UNPKG

@maticoapp/deck.gl-pmtiles

Version:

This repo provides a typed Deck.gl layer and loader for PMTiles data. PMTiles data provides a serverless and compact way to store tile geospatial data. Combined with Deck.gl's rendering, this provides a flexible and powerful way to cheaply manage geospati

1,417 lines (1,399 loc) 460 kB
(() => { var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b ||= {}) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; // node_modules/@babel/runtime/helpers/interopRequireDefault.js var require_interopRequireDefault = __commonJS({ "node_modules/@babel/runtime/helpers/interopRequireDefault.js"(exports, module) { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/defineProperty.js var require_defineProperty = __commonJS({ "node_modules/@babel/runtime/helpers/defineProperty.js"(exports, module) { function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/classCallCheck.js var require_classCallCheck = __commonJS({ "node_modules/@babel/runtime/helpers/classCallCheck.js"(exports, module) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/createClass.js var require_createClass = __commonJS({ "node_modules/@babel/runtime/helpers/createClass.js"(exports, module) { 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); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/typeof.js var require_typeof = __commonJS({ "node_modules/@babel/runtime/helpers/typeof.js"(exports, module) { function _typeof(obj) { "@babel/helpers - typeof"; return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(obj); } module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/setPrototypeOf.js var require_setPrototypeOf = __commonJS({ "node_modules/@babel/runtime/helpers/setPrototypeOf.js"(exports, module) { function _setPrototypeOf(o, p) { module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { o2.__proto__ = p2; return o2; }, module.exports.__esModule = true, module.exports["default"] = module.exports; return _setPrototypeOf(o, p); } module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/inherits.js var require_inherits = __commonJS({ "node_modules/@babel/runtime/helpers/inherits.js"(exports, module) { var setPrototypeOf = require_setPrototypeOf(); 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) setPrototypeOf(subClass, superClass); } module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/assertThisInitialized.js var require_assertThisInitialized = __commonJS({ "node_modules/@babel/runtime/helpers/assertThisInitialized.js"(exports, module) { function _assertThisInitialized(self2) { if (self2 === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self2; } module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/possibleConstructorReturn.js var require_possibleConstructorReturn = __commonJS({ "node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"(exports, module) { var _typeof = require_typeof()["default"]; var assertThisInitialized = require_assertThisInitialized(); function _possibleConstructorReturn(self2, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return assertThisInitialized(self2); } module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@babel/runtime/helpers/getPrototypeOf.js var require_getPrototypeOf = __commonJS({ "node_modules/@babel/runtime/helpers/getPrototypeOf.js"(exports, module) { function _getPrototypeOf(o) { module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { return o2.__proto__ || Object.getPrototypeOf(o2); }, module.exports.__esModule = true, module.exports["default"] = module.exports; return _getPrototypeOf(o); } module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; } }); // node_modules/@math.gl/core/dist/es5/lib/assert.js var require_assert = __commonJS({ "node_modules/@math.gl/core/dist/es5/lib/assert.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = assert; function assert(condition, message) { if (!condition) { throw new Error("math.gl assertion ".concat(message)); } } } }); // node_modules/@math.gl/core/dist/es5/lib/common.js var require_common = __commonJS({ "node_modules/@math.gl/core/dist/es5/lib/common.js"(exports) { "use strict"; var _interopRequireDefault = require_interopRequireDefault(); Object.defineProperty(exports, "__esModule", { value: true }); exports.configure = configure; exports.formatValue = formatValue; exports.isArray = isArray; exports.clone = clone; exports.toRadians = toRadians; exports.toDegrees = toDegrees; 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.exactEquals = exactEquals; exports.withEpsilon = withEpsilon; exports.config = void 0; var _typeof2 = _interopRequireDefault(require_typeof()); var _assert = _interopRequireDefault(require_assert()); var RADIANS_TO_DEGREES = 1 / Math.PI * 180; var DEGREES_TO_RADIANS = 1 / 180 * Math.PI; var config = { EPSILON: 1e-12, debug: false, precision: 4, printTypes: false, printDegrees: false, printRowMajor: true }; exports.config = config; function configure(options) { for (var key in options) { (0, _assert.default)(key in config); config[key] = options[key]; } return config; } function formatValue(value) { var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$precision = _ref.precision, precision = _ref$precision === void 0 ? config.precision : _ref$precision; value = round(value); return "".concat(parseFloat(value.toPrecision(precision))); } function isArray(value) { return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView); } function clone(array) { return "clone" in array ? array.clone() : array.slice(); } function toRadians(degrees2) { return radians(degrees2); } function toDegrees(radians2) { return degrees(radians2); } function radians(degrees2, result) { return map(degrees2, function(degrees3) { return degrees3 * DEGREES_TO_RADIANS; }, result); } function degrees(radians2, result) { return map(radians2, function(radians3) { return radians3 * RADIANS_TO_DEGREES; }, result); } function sin(radians2, result) { return map(radians2, function(angle) { return Math.sin(angle); }, result); } function cos(radians2, result) { return map(radians2, function(angle) { return Math.cos(angle); }, result); } function tan(radians2, result) { return map(radians2, function(angle) { return Math.tan(angle); }, result); } function asin(radians2, result) { return map(radians2, function(angle) { return Math.asin(angle); }, result); } function acos(radians2, result) { return map(radians2, function(angle) { return Math.acos(angle); }, result); } function atan(radians2, result) { return map(radians2, function(angle) { return Math.atan(angle); }, result); } function clamp(value, min, max2) { return map(value, function(value2) { return Math.max(min, Math.min(max2, value2)); }); } 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, epsilon) { var oldEpsilon = config.EPSILON; if (epsilon) { config.EPSILON = epsilon; } try { if (a === b) { return true; } if (isArray(a) && isArray(b)) { 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; } if (a && a.equals) { return a.equals(b); } if (b && b.equals) { return b.equals(a); } if (typeof a === "number" && typeof b === "number") { return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b)); } return false; } finally { config.EPSILON = oldEpsilon; } } function exactEquals(a, b) { if (a === b) { return true; } if (a && (0, _typeof2.default)(a) === "object" && b && (0, _typeof2.default)(b) === "object") { if (a.constructor !== b.constructor) { return false; } if (a.exactEquals) { return a.exactEquals(b); } } if (isArray(a) && isArray(b)) { if (a.length !== b.length) { return false; } for (var i = 0; i < a.length; ++i) { if (!exactEquals(a[i], b[i])) { return false; } } return true; } return false; } function withEpsilon(epsilon, func) { var oldPrecision = config.EPSILON; config.EPSILON = epsilon; var value; try { value = func(); } finally { config.EPSILON = oldPrecision; } return value; } function round(value) { return Math.round(value / config.EPSILON) * config.EPSILON; } function duplicateArray(array) { return array.clone ? array.clone() : new Array(array.length); } function map(value, func, result) { if (isArray(value)) { var array = value; result = result || duplicateArray(array); for (var i = 0; i < result.length && i < array.length; ++i) { result[i] = func(value[i], i, result); } return result; } return func(value); } } }); // node_modules/@math.gl/core/dist/es5/classes/base/math-array.js var require_math_array = __commonJS({ "node_modules/@math.gl/core/dist/es5/classes/base/math-array.js"(exports) { "use strict"; var _interopRequireDefault = require_interopRequireDefault(); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); var _createClass2 = _interopRequireDefault(require_createClass()); var _inherits2 = _interopRequireDefault(require_inherits()); var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn()); var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf()); var _common = require_common(); function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })); return true; } catch (e) { return false; } } function _extendableBuiltin(cls) { function ExtendableBuiltin() { var instance = Reflect.construct(cls, Array.from(arguments)); Object.setPrototypeOf(instance, Object.getPrototypeOf(this)); return instance; } ExtendableBuiltin.prototype = Object.create(cls.prototype, { constructor: { value: cls, enumerable: false, writable: true, configurable: true } }); if (Object.setPrototypeOf) { Object.setPrototypeOf(ExtendableBuiltin, cls); } else { ExtendableBuiltin.__proto__ = cls; } return ExtendableBuiltin; } var MathArray = function(_extendableBuiltin2) { (0, _inherits2.default)(MathArray2, _extendableBuiltin2); var _super = _createSuper(MathArray2); function MathArray2() { (0, _classCallCheck2.default)(this, MathArray2); return _super.apply(this, arguments); } (0, _createClass2.default)(MathArray2, [{ key: "clone", value: function clone() { return new this.constructor().copy(this); } }, { key: "fromArray", value: function fromArray(array) { var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; for (var i = 0; i < this.ELEMENTS; ++i) { this[i] = array[i + offset]; } return this.check(); } }, { key: "toArray", value: function toArray() { var targetArray = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; for (var i = 0; i < this.ELEMENTS; ++i) { targetArray[offset + i] = this[i]; } return targetArray; } }, { key: "from", value: function from(arrayOrObject) { return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject); } }, { key: "to", value: function to(arrayOrObject) { if (arrayOrObject === this) { return this; } return (0, _common.isArray)(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject); } }, { key: "toTarget", value: function toTarget(target) { return target ? this.to(target) : this; } }, { key: "toFloat32Array", value: function toFloat32Array() { return new Float32Array(this); } }, { 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: "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: "lerp", value: function lerp(a, b, t) { if (t === void 0) { return this.lerp(this, a, b); } 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 max2(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: "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, _vectors = vectors; _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, _vectors2 = vectors; _i2 < _vectors2.length; _i2++) { var _vector2 = _vectors2[_i2]; for (var i = 0; i < this.ELEMENTS; ++i) { this[i] -= _vector2[i]; } } return this.check(); } }, { key: "scale", value: function scale(_scale) { if (typeof _scale === "number") { for (var i = 0; i < this.ELEMENTS; ++i) { this[i] *= _scale; } } else { for (var _i3 = 0; _i3 < this.ELEMENTS && _i3 < _scale.length; ++_i3) { this[_i3] *= _scale[_i3]; } } return this.check(); } }, { key: "multiplyByScalar", value: function multiplyByScalar(scalar) { for (var i = 0; i < this.ELEMENTS; ++i) { this[i] *= scalar; } return this.check(); } }, { key: "check", value: function check() { if (_common.config.debug && !this.validate()) { throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'")); } return this; } }, { 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: "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(scalar) { for (var i = 0; i < this.ELEMENTS; ++i) { this[i] *= scalar; } return this.check(); } }, { key: "divideScalar", value: function divideScalar(a) { return this.multiplyByScalar(1 / a); } }, { key: "clampScalar", value: function clampScalar(min, max2) { for (var i = 0; i < this.ELEMENTS; ++i) { this[i] = Math.min(Math.max(this[i], min), max2); } return this.check(); } }, { key: "elements", get: function get() { return this; } }]); return MathArray2; }(_extendableBuiltin(Array)); exports.default = MathArray; } }); // node_modules/@math.gl/core/dist/es5/lib/validators.js var require_validators = __commonJS({ "node_modules/@math.gl/core/dist/es5/lib/validators.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateVector = validateVector; exports.checkNumber = checkNumber; exports.checkVector = checkVector; exports.deprecated = deprecated; var _common = require_common(); function validateVector(v, length) { if (v.length !== length) { return false; } for (var i = 0; i < v.length; ++i) { if (!Number.isFinite(v[i])) { return false; } } return true; } function checkNumber(value) { if (!Number.isFinite(value)) { throw new Error("Invalid number ".concat(value)); } return value; } function checkVector(v, length) { var callerName = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ""; if (_common.config.debug && !validateVector(v, length)) { throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'")); } return v; } var map = {}; function deprecated(method, version) { if (!map[method]) { map[method] = true; console.warn("".concat(method, " has been removed in version ").concat(version, ", see upgrade guide for more information")); } } } }); // node_modules/@math.gl/core/dist/es5/classes/base/vector.js var require_vector = __commonJS({ "node_modules/@math.gl/core/dist/es5/classes/base/vector.js"(exports) { "use strict"; var _interopRequireDefault = require_interopRequireDefault(); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); var _createClass2 = _interopRequireDefault(require_createClass()); var _inherits2 = _interopRequireDefault(require_inherits()); var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn()); var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf()); var _mathArray = _interopRequireDefault(require_math_array()); var _validators = require_validators(); var _assert = _interopRequireDefault(require_assert()); function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })); return true; } catch (e) { return false; } } var Vector = function(_MathArray) { (0, _inherits2.default)(Vector2, _MathArray); var _super = _createSuper(Vector2); function Vector2() { (0, _classCallCheck2.default)(this, Vector2); return _super.apply(this, arguments); } (0, _createClass2.default)(Vector2, [{ key: "x", get: function get() { return this[0]; }, set: function set(value) { this[0] = (0, _validators.checkNumber)(value); } }, { key: "y", get: function get() { return this[1]; }, set: function set(value) { this[1] = (0, _validators.checkNumber)(value); } }, { key: "len", value: function len() { return Math.sqrt(this.lengthSquared()); } }, { key: "magnitude", value: function magnitude() { return this.len(); } }, { key: "lengthSquared", value: function lengthSquared() { var length = 0; for (var i = 0; i < this.ELEMENTS; ++i) { length += this[i] * this[i]; } return length; } }, { key: "magnitudeSquared", value: function magnitudeSquared() { return this.lengthSquared(); } }, { 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, _validators.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, _validators.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: "multiply", value: function multiply() { for (var _len = arguments.length, vectors = new Array(_len), _key = 0; _key < _len; _key++) { vectors[_key] = arguments[_key]; } for (var _i = 0, _vectors = vectors; _i < _vectors.length; _i++) { var vector = _vectors[_i]; for (var i = 0; i < this.ELEMENTS; ++i) { this[i] *= vector[i]; } } return this.check(); } }, { key: "divide", value: function divide() { for (var _len2 = arguments.length, vectors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { vectors[_key2] = arguments[_key2]; } for (var _i2 = 0, _vectors2 = vectors; _i2 < _vectors2.length; _i2++) { var vector = _vectors2[_i2]; for (var i = 0; i < this.ELEMENTS; ++i) { this[i] /= 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) { (0, _assert.default)(i >= 0 && i < this.ELEMENTS, "index is out of range"); return (0, _validators.checkNumber)(this[i]); } }, { key: "setComponent", value: function setComponent(i, value) { (0, _assert.default)(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)); } }]); return Vector2; }(_mathArray.default); exports.default = Vector; } }); // node_modules/gl-matrix/cjs/common.js var require_common2 = __commonJS({ "node_modules/gl-matrix/cjs/common.js"(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; var EPSILON = 1e-6; exports.EPSILON = EPSILON; var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; exports.ARRAY_TYPE = ARRAY_TYPE; var RANDOM = Math.random; exports.RANDOM = RANDOM; function setMatrixArrayType(type) { exports.ARRAY_TYPE = ARRAY_TYPE = type; } var degree = Math.PI / 180; function toRadian(a) { return a * degree; } function equals(a, b) { return Math.abs(a - b) <= EPSILON * Math.max(1, 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); }; } }); // node_modules/gl-matrix/cjs/vec2.js var require_vec2 = __commonJS({ "node_modules/gl-matrix/cjs/vec2.js"(exports) { "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof2(obj2) { return typeof obj2; }; } else { _typeof = function _typeof2(obj2) { return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }; } return _typeof(obj); } 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 = max2; 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_common2()); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = /* @__PURE__ */ new WeakMap(); var cacheNodeInterop = /* @__PURE__ */ new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) { return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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 create() { var out = new glMatrix.ARRAY_TYPE(2); if (glMatrix.ARRAY_TYPE != Float32Array) { out[0] = 0; out[1] = 0; } return out; } function clone(a) { var out = new glMatrix.ARRAY_TYPE(2); out[0] = a[0]; out[1] = a[1]; return out; } function fromValues(x, y) { var out = new glMatrix.ARRAY_TYPE(2); out[0] = x; out[1] = y; return out; } function copy(out, a) { out[0] = a[0]; out[1] = a[1]; return out; } function set(out, x, y) { out[0] = x; out[1] = y; return out; } function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; return out; } function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; return out; } function multiply(out, a, b) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; return out; } function divide(out, a, b) { out[0] = a[0] / b[0]; out[1] = a[1] / b[1]; return out; } function ceil(out, a) { out[0] = Math.ceil(a[0]); out[1] = Math.ceil(a[1]); return out; } function floor(out, a) { out[0] = Math.floor(a[0]); out[1] = Math.floor(a[1]); return out; } function min(out, a, b) { out[0] = Math.min(a[0], b[0]); out[1] = Math.min(a[1], b[1]); return out; } function max2(out, a, b) { out[0] = Math.max(a[0], b[0]); out[1] = Math.max(a[1], b[1]); return out; } function round(out, a) { out[0] = Math.round(a[0]); out[1] = Math.round(a[1]); return out; } function scale(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; return out; } function scaleAndAdd(out, a, b, scale2) { out[0] = a[0] + b[0] * scale2; out[1] = a[1] + b[1] * scale2; return out; } function distance(a, b) { var x = b[0] - a[0], y = b[1] - a[1]; return Math.hypot(x, y); } function squaredDistance(a, b) { var x = b[0] - a[0], y = b[1] - a[1]; return x * x + y * y; } function length(a) { var x = a[0], y = a[1]; return Math.hypot(x, y); } function squaredLength(a) { var x = a[0], y = a[1]; return x * x + y * y; } function negate(out, a) { out[0] = -a[0]; out[1] = -a[1]; return out; } function inverse(out, a) { out[0] = 1 / a[0]; out[1] = 1 / a[1]; return out; } function normalize(out, a) { var x = a[0], y = a[1]; var len2 = x * x + y * y; if (len2 > 0) { len2 = 1 / Math.sqrt(len2); } out[0] = a[0] * len2; out[1] = a[1] * len2; return out; } function dot(a, b) { return a[0] * b[0] + a[1] * b[1]; } 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; } 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; } function random(out, scale2) { scale2 = scale2 || 1; var r = glMatrix.RANDOM() * 2 * Math.PI; out[0] = Math.cos(r) * scale2; out[1] = Math.sin(r) * scale2; return 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; } 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; } 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; } 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; } function rotate(out, a, b, rad) { var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad); out[0] = p0 * cosC - p1 * sinC + b[0]; out[1] = p0 * sinC + p1 * cosC + b[1]; return out; } function angle(a, b) { var x1 = a[0], y1 = a[1], x2 = b[0], y2 = b[1], mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), cosine = mag && (x1 * x2 + y1 * y2) / mag; return Math.acos(Math.min(Math.max(cosine, -1), 1)); } function zero(out) { out[0] = 0; out[1] = 0; return out; } function str(a) { return "vec2(" + a[0] + ", " + a[1] + ")"; } function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1]; } 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, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); } var len = length; exports.len = len; var sub = subtract; exports.sub = sub; var mul = multiply; exports.mul = mul; var div = divide; exports.div = div; var dist = distance; exports.dist = dist; var sqrDist = squaredDistance; exports.sqrDist = sqrDist; var sqrLen = squaredLength; 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; } }); // node_modules/@math.gl/core/dist/es5/lib/gl-matrix-extras.js var require_gl_matrix_extras = __commonJS({ "node_modules/@math.gl/core/dist/es5/lib/gl-matrix-extras.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.vec2_transformMat4AsVector = vec2_transformMat4AsVector; exports.vec3_transformMat4AsVector