mirror of
https://github.com/w3reality/three-geo.git
synced 2026-01-25 14:57:51 +00:00
959 lines
733 KiB
JavaScript
959 lines
733 KiB
JavaScript
/*
|
||
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
||
* This devtool is neither made for production nor for readable output files.
|
||
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
||
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
||
* or disable the default devtool with "devtool: false".
|
||
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
||
*/
|
||
(function webpackUniversalModuleDefinition(root, factory) {
|
||
if(typeof exports === 'object' && typeof module === 'object')
|
||
module.exports = factory(require("THREE"));
|
||
else if(typeof define === 'function' && define.amd)
|
||
define(["THREE"], factory);
|
||
else if(typeof exports === 'object')
|
||
exports["ThreeGeo"] = factory(require("THREE"));
|
||
else
|
||
root["ThreeGeo"] = factory(root["THREE"]);
|
||
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_three__) {
|
||
return /******/ (() => { // webpackBootstrap
|
||
/******/ var __webpack_modules__ = ({
|
||
|
||
/***/ "./node_modules/@mapbox/point-geometry/index.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@mapbox/point-geometry/index.js ***!
|
||
\******************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\nmodule.exports = Point;\n\n/**\n * A standalone point geometry with useful accessor, comparison, and\n * modification methods.\n *\n * @class Point\n * @param {Number} x the x-coordinate. this could be longitude or screen\n * pixels, or any other sort of unit.\n * @param {Number} y the y-coordinate. this could be latitude or screen\n * pixels, or any other sort of unit.\n * @example\n * var point = new Point(-77, 38);\n */\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n}\n\nPoint.prototype = {\n\n /**\n * Clone this point, returning a new point that can be modified\n * without affecting the old one.\n * @return {Point} the clone\n */\n clone: function() { return new Point(this.x, this.y); },\n\n /**\n * Add this point's x & y coordinates to another point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n add: function(p) { return this.clone()._add(p); },\n\n /**\n * Subtract this point's x & y coordinates to from point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n sub: function(p) { return this.clone()._sub(p); },\n\n /**\n * Multiply this point's x & y coordinates by point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n multByPoint: function(p) { return this.clone()._multByPoint(p); },\n\n /**\n * Divide this point's x & y coordinates by point,\n * yielding a new point.\n * @param {Point} p the other point\n * @return {Point} output point\n */\n divByPoint: function(p) { return this.clone()._divByPoint(p); },\n\n /**\n * Multiply this point's x & y coordinates by a factor,\n * yielding a new point.\n * @param {Point} k factor\n * @return {Point} output point\n */\n mult: function(k) { return this.clone()._mult(k); },\n\n /**\n * Divide this point's x & y coordinates by a factor,\n * yielding a new point.\n * @param {Point} k factor\n * @return {Point} output point\n */\n div: function(k) { return this.clone()._div(k); },\n\n /**\n * Rotate this point around the 0, 0 origin by an angle a,\n * given in radians\n * @param {Number} a angle to rotate around, in radians\n * @return {Point} output point\n */\n rotate: function(a) { return this.clone()._rotate(a); },\n\n /**\n * Rotate this point around p point by an angle a,\n * given in radians\n * @param {Number} a angle to rotate around, in radians\n * @param {Point} p Point to rotate around\n * @return {Point} output point\n */\n rotateAround: function(a,p) { return this.clone()._rotateAround(a,p); },\n\n /**\n * Multiply this point by a 4x1 transformation matrix\n * @param {Array<Number>} m transformation matrix\n * @return {Point} output point\n */\n matMult: function(m) { return this.clone()._matMult(m); },\n\n /**\n * Calculate this point but as a unit vector from 0, 0, meaning\n * that the distance from the resulting point to the 0, 0\n * coordinate will be equal to 1 and the angle from the resulting\n * point to the 0, 0 coordinate will be the same as before.\n * @return {Point} unit vector point\n */\n unit: function() { return this.clone()._unit(); },\n\n /**\n * Compute a perpendicular point, where the new y coordinate\n * is the old x coordinate and the new x coordinate is the old y\n * coordinate multiplied by -1\n * @return {Point} perpendicular point\n */\n perp: function() { return this.clone()._perp(); },\n\n /**\n * Return a version of this point with the x & y coordinates\n * rounded to integers.\n * @return {Point} rounded point\n */\n round: function() { return this.clone()._round(); },\n\n /**\n * Return the magitude of this point: this is the Euclidean\n * distance from the 0, 0 coordinate to this point's x and y\n * coordinates.\n * @return {Number} magnitude\n */\n mag: function() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n },\n\n /**\n * Judge whether this point is equal to another point, returning\n * true or false.\n * @param {Point} other the other point\n * @return {boolean} whether the points are equal\n */\n equals: function(other) {\n return this.x === other.x &&\n this.y === other.y;\n },\n\n /**\n * Calculate the distance from this point to another point\n * @param {Point} p the other point\n * @return {Number} distance\n */\n dist: function(p) {\n return Math.sqrt(this.distSqr(p));\n },\n\n /**\n * Calculate the distance from this point to another point,\n * without the square root step. Useful if you're comparing\n * relative distances.\n * @param {Point} p the other point\n * @return {Number} distance\n */\n distSqr: function(p) {\n var dx = p.x - this.x,\n dy = p.y - this.y;\n return dx * dx + dy * dy;\n },\n\n /**\n * Get the angle from the 0, 0 coordinate to this point, in radians\n * coordinates.\n * @return {Number} angle\n */\n angle: function() {\n return Math.atan2(this.y, this.x);\n },\n\n /**\n * Get the angle from this point to another point, in radians\n * @param {Point} b the other point\n * @return {Number} angle\n */\n angleTo: function(b) {\n return Math.atan2(this.y - b.y, this.x - b.x);\n },\n\n /**\n * Get the angle between this point and another point, in radians\n * @param {Point} b the other point\n * @return {Number} angle\n */\n angleWith: function(b) {\n return this.angleWithSep(b.x, b.y);\n },\n\n /*\n * Find the angle of the two vectors, solving the formula for\n * the cross product a x b = |a||b|sin(θ) for θ.\n * @param {Number} x the x-coordinate\n * @param {Number} y the y-coordinate\n * @return {Number} the angle in radians\n */\n angleWithSep: function(x, y) {\n return Math.atan2(\n this.x * y - this.y * x,\n this.x * x + this.y * y);\n },\n\n _matMult: function(m) {\n var x = m[0] * this.x + m[1] * this.y,\n y = m[2] * this.x + m[3] * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n\n _add: function(p) {\n this.x += p.x;\n this.y += p.y;\n return this;\n },\n\n _sub: function(p) {\n this.x -= p.x;\n this.y -= p.y;\n return this;\n },\n\n _mult: function(k) {\n this.x *= k;\n this.y *= k;\n return this;\n },\n\n _div: function(k) {\n this.x /= k;\n this.y /= k;\n return this;\n },\n\n _multByPoint: function(p) {\n this.x *= p.x;\n this.y *= p.y;\n return this;\n },\n\n _divByPoint: function(p) {\n this.x /= p.x;\n this.y /= p.y;\n return this;\n },\n\n _unit: function() {\n this._div(this.mag());\n return this;\n },\n\n _perp: function() {\n var y = this.y;\n this.y = this.x;\n this.x = -y;\n return this;\n },\n\n _rotate: function(angle) {\n var cos = Math.cos(angle),\n sin = Math.sin(angle),\n x = cos * this.x - sin * this.y,\n y = sin * this.x + cos * this.y;\n this.x = x;\n this.y = y;\n return this;\n },\n\n _rotateAround: function(angle, p) {\n var cos = Math.cos(angle),\n sin = Math.sin(angle),\n x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),\n y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);\n this.x = x;\n this.y = y;\n return this;\n },\n\n _round: function() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n }\n};\n\n/**\n * Construct a point from an array if necessary, otherwise if the input\n * is already a Point, or an unknown type, return it unchanged\n * @param {Array<Number>|Point|*} a any kind of input value\n * @return {Point} constructed point, or passed-through value.\n * @example\n * // this\n * var point = Point.convert([0, 1]);\n * // is equivalent to\n * var point = new Point(0, 1);\n */\nPoint.convert = function (a) {\n if (a instanceof Point) {\n return a;\n }\n if (Array.isArray(a)) {\n return new Point(a[0], a[1]);\n }\n return a;\n};\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@mapbox/point-geometry/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@mapbox/sphericalmercator/sphericalmercator.js":
|
||
/*!*********************************************************************!*\
|
||
!*** ./node_modules/@mapbox/sphericalmercator/sphericalmercator.js ***!
|
||
\*********************************************************************/
|
||
/***/ ((module, exports) => {
|
||
|
||
eval("var SphericalMercator = (function(){\n\n// Closures including constants and other precalculated values.\nvar cache = {},\n EPSLN = 1.0e-10,\n D2R = Math.PI / 180,\n R2D = 180 / Math.PI,\n // 900913 properties.\n A = 6378137.0,\n MAXEXTENT = 20037508.342789244;\n\nfunction isFloat(n){\n return Number(n) === n && n % 1 !== 0;\n}\n\n// SphericalMercator constructor: precaches calculations\n// for fast tile lookups.\nfunction SphericalMercator(options) {\n options = options || {};\n this.size = options.size || 256;\n this.expansion = (options.antimeridian === true) ? 2 : 1;\n if (!cache[this.size]) {\n var size = this.size;\n var c = cache[this.size] = {};\n c.Bc = [];\n c.Cc = [];\n c.zc = [];\n c.Ac = [];\n for (var d = 0; d < 30; d++) {\n c.Bc.push(size / 360);\n c.Cc.push(size / (2 * Math.PI));\n c.zc.push(size / 2);\n c.Ac.push(size);\n size *= 2;\n }\n }\n this.Bc = cache[this.size].Bc;\n this.Cc = cache[this.size].Cc;\n this.zc = cache[this.size].zc;\n this.Ac = cache[this.size].Ac;\n};\n\n// Convert lon lat to screen pixel value\n//\n// - `ll` {Array} `[lon, lat]` array of geographic coordinates.\n// - `zoom` {Number} zoom level.\nSphericalMercator.prototype.px = function(ll, zoom) {\n if (isFloat(zoom)) {\n var size = this.size * Math.pow(2, zoom);\n var d = size / 2;\n var bc = (size / 360);\n var cc = (size / (2 * Math.PI));\n var ac = size;\n var f = Math.min(Math.max(Math.sin(D2R * ll[1]), -0.9999), 0.9999);\n var x = d + ll[0] * bc;\n var y = d + 0.5 * Math.log((1 + f) / (1 - f)) * -cc;\n (x > ac * this.expansion) && (x = ac * this.expansion);\n (y > ac) && (y = ac);\n //(x < 0) && (x = 0);\n //(y < 0) && (y = 0);\n return [x, y];\n } else {\n var d = this.zc[zoom];\n var f = Math.min(Math.max(Math.sin(D2R * ll[1]), -0.9999), 0.9999);\n var x = Math.round(d + ll[0] * this.Bc[zoom]);\n var y = Math.round(d + 0.5 * Math.log((1 + f) / (1 - f)) * (-this.Cc[zoom]));\n (x > this.Ac[zoom] * this.expansion) && (x = this.Ac[zoom] * this.expansion);\n (y > this.Ac[zoom]) && (y = this.Ac[zoom]);\n //(x < 0) && (x = 0);\n //(y < 0) && (y = 0);\n return [x, y];\n }\n};\n\n// Convert screen pixel value to lon lat\n//\n// - `px` {Array} `[x, y]` array of geographic coordinates.\n// - `zoom` {Number} zoom level.\nSphericalMercator.prototype.ll = function(px, zoom) {\n if (isFloat(zoom)) {\n var size = this.size * Math.pow(2, zoom);\n var bc = (size / 360);\n var cc = (size / (2 * Math.PI));\n var zc = size / 2;\n var g = (px[1] - zc) / -cc;\n var lon = (px[0] - zc) / bc;\n var lat = R2D * (2 * Math.atan(Math.exp(g)) - 0.5 * Math.PI);\n return [lon, lat];\n } else {\n var g = (px[1] - this.zc[zoom]) / (-this.Cc[zoom]);\n var lon = (px[0] - this.zc[zoom]) / this.Bc[zoom];\n var lat = R2D * (2 * Math.atan(Math.exp(g)) - 0.5 * Math.PI);\n return [lon, lat];\n }\n};\n\n// Convert tile xyz value to bbox of the form `[w, s, e, n]`\n//\n// - `x` {Number} x (longitude) number.\n// - `y` {Number} y (latitude) number.\n// - `zoom` {Number} zoom.\n// - `tms_style` {Boolean} whether to compute using tms-style.\n// - `srs` {String} projection for resulting bbox (WGS84|900913).\n// - `return` {Array} bbox array of values in form `[w, s, e, n]`.\nSphericalMercator.prototype.bbox = function(x, y, zoom, tms_style, srs) {\n // Convert xyz into bbox with srs WGS84\n if (tms_style) {\n y = (Math.pow(2, zoom) - 1) - y;\n }\n // Use +y to make sure it's a number to avoid inadvertent concatenation.\n var ll = [x * this.size, (+y + 1) * this.size]; // lower left\n // Use +x to make sure it's a number to avoid inadvertent concatenation.\n var ur = [(+x + 1) * this.size, y * this.size]; // upper right\n var bbox = this.ll(ll, zoom).concat(this.ll(ur, zoom));\n\n // If web mercator requested reproject to 900913.\n if (srs === '900913') {\n return this.convert(bbox, '900913');\n } else {\n return bbox;\n }\n};\n\n// Convert bbox to xyx bounds\n//\n// - `bbox` {Number} bbox in the form `[w, s, e, n]`.\n// - `zoom` {Number} zoom.\n// - `tms_style` {Boolean} whether to compute using tms-style.\n// - `srs` {String} projection of input bbox (WGS84|900913).\n// - `@return` {Object} XYZ bounds containing minX, maxX, minY, maxY properties.\nSphericalMercator.prototype.xyz = function(bbox, zoom, tms_style, srs) {\n // If web mercator provided reproject to WGS84.\n if (srs === '900913') {\n bbox = this.convert(bbox, 'WGS84');\n }\n\n var ll = [bbox[0], bbox[1]]; // lower left\n var ur = [bbox[2], bbox[3]]; // upper right\n var px_ll = this.px(ll, zoom);\n var px_ur = this.px(ur, zoom);\n // Y = 0 for XYZ is the top hence minY uses px_ur[1].\n var x = [ Math.floor(px_ll[0] / this.size), Math.floor((px_ur[0] - 1) / this.size) ];\n var y = [ Math.floor(px_ur[1] / this.size), Math.floor((px_ll[1] - 1) / this.size) ];\n var bounds = {\n minX: Math.min.apply(Math, x) < 0 ? 0 : Math.min.apply(Math, x),\n minY: Math.min.apply(Math, y) < 0 ? 0 : Math.min.apply(Math, y),\n maxX: Math.max.apply(Math, x),\n maxY: Math.max.apply(Math, y)\n };\n if (tms_style) {\n var tms = {\n minY: (Math.pow(2, zoom) - 1) - bounds.maxY,\n maxY: (Math.pow(2, zoom) - 1) - bounds.minY\n };\n bounds.minY = tms.minY;\n bounds.maxY = tms.maxY;\n }\n return bounds;\n};\n\n// Convert projection of given bbox.\n//\n// - `bbox` {Number} bbox in the form `[w, s, e, n]`.\n// - `to` {String} projection of output bbox (WGS84|900913). Input bbox\n// assumed to be the \"other\" projection.\n// - `@return` {Object} bbox with reprojected coordinates.\nSphericalMercator.prototype.convert = function(bbox, to) {\n if (to === '900913') {\n return this.forward(bbox.slice(0, 2)).concat(this.forward(bbox.slice(2,4)));\n } else {\n return this.inverse(bbox.slice(0, 2)).concat(this.inverse(bbox.slice(2,4)));\n }\n};\n\n// Convert lon/lat values to 900913 x/y.\nSphericalMercator.prototype.forward = function(ll) {\n var xy = [\n A * ll[0] * D2R,\n A * Math.log(Math.tan((Math.PI*0.25) + (0.5 * ll[1] * D2R)))\n ];\n // if xy value is beyond maxextent (e.g. poles), return maxextent.\n (xy[0] > MAXEXTENT) && (xy[0] = MAXEXTENT);\n (xy[0] < -MAXEXTENT) && (xy[0] = -MAXEXTENT);\n (xy[1] > MAXEXTENT) && (xy[1] = MAXEXTENT);\n (xy[1] < -MAXEXTENT) && (xy[1] = -MAXEXTENT);\n return xy;\n};\n\n// Convert 900913 x/y values to lon/lat.\nSphericalMercator.prototype.inverse = function(xy) {\n return [\n (xy[0] * R2D / A),\n ((Math.PI*0.5) - 2.0 * Math.atan(Math.exp(-xy[1] / A))) * R2D\n ];\n};\n\nreturn SphericalMercator;\n\n})();\n\nif (true) {\n module.exports = exports = SphericalMercator;\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@mapbox/sphericalmercator/sphericalmercator.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@mapbox/tile-cover/index.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@mapbox/tile-cover/index.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar tilebelt = __webpack_require__(/*! @mapbox/tilebelt */ \"./node_modules/@mapbox/tilebelt/index.js\");\n\n/**\n * Given a geometry, create cells and return them in a format easily readable\n * by any software that reads GeoJSON.\n *\n * @alias geojson\n * @param {Object} geom GeoJSON geometry\n * @param {Object} limits an object with min_zoom and max_zoom properties\n * specifying the minimum and maximum level to be tiled.\n * @returns {Object} FeatureCollection of cells formatted as GeoJSON Features\n */\nexports.geojson = function (geom, limits) {\n return {\n type: 'FeatureCollection',\n features: getTiles(geom, limits).map(tileToFeature)\n };\n};\n\nfunction tileToFeature(t) {\n return {\n type: 'Feature',\n geometry: tilebelt.tileToGeoJSON(t),\n properties: {}\n };\n}\n\n/**\n * Given a geometry, create cells and return them in their raw form,\n * as an array of cell identifiers.\n *\n * @alias tiles\n * @param {Object} geom GeoJSON geometry\n * @param {Object} limits an object with min_zoom and max_zoom properties\n * specifying the minimum and maximum level to be tiled.\n * @returns {Array<Array<number>>} An array of tiles given as [x, y, z] arrays\n */\nexports.tiles = getTiles;\n\n/**\n * Given a geometry, create cells and return them as\n * [quadkey](http://msdn.microsoft.com/en-us/library/bb259689.aspx) indexes.\n *\n * @alias indexes\n * @param {Object} geom GeoJSON geometry\n * @param {Object} limits an object with min_zoom and max_zoom properties\n * specifying the minimum and maximum level to be tiled.\n * @returns {Array<String>} An array of tiles given as quadkeys.\n */\nexports.indexes = function (geom, limits) {\n return getTiles(geom, limits).map(tilebelt.tileToQuadkey);\n};\n\nfunction getTiles(geom, limits) {\n var i, tile,\n coords = geom.coordinates,\n maxZoom = limits.max_zoom,\n tileHash = {},\n tiles = [];\n\n if (geom.type === 'Point') {\n return [tilebelt.pointToTile(coords[0], coords[1], maxZoom)];\n\n } else if (geom.type === 'MultiPoint') {\n for (i = 0; i < coords.length; i++) {\n tile = tilebelt.pointToTile(coords[i][0], coords[i][1], maxZoom);\n tileHash[toID(tile[0], tile[1], tile[2])] = true;\n }\n } else if (geom.type === 'LineString') {\n lineCover(tileHash, coords, maxZoom);\n\n } else if (geom.type === 'MultiLineString') {\n for (i = 0; i < coords.length; i++) {\n lineCover(tileHash, coords[i], maxZoom);\n }\n } else if (geom.type === 'Polygon') {\n polygonCover(tileHash, tiles, coords, maxZoom);\n\n } else if (geom.type === 'MultiPolygon') {\n for (i = 0; i < coords.length; i++) {\n polygonCover(tileHash, tiles, coords[i], maxZoom);\n }\n } else {\n throw new Error('Geometry type not implemented');\n }\n\n if (limits.min_zoom !== maxZoom) {\n // sync tile hash and tile array so that both contain the same tiles\n var len = tiles.length;\n appendHashTiles(tileHash, tiles);\n for (i = 0; i < len; i++) {\n var t = tiles[i];\n tileHash[toID(t[0], t[1], t[2])] = true;\n }\n return mergeTiles(tileHash, tiles, limits);\n }\n\n appendHashTiles(tileHash, tiles);\n return tiles;\n}\n\nfunction mergeTiles(tileHash, tiles, limits) {\n var mergedTiles = [];\n\n for (var z = limits.max_zoom; z > limits.min_zoom; z--) {\n\n var parentTileHash = {};\n var parentTiles = [];\n\n for (var i = 0; i < tiles.length; i++) {\n var t = tiles[i];\n\n if (t[0] % 2 === 0 && t[1] % 2 === 0) {\n var id2 = toID(t[0] + 1, t[1], z),\n id3 = toID(t[0], t[1] + 1, z),\n id4 = toID(t[0] + 1, t[1] + 1, z);\n\n if (tileHash[id2] && tileHash[id3] && tileHash[id4]) {\n tileHash[toID(t[0], t[1], t[2])] = false;\n tileHash[id2] = false;\n tileHash[id3] = false;\n tileHash[id4] = false;\n\n var parentTile = [t[0] / 2, t[1] / 2, z - 1];\n\n if (z - 1 === limits.min_zoom) mergedTiles.push(parentTile);\n else {\n parentTileHash[toID(t[0] / 2, t[1] / 2, z - 1)] = true;\n parentTiles.push(parentTile);\n }\n }\n }\n }\n\n for (i = 0; i < tiles.length; i++) {\n t = tiles[i];\n if (tileHash[toID(t[0], t[1], t[2])]) mergedTiles.push(t);\n }\n\n tileHash = parentTileHash;\n tiles = parentTiles;\n }\n\n return mergedTiles;\n}\n\nfunction polygonCover(tileHash, tileArray, geom, zoom) {\n var intersections = [];\n\n for (var i = 0; i < geom.length; i++) {\n var ring = [];\n lineCover(tileHash, geom[i], zoom, ring);\n\n for (var j = 0, len = ring.length, k = len - 1; j < len; k = j++) {\n var m = (j + 1) % len;\n var y = ring[j][1];\n\n // add interesction if it's not local extremum or duplicate\n if ((y > ring[k][1] || y > ring[m][1]) && // not local minimum\n (y < ring[k][1] || y < ring[m][1]) && // not local maximum\n y !== ring[m][1]) intersections.push(ring[j]);\n }\n }\n\n intersections.sort(compareTiles); // sort by y, then x\n\n for (i = 0; i < intersections.length; i += 2) {\n // fill tiles between pairs of intersections\n y = intersections[i][1];\n for (var x = intersections[i][0] + 1; x < intersections[i + 1][0]; x++) {\n var id = toID(x, y, zoom);\n if (!tileHash[id]) {\n tileArray.push([x, y, zoom]);\n }\n }\n }\n}\n\nfunction compareTiles(a, b) {\n return (a[1] - b[1]) || (a[0] - b[0]);\n}\n\nfunction lineCover(tileHash, coords, maxZoom, ring) {\n var prevX, prevY;\n\n for (var i = 0; i < coords.length - 1; i++) {\n var start = tilebelt.pointToTileFraction(coords[i][0], coords[i][1], maxZoom),\n stop = tilebelt.pointToTileFraction(coords[i + 1][0], coords[i + 1][1], maxZoom),\n x0 = start[0],\n y0 = start[1],\n x1 = stop[0],\n y1 = stop[1],\n dx = x1 - x0,\n dy = y1 - y0;\n\n if (dy === 0 && dx === 0) continue;\n\n var sx = dx > 0 ? 1 : -1,\n sy = dy > 0 ? 1 : -1,\n x = Math.floor(x0),\n y = Math.floor(y0),\n tMaxX = dx === 0 ? Infinity : Math.abs(((dx > 0 ? 1 : 0) + x - x0) / dx),\n tMaxY = dy === 0 ? Infinity : Math.abs(((dy > 0 ? 1 : 0) + y - y0) / dy),\n tdx = Math.abs(sx / dx),\n tdy = Math.abs(sy / dy);\n\n if (x !== prevX || y !== prevY) {\n tileHash[toID(x, y, maxZoom)] = true;\n if (ring && y !== prevY) ring.push([x, y]);\n prevX = x;\n prevY = y;\n }\n\n while (tMaxX < 1 || tMaxY < 1) {\n if (tMaxX < tMaxY) {\n tMaxX += tdx;\n x += sx;\n } else {\n tMaxY += tdy;\n y += sy;\n }\n tileHash[toID(x, y, maxZoom)] = true;\n if (ring && y !== prevY) ring.push([x, y]);\n prevX = x;\n prevY = y;\n }\n }\n\n if (ring && y === ring[0][1]) ring.pop();\n}\n\nfunction appendHashTiles(hash, tiles) {\n var keys = Object.keys(hash);\n for (var i = 0; i < keys.length; i++) {\n tiles.push(fromID(+keys[i]));\n }\n}\n\nfunction toID(x, y, z) {\n var dim = 2 * (1 << z);\n return ((dim * y + x) * 32) + z;\n}\n\nfunction fromID(id) {\n var z = id % 32,\n dim = 2 * (1 << z),\n xy = ((id - z) / 32),\n x = xy % dim,\n y = ((xy - x) / dim) % dim;\n return [x, y, z];\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@mapbox/tile-cover/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@mapbox/tilebelt/index.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@mapbox/tilebelt/index.js ***!
|
||
\************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar d2r = Math.PI / 180,\n r2d = 180 / Math.PI;\n\n/**\n * Get the bbox of a tile\n *\n * @name tileToBBOX\n * @param {Array<number>} tile\n * @returns {Array<number>} bbox\n * @example\n * var bbox = tileToBBOX([5, 10, 10])\n * //=bbox\n */\nfunction tileToBBOX(tile) {\n var e = tile2lon(tile[0] + 1, tile[2]);\n var w = tile2lon(tile[0], tile[2]);\n var s = tile2lat(tile[1] + 1, tile[2]);\n var n = tile2lat(tile[1], tile[2]);\n return [w, s, e, n];\n}\n\n/**\n * Get a geojson representation of a tile\n *\n * @name tileToGeoJSON\n * @param {Array<number>} tile\n * @returns {Feature<Polygon>}\n * @example\n * var poly = tileToGeoJSON([5, 10, 10])\n * //=poly\n */\nfunction tileToGeoJSON(tile) {\n var bbox = tileToBBOX(tile);\n var poly = {\n type: 'Polygon',\n coordinates: [[\n [bbox[0], bbox[3]],\n [bbox[0], bbox[1]],\n [bbox[2], bbox[1]],\n [bbox[2], bbox[3]],\n [bbox[0], bbox[3]]\n ]]\n };\n return poly;\n}\n\nfunction tile2lon(x, z) {\n return x / Math.pow(2, z) * 360 - 180;\n}\n\nfunction tile2lat(y, z) {\n var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n}\n\n/**\n * Get the tile for a point at a specified zoom level\n *\n * @name pointToTile\n * @param {number} lon\n * @param {number} lat\n * @param {number} z\n * @returns {Array<number>} tile\n * @example\n * var tile = pointToTile(1, 1, 20)\n * //=tile\n */\nfunction pointToTile(lon, lat, z) {\n var tile = pointToTileFraction(lon, lat, z);\n tile[0] = Math.floor(tile[0]);\n tile[1] = Math.floor(tile[1]);\n return tile;\n}\n\n/**\n * Get the 4 tiles one zoom level higher\n *\n * @name getChildren\n * @param {Array<number>} tile\n * @returns {Array<Array<number>>} tiles\n * @example\n * var tiles = getChildren([5, 10, 10])\n * //=tiles\n */\nfunction getChildren(tile) {\n return [\n [tile[0] * 2, tile[1] * 2, tile[2] + 1],\n [tile[0] * 2 + 1, tile[1] * 2, tile[2 ] + 1],\n [tile[0] * 2 + 1, tile[1] * 2 + 1, tile[2] + 1],\n [tile[0] * 2, tile[1] * 2 + 1, tile[2] + 1]\n ];\n}\n\n/**\n * Get the tile one zoom level lower\n *\n * @name getParent\n * @param {Array<number>} tile\n * @returns {Array<number>} tile\n * @example\n * var tile = getParent([5, 10, 10])\n * //=tile\n */\nfunction getParent(tile) {\n return [tile[0] >> 1, tile[1] >> 1, tile[2] - 1];\n}\n\nfunction getSiblings(tile) {\n return getChildren(getParent(tile));\n}\n\n/**\n * Get the 3 sibling tiles for a tile\n *\n * @name getSiblings\n * @param {Array<number>} tile\n * @returns {Array<Array<number>>} tiles\n * @example\n * var tiles = getSiblings([5, 10, 10])\n * //=tiles\n */\nfunction hasSiblings(tile, tiles) {\n var siblings = getSiblings(tile);\n for (var i = 0; i < siblings.length; i++) {\n if (!hasTile(tiles, siblings[i])) return false;\n }\n return true;\n}\n\n/**\n * Check to see if an array of tiles contains a particular tile\n *\n * @name hasTile\n * @param {Array<Array<number>>} tiles\n * @param {Array<number>} tile\n * @returns {boolean}\n * @example\n * var tiles = [\n * [0, 0, 5],\n * [0, 1, 5],\n * [1, 1, 5],\n * [1, 0, 5]\n * ]\n * hasTile(tiles, [0, 0, 5])\n * //=boolean\n */\nfunction hasTile(tiles, tile) {\n for (var i = 0; i < tiles.length; i++) {\n if (tilesEqual(tiles[i], tile)) return true;\n }\n return false;\n}\n\n/**\n * Check to see if two tiles are the same\n *\n * @name tilesEqual\n * @param {Array<number>} tile1\n * @param {Array<number>} tile2\n * @returns {boolean}\n * @example\n * tilesEqual([0, 1, 5], [0, 0, 5])\n * //=boolean\n */\nfunction tilesEqual(tile1, tile2) {\n return (\n tile1[0] === tile2[0] &&\n tile1[1] === tile2[1] &&\n tile1[2] === tile2[2]\n );\n}\n\n/**\n * Get the quadkey for a tile\n *\n * @name tileToQuadkey\n * @param {Array<number>} tile\n * @returns {string} quadkey\n * @example\n * var quadkey = tileToQuadkey([0, 1, 5])\n * //=quadkey\n */\nfunction tileToQuadkey(tile) {\n var index = '';\n for (var z = tile[2]; z > 0; z--) {\n var b = 0;\n var mask = 1 << (z - 1);\n if ((tile[0] & mask) !== 0) b++;\n if ((tile[1] & mask) !== 0) b += 2;\n index += b.toString();\n }\n return index;\n}\n\n/**\n * Get the tile for a quadkey\n *\n * @name quadkeyToTile\n * @param {string} quadkey\n * @returns {Array<number>} tile\n * @example\n * var tile = quadkeyToTile('00001033')\n * //=tile\n */\nfunction quadkeyToTile(quadkey) {\n var x = 0;\n var y = 0;\n var z = quadkey.length;\n\n for (var i = z; i > 0; i--) {\n var mask = 1 << (i - 1);\n var q = +quadkey[z - i];\n if (q === 1) x |= mask;\n if (q === 2) y |= mask;\n if (q === 3) {\n x |= mask;\n y |= mask;\n }\n }\n return [x, y, z];\n}\n\n/**\n * Get the smallest tile to cover a bbox\n *\n * @name bboxToTile\n * @param {Array<number>} bbox\n * @returns {Array<number>} tile\n * @example\n * var tile = bboxToTile([ -178, 84, -177, 85 ])\n * //=tile\n */\nfunction bboxToTile(bboxCoords) {\n var min = pointToTile(bboxCoords[0], bboxCoords[1], 32);\n var max = pointToTile(bboxCoords[2], bboxCoords[3], 32);\n var bbox = [min[0], min[1], max[0], max[1]];\n\n var z = getBboxZoom(bbox);\n if (z === 0) return [0, 0, 0];\n var x = bbox[0] >>> (32 - z);\n var y = bbox[1] >>> (32 - z);\n return [x, y, z];\n}\n\nfunction getBboxZoom(bbox) {\n var MAX_ZOOM = 28;\n for (var z = 0; z < MAX_ZOOM; z++) {\n var mask = 1 << (32 - (z + 1));\n if (((bbox[0] & mask) !== (bbox[2] & mask)) ||\n ((bbox[1] & mask) !== (bbox[3] & mask))) {\n return z;\n }\n }\n\n return MAX_ZOOM;\n}\n\n/**\n * Get the precise fractional tile location for a point at a zoom level\n *\n * @name pointToTileFraction\n * @param {number} lon\n * @param {number} lat\n * @param {number} z\n * @returns {Array<number>} tile fraction\n * var tile = pointToTileFraction(30.5, 50.5, 15)\n * //=tile\n */\nfunction pointToTileFraction(lon, lat, z) {\n var sin = Math.sin(lat * d2r),\n z2 = Math.pow(2, z),\n x = z2 * (lon / 360 + 0.5),\n y = z2 * (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI);\n\n // Wrap Tile X\n x = x % z2;\n if (x < 0) x = x + z2;\n return [x, y, z];\n}\n\nmodule.exports = {\n tileToGeoJSON: tileToGeoJSON,\n tileToBBOX: tileToBBOX,\n getChildren: getChildren,\n getParent: getParent,\n getSiblings: getSiblings,\n hasTile: hasTile,\n hasSiblings: hasSiblings,\n tilesEqual: tilesEqual,\n tileToQuadkey: tileToQuadkey,\n quadkeyToTile: quadkeyToTile,\n pointToTile: pointToTile,\n bboxToTile: bboxToTile,\n pointToTileFraction: pointToTileFraction\n};\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@mapbox/tilebelt/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@mapbox/vector-tile/index.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/@mapbox/vector-tile/index.js ***!
|
||
\***************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("module.exports.VectorTile = __webpack_require__(/*! ./lib/vectortile.js */ \"./node_modules/@mapbox/vector-tile/lib/vectortile.js\");\nmodule.exports.VectorTileFeature = __webpack_require__(/*! ./lib/vectortilefeature.js */ \"./node_modules/@mapbox/vector-tile/lib/vectortilefeature.js\");\nmodule.exports.VectorTileLayer = __webpack_require__(/*! ./lib/vectortilelayer.js */ \"./node_modules/@mapbox/vector-tile/lib/vectortilelayer.js\");\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@mapbox/vector-tile/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@mapbox/vector-tile/lib/vectortile.js":
|
||
/*!************************************************************!*\
|
||
!*** ./node_modules/@mapbox/vector-tile/lib/vectortile.js ***!
|
||
\************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar VectorTileLayer = __webpack_require__(/*! ./vectortilelayer */ \"./node_modules/@mapbox/vector-tile/lib/vectortilelayer.js\");\n\nmodule.exports = VectorTile;\n\nfunction VectorTile(pbf, end) {\n this.layers = pbf.readFields(readTile, {}, end);\n}\n\nfunction readTile(tag, layers, pbf) {\n if (tag === 3) {\n var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);\n if (layer.length) layers[layer.name] = layer;\n }\n}\n\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@mapbox/vector-tile/lib/vectortile.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@mapbox/vector-tile/lib/vectortilefeature.js":
|
||
/*!*******************************************************************!*\
|
||
!*** ./node_modules/@mapbox/vector-tile/lib/vectortilefeature.js ***!
|
||
\*******************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar Point = __webpack_require__(/*! @mapbox/point-geometry */ \"./node_modules/@mapbox/point-geometry/index.js\");\n\nmodule.exports = VectorTileFeature;\n\nfunction VectorTileFeature(pbf, end, extent, keys, values) {\n // Public\n this.properties = {};\n this.extent = extent;\n this.type = 0;\n\n // Private\n this._pbf = pbf;\n this._geometry = -1;\n this._keys = keys;\n this._values = values;\n\n pbf.readFields(readFeature, this, end);\n}\n\nfunction readFeature(tag, feature, pbf) {\n if (tag == 1) feature.id = pbf.readVarint();\n else if (tag == 2) readTag(pbf, feature);\n else if (tag == 3) feature.type = pbf.readVarint();\n else if (tag == 4) feature._geometry = pbf.pos;\n}\n\nfunction readTag(pbf, feature) {\n var end = pbf.readVarint() + pbf.pos;\n\n while (pbf.pos < end) {\n var key = feature._keys[pbf.readVarint()],\n value = feature._values[pbf.readVarint()];\n feature.properties[key] = value;\n }\n}\n\nVectorTileFeature.types = ['Unknown', 'Point', 'LineString', 'Polygon'];\n\nVectorTileFeature.prototype.loadGeometry = function() {\n var pbf = this._pbf;\n pbf.pos = this._geometry;\n\n var end = pbf.readVarint() + pbf.pos,\n cmd = 1,\n length = 0,\n x = 0,\n y = 0,\n lines = [],\n line;\n\n while (pbf.pos < end) {\n if (length <= 0) {\n var cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n\n length--;\n\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n\n if (cmd === 1) { // moveTo\n if (line) lines.push(line);\n line = [];\n }\n\n line.push(new Point(x, y));\n\n } else if (cmd === 7) {\n\n // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n if (line) {\n line.push(line[0].clone()); // closePolygon\n }\n\n } else {\n throw new Error('unknown command ' + cmd);\n }\n }\n\n if (line) lines.push(line);\n\n return lines;\n};\n\nVectorTileFeature.prototype.bbox = function() {\n var pbf = this._pbf;\n pbf.pos = this._geometry;\n\n var end = pbf.readVarint() + pbf.pos,\n cmd = 1,\n length = 0,\n x = 0,\n y = 0,\n x1 = Infinity,\n x2 = -Infinity,\n y1 = Infinity,\n y2 = -Infinity;\n\n while (pbf.pos < end) {\n if (length <= 0) {\n var cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n\n length--;\n\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (x < x1) x1 = x;\n if (x > x2) x2 = x;\n if (y < y1) y1 = y;\n if (y > y2) y2 = y;\n\n } else if (cmd !== 7) {\n throw new Error('unknown command ' + cmd);\n }\n }\n\n return [x1, y1, x2, y2];\n};\n\nVectorTileFeature.prototype.toGeoJSON = function(x, y, z) {\n var size = this.extent * Math.pow(2, z),\n x0 = this.extent * x,\n y0 = this.extent * y,\n coords = this.loadGeometry(),\n type = VectorTileFeature.types[this.type],\n i, j;\n\n function project(line) {\n for (var j = 0; j < line.length; j++) {\n var p = line[j], y2 = 180 - (p.y + y0) * 360 / size;\n line[j] = [\n (p.x + x0) * 360 / size - 180,\n 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90\n ];\n }\n }\n\n switch (this.type) {\n case 1:\n var points = [];\n for (i = 0; i < coords.length; i++) {\n points[i] = coords[i][0];\n }\n coords = points;\n project(coords);\n break;\n\n case 2:\n for (i = 0; i < coords.length; i++) {\n project(coords[i]);\n }\n break;\n\n case 3:\n coords = classifyRings(coords);\n for (i = 0; i < coords.length; i++) {\n for (j = 0; j < coords[i].length; j++) {\n project(coords[i][j]);\n }\n }\n break;\n }\n\n if (coords.length === 1) {\n coords = coords[0];\n } else {\n type = 'Multi' + type;\n }\n\n var result = {\n type: \"Feature\",\n geometry: {\n type: type,\n coordinates: coords\n },\n properties: this.properties\n };\n\n if ('id' in this) {\n result.id = this.id;\n }\n\n return result;\n};\n\n// classifies an array of rings into polygons with outer rings and holes\n\nfunction classifyRings(rings) {\n var len = rings.length;\n\n if (len <= 1) return [rings];\n\n var polygons = [],\n polygon,\n ccw;\n\n for (var i = 0; i < len; i++) {\n var area = signedArea(rings[i]);\n if (area === 0) continue;\n\n if (ccw === undefined) ccw = area < 0;\n\n if (ccw === area < 0) {\n if (polygon) polygons.push(polygon);\n polygon = [rings[i]];\n\n } else {\n polygon.push(rings[i]);\n }\n }\n if (polygon) polygons.push(polygon);\n\n return polygons;\n}\n\nfunction signedArea(ring) {\n var sum = 0;\n for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2.x - p1.x) * (p1.y + p2.y);\n }\n return sum;\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@mapbox/vector-tile/lib/vectortilefeature.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@mapbox/vector-tile/lib/vectortilelayer.js":
|
||
/*!*****************************************************************!*\
|
||
!*** ./node_modules/@mapbox/vector-tile/lib/vectortilelayer.js ***!
|
||
\*****************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar VectorTileFeature = __webpack_require__(/*! ./vectortilefeature.js */ \"./node_modules/@mapbox/vector-tile/lib/vectortilefeature.js\");\n\nmodule.exports = VectorTileLayer;\n\nfunction VectorTileLayer(pbf, end) {\n // Public\n this.version = 1;\n this.name = null;\n this.extent = 4096;\n this.length = 0;\n\n // Private\n this._pbf = pbf;\n this._keys = [];\n this._values = [];\n this._features = [];\n\n pbf.readFields(readLayer, this, end);\n\n this.length = this._features.length;\n}\n\nfunction readLayer(tag, layer, pbf) {\n if (tag === 15) layer.version = pbf.readVarint();\n else if (tag === 1) layer.name = pbf.readString();\n else if (tag === 5) layer.extent = pbf.readVarint();\n else if (tag === 2) layer._features.push(pbf.pos);\n else if (tag === 3) layer._keys.push(pbf.readString());\n else if (tag === 4) layer._values.push(readValueMessage(pbf));\n}\n\nfunction readValueMessage(pbf) {\n var value = null,\n end = pbf.readVarint() + pbf.pos;\n\n while (pbf.pos < end) {\n var tag = pbf.readVarint() >> 3;\n\n value = tag === 1 ? pbf.readString() :\n tag === 2 ? pbf.readFloat() :\n tag === 3 ? pbf.readDouble() :\n tag === 4 ? pbf.readVarint64() :\n tag === 5 ? pbf.readVarint() :\n tag === 6 ? pbf.readSVarint() :\n tag === 7 ? pbf.readBoolean() : null;\n }\n\n return value;\n}\n\n// return feature `i` from this layer as a `VectorTileFeature`\nVectorTileLayer.prototype.feature = function(i) {\n if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds');\n\n this._pbf.pos = this._features[i];\n\n var end = this._pbf.readVarint() + this._pbf.pos;\n return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);\n};\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@mapbox/vector-tile/lib/vectortilelayer.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/centroid/main.es.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/@turf/centroid/main.es.js ***!
|
||
\************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _turf_meta__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/meta */ \"./node_modules/@turf/meta/dist/es/index.js\");\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n\n\n\n/**\n * Takes one or more features and calculates the centroid using the mean of all vertices.\n * This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons.\n *\n * @name centroid\n * @param {GeoJSON} geojson GeoJSON to be centered\n * @param {Object} [properties={}] an Object that is used as the {@link Feature}'s properties\n * @returns {Feature<Point>} the centroid of the input features\n * @example\n * var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);\n *\n * var centroid = turf.centroid(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, centroid]\n */\nfunction centroid(geojson, properties) {\n var xSum = 0;\n var ySum = 0;\n var len = 0;\n (0,_turf_meta__WEBPACK_IMPORTED_MODULE_0__.coordEach)(geojson, function (coord) {\n xSum += coord[0];\n ySum += coord[1];\n len++;\n }, true);\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_1__.point)([xSum / len, ySum / len], properties);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (centroid);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/centroid/main.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/clone/main.es.js":
|
||
/*!*********************************************!*\
|
||
!*** ./node_modules/@turf/clone/main.es.js ***!
|
||
\*********************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/**\n * Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'.\n * ~3-5x faster than the common JSON.parse + JSON.stringify combo method.\n *\n * @name clone\n * @param {GeoJSON} geojson GeoJSON Object\n * @returns {GeoJSON} cloned GeoJSON Object\n * @example\n * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]], {color: 'red'});\n *\n * var lineCloned = turf.clone(line);\n */\nfunction clone(geojson) {\n if (!geojson) throw new Error('geojson is required');\n\n switch (geojson.type) {\n case 'Feature':\n return cloneFeature(geojson);\n case 'FeatureCollection':\n return cloneFeatureCollection(geojson);\n case 'Point':\n case 'LineString':\n case 'Polygon':\n case 'MultiPoint':\n case 'MultiLineString':\n case 'MultiPolygon':\n case 'GeometryCollection':\n return cloneGeometry(geojson);\n default:\n throw new Error('unknown GeoJSON type');\n }\n}\n\n/**\n * Clone Feature\n *\n * @private\n * @param {Feature<any>} geojson GeoJSON Feature\n * @returns {Feature<any>} cloned Feature\n */\nfunction cloneFeature(geojson) {\n var cloned = {type: 'Feature'};\n // Preserve Foreign Members\n Object.keys(geojson).forEach(function (key) {\n switch (key) {\n case 'type':\n case 'properties':\n case 'geometry':\n return;\n default:\n cloned[key] = geojson[key];\n }\n });\n // Add properties & geometry last\n cloned.properties = cloneProperties(geojson.properties);\n cloned.geometry = cloneGeometry(geojson.geometry);\n return cloned;\n}\n\n/**\n * Clone Properties\n *\n * @private\n * @param {Object} properties GeoJSON Properties\n * @returns {Object} cloned Properties\n */\nfunction cloneProperties(properties) {\n var cloned = {};\n if (!properties) return cloned;\n Object.keys(properties).forEach(function (key) {\n var value = properties[key];\n if (typeof value === 'object') {\n if (value === null) {\n // handle null\n cloned[key] = null;\n } else if (value.length) {\n // handle Array\n cloned[key] = value.map(function (item) {\n return item;\n });\n } else {\n // handle generic Object\n cloned[key] = cloneProperties(value);\n }\n } else cloned[key] = value;\n });\n return cloned;\n}\n\n/**\n * Clone Feature Collection\n *\n * @private\n * @param {FeatureCollection<any>} geojson GeoJSON Feature Collection\n * @returns {FeatureCollection<any>} cloned Feature Collection\n */\nfunction cloneFeatureCollection(geojson) {\n var cloned = {type: 'FeatureCollection'};\n\n // Preserve Foreign Members\n Object.keys(geojson).forEach(function (key) {\n switch (key) {\n case 'type':\n case 'features':\n return;\n default:\n cloned[key] = geojson[key];\n }\n });\n // Add features\n cloned.features = geojson.features.map(function (feature) {\n return cloneFeature(feature);\n });\n return cloned;\n}\n\n/**\n * Clone Geometry\n *\n * @private\n * @param {Geometry<any>} geometry GeoJSON Geometry\n * @returns {Geometry<any>} cloned Geometry\n */\nfunction cloneGeometry(geometry) {\n var geom = {type: geometry.type};\n if (geometry.bbox) geom.bbox = geometry.bbox;\n\n if (geometry.type === 'GeometryCollection') {\n geom.geometries = geometry.geometries.map(function (geom) {\n return cloneGeometry(geom);\n });\n return geom;\n }\n geom.coordinates = deepSlice(geometry.coordinates);\n return geom;\n}\n\n/**\n * Deep Slice coordinates\n *\n * @private\n * @param {Coordinates} coords Coordinates\n * @returns {Coordinates} all coordinates sliced\n */\nfunction deepSlice(coords) {\n if (typeof coords[0] !== 'object') { return coords.slice(); }\n return coords.map(function (coord) {\n return deepSlice(coord);\n });\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clone);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/clone/main.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/rhumb-bearing/main.es.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@turf/rhumb-bearing/main.es.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/invariant */ \"./node_modules/@turf/invariant/dist/es/index.js\");\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n\n\n\n// https://en.wikipedia.org/wiki/Rhumb_line\n/**\n * Takes two {@link Point|points} and finds the bearing angle between them along a Rhumb line\n * i.e. the angle measured in degrees start the north line (0 degrees)\n *\n * @name rhumbBearing\n * @param {Coord} start starting Point\n * @param {Coord} end ending Point\n * @param {Object} [options] Optional parameters\n * @param {boolean} [options.final=false] calculates the final bearing if true\n * @returns {number} bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise)\n * @example\n * var point1 = turf.point([-75.343, 39.984], {\"marker-color\": \"#F00\"});\n * var point2 = turf.point([-75.534, 39.123], {\"marker-color\": \"#00F\"});\n *\n * var bearing = turf.rhumbBearing(point1, point2);\n *\n * //addToMap\n * var addToMap = [point1, point2];\n * point1.properties.bearing = bearing;\n * point2.properties.bearing = bearing;\n */\nfunction rhumbBearing(start, end, options) {\n // Optional parameters\n options = options || {};\n if (!(0,_turf_helpers__WEBPACK_IMPORTED_MODULE_1__.isObject)(options)) throw new Error('options is invalid');\n var final = options.final;\n\n // validation\n if (!start) throw new Error('start point is required');\n if (!end) throw new Error('end point is required');\n\n var bear360;\n\n if (final) bear360 = calculateRhumbBearing((0,_turf_invariant__WEBPACK_IMPORTED_MODULE_0__.getCoord)(end), (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_0__.getCoord)(start));\n else bear360 = calculateRhumbBearing((0,_turf_invariant__WEBPACK_IMPORTED_MODULE_0__.getCoord)(start), (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_0__.getCoord)(end));\n\n var bear180 = (bear360 > 180) ? -(360 - bear360) : bear360;\n\n return bear180;\n}\n\n/**\n * Returns the bearing from ‘this’ point to destination point along a rhumb line.\n * Adapted from Geodesy: https://github.com/chrisveness/geodesy/blob/master/latlon-spherical.js\n *\n * @private\n * @param {Array<number>} from - origin point.\n * @param {Array<number>} to - destination point.\n * @returns {number} Bearing in degrees from north.\n * @example\n * var p1 = new LatLon(51.127, 1.338);\n * var p2 = new LatLon(50.964, 1.853);\n * var d = p1.rhumbBearingTo(p2); // 116.7 m\n */\nfunction calculateRhumbBearing(from, to) {\n // φ => phi\n // Δλ => deltaLambda\n // Δψ => deltaPsi\n // θ => theta\n var phi1 = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_1__.degreesToRadians)(from[1]);\n var phi2 = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_1__.degreesToRadians)(to[1]);\n var deltaLambda = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_1__.degreesToRadians)((to[0] - from[0]));\n // if deltaLambdaon over 180° take shorter rhumb line across the anti-meridian:\n if (deltaLambda > Math.PI) deltaLambda -= 2 * Math.PI;\n if (deltaLambda < -Math.PI) deltaLambda += 2 * Math.PI;\n\n var deltaPsi = Math.log(Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4));\n\n var theta = Math.atan2(deltaLambda, deltaPsi);\n\n return ((0,_turf_helpers__WEBPACK_IMPORTED_MODULE_1__.radiansToDegrees)(theta) + 360) % 360;\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rhumbBearing);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/rhumb-bearing/main.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/rhumb-destination/main.es.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/@turf/rhumb-destination/main.es.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n/* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/invariant */ \"./node_modules/@turf/invariant/dist/es/index.js\");\n\n\n\n// https://en.wikipedia.org/wiki/Rhumb_line\n/**\n * Returns the destination {@link Point} having travelled the given distance along a Rhumb line from the\n * origin Point with the (varant) given bearing.\n *\n * @name rhumbDestination\n * @param {Coord} origin starting point\n * @param {number} distance distance from the starting point\n * @param {number} bearing varant bearing angle ranging from -180 to 180 degrees from north\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers\n * @param {Object} [options.properties={}] translate properties to destination point\n * @returns {Feature<Point>} Destination point.\n * @example\n * var pt = turf.point([-75.343, 39.984], {\"marker-color\": \"F00\"});\n * var distance = 50;\n * var bearing = 90;\n * var options = {units: 'miles'};\n *\n * var destination = turf.rhumbDestination(pt, distance, bearing, options);\n *\n * //addToMap\n * var addToMap = [pt, destination]\n * destination.properties['marker-color'] = '#00F';\n */\nfunction rhumbDestination(origin, distance, bearing, options) {\n // Optional parameters\n options = options || {};\n if (!(0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.isObject)(options)) throw new Error('options is invalid');\n var units = options.units;\n var properties = options.properties;\n\n // validation\n if (!origin) throw new Error('origin is required');\n if (distance === undefined || distance === null) throw new Error('distance is required');\n if (bearing === undefined || bearing === null) throw new Error('bearing is required');\n if (!(distance >= 0)) throw new Error('distance must be greater than 0');\n\n var distanceInMeters = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.convertLength)(distance, units, 'meters');\n var coords = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_1__.getCoord)(origin);\n var destination = calculateRhumbDestination(coords, distanceInMeters, bearing);\n\n // compensate the crossing of the 180th meridian (https://macwright.org/2016/09/26/the-180th-meridian.html)\n // solution from https://github.com/mapbox/mapbox-gl-js/issues/3250#issuecomment-294887678\n destination[0] += (destination[0] - coords[0] > 180) ? -360 : (coords[0] - destination[0] > 180) ? 360 : 0;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.point)(destination, properties);\n}\n\n/**\n * Returns the destination point having travelled along a rhumb line from origin point the given\n * distance on the given bearing.\n * Adapted from Geodesy: http://www.movable-type.co.uk/scripts/latlong.html#rhumblines\n *\n * @private\n * @param {Array<number>} origin - point\n * @param {number} distance - Distance travelled, in same units as earth radius (default: metres).\n * @param {number} bearing - Bearing in degrees from north.\n * @param {number} [radius=6371e3] - (Mean) radius of earth (defaults to radius in metres).\n * @returns {Array<number>} Destination point.\n */\nfunction calculateRhumbDestination(origin, distance, bearing, radius) {\n // φ => phi\n // λ => lambda\n // ψ => psi\n // Δ => Delta\n // δ => delta\n // θ => theta\n\n radius = (radius === undefined) ? _turf_helpers__WEBPACK_IMPORTED_MODULE_0__.earthRadius : Number(radius);\n\n var delta = distance / radius; // angular distance in radians\n var lambda1 = origin[0] * Math.PI / 180; // to radians, but without normalize to 𝜋\n var phi1 = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.degreesToRadians)(origin[1]);\n var theta = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.degreesToRadians)(bearing);\n\n var DeltaPhi = delta * Math.cos(theta);\n var phi2 = phi1 + DeltaPhi;\n\n // check for some daft bugger going past the pole, normalise latitude if so\n if (Math.abs(phi2) > Math.PI / 2) phi2 = phi2 > 0 ? Math.PI - phi2 : -Math.PI - phi2;\n\n var DeltaPsi = Math.log(Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4));\n var q = Math.abs(DeltaPsi) > 10e-12 ? DeltaPhi / DeltaPsi : Math.cos(phi1); // E-W course becomes ill-conditioned with 0/0\n\n var DeltaLambda = delta * Math.sin(theta) / q;\n var lambda2 = lambda1 + DeltaLambda;\n\n return [((lambda2 * 180 / Math.PI) + 540) % 360 - 180, phi2 * 180 / Math.PI]; // normalise to −180..+180°\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rhumbDestination);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/rhumb-destination/main.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/rhumb-distance/main.es.js":
|
||
/*!******************************************************!*\
|
||
!*** ./node_modules/@turf/rhumb-distance/main.es.js ***!
|
||
\******************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n/* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/invariant */ \"./node_modules/@turf/invariant/dist/es/index.js\");\n\n\n\n// https://en.wikipedia.org/wiki/Rhumb_line\n/**\n * Calculates the distance along a rhumb line between two {@link Point|points} in degrees, radians,\n * miles, or kilometers.\n *\n * @name rhumbDistance\n * @param {Coord} from origin point\n * @param {Coord} to destination point\n * @param {Object} [options] Optional parameters\n * @param {string} [options.units=\"kilometers\"] can be degrees, radians, miles, or kilometers\n * @returns {number} distance between the two points\n * @example\n * var from = turf.point([-75.343, 39.984]);\n * var to = turf.point([-75.534, 39.123]);\n * var options = {units: 'miles'};\n *\n * var distance = turf.rhumbDistance(from, to, options);\n *\n * //addToMap\n * var addToMap = [from, to];\n * from.properties.distance = distance;\n * to.properties.distance = distance;\n */\nfunction rhumbDistance(from, to, options) {\n // Optional parameters\n options = options || {};\n if (!(0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.isObject)(options)) throw new Error('options is invalid');\n var units = options.units;\n\n // validation\n if (!from) throw new Error('from point is required');\n if (!to) throw new Error('to point is required');\n\n var origin = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_1__.getCoord)(from);\n var destination = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_1__.getCoord)(to);\n\n // compensate the crossing of the 180th meridian (https://macwright.org/2016/09/26/the-180th-meridian.html)\n // solution from https://github.com/mapbox/mapbox-gl-js/issues/3250#issuecomment-294887678\n destination[0] += (destination[0] - origin[0] > 180) ? -360 : (origin[0] - destination[0] > 180) ? 360 : 0;\n var distanceInMeters = calculateRhumbDistance(origin, destination);\n var distance = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.convertLength)(distanceInMeters, 'meters', units);\n return distance;\n}\n\n/**\n * Returns the distance travelling from ‘this’ point to destination point along a rhumb line.\n * Adapted from Geodesy: https://github.com/chrisveness/geodesy/blob/master/latlon-spherical.js\n *\n * @private\n * @param {Array<number>} origin point.\n * @param {Array<number>} destination point.\n * @param {number} [radius=6371e3] - (Mean) radius of earth (defaults to radius in metres).\n * @returns {number} Distance in km between this point and destination point (same units as radius).\n *\n * @example\n * var p1 = new LatLon(51.127, 1.338);\n * var p2 = new LatLon(50.964, 1.853);\n * var d = p1.distanceTo(p2); // 40.31 km\n */\nfunction calculateRhumbDistance(origin, destination, radius) {\n // φ => phi\n // λ => lambda\n // ψ => psi\n // Δ => Delta\n // δ => delta\n // θ => theta\n\n radius = (radius === undefined) ? _turf_helpers__WEBPACK_IMPORTED_MODULE_0__.earthRadius : Number(radius);\n // see www.edwilliams.org/avform.htm#Rhumb\n\n var R = radius;\n var phi1 = origin[1] * Math.PI / 180;\n var phi2 = destination[1] * Math.PI / 180;\n var DeltaPhi = phi2 - phi1;\n var DeltaLambda = Math.abs(destination[0] - origin[0]) * Math.PI / 180;\n // if dLon over 180° take shorter rhumb line across the anti-meridian:\n if (DeltaLambda > Math.PI) DeltaLambda -= 2 * Math.PI;\n\n // on Mercator projection, longitude distances shrink by latitude; q is the 'stretch factor'\n // q becomes ill-conditioned along E-W line (0/0); use empirical tolerance to avoid it\n var DeltaPsi = Math.log(Math.tan(phi2 / 2 + Math.PI / 4) / Math.tan(phi1 / 2 + Math.PI / 4));\n var q = Math.abs(DeltaPsi) > 10e-12 ? DeltaPhi / DeltaPsi : Math.cos(phi1);\n\n // distance is pythagoras on 'stretched' Mercator projection\n var delta = Math.sqrt(DeltaPhi * DeltaPhi + q * q * DeltaLambda * DeltaLambda); // angular distance in radians\n var dist = delta * R;\n\n return dist;\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rhumbDistance);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/rhumb-distance/main.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/transform-rotate/main.es.js":
|
||
/*!********************************************************!*\
|
||
!*** ./node_modules/@turf/transform-rotate/main.es.js ***!
|
||
\********************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _turf_centroid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/centroid */ \"./node_modules/@turf/centroid/main.es.js\");\n/* harmony import */ var _turf_rhumb_bearing__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/rhumb-bearing */ \"./node_modules/@turf/rhumb-bearing/main.es.js\");\n/* harmony import */ var _turf_rhumb_distance__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @turf/rhumb-distance */ \"./node_modules/@turf/rhumb-distance/main.es.js\");\n/* harmony import */ var _turf_rhumb_destination__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @turf/rhumb-destination */ \"./node_modules/@turf/rhumb-destination/main.es.js\");\n/* harmony import */ var _turf_clone__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @turf/clone */ \"./node_modules/@turf/clone/main.es.js\");\n/* harmony import */ var _turf_meta__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @turf/meta */ \"./node_modules/@turf/meta/dist/es/index.js\");\n/* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @turf/invariant */ \"./node_modules/@turf/invariant/dist/es/index.js\");\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n\n\n\n\n\n\n\n\n\n/**\n * Rotates any geojson Feature or Geometry of a specified angle, around its `centroid` or a given `pivot` point;\n * all rotations follow the right-hand rule: https://en.wikipedia.org/wiki/Right-hand_rule\n *\n * @name transformRotate\n * @param {GeoJSON} geojson object to be rotated\n * @param {number} angle of rotation (along the vertical axis), from North in decimal degrees, negative clockwise\n * @param {Object} [options={}] Optional parameters\n * @param {Coord} [options.pivot='centroid'] point around which the rotation will be performed\n * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)\n * @returns {GeoJSON} the rotated GeoJSON feature\n * @example\n * var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);\n * var options = {pivot: [0, 25]};\n * var rotatedPoly = turf.transformRotate(poly, 10, options);\n *\n * //addToMap\n * var addToMap = [poly, rotatedPoly];\n * rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};\n */\nfunction transformRotate(geojson, angle, options) {\n // Optional parameters\n options = options || {};\n if (!(0,_turf_helpers__WEBPACK_IMPORTED_MODULE_7__.isObject)(options)) throw new Error('options is invalid');\n var pivot = options.pivot;\n var mutate = options.mutate;\n\n // Input validation\n if (!geojson) throw new Error('geojson is required');\n if (angle === undefined || angle === null || isNaN(angle)) throw new Error('angle is required');\n\n // Shortcut no-rotation\n if (angle === 0) return geojson;\n\n // Use centroid of GeoJSON if pivot is not provided\n if (!pivot) pivot = (0,_turf_centroid__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(geojson);\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) geojson = (0,_turf_clone__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(geojson);\n\n // Rotate each coordinate\n (0,_turf_meta__WEBPACK_IMPORTED_MODULE_5__.coordEach)(geojson, function (pointCoords) {\n var initialAngle = (0,_turf_rhumb_bearing__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(pivot, pointCoords);\n var finalAngle = initialAngle + angle;\n var distance = (0,_turf_rhumb_distance__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(pivot, pointCoords);\n var newCoords = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_6__.getCoords)((0,_turf_rhumb_destination__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(pivot, distance, finalAngle));\n pointCoords[0] = newCoords[0];\n pointCoords[1] = newCoords[1];\n });\n return geojson;\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (transformRotate);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/transform-rotate/main.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/transform-translate/main.es.js":
|
||
/*!***********************************************************!*\
|
||
!*** ./node_modules/@turf/transform-translate/main.es.js ***!
|
||
\***********************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _turf_meta__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/meta */ \"./node_modules/@turf/meta/dist/es/index.js\");\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n/* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @turf/invariant */ \"./node_modules/@turf/invariant/dist/es/index.js\");\n/* harmony import */ var _turf_clone__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @turf/clone */ \"./node_modules/@turf/clone/main.es.js\");\n/* harmony import */ var _turf_rhumb_destination__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @turf/rhumb-destination */ \"./node_modules/@turf/rhumb-destination/main.es.js\");\n\n\n\n\n\n\n/**\n * Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line\n * on the provided direction angle.\n *\n * @name transformTranslate\n * @param {GeoJSON} geojson object to be translated\n * @param {number} distance length of the motion; negative values determine motion in opposite direction\n * @param {number} direction of the motion; angle from North in decimal degrees, positive clockwise\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] in which `distance` will be express; miles, kilometers, degrees, or radians\n * @param {number} [options.zTranslation=0] length of the vertical motion, same unit of distance\n * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)\n * @returns {GeoJSON} the translated GeoJSON object\n * @example\n * var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);\n * var translatedPoly = turf.transformTranslate(poly, 100, 35);\n *\n * //addToMap\n * var addToMap = [poly, translatedPoly];\n * translatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};\n */\nfunction transformTranslate(geojson, distance, direction, options) {\n // Optional parameters\n options = options || {};\n if (!(0,_turf_helpers__WEBPACK_IMPORTED_MODULE_1__.isObject)(options)) throw new Error('options is invalid');\n var units = options.units;\n var zTranslation = options.zTranslation;\n var mutate = options.mutate;\n\n // Input validation\n if (!geojson) throw new Error('geojson is required');\n if (distance === undefined || distance === null || isNaN(distance)) throw new Error('distance is required');\n if (zTranslation && typeof zTranslation !== 'number' && isNaN(zTranslation)) throw new Error('zTranslation is not a number');\n\n // Shortcut no-motion\n zTranslation = (zTranslation !== undefined) ? zTranslation : 0;\n if (distance === 0 && zTranslation === 0) return geojson;\n\n if (direction === undefined || direction === null || isNaN(direction)) throw new Error('direction is required');\n\n // Invert with negative distances\n if (distance < 0) {\n distance = -distance;\n direction = -direction;\n }\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) geojson = (0,_turf_clone__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(geojson);\n\n // Translate each coordinate\n (0,_turf_meta__WEBPACK_IMPORTED_MODULE_0__.coordEach)(geojson, function (pointCoords) {\n var newCoords = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_2__.getCoords)((0,_turf_rhumb_destination__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(pointCoords, distance, direction, {units: units}));\n pointCoords[0] = newCoords[0];\n pointCoords[1] = newCoords[1];\n if (zTranslation && pointCoords.length === 3) pointCoords[2] += zTranslation;\n });\n return geojson;\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (transformTranslate);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/transform-translate/main.es.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/union/dist/es/index.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/@turf/union/dist/es/index.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var polygon_clipping__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! polygon-clipping */ \"./node_modules/polygon-clipping/dist/polygon-clipping.umd.js\");\n/* harmony import */ var polygon_clipping__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(polygon_clipping__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/invariant */ \"./node_modules/@turf/invariant/dist/es/index.js\");\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n\n\n\n/**\n * Takes two {@link (Multi)Polygon(s)} and returns a combined polygon. If the input polygons are not contiguous, this function returns a {@link MultiPolygon} feature.\n *\n * @name union\n * @param {Feature<Polygon|MultiPolygon>} polygon1 input Polygon feature\n * @param {Feature<Polygon|MultiPolygon>} polygon2 Polygon feature to difference from polygon1\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] Translate Properties to output Feature\n * @returns {Feature<(Polygon|MultiPolygon)>} a combined {@link Polygon} or {@link MultiPolygon} feature\n * @example\n * var poly1 = turf.polygon([[\n * [-82.574787, 35.594087],\n * [-82.574787, 35.615581],\n * [-82.545261, 35.615581],\n * [-82.545261, 35.594087],\n * [-82.574787, 35.594087]\n * ]], {\"fill\": \"#0f0\"});\n * var poly2 = turf.polygon([[\n * [-82.560024, 35.585153],\n * [-82.560024, 35.602602],\n * [-82.52964, 35.602602],\n * [-82.52964, 35.585153],\n * [-82.560024, 35.585153]\n * ]], {\"fill\": \"#00f\"});\n *\n * var union = turf.union(poly1, poly2);\n *\n * //addToMap\n * var addToMap = [poly1, poly2, union];\n */\nfunction union(poly1, poly2, options) {\n if (options === void 0) { options = {}; }\n var geom1 = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_1__.getGeom)(poly1);\n var geom2 = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_1__.getGeom)(poly2);\n var unioned = polygon_clipping__WEBPACK_IMPORTED_MODULE_0___default().union(geom1.coordinates, geom2.coordinates);\n if (unioned.length === 0)\n return null;\n if (unioned.length === 1)\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_2__.polygon)(unioned[0], options.properties);\n else\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_2__.multiPolygon)(unioned, options.properties);\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (union);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/union/dist/es/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/cwise-compiler/compiler.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/cwise-compiler/compiler.js ***!
|
||
\*************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar createThunk = __webpack_require__(/*! ./lib/thunk.js */ \"./node_modules/cwise-compiler/lib/thunk.js\")\n\nfunction Procedure() {\n this.argTypes = []\n this.shimArgs = []\n this.arrayArgs = []\n this.arrayBlockIndices = []\n this.scalarArgs = []\n this.offsetArgs = []\n this.offsetArgIndex = []\n this.indexArgs = []\n this.shapeArgs = []\n this.funcName = \"\"\n this.pre = null\n this.body = null\n this.post = null\n this.debug = false\n}\n\nfunction compileCwise(user_args) {\n //Create procedure\n var proc = new Procedure()\n \n //Parse blocks\n proc.pre = user_args.pre\n proc.body = user_args.body\n proc.post = user_args.post\n\n //Parse arguments\n var proc_args = user_args.args.slice(0)\n proc.argTypes = proc_args\n for(var i=0; i<proc_args.length; ++i) {\n var arg_type = proc_args[i]\n if(arg_type === \"array\" || (typeof arg_type === \"object\" && arg_type.blockIndices)) {\n proc.argTypes[i] = \"array\"\n proc.arrayArgs.push(i)\n proc.arrayBlockIndices.push(arg_type.blockIndices ? arg_type.blockIndices : 0)\n proc.shimArgs.push(\"array\" + i)\n if(i < proc.pre.args.length && proc.pre.args[i].count>0) {\n throw new Error(\"cwise: pre() block may not reference array args\")\n }\n if(i < proc.post.args.length && proc.post.args[i].count>0) {\n throw new Error(\"cwise: post() block may not reference array args\")\n }\n } else if(arg_type === \"scalar\") {\n proc.scalarArgs.push(i)\n proc.shimArgs.push(\"scalar\" + i)\n } else if(arg_type === \"index\") {\n proc.indexArgs.push(i)\n if(i < proc.pre.args.length && proc.pre.args[i].count > 0) {\n throw new Error(\"cwise: pre() block may not reference array index\")\n }\n if(i < proc.body.args.length && proc.body.args[i].lvalue) {\n throw new Error(\"cwise: body() block may not write to array index\")\n }\n if(i < proc.post.args.length && proc.post.args[i].count > 0) {\n throw new Error(\"cwise: post() block may not reference array index\")\n }\n } else if(arg_type === \"shape\") {\n proc.shapeArgs.push(i)\n if(i < proc.pre.args.length && proc.pre.args[i].lvalue) {\n throw new Error(\"cwise: pre() block may not write to array shape\")\n }\n if(i < proc.body.args.length && proc.body.args[i].lvalue) {\n throw new Error(\"cwise: body() block may not write to array shape\")\n }\n if(i < proc.post.args.length && proc.post.args[i].lvalue) {\n throw new Error(\"cwise: post() block may not write to array shape\")\n }\n } else if(typeof arg_type === \"object\" && arg_type.offset) {\n proc.argTypes[i] = \"offset\"\n proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset })\n proc.offsetArgIndex.push(i)\n } else {\n throw new Error(\"cwise: Unknown argument type \" + proc_args[i])\n }\n }\n \n //Make sure at least one array argument was specified\n if(proc.arrayArgs.length <= 0) {\n throw new Error(\"cwise: No array arguments specified\")\n }\n \n //Make sure arguments are correct\n if(proc.pre.args.length > proc_args.length) {\n throw new Error(\"cwise: Too many arguments in pre() block\")\n }\n if(proc.body.args.length > proc_args.length) {\n throw new Error(\"cwise: Too many arguments in body() block\")\n }\n if(proc.post.args.length > proc_args.length) {\n throw new Error(\"cwise: Too many arguments in post() block\")\n }\n\n //Check debug flag\n proc.debug = !!user_args.printCode || !!user_args.debug\n \n //Retrieve name\n proc.funcName = user_args.funcName || \"cwise\"\n \n //Read in block size\n proc.blockSize = user_args.blockSize || 64\n\n return createThunk(proc)\n}\n\nmodule.exports = compileCwise\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/cwise-compiler/compiler.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/cwise-compiler/lib/compile.js":
|
||
/*!****************************************************!*\
|
||
!*** ./node_modules/cwise-compiler/lib/compile.js ***!
|
||
\****************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar uniq = __webpack_require__(/*! uniq */ \"./node_modules/uniq/uniq.js\")\n\n// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index)\n// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of \"pointers\" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments.\nfunction innerFill(order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , has_index = proc.indexArgs.length>0\n , code = []\n , vars = []\n , idx=0, pidx=0, i, j\n for(i=0; i<dimension; ++i) { // Iteration variables\n vars.push([\"i\",i,\"=0\"].join(\"\"))\n }\n //Compute scan deltas\n for(j=0; j<nargs; ++j) {\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n if(i === 0) { // The innermost/fastest dimension's delta is simply its stride\n vars.push([\"d\",j,\"s\",i,\"=t\",j,\"p\",idx].join(\"\"))\n } else { // For other dimensions the delta is basically the stride minus something which essentially \"rewinds\" the previous (more inner) dimension\n vars.push([\"d\",j,\"s\",i,\"=(t\",j,\"p\",idx,\"-s\",pidx,\"*t\",j,\"p\",pidx,\")\"].join(\"\"))\n }\n }\n }\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n } \n //Scan loop\n for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards\n idx = order[i]\n code.push([\"for(i\",i,\"=0;i\",i,\"<s\",idx,\";++i\",i,\"){\"].join(\"\"))\n }\n //Push body of inner loop\n code.push(body)\n //Advance scan pointers\n for(i=0; i<dimension; ++i) {\n pidx = idx\n idx = order[i]\n for(j=0; j<nargs; ++j) {\n code.push([\"p\",j,\"+=d\",j,\"s\",i].join(\"\"))\n }\n if(has_index) {\n if(i > 0) {\n code.push([\"index[\",pidx,\"]-=s\",pidx].join(\"\"))\n }\n code.push([\"++index[\",idx,\"]\"].join(\"\"))\n }\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}\n\n// Generate \"outer\" loops that loop over blocks of data, applying \"inner\" loops to the blocks by manipulating the local variables in such a way that the inner loop only \"sees\" the current block.\n// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary.\n// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and \"shape\" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used.\nfunction outerFill(matched, order, proc, body) {\n var dimension = order.length\n , nargs = proc.arrayArgs.length\n , blockSize = proc.blockSize\n , has_index = proc.indexArgs.length > 0\n , code = []\n for(var i=0; i<nargs; ++i) {\n code.push([\"var offset\",i,\"=p\",i].join(\"\"))\n }\n //Generate loops for unmatched dimensions\n // The order in which these dimensions are traversed is fairly arbitrary (from small stride to large stride, for the first argument)\n // TODO: It would be nice if the order in which these loops are placed would also be somehow \"optimal\" (at the very least we should check that it really doesn't hurt us if they're not).\n for(var i=matched; i<dimension; ++i) {\n code.push([\"for(var j\"+i+\"=SS[\", order[i], \"]|0;j\", i, \">0;){\"].join(\"\")) // Iterate back to front\n code.push([\"if(j\",i,\"<\",blockSize,\"){\"].join(\"\")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j).\n code.push([\"s\",order[i],\"=j\",i].join(\"\"))\n code.push([\"j\",i,\"=0\"].join(\"\"))\n code.push([\"}else{s\",order[i],\"=\",blockSize].join(\"\"))\n code.push([\"j\",i,\"-=\",blockSize,\"}\"].join(\"\"))\n if(has_index) {\n code.push([\"index[\",order[i],\"]=j\",i].join(\"\"))\n }\n }\n for(var i=0; i<nargs; ++i) {\n var indexStr = [\"offset\"+i]\n for(var j=matched; j<dimension; ++j) {\n indexStr.push([\"j\",j,\"*t\",i,\"p\",order[j]].join(\"\"))\n }\n code.push([\"p\",i,\"=(\",indexStr.join(\"+\"),\")\"].join(\"\"))\n }\n code.push(innerFill(order, proc, body))\n for(var i=matched; i<dimension; ++i) {\n code.push(\"}\")\n }\n return code.join(\"\\n\")\n}\n\n//Count the number of compatible inner orders\n// This is the length of the longest common prefix of the arrays in orders.\n// Each array in orders lists the dimensions of the correspond ndarray in order of increasing stride.\n// This is thus the maximum number of dimensions that can be efficiently traversed by simple nested loops for all arrays.\nfunction countMatches(orders) {\n var matched = 0, dimension = orders[0].length\n while(matched < dimension) {\n for(var j=1; j<orders.length; ++j) {\n if(orders[j][matched] !== orders[0][matched]) {\n return matched\n }\n }\n ++matched\n }\n return matched\n}\n\n//Processes a block according to the given data types\n// Replaces variable names by different ones, either \"local\" ones (that are then ferried in and out of the given array) or ones matching the arguments that the function performing the ultimate loop will accept.\nfunction processBlock(block, proc, dtypes) {\n var code = block.body\n var pre = []\n var post = []\n for(var i=0; i<block.args.length; ++i) {\n var carg = block.args[i]\n if(carg.count <= 0) {\n continue\n }\n var re = new RegExp(carg.name, \"g\")\n var ptrStr = \"\"\n var arrNum = proc.arrayArgs.indexOf(i)\n switch(proc.argTypes[i]) {\n case \"offset\":\n var offArgIndex = proc.offsetArgIndex.indexOf(i)\n var offArg = proc.offsetArgs[offArgIndex]\n arrNum = offArg.array\n ptrStr = \"+q\" + offArgIndex // Adds offset to the \"pointer\" in the array\n case \"array\":\n ptrStr = \"p\" + arrNum + ptrStr\n var localStr = \"l\" + i\n var arrStr = \"a\" + arrNum\n if (proc.arrayBlockIndices[arrNum] === 0) { // Argument to body is just a single value from this array\n if(carg.count === 1) { // Argument/array used only once(?)\n if(dtypes[arrNum] === \"generic\") {\n if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }\n } else {\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n } else if(dtypes[arrNum] === \"generic\") {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n }\n } else {\n pre.push([\"var \", localStr, \"=\", arrStr, \"[\", ptrStr, \"]\"].join(\"\")) // TODO: Could we optimize by checking for carg.rvalue?\n code = code.replace(re, localStr)\n if(carg.lvalue) {\n post.push([arrStr, \"[\", ptrStr, \"]=\", localStr].join(\"\"))\n }\n }\n } else { // Argument to body is a \"block\"\n var reStrArr = [carg.name], ptrStrArr = [ptrStr]\n for(var j=0; j<Math.abs(proc.arrayBlockIndices[arrNum]); j++) {\n reStrArr.push(\"\\\\s*\\\\[([^\\\\]]+)\\\\]\")\n ptrStrArr.push(\"$\" + (j+1) + \"*t\" + arrNum + \"b\" + j) // Matched index times stride\n }\n re = new RegExp(reStrArr.join(\"\"), \"g\")\n ptrStr = ptrStrArr.join(\"+\")\n if(dtypes[arrNum] === \"generic\") {\n /*if(carg.lvalue) {\n pre.push([\"var \", localStr, \"=\", arrStr, \".get(\", ptrStr, \")\"].join(\"\")) // Is this necessary if the argument is ONLY used as an lvalue? (keep in mind that we can have a += something, so we would actually need to check carg.rvalue)\n code = code.replace(re, localStr)\n post.push([arrStr, \".set(\", ptrStr, \",\", localStr,\")\"].join(\"\"))\n } else {\n code = code.replace(re, [arrStr, \".get(\", ptrStr, \")\"].join(\"\"))\n }*/\n throw new Error(\"cwise: Generic arrays not supported in combination with blocks!\")\n } else {\n // This does not produce any local variables, even if variables are used multiple times. It would be possible to do so, but it would complicate things quite a bit.\n code = code.replace(re, [arrStr, \"[\", ptrStr, \"]\"].join(\"\"))\n }\n }\n break\n case \"scalar\":\n code = code.replace(re, \"Y\" + proc.scalarArgs.indexOf(i))\n break\n case \"index\":\n code = code.replace(re, \"index\")\n break\n case \"shape\":\n code = code.replace(re, \"shape\")\n break\n }\n }\n return [pre.join(\"\\n\"), code, post.join(\"\\n\")].join(\"\\n\").trim()\n}\n\nfunction typeSummary(dtypes) {\n var summary = new Array(dtypes.length)\n var allEqual = true\n for(var i=0; i<dtypes.length; ++i) {\n var t = dtypes[i]\n var digits = t.match(/\\d+/)\n if(!digits) {\n digits = \"\"\n } else {\n digits = digits[0]\n }\n if(t.charAt(0) === 0) {\n summary[i] = \"u\" + t.charAt(1) + digits\n } else {\n summary[i] = t.charAt(0) + digits\n }\n if(i > 0) {\n allEqual = allEqual && summary[i] === summary[i-1]\n }\n }\n if(allEqual) {\n return summary[0]\n }\n return summary.join(\"\")\n}\n\n//Generates a cwise operator\nfunction generateCWiseOp(proc, typesig) {\n\n //Compute dimension\n // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg.\n var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0\n var orders = new Array(proc.arrayArgs.length)\n var dtypes = new Array(proc.arrayArgs.length)\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n dtypes[i] = typesig[2*i]\n orders[i] = typesig[2*i+1]\n }\n \n //Determine where block and loop indices start and end\n var blockBegin = [], blockEnd = [] // These indices are exposed as blocks\n var loopBegin = [], loopEnd = [] // These indices are iterated over\n var loopOrders = [] // orders restricted to the loop indices\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n if (proc.arrayBlockIndices[i]<0) {\n loopBegin.push(0)\n loopEnd.push(dimension)\n blockBegin.push(dimension)\n blockEnd.push(dimension+proc.arrayBlockIndices[i])\n } else {\n loopBegin.push(proc.arrayBlockIndices[i]) // Non-negative\n loopEnd.push(proc.arrayBlockIndices[i]+dimension)\n blockBegin.push(0)\n blockEnd.push(proc.arrayBlockIndices[i])\n }\n var newOrder = []\n for(var j=0; j<orders[i].length; j++) {\n if (loopBegin[i]<=orders[i][j] && orders[i][j]<loopEnd[i]) {\n newOrder.push(orders[i][j]-loopBegin[i]) // If this is a loop index, put it in newOrder, subtracting loopBegin, to make sure that all loopOrders are using a common set of indices.\n }\n }\n loopOrders.push(newOrder)\n }\n\n //First create arguments for procedure\n var arglist = [\"SS\"] // SS is the overall shape over which we iterate\n var code = [\"'use strict'\"]\n var vars = []\n \n for(var j=0; j<dimension; ++j) {\n vars.push([\"s\", j, \"=SS[\", j, \"]\"].join(\"\")) // The limits for each dimension.\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n arglist.push(\"a\"+i) // Actual data array\n arglist.push(\"t\"+i) // Strides\n arglist.push(\"p\"+i) // Offset in the array at which the data starts (also used for iterating over the data)\n \n for(var j=0; j<dimension; ++j) { // Unpack the strides into vars for looping\n vars.push([\"t\",i,\"p\",j,\"=t\",i,\"[\",loopBegin[i]+j,\"]\"].join(\"\"))\n }\n \n for(var j=0; j<Math.abs(proc.arrayBlockIndices[i]); ++j) { // Unpack the strides into vars for block iteration\n vars.push([\"t\",i,\"b\",j,\"=t\",i,\"[\",blockBegin[i]+j,\"]\"].join(\"\"))\n }\n }\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n arglist.push(\"Y\" + i)\n }\n if(proc.shapeArgs.length > 0) {\n vars.push(\"shape=SS.slice(0)\") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example)\n }\n if(proc.indexArgs.length > 0) {\n // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes.\n var zeros = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n zeros[i] = \"0\"\n }\n vars.push([\"index=[\", zeros.join(\",\"), \"]\"].join(\"\"))\n }\n for(var i=0; i<proc.offsetArgs.length; ++i) { // Offset arguments used for stencil operations\n var off_arg = proc.offsetArgs[i]\n var init_string = []\n for(var j=0; j<off_arg.offset.length; ++j) {\n if(off_arg.offset[j] === 0) {\n continue\n } else if(off_arg.offset[j] === 1) {\n init_string.push([\"t\", off_arg.array, \"p\", j].join(\"\")) \n } else {\n init_string.push([off_arg.offset[j], \"*t\", off_arg.array, \"p\", j].join(\"\"))\n }\n }\n if(init_string.length === 0) {\n vars.push(\"q\" + i + \"=0\")\n } else {\n vars.push([\"q\", i, \"=\", init_string.join(\"+\")].join(\"\"))\n }\n }\n\n //Prepare this variables\n var thisVars = uniq([].concat(proc.pre.thisVars)\n .concat(proc.body.thisVars)\n .concat(proc.post.thisVars))\n vars = vars.concat(thisVars)\n if (vars.length > 0) {\n code.push(\"var \" + vars.join(\",\"))\n }\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n code.push(\"p\"+i+\"|=0\")\n }\n \n //Inline prelude\n if(proc.pre.body.length > 3) {\n code.push(processBlock(proc.pre, proc, dtypes))\n }\n\n //Process body\n var body = processBlock(proc.body, proc, dtypes)\n var matched = countMatches(loopOrders)\n if(matched < dimension) {\n code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example.\n } else {\n code.push(innerFill(loopOrders[0], proc, body))\n }\n\n //Inline epilog\n if(proc.post.body.length > 3) {\n code.push(processBlock(proc.post, proc, dtypes))\n }\n \n if(proc.debug) {\n console.log(\"-----Generated cwise routine for \", typesig, \":\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n var loopName = [(proc.funcName||\"unnamed\"), \"_cwise_loop_\", orders[0].join(\"s\"),\"m\",matched,typeSummary(dtypes)].join(\"\")\n var f = new Function([\"function \",loopName,\"(\", arglist.join(\",\"),\"){\", code.join(\"\\n\"),\"} return \", loopName].join(\"\"))\n return f()\n}\nmodule.exports = generateCWiseOp\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/cwise-compiler/lib/compile.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/cwise-compiler/lib/thunk.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/cwise-compiler/lib/thunk.js ***!
|
||
\**************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\n// The function below is called when constructing a cwise function object, and does the following:\n// A function object is constructed which accepts as argument a compilation function and returns another function.\n// It is this other function that is eventually returned by createThunk, and this function is the one that actually\n// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed.\n// The compilation passed to the first function object is used for compiling new functions.\n// Once this function object is created, it is called with compile as argument, where the first argument of compile\n// is bound to \"proc\" (essentially containing a preprocessed version of the user arguments to cwise).\n// So createThunk roughly works like this:\n// function createThunk(proc) {\n// var thunk = function(compileBound) {\n// var CACHED = {}\n// return function(arrays and scalars) {\n// if (dtype and order of arrays in CACHED) {\n// var func = CACHED[dtype and order of arrays]\n// } else {\n// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays)\n// }\n// return func(arrays and scalars)\n// }\n// }\n// return thunk(compile.bind1(proc))\n// }\n\nvar compile = __webpack_require__(/*! ./compile.js */ \"./node_modules/cwise-compiler/lib/compile.js\")\n\nfunction createThunk(proc) {\n var code = [\"'use strict'\", \"var CACHED={}\"]\n var vars = []\n var thunkName = proc.funcName + \"_cwise_thunk\"\n \n //Build thunk\n code.push([\"return function \", thunkName, \"(\", proc.shimArgs.join(\",\"), \"){\"].join(\"\"))\n var typesig = []\n var string_typesig = []\n var proc_args = [[\"array\",proc.arrayArgs[0],\".shape.slice(\", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS).\n Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(\",\"+proc.arrayBlockIndices[0]+\")\"):\")\"].join(\"\")]\n var shapeLengthConditions = [], shapeConditions = []\n // Process array arguments\n for(var i=0; i<proc.arrayArgs.length; ++i) {\n var j = proc.arrayArgs[i]\n vars.push([\"t\", j, \"=array\", j, \".dtype,\",\n \"r\", j, \"=array\", j, \".order\"].join(\"\"))\n typesig.push(\"t\" + j)\n typesig.push(\"r\" + j)\n string_typesig.push(\"t\"+j)\n string_typesig.push(\"r\"+j+\".join()\")\n proc_args.push(\"array\" + j + \".data\")\n proc_args.push(\"array\" + j + \".stride\")\n proc_args.push(\"array\" + j + \".offset|0\")\n if (i>0) { // Gather conditions to check for shape equality (ignoring block indices)\n shapeLengthConditions.push(\"array\" + proc.arrayArgs[0] + \".shape.length===array\" + j + \".shape.length+\" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i])))\n shapeConditions.push(\"array\" + proc.arrayArgs[0] + \".shape[shapeIndex+\" + Math.max(0,proc.arrayBlockIndices[0]) + \"]===array\" + j + \".shape[shapeIndex+\" + Math.max(0,proc.arrayBlockIndices[i]) + \"]\")\n }\n }\n // Check for shape equality\n if (proc.arrayArgs.length > 1) {\n code.push(\"if (!(\" + shapeLengthConditions.join(\" && \") + \")) throw new Error('cwise: Arrays do not all have the same dimensionality!')\")\n code.push(\"for(var shapeIndex=array\" + proc.arrayArgs[0] + \".shape.length-\" + Math.abs(proc.arrayBlockIndices[0]) + \"; shapeIndex-->0;) {\")\n code.push(\"if (!(\" + shapeConditions.join(\" && \") + \")) throw new Error('cwise: Arrays do not all have the same shape!')\")\n code.push(\"}\")\n }\n // Process scalar arguments\n for(var i=0; i<proc.scalarArgs.length; ++i) {\n proc_args.push(\"scalar\" + proc.scalarArgs[i])\n }\n // Check for cached function (and if not present, generate it)\n vars.push([\"type=[\", string_typesig.join(\",\"), \"].join()\"].join(\"\"))\n vars.push(\"proc=CACHED[type]\")\n code.push(\"var \" + vars.join(\",\"))\n \n code.push([\"if(!proc){\",\n \"CACHED[type]=proc=compile([\", typesig.join(\",\"), \"])}\",\n \"return proc(\", proc_args.join(\",\"), \")}\"].join(\"\"))\n\n if(proc.debug) {\n console.log(\"-----Generated thunk:\\n\" + code.join(\"\\n\") + \"\\n----------\")\n }\n \n //Compile thunk\n var thunk = new Function(\"compile\", code.join(\"\\n\"))\n return thunk(compile.bind(undefined, proc))\n}\n\nmodule.exports = createThunk\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/cwise-compiler/lib/thunk.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/data-uri-to-buffer/index.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/data-uri-to-buffer/index.js ***!
|
||
\**************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ \"./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js\")[\"Buffer\"];\n\n/**\n * Module exports.\n */\n\nmodule.exports = dataUriToBuffer;\n\n/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @param {String} uri Data URI to turn into a Buffer instance\n * @return {Buffer} Buffer instance from Data URI\n * @api public\n */\n\nfunction dataUriToBuffer (uri) {\n if (!/^data\\:/i.test(uri)) {\n throw new TypeError('`uri` does not appear to be a Data URI (must begin with \"data:\")');\n }\n\n // strip newlines\n uri = uri.replace(/\\r?\\n/g, '');\n\n // split the URI up into the \"metadata\" and the \"data\" portions\n var firstComma = uri.indexOf(',');\n if (-1 === firstComma || firstComma <= 4) throw new TypeError('malformed data: URI');\n\n // remove the \"data:\" scheme and parse the metadata\n var meta = uri.substring(5, firstComma).split(';');\n\n var base64 = false;\n var charset = 'US-ASCII';\n for (var i = 0; i < meta.length; i++) {\n if ('base64' == meta[i]) {\n base64 = true;\n } else if (0 == meta[i].indexOf('charset=')) {\n charset = meta[i].substring(8);\n }\n }\n\n // get the encoded data portion and decode URI-encoded chars\n var data = unescape(uri.substring(firstComma + 1));\n\n var encoding = base64 ? 'base64' : 'ascii';\n var buffer = new Buffer(data, encoding);\n\n // set `.type` property to MIME type\n buffer.type = meta[0] || 'text/plain';\n\n // set the `.charset` property\n buffer.charset = charset;\n\n return buffer;\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/data-uri-to-buffer/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/base64-js/index.js":
|
||
/*!*******************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/base64-js/index.js ***!
|
||
\*******************************************************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/base64-js/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js":
|
||
/*!****************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js ***!
|
||
\****************************************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nconst base64 = __webpack_require__(/*! base64-js */ \"./node_modules/es-pack-js/node-polyfill/node_modules/base64-js/index.js\")\nconst ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\")\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return '<Buffer ' + str + '>'\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/events/events.js":
|
||
/*!*****************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/events/events.js ***!
|
||
\*****************************************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/events/events.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/path-browserify/index.js":
|
||
/*!*************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/path-browserify/index.js ***!
|
||
\*************************************************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/path-browserify/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js":
|
||
/*!**********************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js ***!
|
||
\**********************************************************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inheritsLoose(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n\n return NodeError;\n }(Base);\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"';\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n }\n\n msg += \". Received type \".concat(typeof actual);\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented';\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\nmodule.exports.codes = codes;\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js":
|
||
/*!**************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js ***!
|
||
\**************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n/*<replacement>*/\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n\n for (var key in obj) {\n keys.push(key);\n }\n\n return keys;\n};\n/*</replacement>*/\n\n\nmodule.exports = Duplex;\n\nvar Readable = __webpack_require__(/*! ./_stream_readable */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_readable.js\");\n\nvar Writable = __webpack_require__(/*! ./_stream_writable */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_writable.js\");\n\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Duplex, Readable);\n\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n}); // the no-half-open enforcer\n\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return; // no more data can be written.\n // But allow more writes to happen in this tick.\n\n process.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_passthrough.js":
|
||
/*!*******************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_passthrough.js ***!
|
||
\*******************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n\nmodule.exports = PassThrough;\n\nvar Transform = __webpack_require__(/*! ./_stream_transform */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_transform.js\");\n\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_passthrough.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_readable.js":
|
||
/*!****************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_readable.js ***!
|
||
\****************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\nmodule.exports = Readable;\n/*<replacement>*/\n\nvar Duplex;\n/*</replacement>*/\n\nReadable.ReadableState = ReadableState;\n/*<replacement>*/\n\nvar EE = (__webpack_require__(/*! events */ \"./node_modules/es-pack-js/node-polyfill/node_modules/events/events.js\").EventEmitter);\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/*</replacement>*/\n\n/*<replacement>*/\n\n\nvar Stream = __webpack_require__(/*! ./internal/streams/stream */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/stream-browser.js\");\n/*</replacement>*/\n\n\nvar Buffer = (__webpack_require__(/*! buffer */ \"./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js\").Buffer);\n\nvar OurUint8Array = __webpack_require__.g.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/*<replacement>*/\n\n\nvar debugUtil = __webpack_require__(/*! util */ \"?98ce\");\n\nvar debug;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/*</replacement>*/\n\n\nvar BufferList = __webpack_require__(/*! ./internal/streams/buffer_list */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/buffer_list.js\");\n\nvar destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/destroy.js\");\n\nvar _require = __webpack_require__(/*! ./internal/streams/state */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/state.js\"),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js\").codes),\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.\n\n\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Readable, Stream);\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js\");\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')\n\n this.autoDestroy = !!options.autoDestroy; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ \"./node_modules/es-pack-js/node-polyfill/node_modules/string_decoder/lib/string_decoder.js\").StringDecoder);\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js\");\n if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n } // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n\n\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n\n return er;\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = (__webpack_require__(/*! string_decoder/ */ \"./node_modules/es-pack-js/node-polyfill/node_modules/string_decoder/lib/string_decoder.js\").StringDecoder);\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8\n\n this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:\n\n var p = this._readableState.buffer.head;\n var content = '';\n\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n\n this._readableState.buffer.clear();\n\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n}; // Don't raise the hwm > 1GB\n\n\nvar MAX_HWM = 0x40000000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true;\n\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n } // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n\n\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused\n\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true; // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume'); // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n\n state.paused = false;\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n\n if (!state.reading) {\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n this._readableState.paused = true;\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {\n ;\n }\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = __webpack_require__(/*! ./internal/streams/async_iterator */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/async_iterator.js\");\n }\n\n return createReadableStreamAsyncIterator(this);\n };\n}\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n}); // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.\n\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\n\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = __webpack_require__(/*! ./internal/streams/from */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/from-browser.js\");\n }\n\n return from(Readable, iterable, opts);\n };\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_readable.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_transform.js":
|
||
/*!*****************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_transform.js ***!
|
||
\*****************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n\nmodule.exports = Transform;\n\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js\").codes),\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n\nvar Duplex = __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js\");\n\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_transform.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_writable.js":
|
||
/*!****************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_writable.js ***!
|
||
\****************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n\nmodule.exports = Writable;\n/* <replacement> */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* </replacement> */\n\n/*<replacement>*/\n\n\nvar Duplex;\n/*</replacement>*/\n\nWritable.WritableState = WritableState;\n/*<replacement>*/\n\nvar internalUtil = {\n deprecate: __webpack_require__(/*! util-deprecate */ \"./node_modules/es-pack-js/node-polyfill/node_modules/util-deprecate/browser.js\")\n};\n/*</replacement>*/\n\n/*<replacement>*/\n\nvar Stream = __webpack_require__(/*! ./internal/streams/stream */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/stream-browser.js\");\n/*</replacement>*/\n\n\nvar Buffer = (__webpack_require__(/*! buffer */ \"./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js\").Buffer);\n\nvar OurUint8Array = __webpack_require__.g.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\nvar destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/destroy.js\");\n\nvar _require = __webpack_require__(/*! ./internal/streams/state */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/state.js\"),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = (__webpack_require__(/*! ../errors */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js\").codes),\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n\n__webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\")(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js\");\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')\n\n this.autoDestroy = !!options.autoDestroy; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js\"); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb\n\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n\n return true;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n errorOrDestroy(stream, err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n } // reuse the free corkReq.\n\n\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_writable.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/async_iterator.js":
|
||
/*!*******************************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/async_iterator.js ***!
|
||
\*******************************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar _Object$setPrototypeO;\n\nfunction _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; }\n\nvar finished = __webpack_require__(/*! ./end-of-stream */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/end-of-stream.js\");\n\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\n\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\n\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n\n if (resolve !== null) {\n var data = iter[kStream].read(); // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\n\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\n\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\n\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n\n next: function next() {\n var _this = this;\n\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n\n if (error !== null) {\n return Promise.reject(error);\n }\n\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n } // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n\n\n var lastPromise = this[kLastPromise];\n var promise;\n\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n\n promise = new Promise(this[kHandlePromise]);\n }\n\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\n\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n\n iterator[kError] = err;\n return;\n }\n\n var resolve = iterator[kLastResolve];\n\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\n\nmodule.exports = createReadableStreamAsyncIterator;\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/async_iterator.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/buffer_list.js":
|
||
/*!****************************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/buffer_list.js ***!
|
||
\****************************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _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; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar _require = __webpack_require__(/*! buffer */ \"./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js\"),\n Buffer = _require.Buffer;\n\nvar _require2 = __webpack_require__(/*! util */ \"?1ed4\"),\n inspect = _require2.inspect;\n\nvar custom = inspect && inspect.custom || 'inspect';\n\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\n\nmodule.exports =\n/*#__PURE__*/\nfunction () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n\n while (p = p.next) {\n ret += s + p.data;\n }\n\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n\n return ret;\n } // Consumes a specified amount of bytes or characters from the buffered data.\n\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n } // Consumes a specified amount of characters from the buffered data.\n\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n this.length -= c;\n return ret;\n } // Consumes a specified amount of bytes from the buffered data.\n\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n this.length -= c;\n return ret;\n } // Make sure the linked list only shows the minimal necessary information.\n\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread({}, options, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n\n return BufferList;\n}();\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/buffer_list.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/destroy.js":
|
||
/*!************************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/destroy.js ***!
|
||
\************************************************************************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval(" // undocumented cb() API, needed for core, not for public API\n\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n\n return this;\n } // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n } // if this is a duplex stream mark the writable part as destroyed as well\n\n\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n\n return this;\n}\n\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\n\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/destroy.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/end-of-stream.js":
|
||
/*!******************************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/end-of-stream.js ***!
|
||
\******************************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n\nvar ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(/*! ../../../errors */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js\").codes.ERR_STREAM_PREMATURE_CLOSE);\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callback.apply(this, args);\n };\n}\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n\n var writableEnded = stream._writableState && stream._writableState.finished;\n\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n\n var onclose = function onclose() {\n var err;\n\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/end-of-stream.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/from-browser.js":
|
||
/*!*****************************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/from-browser.js ***!
|
||
\*****************************************************************************************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("module.exports = function () {\n throw new Error('Readable.from is not available in the browser')\n};\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/from-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/pipeline.js":
|
||
/*!*************************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/pipeline.js ***!
|
||
\*************************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n\nvar eos;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\n\nvar _require$codes = (__webpack_require__(/*! ../../../errors */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js\").codes),\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = __webpack_require__(/*! ./end-of-stream */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/end-of-stream.js\");\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true; // request.destroy just do .end - .abort is what we want\n\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\n\nfunction call(fn) {\n fn();\n}\n\nfunction pipe(from, to) {\n return from.pipe(to);\n}\n\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\n\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\n\nmodule.exports = pipeline;\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/pipeline.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/state.js":
|
||
/*!**********************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/state.js ***!
|
||
\**********************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar ERR_INVALID_OPT_VALUE = (__webpack_require__(/*! ../../../errors */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/errors-browser.js\").codes.ERR_INVALID_OPT_VALUE);\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n\n return Math.floor(hwm);\n } // Default value\n\n\n return state.objectMode ? 16 : 16 * 1024;\n}\n\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/state.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/stream-browser.js":
|
||
/*!*******************************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/stream-browser.js ***!
|
||
\*******************************************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("module.exports = __webpack_require__(/*! events */ \"./node_modules/es-pack-js/node-polyfill/node_modules/events/events.js\").EventEmitter;\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/stream-browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/stream-browserify/index.js":
|
||
/*!***************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/stream-browserify/index.js ***!
|
||
\***************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = (__webpack_require__(/*! events */ \"./node_modules/es-pack-js/node-polyfill/node_modules/events/events.js\").EventEmitter);\nvar inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n\ninherits(Stream, EE);\nStream.Readable = __webpack_require__(/*! readable-stream/lib/_stream_readable.js */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_readable.js\");\nStream.Writable = __webpack_require__(/*! readable-stream/lib/_stream_writable.js */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_writable.js\");\nStream.Duplex = __webpack_require__(/*! readable-stream/lib/_stream_duplex.js */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_duplex.js\");\nStream.Transform = __webpack_require__(/*! readable-stream/lib/_stream_transform.js */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_transform.js\");\nStream.PassThrough = __webpack_require__(/*! readable-stream/lib/_stream_passthrough.js */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/_stream_passthrough.js\");\nStream.finished = __webpack_require__(/*! readable-stream/lib/internal/streams/end-of-stream.js */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/end-of-stream.js\")\nStream.pipeline = __webpack_require__(/*! readable-stream/lib/internal/streams/pipeline.js */ \"./node_modules/es-pack-js/node-polyfill/node_modules/readable-stream/lib/internal/streams/pipeline.js\")\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/stream-browserify/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/string_decoder/lib/string_decoder.js":
|
||
/*!*************************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/string_decoder/lib/string_decoder.js ***!
|
||
\*************************************************************************************************/
|
||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n/*<replacement>*/\n\nvar Buffer = (__webpack_require__(/*! safe-buffer */ \"./node_modules/safe-buffer/index.js\").Buffer);\n/*</replacement>*/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/string_decoder/lib/string_decoder.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/node-polyfill/node_modules/util-deprecate/browser.js":
|
||
/*!**************************************************************************************!*\
|
||
!*** ./node_modules/es-pack-js/node-polyfill/node_modules/util-deprecate/browser.js ***!
|
||
\**************************************************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!__webpack_require__.g.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = __webpack_require__.g.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/node-polyfill/node_modules/util-deprecate/browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/index.js":
|
||
/*!**********************!*\
|
||
!*** ./src/index.js ***!
|
||
\**********************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../package.json */ \"./package.json\");\n/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! regenerator-runtime/runtime.js */ \"./node_modules/regenerator-runtime/runtime.js\");\n/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"three\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _mapbox_tile_cover__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @mapbox/tile-cover */ \"./node_modules/@mapbox/tile-cover/index.js\");\n/* harmony import */ var _models_rgb_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./models/rgb.js */ \"./src/models/rgb.js\");\n/* harmony import */ var _models_vector_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./models/vector.js */ \"./src/models/vector.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils.js */ \"./src/utils.js\");\n/* harmony import */ var three_laser_pointer_src__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three-laser-pointer/src */ \"./node_modules/three-laser-pointer/src/index.js\");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n\nvar __version = _package_json__WEBPACK_IMPORTED_MODULE_0__.version;\n\n\n\n\n\n\n // import Elevation from './elevation.js'; // WIP\n\nvar Elevation = {\n resolveElevation: function resolveElevation() {\n return undefined;\n }\n}; // dummy for now\n\nvar ThreeGeo = /*#__PURE__*/function () {\n function ThreeGeo() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, ThreeGeo);\n\n this.version = __version;\n console.info(\"ThreeGeo \".concat(__version, \" with THREE r\").concat(three__WEBPACK_IMPORTED_MODULE_2__.REVISION));\n var defaults = {\n unitsSide: 1.0,\n tokenMapbox: '',\n isNode: false,\n isDebug: false,\n apiVector: 'mapbox-terrain-vector',\n apiRgb: 'mapbox-terrain-rgb',\n apiSatellite: 'mapbox-satellite'\n };\n var actual = Object.assign({}, defaults, opts);\n this.constUnitsSide = actual.unitsSide;\n this.tokenMapbox = actual.tokenMapbox;\n this.isNode =\n /* legacy */\n actual.useNodePixels || actual.isNode;\n this.isDebug = actual.isDebug;\n this.apiVector = actual.apiVector;\n this.apiRgb = actual.apiRgb;\n this.apiSatellite = actual.apiSatellite;\n\n if (this.isDebug) {\n console.warn('`isDebug` is true; terrains support `.userData.debug()`.');\n }\n }\n\n _createClass(ThreeGeo, [{\n key: \"getProjection\",\n value: // ll-notation\n // latlng: three-geo, leaflet\n // lnglat: turf\n function getProjection(origin, radius) {\n var unitsSide = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.constUnitsSide;\n var wsen = _utils_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].originRadiusToBbox(origin, radius); // console.log('origin:', origin);\n // console.log('wsen:', wsen);\n\n var _unitsPerMeter = ThreeGeo._getUnitsPerMeter(unitsSide, radius);\n\n return {\n proj: function proj(latlng) {\n var meshes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n return (// `meshes`: rgbDem\n ThreeGeo._proj(latlng, meshes, wsen, unitsSide)\n );\n },\n projInv: function projInv(x, y) {\n return ThreeGeo._projInv(x, y, origin, _unitsPerMeter);\n },\n // latlng\n bbox: wsen,\n unitsPerMeter: _unitsPerMeter\n };\n }\n }, {\n key: \"getTerrain\",\n value: function getTerrain(origin, radius, zoom) {\n var _this = this;\n\n var cbs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n return new Promise(function (res, rej) {\n try {\n var watcher = ThreeGeo._createWatcher(cbs, res);\n\n if (!watcher) return; // static parameters\n\n var _unitsSide = _this.constUnitsSide;\n\n var unitsPerMeter = ThreeGeo._getUnitsPerMeter(_unitsSide, radius);\n\n var projectCoord = function projectCoord(coord, nw, se) {\n return ThreeGeo._projectCoord(_unitsSide, coord, nw, se);\n };\n\n var token = _this.tokenMapbox,\n isNode = _this.isNode,\n isDebug = _this.isDebug,\n apiRgb = _this.apiRgb,\n apiSatellite = _this.apiSatellite,\n apiVector = _this.apiVector; // callbacks\n\n var onRgbDem = cbs.onRgbDem,\n onSatelliteMat = cbs.onSatelliteMat,\n onVectorDem = cbs.onVectorDem; // ROI\n\n var bbox = ThreeGeo.getBbox(origin, radius);\n console.log('bbox:', bbox);\n var zpCovered = ThreeGeo.getZoomposCovered(bbox.feature, zoom);\n console.log('(satellite-level) zpCovered:', zpCovered);\n\n if (onRgbDem) {\n new _models_rgb_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]({\n unitsPerMeter: unitsPerMeter,\n projectCoord: projectCoord,\n token: token,\n isNode: isNode,\n isDebug: isDebug,\n apiRgb: apiRgb,\n apiSatellite: apiSatellite,\n onRgbDem: onRgbDem,\n onSatelliteMat: onSatelliteMat,\n watcher: watcher\n }).fetch(zpCovered, bbox);\n }\n\n if (onVectorDem) {\n new _models_vector_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]({\n unitsPerMeter: unitsPerMeter,\n projectCoord: projectCoord,\n token: token,\n isNode: isNode,\n isDebug: isDebug,\n apiVector: apiVector,\n onVectorDem: onVectorDem,\n watcher: watcher\n }).fetch(zpCovered, bbox, radius);\n }\n } catch (err) {\n console.error('err:', err);\n rej(err);\n }\n });\n }\n }, {\n key: \"getTerrainRgb\",\n value: function () {\n var _getTerrainRgb = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(origin, radius, zoom) {\n var _cb,\n _yield$this$getTerrai,\n objs,\n debug,\n _args = arguments;\n\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _cb = _args.length > 3 && _args[3] !== undefined ? _args[3] : undefined;\n _context.next = 3;\n return this.getTerrain(origin, radius, zoom, {\n // Set dummy callbacks to trigger rgb DEM fetching\n onRgbDem: function onRgbDem() {},\n onSatelliteMat: function onSatelliteMat() {}\n });\n\n case 3:\n _yield$this$getTerrai = _context.sent;\n objs = _yield$this$getTerrai.rgbDem;\n debug = _yield$this$getTerrai.debug;\n return _context.abrupt(\"return\", _cb ? _cb(objs) : ThreeGeo._createDemGroup('dem-rgb', objs, debug));\n\n case 7:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function getTerrainRgb(_x, _x2, _x3) {\n return _getTerrainRgb.apply(this, arguments);\n }\n\n return getTerrainRgb;\n }()\n }, {\n key: \"getTerrainVector\",\n value: function () {\n var _getTerrainVector = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(origin, radius, zoom) {\n var _cb,\n _yield$this$getTerrai2,\n objs,\n debug,\n _args2 = arguments;\n\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _cb = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : undefined;\n _context2.next = 3;\n return this.getTerrain(origin, radius, zoom, {\n // Set dummy callbacks to trigger vector DEM fetching\n onVectorDem: function onVectorDem() {}\n });\n\n case 3:\n _yield$this$getTerrai2 = _context2.sent;\n objs = _yield$this$getTerrai2.vectorDem;\n debug = _yield$this$getTerrai2.debug;\n return _context2.abrupt(\"return\", _cb ? _cb(objs) : ThreeGeo._createDemGroup('dem-vec', objs, debug));\n\n case 7:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function getTerrainVector(_x4, _x5, _x6) {\n return _getTerrainVector.apply(this, arguments);\n }\n\n return getTerrainVector;\n }()\n }, {\n key: \"setApiVector\",\n value: function setApiVector(api) {\n this.apiVector = api;\n }\n }, {\n key: \"setApiRgb\",\n value: function setApiRgb(api) {\n this.apiRgb = api;\n }\n }, {\n key: \"setApiSatellite\",\n value: function setApiSatellite(api) {\n this.apiSatellite = api;\n }\n }], [{\n key: \"_getUnitsPerMeter\",\n value: function _getUnitsPerMeter(unitsSide, radius) {\n return unitsSide / (radius * Math.pow(2, 0.5) * 1000);\n }\n }, {\n key: \"_projectCoord\",\n value: function _projectCoord(unitsSide, coord, nw, se) {\n // lng, lat -> px, py\n return [unitsSide * (-0.5 + (coord[0] - nw[0]) / (se[0] - nw[0])), unitsSide * (-0.5 - (coord[1] - se[1]) / (se[1] - nw[1]))];\n }\n }, {\n key: \"_proj\",\n value: function _proj(ll, meshes, wsen, unitsSide) {\n var _ll = _slicedToArray(ll, 2),\n lat = _ll[0],\n lng = _ll[1];\n\n var _wsen = _slicedToArray(wsen, 4),\n w = _wsen[0],\n s = _wsen[1],\n e = _wsen[2],\n n = _wsen[3]; // [x, y, z]: terrain coordinates\n\n\n var _this$_projectCoord = this._projectCoord(unitsSide, [lng, lat], [w, n], [e, s]),\n _this$_projectCoord2 = _slicedToArray(_this$_projectCoord, 2),\n x = _this$_projectCoord2[0],\n y = _this$_projectCoord2[1]; // WIP (undocumented API): Resolve `z` (elevation) in case\n // the optional `meshes` is provided.\n\n\n var z = meshes ? Elevation.resolveElevation(x, y, lat, lng, meshes) : // 'maybe' `undefined`\n undefined;\n return z !== undefined ? [x, y, z] : [x, y];\n }\n }, {\n key: \"_projInv\",\n value: function _projInv(x, y, origin, unitsPerMeter) {\n var ll = _utils_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].translateTurfObject(_utils_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].createTurfPoint(origin), x, y, 0, unitsPerMeter).geometry.coordinates; // lnglat\n\n return [ll[1], ll[0]]; // latlng\n } // Zoom extent - https://www.mapbox.com/studio/tilesets/\n // satellite: z0 ~ z22\n // rgb dem: z0 ~ z15\n // vector dem: z0 ~ z15\n\n }, {\n key: \"getZoomposCovered\",\n value: function getZoomposCovered(polygon, zoom) {\n // isochrone polygon\n // https://www.mapbox.com/vector-tiles/mapbox-terrain/#contour\n // Zoom level Contour Interval\n // 9 500 meters\n // 10 200 meters\n // 11 100 meters\n // 12 50 meters\n // 13 20 meters\n // 14+ 10 meters\n var limits = {\n min_zoom: zoom,\n max_zoom: zoom\n };\n return _mapbox_tile_cover__WEBPACK_IMPORTED_MODULE_3__.tiles(polygon.geometry, limits) // poszoom\n .map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 3),\n x = _ref2[0],\n y = _ref2[1],\n z = _ref2[2];\n\n return [z, x, y];\n }); // zoompos now!!\n }\n }, {\n key: \"getBbox\",\n value: function getBbox(origin, radius) {\n var testPolygon = {\n \"type\": \"FeatureCollection\",\n \"features\": [{\n \"type\": \"Feature\",\n \"properties\": {},\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [[]]\n }\n }]\n };\n var polygon = testPolygon.features[0];\n\n var _Utils$originRadiusTo = _utils_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"].originRadiusToBbox(origin, radius),\n _Utils$originRadiusTo2 = _slicedToArray(_Utils$originRadiusTo, 4),\n w = _Utils$originRadiusTo2[0],\n s = _Utils$originRadiusTo2[1],\n e = _Utils$originRadiusTo2[2],\n n = _Utils$originRadiusTo2[3];\n\n var nw = [w, n],\n se = [e, s];\n polygon.geometry.coordinates[0] = [nw, [se[0], nw[1]], se, [nw[0], se[1]], nw]; // console.log('testPolygon:', testPolygon);\n\n return {\n feature: polygon,\n northWest: nw,\n southEast: se\n };\n }\n }, {\n key: \"_createWatcher\",\n value: function _createWatcher(cbs, res) {\n var isVecPending = cbs.onVectorDem ? true : false;\n var isRgbPending = cbs.onRgbDem ? true : false;\n var ret = {\n vectorDem: [],\n rgbDem: [],\n debug: null\n };\n\n var isDone = function isDone() {\n return !isVecPending && !isRgbPending;\n };\n\n if (isDone()) {\n console.log('no callbacks are set');\n res(ret);\n return null;\n }\n\n return function (payload) {\n var what = payload.what,\n data = payload.data,\n debug = payload.debug;\n ret.debug = debug;\n\n if (what === 'dem-vec') {\n isVecPending = false;\n ret.vectorDem = data;\n }\n\n if (what === 'dem-rgb') {\n isRgbPending = false;\n ret.rgbDem = data;\n }\n\n if (isDone()) {\n console.log('all callbacks are complete');\n res(ret);\n }\n };\n }\n }, {\n key: \"_createDemGroup\",\n value: function _createDemGroup(name, objs, debug) {\n var group = new three__WEBPACK_IMPORTED_MODULE_2__.Group();\n group.name = name;\n\n group.userData['debug'] = function () {\n if (!debug) console.warn('Use the `isDebug` option to enable `.userData.debug()`.');\n return debug;\n };\n\n var _iterator = _createForOfIteratorHelper(objs),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var obj = _step.value;\n group.add(obj);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n return group;\n }\n }]);\n\n return ThreeGeo;\n}();\n\nThreeGeo.Utils = _utils_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\nThreeGeo.Laser = three_laser_pointer_src__WEBPACK_IMPORTED_MODULE_7__[\"default\"];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ThreeGeo);\n\n//# sourceURL=webpack://ThreeGeo/./src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/models/fetch.js":
|
||
/*!*****************************!*\
|
||
!*** ./src/models/fetch.js ***!
|
||
\*****************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var xhr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! xhr */ \"./node_modules/xhr/index.js\");\n/* harmony import */ var xhr__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(xhr__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var pbf__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! pbf */ \"./node_modules/pbf/index.js\");\n/* harmony import */ var pbf__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(pbf__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _mapbox_vector_tile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @mapbox/vector-tile */ \"./node_modules/@mapbox/vector-tile/index.js\");\n/* harmony import */ var get_pixels__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! get-pixels */ \"./node_modules/get-pixels/dom-pixels.js\");\n/* harmony import */ var get_pixels__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(get_pixels__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils.js */ \"./src/utils.js\");\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n\n\n\n // 'get-pixels/dom-pixels'\n\n\n\nvar Fetch = /*#__PURE__*/function () {\n function Fetch() {\n _classCallCheck(this, Fetch);\n }\n\n _createClass(Fetch, null, [{\n key: \"getUriCustom\",\n value: function getUriCustom(api, zoompos) {\n // Resolve the api type: e.g. `../data/${name}/custom-terrain-rgb` -> `custom-terrain-rgb`\n var _api = api.split('/');\n\n _api = _api.length ? _api[_api.length - 1] : 'Oops';\n var extension;\n\n switch (_api) {\n case 'custom-terrain-vector':\n extension = 'pbf';\n break;\n\n case 'custom-terrain-rgb':\n extension = 'png';\n break;\n\n case 'custom-satellite':\n extension = 'jpg';\n break;\n\n default:\n console.log('getUriCustom(): unsupported api:', api);\n return '';\n }\n\n return \"\".concat(api, \"-\").concat(zoompos.join('-'), \".\").concat(extension);\n }\n }, {\n key: \"getUriMapbox\",\n value: function getUriMapbox(token, api, zoompos) {\n var prefix,\n res = '';\n\n switch (api) {\n case 'mapbox-terrain-vector':\n // https://docs.mapbox.com/help/troubleshooting/access-elevation-data/#mapbox-terrain-vector-tileset\n // https://docs.mapbox.com/api/maps/#vector-tiles\n prefix = 'https://api.mapbox.com/v4/mapbox.mapbox-terrain-v2';\n res = '.vector.pbf';\n break;\n\n case 'mapbox-terrain-rgb':\n // https://docs.mapbox.com/help/troubleshooting/access-elevation-data/#mapbox-terrain-rgb\n prefix = 'https://api.mapbox.com/v4/mapbox.terrain-rgb';\n res = '@2x.pngraw';\n break;\n\n case 'mapbox-satellite':\n // https://docs.mapbox.com/help/troubleshooting/migrate-legacy-static-images-api/\n // https://docs.mapbox.com/api/maps/#static-tiles\n prefix = 'https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles';\n break;\n\n default:\n console.log('getUriMapbox(): unsupported api:', api);\n return '';\n }\n\n return \"\".concat(prefix, \"/\").concat(zoompos.join('/')).concat(res, \"?access_token=\").concat(token);\n }\n }, {\n key: \"dumpBufferAsBlob\",\n value: function dumpBufferAsBlob(buffer, name) {\n // https://discourse.threejs.org/t/how-to-create-a-new-file-and-save-it-with-arraybuffer-content/628/2\n var file = new Blob([buffer], {\n type: 'application/octet-stream'\n });\n var anc = document.createElement('a');\n anc.href = URL.createObjectURL(file);\n anc.download = name;\n document.body.appendChild(anc);\n anc.click();\n }\n }, {\n key: \"dumpBlob\",\n value: function () {\n var _dumpBlob = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(uri, isNode, api, zoompos) {\n var ab;\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n _context.next = 3;\n return this.req(uri, isNode);\n\n case 3:\n ab = _context.sent;\n this.dumpBufferAsBlob(ab, \"\".concat(api, \"-\").concat(zoompos.join('-'), \".blob\"));\n _context.next = 10;\n break;\n\n case 7:\n _context.prev = 7;\n _context.t0 = _context[\"catch\"](0);\n console.error('dumpBlob(): err', _context.t0);\n\n case 10:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[0, 7]]);\n }));\n\n function dumpBlob(_x, _x2, _x3, _x4) {\n return _dumpBlob.apply(this, arguments);\n }\n\n return dumpBlob;\n }()\n }, {\n key: \"getRgbTile\",\n value: function () {\n var _getRgbTile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(uri, isNode, res) {\n var gp;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (!isNode) {\n _context2.next = 6;\n break;\n }\n\n _context2.next = 3;\n return _utils_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Meta.nodeRequire(__webpack_require__.g, 'get-pixels/node-pixels');\n\n case 3:\n _context2.t0 = _context2.sent;\n _context2.next = 7;\n break;\n\n case 6:\n _context2.t0 = (get_pixels__WEBPACK_IMPORTED_MODULE_3___default());\n\n case 7:\n gp = _context2.t0;\n gp(uri, function (error, pixels) {\n return res(error ? null : pixels);\n });\n\n case 9:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n function getRgbTile(_x5, _x6, _x7) {\n return _getRgbTile.apply(this, arguments);\n }\n\n return getRgbTile;\n }()\n }, {\n key: \"getVectorTile\",\n value: function () {\n var _getVectorTile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(uri, isNode, res) {\n var fs;\n return regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n if (!(isNode && !uri.startsWith('http://') && !uri.startsWith('https://'))) {\n _context3.next = 7;\n break;\n }\n\n _context3.next = 3;\n return _utils_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Meta.nodeRequire(__webpack_require__.g, 'fs');\n\n case 3:\n fs = _context3.sent;\n fs.readFile(uri, function (error, data) {\n return res(error ? null : new _mapbox_vector_tile__WEBPACK_IMPORTED_MODULE_2__.VectorTile(new (pbf__WEBPACK_IMPORTED_MODULE_1___default())(data.buffer)));\n });\n _context3.next = 16;\n break;\n\n case 7:\n _context3.t0 = res;\n _context3.t1 = _mapbox_vector_tile__WEBPACK_IMPORTED_MODULE_2__.VectorTile;\n _context3.t2 = (pbf__WEBPACK_IMPORTED_MODULE_1___default());\n _context3.next = 12;\n return this.req(uri, isNode);\n\n case 12:\n _context3.t3 = _context3.sent;\n _context3.t4 = new _context3.t2(_context3.t3);\n _context3.t5 = new _context3.t1(_context3.t4);\n (0, _context3.t0)(_context3.t5);\n\n case 16:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n\n function getVectorTile(_x8, _x9, _x10) {\n return _getVectorTile.apply(this, arguments);\n }\n\n return getVectorTile;\n }()\n }, {\n key: \"req\",\n value: function () {\n var _req2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(uri, isNode) {\n var _this = this;\n\n var _req;\n\n return regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n if (!isNode) {\n _context4.next = 6;\n break;\n }\n\n _context4.next = 3;\n return _utils_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"].Meta.nodeRequire(__webpack_require__.g, 'request');\n\n case 3:\n _context4.t0 = _context4.sent;\n _context4.next = 7;\n break;\n\n case 6:\n _context4.t0 = (xhr__WEBPACK_IMPORTED_MODULE_0___default());\n\n case 7:\n _req = _context4.t0;\n return _context4.abrupt(\"return\", new Promise(function (res, rej) {\n _req({\n uri: uri,\n responseType: 'arraybuffer'\n }, function (error, response, ab) {\n var err = error || !_this.isAjaxSuccessful(response.statusCode);\n err ? rej(err) : res(ab);\n });\n }));\n\n case 9:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n\n function req(_x11, _x12) {\n return _req2.apply(this, arguments);\n }\n\n return req;\n }()\n }, {\n key: \"isAjaxSuccessful\",\n value: function isAjaxSuccessful(stat) {\n console.log('stat:', stat); // https://stackoverflow.com/questions/21756910/how-to-use-status-codes-200-404-300-how-jquery-done-and-fail-work-internally\n\n return stat >= 200 && stat < 300 || stat === 304;\n } // compute elevation tiles belonging to the gradparent zoom level\n\n }, {\n key: \"getZoomposEle\",\n value: function getZoomposEle(zpArray) {\n var elevations = {};\n zpArray.forEach(function (zoompos) {\n var grandparent = [zoompos[0] - 2, Math.floor(zoompos[1] / 4), Math.floor(zoompos[2] / 4)];\n\n if (elevations[grandparent]) {\n elevations[grandparent].push(zoompos);\n } else {\n elevations[grandparent] = [zoompos];\n }\n }); // console.log('elevations:', elevations);\n\n return Object.keys(elevations).map(function (triplet) {\n return triplet.split(',').map(function (num) {\n return parseFloat(num);\n });\n });\n }\n }, {\n key: \"fetchTile\",\n value: function fetchTile(zoompos, api, token, isNode) {\n var _this2 = this;\n\n var tag = 'fetchTile()';\n var isMapbox = api.startsWith('mapbox-');\n var uri = isMapbox ? this.getUriMapbox(token, api, zoompos) : this.getUriCustom(api, zoompos);\n console.log(\"\".concat(tag, \": uri: \").concat(uri));\n\n var future = function future(res) {\n var ret = null;\n\n if (api.includes('mapbox-terrain-vector') || api.includes('custom-terrain-vector')) {\n ret = _this2.getVectorTile(uri, isNode, res);\n } else if (api.includes('mapbox-terrain-rgb') || api.includes('mapbox-satellite') || api.includes('custom-terrain-rgb') || api.includes('custom-satellite')) {\n ret = _this2.getRgbTile(uri, isNode, res);\n }\n\n return ret;\n };\n\n return new Promise( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(res, _rej) {\n var ft;\n return regeneratorRuntime.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n _context5.prev = 0;\n ft = future(res);\n\n if (!(ft !== null)) {\n _context5.next = 7;\n break;\n }\n\n _context5.next = 5;\n return ft;\n\n case 5:\n _context5.next = 8;\n break;\n\n case 7:\n throw new Error(\"\".concat(tag, \": unsupported api: \").concat(api));\n\n case 8:\n _context5.next = 14;\n break;\n\n case 10:\n _context5.prev = 10;\n _context5.t0 = _context5[\"catch\"](0);\n console.warn(\"\".concat(tag, \": err: \").concat(_context5.t0));\n res(null);\n\n case 14:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, null, [[0, 10]]);\n }));\n\n return function (_x13, _x14) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }]);\n\n return Fetch;\n}();\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Fetch);\n\n//# sourceURL=webpack://ThreeGeo/./src/models/fetch.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/models/rgb.js":
|
||
/*!***************************!*\
|
||
!*** ./src/models/rgb.js ***!
|
||
\***************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _fetch_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fetch.js */ \"./src/models/fetch.js\");\n/* harmony import */ var _mapbox_sphericalmercator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @mapbox/sphericalmercator */ \"./node_modules/@mapbox/sphericalmercator/sphericalmercator.js\");\n/* harmony import */ var _mapbox_sphericalmercator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_mapbox_sphericalmercator__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"three\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_2__);\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n\n\n\nvar constVertices = 128;\nvar constTilePixels = new (_mapbox_sphericalmercator__WEBPACK_IMPORTED_MODULE_1___default())({\n size: 128\n}); // use shift = 0 when array's format is [x0, z0, y0, x1, z1, y1, ... x127, z127, y127]\n// 0: Array(128) [1, 4, 7, 10, 13, 16, 19, 22, ... 379, 382]\n// 1: Array(128) [1, 385, 769, 1153, 1537, 1921, 2305, 2689, ... 48385, 48769]\n// 2: Array(128) [48769, 48772, 48775, 48778, 48781, 48784, 48787, 48790, ... 49147, 49150]\n// 3: Array(128) [382, 766, 1150, 1534, 1918, 2302, 2686, 3070, ... 48766, 49150]\n// use shift = 1 when array's format is [x0, y0, z0, x1, y1, z1, ... x127, y127, z127]\n// 0: Array(128) [2, 5, 8, 11, ... 380, 383]\n// 1: Array(128) [2, 386, 770, 1154, ... 48386, 48770]\n// 2: Array(128) [48770, 48773, 48776, 48779, ... 49148, 49151]\n// 3: Array(128) [383, 767, 1151, 1535, ... 48767, 49151]\n\nvar computeSeamRows = function computeSeamRows(shift) {\n var totalCount = 49152; // 128 * 128 * 3\n\n var rowCount = 384; // 128 * 3\n\n var rows = [[], [], [], []];\n\n for (var c = 0; c < rowCount; c += 3) {\n // 0, 1, 2, 3; north, west, south, east; +y, -x, -y, +x\n rows[0].push(c + 1 + shift);\n rows[1].push(c / 3 * rowCount + 1 + shift);\n rows[2].push(c + 1 + totalCount - rowCount + shift);\n rows[3].push((c / 3 + 1) * rowCount - 2 + shift);\n }\n\n return rows;\n};\n\nvar constSeamRows = computeSeamRows(1);\n\nvar sixteenthPixelRanges = function () {\n var cols = 512;\n var rows = 512;\n var scaleFactor = 4;\n var ranges = [];\n\n for (var c = 0; c < scaleFactor; c++) {\n for (var r = 0; r < scaleFactor; r++) {\n ranges.push([[r * (rows / scaleFactor - 1) + r, (r + 1) * rows / scaleFactor], [c * (cols / scaleFactor - 1) + c, (c + 1) * cols / scaleFactor]]);\n }\n }\n\n ;\n return ranges;\n}();\n\nvar RgbModel = /*#__PURE__*/function () {\n function RgbModel(params) {\n _classCallCheck(this, RgbModel);\n\n // static parameters\n this.unitsPerMeter = params.unitsPerMeter;\n this.projectCoord = params.projectCoord;\n this.token = params.token;\n this.isNode = params.isNode;\n this.isDebug = params.isDebug;\n this.apiRgb = params.apiRgb;\n this.apiSatellite = params.apiSatellite; // callbacks\n\n this.onRgbDem = params.onRgbDem;\n this.onSatelliteMat = params.onSatelliteMat;\n this.watcher = params.watcher; // state variables\n\n this.dataEleCovered = [];\n }\n\n _createClass(RgbModel, [{\n key: \"fetch\",\n value: function fetch(zpCovered, bbox) {\n var _this = this;\n\n // e.g. satellite's zoom: 14\n // dem's zoom: 12 (=14-2)\n var zpEle = _fetch_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].getZoomposEle(zpCovered);\n console.log('RgbModel: zpEle:', zpEle);\n var count = 0;\n zpEle.forEach( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(zoompos) {\n var tile;\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return _fetch_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fetchTile(zoompos, _this.apiRgb, _this.token, _this.isNode);\n\n case 2:\n tile = _context.sent;\n\n if (tile !== null) {\n _this.addTile(tile, zoompos, zpCovered, bbox);\n } else {\n console.log(\"fetchTile() failed for rgb dem of zp: \".concat(zoompos, \" (count: \").concat(count, \"/\").concat(zpEle.length, \")\"));\n }\n\n count++;\n\n if (count === zpEle.length) {\n _this.build();\n }\n\n case 6:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }, {\n key: \"addTile\",\n value: function addTile(tile, zoomposEle, zpCovered, bbox) {\n this.dataEleCovered = this.dataEleCovered.concat(this._addTile(tile, zoomposEle, zpCovered, bbox));\n console.log(\"now \".concat(this.dataEleCovered.length, \" satellite tiles in dataEleCovered\"));\n }\n }, {\n key: \"_addTile\",\n value: function _addTile(pixels, zoomposEle, zpCovered, bbox) {\n var unitsPerMeter = this.unitsPerMeter,\n projectCoord = this.projectCoord;\n var elevations = [];\n\n if (pixels) {\n var R, G, B;\n\n for (var e = 0; e < pixels.data.length; e += 4) {\n R = pixels.data[e];\n G = pixels.data[e + 1];\n B = pixels.data[e + 2];\n elevations.push(-10000 + (R * 256 * 256 + G * 256 + B) * 0.1);\n }\n } else {\n elevations = new Array(262144).fill(0); // 512 * 512 (=1/4 MB)\n } // console.log('elevations:', elevations); // elevations: (262144) [...]\n // figure out tile coordinates of the 16 grandchildren of this tile\n\n\n var sixteenths = [];\n\n for (var col = 0; col < 4; col++) {\n for (var row = 0; row < 4; row++) {\n sixteenths.push([zoomposEle[0] + 2, zoomposEle[1] * 4 + col, zoomposEle[2] * 4 + row].join('/'));\n }\n } // console.log('sixteenths:', sixteenths);\n\n\n var zpCoveredStr = zpCovered.map(function (zp) {\n return zp.join('/');\n }); // console.log('zpCoveredStr:', zpCoveredStr);\n // console.log('sixteenthPixelRanges:', sixteenthPixelRanges);\n // 0 [0, 128] [0, 128]\n // 1 [128, 256] [0, 128]\n // 2 [256, 384] [0, 128]\n // 3 [384, 512] [0, 128]\n // 4 [0, 128] [128, 256]\n //...\n // 12 [0, 128] [384, 512]\n // 13 [128, 256] [384, 512]\n // 14 [256, 384] [384, 512]\n // 15 [384, 512] [384, 512]\n\n var dataEle = [];\n sixteenths.forEach(function (zoomposStr, index) {\n if (!zpCoveredStr.includes(zoomposStr)) return;\n var zoompos = zoomposStr.split('/').map(function (str) {\n return parseInt(str);\n });\n var pxRange = sixteenthPixelRanges[index];\n var elev = [];\n\n for (var r = pxRange[0][0]; r < pxRange[0][1]; r++) {\n for (var c = pxRange[1][0]; c < pxRange[1][1]; c++) {\n elev.push(elevations[r * 512 + c]);\n }\n } // console.log('elev:', elev); // 16384 = 128 * 128 elements\n\n\n var array = [];\n var dataIndex = 0;\n\n for (var _row = 0; _row < constVertices; _row++) {\n for (var _col = 0; _col < constVertices; _col++) {\n var lonlatPixel = constTilePixels.ll([zoompos[1] * 128 + _col, zoompos[2] * 128 + _row], zoompos[0]); // console.log('lonlatPixel:', lonlatPixel);\n // NOTE: do use shift = 1 for computeSeamRows()\n\n array.push.apply(array, _toConsumableArray(projectCoord(lonlatPixel, bbox.northWest, bbox.southEast)).concat([elev[dataIndex] * unitsPerMeter]));\n dataIndex++;\n }\n } // console.log('zoompos, array:', zoompos, array); // 49152 = 128*128*3 elements\n\n\n dataEle.push([zoompos, array, zoomposEle]);\n }); // console.log('dataEle:', dataEle);\n\n return dataEle;\n }\n }, {\n key: \"build\",\n value: function build() {\n var _this2 = this;\n\n var debug = this.isDebug ? {} : undefined;\n console.log('dataEleCovered:', this.dataEleCovered);\n\n if (this.dataEleCovered.length === 0) {\n var _meshes = [];\n this.onRgbDem(_meshes);\n this.watcher({\n what: 'dem-rgb',\n data: _meshes,\n debug: debug\n });\n return;\n }\n\n var onSatelliteMatWrapper = null;\n\n if (this.onSatelliteMat) {\n var countSat = 0;\n\n onSatelliteMatWrapper = function onSatelliteMatWrapper(mesh, meshesAcc) {\n countSat++;\n\n _this2.onSatelliteMat(mesh);\n\n if (countSat === _this2.dataEleCovered.length) {\n _this2.watcher({\n what: 'dem-rgb',\n data: meshesAcc,\n debug: debug\n });\n }\n };\n }\n\n var meshes = RgbModel._build(this.dataEleCovered, this.apiSatellite, this.token, this.isNode, onSatelliteMatWrapper);\n\n this.onRgbDem(meshes); // legacy API\n\n if (!onSatelliteMatWrapper) {\n this.watcher({\n what: 'dem-rgb',\n data: meshes,\n debug: debug\n });\n }\n }\n }], [{\n key: \"_stitchWithNei2\",\n value: function _stitchWithNei2(array, arrayNei) {\n // add a new south row\n for (var i = 0; i < constVertices; i++) {\n var indexZ = constSeamRows[2][i] + constVertices * 3; // new south row\n\n var indexZNei = constSeamRows[0][i]; // north row to copy\n\n array[indexZ - 2] = arrayNei[indexZNei - 2]; // a new x\n\n array[indexZ - 1] = arrayNei[indexZNei - 1]; // a new y\n\n array[indexZ] = arrayNei[indexZNei]; // a new z\n }\n }\n }, {\n key: \"_stitchWithNei3\",\n value: function _stitchWithNei3(array, arrayNei) {\n // add a new east col\n for (var i = 0; i < constVertices; i++) {\n var indexZ = constSeamRows[3][i] + (1 + i) * 3; // new east col\n\n var indexZNei = constSeamRows[1][i]; // west col to copy\n // https://stackoverflow.com/questions/586182/how-to-insert-an-item-into-an-array-at-a-specific-index\n // arr = [0,1,2,3]\n // arr.splice(2, 0, 99)\n // arr\n // (5) [0, 1, 99, 2, 3]\n\n array.splice(indexZ - 2, 0, arrayNei[indexZNei - 2]);\n array.splice(indexZ - 1, 0, arrayNei[indexZNei - 1]);\n array.splice(indexZ, 0, arrayNei[indexZNei]);\n }\n }\n }, {\n key: \"resolveSeams\",\n value: function resolveSeams(array, infoNei) {\n var _this3 = this;\n\n // console.log('infoNei:', infoNei);\n var cSegments = [constVertices - 1, constVertices - 1];\n Object.entries(infoNei).forEach(function (_ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n idxNei = _ref3[0],\n arrayNei = _ref3[1];\n\n if (idxNei === \"2\") {\n // console.log('now _stitchWithNei2()...');\n _this3._stitchWithNei2(array, arrayNei);\n\n cSegments[1]++;\n } else if (idxNei === \"3\") {\n // console.log('now _stitchWithNei3()...');\n _this3._stitchWithNei3(array, arrayNei);\n\n cSegments[0]++;\n }\n });\n\n if (cSegments[0] === constVertices && cSegments[1] === constVertices) {\n // Both _stitchWithNei2() and _stitchWithNei3() were\n // applided to this array. Need filling a diagonal pothole.\n // console.log('filling a pothole...');\n var arrayNei6 = infoNei[\"6\"];\n\n if (arrayNei6) {\n array.push(arrayNei6[0], arrayNei6[1], arrayNei6[2]);\n } else {\n // filling with a degenerated triangle\n var len = array.length;\n array.push(array[len - 3], array[len - 2], array[len - 1]);\n }\n }\n\n return cSegments;\n }\n }, {\n key: \"createDataFlipY\",\n value: function createDataFlipY(data, shape) {\n var _shape = _slicedToArray(shape, 3),\n w = _shape[0],\n h = _shape[1],\n size = _shape[2];\n\n var out = new Uint8Array(data.length);\n\n for (var y = 0; y < h; y++) {\n for (var x = 0; x < w * size; x += size) {\n for (var i = 0; i < size; i++) {\n out[(h - 1 - y) * w * size + x + i] = data[y * w * size + x + i];\n }\n }\n }\n\n return out;\n }\n }, {\n key: \"getNeighborsInfo\",\n value: function getNeighborsInfo(dataEle, dataEleIds, zoompos) {\n var infoNei = {};\n this.getNeighbors8(zoompos).forEach(function (zoomposNei, idxNei) {\n var id = zoomposNei.join('/');\n\n if (id in dataEleIds) {\n var arrayNei = dataEle[dataEleIds[id]][1]; // console.log('real neighbor yes:', zoomposNei, idxNei, arrayNei);\n\n infoNei[idxNei] = arrayNei;\n }\n });\n return infoNei;\n }\n }, {\n key: \"getNeighbors8\",\n value: function getNeighbors8(zoompos) {\n // 8-neighbors:\n // 4 0 7\n // 1 + 3\n // 5 2 6\n //--------\n // 0, 1, 2, 3: north, west, south, east; +y, -x, -y, +x\n // 4, 5, 6, 7: diagonal neighbors\n var zoomposNeighborsDiff = [[0, 0, -1], [0, -1, 0], [0, 0, 1], [0, 1, 0], [0, -1, -1], [0, -1, 1], [0, 1, 1], [0, 1, -1]];\n var neighbors = [];\n zoomposNeighborsDiff.forEach(function (zoomposDiff) {\n var zoomposNei = zoomposDiff.map(function (coord, idxCoord) {\n return coord + zoompos[idxCoord];\n }); // console.log('8-neighbor candidate:', zoomposNei);\n\n neighbors.push(zoomposNei);\n });\n return neighbors;\n }\n }, {\n key: \"_build\",\n value: function _build(dataEle, apiSatellite, token, isNode, onSatelliteMatWrapper) {\n var _this4 = this;\n\n console.log('apiSatellite:', apiSatellite); // dataEle should be sorted so that .resolveSeams() is applied\n // in the proper order, or the results will have broken stripes\n // due to _stitchWithNei3()\n\n dataEle.sort(function (zp1, zp2) {\n return zp1[0].join('/') > zp2[0].join('/') ? 1 : -1;\n }); // console.log('dataEle (sorted):', dataEle);\n\n var dataEleIds = {};\n dataEle.forEach(function (data, idx) {\n dataEleIds[data[0].join('/')] = idx;\n }); // console.log('dataEleIds:', dataEleIds);\n\n var objs = [];\n dataEle.forEach(function (_ref4) {\n var _ref5 = _slicedToArray(_ref4, 3),\n zoompos = _ref5[0],\n arr = _ref5[1],\n zoomposEle = _ref5[2];\n\n // console.log(zoompos, arr); // a 16th of zoomposEle\n if (arr.length !== constVertices * constVertices * 3) {\n // assumtion on the size of the arr failed...\n console.log('woops: already seams resolved? or what..., NOP');\n return;\n } // console.log('dealing with the seams of:', zoompos);\n\n\n var cSegments = _this4.resolveSeams(arr, _this4.getNeighborsInfo(dataEle, dataEleIds, zoompos));\n\n console.log('cSegments:', cSegments); // w and h don't matter since position.array is being overwritten\n\n var geom = new three__WEBPACK_IMPORTED_MODULE_2__.PlaneBufferGeometry(1, 1, cSegments[0], cSegments[1]);\n geom.attributes.position.array = new Float32Array(arr); //--------\n // test identifying a 127x1 \"belt\"\n // let geom = new THREE.PlaneBufferGeometry(1, 1, 127, 1);\n // let arrBelt = arr;\n // arrBelt.length = 128*2*3;\n // geom.attributes.position.array = new Float32Array(arrBelt);\n\n var plane = new three__WEBPACK_IMPORTED_MODULE_2__.Mesh(geom, new three__WEBPACK_IMPORTED_MODULE_2__.MeshBasicMaterial({\n wireframe: true,\n color: 0xcccccc\n }));\n plane.name = \"dem-rgb-\".concat(zoompos.join('/'));\n\n var _toTile = function _toTile(zp) {\n return [zp[1], zp[2], zp[0]];\n };\n\n plane.userData.threeGeo = {\n tile: _toTile(zoompos),\n srcDem: {\n tile: _toTile(zoomposEle),\n uri: _fetch_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].getUriMapbox(token, 'mapbox-terrain-rgb', zoomposEle)\n }\n };\n objs.push(plane);\n\n _this4.resolveTex(zoompos, apiSatellite, token, isNode, function (tex) {\n if (tex) {\n plane.material = new three__WEBPACK_IMPORTED_MODULE_2__.MeshBasicMaterial({\n side: three__WEBPACK_IMPORTED_MODULE_2__.FrontSide,\n // side: THREE.DoubleSide,\n map: tex\n });\n }\n\n if (onSatelliteMatWrapper) {\n onSatelliteMatWrapper(plane, objs); // legacy API\n }\n });\n });\n return objs;\n } //==== THREE specific\n // _buildModelThree() {} // TODO (refactor)\n\n }, {\n key: \"resolveTex\",\n value: function () {\n var _resolveTex = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(zoompos, apiSatellite, token, isNode, onTex) {\n var pixels, tex;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return _fetch_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fetchTile(zoompos, apiSatellite, token, isNode);\n\n case 2:\n pixels = _context2.sent;\n tex = null;\n\n if (pixels !== null) {\n // console.log(\"satellite pixels\", pixels.shape.slice(0));\n // console.log('satellite pixels:', pixels);\n // https://threejs.org/docs/#api/textures/DataTexture\n //==== On Firefox, calling it with y-flip causes the warning: \"Error: WebGL warning: texImage2D: Alpha-premult and y-flip are deprecated for non-DOM-Element uploads.\"\n // tex = new THREE.DataTexture(pixels.data,\n // pixels.shape[0], pixels.shape[1], THREE.RGBAFormat);\n // tex.flipY = true;\n //==== workaround: do manual y-flip\n tex = new three__WEBPACK_IMPORTED_MODULE_2__.DataTexture(this.createDataFlipY(pixels.data, pixels.shape), pixels.shape[0], pixels.shape[1], three__WEBPACK_IMPORTED_MODULE_2__.RGBAFormat);\n tex.needsUpdate = true;\n } else {\n console.log(\"fetchTile() failed for tex of zp: \".concat(zoompos));\n }\n\n if (onTex) {\n onTex(tex);\n }\n\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function resolveTex(_x2, _x3, _x4, _x5, _x6) {\n return _resolveTex.apply(this, arguments);\n }\n\n return resolveTex;\n }()\n }]);\n\n return RgbModel;\n}();\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RgbModel);\n\n//# sourceURL=webpack://ThreeGeo/./src/models/rgb.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/models/vector.js":
|
||
/*!******************************!*\
|
||
!*** ./src/models/vector.js ***!
|
||
\******************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _fetch_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fetch.js */ \"./src/models/fetch.js\");\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n/* harmony import */ var _turf_area__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @turf/area */ \"./node_modules/@turf/area/dist/es/index.js\");\n/* harmony import */ var _turf_intersect__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @turf/intersect */ \"./node_modules/@turf/intersect/dist/es/index.js\");\n/* harmony import */ var _turf_union__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @turf/union */ \"./node_modules/@turf/union/dist/es/index.js\");\n/* harmony import */ var uniq__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uniq */ \"./node_modules/uniq/uniq.js\");\n/* harmony import */ var uniq__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(uniq__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! three */ \"three\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_5__);\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n\n\n\n\n\n\n\n\nvar VectorModel = /*#__PURE__*/function () {\n function VectorModel(params) {\n _classCallCheck(this, VectorModel);\n\n // static parameters\n this.unitsPerMeter = params.unitsPerMeter;\n this.projectCoord = params.projectCoord;\n this.token = params.token;\n this.isNode = params.isNode;\n this.isDebug = params.isDebug;\n this.apiVector = params.apiVector; // callbacks\n\n this.onVectorDem = params.onVectorDem;\n this.watcher = params.watcher; // state variables\n\n this.bottomTiles = [];\n this.geojson = {\n type: 'FeatureCollection',\n features: []\n };\n\n if (this.isDebug) {\n this.tiles = {};\n }\n }\n\n _createClass(VectorModel, [{\n key: \"fetch\",\n value: function fetch(zpCovered, bbox, radius) {\n var _this = this;\n\n // e.g. satellite's zoom: 14\n // dem's zoom: 12 (=14-2)\n var zpEle = _fetch_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].getZoomposEle(zpCovered);\n console.log('VectorModel: zpEle:', zpEle);\n var count = 0;\n zpEle.forEach( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(zoompos) {\n var tile;\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return _fetch_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fetchTile(zoompos, _this.apiVector, _this.token, _this.isNode);\n\n case 2:\n tile = _context.sent;\n\n if (tile !== null) {\n _this.addTile(tile, zoompos);\n } else {\n console.log(\"fetchTile() failed for vector dem of zp: \".concat(zoompos, \" (count: \").concat(count, \"/\").concat(zpEle.length, \")\"));\n }\n\n count++;\n\n if (count === zpEle.length) {\n _this.build(bbox, radius);\n }\n\n case 6:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }, {\n key: \"addTile\",\n value: function addTile(tile, zoompos) {\n var _this2 = this;\n\n if (this.isDebug) {\n this.tiles[zoompos.join('-')] = tile;\n }\n\n var contour = tile.layers.contour;\n\n if (!contour) {\n // zoom <= 8\n console.log(\"no contours! (zoom=\".concat(zoompos[0], \")\"));\n return;\n }\n\n var _loop2 = function _loop2(i) {\n var feat = tile.layers.contour.feature(i).toGeoJSON(zoompos[1], zoompos[2], zoompos[0]);\n\n if (i === 0) {\n _this2.bottomTiles.push(feat);\n } // break multigons into multiple polygons\n\n\n if (feat.geometry.type === 'MultiPolygon') {\n feat.geometry.coordinates.forEach(function (polygon) {\n return _this2.geojson.features.push({\n type: 'Feature',\n properties: {\n ele: feat.properties.ele\n },\n geometry: {\n type: 'Polygon',\n coordinates: polygon\n }\n });\n });\n } else {\n // single polygons can be pushed in as-is\n _this2.geojson.features.push(feat);\n }\n };\n\n for (var i = 0; i < tile.layers.contour.length; i++) {\n _loop2(i);\n } // console.log('this.bottomTiles:', this.bottomTiles);\n\n }\n }, {\n key: \"_buildContours\",\n value: function _buildContours(polygon, radius) {\n var eleList = uniq__WEBPACK_IMPORTED_MODULE_4___default()(this.geojson.features.map(function (feat) {\n return feat.properties.ele;\n })).sort(function (a, b) {\n return a - b;\n }); // console.log('eleList:', eleList);\n\n VectorModel._addBottomEle(this.geojson, this.bottomTiles, eleList); // console.log('this.geojson:', this.geojson);\n\n\n return VectorModel._getContours(eleList, this.geojson, polygon, radius * radius * 2000000); // maxArea: (r * sqrt2 * 1000)**2\n }\n }, {\n key: \"build\",\n value: function build(bbox, radius) {\n var debug = this.isDebug ? {\n tiles: this.tiles\n } : undefined;\n\n var objs = this._buildModelThree(this._buildContours(bbox.feature, radius), bbox.northWest, bbox.southEast);\n\n if (this.onVectorDem) {\n this.onVectorDem(objs); // legacy API\n }\n\n if (this.watcher) {\n this.watcher({\n what: 'dem-vec',\n data: objs,\n debug: debug\n });\n }\n } //==== THREE specific\n\n }, {\n key: \"_buildModelThree\",\n value: function _buildModelThree(contours, nw, se) {\n var _this3 = this;\n\n // console.log('_buildThreeModel():', contours, nw, se);\n var _getColorRange = function _getColorRange(range, len) {\n var _rgb = function _rgb(hex) {\n return [hex >> 16, (hex & 0x00ff00) >> 8, hex & 0x0000ff];\n };\n\n var arrStart = _rgb(range[0]);\n\n var arrDiff = _rgb(range[1] - range[0]);\n\n return function (ic) {\n var r = arrStart[0] + Math.floor(ic * arrDiff[0] / len);\n var g = arrStart[1] + Math.floor(ic * arrDiff[1] / len);\n var b = arrStart[2] + Math.floor(ic * arrDiff[2] / len); // console.log('r g b:', r, g, b);\n\n return (r << 16) + (g << 8) + b;\n };\n };\n\n var colorRange = _getColorRange([0x231918, 0xed6356], contours.length);\n\n var objs = [];\n\n var addSlice = function addSlice(coords, ic) {\n // console.log('coords:', coords);\n var _this3$_buildSlice = _this3._buildSlice(coords, ic, colorRange(ic), contours, nw, se),\n _this3$_buildSlice2 = _slicedToArray(_this3$_buildSlice, 2),\n lines = _this3$_buildSlice2[0],\n extrudeShade = _this3$_buildSlice2[1];\n\n lines.forEach(function (line) {\n objs.push(line);\n });\n objs.push(extrudeShade);\n }; // iterate through elevations\n\n\n for (var ic = 0; ic < contours.length; ic++) {\n var level = contours[ic].geometry.geometry; // if (ic !== 110) continue; // debug\n // console.log('level.type:', level.type);\n\n if (level.type === 'Polygon') {\n addSlice(level.coordinates, ic);\n } else if (level.type === 'MultiPolygon') {\n // iterate through shapes per elevation\n for (var i = 0; i < level.coordinates.length; i++) {\n addSlice(level.coordinates[i], ic);\n }\n }\n }\n\n return objs;\n }\n }, {\n key: \"_buildSlice\",\n value: function _buildSlice(coords, iContour, color, contours, nw, se) {\n var _this4 = this;\n\n var shape = new three__WEBPACK_IMPORTED_MODULE_5__.Shape();\n var geoms = [new three__WEBPACK_IMPORTED_MODULE_5__.BufferGeometry()];\n var h = iContour;\n var pz = -contours[h].ele * this.unitsPerMeter;\n\n var setVertices = function setVertices(geom, vertices) {\n return geom.setAttribute('position', new three__WEBPACK_IMPORTED_MODULE_5__.BufferAttribute(new Float32Array(vertices), 3));\n }; // iterate through vertices per shape\n\n\n var vertices = [];\n coords[0].forEach(function (coord, index) {\n var _this4$projectCoord = _this4.projectCoord(coord, nw, se),\n _this4$projectCoord2 = _slicedToArray(_this4$projectCoord, 2),\n px = _this4$projectCoord2[0],\n py = _this4$projectCoord2[1];\n\n vertices.push(-px, py, pz);\n\n if (index === 0) {\n shape.moveTo(-px, py);\n } else {\n shape.lineTo(-px, py);\n }\n });\n setVertices(geoms[0], vertices); // carve out holes (if none, would automatically skip this)\n\n for (var k = 1; k < coords.length; k++) {\n // console.log('holes');\n var holePath = new three__WEBPACK_IMPORTED_MODULE_5__.Path();\n geoms.push(new three__WEBPACK_IMPORTED_MODULE_5__.BufferGeometry()); // iterate through hole path vertices\n\n var _vertices = [];\n\n for (var j = 0; j < coords[k].length; j++) {\n var _this$projectCoord = this.projectCoord(coords[k][j], nw, se),\n _this$projectCoord2 = _slicedToArray(_this$projectCoord, 2),\n px = _this$projectCoord2[0],\n py = _this$projectCoord2[1];\n\n _vertices.push(-px, py, pz);\n\n if (j === 0) {\n holePath.moveTo(-px, py);\n } else {\n holePath.lineTo(-px, py);\n }\n }\n\n setVertices(geoms[k], _vertices);\n shape.holes.push(holePath);\n }\n\n var lines = [];\n geoms.forEach(function (_loop, _index) {\n var line = new three__WEBPACK_IMPORTED_MODULE_5__.Line(geoms[0], new three__WEBPACK_IMPORTED_MODULE_5__.LineBasicMaterial({\n color: 0xcccccc\n })); //======== align x-y : east-north\n\n line.rotation.y = Math.PI;\n line.name = \"dem-vec-line-\".concat(contours[h].ele, \"-\").concat(line.uuid); // line.visible = false;\n\n lines.push(line);\n });\n var extrudeGeom = new three__WEBPACK_IMPORTED_MODULE_5__.ExtrudeGeometry(shape, {\n depth: contours[h + 1] ? this.unitsPerMeter * (contours[h + 1].ele - contours[h].ele) : this.unitsPerMeter * (contours[h].ele - contours[h - 1].ele),\n bevelEnabled: false\n });\n var extrudeShade = new three__WEBPACK_IMPORTED_MODULE_5__.Mesh(extrudeGeom, new three__WEBPACK_IMPORTED_MODULE_5__.MeshBasicMaterial({\n color: color,\n wireframe: false // wireframe: true,\n\n })); //======== align x-y : east-north\n\n extrudeShade.rotation.y = Math.PI;\n extrudeShade.position.z = -pz;\n extrudeShade.name = \"dem-vec-shade-\".concat(contours[h].ele, \"-\").concat(extrudeShade.uuid);\n return [lines, extrudeShade];\n }\n }], [{\n key: \"_addBottomEle\",\n value: function _addBottomEle(geojson, bottomTiles, eleList) {\n bottomTiles.forEach(function (bottom) {\n var tileBottomEle = bottom.properties.ele;\n\n for (var ele = eleList[0]; ele < tileBottomEle; ele += 10) {\n geojson.features.push({\n type: \"Feature\",\n geometry: bottom.geometry,\n properties: {\n ele: ele\n }\n });\n }\n });\n }\n }, {\n key: \"_getContours\",\n value: function _getContours(eleList, geojson, polygon, maxArea) {\n var contours = []; // iterate through elevations, and merge polys of the same elevation\n\n var _loop3 = function _loop3(x) {\n // console.log(`_getContours(): ${x}/${eleList.length}`);\n var currentElevation = eleList[x];\n var elevationPolys = geojson.features.filter(function (feature) {\n return feature.properties.ele === currentElevation;\n });\n\n try {\n // merge between tiles\n var feats = _turf_helpers__WEBPACK_IMPORTED_MODULE_1__.featureCollection(elevationPolys).features; // console.log(currentElevation, feats.length, feats);\n // feats.forEach(feat => { console.log('type:', feat.geometry.type); }); // 'Polygon'\n\n var mergedElevationPoly = feats.reduce(function (accm, feat) {\n return (0,_turf_union__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(accm, feat);\n }, feats[0]); // console.log('@@@', mergedElevationPoly, currentElevation);\n\n if (false) {} // console.log('@@@mergedElevationPoly:', mergedElevationPoly);\n\n\n if (mergedElevationPoly) {\n // console.log('@@@merge success', currentElevation);\n var contourArea = (0,_turf_area__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(mergedElevationPoly.geometry); // L.mapbox.featureLayer().setGeoJSON(mergedElevationPoly).addTo(map);\n\n contours.push({\n 'geometry': mergedElevationPoly,\n 'ele': currentElevation,\n 'area': contourArea\n });\n }\n } catch (error) {\n // on merge fail, insert the previous contour again and skip\n console.log('merge failed at elevation ' + currentElevation);\n console.log(error.message);\n }\n };\n\n for (var x = 0; x < eleList.length; x++) {\n _loop3(x);\n } // remove contour undercuts\n\n\n if (false) { var prevContour, currContour, m; }\n\n return contours;\n }\n }]);\n\n return VectorModel;\n}();\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (VectorModel);\n\n//# sourceURL=webpack://ThreeGeo/./src/models/vector.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/utils.js":
|
||
/*!**********************!*\
|
||
!*** ./src/utils.js ***!
|
||
\**********************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var es_pack_js_src_meta__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! es-pack-js/src/meta */ \"./node_modules/es-pack-js/src/meta/index.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"three\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _mapbox_tilebelt__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @mapbox/tilebelt */ \"./node_modules/@mapbox/tilebelt/index.js\");\n/* harmony import */ var _mapbox_tilebelt__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_mapbox_tilebelt__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var three_laser_pointer_src__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three-laser-pointer/src */ \"./node_modules/three-laser-pointer/src/index.js\");\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n/* harmony import */ var _turf_destination__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @turf/destination */ \"./node_modules/@turf/destination/dist/es/index.js\");\n/* harmony import */ var _turf_transform_translate__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @turf/transform-translate */ \"./node_modules/@turf/transform-translate/main.es.js\");\n/* harmony import */ var _turf_transform_rotate__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @turf/transform-rotate */ \"./node_modules/@turf/transform-rotate/main.es.js\");\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _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; } }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n\n\n\n\n\n\n\n\n\nvar Utils = /*#__PURE__*/function () {\n function Utils() {\n _classCallCheck(this, Utils);\n }\n\n _createClass(Utils, null, [{\n key: \"createLine\",\n value: function createLine(arr) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n color: 0xff0000,\n maxPoints: 256\n };\n var laser = new three_laser_pointer_src__WEBPACK_IMPORTED_MODULE_3__[\"default\"](opts);\n laser.updatePoints(arr);\n return laser;\n }\n }, {\n key: \"bboxToWireframe\",\n value: function bboxToWireframe(wsen, proj) {\n var _ls$position;\n\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var defaults = {\n offsetZ: 0.0,\n color: 0x00cccc,\n height: 0.001\n };\n var actual = Object.assign({}, defaults, opts);\n\n var _wsen = _slicedToArray(wsen, 4),\n w = _wsen[0],\n s = _wsen[1],\n e = _wsen[2],\n n = _wsen[3]; // of bbox\n // console.log('wsen:', wsen);\n\n\n var offset = proj([(s + n) / 2, (w + e) / 2]); // lat, lng -> x, y\n // console.log('offset:', offset);\n\n var _proj = proj([n, w]),\n _proj2 = _slicedToArray(_proj, 2),\n pw = _proj2[0],\n pn = _proj2[1];\n\n var _proj3 = proj([s, e]),\n _proj4 = _slicedToArray(_proj3, 2),\n pe = _proj4[0],\n ps = _proj4[1]; // console.log('pw, pn, pe, ps:', pw, pn, pe, ps);\n // const sides = [0.05, 0.05]; // show the mid point\n\n\n var sides = [pe - pw, pn - ps];\n var dzBounds = actual.height;\n var ls = new three__WEBPACK_IMPORTED_MODULE_1__.LineSegments(new three__WEBPACK_IMPORTED_MODULE_1__.EdgesGeometry(_construct(three__WEBPACK_IMPORTED_MODULE_1__.BoxBufferGeometry, sides.concat([dzBounds]))), new three__WEBPACK_IMPORTED_MODULE_1__.LineBasicMaterial({\n color: actual.color\n }));\n\n (_ls$position = ls.position).set.apply(_ls$position, _toConsumableArray(offset).concat([-dzBounds / 2 + actual.offsetZ]));\n\n ls.name = \"bbox-\".concat(window.performance.now());\n return {\n obj: ls,\n offset: [].concat(_toConsumableArray(offset), [actual.offsetZ]),\n size: [].concat(sides, [actual.height])\n };\n }\n }, {\n key: \"tileToBbox\",\n value: function tileToBbox(tile) {\n return _mapbox_tilebelt__WEBPACK_IMPORTED_MODULE_2___default().tileToBBOX(tile);\n } // REMOVING in favour of the WIP `Elevation` API\n\n }, {\n key: \"_resolveTri\",\n value: function _resolveTri(x, y, meshes, scale, shiftZ) {\n var isect = new three_laser_pointer_src__WEBPACK_IMPORTED_MODULE_3__[\"default\"]().raycast(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(x, y, 12000), // ray origin\n new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, -1), // ray direction\n meshes); // console.log('isect:', isect);\n\n if (!isect) return null; // console.log('isect:', isect);\n // console.log('isect.point.z:', isect.point.z);\n // console.log('isect.faceIndex:', isect.faceIndex);\n // https://stackoverflow.com/questions/41540313/three-buffergeometry-accessing-face-indices-and-face-normals\n\n var faceIndex = isect.faceIndex;\n var indexArr = isect.object.geometry.index.array;\n var attrPos = isect.object.geometry.attributes.position;\n var tri = [0, 1, 2].map(function (i) {\n return new three__WEBPACK_IMPORTED_MODULE_1__.Vector3().fromBufferAttribute(attrPos, indexArr[3 * faceIndex + i]).multiplyScalar(scale) // z's of tri is relative to the isect point\n .add(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, shiftZ ? shiftZ : -isect.point.z));\n }); // console.log('isect tri (z-shifted):', tri);\n\n return {\n // return new objects to remain pure\n faceIndex: isect.faceIndex,\n isectPoint: isect.point.clone(),\n tri: tri,\n normal: isect.face.normal.clone()\n };\n } // `@turf` dependent methods\n\n }, {\n key: \"createTurfPoint\",\n value: function createTurfPoint(ll) {\n return _turf_helpers__WEBPACK_IMPORTED_MODULE_4__.point([ll[1], ll[0]]);\n }\n }, {\n key: \"originRadiusToBbox\",\n value: function originRadiusToBbox(origin, radius) {\n var _turfDestination$geom = _slicedToArray((0,_turf_destination__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.createTurfPoint(origin), radius, -45, {\n units: 'kilometers'\n }).geometry.coordinates, 2),\n w = _turfDestination$geom[0],\n n = _turfDestination$geom[1];\n\n var _turfDestination$geom2 = _slicedToArray((0,_turf_destination__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(this.createTurfPoint(origin), radius, 135, {\n units: 'kilometers'\n }).geometry.coordinates, 2),\n e = _turfDestination$geom2[0],\n s = _turfDestination$geom2[1];\n\n return [w, s, e, n];\n }\n }, {\n key: \"translateTurfObject\",\n value: function translateTurfObject(turfObj, dx, dy, dz, unitsPerMeter) {\n var mutate = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;\n var vec = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(dx, dy).divideScalar(unitsPerMeter);\n var theta = 90.0 - vec.angle() * 180.0 / Math.PI;\n return (0,_turf_transform_translate__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(turfObj, vec.length(), theta, {\n units: 'meters',\n zTranslation: dz / unitsPerMeter,\n mutate: mutate // \"significant performance increase if true\" per doc\n\n });\n }\n }, {\n key: \"rotateTurfObject\",\n value: function rotateTurfObject(turfObj, deg, pivotLatlng) {\n var mutate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n return (0,_turf_transform_rotate__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(turfObj, deg, {\n pivot: [pivotLatlng[1], pivotLatlng[0]],\n mutate: mutate\n });\n }\n }]);\n\n return Utils;\n}();\n\nUtils.Meta = es_pack_js_src_meta__WEBPACK_IMPORTED_MODULE_0__[\"default\"];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Utils);\n\n//# sourceURL=webpack://ThreeGeo/./src/utils.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/es-pack-js/src/meta/index.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/es-pack-js/src/meta/index.js ***!
|
||
\***************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n\nclass Meta {\n static async nodeRequire(_global, mod) { // {classic,es}-context agnostic wrapper\n const req = typeof _global.require === 'function' ? _global.require : null;\n const imp = typeof _global.import === 'function' ? _global.import : null;\n if (!req && !imp) throw new Error('Neither NodeJS `require` or `import` is available. (If in test environment, maybe, you should add `global.require = require;`.');\n\n return req ? req(mod) : (await imp(mod)).default;\n }\n}\n\nclass Delta {\n constructor() {\n this.perf = null;\n this.start = 0;\n }\n static async new(opts={nodejs: false}) { return await (new this()).init(opts); }\n async init(opts={nodejs: false}) {\n if (opts.nodejs) {\n const { performance: perf } = await Meta.nodeRequire(__webpack_require__.g, 'perf_hooks');\n this.perf = perf;\n } else {\n this.perf = window.performance;\n }\n\n this.start = this.perf.now();\n return this;\n }\n _checkInit() {\n if (!this.perf) throw new Error('Do call `async .init()` first.');\n }\n get() {\n this._checkInit();\n return (this.perf.now() - this.start) / 1000;\n }\n print(prefix='delta:') {\n this._checkInit();\n console.log(`${prefix} ${this.get().toFixed(3)} (s)`);\n }\n}\n\nMeta.Delta = Delta;\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Meta);\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/es-pack-js/src/meta/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/get-pixels/dom-pixels.js":
|
||
/*!***********************************************!*\
|
||
!*** ./node_modules/get-pixels/dom-pixels.js ***!
|
||
\***********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ \"./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js\")[\"Buffer\"];\n\n\nvar path = __webpack_require__(/*! path */ \"./node_modules/es-pack-js/node-polyfill/node_modules/path-browserify/index.js\")\nvar ndarray = __webpack_require__(/*! ndarray */ \"./node_modules/ndarray/ndarray.js\")\nvar GifReader = (__webpack_require__(/*! omggif */ \"./node_modules/omggif/omggif.js\").GifReader)\nvar pack = __webpack_require__(/*! ndarray-pack */ \"./node_modules/ndarray-pack/convert.js\")\nvar through = __webpack_require__(/*! through */ \"./node_modules/through/index.js\")\nvar parseDataURI = __webpack_require__(/*! data-uri-to-buffer */ \"./node_modules/data-uri-to-buffer/index.js\")\n\nfunction defaultImage(url, cb) {\n var img = new Image()\n img.crossOrigin = \"Anonymous\"\n img.onload = function() {\n var canvas = document.createElement('canvas')\n canvas.width = img.width\n canvas.height = img.height\n var context = canvas.getContext('2d')\n context.drawImage(img, 0, 0)\n var pixels = context.getImageData(0, 0, img.width, img.height)\n cb(null, ndarray(new Uint8Array(pixels.data), [img.width, img.height, 4], [4, 4*img.width, 1], 0))\n }\n img.onerror = function(err) {\n cb(err)\n }\n img.src = url\n}\n\n//Animated gif loading\nfunction handleGif(data, cb) {\n var reader\n try {\n reader = new GifReader(data)\n } catch(err) {\n cb(err)\n return\n }\n if(reader.numFrames() > 0) {\n var nshape = [reader.numFrames(), reader.height, reader.width, 4]\n var ndata = new Uint8Array(nshape[0] * nshape[1] * nshape[2] * nshape[3])\n var result = ndarray(ndata, nshape)\n try {\n for(var i=0; i<reader.numFrames(); ++i) {\n reader.decodeAndBlitFrameRGBA(i, ndata.subarray(\n result.index(i, 0, 0, 0),\n result.index(i+1, 0, 0, 0)))\n }\n } catch(err) {\n cb(err)\n return\n }\n cb(null, result.transpose(0,2,1))\n } else {\n var nshape = [reader.height, reader.width, 4]\n var ndata = new Uint8Array(nshape[0] * nshape[1] * nshape[2])\n var result = ndarray(ndata, nshape)\n try {\n reader.decodeAndBlitFrameRGBA(0, ndata)\n } catch(err) {\n cb(err)\n return\n }\n cb(null, result.transpose(1,0))\n }\n}\n\nfunction httpGif(url, cb) {\n var xhr = new XMLHttpRequest()\n xhr.open('GET', url, true)\n xhr.responseType = 'arraybuffer'\n if(xhr.overrideMimeType){\n xhr.overrideMimeType('application/binary')\n }\n xhr.onerror = function(err) {\n cb(err)\n }\n xhr.onload = function() {\n if(xhr.readyState !== 4) {\n return\n }\n var data = new Uint8Array(xhr.response)\n handleGif(data, cb)\n return\n }\n xhr.send()\n}\n\nfunction copyBuffer(buffer) {\n if(buffer[0] === undefined) {\n var n = buffer.length\n var result = new Uint8Array(n)\n for(var i=0; i<n; ++i) {\n result[i] = buffer.get(i)\n }\n return result\n } else {\n return new Uint8Array(buffer)\n }\n}\n\nfunction dataGif(url, cb) {\n process.nextTick(function() {\n try {\n var buffer = parseDataURI(url)\n if(buffer) {\n handleGif(copyBuffer(buffer), cb)\n } else {\n cb(new Error('Error parsing data URI'))\n }\n } catch(err) {\n cb(err)\n }\n })\n}\n\nmodule.exports = function getPixels(url, type, cb) {\n if(!cb) {\n cb = type\n type = ''\n }\n var ext = path.extname(url)\n switch(type || ext.toUpperCase()) {\n case '.GIF':\n httpGif(url, cb)\n break\n default:\n if(Buffer.isBuffer(url)) {\n url = 'data:' + type + ';base64,' + url.toString('base64')\n }\n if(url.indexOf('data:image/gif;') === 0) {\n dataGif(url, cb)\n } else {\n defaultImage(url, cb)\n }\n }\n}\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/get-pixels/dom-pixels.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/global/window.js":
|
||
/*!***************************************!*\
|
||
!*** ./node_modules/global/window.js ***!
|
||
\***************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("var win;\n\nif (typeof window !== \"undefined\") {\n win = window;\n} else if (typeof __webpack_require__.g !== \"undefined\") {\n win = __webpack_require__.g;\n} else if (typeof self !== \"undefined\"){\n win = self;\n} else {\n win = {};\n}\n\nmodule.exports = win;\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/global/window.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/ieee754/index.js":
|
||
/*!***************************************!*\
|
||
!*** ./node_modules/ieee754/index.js ***!
|
||
\***************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
eval("/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/ieee754/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/inherits/inherits_browser.js":
|
||
/*!***************************************************!*\
|
||
!*** ./node_modules/inherits/inherits_browser.js ***!
|
||
\***************************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/inherits/inherits_browser.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/iota-array/iota.js":
|
||
/*!*****************************************!*\
|
||
!*** ./node_modules/iota-array/iota.js ***!
|
||
\*****************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\nfunction iota(n) {\n var result = new Array(n)\n for(var i=0; i<n; ++i) {\n result[i] = i\n }\n return result\n}\n\nmodule.exports = iota\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/iota-array/iota.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/is-buffer/index.js":
|
||
/*!*****************************************!*\
|
||
!*** ./node_modules/is-buffer/index.js ***!
|
||
\*****************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n\n// The _isBuffer check is for Safari 5-7 support, because it's missing\n// Object.prototype.constructor. Remove this eventually\nmodule.exports = function (obj) {\n return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)\n}\n\nfunction isBuffer (obj) {\n return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n\n// For Node v0.10 support. Remove this eventually.\nfunction isSlowBuffer (obj) {\n return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/is-buffer/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/is-function/index.js":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/is-function/index.js ***!
|
||
\*******************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("module.exports = isFunction\n\nvar toString = Object.prototype.toString\n\nfunction isFunction (fn) {\n if (!fn) {\n return false\n }\n var string = toString.call(fn)\n return string === '[object Function]' ||\n (typeof fn === 'function' && string !== '[object RegExp]') ||\n (typeof window !== 'undefined' &&\n // IE8 and below\n (fn === window.setTimeout ||\n fn === window.alert ||\n fn === window.confirm ||\n fn === window.prompt))\n};\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/is-function/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/ndarray-pack/convert.js":
|
||
/*!**********************************************!*\
|
||
!*** ./node_modules/ndarray-pack/convert.js ***!
|
||
\**********************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nvar ndarray = __webpack_require__(/*! ndarray */ \"./node_modules/ndarray/ndarray.js\")\nvar do_convert = __webpack_require__(/*! ./doConvert.js */ \"./node_modules/ndarray-pack/doConvert.js\")\n\nmodule.exports = function convert(arr, result) {\n var shape = [], c = arr, sz = 1\n while(Array.isArray(c)) {\n shape.push(c.length)\n sz *= c.length\n c = c[0]\n }\n if(shape.length === 0) {\n return ndarray()\n }\n if(!result) {\n result = ndarray(new Float64Array(sz), shape)\n }\n do_convert(result, arr)\n return result\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/ndarray-pack/convert.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/ndarray-pack/doConvert.js":
|
||
/*!************************************************!*\
|
||
!*** ./node_modules/ndarray-pack/doConvert.js ***!
|
||
\************************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("module.exports=__webpack_require__(/*! cwise-compiler */ \"./node_modules/cwise-compiler/compiler.js\")({\"args\":[\"array\",\"scalar\",\"index\"],\"pre\":{\"body\":\"{}\",\"args\":[],\"thisVars\":[],\"localVars\":[]},\"body\":{\"body\":\"{\\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\\n}\\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\\n}\",\"args\":[{\"name\":\"_inline_1_arg0_\",\"lvalue\":true,\"rvalue\":false,\"count\":1},{\"name\":\"_inline_1_arg1_\",\"lvalue\":false,\"rvalue\":true,\"count\":1},{\"name\":\"_inline_1_arg2_\",\"lvalue\":false,\"rvalue\":true,\"count\":4}],\"thisVars\":[],\"localVars\":[\"_inline_1_i\",\"_inline_1_v\"]},\"post\":{\"body\":\"{}\",\"args\":[],\"thisVars\":[],\"localVars\":[]},\"funcName\":\"convert\",\"blockSize\":64})\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/ndarray-pack/doConvert.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/ndarray/ndarray.js":
|
||
/*!*****************************************!*\
|
||
!*** ./node_modules/ndarray/ndarray.js ***!
|
||
\*****************************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
eval("var iota = __webpack_require__(/*! iota-array */ \"./node_modules/iota-array/iota.js\")\nvar isBuffer = __webpack_require__(/*! is-buffer */ \"./node_modules/is-buffer/index.js\")\n\nvar hasTypedArrays = ((typeof Float64Array) !== \"undefined\")\n\nfunction compare1st(a, b) {\n return a[0] - b[0]\n}\n\nfunction order() {\n var stride = this.stride\n var terms = new Array(stride.length)\n var i\n for(i=0; i<terms.length; ++i) {\n terms[i] = [Math.abs(stride[i]), i]\n }\n terms.sort(compare1st)\n var result = new Array(terms.length)\n for(i=0; i<result.length; ++i) {\n result[i] = terms[i][1]\n }\n return result\n}\n\nfunction compileConstructor(dtype, dimension) {\n var className = [\"View\", dimension, \"d\", dtype].join(\"\")\n if(dimension < 0) {\n className = \"View_Nil\" + dtype\n }\n var useGetters = (dtype === \"generic\")\n\n if(dimension === -1) {\n //Special case for trivial arrays\n var code =\n \"function \"+className+\"(a){this.data=a;};\\\nvar proto=\"+className+\".prototype;\\\nproto.dtype='\"+dtype+\"';\\\nproto.index=function(){return -1};\\\nproto.size=0;\\\nproto.dimension=-1;\\\nproto.shape=proto.stride=proto.order=[];\\\nproto.lo=proto.hi=proto.transpose=proto.step=\\\nfunction(){return new \"+className+\"(this.data);};\\\nproto.get=proto.set=function(){};\\\nproto.pick=function(){return null};\\\nreturn function construct_\"+className+\"(a){return new \"+className+\"(a);}\"\n var procedure = new Function(code)\n return procedure()\n } else if(dimension === 0) {\n //Special case for 0d arrays\n var code =\n \"function \"+className+\"(a,d) {\\\nthis.data = a;\\\nthis.offset = d\\\n};\\\nvar proto=\"+className+\".prototype;\\\nproto.dtype='\"+dtype+\"';\\\nproto.index=function(){return this.offset};\\\nproto.dimension=0;\\\nproto.size=1;\\\nproto.shape=\\\nproto.stride=\\\nproto.order=[];\\\nproto.lo=\\\nproto.hi=\\\nproto.transpose=\\\nproto.step=function \"+className+\"_copy() {\\\nreturn new \"+className+\"(this.data,this.offset)\\\n};\\\nproto.pick=function \"+className+\"_pick(){\\\nreturn TrivialArray(this.data);\\\n};\\\nproto.valueOf=proto.get=function \"+className+\"_get(){\\\nreturn \"+(useGetters ? \"this.data.get(this.offset)\" : \"this.data[this.offset]\")+\n\"};\\\nproto.set=function \"+className+\"_set(v){\\\nreturn \"+(useGetters ? \"this.data.set(this.offset,v)\" : \"this.data[this.offset]=v\")+\"\\\n};\\\nreturn function construct_\"+className+\"(a,b,c,d){return new \"+className+\"(a,d)}\"\n var procedure = new Function(\"TrivialArray\", code)\n return procedure(CACHED_CONSTRUCTORS[dtype][0])\n }\n\n var code = [\"'use strict'\"]\n\n //Create constructor for view\n var indices = iota(dimension)\n var args = indices.map(function(i) { return \"i\"+i })\n var index_str = \"this.offset+\" + indices.map(function(i) {\n return \"this.stride[\" + i + \"]*i\" + i\n }).join(\"+\")\n var shapeArg = indices.map(function(i) {\n return \"b\"+i\n }).join(\",\")\n var strideArg = indices.map(function(i) {\n return \"c\"+i\n }).join(\",\")\n code.push(\n \"function \"+className+\"(a,\" + shapeArg + \",\" + strideArg + \",d){this.data=a\",\n \"this.shape=[\" + shapeArg + \"]\",\n \"this.stride=[\" + strideArg + \"]\",\n \"this.offset=d|0}\",\n \"var proto=\"+className+\".prototype\",\n \"proto.dtype='\"+dtype+\"'\",\n \"proto.dimension=\"+dimension)\n\n //view.size:\n code.push(\"Object.defineProperty(proto,'size',{get:function \"+className+\"_size(){\\\nreturn \"+indices.map(function(i) { return \"this.shape[\"+i+\"]\" }).join(\"*\"),\n\"}})\")\n\n //view.order:\n if(dimension === 1) {\n code.push(\"proto.order=[0]\")\n } else {\n code.push(\"Object.defineProperty(proto,'order',{get:\")\n if(dimension < 4) {\n code.push(\"function \"+className+\"_order(){\")\n if(dimension === 2) {\n code.push(\"return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})\")\n } else if(dimension === 3) {\n code.push(\n\"var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);\\\nif(s0>s1){\\\nif(s1>s2){\\\nreturn [2,1,0];\\\n}else if(s0>s2){\\\nreturn [1,2,0];\\\n}else{\\\nreturn [1,0,2];\\\n}\\\n}else if(s0>s2){\\\nreturn [2,0,1];\\\n}else if(s2>s1){\\\nreturn [0,1,2];\\\n}else{\\\nreturn [0,2,1];\\\n}}})\")\n }\n } else {\n code.push(\"ORDER})\")\n }\n }\n\n //view.set(i0, ..., v):\n code.push(\n\"proto.set=function \"+className+\"_set(\"+args.join(\",\")+\",v){\")\n if(useGetters) {\n code.push(\"return this.data.set(\"+index_str+\",v)}\")\n } else {\n code.push(\"return this.data[\"+index_str+\"]=v}\")\n }\n\n //view.get(i0, ...):\n code.push(\"proto.get=function \"+className+\"_get(\"+args.join(\",\")+\"){\")\n if(useGetters) {\n code.push(\"return this.data.get(\"+index_str+\")}\")\n } else {\n code.push(\"return this.data[\"+index_str+\"]}\")\n }\n\n //view.index:\n code.push(\n \"proto.index=function \"+className+\"_index(\", args.join(), \"){return \"+index_str+\"}\")\n\n //view.hi():\n code.push(\"proto.hi=function \"+className+\"_hi(\"+args.join(\",\")+\"){return new \"+className+\"(this.data,\"+\n indices.map(function(i) {\n return [\"(typeof i\",i,\"!=='number'||i\",i,\"<0)?this.shape[\", i, \"]:i\", i,\"|0\"].join(\"\")\n }).join(\",\")+\",\"+\n indices.map(function(i) {\n return \"this.stride[\"+i + \"]\"\n }).join(\",\")+\",this.offset)}\")\n\n //view.lo():\n var a_vars = indices.map(function(i) { return \"a\"+i+\"=this.shape[\"+i+\"]\" })\n var c_vars = indices.map(function(i) { return \"c\"+i+\"=this.stride[\"+i+\"]\" })\n code.push(\"proto.lo=function \"+className+\"_lo(\"+args.join(\",\")+\"){var b=this.offset,d=0,\"+a_vars.join(\",\")+\",\"+c_vars.join(\",\"))\n for(var i=0; i<dimension; ++i) {\n code.push(\n\"if(typeof i\"+i+\"==='number'&&i\"+i+\">=0){\\\nd=i\"+i+\"|0;\\\nb+=c\"+i+\"*d;\\\na\"+i+\"-=d}\")\n }\n code.push(\"return new \"+className+\"(this.data,\"+\n indices.map(function(i) {\n return \"a\"+i\n }).join(\",\")+\",\"+\n indices.map(function(i) {\n return \"c\"+i\n }).join(\",\")+\",b)}\")\n\n //view.step():\n code.push(\"proto.step=function \"+className+\"_step(\"+args.join(\",\")+\"){var \"+\n indices.map(function(i) {\n return \"a\"+i+\"=this.shape[\"+i+\"]\"\n }).join(\",\")+\",\"+\n indices.map(function(i) {\n return \"b\"+i+\"=this.stride[\"+i+\"]\"\n }).join(\",\")+\",c=this.offset,d=0,ceil=Math.ceil\")\n for(var i=0; i<dimension; ++i) {\n code.push(\n\"if(typeof i\"+i+\"==='number'){\\\nd=i\"+i+\"|0;\\\nif(d<0){\\\nc+=b\"+i+\"*(a\"+i+\"-1);\\\na\"+i+\"=ceil(-a\"+i+\"/d)\\\n}else{\\\na\"+i+\"=ceil(a\"+i+\"/d)\\\n}\\\nb\"+i+\"*=d\\\n}\")\n }\n code.push(\"return new \"+className+\"(this.data,\"+\n indices.map(function(i) {\n return \"a\" + i\n }).join(\",\")+\",\"+\n indices.map(function(i) {\n return \"b\" + i\n }).join(\",\")+\",c)}\")\n\n //view.transpose():\n var tShape = new Array(dimension)\n var tStride = new Array(dimension)\n for(var i=0; i<dimension; ++i) {\n tShape[i] = \"a[i\"+i+\"]\"\n tStride[i] = \"b[i\"+i+\"]\"\n }\n code.push(\"proto.transpose=function \"+className+\"_transpose(\"+args+\"){\"+\n args.map(function(n,idx) { return n + \"=(\" + n + \"===undefined?\" + idx + \":\" + n + \"|0)\"}).join(\";\"),\n \"var a=this.shape,b=this.stride;return new \"+className+\"(this.data,\"+tShape.join(\",\")+\",\"+tStride.join(\",\")+\",this.offset)}\")\n\n //view.pick():\n code.push(\"proto.pick=function \"+className+\"_pick(\"+args+\"){var a=[],b=[],c=this.offset\")\n for(var i=0; i<dimension; ++i) {\n code.push(\"if(typeof i\"+i+\"==='number'&&i\"+i+\">=0){c=(c+this.stride[\"+i+\"]*i\"+i+\")|0}else{a.push(this.shape[\"+i+\"]);b.push(this.stride[\"+i+\"])}\")\n }\n code.push(\"var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}\")\n\n //Add return statement\n code.push(\"return function construct_\"+className+\"(data,shape,stride,offset){return new \"+className+\"(data,\"+\n indices.map(function(i) {\n return \"shape[\"+i+\"]\"\n }).join(\",\")+\",\"+\n indices.map(function(i) {\n return \"stride[\"+i+\"]\"\n }).join(\",\")+\",offset)}\")\n\n //Compile procedure\n var procedure = new Function(\"CTOR_LIST\", \"ORDER\", code.join(\"\\n\"))\n return procedure(CACHED_CONSTRUCTORS[dtype], order)\n}\n\nfunction arrayDType(data) {\n if(isBuffer(data)) {\n return \"buffer\"\n }\n if(hasTypedArrays) {\n switch(Object.prototype.toString.call(data)) {\n case \"[object Float64Array]\":\n return \"float64\"\n case \"[object Float32Array]\":\n return \"float32\"\n case \"[object Int8Array]\":\n return \"int8\"\n case \"[object Int16Array]\":\n return \"int16\"\n case \"[object Int32Array]\":\n return \"int32\"\n case \"[object Uint8Array]\":\n return \"uint8\"\n case \"[object Uint16Array]\":\n return \"uint16\"\n case \"[object Uint32Array]\":\n return \"uint32\"\n case \"[object Uint8ClampedArray]\":\n return \"uint8_clamped\"\n case \"[object BigInt64Array]\":\n return \"bigint64\"\n case \"[object BigUint64Array]\":\n return \"biguint64\"\n }\n }\n if(Array.isArray(data)) {\n return \"array\"\n }\n return \"generic\"\n}\n\nvar CACHED_CONSTRUCTORS = {\n \"float32\":[],\n \"float64\":[],\n \"int8\":[],\n \"int16\":[],\n \"int32\":[],\n \"uint8\":[],\n \"uint16\":[],\n \"uint32\":[],\n \"array\":[],\n \"uint8_clamped\":[],\n \"bigint64\": [],\n \"biguint64\": [],\n \"buffer\":[],\n \"generic\":[]\n}\n\n;(function() {\n for(var id in CACHED_CONSTRUCTORS) {\n CACHED_CONSTRUCTORS[id].push(compileConstructor(id, -1))\n }\n});\n\nfunction wrappedNDArrayCtor(data, shape, stride, offset) {\n if(data === undefined) {\n var ctor = CACHED_CONSTRUCTORS.array[0]\n return ctor([])\n } else if(typeof data === \"number\") {\n data = [data]\n }\n if(shape === undefined) {\n shape = [ data.length ]\n }\n var d = shape.length\n if(stride === undefined) {\n stride = new Array(d)\n for(var i=d-1, sz=1; i>=0; --i) {\n stride[i] = sz\n sz *= shape[i]\n }\n }\n if(offset === undefined) {\n offset = 0\n for(var i=0; i<d; ++i) {\n if(stride[i] < 0) {\n offset -= (shape[i]-1)*stride[i]\n }\n }\n }\n var dtype = arrayDType(data)\n var ctor_list = CACHED_CONSTRUCTORS[dtype]\n while(ctor_list.length <= d+1) {\n ctor_list.push(compileConstructor(dtype, ctor_list.length-1))\n }\n var ctor = ctor_list[d+1]\n return ctor(data, shape, stride, offset)\n}\n\nmodule.exports = wrappedNDArrayCtor\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/ndarray/ndarray.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/omggif/omggif.js":
|
||
/*!***************************************!*\
|
||
!*** ./node_modules/omggif/omggif.js ***!
|
||
\***************************************/
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
eval("// (c) Dean McNamee <dean@gmail.com>, 2013.\n//\n// https://github.com/deanm/omggif\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n//\n// omggif is a JavaScript implementation of a GIF 89a encoder and decoder,\n// including animation and compression. It does not rely on any specific\n// underlying system, so should run in the browser, Node, or Plask.\n\n\n\nfunction GifWriter(buf, width, height, gopts) {\n var p = 0;\n\n var gopts = gopts === undefined ? { } : gopts;\n var loop_count = gopts.loop === undefined ? null : gopts.loop;\n var global_palette = gopts.palette === undefined ? null : gopts.palette;\n\n if (width <= 0 || height <= 0 || width > 65535 || height > 65535)\n throw new Error(\"Width/Height invalid.\");\n\n function check_palette_and_num_colors(palette) {\n var num_colors = palette.length;\n if (num_colors < 2 || num_colors > 256 || num_colors & (num_colors-1)) {\n throw new Error(\n \"Invalid code/color length, must be power of 2 and 2 .. 256.\");\n }\n return num_colors;\n }\n\n // - Header.\n buf[p++] = 0x47; buf[p++] = 0x49; buf[p++] = 0x46; // GIF\n buf[p++] = 0x38; buf[p++] = 0x39; buf[p++] = 0x61; // 89a\n\n // Handling of Global Color Table (palette) and background index.\n var gp_num_colors_pow2 = 0;\n var background = 0;\n if (global_palette !== null) {\n var gp_num_colors = check_palette_and_num_colors(global_palette);\n while (gp_num_colors >>= 1) ++gp_num_colors_pow2;\n gp_num_colors = 1 << gp_num_colors_pow2;\n --gp_num_colors_pow2;\n if (gopts.background !== undefined) {\n background = gopts.background;\n if (background >= gp_num_colors)\n throw new Error(\"Background index out of range.\");\n // The GIF spec states that a background index of 0 should be ignored, so\n // this is probably a mistake and you really want to set it to another\n // slot in the palette. But actually in the end most browsers, etc end\n // up ignoring this almost completely (including for dispose background).\n if (background === 0)\n throw new Error(\"Background index explicitly passed as 0.\");\n }\n }\n\n // - Logical Screen Descriptor.\n // NOTE(deanm): w/h apparently ignored by implementations, but set anyway.\n buf[p++] = width & 0xff; buf[p++] = width >> 8 & 0xff;\n buf[p++] = height & 0xff; buf[p++] = height >> 8 & 0xff;\n // NOTE: Indicates 0-bpp original color resolution (unused?).\n buf[p++] = (global_palette !== null ? 0x80 : 0) | // Global Color Table Flag.\n gp_num_colors_pow2; // NOTE: No sort flag (unused?).\n buf[p++] = background; // Background Color Index.\n buf[p++] = 0; // Pixel aspect ratio (unused?).\n\n // - Global Color Table\n if (global_palette !== null) {\n for (var i = 0, il = global_palette.length; i < il; ++i) {\n var rgb = global_palette[i];\n buf[p++] = rgb >> 16 & 0xff;\n buf[p++] = rgb >> 8 & 0xff;\n buf[p++] = rgb & 0xff;\n }\n }\n\n if (loop_count !== null) { // Netscape block for looping.\n if (loop_count < 0 || loop_count > 65535)\n throw new Error(\"Loop count invalid.\")\n // Extension code, label, and length.\n buf[p++] = 0x21; buf[p++] = 0xff; buf[p++] = 0x0b;\n // NETSCAPE2.0\n buf[p++] = 0x4e; buf[p++] = 0x45; buf[p++] = 0x54; buf[p++] = 0x53;\n buf[p++] = 0x43; buf[p++] = 0x41; buf[p++] = 0x50; buf[p++] = 0x45;\n buf[p++] = 0x32; buf[p++] = 0x2e; buf[p++] = 0x30;\n // Sub-block\n buf[p++] = 0x03; buf[p++] = 0x01;\n buf[p++] = loop_count & 0xff; buf[p++] = loop_count >> 8 & 0xff;\n buf[p++] = 0x00; // Terminator.\n }\n\n\n var ended = false;\n\n this.addFrame = function(x, y, w, h, indexed_pixels, opts) {\n if (ended === true) { --p; ended = false; } // Un-end.\n\n opts = opts === undefined ? { } : opts;\n\n // TODO(deanm): Bounds check x, y. Do they need to be within the virtual\n // canvas width/height, I imagine?\n if (x < 0 || y < 0 || x > 65535 || y > 65535)\n throw new Error(\"x/y invalid.\")\n\n if (w <= 0 || h <= 0 || w > 65535 || h > 65535)\n throw new Error(\"Width/Height invalid.\")\n\n if (indexed_pixels.length < w * h)\n throw new Error(\"Not enough pixels for the frame size.\");\n\n var using_local_palette = true;\n var palette = opts.palette;\n if (palette === undefined || palette === null) {\n using_local_palette = false;\n palette = global_palette;\n }\n\n if (palette === undefined || palette === null)\n throw new Error(\"Must supply either a local or global palette.\");\n\n var num_colors = check_palette_and_num_colors(palette);\n\n // Compute the min_code_size (power of 2), destroying num_colors.\n var min_code_size = 0;\n while (num_colors >>= 1) ++min_code_size;\n num_colors = 1 << min_code_size; // Now we can easily get it back.\n\n var delay = opts.delay === undefined ? 0 : opts.delay;\n\n // From the spec:\n // 0 - No disposal specified. The decoder is\n // not required to take any action.\n // 1 - Do not dispose. The graphic is to be left\n // in place.\n // 2 - Restore to background color. The area used by the\n // graphic must be restored to the background color.\n // 3 - Restore to previous. The decoder is required to\n // restore the area overwritten by the graphic with\n // what was there prior to rendering the graphic.\n // 4-7 - To be defined.\n // NOTE(deanm): Dispose background doesn't really work, apparently most\n // browsers ignore the background palette index and clear to transparency.\n var disposal = opts.disposal === undefined ? 0 : opts.disposal;\n if (disposal < 0 || disposal > 3) // 4-7 is reserved.\n throw new Error(\"Disposal out of range.\");\n\n var use_transparency = false;\n var transparent_index = 0;\n if (opts.transparent !== undefined && opts.transparent !== null) {\n use_transparency = true;\n transparent_index = opts.transparent;\n if (transparent_index < 0 || transparent_index >= num_colors)\n throw new Error(\"Transparent color index.\");\n }\n\n if (disposal !== 0 || use_transparency || delay !== 0) {\n // - Graphics Control Extension\n buf[p++] = 0x21; buf[p++] = 0xf9; // Extension / Label.\n buf[p++] = 4; // Byte size.\n\n buf[p++] = disposal << 2 | (use_transparency === true ? 1 : 0);\n buf[p++] = delay & 0xff; buf[p++] = delay >> 8 & 0xff;\n buf[p++] = transparent_index; // Transparent color index.\n buf[p++] = 0; // Block Terminator.\n }\n\n // - Image Descriptor\n buf[p++] = 0x2c; // Image Seperator.\n buf[p++] = x & 0xff; buf[p++] = x >> 8 & 0xff; // Left.\n buf[p++] = y & 0xff; buf[p++] = y >> 8 & 0xff; // Top.\n buf[p++] = w & 0xff; buf[p++] = w >> 8 & 0xff;\n buf[p++] = h & 0xff; buf[p++] = h >> 8 & 0xff;\n // NOTE: No sort flag (unused?).\n // TODO(deanm): Support interlace.\n buf[p++] = using_local_palette === true ? (0x80 | (min_code_size-1)) : 0;\n\n // - Local Color Table\n if (using_local_palette === true) {\n for (var i = 0, il = palette.length; i < il; ++i) {\n var rgb = palette[i];\n buf[p++] = rgb >> 16 & 0xff;\n buf[p++] = rgb >> 8 & 0xff;\n buf[p++] = rgb & 0xff;\n }\n }\n\n p = GifWriterOutputLZWCodeStream(\n buf, p, min_code_size < 2 ? 2 : min_code_size, indexed_pixels);\n\n return p;\n };\n\n this.end = function() {\n if (ended === false) {\n buf[p++] = 0x3b; // Trailer.\n ended = true;\n }\n return p;\n };\n\n this.getOutputBuffer = function() { return buf; };\n this.setOutputBuffer = function(v) { buf = v; };\n this.getOutputBufferPosition = function() { return p; };\n this.setOutputBufferPosition = function(v) { p = v; };\n}\n\n// Main compression routine, palette indexes -> LZW code stream.\n// |index_stream| must have at least one entry.\nfunction GifWriterOutputLZWCodeStream(buf, p, min_code_size, index_stream) {\n buf[p++] = min_code_size;\n var cur_subblock = p++; // Pointing at the length field.\n\n var clear_code = 1 << min_code_size;\n var code_mask = clear_code - 1;\n var eoi_code = clear_code + 1;\n var next_code = eoi_code + 1;\n\n var cur_code_size = min_code_size + 1; // Number of bits per code.\n var cur_shift = 0;\n // We have at most 12-bit codes, so we should have to hold a max of 19\n // bits here (and then we would write out).\n var cur = 0;\n\n function emit_bytes_to_buffer(bit_block_size) {\n while (cur_shift >= bit_block_size) {\n buf[p++] = cur & 0xff;\n cur >>= 8; cur_shift -= 8;\n if (p === cur_subblock + 256) { // Finished a subblock.\n buf[cur_subblock] = 255;\n cur_subblock = p++;\n }\n }\n }\n\n function emit_code(c) {\n cur |= c << cur_shift;\n cur_shift += cur_code_size;\n emit_bytes_to_buffer(8);\n }\n\n // I am not an expert on the topic, and I don't want to write a thesis.\n // However, it is good to outline here the basic algorithm and the few data\n // structures and optimizations here that make this implementation fast.\n // The basic idea behind LZW is to build a table of previously seen runs\n // addressed by a short id (herein called output code). All data is\n // referenced by a code, which represents one or more values from the\n // original input stream. All input bytes can be referenced as the same\n // value as an output code. So if you didn't want any compression, you\n // could more or less just output the original bytes as codes (there are\n // some details to this, but it is the idea). In order to achieve\n // compression, values greater then the input range (codes can be up to\n // 12-bit while input only 8-bit) represent a sequence of previously seen\n // inputs. The decompressor is able to build the same mapping while\n // decoding, so there is always a shared common knowledge between the\n // encoding and decoder, which is also important for \"timing\" aspects like\n // how to handle variable bit width code encoding.\n //\n // One obvious but very important consequence of the table system is there\n // is always a unique id (at most 12-bits) to map the runs. 'A' might be\n // 4, then 'AA' might be 10, 'AAA' 11, 'AAAA' 12, etc. This relationship\n // can be used for an effecient lookup strategy for the code mapping. We\n // need to know if a run has been seen before, and be able to map that run\n // to the output code. Since we start with known unique ids (input bytes),\n // and then from those build more unique ids (table entries), we can\n // continue this chain (almost like a linked list) to always have small\n // integer values that represent the current byte chains in the encoder.\n // This means instead of tracking the input bytes (AAAABCD) to know our\n // current state, we can track the table entry for AAAABC (it is guaranteed\n // to exist by the nature of the algorithm) and the next character D.\n // Therefor the tuple of (table_entry, byte) is guaranteed to also be\n // unique. This allows us to create a simple lookup key for mapping input\n // sequences to codes (table indices) without having to store or search\n // any of the code sequences. So if 'AAAA' has a table entry of 12, the\n // tuple of ('AAAA', K) for any input byte K will be unique, and can be our\n // key. This leads to a integer value at most 20-bits, which can always\n // fit in an SMI value and be used as a fast sparse array / object key.\n\n // Output code for the current contents of the index buffer.\n var ib_code = index_stream[0] & code_mask; // Load first input index.\n var code_table = { }; // Key'd on our 20-bit \"tuple\".\n\n emit_code(clear_code); // Spec says first code should be a clear code.\n\n // First index already loaded, process the rest of the stream.\n for (var i = 1, il = index_stream.length; i < il; ++i) {\n var k = index_stream[i] & code_mask;\n var cur_key = ib_code << 8 | k; // (prev, k) unique tuple.\n var cur_code = code_table[cur_key]; // buffer + k.\n\n // Check if we have to create a new code table entry.\n if (cur_code === undefined) { // We don't have buffer + k.\n // Emit index buffer (without k).\n // This is an inline version of emit_code, because this is the core\n // writing routine of the compressor (and V8 cannot inline emit_code\n // because it is a closure here in a different context). Additionally\n // we can call emit_byte_to_buffer less often, because we can have\n // 30-bits (from our 31-bit signed SMI), and we know our codes will only\n // be 12-bits, so can safely have 18-bits there without overflow.\n // emit_code(ib_code);\n cur |= ib_code << cur_shift;\n cur_shift += cur_code_size;\n while (cur_shift >= 8) {\n buf[p++] = cur & 0xff;\n cur >>= 8; cur_shift -= 8;\n if (p === cur_subblock + 256) { // Finished a subblock.\n buf[cur_subblock] = 255;\n cur_subblock = p++;\n }\n }\n\n if (next_code === 4096) { // Table full, need a clear.\n emit_code(clear_code);\n next_code = eoi_code + 1;\n cur_code_size = min_code_size + 1;\n code_table = { };\n } else { // Table not full, insert a new entry.\n // Increase our variable bit code sizes if necessary. This is a bit\n // tricky as it is based on \"timing\" between the encoding and\n // decoder. From the encoders perspective this should happen after\n // we've already emitted the index buffer and are about to create the\n // first table entry that would overflow our current code bit size.\n if (next_code >= (1 << cur_code_size)) ++cur_code_size;\n code_table[cur_key] = next_code++; // Insert into code table.\n }\n\n ib_code = k; // Index buffer to single input k.\n } else {\n ib_code = cur_code; // Index buffer to sequence in code table.\n }\n }\n\n emit_code(ib_code); // There will still be something in the index buffer.\n emit_code(eoi_code); // End Of Information.\n\n // Flush / finalize the sub-blocks stream to the buffer.\n emit_bytes_to_buffer(1);\n\n // Finish the sub-blocks, writing out any unfinished lengths and\n // terminating with a sub-block of length 0. If we have already started\n // but not yet used a sub-block it can just become the terminator.\n if (cur_subblock + 1 === p) { // Started but unused.\n buf[cur_subblock] = 0;\n } else { // Started and used, write length and additional terminator block.\n buf[cur_subblock] = p - cur_subblock - 1;\n buf[p++] = 0;\n }\n return p;\n}\n\nfunction GifReader(buf) {\n var p = 0;\n\n // - Header (GIF87a or GIF89a).\n if (buf[p++] !== 0x47 || buf[p++] !== 0x49 || buf[p++] !== 0x46 ||\n buf[p++] !== 0x38 || (buf[p++]+1 & 0xfd) !== 0x38 || buf[p++] !== 0x61) {\n throw new Error(\"Invalid GIF 87a/89a header.\");\n }\n\n // - Logical Screen Descriptor.\n var width = buf[p++] | buf[p++] << 8;\n var height = buf[p++] | buf[p++] << 8;\n var pf0 = buf[p++]; // <Packed Fields>.\n var global_palette_flag = pf0 >> 7;\n var num_global_colors_pow2 = pf0 & 0x7;\n var num_global_colors = 1 << (num_global_colors_pow2 + 1);\n var background = buf[p++];\n buf[p++]; // Pixel aspect ratio (unused?).\n\n var global_palette_offset = null;\n var global_palette_size = null;\n\n if (global_palette_flag) {\n global_palette_offset = p;\n global_palette_size = num_global_colors;\n p += num_global_colors * 3; // Seek past palette.\n }\n\n var no_eof = true;\n\n var frames = [ ];\n\n var delay = 0;\n var transparent_index = null;\n var disposal = 0; // 0 - No disposal specified.\n var loop_count = null;\n\n this.width = width;\n this.height = height;\n\n while (no_eof && p < buf.length) {\n switch (buf[p++]) {\n case 0x21: // Graphics Control Extension Block\n switch (buf[p++]) {\n case 0xff: // Application specific block\n // Try if it's a Netscape block (with animation loop counter).\n if (buf[p ] !== 0x0b || // 21 FF already read, check block size.\n // NETSCAPE2.0\n buf[p+1 ] == 0x4e && buf[p+2 ] == 0x45 && buf[p+3 ] == 0x54 &&\n buf[p+4 ] == 0x53 && buf[p+5 ] == 0x43 && buf[p+6 ] == 0x41 &&\n buf[p+7 ] == 0x50 && buf[p+8 ] == 0x45 && buf[p+9 ] == 0x32 &&\n buf[p+10] == 0x2e && buf[p+11] == 0x30 &&\n // Sub-block\n buf[p+12] == 0x03 && buf[p+13] == 0x01 && buf[p+16] == 0) {\n p += 14;\n loop_count = buf[p++] | buf[p++] << 8;\n p++; // Skip terminator.\n } else { // We don't know what it is, just try to get past it.\n p += 12;\n while (true) { // Seek through subblocks.\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n p += block_size;\n }\n }\n break;\n\n case 0xf9: // Graphics Control Extension\n if (buf[p++] !== 0x4 || buf[p+4] !== 0)\n throw new Error(\"Invalid graphics extension block.\");\n var pf1 = buf[p++];\n delay = buf[p++] | buf[p++] << 8;\n transparent_index = buf[p++];\n if ((pf1 & 1) === 0) transparent_index = null;\n disposal = pf1 >> 2 & 0x7;\n p++; // Skip terminator.\n break;\n\n case 0xfe: // Comment Extension.\n while (true) { // Seek through subblocks.\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n // console.log(buf.slice(p, p+block_size).toString('ascii'));\n p += block_size;\n }\n break;\n\n default:\n throw new Error(\n \"Unknown graphic control label: 0x\" + buf[p-1].toString(16));\n }\n break;\n\n case 0x2c: // Image Descriptor.\n var x = buf[p++] | buf[p++] << 8;\n var y = buf[p++] | buf[p++] << 8;\n var w = buf[p++] | buf[p++] << 8;\n var h = buf[p++] | buf[p++] << 8;\n var pf2 = buf[p++];\n var local_palette_flag = pf2 >> 7;\n var interlace_flag = pf2 >> 6 & 1;\n var num_local_colors_pow2 = pf2 & 0x7;\n var num_local_colors = 1 << (num_local_colors_pow2 + 1);\n var palette_offset = global_palette_offset;\n var palette_size = global_palette_size;\n var has_local_palette = false;\n if (local_palette_flag) {\n var has_local_palette = true;\n palette_offset = p; // Override with local palette.\n palette_size = num_local_colors;\n p += num_local_colors * 3; // Seek past palette.\n }\n\n var data_offset = p;\n\n p++; // codesize\n while (true) {\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n p += block_size;\n }\n\n frames.push({x: x, y: y, width: w, height: h,\n has_local_palette: has_local_palette,\n palette_offset: palette_offset,\n palette_size: palette_size,\n data_offset: data_offset,\n data_length: p - data_offset,\n transparent_index: transparent_index,\n interlaced: !!interlace_flag,\n delay: delay,\n disposal: disposal});\n break;\n\n case 0x3b: // Trailer Marker (end of file).\n no_eof = false;\n break;\n\n default:\n throw new Error(\"Unknown gif block: 0x\" + buf[p-1].toString(16));\n break;\n }\n }\n\n this.numFrames = function() {\n return frames.length;\n };\n\n this.loopCount = function() {\n return loop_count;\n };\n\n this.frameInfo = function(frame_num) {\n if (frame_num < 0 || frame_num >= frames.length)\n throw new Error(\"Frame index out of range.\");\n return frames[frame_num];\n }\n\n this.decodeAndBlitFrameBGRA = function(frame_num, pixels) {\n var frame = this.frameInfo(frame_num);\n var num_pixels = frame.width * frame.height;\n var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices.\n GifReaderLZWOutputIndexStream(\n buf, frame.data_offset, index_stream, num_pixels);\n var palette_offset = frame.palette_offset;\n\n // NOTE(deanm): It seems to be much faster to compare index to 256 than\n // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in\n // the profile, not sure if it's related to using a Uint8Array.\n var trans = frame.transparent_index;\n if (trans === null) trans = 256;\n\n // We are possibly just blitting to a portion of the entire frame.\n // That is a subrect within the framerect, so the additional pixels\n // must be skipped over after we finished a scanline.\n var framewidth = frame.width;\n var framestride = width - framewidth;\n var xleft = framewidth; // Number of subrect pixels left in scanline.\n\n // Output indicies of the top left and bottom right corners of the subrect.\n var opbeg = ((frame.y * width) + frame.x) * 4;\n var opend = ((frame.y + frame.height) * width + frame.x) * 4;\n var op = opbeg;\n\n var scanstride = framestride * 4;\n\n // Use scanstride to skip past the rows when interlacing. This is skipping\n // 7 rows for the first two passes, then 3 then 1.\n if (frame.interlaced === true) {\n scanstride += width * 4 * 7; // Pass 1.\n }\n\n var interlaceskip = 8; // Tracking the row interval in the current pass.\n\n for (var i = 0, il = index_stream.length; i < il; ++i) {\n var index = index_stream[i];\n\n if (xleft === 0) { // Beginning of new scan line\n op += scanstride;\n xleft = framewidth;\n if (op >= opend) { // Catch the wrap to switch passes when interlacing.\n scanstride = framestride * 4 + width * 4 * (interlaceskip-1);\n // interlaceskip / 2 * 4 is interlaceskip << 1.\n op = opbeg + (framewidth + framestride) * (interlaceskip << 1);\n interlaceskip >>= 1;\n }\n }\n\n if (index === trans) {\n op += 4;\n } else {\n var r = buf[palette_offset + index * 3];\n var g = buf[palette_offset + index * 3 + 1];\n var b = buf[palette_offset + index * 3 + 2];\n pixels[op++] = b;\n pixels[op++] = g;\n pixels[op++] = r;\n pixels[op++] = 255;\n }\n --xleft;\n }\n };\n\n // I will go to copy and paste hell one day...\n this.decodeAndBlitFrameRGBA = function(frame_num, pixels) {\n var frame = this.frameInfo(frame_num);\n var num_pixels = frame.width * frame.height;\n var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices.\n GifReaderLZWOutputIndexStream(\n buf, frame.data_offset, index_stream, num_pixels);\n var palette_offset = frame.palette_offset;\n\n // NOTE(deanm): It seems to be much faster to compare index to 256 than\n // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in\n // the profile, not sure if it's related to using a Uint8Array.\n var trans = frame.transparent_index;\n if (trans === null) trans = 256;\n\n // We are possibly just blitting to a portion of the entire frame.\n // That is a subrect within the framerect, so the additional pixels\n // must be skipped over after we finished a scanline.\n var framewidth = frame.width;\n var framestride = width - framewidth;\n var xleft = framewidth; // Number of subrect pixels left in scanline.\n\n // Output indicies of the top left and bottom right corners of the subrect.\n var opbeg = ((frame.y * width) + frame.x) * 4;\n var opend = ((frame.y + frame.height) * width + frame.x) * 4;\n var op = opbeg;\n\n var scanstride = framestride * 4;\n\n // Use scanstride to skip past the rows when interlacing. This is skipping\n // 7 rows for the first two passes, then 3 then 1.\n if (frame.interlaced === true) {\n scanstride += width * 4 * 7; // Pass 1.\n }\n\n var interlaceskip = 8; // Tracking the row interval in the current pass.\n\n for (var i = 0, il = index_stream.length; i < il; ++i) {\n var index = index_stream[i];\n\n if (xleft === 0) { // Beginning of new scan line\n op += scanstride;\n xleft = framewidth;\n if (op >= opend) { // Catch the wrap to switch passes when interlacing.\n scanstride = framestride * 4 + width * 4 * (interlaceskip-1);\n // interlaceskip / 2 * 4 is interlaceskip << 1.\n op = opbeg + (framewidth + framestride) * (interlaceskip << 1);\n interlaceskip >>= 1;\n }\n }\n\n if (index === trans) {\n op += 4;\n } else {\n var r = buf[palette_offset + index * 3];\n var g = buf[palette_offset + index * 3 + 1];\n var b = buf[palette_offset + index * 3 + 2];\n pixels[op++] = r;\n pixels[op++] = g;\n pixels[op++] = b;\n pixels[op++] = 255;\n }\n --xleft;\n }\n };\n}\n\nfunction GifReaderLZWOutputIndexStream(code_stream, p, output, output_length) {\n var min_code_size = code_stream[p++];\n\n var clear_code = 1 << min_code_size;\n var eoi_code = clear_code + 1;\n var next_code = eoi_code + 1;\n\n var cur_code_size = min_code_size + 1; // Number of bits per code.\n // NOTE: This shares the same name as the encoder, but has a different\n // meaning here. Here this masks each code coming from the code stream.\n var code_mask = (1 << cur_code_size) - 1;\n var cur_shift = 0;\n var cur = 0;\n\n var op = 0; // Output pointer.\n\n var subblock_size = code_stream[p++];\n\n // TODO(deanm): Would using a TypedArray be any faster? At least it would\n // solve the fast mode / backing store uncertainty.\n // var code_table = Array(4096);\n var code_table = new Int32Array(4096); // Can be signed, we only use 20 bits.\n\n var prev_code = null; // Track code-1.\n\n while (true) {\n // Read up to two bytes, making sure we always 12-bits for max sized code.\n while (cur_shift < 16) {\n if (subblock_size === 0) break; // No more data to be read.\n\n cur |= code_stream[p++] << cur_shift;\n cur_shift += 8;\n\n if (subblock_size === 1) { // Never let it get to 0 to hold logic above.\n subblock_size = code_stream[p++]; // Next subblock.\n } else {\n --subblock_size;\n }\n }\n\n // TODO(deanm): We should never really get here, we should have received\n // and EOI.\n if (cur_shift < cur_code_size)\n break;\n\n var code = cur & code_mask;\n cur >>= cur_code_size;\n cur_shift -= cur_code_size;\n\n // TODO(deanm): Maybe should check that the first code was a clear code,\n // at least this is what you're supposed to do. But actually our encoder\n // now doesn't emit a clear code first anyway.\n if (code === clear_code) {\n // We don't actually have to clear the table. This could be a good idea\n // for greater error checking, but we don't really do any anyway. We\n // will just track it with next_code and overwrite old entries.\n\n next_code = eoi_code + 1;\n cur_code_size = min_code_size + 1;\n code_mask = (1 << cur_code_size) - 1;\n\n // Don't update prev_code ?\n prev_code = null;\n continue;\n } else if (code === eoi_code) {\n break;\n }\n\n // We have a similar situation as the decoder, where we want to store\n // variable length entries (code table entries), but we want to do in a\n // faster manner than an array of arrays. The code below stores sort of a\n // linked list within the code table, and then \"chases\" through it to\n // construct the dictionary entries. When a new entry is created, just the\n // last byte is stored, and the rest (prefix) of the entry is only\n // referenced by its table entry. Then the code chases through the\n // prefixes until it reaches a single byte code. We have to chase twice,\n // first to compute the length, and then to actually copy the data to the\n // output (backwards, since we know the length). The alternative would be\n // storing something in an intermediate stack, but that doesn't make any\n // more sense. I implemented an approach where it also stored the length\n // in the code table, although it's a bit tricky because you run out of\n // bits (12 + 12 + 8), but I didn't measure much improvements (the table\n // entries are generally not the long). Even when I created benchmarks for\n // very long table entries the complexity did not seem worth it.\n // The code table stores the prefix entry in 12 bits and then the suffix\n // byte in 8 bits, so each entry is 20 bits.\n\n var chase_code = code < next_code ? code : prev_code;\n\n // Chase what we will output, either {CODE} or {CODE-1}.\n var chase_length = 0;\n var chase = chase_code;\n while (chase > clear_code) {\n chase = code_table[chase] >> 8;\n ++chase_length;\n }\n\n var k = chase;\n\n var op_end = op + chase_length + (chase_code !== code ? 1 : 0);\n if (op_end > output_length) {\n console.log(\"Warning, gif stream longer than expected.\");\n return;\n }\n\n // Already have the first byte from the chase, might as well write it fast.\n output[op++] = k;\n\n op += chase_length;\n var b = op; // Track pointer, writing backwards.\n\n if (chase_code !== code) // The case of emitting {CODE-1} + k.\n output[op++] = k;\n\n chase = chase_code;\n while (chase_length--) {\n chase = code_table[chase];\n output[--b] = chase & 0xff; // Write backwards.\n chase >>= 8; // Pull down to the prefix code.\n }\n\n if (prev_code !== null && next_code < 4096) {\n code_table[next_code++] = prev_code << 8 | k;\n // TODO(deanm): Figure out this clearing vs code growth logic better. I\n // have an feeling that it should just happen somewhere else, for now it\n // is awkward between when we grow past the max and then hit a clear code.\n // For now just check if we hit the max 12-bits (then a clear code should\n // follow, also of course encoded in 12-bits).\n if (next_code >= code_mask+1 && cur_code_size < 12) {\n ++cur_code_size;\n code_mask = code_mask << 1 | 1;\n }\n }\n\n prev_code = code;\n }\n\n if (op !== output_length) {\n console.log(\"Warning, gif stream shorter than expected.\");\n }\n\n return output;\n}\n\n// CommonJS.\ntry { exports.GifWriter = GifWriter; exports.GifReader = GifReader } catch(e) {}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/omggif/omggif.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/parse-headers/parse-headers.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/parse-headers/parse-headers.js ***!
|
||
\*****************************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("var trim = function(string) {\n return string.replace(/^\\s+|\\s+$/g, '');\n}\n , isArray = function(arg) {\n return Object.prototype.toString.call(arg) === '[object Array]';\n }\n\nmodule.exports = function (headers) {\n if (!headers)\n return {}\n\n var result = {}\n\n var headersArr = trim(headers).split('\\n')\n\n for (var i = 0; i < headersArr.length; i++) {\n var row = headersArr[i]\n var index = row.indexOf(':')\n , key = trim(row.slice(0, index)).toLowerCase()\n , value = trim(row.slice(index + 1))\n\n if (typeof(result[key]) === 'undefined') {\n result[key] = value\n } else if (isArray(result[key])) {\n result[key].push(value)\n } else {\n result[key] = [ result[key], value ]\n }\n }\n\n return result\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/parse-headers/parse-headers.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/pbf/index.js":
|
||
/*!***********************************!*\
|
||
!*** ./node_modules/pbf/index.js ***!
|
||
\***********************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\n\nmodule.exports = Pbf;\n\nvar ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\");\n\nfunction Pbf(buf) {\n this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);\n this.pos = 0;\n this.type = 0;\n this.length = this.buf.length;\n}\n\nPbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum\nPbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64\nPbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields\nPbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32\n\nvar SHIFT_LEFT_32 = (1 << 16) * (1 << 16),\n SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n\n// Threshold chosen based on both benchmarking and knowledge about browser string\n// data structures (which currently switch structure types at 12 bytes or more)\nvar TEXT_DECODER_MIN_LENGTH = 12;\nvar utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');\n\nPbf.prototype = {\n\n destroy: function() {\n this.buf = null;\n },\n\n // === READING =================================================================\n\n readFields: function(readField, result, end) {\n end = end || this.length;\n\n while (this.pos < end) {\n var val = this.readVarint(),\n tag = val >> 3,\n startPos = this.pos;\n\n this.type = val & 0x7;\n readField(tag, result, this);\n\n if (this.pos === startPos) this.skip(val);\n }\n return result;\n },\n\n readMessage: function(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n },\n\n readFixed32: function() {\n var val = readUInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n readSFixed32: function() {\n var val = readInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)\n\n readFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readSFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readFloat: function() {\n var val = ieee754.read(this.buf, this.pos, true, 23, 4);\n this.pos += 4;\n return val;\n },\n\n readDouble: function() {\n var val = ieee754.read(this.buf, this.pos, true, 52, 8);\n this.pos += 8;\n return val;\n },\n\n readVarint: function(isSigned) {\n var buf = this.buf,\n val, b;\n\n b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;\n b = buf[this.pos]; val |= (b & 0x0f) << 28;\n\n return readVarintRemainder(val, isSigned, this);\n },\n\n readVarint64: function() { // for compatibility with v2.0.1\n return this.readVarint(true);\n },\n\n readSVarint: function() {\n var num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding\n },\n\n readBoolean: function() {\n return Boolean(this.readVarint());\n },\n\n readString: function() {\n var end = this.readVarint() + this.pos;\n var pos = this.pos;\n this.pos = end;\n\n if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {\n // longer strings are fast with the built-in browser TextDecoder API\n return readUtf8TextDecoder(this.buf, pos, end);\n }\n // short strings are fast with our custom implementation\n return readUtf8(this.buf, pos, end);\n },\n\n readBytes: function() {\n var end = this.readVarint() + this.pos,\n buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n },\n\n // verbose for performance reasons; doesn't affect gzipped size\n\n readPackedVarint: function(arr, isSigned) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readVarint(isSigned));\n return arr;\n },\n readPackedSVarint: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSVarint());\n return arr;\n },\n readPackedBoolean: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readBoolean());\n return arr;\n },\n readPackedFloat: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFloat());\n return arr;\n },\n readPackedDouble: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readDouble());\n return arr;\n },\n readPackedFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed32());\n return arr;\n },\n readPackedSFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed32());\n return arr;\n },\n readPackedFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed64());\n return arr;\n },\n readPackedSFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed64());\n return arr;\n },\n\n skip: function(val) {\n var type = val & 0x7;\n if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}\n else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;\n else if (type === Pbf.Fixed32) this.pos += 4;\n else if (type === Pbf.Fixed64) this.pos += 8;\n else throw new Error('Unimplemented type: ' + type);\n },\n\n // === WRITING =================================================================\n\n writeTag: function(tag, type) {\n this.writeVarint((tag << 3) | type);\n },\n\n realloc: function(min) {\n var length = this.length || 16;\n\n while (length < this.pos + min) length *= 2;\n\n if (length !== this.length) {\n var buf = new Uint8Array(length);\n buf.set(this.buf);\n this.buf = buf;\n this.length = length;\n }\n },\n\n finish: function() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n },\n\n writeFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeSFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeSFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeVarint: function(val) {\n val = +val || 0;\n\n if (val > 0xfffffff || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n\n this.realloc(4);\n\n this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = (val >>> 7) & 0x7f;\n },\n\n writeSVarint: function(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n },\n\n writeBoolean: function(val) {\n this.writeVarint(Boolean(val));\n },\n\n writeString: function(str) {\n str = String(str);\n this.realloc(str.length * 4);\n\n this.pos++; // reserve 1 byte for short string length\n\n var startPos = this.pos;\n // write the string directly to the buffer and see how much was written\n this.pos = writeUtf8(this.buf, str, this.pos);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeFloat: function(val) {\n this.realloc(4);\n ieee754.write(this.buf, val, this.pos, true, 23, 4);\n this.pos += 4;\n },\n\n writeDouble: function(val) {\n this.realloc(8);\n ieee754.write(this.buf, val, this.pos, true, 52, 8);\n this.pos += 8;\n },\n\n writeBytes: function(buffer) {\n var len = buffer.length;\n this.writeVarint(len);\n this.realloc(len);\n for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];\n },\n\n writeRawMessage: function(fn, obj) {\n this.pos++; // reserve 1 byte for short message length\n\n // write the message directly to the buffer and see how much was written\n var startPos = this.pos;\n fn(obj, this);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeMessage: function(tag, fn, obj) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeRawMessage(fn, obj);\n },\n\n writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },\n writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },\n writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },\n writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },\n writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },\n writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },\n writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },\n writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },\n writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },\n\n writeBytesField: function(tag, buffer) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeBytes(buffer);\n },\n writeFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFixed32(val);\n },\n writeSFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeSFixed32(val);\n },\n writeFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeFixed64(val);\n },\n writeSFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeSFixed64(val);\n },\n writeVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeVarint(val);\n },\n writeSVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeSVarint(val);\n },\n writeStringField: function(tag, str) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeString(str);\n },\n writeFloatField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFloat(val);\n },\n writeDoubleField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeDouble(val);\n },\n writeBooleanField: function(tag, val) {\n this.writeVarintField(tag, Boolean(val));\n }\n};\n\nfunction readVarintRemainder(l, s, p) {\n var buf = p.buf,\n h, b;\n\n b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);\n\n throw new Error('Expected varint not more than 10 bytes');\n}\n\nfunction readPackedEnd(pbf) {\n return pbf.type === Pbf.Bytes ?\n pbf.readVarint() + pbf.pos : pbf.pos + 1;\n}\n\nfunction toNum(low, high, isSigned) {\n if (isSigned) {\n return high * 0x100000000 + (low >>> 0);\n }\n\n return ((high >>> 0) * 0x100000000) + (low >>> 0);\n}\n\nfunction writeBigVarint(val, pbf) {\n var low, high;\n\n if (val >= 0) {\n low = (val % 0x100000000) | 0;\n high = (val / 0x100000000) | 0;\n } else {\n low = ~(-val % 0x100000000);\n high = ~(-val / 0x100000000);\n\n if (low ^ 0xffffffff) {\n low = (low + 1) | 0;\n } else {\n low = 0;\n high = (high + 1) | 0;\n }\n }\n\n if (val >= 0x10000000000000000 || val < -0x10000000000000000) {\n throw new Error('Given varint doesn\\'t fit into 10 bytes');\n }\n\n pbf.realloc(10);\n\n writeBigVarintLow(low, high, pbf);\n writeBigVarintHigh(high, pbf);\n}\n\nfunction writeBigVarintLow(low, high, pbf) {\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos] = low & 0x7f;\n}\n\nfunction writeBigVarintHigh(high, pbf) {\n var lsb = (high & 0x07) << 4;\n\n pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f;\n}\n\nfunction makeRoomForExtraLength(startPos, len, pbf) {\n var extraLen =\n len <= 0x3fff ? 1 :\n len <= 0x1fffff ? 2 :\n len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));\n\n // if 1 byte isn't enough for encoding message length, shift the data to the right\n pbf.realloc(extraLen);\n for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];\n}\n\nfunction writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }\nfunction writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }\nfunction writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }\nfunction writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }\nfunction writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }\nfunction writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }\nfunction writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }\nfunction writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }\nfunction writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }\n\n// Buffer code below from https://github.com/feross/buffer, MIT-licensed\n\nfunction readUInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] * 0x1000000);\n}\n\nfunction writeInt32(buf, val, pos) {\n buf[pos] = val;\n buf[pos + 1] = (val >>> 8);\n buf[pos + 2] = (val >>> 16);\n buf[pos + 3] = (val >>> 24);\n}\n\nfunction readInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] << 24);\n}\n\nfunction readUtf8(buf, pos, end) {\n var str = '';\n var i = pos;\n\n while (i < end) {\n var b0 = buf[i];\n var c = null; // codepoint\n var bytesPerSequence =\n b0 > 0xEF ? 4 :\n b0 > 0xDF ? 3 :\n b0 > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence > end) break;\n\n var b1, b2, b3;\n\n if (bytesPerSequence === 1) {\n if (b0 < 0x80) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 0xC0) === 0x80) {\n c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);\n if (c <= 0x7F) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);\n if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 4) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n b3 = buf[i + 3];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);\n if (c <= 0xFFFF || c >= 0x110000) {\n c = null;\n }\n }\n }\n\n if (c === null) {\n c = 0xFFFD;\n bytesPerSequence = 1;\n\n } else if (c > 0xFFFF) {\n c -= 0x10000;\n str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);\n c = 0xDC00 | c & 0x3FF;\n }\n\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n\n return str;\n}\n\nfunction readUtf8TextDecoder(buf, pos, end) {\n return utf8TextDecoder.decode(buf.subarray(pos, end));\n}\n\nfunction writeUtf8(buf, str, pos) {\n for (var i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i); // code point\n\n if (c > 0xD7FF && c < 0xE000) {\n if (lead) {\n if (c < 0xDC00) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = c;\n continue;\n } else {\n c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;\n lead = null;\n }\n } else {\n if (c > 0xDBFF || (i + 1 === str.length)) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = null;\n }\n\n if (c < 0x80) {\n buf[pos++] = c;\n } else {\n if (c < 0x800) {\n buf[pos++] = c >> 0x6 | 0xC0;\n } else {\n if (c < 0x10000) {\n buf[pos++] = c >> 0xC | 0xE0;\n } else {\n buf[pos++] = c >> 0x12 | 0xF0;\n buf[pos++] = c >> 0xC & 0x3F | 0x80;\n }\n buf[pos++] = c >> 0x6 & 0x3F | 0x80;\n }\n buf[pos++] = c & 0x3F | 0x80;\n }\n }\n return pos;\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/pbf/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/polygon-clipping/dist/polygon-clipping.umd.js":
|
||
/*!********************************************************************!*\
|
||
!*** ./node_modules/polygon-clipping/dist/polygon-clipping.umd.js ***!
|
||
\********************************************************************/
|
||
/***/ (function(module) {
|
||
|
||
eval("(function (global, factory) {\n true ? module.exports = factory() :\n 0;\n}(this, (function () { 'use strict';\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n /**\n * splaytree v3.1.0\n * Fast Splay tree for Node and browser\n *\n * @author Alexander Milevski <info@w8r.name>\n * @license MIT\n * @preserve\n */\n var Node =\n /** @class */\n function () {\n function Node(key, data) {\n this.next = null;\n this.key = key;\n this.data = data;\n this.left = null;\n this.right = null;\n }\n\n return Node;\n }();\n /* follows \"An implementation of top-down splaying\"\r\n * by D. Sleator <sleator@cs.cmu.edu> March 1992\r\n */\n\n\n function DEFAULT_COMPARE(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n /**\r\n * Simple top down splay, not requiring i to be in the tree t.\r\n */\n\n\n function splay(i, t, comparator) {\n var N = new Node(null, null);\n var l = N;\n var r = N;\n\n while (true) {\n var cmp = comparator(i, t.key); //if (i < t.key) {\n\n if (cmp < 0) {\n if (t.left === null) break; //if (i < t.left.key) {\n\n if (comparator(i, t.left.key) < 0) {\n var y = t.left;\n /* rotate right */\n\n t.left = y.right;\n y.right = t;\n t = y;\n if (t.left === null) break;\n }\n\n r.left = t;\n /* link right */\n\n r = t;\n t = t.left; //} else if (i > t.key) {\n } else if (cmp > 0) {\n if (t.right === null) break; //if (i > t.right.key) {\n\n if (comparator(i, t.right.key) > 0) {\n var y = t.right;\n /* rotate left */\n\n t.right = y.left;\n y.left = t;\n t = y;\n if (t.right === null) break;\n }\n\n l.right = t;\n /* link left */\n\n l = t;\n t = t.right;\n } else break;\n }\n /* assemble */\n\n\n l.right = t.left;\n r.left = t.right;\n t.left = N.right;\n t.right = N.left;\n return t;\n }\n\n function insert(i, data, t, comparator) {\n var node = new Node(i, data);\n\n if (t === null) {\n node.left = node.right = null;\n return node;\n }\n\n t = splay(i, t, comparator);\n var cmp = comparator(i, t.key);\n\n if (cmp < 0) {\n node.left = t.left;\n node.right = t;\n t.left = null;\n } else if (cmp >= 0) {\n node.right = t.right;\n node.left = t;\n t.right = null;\n }\n\n return node;\n }\n\n function split(key, v, comparator) {\n var left = null;\n var right = null;\n\n if (v) {\n v = splay(key, v, comparator);\n var cmp = comparator(v.key, key);\n\n if (cmp === 0) {\n left = v.left;\n right = v.right;\n } else if (cmp < 0) {\n right = v.right;\n v.right = null;\n left = v;\n } else {\n left = v.left;\n v.left = null;\n right = v;\n }\n }\n\n return {\n left: left,\n right: right\n };\n }\n\n function merge(left, right, comparator) {\n if (right === null) return left;\n if (left === null) return right;\n right = splay(left.key, right, comparator);\n right.left = left;\n return right;\n }\n /**\r\n * Prints level of the tree\r\n */\n\n\n function printRow(root, prefix, isTail, out, printNode) {\n if (root) {\n out(\"\" + prefix + (isTail ? '└── ' : '├── ') + printNode(root) + \"\\n\");\n var indent = prefix + (isTail ? ' ' : '│ ');\n if (root.left) printRow(root.left, indent, false, out, printNode);\n if (root.right) printRow(root.right, indent, true, out, printNode);\n }\n }\n\n var Tree =\n /** @class */\n function () {\n function Tree(comparator) {\n if (comparator === void 0) {\n comparator = DEFAULT_COMPARE;\n }\n\n this._root = null;\n this._size = 0;\n this._comparator = comparator;\n }\n /**\r\n * Inserts a key, allows duplicates\r\n */\n\n\n Tree.prototype.insert = function (key, data) {\n this._size++;\n return this._root = insert(key, data, this._root, this._comparator);\n };\n /**\r\n * Adds a key, if it is not present in the tree\r\n */\n\n\n Tree.prototype.add = function (key, data) {\n var node = new Node(key, data);\n\n if (this._root === null) {\n node.left = node.right = null;\n this._size++;\n this._root = node;\n }\n\n var comparator = this._comparator;\n var t = splay(key, this._root, comparator);\n var cmp = comparator(key, t.key);\n if (cmp === 0) this._root = t;else {\n if (cmp < 0) {\n node.left = t.left;\n node.right = t;\n t.left = null;\n } else if (cmp > 0) {\n node.right = t.right;\n node.left = t;\n t.right = null;\n }\n\n this._size++;\n this._root = node;\n }\n return this._root;\n };\n /**\r\n * @param {Key} key\r\n * @return {Node|null}\r\n */\n\n\n Tree.prototype.remove = function (key) {\n this._root = this._remove(key, this._root, this._comparator);\n };\n /**\r\n * Deletes i from the tree if it's there\r\n */\n\n\n Tree.prototype._remove = function (i, t, comparator) {\n var x;\n if (t === null) return null;\n t = splay(i, t, comparator);\n var cmp = comparator(i, t.key);\n\n if (cmp === 0) {\n /* found it */\n if (t.left === null) {\n x = t.right;\n } else {\n x = splay(i, t.left, comparator);\n x.right = t.right;\n }\n\n this._size--;\n return x;\n }\n\n return t;\n /* It wasn't there */\n };\n /**\r\n * Removes and returns the node with smallest key\r\n */\n\n\n Tree.prototype.pop = function () {\n var node = this._root;\n\n if (node) {\n while (node.left) {\n node = node.left;\n }\n\n this._root = splay(node.key, this._root, this._comparator);\n this._root = this._remove(node.key, this._root, this._comparator);\n return {\n key: node.key,\n data: node.data\n };\n }\n\n return null;\n };\n /**\r\n * Find without splaying\r\n */\n\n\n Tree.prototype.findStatic = function (key) {\n var current = this._root;\n var compare = this._comparator;\n\n while (current) {\n var cmp = compare(key, current.key);\n if (cmp === 0) return current;else if (cmp < 0) current = current.left;else current = current.right;\n }\n\n return null;\n };\n\n Tree.prototype.find = function (key) {\n if (this._root) {\n this._root = splay(key, this._root, this._comparator);\n if (this._comparator(key, this._root.key) !== 0) return null;\n }\n\n return this._root;\n };\n\n Tree.prototype.contains = function (key) {\n var current = this._root;\n var compare = this._comparator;\n\n while (current) {\n var cmp = compare(key, current.key);\n if (cmp === 0) return true;else if (cmp < 0) current = current.left;else current = current.right;\n }\n\n return false;\n };\n\n Tree.prototype.forEach = function (visitor, ctx) {\n var current = this._root;\n var Q = [];\n /* Initialize stack s */\n\n var done = false;\n\n while (!done) {\n if (current !== null) {\n Q.push(current);\n current = current.left;\n } else {\n if (Q.length !== 0) {\n current = Q.pop();\n visitor.call(ctx, current);\n current = current.right;\n } else done = true;\n }\n }\n\n return this;\n };\n /**\r\n * Walk key range from `low` to `high`. Stops if `fn` returns a value.\r\n */\n\n\n Tree.prototype.range = function (low, high, fn, ctx) {\n var Q = [];\n var compare = this._comparator;\n var node = this._root;\n var cmp;\n\n while (Q.length !== 0 || node) {\n if (node) {\n Q.push(node);\n node = node.left;\n } else {\n node = Q.pop();\n cmp = compare(node.key, high);\n\n if (cmp > 0) {\n break;\n } else if (compare(node.key, low) >= 0) {\n if (fn.call(ctx, node)) return this; // stop if smth is returned\n }\n\n node = node.right;\n }\n }\n\n return this;\n };\n /**\r\n * Returns array of keys\r\n */\n\n\n Tree.prototype.keys = function () {\n var keys = [];\n this.forEach(function (_a) {\n var key = _a.key;\n return keys.push(key);\n });\n return keys;\n };\n /**\r\n * Returns array of all the data in the nodes\r\n */\n\n\n Tree.prototype.values = function () {\n var values = [];\n this.forEach(function (_a) {\n var data = _a.data;\n return values.push(data);\n });\n return values;\n };\n\n Tree.prototype.min = function () {\n if (this._root) return this.minNode(this._root).key;\n return null;\n };\n\n Tree.prototype.max = function () {\n if (this._root) return this.maxNode(this._root).key;\n return null;\n };\n\n Tree.prototype.minNode = function (t) {\n if (t === void 0) {\n t = this._root;\n }\n\n if (t) while (t.left) {\n t = t.left;\n }\n return t;\n };\n\n Tree.prototype.maxNode = function (t) {\n if (t === void 0) {\n t = this._root;\n }\n\n if (t) while (t.right) {\n t = t.right;\n }\n return t;\n };\n /**\r\n * Returns node at given index\r\n */\n\n\n Tree.prototype.at = function (index) {\n var current = this._root;\n var done = false;\n var i = 0;\n var Q = [];\n\n while (!done) {\n if (current) {\n Q.push(current);\n current = current.left;\n } else {\n if (Q.length > 0) {\n current = Q.pop();\n if (i === index) return current;\n i++;\n current = current.right;\n } else done = true;\n }\n }\n\n return null;\n };\n\n Tree.prototype.next = function (d) {\n var root = this._root;\n var successor = null;\n\n if (d.right) {\n successor = d.right;\n\n while (successor.left) {\n successor = successor.left;\n }\n\n return successor;\n }\n\n var comparator = this._comparator;\n\n while (root) {\n var cmp = comparator(d.key, root.key);\n if (cmp === 0) break;else if (cmp < 0) {\n successor = root;\n root = root.left;\n } else root = root.right;\n }\n\n return successor;\n };\n\n Tree.prototype.prev = function (d) {\n var root = this._root;\n var predecessor = null;\n\n if (d.left !== null) {\n predecessor = d.left;\n\n while (predecessor.right) {\n predecessor = predecessor.right;\n }\n\n return predecessor;\n }\n\n var comparator = this._comparator;\n\n while (root) {\n var cmp = comparator(d.key, root.key);\n if (cmp === 0) break;else if (cmp < 0) root = root.left;else {\n predecessor = root;\n root = root.right;\n }\n }\n\n return predecessor;\n };\n\n Tree.prototype.clear = function () {\n this._root = null;\n this._size = 0;\n return this;\n };\n\n Tree.prototype.toList = function () {\n return toList(this._root);\n };\n /**\r\n * Bulk-load items. Both array have to be same size\r\n */\n\n\n Tree.prototype.load = function (keys, values, presort) {\n if (values === void 0) {\n values = [];\n }\n\n if (presort === void 0) {\n presort = false;\n }\n\n var size = keys.length;\n var comparator = this._comparator; // sort if needed\n\n if (presort) sort(keys, values, 0, size - 1, comparator);\n\n if (this._root === null) {\n // empty tree\n this._root = loadRecursive(keys, values, 0, size);\n this._size = size;\n } else {\n // that re-builds the whole tree from two in-order traversals\n var mergedList = mergeLists(this.toList(), createList(keys, values), comparator);\n size = this._size + size;\n this._root = sortedListToBST({\n head: mergedList\n }, 0, size);\n }\n\n return this;\n };\n\n Tree.prototype.isEmpty = function () {\n return this._root === null;\n };\n\n Object.defineProperty(Tree.prototype, \"size\", {\n get: function get() {\n return this._size;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tree.prototype, \"root\", {\n get: function get() {\n return this._root;\n },\n enumerable: true,\n configurable: true\n });\n\n Tree.prototype.toString = function (printNode) {\n if (printNode === void 0) {\n printNode = function printNode(n) {\n return String(n.key);\n };\n }\n\n var out = [];\n printRow(this._root, '', true, function (v) {\n return out.push(v);\n }, printNode);\n return out.join('');\n };\n\n Tree.prototype.update = function (key, newKey, newData) {\n var comparator = this._comparator;\n\n var _a = split(key, this._root, comparator),\n left = _a.left,\n right = _a.right;\n\n if (comparator(key, newKey) < 0) {\n right = insert(newKey, newData, right, comparator);\n } else {\n left = insert(newKey, newData, left, comparator);\n }\n\n this._root = merge(left, right, comparator);\n };\n\n Tree.prototype.split = function (key) {\n return split(key, this._root, this._comparator);\n };\n\n return Tree;\n }();\n\n function loadRecursive(keys, values, start, end) {\n var size = end - start;\n\n if (size > 0) {\n var middle = start + Math.floor(size / 2);\n var key = keys[middle];\n var data = values[middle];\n var node = new Node(key, data);\n node.left = loadRecursive(keys, values, start, middle);\n node.right = loadRecursive(keys, values, middle + 1, end);\n return node;\n }\n\n return null;\n }\n\n function createList(keys, values) {\n var head = new Node(null, null);\n var p = head;\n\n for (var i = 0; i < keys.length; i++) {\n p = p.next = new Node(keys[i], values[i]);\n }\n\n p.next = null;\n return head.next;\n }\n\n function toList(root) {\n var current = root;\n var Q = [];\n var done = false;\n var head = new Node(null, null);\n var p = head;\n\n while (!done) {\n if (current) {\n Q.push(current);\n current = current.left;\n } else {\n if (Q.length > 0) {\n current = p = p.next = Q.pop();\n current = current.right;\n } else done = true;\n }\n }\n\n p.next = null; // that'll work even if the tree was empty\n\n return head.next;\n }\n\n function sortedListToBST(list, start, end) {\n var size = end - start;\n\n if (size > 0) {\n var middle = start + Math.floor(size / 2);\n var left = sortedListToBST(list, start, middle);\n var root = list.head;\n root.left = left;\n list.head = list.head.next;\n root.right = sortedListToBST(list, middle + 1, end);\n return root;\n }\n\n return null;\n }\n\n function mergeLists(l1, l2, compare) {\n var head = new Node(null, null); // dummy\n\n var p = head;\n var p1 = l1;\n var p2 = l2;\n\n while (p1 !== null && p2 !== null) {\n if (compare(p1.key, p2.key) < 0) {\n p.next = p1;\n p1 = p1.next;\n } else {\n p.next = p2;\n p2 = p2.next;\n }\n\n p = p.next;\n }\n\n if (p1 !== null) {\n p.next = p1;\n } else if (p2 !== null) {\n p.next = p2;\n }\n\n return head.next;\n }\n\n function sort(keys, values, left, right, compare) {\n if (left >= right) return;\n var pivot = keys[left + right >> 1];\n var i = left - 1;\n var j = right + 1;\n\n while (true) {\n do {\n i++;\n } while (compare(keys[i], pivot) < 0);\n\n do {\n j--;\n } while (compare(keys[j], pivot) > 0);\n\n if (i >= j) break;\n var tmp = keys[i];\n keys[i] = keys[j];\n keys[j] = tmp;\n tmp = values[i];\n values[i] = values[j];\n values[j] = tmp;\n }\n\n sort(keys, values, left, j, compare);\n sort(keys, values, j + 1, right, compare);\n }\n\n /**\n * A bounding box has the format:\n *\n * { ll: { x: xmin, y: ymin }, ur: { x: xmax, y: ymax } }\n *\n */\n var isInBbox = function isInBbox(bbox, point) {\n return bbox.ll.x <= point.x && point.x <= bbox.ur.x && bbox.ll.y <= point.y && point.y <= bbox.ur.y;\n };\n /* Returns either null, or a bbox (aka an ordered pair of points)\n * If there is only one point of overlap, a bbox with identical points\n * will be returned */\n\n var getBboxOverlap = function getBboxOverlap(b1, b2) {\n // check if the bboxes overlap at all\n if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y) return null; // find the middle two X values\n\n var lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;\n var upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x; // find the middle two Y values\n\n var lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;\n var upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y; // put those middle values together to get the overlap\n\n return {\n ll: {\n x: lowerX,\n y: lowerY\n },\n ur: {\n x: upperX,\n y: upperY\n }\n };\n };\n\n /* Javascript doesn't do integer math. Everything is\n * floating point with percision Number.EPSILON.\n *\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON\n */\n var epsilon = Number.EPSILON; // IE Polyfill\n\n if (epsilon === undefined) epsilon = Math.pow(2, -52);\n var EPSILON_SQ = epsilon * epsilon;\n /* FLP comparator */\n\n var cmp = function cmp(a, b) {\n // check if they're both 0\n if (-epsilon < a && a < epsilon) {\n if (-epsilon < b && b < epsilon) {\n return 0;\n }\n } // check if they're flp equal\n\n\n var ab = a - b;\n\n if (ab * ab < EPSILON_SQ * a * b) {\n return 0;\n } // normal comparison\n\n\n return a < b ? -1 : 1;\n };\n\n /**\n * This class rounds incoming values sufficiently so that\n * floating points problems are, for the most part, avoided.\n *\n * Incoming points are have their x & y values tested against\n * all previously seen x & y values. If either is 'too close'\n * to a previously seen value, it's value is 'snapped' to the\n * previously seen value.\n *\n * All points should be rounded by this class before being\n * stored in any data structures in the rest of this algorithm.\n */\n\n var PtRounder = /*#__PURE__*/function () {\n function PtRounder() {\n _classCallCheck(this, PtRounder);\n\n this.reset();\n }\n\n _createClass(PtRounder, [{\n key: \"reset\",\n value: function reset() {\n this.xRounder = new CoordRounder();\n this.yRounder = new CoordRounder();\n }\n }, {\n key: \"round\",\n value: function round(x, y) {\n return {\n x: this.xRounder.round(x),\n y: this.yRounder.round(y)\n };\n }\n }]);\n\n return PtRounder;\n }();\n\n var CoordRounder = /*#__PURE__*/function () {\n function CoordRounder() {\n _classCallCheck(this, CoordRounder);\n\n this.tree = new Tree(); // preseed with 0 so we don't end up with values < Number.EPSILON\n\n this.round(0);\n } // Note: this can rounds input values backwards or forwards.\n // You might ask, why not restrict this to just rounding\n // forwards? Wouldn't that allow left endpoints to always\n // remain left endpoints during splitting (never change to\n // right). No - it wouldn't, because we snap intersections\n // to endpoints (to establish independence from the segment\n // angle for t-intersections).\n\n\n _createClass(CoordRounder, [{\n key: \"round\",\n value: function round(coord) {\n var node = this.tree.add(coord);\n var prevNode = this.tree.prev(node);\n\n if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {\n this.tree.remove(coord);\n return prevNode.key;\n }\n\n var nextNode = this.tree.next(node);\n\n if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {\n this.tree.remove(coord);\n return nextNode.key;\n }\n\n return coord;\n }\n }]);\n\n return CoordRounder;\n }(); // singleton available by import\n\n\n var rounder = new PtRounder();\n\n /* Cross Product of two vectors with first point at origin */\n\n var crossProduct = function crossProduct(a, b) {\n return a.x * b.y - a.y * b.x;\n };\n /* Dot Product of two vectors with first point at origin */\n\n var dotProduct = function dotProduct(a, b) {\n return a.x * b.x + a.y * b.y;\n };\n /* Comparator for two vectors with same starting point */\n\n var compareVectorAngles = function compareVectorAngles(basePt, endPt1, endPt2) {\n var v1 = {\n x: endPt1.x - basePt.x,\n y: endPt1.y - basePt.y\n };\n var v2 = {\n x: endPt2.x - basePt.x,\n y: endPt2.y - basePt.y\n };\n var kross = crossProduct(v1, v2);\n return cmp(kross, 0);\n };\n var length = function length(v) {\n return Math.sqrt(dotProduct(v, v));\n };\n /* Get the sine of the angle from pShared -> pAngle to pShaed -> pBase */\n\n var sineOfAngle = function sineOfAngle(pShared, pBase, pAngle) {\n var vBase = {\n x: pBase.x - pShared.x,\n y: pBase.y - pShared.y\n };\n var vAngle = {\n x: pAngle.x - pShared.x,\n y: pAngle.y - pShared.y\n };\n return crossProduct(vAngle, vBase) / length(vAngle) / length(vBase);\n };\n /* Get the cosine of the angle from pShared -> pAngle to pShaed -> pBase */\n\n var cosineOfAngle = function cosineOfAngle(pShared, pBase, pAngle) {\n var vBase = {\n x: pBase.x - pShared.x,\n y: pBase.y - pShared.y\n };\n var vAngle = {\n x: pAngle.x - pShared.x,\n y: pAngle.y - pShared.y\n };\n return dotProduct(vAngle, vBase) / length(vAngle) / length(vBase);\n };\n /* Get the x coordinate where the given line (defined by a point and vector)\n * crosses the horizontal line with the given y coordiante.\n * In the case of parrallel lines (including overlapping ones) returns null. */\n\n var horizontalIntersection = function horizontalIntersection(pt, v, y) {\n if (v.y === 0) return null;\n return {\n x: pt.x + v.x / v.y * (y - pt.y),\n y: y\n };\n };\n /* Get the y coordinate where the given line (defined by a point and vector)\n * crosses the vertical line with the given x coordiante.\n * In the case of parrallel lines (including overlapping ones) returns null. */\n\n var verticalIntersection = function verticalIntersection(pt, v, x) {\n if (v.x === 0) return null;\n return {\n x: x,\n y: pt.y + v.y / v.x * (x - pt.x)\n };\n };\n /* Get the intersection of two lines, each defined by a base point and a vector.\n * In the case of parrallel lines (including overlapping ones) returns null. */\n\n var intersection = function intersection(pt1, v1, pt2, v2) {\n // take some shortcuts for vertical and horizontal lines\n // this also ensures we don't calculate an intersection and then discover\n // it's actually outside the bounding box of the line\n if (v1.x === 0) return verticalIntersection(pt2, v2, pt1.x);\n if (v2.x === 0) return verticalIntersection(pt1, v1, pt2.x);\n if (v1.y === 0) return horizontalIntersection(pt2, v2, pt1.y);\n if (v2.y === 0) return horizontalIntersection(pt1, v1, pt2.y); // General case for non-overlapping segments.\n // This algorithm is based on Schneider and Eberly.\n // http://www.cimec.org.ar/~ncalvo/Schneider_Eberly.pdf - pg 244\n\n var kross = crossProduct(v1, v2);\n if (kross == 0) return null;\n var ve = {\n x: pt2.x - pt1.x,\n y: pt2.y - pt1.y\n };\n var d1 = crossProduct(ve, v1) / kross;\n var d2 = crossProduct(ve, v2) / kross; // take the average of the two calculations to minimize rounding error\n\n var x1 = pt1.x + d2 * v1.x,\n x2 = pt2.x + d1 * v2.x;\n var y1 = pt1.y + d2 * v1.y,\n y2 = pt2.y + d1 * v2.y;\n var x = (x1 + x2) / 2;\n var y = (y1 + y2) / 2;\n return {\n x: x,\n y: y\n };\n };\n\n var SweepEvent = /*#__PURE__*/function () {\n _createClass(SweepEvent, null, [{\n key: \"compare\",\n // for ordering sweep events in the sweep event queue\n value: function compare(a, b) {\n // favor event with a point that the sweep line hits first\n var ptCmp = SweepEvent.comparePoints(a.point, b.point);\n if (ptCmp !== 0) return ptCmp; // the points are the same, so link them if needed\n\n if (a.point !== b.point) a.link(b); // favor right events over left\n\n if (a.isLeft !== b.isLeft) return a.isLeft ? 1 : -1; // we have two matching left or right endpoints\n // ordering of this case is the same as for their segments\n\n return Segment.compare(a.segment, b.segment);\n } // for ordering points in sweep line order\n\n }, {\n key: \"comparePoints\",\n value: function comparePoints(aPt, bPt) {\n if (aPt.x < bPt.x) return -1;\n if (aPt.x > bPt.x) return 1;\n if (aPt.y < bPt.y) return -1;\n if (aPt.y > bPt.y) return 1;\n return 0;\n } // Warning: 'point' input will be modified and re-used (for performance)\n\n }]);\n\n function SweepEvent(point, isLeft) {\n _classCallCheck(this, SweepEvent);\n\n if (point.events === undefined) point.events = [this];else point.events.push(this);\n this.point = point;\n this.isLeft = isLeft; // this.segment, this.otherSE set by factory\n }\n\n _createClass(SweepEvent, [{\n key: \"link\",\n value: function link(other) {\n if (other.point === this.point) {\n throw new Error('Tried to link already linked events');\n }\n\n var otherEvents = other.point.events;\n\n for (var i = 0, iMax = otherEvents.length; i < iMax; i++) {\n var evt = otherEvents[i];\n this.point.events.push(evt);\n evt.point = this.point;\n }\n\n this.checkForConsuming();\n }\n /* Do a pass over our linked events and check to see if any pair\n * of segments match, and should be consumed. */\n\n }, {\n key: \"checkForConsuming\",\n value: function checkForConsuming() {\n // FIXME: The loops in this method run O(n^2) => no good.\n // Maintain little ordered sweep event trees?\n // Can we maintaining an ordering that avoids the need\n // for the re-sorting with getLeftmostComparator in geom-out?\n // Compare each pair of events to see if other events also match\n var numEvents = this.point.events.length;\n\n for (var i = 0; i < numEvents; i++) {\n var evt1 = this.point.events[i];\n if (evt1.segment.consumedBy !== undefined) continue;\n\n for (var j = i + 1; j < numEvents; j++) {\n var evt2 = this.point.events[j];\n if (evt2.consumedBy !== undefined) continue;\n if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;\n evt1.segment.consume(evt2.segment);\n }\n }\n }\n }, {\n key: \"getAvailableLinkedEvents\",\n value: function getAvailableLinkedEvents() {\n // point.events is always of length 2 or greater\n var events = [];\n\n for (var i = 0, iMax = this.point.events.length; i < iMax; i++) {\n var evt = this.point.events[i];\n\n if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {\n events.push(evt);\n }\n }\n\n return events;\n }\n /**\n * Returns a comparator function for sorting linked events that will\n * favor the event that will give us the smallest left-side angle.\n * All ring construction starts as low as possible heading to the right,\n * so by always turning left as sharp as possible we'll get polygons\n * without uncessary loops & holes.\n *\n * The comparator function has a compute cache such that it avoids\n * re-computing already-computed values.\n */\n\n }, {\n key: \"getLeftmostComparator\",\n value: function getLeftmostComparator(baseEvent) {\n var _this = this;\n\n var cache = new Map();\n\n var fillCache = function fillCache(linkedEvent) {\n var nextEvent = linkedEvent.otherSE;\n cache.set(linkedEvent, {\n sine: sineOfAngle(_this.point, baseEvent.point, nextEvent.point),\n cosine: cosineOfAngle(_this.point, baseEvent.point, nextEvent.point)\n });\n };\n\n return function (a, b) {\n if (!cache.has(a)) fillCache(a);\n if (!cache.has(b)) fillCache(b);\n\n var _cache$get = cache.get(a),\n asine = _cache$get.sine,\n acosine = _cache$get.cosine;\n\n var _cache$get2 = cache.get(b),\n bsine = _cache$get2.sine,\n bcosine = _cache$get2.cosine; // both on or above x-axis\n\n\n if (asine >= 0 && bsine >= 0) {\n if (acosine < bcosine) return 1;\n if (acosine > bcosine) return -1;\n return 0;\n } // both below x-axis\n\n\n if (asine < 0 && bsine < 0) {\n if (acosine < bcosine) return -1;\n if (acosine > bcosine) return 1;\n return 0;\n } // one above x-axis, one below\n\n\n if (bsine < asine) return -1;\n if (bsine > asine) return 1;\n return 0;\n };\n }\n }]);\n\n return SweepEvent;\n }();\n\n // segments and sweep events when all else is identical\n\n var segmentId = 0;\n\n var Segment = /*#__PURE__*/function () {\n _createClass(Segment, null, [{\n key: \"compare\",\n\n /* This compare() function is for ordering segments in the sweep\n * line tree, and does so according to the following criteria:\n *\n * Consider the vertical line that lies an infinestimal step to the\n * right of the right-more of the two left endpoints of the input\n * segments. Imagine slowly moving a point up from negative infinity\n * in the increasing y direction. Which of the two segments will that\n * point intersect first? That segment comes 'before' the other one.\n *\n * If neither segment would be intersected by such a line, (if one\n * or more of the segments are vertical) then the line to be considered\n * is directly on the right-more of the two left inputs.\n */\n value: function compare(a, b) {\n var alx = a.leftSE.point.x;\n var blx = b.leftSE.point.x;\n var arx = a.rightSE.point.x;\n var brx = b.rightSE.point.x; // check if they're even in the same vertical plane\n\n if (brx < alx) return 1;\n if (arx < blx) return -1;\n var aly = a.leftSE.point.y;\n var bly = b.leftSE.point.y;\n var ary = a.rightSE.point.y;\n var bry = b.rightSE.point.y; // is left endpoint of segment B the right-more?\n\n if (alx < blx) {\n // are the two segments in the same horizontal plane?\n if (bly < aly && bly < ary) return 1;\n if (bly > aly && bly > ary) return -1; // is the B left endpoint colinear to segment A?\n\n var aCmpBLeft = a.comparePoint(b.leftSE.point);\n if (aCmpBLeft < 0) return 1;\n if (aCmpBLeft > 0) return -1; // is the A right endpoint colinear to segment B ?\n\n var bCmpARight = b.comparePoint(a.rightSE.point);\n if (bCmpARight !== 0) return bCmpARight; // colinear segments, consider the one with left-more\n // left endpoint to be first (arbitrary?)\n\n return -1;\n } // is left endpoint of segment A the right-more?\n\n\n if (alx > blx) {\n if (aly < bly && aly < bry) return -1;\n if (aly > bly && aly > bry) return 1; // is the A left endpoint colinear to segment B?\n\n var bCmpALeft = b.comparePoint(a.leftSE.point);\n if (bCmpALeft !== 0) return bCmpALeft; // is the B right endpoint colinear to segment A?\n\n var aCmpBRight = a.comparePoint(b.rightSE.point);\n if (aCmpBRight < 0) return 1;\n if (aCmpBRight > 0) return -1; // colinear segments, consider the one with left-more\n // left endpoint to be first (arbitrary?)\n\n return 1;\n } // if we get here, the two left endpoints are in the same\n // vertical plane, ie alx === blx\n // consider the lower left-endpoint to come first\n\n\n if (aly < bly) return -1;\n if (aly > bly) return 1; // left endpoints are identical\n // check for colinearity by using the left-more right endpoint\n // is the A right endpoint more left-more?\n\n if (arx < brx) {\n var _bCmpARight = b.comparePoint(a.rightSE.point);\n\n if (_bCmpARight !== 0) return _bCmpARight;\n } // is the B right endpoint more left-more?\n\n\n if (arx > brx) {\n var _aCmpBRight = a.comparePoint(b.rightSE.point);\n\n if (_aCmpBRight < 0) return 1;\n if (_aCmpBRight > 0) return -1;\n }\n\n if (arx !== brx) {\n // are these two [almost] vertical segments with opposite orientation?\n // if so, the one with the lower right endpoint comes first\n var ay = ary - aly;\n var ax = arx - alx;\n var by = bry - bly;\n var bx = brx - blx;\n if (ay > ax && by < bx) return 1;\n if (ay < ax && by > bx) return -1;\n } // we have colinear segments with matching orientation\n // consider the one with more left-more right endpoint to be first\n\n\n if (arx > brx) return 1;\n if (arx < brx) return -1; // if we get here, two two right endpoints are in the same\n // vertical plane, ie arx === brx\n // consider the lower right-endpoint to come first\n\n if (ary < bry) return -1;\n if (ary > bry) return 1; // right endpoints identical as well, so the segments are idential\n // fall back on creation order as consistent tie-breaker\n\n if (a.id < b.id) return -1;\n if (a.id > b.id) return 1; // identical segment, ie a === b\n\n return 0;\n }\n /* Warning: a reference to ringWindings input will be stored,\n * and possibly will be later modified */\n\n }]);\n\n function Segment(leftSE, rightSE, rings, windings) {\n _classCallCheck(this, Segment);\n\n this.id = ++segmentId;\n this.leftSE = leftSE;\n leftSE.segment = this;\n leftSE.otherSE = rightSE;\n this.rightSE = rightSE;\n rightSE.segment = this;\n rightSE.otherSE = leftSE;\n this.rings = rings;\n this.windings = windings; // left unset for performance, set later in algorithm\n // this.ringOut, this.consumedBy, this.prev\n }\n\n _createClass(Segment, [{\n key: \"replaceRightSE\",\n\n /* When a segment is split, the rightSE is replaced with a new sweep event */\n value: function replaceRightSE(newRightSE) {\n this.rightSE = newRightSE;\n this.rightSE.segment = this;\n this.rightSE.otherSE = this.leftSE;\n this.leftSE.otherSE = this.rightSE;\n }\n }, {\n key: \"bbox\",\n value: function bbox() {\n var y1 = this.leftSE.point.y;\n var y2 = this.rightSE.point.y;\n return {\n ll: {\n x: this.leftSE.point.x,\n y: y1 < y2 ? y1 : y2\n },\n ur: {\n x: this.rightSE.point.x,\n y: y1 > y2 ? y1 : y2\n }\n };\n }\n /* A vector from the left point to the right */\n\n }, {\n key: \"vector\",\n value: function vector() {\n return {\n x: this.rightSE.point.x - this.leftSE.point.x,\n y: this.rightSE.point.y - this.leftSE.point.y\n };\n }\n }, {\n key: \"isAnEndpoint\",\n value: function isAnEndpoint(pt) {\n return pt.x === this.leftSE.point.x && pt.y === this.leftSE.point.y || pt.x === this.rightSE.point.x && pt.y === this.rightSE.point.y;\n }\n /* Compare this segment with a point.\n *\n * A point P is considered to be colinear to a segment if there\n * exists a distance D such that if we travel along the segment\n * from one * endpoint towards the other a distance D, we find\n * ourselves at point P.\n *\n * Return value indicates:\n *\n * 1: point lies above the segment (to the left of vertical)\n * 0: point is colinear to segment\n * -1: point lies below the segment (to the right of vertical)\n */\n\n }, {\n key: \"comparePoint\",\n value: function comparePoint(point) {\n if (this.isAnEndpoint(point)) return 0;\n var lPt = this.leftSE.point;\n var rPt = this.rightSE.point;\n var v = this.vector(); // Exactly vertical segments.\n\n if (lPt.x === rPt.x) {\n if (point.x === lPt.x) return 0;\n return point.x < lPt.x ? 1 : -1;\n } // Nearly vertical segments with an intersection.\n // Check to see where a point on the line with matching Y coordinate is.\n\n\n var yDist = (point.y - lPt.y) / v.y;\n var xFromYDist = lPt.x + yDist * v.x;\n if (point.x === xFromYDist) return 0; // General case.\n // Check to see where a point on the line with matching X coordinate is.\n\n var xDist = (point.x - lPt.x) / v.x;\n var yFromXDist = lPt.y + xDist * v.y;\n if (point.y === yFromXDist) return 0;\n return point.y < yFromXDist ? -1 : 1;\n }\n /**\n * Given another segment, returns the first non-trivial intersection\n * between the two segments (in terms of sweep line ordering), if it exists.\n *\n * A 'non-trivial' intersection is one that will cause one or both of the\n * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:\n *\n * * endpoint of segA with endpoint of segB --> trivial\n * * endpoint of segA with point along segB --> non-trivial\n * * endpoint of segB with point along segA --> non-trivial\n * * point along segA with point along segB --> non-trivial\n *\n * If no non-trivial intersection exists, return null\n * Else, return null.\n */\n\n }, {\n key: \"getIntersection\",\n value: function getIntersection(other) {\n // If bboxes don't overlap, there can't be any intersections\n var tBbox = this.bbox();\n var oBbox = other.bbox();\n var bboxOverlap = getBboxOverlap(tBbox, oBbox);\n if (bboxOverlap === null) return null; // We first check to see if the endpoints can be considered intersections.\n // This will 'snap' intersections to endpoints if possible, and will\n // handle cases of colinearity.\n\n var tlp = this.leftSE.point;\n var trp = this.rightSE.point;\n var olp = other.leftSE.point;\n var orp = other.rightSE.point; // does each endpoint touch the other segment?\n // note that we restrict the 'touching' definition to only allow segments\n // to touch endpoints that lie forward from where we are in the sweep line pass\n\n var touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;\n var touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;\n var touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;\n var touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0; // do left endpoints match?\n\n if (touchesThisLSE && touchesOtherLSE) {\n // these two cases are for colinear segments with matching left\n // endpoints, and one segment being longer than the other\n if (touchesThisRSE && !touchesOtherRSE) return trp;\n if (!touchesThisRSE && touchesOtherRSE) return orp; // either the two segments match exactly (two trival intersections)\n // or just on their left endpoint (one trivial intersection\n\n return null;\n } // does this left endpoint matches (other doesn't)\n\n\n if (touchesThisLSE) {\n // check for segments that just intersect on opposing endpoints\n if (touchesOtherRSE) {\n if (tlp.x === orp.x && tlp.y === orp.y) return null;\n } // t-intersection on left endpoint\n\n\n return tlp;\n } // does other left endpoint matches (this doesn't)\n\n\n if (touchesOtherLSE) {\n // check for segments that just intersect on opposing endpoints\n if (touchesThisRSE) {\n if (trp.x === olp.x && trp.y === olp.y) return null;\n } // t-intersection on left endpoint\n\n\n return olp;\n } // trivial intersection on right endpoints\n\n\n if (touchesThisRSE && touchesOtherRSE) return null; // t-intersections on just one right endpoint\n\n if (touchesThisRSE) return trp;\n if (touchesOtherRSE) return orp; // None of our endpoints intersect. Look for a general intersection between\n // infinite lines laid over the segments\n\n var pt = intersection(tlp, this.vector(), olp, other.vector()); // are the segments parrallel? Note that if they were colinear with overlap,\n // they would have an endpoint intersection and that case was already handled above\n\n if (pt === null) return null; // is the intersection found between the lines not on the segments?\n\n if (!isInBbox(bboxOverlap, pt)) return null; // round the the computed point if needed\n\n return rounder.round(pt.x, pt.y);\n }\n /**\n * Split the given segment into multiple segments on the given points.\n * * Each existing segment will retain its leftSE and a new rightSE will be\n * generated for it.\n * * A new segment will be generated which will adopt the original segment's\n * rightSE, and a new leftSE will be generated for it.\n * * If there are more than two points given to split on, new segments\n * in the middle will be generated with new leftSE and rightSE's.\n * * An array of the newly generated SweepEvents will be returned.\n *\n * Warning: input array of points is modified\n */\n\n }, {\n key: \"split\",\n value: function split(point) {\n var newEvents = [];\n var alreadyLinked = point.events !== undefined;\n var newLeftSE = new SweepEvent(point, true);\n var newRightSE = new SweepEvent(point, false);\n var oldRightSE = this.rightSE;\n this.replaceRightSE(newRightSE);\n newEvents.push(newRightSE);\n newEvents.push(newLeftSE);\n var newSeg = new Segment(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice()); // when splitting a nearly vertical downward-facing segment,\n // sometimes one of the resulting new segments is vertical, in which\n // case its left and right events may need to be swapped\n\n if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {\n newSeg.swapEvents();\n }\n\n if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {\n this.swapEvents();\n } // in the point we just used to create new sweep events with was already\n // linked to other events, we need to check if either of the affected\n // segments should be consumed\n\n\n if (alreadyLinked) {\n newLeftSE.checkForConsuming();\n newRightSE.checkForConsuming();\n }\n\n return newEvents;\n }\n /* Swap which event is left and right */\n\n }, {\n key: \"swapEvents\",\n value: function swapEvents() {\n var tmpEvt = this.rightSE;\n this.rightSE = this.leftSE;\n this.leftSE = tmpEvt;\n this.leftSE.isLeft = true;\n this.rightSE.isLeft = false;\n\n for (var i = 0, iMax = this.windings.length; i < iMax; i++) {\n this.windings[i] *= -1;\n }\n }\n /* Consume another segment. We take their rings under our wing\n * and mark them as consumed. Use for perfectly overlapping segments */\n\n }, {\n key: \"consume\",\n value: function consume(other) {\n var consumer = this;\n var consumee = other;\n\n while (consumer.consumedBy) {\n consumer = consumer.consumedBy;\n }\n\n while (consumee.consumedBy) {\n consumee = consumee.consumedBy;\n }\n\n var cmp = Segment.compare(consumer, consumee);\n if (cmp === 0) return; // already consumed\n // the winner of the consumption is the earlier segment\n // according to sweep line ordering\n\n if (cmp > 0) {\n var tmp = consumer;\n consumer = consumee;\n consumee = tmp;\n } // make sure a segment doesn't consume it's prev\n\n\n if (consumer.prev === consumee) {\n var _tmp = consumer;\n consumer = consumee;\n consumee = _tmp;\n }\n\n for (var i = 0, iMax = consumee.rings.length; i < iMax; i++) {\n var ring = consumee.rings[i];\n var winding = consumee.windings[i];\n var index = consumer.rings.indexOf(ring);\n\n if (index === -1) {\n consumer.rings.push(ring);\n consumer.windings.push(winding);\n } else consumer.windings[index] += winding;\n }\n\n consumee.rings = null;\n consumee.windings = null;\n consumee.consumedBy = consumer; // mark sweep events consumed as to maintain ordering in sweep event queue\n\n consumee.leftSE.consumedBy = consumer.leftSE;\n consumee.rightSE.consumedBy = consumer.rightSE;\n }\n /* The first segment previous segment chain that is in the result */\n\n }, {\n key: \"prevInResult\",\n value: function prevInResult() {\n if (this._prevInResult !== undefined) return this._prevInResult;\n if (!this.prev) this._prevInResult = null;else if (this.prev.isInResult()) this._prevInResult = this.prev;else this._prevInResult = this.prev.prevInResult();\n return this._prevInResult;\n }\n }, {\n key: \"beforeState\",\n value: function beforeState() {\n if (this._beforeState !== undefined) return this._beforeState;\n if (!this.prev) this._beforeState = {\n rings: [],\n windings: [],\n multiPolys: []\n };else {\n var seg = this.prev.consumedBy || this.prev;\n this._beforeState = seg.afterState();\n }\n return this._beforeState;\n }\n }, {\n key: \"afterState\",\n value: function afterState() {\n if (this._afterState !== undefined) return this._afterState;\n var beforeState = this.beforeState();\n this._afterState = {\n rings: beforeState.rings.slice(0),\n windings: beforeState.windings.slice(0),\n multiPolys: []\n };\n var ringsAfter = this._afterState.rings;\n var windingsAfter = this._afterState.windings;\n var mpsAfter = this._afterState.multiPolys; // calculate ringsAfter, windingsAfter\n\n for (var i = 0, iMax = this.rings.length; i < iMax; i++) {\n var ring = this.rings[i];\n var winding = this.windings[i];\n var index = ringsAfter.indexOf(ring);\n\n if (index === -1) {\n ringsAfter.push(ring);\n windingsAfter.push(winding);\n } else windingsAfter[index] += winding;\n } // calcualte polysAfter\n\n\n var polysAfter = [];\n var polysExclude = [];\n\n for (var _i = 0, _iMax = ringsAfter.length; _i < _iMax; _i++) {\n if (windingsAfter[_i] === 0) continue; // non-zero rule\n\n var _ring = ringsAfter[_i];\n var poly = _ring.poly;\n if (polysExclude.indexOf(poly) !== -1) continue;\n if (_ring.isExterior) polysAfter.push(poly);else {\n if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);\n\n var _index = polysAfter.indexOf(_ring.poly);\n\n if (_index !== -1) polysAfter.splice(_index, 1);\n }\n } // calculate multiPolysAfter\n\n\n for (var _i2 = 0, _iMax2 = polysAfter.length; _i2 < _iMax2; _i2++) {\n var mp = polysAfter[_i2].multiPoly;\n if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);\n }\n\n return this._afterState;\n }\n /* Is this segment part of the final result? */\n\n }, {\n key: \"isInResult\",\n value: function isInResult() {\n // if we've been consumed, we're not in the result\n if (this.consumedBy) return false;\n if (this._isInResult !== undefined) return this._isInResult;\n var mpsBefore = this.beforeState().multiPolys;\n var mpsAfter = this.afterState().multiPolys;\n\n switch (operation.type) {\n case 'union':\n {\n // UNION - included iff:\n // * On one side of us there is 0 poly interiors AND\n // * On the other side there is 1 or more.\n var noBefores = mpsBefore.length === 0;\n var noAfters = mpsAfter.length === 0;\n this._isInResult = noBefores !== noAfters;\n break;\n }\n\n case 'intersection':\n {\n // INTERSECTION - included iff:\n // * on one side of us all multipolys are rep. with poly interiors AND\n // * on the other side of us, not all multipolys are repsented\n // with poly interiors\n var least;\n var most;\n\n if (mpsBefore.length < mpsAfter.length) {\n least = mpsBefore.length;\n most = mpsAfter.length;\n } else {\n least = mpsAfter.length;\n most = mpsBefore.length;\n }\n\n this._isInResult = most === operation.numMultiPolys && least < most;\n break;\n }\n\n case 'xor':\n {\n // XOR - included iff:\n // * the difference between the number of multipolys represented\n // with poly interiors on our two sides is an odd number\n var diff = Math.abs(mpsBefore.length - mpsAfter.length);\n this._isInResult = diff % 2 === 1;\n break;\n }\n\n case 'difference':\n {\n // DIFFERENCE included iff:\n // * on exactly one side, we have just the subject\n var isJustSubject = function isJustSubject(mps) {\n return mps.length === 1 && mps[0].isSubject;\n };\n\n this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);\n break;\n }\n\n default:\n throw new Error(\"Unrecognized operation type found \".concat(operation.type));\n }\n\n return this._isInResult;\n }\n }], [{\n key: \"fromRing\",\n value: function fromRing(pt1, pt2, ring) {\n var leftPt, rightPt, winding; // ordering the two points according to sweep line ordering\n\n var cmpPts = SweepEvent.comparePoints(pt1, pt2);\n\n if (cmpPts < 0) {\n leftPt = pt1;\n rightPt = pt2;\n winding = 1;\n } else if (cmpPts > 0) {\n leftPt = pt2;\n rightPt = pt1;\n winding = -1;\n } else throw new Error(\"Tried to create degenerate segment at [\".concat(pt1.x, \", \").concat(pt1.y, \"]\"));\n\n var leftSE = new SweepEvent(leftPt, true);\n var rightSE = new SweepEvent(rightPt, false);\n return new Segment(leftSE, rightSE, [ring], [winding]);\n }\n }]);\n\n return Segment;\n }();\n\n var RingIn = /*#__PURE__*/function () {\n function RingIn(geomRing, poly, isExterior) {\n _classCallCheck(this, RingIn);\n\n if (!Array.isArray(geomRing) || geomRing.length === 0) {\n throw new Error('Input geometry is not a valid Polygon or MultiPolygon');\n }\n\n this.poly = poly;\n this.isExterior = isExterior;\n this.segments = [];\n\n if (typeof geomRing[0][0] !== 'number' || typeof geomRing[0][1] !== 'number') {\n throw new Error('Input geometry is not a valid Polygon or MultiPolygon');\n }\n\n var firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);\n this.bbox = {\n ll: {\n x: firstPoint.x,\n y: firstPoint.y\n },\n ur: {\n x: firstPoint.x,\n y: firstPoint.y\n }\n };\n var prevPoint = firstPoint;\n\n for (var i = 1, iMax = geomRing.length; i < iMax; i++) {\n if (typeof geomRing[i][0] !== 'number' || typeof geomRing[i][1] !== 'number') {\n throw new Error('Input geometry is not a valid Polygon or MultiPolygon');\n }\n\n var point = rounder.round(geomRing[i][0], geomRing[i][1]); // skip repeated points\n\n if (point.x === prevPoint.x && point.y === prevPoint.y) continue;\n this.segments.push(Segment.fromRing(prevPoint, point, this));\n if (point.x < this.bbox.ll.x) this.bbox.ll.x = point.x;\n if (point.y < this.bbox.ll.y) this.bbox.ll.y = point.y;\n if (point.x > this.bbox.ur.x) this.bbox.ur.x = point.x;\n if (point.y > this.bbox.ur.y) this.bbox.ur.y = point.y;\n prevPoint = point;\n } // add segment from last to first if last is not the same as first\n\n\n if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {\n this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));\n }\n }\n\n _createClass(RingIn, [{\n key: \"getSweepEvents\",\n value: function getSweepEvents() {\n var sweepEvents = [];\n\n for (var i = 0, iMax = this.segments.length; i < iMax; i++) {\n var segment = this.segments[i];\n sweepEvents.push(segment.leftSE);\n sweepEvents.push(segment.rightSE);\n }\n\n return sweepEvents;\n }\n }]);\n\n return RingIn;\n }();\n var PolyIn = /*#__PURE__*/function () {\n function PolyIn(geomPoly, multiPoly) {\n _classCallCheck(this, PolyIn);\n\n if (!Array.isArray(geomPoly)) {\n throw new Error('Input geometry is not a valid Polygon or MultiPolygon');\n }\n\n this.exteriorRing = new RingIn(geomPoly[0], this, true); // copy by value\n\n this.bbox = {\n ll: {\n x: this.exteriorRing.bbox.ll.x,\n y: this.exteriorRing.bbox.ll.y\n },\n ur: {\n x: this.exteriorRing.bbox.ur.x,\n y: this.exteriorRing.bbox.ur.y\n }\n };\n this.interiorRings = [];\n\n for (var i = 1, iMax = geomPoly.length; i < iMax; i++) {\n var ring = new RingIn(geomPoly[i], this, false);\n if (ring.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = ring.bbox.ll.x;\n if (ring.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = ring.bbox.ll.y;\n if (ring.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = ring.bbox.ur.x;\n if (ring.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = ring.bbox.ur.y;\n this.interiorRings.push(ring);\n }\n\n this.multiPoly = multiPoly;\n }\n\n _createClass(PolyIn, [{\n key: \"getSweepEvents\",\n value: function getSweepEvents() {\n var sweepEvents = this.exteriorRing.getSweepEvents();\n\n for (var i = 0, iMax = this.interiorRings.length; i < iMax; i++) {\n var ringSweepEvents = this.interiorRings[i].getSweepEvents();\n\n for (var j = 0, jMax = ringSweepEvents.length; j < jMax; j++) {\n sweepEvents.push(ringSweepEvents[j]);\n }\n }\n\n return sweepEvents;\n }\n }]);\n\n return PolyIn;\n }();\n var MultiPolyIn = /*#__PURE__*/function () {\n function MultiPolyIn(geom, isSubject) {\n _classCallCheck(this, MultiPolyIn);\n\n if (!Array.isArray(geom)) {\n throw new Error('Input geometry is not a valid Polygon or MultiPolygon');\n }\n\n try {\n // if the input looks like a polygon, convert it to a multipolygon\n if (typeof geom[0][0][0] === 'number') geom = [geom];\n } catch (ex) {// The input is either malformed or has empty arrays.\n // In either case, it will be handled later on.\n }\n\n this.polys = [];\n this.bbox = {\n ll: {\n x: Number.POSITIVE_INFINITY,\n y: Number.POSITIVE_INFINITY\n },\n ur: {\n x: Number.NEGATIVE_INFINITY,\n y: Number.NEGATIVE_INFINITY\n }\n };\n\n for (var i = 0, iMax = geom.length; i < iMax; i++) {\n var poly = new PolyIn(geom[i], this);\n if (poly.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = poly.bbox.ll.x;\n if (poly.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = poly.bbox.ll.y;\n if (poly.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = poly.bbox.ur.x;\n if (poly.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = poly.bbox.ur.y;\n this.polys.push(poly);\n }\n\n this.isSubject = isSubject;\n }\n\n _createClass(MultiPolyIn, [{\n key: \"getSweepEvents\",\n value: function getSweepEvents() {\n var sweepEvents = [];\n\n for (var i = 0, iMax = this.polys.length; i < iMax; i++) {\n var polySweepEvents = this.polys[i].getSweepEvents();\n\n for (var j = 0, jMax = polySweepEvents.length; j < jMax; j++) {\n sweepEvents.push(polySweepEvents[j]);\n }\n }\n\n return sweepEvents;\n }\n }]);\n\n return MultiPolyIn;\n }();\n\n var RingOut = /*#__PURE__*/function () {\n _createClass(RingOut, null, [{\n key: \"factory\",\n\n /* Given the segments from the sweep line pass, compute & return a series\n * of closed rings from all the segments marked to be part of the result */\n value: function factory(allSegments) {\n var ringsOut = [];\n\n for (var i = 0, iMax = allSegments.length; i < iMax; i++) {\n var segment = allSegments[i];\n if (!segment.isInResult() || segment.ringOut) continue;\n var prevEvent = null;\n var event = segment.leftSE;\n var nextEvent = segment.rightSE;\n var events = [event];\n var startingPoint = event.point;\n var intersectionLEs = [];\n /* Walk the chain of linked events to form a closed ring */\n\n while (true) {\n prevEvent = event;\n event = nextEvent;\n events.push(event);\n /* Is the ring complete? */\n\n if (event.point === startingPoint) break;\n\n while (true) {\n var availableLEs = event.getAvailableLinkedEvents();\n /* Did we hit a dead end? This shouldn't happen. Indicates some earlier\n * part of the algorithm malfunctioned... please file a bug report. */\n\n if (availableLEs.length === 0) {\n var firstPt = events[0].point;\n var lastPt = events[events.length - 1].point;\n throw new Error(\"Unable to complete output ring starting at [\".concat(firstPt.x, \",\") + \" \".concat(firstPt.y, \"]. Last matching segment found ends at\") + \" [\".concat(lastPt.x, \", \").concat(lastPt.y, \"].\"));\n }\n /* Only one way to go, so cotinue on the path */\n\n\n if (availableLEs.length === 1) {\n nextEvent = availableLEs[0].otherSE;\n break;\n }\n /* We must have an intersection. Check for a completed loop */\n\n\n var indexLE = null;\n\n for (var j = 0, jMax = intersectionLEs.length; j < jMax; j++) {\n if (intersectionLEs[j].point === event.point) {\n indexLE = j;\n break;\n }\n }\n /* Found a completed loop. Cut that off and make a ring */\n\n\n if (indexLE !== null) {\n var intersectionLE = intersectionLEs.splice(indexLE)[0];\n var ringEvents = events.splice(intersectionLE.index);\n ringEvents.unshift(ringEvents[0].otherSE);\n ringsOut.push(new RingOut(ringEvents.reverse()));\n continue;\n }\n /* register the intersection */\n\n\n intersectionLEs.push({\n index: events.length,\n point: event.point\n });\n /* Choose the left-most option to continue the walk */\n\n var comparator = event.getLeftmostComparator(prevEvent);\n nextEvent = availableLEs.sort(comparator)[0].otherSE;\n break;\n }\n }\n\n ringsOut.push(new RingOut(events));\n }\n\n return ringsOut;\n }\n }]);\n\n function RingOut(events) {\n _classCallCheck(this, RingOut);\n\n this.events = events;\n\n for (var i = 0, iMax = events.length; i < iMax; i++) {\n events[i].segment.ringOut = this;\n }\n\n this.poly = null;\n }\n\n _createClass(RingOut, [{\n key: \"getGeom\",\n value: function getGeom() {\n // Remove superfluous points (ie extra points along a straight line),\n var prevPt = this.events[0].point;\n var points = [prevPt];\n\n for (var i = 1, iMax = this.events.length - 1; i < iMax; i++) {\n var _pt = this.events[i].point;\n var _nextPt = this.events[i + 1].point;\n if (compareVectorAngles(_pt, prevPt, _nextPt) === 0) continue;\n points.push(_pt);\n prevPt = _pt;\n } // ring was all (within rounding error of angle calc) colinear points\n\n\n if (points.length === 1) return null; // check if the starting point is necessary\n\n var pt = points[0];\n var nextPt = points[1];\n if (compareVectorAngles(pt, prevPt, nextPt) === 0) points.shift();\n points.push(points[0]);\n var step = this.isExteriorRing() ? 1 : -1;\n var iStart = this.isExteriorRing() ? 0 : points.length - 1;\n var iEnd = this.isExteriorRing() ? points.length : -1;\n var orderedPoints = [];\n\n for (var _i = iStart; _i != iEnd; _i += step) {\n orderedPoints.push([points[_i].x, points[_i].y]);\n }\n\n return orderedPoints;\n }\n }, {\n key: \"isExteriorRing\",\n value: function isExteriorRing() {\n if (this._isExteriorRing === undefined) {\n var enclosing = this.enclosingRing();\n this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;\n }\n\n return this._isExteriorRing;\n }\n }, {\n key: \"enclosingRing\",\n value: function enclosingRing() {\n if (this._enclosingRing === undefined) {\n this._enclosingRing = this._calcEnclosingRing();\n }\n\n return this._enclosingRing;\n }\n /* Returns the ring that encloses this one, if any */\n\n }, {\n key: \"_calcEnclosingRing\",\n value: function _calcEnclosingRing() {\n // start with the ealier sweep line event so that the prevSeg\n // chain doesn't lead us inside of a loop of ours\n var leftMostEvt = this.events[0];\n\n for (var i = 1, iMax = this.events.length; i < iMax; i++) {\n var evt = this.events[i];\n if (SweepEvent.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;\n }\n\n var prevSeg = leftMostEvt.segment.prevInResult();\n var prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;\n\n while (true) {\n // no segment found, thus no ring can enclose us\n if (!prevSeg) return null; // no segments below prev segment found, thus the ring of the prev\n // segment must loop back around and enclose us\n\n if (!prevPrevSeg) return prevSeg.ringOut; // if the two segments are of different rings, the ring of the prev\n // segment must either loop around us or the ring of the prev prev\n // seg, which would make us and the ring of the prev peers\n\n if (prevPrevSeg.ringOut !== prevSeg.ringOut) {\n if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {\n return prevSeg.ringOut;\n } else return prevSeg.ringOut.enclosingRing();\n } // two segments are from the same ring, so this was a penisula\n // of that ring. iterate downward, keep searching\n\n\n prevSeg = prevPrevSeg.prevInResult();\n prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;\n }\n }\n }]);\n\n return RingOut;\n }();\n var PolyOut = /*#__PURE__*/function () {\n function PolyOut(exteriorRing) {\n _classCallCheck(this, PolyOut);\n\n this.exteriorRing = exteriorRing;\n exteriorRing.poly = this;\n this.interiorRings = [];\n }\n\n _createClass(PolyOut, [{\n key: \"addInterior\",\n value: function addInterior(ring) {\n this.interiorRings.push(ring);\n ring.poly = this;\n }\n }, {\n key: \"getGeom\",\n value: function getGeom() {\n var geom = [this.exteriorRing.getGeom()]; // exterior ring was all (within rounding error of angle calc) colinear points\n\n if (geom[0] === null) return null;\n\n for (var i = 0, iMax = this.interiorRings.length; i < iMax; i++) {\n var ringGeom = this.interiorRings[i].getGeom(); // interior ring was all (within rounding error of angle calc) colinear points\n\n if (ringGeom === null) continue;\n geom.push(ringGeom);\n }\n\n return geom;\n }\n }]);\n\n return PolyOut;\n }();\n var MultiPolyOut = /*#__PURE__*/function () {\n function MultiPolyOut(rings) {\n _classCallCheck(this, MultiPolyOut);\n\n this.rings = rings;\n this.polys = this._composePolys(rings);\n }\n\n _createClass(MultiPolyOut, [{\n key: \"getGeom\",\n value: function getGeom() {\n var geom = [];\n\n for (var i = 0, iMax = this.polys.length; i < iMax; i++) {\n var polyGeom = this.polys[i].getGeom(); // exterior ring was all (within rounding error of angle calc) colinear points\n\n if (polyGeom === null) continue;\n geom.push(polyGeom);\n }\n\n return geom;\n }\n }, {\n key: \"_composePolys\",\n value: function _composePolys(rings) {\n var polys = [];\n\n for (var i = 0, iMax = rings.length; i < iMax; i++) {\n var ring = rings[i];\n if (ring.poly) continue;\n if (ring.isExteriorRing()) polys.push(new PolyOut(ring));else {\n var enclosingRing = ring.enclosingRing();\n if (!enclosingRing.poly) polys.push(new PolyOut(enclosingRing));\n enclosingRing.poly.addInterior(ring);\n }\n }\n\n return polys;\n }\n }]);\n\n return MultiPolyOut;\n }();\n\n /**\n * NOTE: We must be careful not to change any segments while\n * they are in the SplayTree. AFAIK, there's no way to tell\n * the tree to rebalance itself - thus before splitting\n * a segment that's in the tree, we remove it from the tree,\n * do the split, then re-insert it. (Even though splitting a\n * segment *shouldn't* change its correct position in the\n * sweep line tree, the reality is because of rounding errors,\n * it sometimes does.)\n */\n\n var SweepLine = /*#__PURE__*/function () {\n function SweepLine(queue) {\n var comparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Segment.compare;\n\n _classCallCheck(this, SweepLine);\n\n this.queue = queue;\n this.tree = new Tree(comparator);\n this.segments = [];\n }\n\n _createClass(SweepLine, [{\n key: \"process\",\n value: function process(event) {\n var segment = event.segment;\n var newEvents = []; // if we've already been consumed by another segment,\n // clean up our body parts and get out\n\n if (event.consumedBy) {\n if (event.isLeft) this.queue.remove(event.otherSE);else this.tree.remove(segment);\n return newEvents;\n }\n\n var node = event.isLeft ? this.tree.insert(segment) : this.tree.find(segment);\n if (!node) throw new Error(\"Unable to find segment #\".concat(segment.id, \" \") + \"[\".concat(segment.leftSE.point.x, \", \").concat(segment.leftSE.point.y, \"] -> \") + \"[\".concat(segment.rightSE.point.x, \", \").concat(segment.rightSE.point.y, \"] \") + 'in SweepLine tree. Please submit a bug report.');\n var prevNode = node;\n var nextNode = node;\n var prevSeg = undefined;\n var nextSeg = undefined; // skip consumed segments still in tree\n\n while (prevSeg === undefined) {\n prevNode = this.tree.prev(prevNode);\n if (prevNode === null) prevSeg = null;else if (prevNode.key.consumedBy === undefined) prevSeg = prevNode.key;\n } // skip consumed segments still in tree\n\n\n while (nextSeg === undefined) {\n nextNode = this.tree.next(nextNode);\n if (nextNode === null) nextSeg = null;else if (nextNode.key.consumedBy === undefined) nextSeg = nextNode.key;\n }\n\n if (event.isLeft) {\n // Check for intersections against the previous segment in the sweep line\n var prevMySplitter = null;\n\n if (prevSeg) {\n var prevInter = prevSeg.getIntersection(segment);\n\n if (prevInter !== null) {\n if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;\n\n if (!prevSeg.isAnEndpoint(prevInter)) {\n var newEventsFromSplit = this._splitSafely(prevSeg, prevInter);\n\n for (var i = 0, iMax = newEventsFromSplit.length; i < iMax; i++) {\n newEvents.push(newEventsFromSplit[i]);\n }\n }\n }\n } // Check for intersections against the next segment in the sweep line\n\n\n var nextMySplitter = null;\n\n if (nextSeg) {\n var nextInter = nextSeg.getIntersection(segment);\n\n if (nextInter !== null) {\n if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;\n\n if (!nextSeg.isAnEndpoint(nextInter)) {\n var _newEventsFromSplit = this._splitSafely(nextSeg, nextInter);\n\n for (var _i = 0, _iMax = _newEventsFromSplit.length; _i < _iMax; _i++) {\n newEvents.push(_newEventsFromSplit[_i]);\n }\n }\n }\n } // For simplicity, even if we find more than one intersection we only\n // spilt on the 'earliest' (sweep-line style) of the intersections.\n // The other intersection will be handled in a future process().\n\n\n if (prevMySplitter !== null || nextMySplitter !== null) {\n var mySplitter = null;\n if (prevMySplitter === null) mySplitter = nextMySplitter;else if (nextMySplitter === null) mySplitter = prevMySplitter;else {\n var cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);\n mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;\n } // Rounding errors can cause changes in ordering,\n // so remove afected segments and right sweep events before splitting\n\n this.queue.remove(segment.rightSE);\n newEvents.push(segment.rightSE);\n\n var _newEventsFromSplit2 = segment.split(mySplitter);\n\n for (var _i2 = 0, _iMax2 = _newEventsFromSplit2.length; _i2 < _iMax2; _i2++) {\n newEvents.push(_newEventsFromSplit2[_i2]);\n }\n }\n\n if (newEvents.length > 0) {\n // We found some intersections, so re-do the current event to\n // make sure sweep line ordering is totally consistent for later\n // use with the segment 'prev' pointers\n this.tree.remove(segment);\n newEvents.push(event);\n } else {\n // done with left event\n this.segments.push(segment);\n segment.prev = prevSeg;\n }\n } else {\n // event.isRight\n // since we're about to be removed from the sweep line, check for\n // intersections between our previous and next segments\n if (prevSeg && nextSeg) {\n var inter = prevSeg.getIntersection(nextSeg);\n\n if (inter !== null) {\n if (!prevSeg.isAnEndpoint(inter)) {\n var _newEventsFromSplit3 = this._splitSafely(prevSeg, inter);\n\n for (var _i3 = 0, _iMax3 = _newEventsFromSplit3.length; _i3 < _iMax3; _i3++) {\n newEvents.push(_newEventsFromSplit3[_i3]);\n }\n }\n\n if (!nextSeg.isAnEndpoint(inter)) {\n var _newEventsFromSplit4 = this._splitSafely(nextSeg, inter);\n\n for (var _i4 = 0, _iMax4 = _newEventsFromSplit4.length; _i4 < _iMax4; _i4++) {\n newEvents.push(_newEventsFromSplit4[_i4]);\n }\n }\n }\n }\n\n this.tree.remove(segment);\n }\n\n return newEvents;\n }\n /* Safely split a segment that is currently in the datastructures\n * IE - a segment other than the one that is currently being processed. */\n\n }, {\n key: \"_splitSafely\",\n value: function _splitSafely(seg, pt) {\n // Rounding errors can cause changes in ordering,\n // so remove afected segments and right sweep events before splitting\n // removeNode() doesn't work, so have re-find the seg\n // https://github.com/w8r/splay-tree/pull/5\n this.tree.remove(seg);\n var rightSE = seg.rightSE;\n this.queue.remove(rightSE);\n var newEvents = seg.split(pt);\n newEvents.push(rightSE); // splitting can trigger consumption\n\n if (seg.consumedBy === undefined) this.tree.insert(seg);\n return newEvents;\n }\n }]);\n\n return SweepLine;\n }();\n\n var POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== 'undefined' && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1000000;\n var POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== 'undefined' && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1000000;\n var Operation = /*#__PURE__*/function () {\n function Operation() {\n _classCallCheck(this, Operation);\n }\n\n _createClass(Operation, [{\n key: \"run\",\n value: function run(type, geom, moreGeoms) {\n operation.type = type;\n rounder.reset();\n /* Convert inputs to MultiPoly objects */\n\n var multipolys = [new MultiPolyIn(geom, true)];\n\n for (var i = 0, iMax = moreGeoms.length; i < iMax; i++) {\n multipolys.push(new MultiPolyIn(moreGeoms[i], false));\n }\n\n operation.numMultiPolys = multipolys.length;\n /* BBox optimization for difference operation\n * If the bbox of a multipolygon that's part of the clipping doesn't\n * intersect the bbox of the subject at all, we can just drop that\n * multiploygon. */\n\n if (operation.type === 'difference') {\n // in place removal\n var subject = multipolys[0];\n var _i = 1;\n\n while (_i < multipolys.length) {\n if (getBboxOverlap(multipolys[_i].bbox, subject.bbox) !== null) _i++;else multipolys.splice(_i, 1);\n }\n }\n /* BBox optimization for intersection operation\n * If we can find any pair of multipolygons whose bbox does not overlap,\n * then the result will be empty. */\n\n\n if (operation.type === 'intersection') {\n // TODO: this is O(n^2) in number of polygons. By sorting the bboxes,\n // it could be optimized to O(n * ln(n))\n for (var _i2 = 0, _iMax = multipolys.length; _i2 < _iMax; _i2++) {\n var mpA = multipolys[_i2];\n\n for (var j = _i2 + 1, jMax = multipolys.length; j < jMax; j++) {\n if (getBboxOverlap(mpA.bbox, multipolys[j].bbox) === null) return [];\n }\n }\n }\n /* Put segment endpoints in a priority queue */\n\n\n var queue = new Tree(SweepEvent.compare);\n\n for (var _i3 = 0, _iMax2 = multipolys.length; _i3 < _iMax2; _i3++) {\n var sweepEvents = multipolys[_i3].getSweepEvents();\n\n for (var _j = 0, _jMax = sweepEvents.length; _j < _jMax; _j++) {\n queue.insert(sweepEvents[_j]);\n\n if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {\n // prevents an infinite loop, an otherwise common manifestation of bugs\n throw new Error('Infinite loop when putting segment endpoints in a priority queue ' + '(queue size too big). Please file a bug report.');\n }\n }\n }\n /* Pass the sweep line over those endpoints */\n\n\n var sweepLine = new SweepLine(queue);\n var prevQueueSize = queue.size;\n var node = queue.pop();\n\n while (node) {\n var evt = node.key;\n\n if (queue.size === prevQueueSize) {\n // prevents an infinite loop, an otherwise common manifestation of bugs\n var seg = evt.segment;\n throw new Error(\"Unable to pop() \".concat(evt.isLeft ? 'left' : 'right', \" SweepEvent \") + \"[\".concat(evt.point.x, \", \").concat(evt.point.y, \"] from segment #\").concat(seg.id, \" \") + \"[\".concat(seg.leftSE.point.x, \", \").concat(seg.leftSE.point.y, \"] -> \") + \"[\".concat(seg.rightSE.point.x, \", \").concat(seg.rightSE.point.y, \"] from queue. \") + 'Please file a bug report.');\n }\n\n if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {\n // prevents an infinite loop, an otherwise common manifestation of bugs\n throw new Error('Infinite loop when passing sweep line over endpoints ' + '(queue size too big). Please file a bug report.');\n }\n\n if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {\n // prevents an infinite loop, an otherwise common manifestation of bugs\n throw new Error('Infinite loop when passing sweep line over endpoints ' + '(too many sweep line segments). Please file a bug report.');\n }\n\n var newEvents = sweepLine.process(evt);\n\n for (var _i4 = 0, _iMax3 = newEvents.length; _i4 < _iMax3; _i4++) {\n var _evt = newEvents[_i4];\n if (_evt.consumedBy === undefined) queue.insert(_evt);\n }\n\n prevQueueSize = queue.size;\n node = queue.pop();\n } // free some memory we don't need anymore\n\n\n rounder.reset();\n /* Collect and compile segments we're keeping into a multipolygon */\n\n var ringsOut = RingOut.factory(sweepLine.segments);\n var result = new MultiPolyOut(ringsOut);\n return result.getGeom();\n }\n }]);\n\n return Operation;\n }(); // singleton available by import\n\n var operation = new Operation();\n\n var union = function union(geom) {\n for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n moreGeoms[_key - 1] = arguments[_key];\n }\n\n return operation.run('union', geom, moreGeoms);\n };\n\n var intersection$1 = function intersection(geom) {\n for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n moreGeoms[_key2 - 1] = arguments[_key2];\n }\n\n return operation.run('intersection', geom, moreGeoms);\n };\n\n var xor = function xor(geom) {\n for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n moreGeoms[_key3 - 1] = arguments[_key3];\n }\n\n return operation.run('xor', geom, moreGeoms);\n };\n\n var difference = function difference(subjectGeom) {\n for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n clippingGeoms[_key4 - 1] = arguments[_key4];\n }\n\n return operation.run('difference', subjectGeom, clippingGeoms);\n };\n\n var index = {\n union: union,\n intersection: intersection$1,\n xor: xor,\n difference: difference\n };\n\n return index;\n\n})));\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/polygon-clipping/dist/polygon-clipping.umd.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/regenerator-runtime/runtime.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/regenerator-runtime/runtime.js ***!
|
||
\*****************************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n true ? module.exports : 0\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/regenerator-runtime/runtime.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/safe-buffer/index.js":
|
||
/*!*******************************************!*\
|
||
!*** ./node_modules/safe-buffer/index.js ***!
|
||
\*******************************************/
|
||
/***/ ((module, exports, __webpack_require__) => {
|
||
|
||
eval("/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = __webpack_require__(/*! buffer */ \"./node_modules/es-pack-js/node-polyfill/node_modules/buffer/index.js\")\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/safe-buffer/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/three-laser-pointer/src/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/three-laser-pointer/src/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../package.json */ \"./node_modules/three-laser-pointer/package.json\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"three\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__);\n\nconst __version = _package_json__WEBPACK_IMPORTED_MODULE_0__.version;\n\n\n\nclass Line extends three__WEBPACK_IMPORTED_MODULE_1__.Line {\n // ref. https://stackoverflow.com/questions/31399856/drawing-a-line-with-three-js-dynamically\n constructor(maxPoints, color=0xff0000) {\n const geometry = new three__WEBPACK_IMPORTED_MODULE_1__.BufferGeometry();\n geometry.setAttribute('position', new three__WEBPACK_IMPORTED_MODULE_1__.BufferAttribute(\n new Float32Array(maxPoints * 3), 3));\n super(geometry, new three__WEBPACK_IMPORTED_MODULE_1__.LineBasicMaterial({ color }));\n\n this._maxPoints = maxPoints;\n this._numPoints = 0;\n }\n\n setColor(color) {\n this.material.color.setHex(color);\n }\n\n getColor() {\n return this.material.color;\n }\n\n getPoints() {\n let arr = this.geometry.attributes.position.array;\n let points = [];\n for (let i = 0; i < this._numPoints; i++) {\n points.push(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(arr[3*i], arr[3*i+1], arr[3*i+2]));\n }\n return points;\n }\n\n static flattenPoints(arrPoints) {\n return arrPoints.map(pt => [pt.x, pt.y, pt.z])\n .reduce((acc, ele) => acc.concat(ele));\n }\n\n updatePoints(arr, isFlatten=false) {\n if (!isFlatten) {\n arr = Laser.flattenPoints(arr);\n }\n let attrPos = this.geometry.attributes.position;\n let maxPoints = attrPos.count;\n let numPoints = arr.length / 3;\n // console.log(`numPoints/maxPoints: ${numPoints}/${maxPoints}`);\n if (numPoints > maxPoints) {\n numPoints = maxPoints;\n }\n for (let i = 0; i < numPoints; i++) {\n attrPos.array[3*i] = arr[3*i];\n attrPos.array[3*i+1] = arr[3*i+1];\n attrPos.array[3*i+2] = arr[3*i+2];\n }\n attrPos.needsUpdate = true;\n this.geometry.setDrawRange(0, numPoints);\n this._frustumCullingWorkaround();\n this._numPoints = numPoints;\n }\n\n clearPoints() {\n this.updatePoints([], true);\n }\n\n updatePointsRandomWalk(numPoints) {\n this.updatePoints(Line._getPointsRandomWalk(numPoints), true);\n }\n\n static _getPointsRandomWalk(numPoints) {\n let positions = [];\n let x = 0;\n let y = 0;\n let z = 0;\n for (let i = 0; i < numPoints; i++) {\n positions.push(x);\n positions.push(y);\n positions.push(z);\n x += ( Math.random() - 0.5 ) * 2;\n y += ( Math.random() - 0.5 ) * 2;\n z += ( Math.random() - 0.5 ) * 2;\n }\n return positions;\n }\n\n _frustumCullingWorkaround() {\n // https://stackoverflow.com/questions/36497763/three-js-line-disappears-if-one-point-is-outside-of-the-cameras-view\n this.geometry.computeBoundingSphere();\n //----\n // this.frustumCulled = false;\n }\n}\n\nclass Laser extends Line {\n constructor(options={}) {\n const defaults = {\n color: 0xff0000,\n maxPoints: 256,\n infLength: 9999.0,\n };\n const actual = Object.assign({}, defaults, options);\n super(actual.maxPoints, actual.color);\n\n console.info(`Laser ${__version} with THREE r${three__WEBPACK_IMPORTED_MODULE_1__.REVISION}`);\n this.version = __version;\n this._src = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0);\n this._raycaster = new three__WEBPACK_IMPORTED_MODULE_1__.Raycaster();\n this._infLen = actual.infLength;\n this._meshes = [];\n }\n\n setSource(src, camera=null) {\n // in case camera is given, treat (x, y, z) as in the camera coords\n this._src = camera ? src.clone().applyMatrix4(camera.matrixWorld) : src.clone();\n }\n\n getSource() {\n return this._src.clone();\n }\n\n static direct(src, target) {\n return target.clone().sub(src).normalize();\n }\n\n static reflect(d, n) {\n // r = d - 2 * (d.n) n; https://math.stackexchange.com/questions/13261/how-to-get-a-reflection-vector\n return d.clone().sub(n.clone().multiplyScalar(2*d.dot(n)));\n }\n\n _raycast(meshes, recursive, faceExclude) {\n let isects = this._raycaster.intersectObjects(meshes, recursive);\n if (faceExclude) {\n for (let i = 0; i < isects.length; i++) {\n if (isects[i].face !== faceExclude) {\n return isects[i];\n }\n }\n return null;\n }\n return isects.length > 0 ? isects[0] : null;\n }\n\n raycast(origin, direction, meshes, faceExclude=null, recursive=false) {\n this._raycaster.set(origin, direction);\n return this._raycast(meshes, recursive, faceExclude);\n }\n\n raycastFromCamera(mx, my, width, height, cam, meshes, recursive=false) {\n let mouse = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2( // normalized (-1 to +1)\n (mx / width) * 2 - 1,\n - (my / height) * 2 + 1);\n // update the picking ray with the camera and mouse position\n this._raycaster.setFromCamera(mouse, cam);\n return this._raycast(meshes, recursive, null);\n }\n\n getMeshesHit() {\n return this._meshes;\n }\n\n point(pt, color=null) {\n // console.log(\"point():\", this._src, pt);\n this.updatePoints([\n this._src.x, this._src.y, this._src.z,\n pt.x, pt.y, pt.z], true);\n this._meshes.length = 0;\n if (color) {\n this.material.color.setHex(color);\n }\n }\n\n pointWithRaytrace(pt, meshes=[], color=null, maxReflect=16) {\n this.point(pt, color);\n if (maxReflect < 1) return;\n\n let src = this.getSource();\n let dir = Laser.direct(src, pt);\n let isect = this.raycast(src, dir, meshes);\n if (!isect) return;\n\n let arrRefs = this.computeReflections(\n pt, dir, isect, meshes, maxReflect);\n this.updatePoints([src.x, src.y, src.z, pt.x, pt.y, pt.z, ...arrRefs], true);\n }\n\n // legacy: this recursive version has stack depth limitation\n _computeReflectionsRecursive(src, dir, isect, meshes, maxReflect) {\n const arr = [];\n\n // https://stackoverflow.com/questions/7065120/calling-a-javascript-function-recursively\n // https://stackoverflow.com/questions/41681357/can-a-normal-or-arrow-function-invoke-itself-from-its-body-in-a-recursive-manner\n const self = this;\n (function me (src, dir, isect) {\n // https://stackoverflow.com/questions/39082673/get-face-global-normal-in-three-js\n // console.log('local normal:', isect.face.normal);\n let normalMatrix = new three__WEBPACK_IMPORTED_MODULE_1__.Matrix3().getNormalMatrix(isect.object.matrixWorld);\n let normalWorld = isect.face.normal.clone().applyMatrix3(normalMatrix).normalize();\n\n let ref = Laser.reflect(dir, normalWorld);\n let isectNew = self.raycast(src, ref, meshes, isect.face);\n // console.log('isectNew:', isectNew);\n\n if (isectNew) {\n let pt = isectNew.point;\n arr.push(pt.x, pt.y, pt.z);\n if (arr.length / 3 < maxReflect) {\n me(pt, ref, isectNew);\n }\n } else {\n let inf = src.clone().add(ref.multiplyScalar(self._infLen));\n arr.push(inf.x, inf.y, inf.z);\n }\n })(src, dir, isect);\n return arr;\n }\n\n _computeReflections(src, dir, isect, meshes, maxReflect) {\n const arr = [];\n this._meshes = [isect.object]; // re-init\n\n while (1) {\n let normalMatrix = new three__WEBPACK_IMPORTED_MODULE_1__.Matrix3().getNormalMatrix(isect.object.matrixWorld);\n let normalWorld = isect.face.normal.clone().applyMatrix3(normalMatrix).normalize();\n\n let ref = Laser.reflect(dir, normalWorld);\n let isectNew = this.raycast(src, ref, meshes, isect.face);\n if (isectNew) {\n let pt = isectNew.point;\n arr.push(pt.x, pt.y, pt.z);\n this._meshes.push(isectNew.object);\n if (arr.length / 3 < maxReflect) {\n src = pt;\n dir = ref;\n isect = isectNew;\n continue;\n }\n break;\n } else {\n let inf = src.clone().add(ref.multiplyScalar(this._infLen));\n arr.push(inf.x, inf.y, inf.z);\n break;\n }\n }\n return arr;\n }\n\n computeReflections(src, dir, isect, meshes, maxReflect) {\n // return this._computeReflectionsRecursive(src, dir, isect, meshes, maxReflect);\n return this._computeReflections(src, dir, isect, meshes, maxReflect);\n }\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Laser);\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/three-laser-pointer/src/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/through/index.js":
|
||
/*!***************************************!*\
|
||
!*** ./node_modules/through/index.js ***!
|
||
\***************************************/
|
||
/***/ ((module, exports, __webpack_require__) => {
|
||
|
||
eval("var Stream = __webpack_require__(/*! stream */ \"./node_modules/es-pack-js/node-polyfill/node_modules/stream-browserify/index.js\")\n\n// through\n//\n// a stream that does nothing but re-emit the input.\n// useful for aggregating a series of changing but not ending streams into one stream)\n\nexports = module.exports = through\nthrough.through = through\n\n//create a readable writable stream.\n\nfunction through (write, end, opts) {\n write = write || function (data) { this.queue(data) }\n end = end || function () { this.queue(null) }\n\n var ended = false, destroyed = false, buffer = [], _ended = false\n var stream = new Stream()\n stream.readable = stream.writable = true\n stream.paused = false\n\n// stream.autoPause = !(opts && opts.autoPause === false)\n stream.autoDestroy = !(opts && opts.autoDestroy === false)\n\n stream.write = function (data) {\n write.call(this, data)\n return !stream.paused\n }\n\n function drain() {\n while(buffer.length && !stream.paused) {\n var data = buffer.shift()\n if(null === data)\n return stream.emit('end')\n else\n stream.emit('data', data)\n }\n }\n\n stream.queue = stream.push = function (data) {\n// console.error(ended)\n if(_ended) return stream\n if(data === null) _ended = true\n buffer.push(data)\n drain()\n return stream\n }\n\n //this will be registered as the first 'end' listener\n //must call destroy next tick, to make sure we're after any\n //stream piped from here.\n //this is only a problem if end is not emitted synchronously.\n //a nicer way to do this is to make sure this is the last listener for 'end'\n\n stream.on('end', function () {\n stream.readable = false\n if(!stream.writable && stream.autoDestroy)\n process.nextTick(function () {\n stream.destroy()\n })\n })\n\n function _end () {\n stream.writable = false\n end.call(stream)\n if(!stream.readable && stream.autoDestroy)\n stream.destroy()\n }\n\n stream.end = function (data) {\n if(ended) return\n ended = true\n if(arguments.length) stream.write(data)\n _end() // will emit or queue\n return stream\n }\n\n stream.destroy = function () {\n if(destroyed) return\n destroyed = true\n ended = true\n buffer.length = 0\n stream.writable = stream.readable = false\n stream.emit('close')\n return stream\n }\n\n stream.pause = function () {\n if(stream.paused) return\n stream.paused = true\n return stream\n }\n\n stream.resume = function () {\n if(stream.paused) {\n stream.paused = false\n stream.emit('resume')\n }\n drain()\n //may have become paused again,\n //as drain emits 'data'.\n if(!stream.paused)\n stream.emit('drain')\n return stream\n }\n return stream\n}\n\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/through/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/uniq/uniq.js":
|
||
/*!***********************************!*\
|
||
!*** ./node_modules/uniq/uniq.js ***!
|
||
\***********************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("\n\nfunction unique_pred(list, compare) {\n var ptr = 1\n , len = list.length\n , a=list[0], b=list[0]\n for(var i=1; i<len; ++i) {\n b = a\n a = list[i]\n if(compare(a, b)) {\n if(i === ptr) {\n ptr++\n continue\n }\n list[ptr++] = a\n }\n }\n list.length = ptr\n return list\n}\n\nfunction unique_eq(list) {\n var ptr = 1\n , len = list.length\n , a=list[0], b = list[0]\n for(var i=1; i<len; ++i, b=a) {\n b = a\n a = list[i]\n if(a !== b) {\n if(i === ptr) {\n ptr++\n continue\n }\n list[ptr++] = a\n }\n }\n list.length = ptr\n return list\n}\n\nfunction unique(list, compare, sorted) {\n if(list.length === 0) {\n return list\n }\n if(compare) {\n if(!sorted) {\n list.sort(compare)\n }\n return unique_pred(list, compare)\n }\n if(!sorted) {\n list.sort()\n }\n return unique_eq(list)\n}\n\nmodule.exports = unique\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/uniq/uniq.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/xhr/index.js":
|
||
/*!***********************************!*\
|
||
!*** ./node_modules/xhr/index.js ***!
|
||
\***********************************/
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("\nvar window = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\")\nvar isFunction = __webpack_require__(/*! is-function */ \"./node_modules/is-function/index.js\")\nvar parseHeaders = __webpack_require__(/*! parse-headers */ \"./node_modules/parse-headers/parse-headers.js\")\nvar xtend = __webpack_require__(/*! xtend */ \"./node_modules/xtend/immutable.js\")\n\nmodule.exports = createXHR\n// Allow use of default import syntax in TypeScript\nmodule.exports[\"default\"] = createXHR;\ncreateXHR.XMLHttpRequest = window.XMLHttpRequest || noop\ncreateXHR.XDomainRequest = \"withCredentials\" in (new createXHR.XMLHttpRequest()) ? createXHR.XMLHttpRequest : window.XDomainRequest\n\nforEachArray([\"get\", \"put\", \"post\", \"patch\", \"head\", \"delete\"], function(method) {\n createXHR[method === \"delete\" ? \"del\" : method] = function(uri, options, callback) {\n options = initParams(uri, options, callback)\n options.method = method.toUpperCase()\n return _createXHR(options)\n }\n})\n\nfunction forEachArray(array, iterator) {\n for (var i = 0; i < array.length; i++) {\n iterator(array[i])\n }\n}\n\nfunction isEmpty(obj){\n for(var i in obj){\n if(obj.hasOwnProperty(i)) return false\n }\n return true\n}\n\nfunction initParams(uri, options, callback) {\n var params = uri\n\n if (isFunction(options)) {\n callback = options\n if (typeof uri === \"string\") {\n params = {uri:uri}\n }\n } else {\n params = xtend(options, {uri: uri})\n }\n\n params.callback = callback\n return params\n}\n\nfunction createXHR(uri, options, callback) {\n options = initParams(uri, options, callback)\n return _createXHR(options)\n}\n\nfunction _createXHR(options) {\n if(typeof options.callback === \"undefined\"){\n throw new Error(\"callback argument missing\")\n }\n\n var called = false\n var callback = function cbOnce(err, response, body){\n if(!called){\n called = true\n options.callback(err, response, body)\n }\n }\n\n function readystatechange() {\n if (xhr.readyState === 4) {\n setTimeout(loadFunc, 0)\n }\n }\n\n function getBody() {\n // Chrome with requestType=blob throws errors arround when even testing access to responseText\n var body = undefined\n\n if (xhr.response) {\n body = xhr.response\n } else {\n body = xhr.responseText || getXml(xhr)\n }\n\n if (isJson) {\n try {\n body = JSON.parse(body)\n } catch (e) {}\n }\n\n return body\n }\n\n function errorFunc(evt) {\n clearTimeout(timeoutTimer)\n if(!(evt instanceof Error)){\n evt = new Error(\"\" + (evt || \"Unknown XMLHttpRequest Error\") )\n }\n evt.statusCode = 0\n return callback(evt, failureResponse)\n }\n\n // will load the data & process the response in a special response object\n function loadFunc() {\n if (aborted) return\n var status\n clearTimeout(timeoutTimer)\n if(options.useXDR && xhr.status===undefined) {\n //IE8 CORS GET successful response doesn't have a status field, but body is fine\n status = 200\n } else {\n status = (xhr.status === 1223 ? 204 : xhr.status)\n }\n var response = failureResponse\n var err = null\n\n if (status !== 0){\n response = {\n body: getBody(),\n statusCode: status,\n method: method,\n headers: {},\n url: uri,\n rawRequest: xhr\n }\n if(xhr.getAllResponseHeaders){ //remember xhr can in fact be XDR for CORS in IE\n response.headers = parseHeaders(xhr.getAllResponseHeaders())\n }\n } else {\n err = new Error(\"Internal XMLHttpRequest Error\")\n }\n return callback(err, response, response.body)\n }\n\n var xhr = options.xhr || null\n\n if (!xhr) {\n if (options.cors || options.useXDR) {\n xhr = new createXHR.XDomainRequest()\n }else{\n xhr = new createXHR.XMLHttpRequest()\n }\n }\n\n var key\n var aborted\n var uri = xhr.url = options.uri || options.url\n var method = xhr.method = options.method || \"GET\"\n var body = options.body || options.data\n var headers = xhr.headers = options.headers || {}\n var sync = !!options.sync\n var isJson = false\n var timeoutTimer\n var failureResponse = {\n body: undefined,\n headers: {},\n statusCode: 0,\n method: method,\n url: uri,\n rawRequest: xhr\n }\n\n if (\"json\" in options && options.json !== false) {\n isJson = true\n headers[\"accept\"] || headers[\"Accept\"] || (headers[\"Accept\"] = \"application/json\") //Don't override existing accept header declared by user\n if (method !== \"GET\" && method !== \"HEAD\") {\n headers[\"content-type\"] || headers[\"Content-Type\"] || (headers[\"Content-Type\"] = \"application/json\") //Don't override existing accept header declared by user\n body = JSON.stringify(options.json === true ? body : options.json)\n }\n }\n\n xhr.onreadystatechange = readystatechange\n xhr.onload = loadFunc\n xhr.onerror = errorFunc\n // IE9 must have onprogress be set to a unique function.\n xhr.onprogress = function () {\n // IE must die\n }\n xhr.onabort = function(){\n aborted = true;\n }\n xhr.ontimeout = errorFunc\n xhr.open(method, uri, !sync, options.username, options.password)\n //has to be after open\n if(!sync) {\n xhr.withCredentials = !!options.withCredentials\n }\n // Cannot set timeout with sync request\n // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly\n // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent\n if (!sync && options.timeout > 0 ) {\n timeoutTimer = setTimeout(function(){\n if (aborted) return\n aborted = true//IE9 may still call readystatechange\n xhr.abort(\"timeout\")\n var e = new Error(\"XMLHttpRequest timeout\")\n e.code = \"ETIMEDOUT\"\n errorFunc(e)\n }, options.timeout )\n }\n\n if (xhr.setRequestHeader) {\n for(key in headers){\n if(headers.hasOwnProperty(key)){\n xhr.setRequestHeader(key, headers[key])\n }\n }\n } else if (options.headers && !isEmpty(options.headers)) {\n throw new Error(\"Headers cannot be set on an XDomainRequest object\")\n }\n\n if (\"responseType\" in options) {\n xhr.responseType = options.responseType\n }\n\n if (\"beforeSend\" in options &&\n typeof options.beforeSend === \"function\"\n ) {\n options.beforeSend(xhr)\n }\n\n // Microsoft Edge browser sends \"undefined\" when send is called with undefined value.\n // XMLHttpRequest spec says to pass null as body to indicate no body\n // See https://github.com/naugtur/xhr/issues/100.\n xhr.send(body || null)\n\n return xhr\n\n\n}\n\nfunction getXml(xhr) {\n // xhr.responseXML will throw Exception \"InvalidStateError\" or \"DOMException\"\n // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML.\n try {\n if (xhr.responseType === \"document\") {\n return xhr.responseXML\n }\n var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === \"parsererror\"\n if (xhr.responseType === \"\" && !firefoxBugTakenEffect) {\n return xhr.responseXML\n }\n } catch (e) {}\n\n return null\n}\n\nfunction noop() {}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/xhr/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/xtend/immutable.js":
|
||
/*!*****************************************!*\
|
||
!*** ./node_modules/xtend/immutable.js ***!
|
||
\*****************************************/
|
||
/***/ ((module) => {
|
||
|
||
eval("module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/xtend/immutable.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "three":
|
||
/*!************************!*\
|
||
!*** external "THREE" ***!
|
||
\************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = __WEBPACK_EXTERNAL_MODULE_three__;
|
||
|
||
/***/ }),
|
||
|
||
/***/ "?1ed4":
|
||
/*!**********************!*\
|
||
!*** util (ignored) ***!
|
||
\**********************/
|
||
/***/ (() => {
|
||
|
||
eval("/* (ignored) */\n\n//# sourceURL=webpack://ThreeGeo/util_(ignored)?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "?98ce":
|
||
/*!**********************!*\
|
||
!*** util (ignored) ***!
|
||
\**********************/
|
||
/***/ (() => {
|
||
|
||
eval("/* (ignored) */\n\n//# sourceURL=webpack://ThreeGeo/util_(ignored)?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/area/dist/es/index.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@turf/area/dist/es/index.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ area)\n/* harmony export */ });\n/* harmony import */ var _turf_meta__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/meta */ \"./node_modules/@turf/meta/dist/es/index.js\");\n\n// Note: change RADIUS => earthRadius\nvar RADIUS = 6378137;\n/**\n * Takes one or more features and returns their area in square meters.\n *\n * @name area\n * @param {GeoJSON} geojson input GeoJSON feature(s)\n * @returns {number} area in square meters\n * @example\n * var polygon = turf.polygon([[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]);\n *\n * var area = turf.area(polygon);\n *\n * //addToMap\n * var addToMap = [polygon]\n * polygon.properties.area = area\n */\nfunction area(geojson) {\n return (0,_turf_meta__WEBPACK_IMPORTED_MODULE_0__.geomReduce)(geojson, function (value, geom) {\n return value + calculateArea(geom);\n }, 0);\n}\n/**\n * Calculate Area\n *\n * @private\n * @param {Geometry} geom GeoJSON Geometries\n * @returns {number} area\n */\nfunction calculateArea(geom) {\n var total = 0;\n var i;\n switch (geom.type) {\n case \"Polygon\":\n return polygonArea(geom.coordinates);\n case \"MultiPolygon\":\n for (i = 0; i < geom.coordinates.length; i++) {\n total += polygonArea(geom.coordinates[i]);\n }\n return total;\n case \"Point\":\n case \"MultiPoint\":\n case \"LineString\":\n case \"MultiLineString\":\n return 0;\n }\n return 0;\n}\nfunction polygonArea(coords) {\n var total = 0;\n if (coords && coords.length > 0) {\n total += Math.abs(ringArea(coords[0]));\n for (var i = 1; i < coords.length; i++) {\n total -= Math.abs(ringArea(coords[i]));\n }\n }\n return total;\n}\n/**\n * @private\n * Calculate the approximate area of the polygon were it projected onto the earth.\n * Note that this area will be positive if ring is oriented clockwise, otherwise it will be negative.\n *\n * Reference:\n * Robert. G. Chamberlain and William H. Duquette, \"Some Algorithms for Polygons on a Sphere\",\n * JPL Publication 07-03, Jet Propulsion\n * Laboratory, Pasadena, CA, June 2007 https://trs.jpl.nasa.gov/handle/2014/40409\n *\n * @param {Array<Array<number>>} coords Ring Coordinates\n * @returns {number} The approximate signed geodesic area of the polygon in square meters.\n */\nfunction ringArea(coords) {\n var p1;\n var p2;\n var p3;\n var lowerIndex;\n var middleIndex;\n var upperIndex;\n var i;\n var total = 0;\n var coordsLength = coords.length;\n if (coordsLength > 2) {\n for (i = 0; i < coordsLength; i++) {\n if (i === coordsLength - 2) {\n // i = N-2\n lowerIndex = coordsLength - 2;\n middleIndex = coordsLength - 1;\n upperIndex = 0;\n }\n else if (i === coordsLength - 1) {\n // i = N-1\n lowerIndex = coordsLength - 1;\n middleIndex = 0;\n upperIndex = 1;\n }\n else {\n // i = 0 to N-3\n lowerIndex = i;\n middleIndex = i + 1;\n upperIndex = i + 2;\n }\n p1 = coords[lowerIndex];\n p2 = coords[middleIndex];\n p3 = coords[upperIndex];\n total += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));\n }\n total = (total * RADIUS * RADIUS) / 2;\n }\n return total;\n}\nfunction rad(num) {\n return (num * Math.PI) / 180;\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/area/dist/es/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/destination/dist/es/index.js":
|
||
/*!*********************************************************!*\
|
||
!*** ./node_modules/@turf/destination/dist/es/index.js ***!
|
||
\*********************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ destination)\n/* harmony export */ });\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n/* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/invariant */ \"./node_modules/@turf/invariant/dist/es/index.js\");\n// http://en.wikipedia.org/wiki/Haversine_formula\n// http://www.movable-type.co.uk/scripts/latlong.html\n\n\n/**\n * Takes a {@link Point} and calculates the location of a destination point given a distance in\n * degrees, radians, miles, or kilometers; and bearing in degrees.\n * This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature.\n *\n * @name destination\n * @param {Coord} origin starting point\n * @param {number} distance distance from the origin point\n * @param {number} bearing ranging from -180 to 180\n * @param {Object} [options={}] Optional parameters\n * @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians\n * @param {Object} [options.properties={}] Translate properties to Point\n * @returns {Feature<Point>} destination point\n * @example\n * var point = turf.point([-75.343, 39.984]);\n * var distance = 50;\n * var bearing = 90;\n * var options = {units: 'miles'};\n *\n * var destination = turf.destination(point, distance, bearing, options);\n *\n * //addToMap\n * var addToMap = [point, destination]\n * destination.properties['marker-color'] = '#f00';\n * point.properties['marker-color'] = '#0f0';\n */\nfunction destination(origin, distance, bearing, options) {\n if (options === void 0) { options = {}; }\n // Handle input\n var coordinates1 = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_1__.getCoord)(origin);\n var longitude1 = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.degreesToRadians)(coordinates1[0]);\n var latitude1 = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.degreesToRadians)(coordinates1[1]);\n var bearingRad = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.degreesToRadians)(bearing);\n var radians = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.lengthToRadians)(distance, options.units);\n // Main\n var latitude2 = Math.asin(Math.sin(latitude1) * Math.cos(radians) +\n Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad));\n var longitude2 = longitude1 +\n Math.atan2(Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1), Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2));\n var lng = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.radiansToDegrees)(longitude2);\n var lat = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.radiansToDegrees)(latitude2);\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.point)([lng, lat], options.properties);\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/destination/dist/es/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/helpers/dist/es/index.js":
|
||
/*!*****************************************************!*\
|
||
!*** ./node_modules/@turf/helpers/dist/es/index.js ***!
|
||
\*****************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"areaFactors\": () => (/* binding */ areaFactors),\n/* harmony export */ \"bearingToAzimuth\": () => (/* binding */ bearingToAzimuth),\n/* harmony export */ \"convertArea\": () => (/* binding */ convertArea),\n/* harmony export */ \"convertLength\": () => (/* binding */ convertLength),\n/* harmony export */ \"degreesToRadians\": () => (/* binding */ degreesToRadians),\n/* harmony export */ \"earthRadius\": () => (/* binding */ earthRadius),\n/* harmony export */ \"factors\": () => (/* binding */ factors),\n/* harmony export */ \"feature\": () => (/* binding */ feature),\n/* harmony export */ \"featureCollection\": () => (/* binding */ featureCollection),\n/* harmony export */ \"geometry\": () => (/* binding */ geometry),\n/* harmony export */ \"geometryCollection\": () => (/* binding */ geometryCollection),\n/* harmony export */ \"isNumber\": () => (/* binding */ isNumber),\n/* harmony export */ \"isObject\": () => (/* binding */ isObject),\n/* harmony export */ \"lengthToDegrees\": () => (/* binding */ lengthToDegrees),\n/* harmony export */ \"lengthToRadians\": () => (/* binding */ lengthToRadians),\n/* harmony export */ \"lineString\": () => (/* binding */ lineString),\n/* harmony export */ \"lineStrings\": () => (/* binding */ lineStrings),\n/* harmony export */ \"multiLineString\": () => (/* binding */ multiLineString),\n/* harmony export */ \"multiPoint\": () => (/* binding */ multiPoint),\n/* harmony export */ \"multiPolygon\": () => (/* binding */ multiPolygon),\n/* harmony export */ \"point\": () => (/* binding */ point),\n/* harmony export */ \"points\": () => (/* binding */ points),\n/* harmony export */ \"polygon\": () => (/* binding */ polygon),\n/* harmony export */ \"polygons\": () => (/* binding */ polygons),\n/* harmony export */ \"radiansToDegrees\": () => (/* binding */ radiansToDegrees),\n/* harmony export */ \"radiansToLength\": () => (/* binding */ radiansToLength),\n/* harmony export */ \"round\": () => (/* binding */ round),\n/* harmony export */ \"unitsFactors\": () => (/* binding */ unitsFactors),\n/* harmony export */ \"validateBBox\": () => (/* binding */ validateBBox),\n/* harmony export */ \"validateId\": () => (/* binding */ validateId)\n/* harmony export */ });\n/**\n * @module helpers\n */\n/**\n * Earth Radius used with the Harvesine formula and approximates using a spherical (non-ellipsoid) Earth.\n *\n * @memberof helpers\n * @type {number}\n */\nvar earthRadius = 6371008.8;\n/**\n * Unit of measurement factors using a spherical (non-ellipsoid) earth radius.\n *\n * @memberof helpers\n * @type {Object}\n */\nvar factors = {\n centimeters: earthRadius * 100,\n centimetres: earthRadius * 100,\n degrees: earthRadius / 111325,\n feet: earthRadius * 3.28084,\n inches: earthRadius * 39.37,\n kilometers: earthRadius / 1000,\n kilometres: earthRadius / 1000,\n meters: earthRadius,\n metres: earthRadius,\n miles: earthRadius / 1609.344,\n millimeters: earthRadius * 1000,\n millimetres: earthRadius * 1000,\n nauticalmiles: earthRadius / 1852,\n radians: 1,\n yards: earthRadius * 1.0936,\n};\n/**\n * Units of measurement factors based on 1 meter.\n *\n * @memberof helpers\n * @type {Object}\n */\nvar unitsFactors = {\n centimeters: 100,\n centimetres: 100,\n degrees: 1 / 111325,\n feet: 3.28084,\n inches: 39.37,\n kilometers: 1 / 1000,\n kilometres: 1 / 1000,\n meters: 1,\n metres: 1,\n miles: 1 / 1609.344,\n millimeters: 1000,\n millimetres: 1000,\n nauticalmiles: 1 / 1852,\n radians: 1 / earthRadius,\n yards: 1.0936133,\n};\n/**\n * Area of measurement factors based on 1 square meter.\n *\n * @memberof helpers\n * @type {Object}\n */\nvar areaFactors = {\n acres: 0.000247105,\n centimeters: 10000,\n centimetres: 10000,\n feet: 10.763910417,\n hectares: 0.0001,\n inches: 1550.003100006,\n kilometers: 0.000001,\n kilometres: 0.000001,\n meters: 1,\n metres: 1,\n miles: 3.86e-7,\n millimeters: 1000000,\n millimetres: 1000000,\n yards: 1.195990046,\n};\n/**\n * Wraps a GeoJSON {@link Geometry} in a GeoJSON {@link Feature}.\n *\n * @name feature\n * @param {Geometry} geometry input geometry\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature} a GeoJSON Feature\n * @example\n * var geometry = {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 50]\n * };\n *\n * var feature = turf.feature(geometry);\n *\n * //=feature\n */\nfunction feature(geom, properties, options) {\n if (options === void 0) { options = {}; }\n var feat = { type: \"Feature\" };\n if (options.id === 0 || options.id) {\n feat.id = options.id;\n }\n if (options.bbox) {\n feat.bbox = options.bbox;\n }\n feat.properties = properties || {};\n feat.geometry = geom;\n return feat;\n}\n/**\n * Creates a GeoJSON {@link Geometry} from a Geometry string type & coordinates.\n * For GeometryCollection type use `helpers.geometryCollection`\n *\n * @name geometry\n * @param {string} type Geometry Type\n * @param {Array<any>} coordinates Coordinates\n * @param {Object} [options={}] Optional Parameters\n * @returns {Geometry} a GeoJSON Geometry\n * @example\n * var type = \"Point\";\n * var coordinates = [110, 50];\n * var geometry = turf.geometry(type, coordinates);\n * // => geometry\n */\nfunction geometry(type, coordinates, _options) {\n if (_options === void 0) { _options = {}; }\n switch (type) {\n case \"Point\":\n return point(coordinates).geometry;\n case \"LineString\":\n return lineString(coordinates).geometry;\n case \"Polygon\":\n return polygon(coordinates).geometry;\n case \"MultiPoint\":\n return multiPoint(coordinates).geometry;\n case \"MultiLineString\":\n return multiLineString(coordinates).geometry;\n case \"MultiPolygon\":\n return multiPolygon(coordinates).geometry;\n default:\n throw new Error(type + \" is invalid\");\n }\n}\n/**\n * Creates a {@link Point} {@link Feature} from a Position.\n *\n * @name point\n * @param {Array<number>} coordinates longitude, latitude position (each in decimal degrees)\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<Point>} a Point feature\n * @example\n * var point = turf.point([-75.343, 39.984]);\n *\n * //=point\n */\nfunction point(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n if (!coordinates) {\n throw new Error(\"coordinates is required\");\n }\n if (!Array.isArray(coordinates)) {\n throw new Error(\"coordinates must be an Array\");\n }\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be at least 2 numbers long\");\n }\n if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {\n throw new Error(\"coordinates must contain numbers\");\n }\n var geom = {\n type: \"Point\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Point} {@link FeatureCollection} from an Array of Point coordinates.\n *\n * @name points\n * @param {Array<Array<number>>} coordinates an array of Points\n * @param {Object} [properties={}] Translate these properties to each Feature\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {string|number} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Point>} Point Feature\n * @example\n * var points = turf.points([\n * [-75, 39],\n * [-80, 45],\n * [-78, 50]\n * ]);\n *\n * //=points\n */\nfunction points(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n return featureCollection(coordinates.map(function (coords) {\n return point(coords, properties);\n }), options);\n}\n/**\n * Creates a {@link Polygon} {@link Feature} from an Array of LinearRings.\n *\n * @name polygon\n * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<Polygon>} Polygon Feature\n * @example\n * var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]], { name: 'poly1' });\n *\n * //=polygon\n */\nfunction polygon(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {\n var ring = coordinates_1[_i];\n if (ring.length < 4) {\n throw new Error(\"Each LinearRing of a Polygon must have 4 or more Positions.\");\n }\n for (var j = 0; j < ring[ring.length - 1].length; j++) {\n // Check if first point of Polygon contains two numbers\n if (ring[ring.length - 1][j] !== ring[0][j]) {\n throw new Error(\"First and last Position are not equivalent.\");\n }\n }\n }\n var geom = {\n type: \"Polygon\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Polygon} {@link FeatureCollection} from an Array of Polygon coordinates.\n *\n * @name polygons\n * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygon coordinates\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<Polygon>} Polygon FeatureCollection\n * @example\n * var polygons = turf.polygons([\n * [[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],\n * [[[-15, 42], [-14, 46], [-12, 41], [-17, 44], [-15, 42]]],\n * ]);\n *\n * //=polygons\n */\nfunction polygons(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n return featureCollection(coordinates.map(function (coords) {\n return polygon(coords, properties);\n }), options);\n}\n/**\n * Creates a {@link LineString} {@link Feature} from an Array of Positions.\n *\n * @name lineString\n * @param {Array<Array<number>>} coordinates an array of Positions\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<LineString>} LineString Feature\n * @example\n * var linestring1 = turf.lineString([[-24, 63], [-23, 60], [-25, 65], [-20, 69]], {name: 'line 1'});\n * var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]], {name: 'line 2'});\n *\n * //=linestring1\n * //=linestring2\n */\nfunction lineString(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n if (coordinates.length < 2) {\n throw new Error(\"coordinates must be an array of two or more positions\");\n }\n var geom = {\n type: \"LineString\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link LineString} {@link FeatureCollection} from an Array of LineString coordinates.\n *\n * @name lineStrings\n * @param {Array<Array<Array<number>>>} coordinates an array of LinearRings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north]\n * associated with the FeatureCollection\n * @param {string|number} [options.id] Identifier associated with the FeatureCollection\n * @returns {FeatureCollection<LineString>} LineString FeatureCollection\n * @example\n * var linestrings = turf.lineStrings([\n * [[-24, 63], [-23, 60], [-25, 65], [-20, 69]],\n * [[-14, 43], [-13, 40], [-15, 45], [-10, 49]]\n * ]);\n *\n * //=linestrings\n */\nfunction lineStrings(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n return featureCollection(coordinates.map(function (coords) {\n return lineString(coords, properties);\n }), options);\n}\n/**\n * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.\n *\n * @name featureCollection\n * @param {Feature[]} features input features\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {FeatureCollection} FeatureCollection of Features\n * @example\n * var locationA = turf.point([-75.343, 39.984], {name: 'Location A'});\n * var locationB = turf.point([-75.833, 39.284], {name: 'Location B'});\n * var locationC = turf.point([-75.534, 39.123], {name: 'Location C'});\n *\n * var collection = turf.featureCollection([\n * locationA,\n * locationB,\n * locationC\n * ]);\n *\n * //=collection\n */\nfunction featureCollection(features, options) {\n if (options === void 0) { options = {}; }\n var fc = { type: \"FeatureCollection\" };\n if (options.id) {\n fc.id = options.id;\n }\n if (options.bbox) {\n fc.bbox = options.bbox;\n }\n fc.features = features;\n return fc;\n}\n/**\n * Creates a {@link Feature<MultiLineString>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiLineString\n * @param {Array<Array<Array<number>>>} coordinates an array of LineStrings\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiLineString>} a MultiLineString feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiLine = turf.multiLineString([[[0,0],[10,10]]]);\n *\n * //=multiLine\n */\nfunction multiLineString(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n var geom = {\n type: \"MultiLineString\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<MultiPoint>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiPoint\n * @param {Array<Array<number>>} coordinates an array of Positions\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPoint>} a MultiPoint feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPt = turf.multiPoint([[0,0],[10,10]]);\n *\n * //=multiPt\n */\nfunction multiPoint(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n var geom = {\n type: \"MultiPoint\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<MultiPolygon>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name multiPolygon\n * @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygons\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<MultiPolygon>} a multipolygon feature\n * @throws {Error} if no coordinates are passed\n * @example\n * var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);\n *\n * //=multiPoly\n *\n */\nfunction multiPolygon(coordinates, properties, options) {\n if (options === void 0) { options = {}; }\n var geom = {\n type: \"MultiPolygon\",\n coordinates: coordinates,\n };\n return feature(geom, properties, options);\n}\n/**\n * Creates a {@link Feature<GeometryCollection>} based on a\n * coordinate array. Properties can be added optionally.\n *\n * @name geometryCollection\n * @param {Array<Geometry>} geometries an array of GeoJSON Geometries\n * @param {Object} [properties={}] an Object of key-value pairs to add as properties\n * @param {Object} [options={}] Optional Parameters\n * @param {Array<number>} [options.bbox] Bounding Box Array [west, south, east, north] associated with the Feature\n * @param {string|number} [options.id] Identifier associated with the Feature\n * @returns {Feature<GeometryCollection>} a GeoJSON GeometryCollection Feature\n * @example\n * var pt = turf.geometry(\"Point\", [100, 0]);\n * var line = turf.geometry(\"LineString\", [[101, 0], [102, 1]]);\n * var collection = turf.geometryCollection([pt, line]);\n *\n * // => collection\n */\nfunction geometryCollection(geometries, properties, options) {\n if (options === void 0) { options = {}; }\n var geom = {\n type: \"GeometryCollection\",\n geometries: geometries,\n };\n return feature(geom, properties, options);\n}\n/**\n * Round number to precision\n *\n * @param {number} num Number\n * @param {number} [precision=0] Precision\n * @returns {number} rounded number\n * @example\n * turf.round(120.4321)\n * //=120\n *\n * turf.round(120.4321, 2)\n * //=120.43\n */\nfunction round(num, precision) {\n if (precision === void 0) { precision = 0; }\n if (precision && !(precision >= 0)) {\n throw new Error(\"precision must be a positive number\");\n }\n var multiplier = Math.pow(10, precision || 0);\n return Math.round(num * multiplier) / multiplier;\n}\n/**\n * Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit.\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @name radiansToLength\n * @param {number} radians in radians across the sphere\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} distance\n */\nfunction radiansToLength(radians, units) {\n if (units === void 0) { units = \"kilometers\"; }\n var factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return radians * factor;\n}\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @name lengthToRadians\n * @param {number} distance in real units\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} radians\n */\nfunction lengthToRadians(distance, units) {\n if (units === void 0) { units = \"kilometers\"; }\n var factor = factors[units];\n if (!factor) {\n throw new Error(units + \" units is invalid\");\n }\n return distance / factor;\n}\n/**\n * Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet\n *\n * @name lengthToDegrees\n * @param {number} distance in real units\n * @param {string} [units=\"kilometers\"] can be degrees, radians, miles, inches, yards, metres,\n * meters, kilometres, kilometers.\n * @returns {number} degrees\n */\nfunction lengthToDegrees(distance, units) {\n return radiansToDegrees(lengthToRadians(distance, units));\n}\n/**\n * Converts any bearing angle from the north line direction (positive clockwise)\n * and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line\n *\n * @name bearingToAzimuth\n * @param {number} bearing angle, between -180 and +180 degrees\n * @returns {number} angle between 0 and 360 degrees\n */\nfunction bearingToAzimuth(bearing) {\n var angle = bearing % 360;\n if (angle < 0) {\n angle += 360;\n }\n return angle;\n}\n/**\n * Converts an angle in radians to degrees\n *\n * @name radiansToDegrees\n * @param {number} radians angle in radians\n * @returns {number} degrees between 0 and 360 degrees\n */\nfunction radiansToDegrees(radians) {\n var degrees = radians % (2 * Math.PI);\n return (degrees * 180) / Math.PI;\n}\n/**\n * Converts an angle in degrees to radians\n *\n * @name degreesToRadians\n * @param {number} degrees angle between 0 and 360 degrees\n * @returns {number} angle in radians\n */\nfunction degreesToRadians(degrees) {\n var radians = degrees % 360;\n return (radians * Math.PI) / 180;\n}\n/**\n * Converts a length to the requested unit.\n * Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet\n *\n * @param {number} length to be converted\n * @param {Units} [originalUnit=\"kilometers\"] of the length\n * @param {Units} [finalUnit=\"kilometers\"] returned unit\n * @returns {number} the converted length\n */\nfunction convertLength(length, originalUnit, finalUnit) {\n if (originalUnit === void 0) { originalUnit = \"kilometers\"; }\n if (finalUnit === void 0) { finalUnit = \"kilometers\"; }\n if (!(length >= 0)) {\n throw new Error(\"length must be a positive number\");\n }\n return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);\n}\n/**\n * Converts a area to the requested unit.\n * Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches, hectares\n * @param {number} area to be converted\n * @param {Units} [originalUnit=\"meters\"] of the distance\n * @param {Units} [finalUnit=\"kilometers\"] returned unit\n * @returns {number} the converted area\n */\nfunction convertArea(area, originalUnit, finalUnit) {\n if (originalUnit === void 0) { originalUnit = \"meters\"; }\n if (finalUnit === void 0) { finalUnit = \"kilometers\"; }\n if (!(area >= 0)) {\n throw new Error(\"area must be a positive number\");\n }\n var startFactor = areaFactors[originalUnit];\n if (!startFactor) {\n throw new Error(\"invalid original units\");\n }\n var finalFactor = areaFactors[finalUnit];\n if (!finalFactor) {\n throw new Error(\"invalid final units\");\n }\n return (area / startFactor) * finalFactor;\n}\n/**\n * isNumber\n *\n * @param {*} num Number to validate\n * @returns {boolean} true/false\n * @example\n * turf.isNumber(123)\n * //=true\n * turf.isNumber('foo')\n * //=false\n */\nfunction isNumber(num) {\n return !isNaN(num) && num !== null && !Array.isArray(num);\n}\n/**\n * isObject\n *\n * @param {*} input variable to validate\n * @returns {boolean} true/false\n * @example\n * turf.isObject({elevation: 10})\n * //=true\n * turf.isObject('foo')\n * //=false\n */\nfunction isObject(input) {\n return !!input && input.constructor === Object;\n}\n/**\n * Validate BBox\n *\n * @private\n * @param {Array<number>} bbox BBox to validate\n * @returns {void}\n * @throws Error if BBox is not valid\n * @example\n * validateBBox([-180, -40, 110, 50])\n * //=OK\n * validateBBox([-180, -40])\n * //=Error\n * validateBBox('Foo')\n * //=Error\n * validateBBox(5)\n * //=Error\n * validateBBox(null)\n * //=Error\n * validateBBox(undefined)\n * //=Error\n */\nfunction validateBBox(bbox) {\n if (!bbox) {\n throw new Error(\"bbox is required\");\n }\n if (!Array.isArray(bbox)) {\n throw new Error(\"bbox must be an Array\");\n }\n if (bbox.length !== 4 && bbox.length !== 6) {\n throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n }\n bbox.forEach(function (num) {\n if (!isNumber(num)) {\n throw new Error(\"bbox must only contain numbers\");\n }\n });\n}\n/**\n * Validate Id\n *\n * @private\n * @param {string|number} id Id to validate\n * @returns {void}\n * @throws Error if Id is not valid\n * @example\n * validateId([-180, -40, 110, 50])\n * //=Error\n * validateId([-180, -40])\n * //=Error\n * validateId('Foo')\n * //=OK\n * validateId(5)\n * //=OK\n * validateId(null)\n * //=Error\n * validateId(undefined)\n * //=Error\n */\nfunction validateId(id) {\n if (!id) {\n throw new Error(\"id is required\");\n }\n if ([\"string\", \"number\"].indexOf(typeof id) === -1) {\n throw new Error(\"id must be a number or a string\");\n }\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/helpers/dist/es/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/intersect/dist/es/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@turf/intersect/dist/es/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ intersect)\n/* harmony export */ });\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n/* harmony import */ var _turf_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @turf/invariant */ \"./node_modules/@turf/invariant/dist/es/index.js\");\n/* harmony import */ var polygon_clipping__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! polygon-clipping */ \"./node_modules/polygon-clipping/dist/polygon-clipping.umd.js\");\n\n\n\n/**\n * Takes two {@link Polygon|polygon} or {@link MultiPolygon|multi-polygon} geometries and\n * finds their polygonal intersection. If they don't intersect, returns null.\n *\n * @name intersect\n * @param {Feature<Polygon | MultiPolygon>} poly1 the first polygon or multipolygon\n * @param {Feature<Polygon | MultiPolygon>} poly2 the second polygon or multipolygon\n * @param {Object} [options={}] Optional Parameters\n * @param {Object} [options.properties={}] Translate GeoJSON Properties to Feature\n * @returns {Feature|null} returns a feature representing the area they share (either a {@link Polygon} or\n * {@link MultiPolygon}). If they do not share any area, returns `null`.\n * @example\n * var poly1 = turf.polygon([[\n * [-122.801742, 45.48565],\n * [-122.801742, 45.60491],\n * [-122.584762, 45.60491],\n * [-122.584762, 45.48565],\n * [-122.801742, 45.48565]\n * ]]);\n *\n * var poly2 = turf.polygon([[\n * [-122.520217, 45.535693],\n * [-122.64038, 45.553967],\n * [-122.720031, 45.526554],\n * [-122.669906, 45.507309],\n * [-122.723464, 45.446643],\n * [-122.532577, 45.408574],\n * [-122.487258, 45.477466],\n * [-122.520217, 45.535693]\n * ]]);\n *\n * var intersection = turf.intersect(poly1, poly2);\n *\n * //addToMap\n * var addToMap = [poly1, poly2, intersection];\n */\nfunction intersect(poly1, poly2, options) {\n if (options === void 0) { options = {}; }\n var geom1 = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_1__.getGeom)(poly1);\n var geom2 = (0,_turf_invariant__WEBPACK_IMPORTED_MODULE_1__.getGeom)(poly2);\n var intersection = polygon_clipping__WEBPACK_IMPORTED_MODULE_2__.intersection(geom1.coordinates, geom2.coordinates);\n if (intersection.length === 0)\n return null;\n if (intersection.length === 1)\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.polygon)(intersection[0], options.properties);\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.multiPolygon)(intersection, options.properties);\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/intersect/dist/es/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/invariant/dist/es/index.js":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/@turf/invariant/dist/es/index.js ***!
|
||
\*******************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"collectionOf\": () => (/* binding */ collectionOf),\n/* harmony export */ \"containsNumber\": () => (/* binding */ containsNumber),\n/* harmony export */ \"featureOf\": () => (/* binding */ featureOf),\n/* harmony export */ \"geojsonType\": () => (/* binding */ geojsonType),\n/* harmony export */ \"getCoord\": () => (/* binding */ getCoord),\n/* harmony export */ \"getCoords\": () => (/* binding */ getCoords),\n/* harmony export */ \"getGeom\": () => (/* binding */ getGeom),\n/* harmony export */ \"getType\": () => (/* binding */ getType)\n/* harmony export */ });\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n\n/**\n * Unwrap a coordinate from a Point Feature, Geometry or a single coordinate.\n *\n * @name getCoord\n * @param {Array<number>|Geometry<Point>|Feature<Point>} coord GeoJSON Point or an Array of numbers\n * @returns {Array<number>} coordinates\n * @example\n * var pt = turf.point([10, 10]);\n *\n * var coord = turf.getCoord(pt);\n * //= [10, 10]\n */\nfunction getCoord(coord) {\n if (!coord) {\n throw new Error(\"coord is required\");\n }\n if (!Array.isArray(coord)) {\n if (coord.type === \"Feature\" &&\n coord.geometry !== null &&\n coord.geometry.type === \"Point\") {\n return coord.geometry.coordinates;\n }\n if (coord.type === \"Point\") {\n return coord.coordinates;\n }\n }\n if (Array.isArray(coord) &&\n coord.length >= 2 &&\n !Array.isArray(coord[0]) &&\n !Array.isArray(coord[1])) {\n return coord;\n }\n throw new Error(\"coord must be GeoJSON Point or an Array of numbers\");\n}\n/**\n * Unwrap coordinates from a Feature, Geometry Object or an Array\n *\n * @name getCoords\n * @param {Array<any>|Geometry|Feature} coords Feature, Geometry Object or an Array\n * @returns {Array<any>} coordinates\n * @example\n * var poly = turf.polygon([[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]);\n *\n * var coords = turf.getCoords(poly);\n * //= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]]\n */\nfunction getCoords(coords) {\n if (Array.isArray(coords)) {\n return coords;\n }\n // Feature\n if (coords.type === \"Feature\") {\n if (coords.geometry !== null) {\n return coords.geometry.coordinates;\n }\n }\n else {\n // Geometry\n if (coords.coordinates) {\n return coords.coordinates;\n }\n }\n throw new Error(\"coords must be GeoJSON Feature, Geometry Object or an Array\");\n}\n/**\n * Checks if coordinates contains a number\n *\n * @name containsNumber\n * @param {Array<any>} coordinates GeoJSON Coordinates\n * @returns {boolean} true if Array contains a number\n */\nfunction containsNumber(coordinates) {\n if (coordinates.length > 1 &&\n (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.isNumber)(coordinates[0]) &&\n (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.isNumber)(coordinates[1])) {\n return true;\n }\n if (Array.isArray(coordinates[0]) && coordinates[0].length) {\n return containsNumber(coordinates[0]);\n }\n throw new Error(\"coordinates must only contain numbers\");\n}\n/**\n * Enforce expectations about types of GeoJSON objects for Turf.\n *\n * @name geojsonType\n * @param {GeoJSON} value any GeoJSON object\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} if value is not the expected type.\n */\nfunction geojsonType(value, type, name) {\n if (!type || !name) {\n throw new Error(\"type and name required\");\n }\n if (!value || value.type !== type) {\n throw new Error(\"Invalid input to \" +\n name +\n \": must be a \" +\n type +\n \", given \" +\n value.type);\n }\n}\n/**\n * Enforce expectations about types of {@link Feature} inputs for Turf.\n * Internally this uses {@link geojsonType} to judge geometry types.\n *\n * @name featureOf\n * @param {Feature} feature a feature with an expected geometry type\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} error if value is not the expected type.\n */\nfunction featureOf(feature, type, name) {\n if (!feature) {\n throw new Error(\"No feature passed\");\n }\n if (!name) {\n throw new Error(\".featureOf() requires a name\");\n }\n if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n throw new Error(\"Invalid input to \" + name + \", Feature with geometry required\");\n }\n if (!feature.geometry || feature.geometry.type !== type) {\n throw new Error(\"Invalid input to \" +\n name +\n \": must be a \" +\n type +\n \", given \" +\n feature.geometry.type);\n }\n}\n/**\n * Enforce expectations about types of {@link FeatureCollection} inputs for Turf.\n * Internally this uses {@link geojsonType} to judge geometry types.\n *\n * @name collectionOf\n * @param {FeatureCollection} featureCollection a FeatureCollection for which features will be judged\n * @param {string} type expected GeoJSON type\n * @param {string} name name of calling function\n * @throws {Error} if value is not the expected type.\n */\nfunction collectionOf(featureCollection, type, name) {\n if (!featureCollection) {\n throw new Error(\"No featureCollection passed\");\n }\n if (!name) {\n throw new Error(\".collectionOf() requires a name\");\n }\n if (!featureCollection || featureCollection.type !== \"FeatureCollection\") {\n throw new Error(\"Invalid input to \" + name + \", FeatureCollection required\");\n }\n for (var _i = 0, _a = featureCollection.features; _i < _a.length; _i++) {\n var feature = _a[_i];\n if (!feature || feature.type !== \"Feature\" || !feature.geometry) {\n throw new Error(\"Invalid input to \" + name + \", Feature with geometry required\");\n }\n if (!feature.geometry || feature.geometry.type !== type) {\n throw new Error(\"Invalid input to \" +\n name +\n \": must be a \" +\n type +\n \", given \" +\n feature.geometry.type);\n }\n }\n}\n/**\n * Get Geometry from Feature or Geometry Object\n *\n * @param {Feature|Geometry} geojson GeoJSON Feature or Geometry Object\n * @returns {Geometry|null} GeoJSON Geometry Object\n * @throws {Error} if geojson is not a Feature or Geometry Object\n * @example\n * var point = {\n * \"type\": \"Feature\",\n * \"properties\": {},\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 40]\n * }\n * }\n * var geom = turf.getGeom(point)\n * //={\"type\": \"Point\", \"coordinates\": [110, 40]}\n */\nfunction getGeom(geojson) {\n if (geojson.type === \"Feature\") {\n return geojson.geometry;\n }\n return geojson;\n}\n/**\n * Get GeoJSON object's type, Geometry type is prioritize.\n *\n * @param {GeoJSON} geojson GeoJSON object\n * @param {string} [name=\"geojson\"] name of the variable to display in error message (unused)\n * @returns {string} GeoJSON type\n * @example\n * var point = {\n * \"type\": \"Feature\",\n * \"properties\": {},\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 40]\n * }\n * }\n * var geom = turf.getType(point)\n * //=\"Point\"\n */\nfunction getType(geojson, _name) {\n if (geojson.type === \"FeatureCollection\") {\n return \"FeatureCollection\";\n }\n if (geojson.type === \"GeometryCollection\") {\n return \"GeometryCollection\";\n }\n if (geojson.type === \"Feature\" && geojson.geometry !== null) {\n return geojson.geometry.type;\n }\n return geojson.type;\n}\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/invariant/dist/es/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/@turf/meta/dist/es/index.js":
|
||
/*!**************************************************!*\
|
||
!*** ./node_modules/@turf/meta/dist/es/index.js ***!
|
||
\**************************************************/
|
||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"coordAll\": () => (/* binding */ coordAll),\n/* harmony export */ \"coordEach\": () => (/* binding */ coordEach),\n/* harmony export */ \"coordReduce\": () => (/* binding */ coordReduce),\n/* harmony export */ \"featureEach\": () => (/* binding */ featureEach),\n/* harmony export */ \"featureReduce\": () => (/* binding */ featureReduce),\n/* harmony export */ \"findPoint\": () => (/* binding */ findPoint),\n/* harmony export */ \"findSegment\": () => (/* binding */ findSegment),\n/* harmony export */ \"flattenEach\": () => (/* binding */ flattenEach),\n/* harmony export */ \"flattenReduce\": () => (/* binding */ flattenReduce),\n/* harmony export */ \"geomEach\": () => (/* binding */ geomEach),\n/* harmony export */ \"geomReduce\": () => (/* binding */ geomReduce),\n/* harmony export */ \"lineEach\": () => (/* binding */ lineEach),\n/* harmony export */ \"lineReduce\": () => (/* binding */ lineReduce),\n/* harmony export */ \"propEach\": () => (/* binding */ propEach),\n/* harmony export */ \"propReduce\": () => (/* binding */ propReduce),\n/* harmony export */ \"segmentEach\": () => (/* binding */ segmentEach),\n/* harmony export */ \"segmentReduce\": () => (/* binding */ segmentReduce)\n/* harmony export */ });\n/* harmony import */ var _turf_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turf/helpers */ \"./node_modules/@turf/helpers/dist/es/index.js\");\n\n\n/**\n * Callback for coordEach\n *\n * @callback coordEachCallback\n * @param {Array<number>} currentCoord The current coordinate being processed.\n * @param {number} coordIndex The current index of the coordinate being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n */\n\n/**\n * Iterate over coordinates in any GeoJSON object, similar to Array.forEach()\n *\n * @name coordEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentCoord, coordIndex, featureIndex, multiFeatureIndex)\n * @param {boolean} [excludeWrapCoord=false] whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {\"foo\": \"bar\"}),\n * turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.coordEach(features, function (currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n * //=currentCoord\n * //=coordIndex\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * });\n */\nfunction coordEach(geojson, callback, excludeWrapCoord) {\n // Handles null Geometry -- Skips this GeoJSON\n if (geojson === null) return;\n var j,\n k,\n l,\n geometry,\n stopG,\n coords,\n geometryMaybeCollection,\n wrapShrink = 0,\n coordIndex = 0,\n isGeometryCollection,\n type = geojson.type,\n isFeatureCollection = type === \"FeatureCollection\",\n isFeature = type === \"Feature\",\n stop = isFeatureCollection ? geojson.features.length : 1;\n\n // This logic may look a little weird. The reason why it is that way\n // is because it's trying to be fast. GeoJSON supports multiple kinds\n // of objects at its root: FeatureCollection, Features, Geometries.\n // This function has the responsibility of handling all of them, and that\n // means that some of the `for` loops you see below actually just don't apply\n // to certain inputs. For instance, if you give this just a\n // Point geometry, then both loops are short-circuited and all we do\n // is gradually rename the input until it's called 'geometry'.\n //\n // This also aims to allocate as few resources as possible: just a\n // few numbers and booleans, rather than any temporary arrays as would\n // be required with the normalization approach.\n for (var featureIndex = 0; featureIndex < stop; featureIndex++) {\n geometryMaybeCollection = isFeatureCollection\n ? geojson.features[featureIndex].geometry\n : isFeature\n ? geojson.geometry\n : geojson;\n isGeometryCollection = geometryMaybeCollection\n ? geometryMaybeCollection.type === \"GeometryCollection\"\n : false;\n stopG = isGeometryCollection\n ? geometryMaybeCollection.geometries.length\n : 1;\n\n for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {\n var multiFeatureIndex = 0;\n var geometryIndex = 0;\n geometry = isGeometryCollection\n ? geometryMaybeCollection.geometries[geomIndex]\n : geometryMaybeCollection;\n\n // Handles null Geometry -- Skips this geometry\n if (geometry === null) continue;\n coords = geometry.coordinates;\n var geomType = geometry.type;\n\n wrapShrink =\n excludeWrapCoord &&\n (geomType === \"Polygon\" || geomType === \"MultiPolygon\")\n ? 1\n : 0;\n\n switch (geomType) {\n case null:\n break;\n case \"Point\":\n if (\n callback(\n coords,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n coordIndex++;\n multiFeatureIndex++;\n break;\n case \"LineString\":\n case \"MultiPoint\":\n for (j = 0; j < coords.length; j++) {\n if (\n callback(\n coords[j],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n coordIndex++;\n if (geomType === \"MultiPoint\") multiFeatureIndex++;\n }\n if (geomType === \"LineString\") multiFeatureIndex++;\n break;\n case \"Polygon\":\n case \"MultiLineString\":\n for (j = 0; j < coords.length; j++) {\n for (k = 0; k < coords[j].length - wrapShrink; k++) {\n if (\n callback(\n coords[j][k],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n coordIndex++;\n }\n if (geomType === \"MultiLineString\") multiFeatureIndex++;\n if (geomType === \"Polygon\") geometryIndex++;\n }\n if (geomType === \"Polygon\") multiFeatureIndex++;\n break;\n case \"MultiPolygon\":\n for (j = 0; j < coords.length; j++) {\n geometryIndex = 0;\n for (k = 0; k < coords[j].length; k++) {\n for (l = 0; l < coords[j][k].length - wrapShrink; l++) {\n if (\n callback(\n coords[j][k][l],\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n coordIndex++;\n }\n geometryIndex++;\n }\n multiFeatureIndex++;\n }\n break;\n case \"GeometryCollection\":\n for (j = 0; j < geometry.geometries.length; j++)\n if (\n coordEach(geometry.geometries[j], callback, excludeWrapCoord) ===\n false\n )\n return false;\n break;\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n }\n}\n\n/**\n * Callback for coordReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback coordReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Array<number>} currentCoord The current coordinate being processed.\n * @param {number} coordIndex The current index of the coordinate being processed.\n * Starts at index 0, if an initialValue is provided, and at index 1 otherwise.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n */\n\n/**\n * Reduce coordinates in any GeoJSON object, similar to Array.reduce()\n *\n * @name coordReduce\n * @param {FeatureCollection|Geometry|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentCoord, coordIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @param {boolean} [excludeWrapCoord=false] whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {\"foo\": \"bar\"}),\n * turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.coordReduce(features, function (previousValue, currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {\n * //=previousValue\n * //=currentCoord\n * //=coordIndex\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * return currentCoord;\n * });\n */\nfunction coordReduce(geojson, callback, initialValue, excludeWrapCoord) {\n var previousValue = initialValue;\n coordEach(\n geojson,\n function (\n currentCoord,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) {\n if (coordIndex === 0 && initialValue === undefined)\n previousValue = currentCoord;\n else\n previousValue = callback(\n previousValue,\n currentCoord,\n coordIndex,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n },\n excludeWrapCoord\n );\n return previousValue;\n}\n\n/**\n * Callback for propEach\n *\n * @callback propEachCallback\n * @param {Object} currentProperties The current Properties being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Iterate over properties in any GeoJSON object, similar to Array.forEach()\n *\n * @name propEach\n * @param {FeatureCollection|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentProperties, featureIndex)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.propEach(features, function (currentProperties, featureIndex) {\n * //=currentProperties\n * //=featureIndex\n * });\n */\nfunction propEach(geojson, callback) {\n var i;\n switch (geojson.type) {\n case \"FeatureCollection\":\n for (i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i].properties, i) === false) break;\n }\n break;\n case \"Feature\":\n callback(geojson.properties, 0);\n break;\n }\n}\n\n/**\n * Callback for propReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback propReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {*} currentProperties The current Properties being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Reduce properties in any GeoJSON object into a single value,\n * similar to how Array.reduce works. However, in this case we lazily run\n * the reduction, so an array of all properties is unnecessary.\n *\n * @name propReduce\n * @param {FeatureCollection|Feature} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentProperties, featureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.propReduce(features, function (previousValue, currentProperties, featureIndex) {\n * //=previousValue\n * //=currentProperties\n * //=featureIndex\n * return currentProperties\n * });\n */\nfunction propReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n propEach(geojson, function (currentProperties, featureIndex) {\n if (featureIndex === 0 && initialValue === undefined)\n previousValue = currentProperties;\n else\n previousValue = callback(previousValue, currentProperties, featureIndex);\n });\n return previousValue;\n}\n\n/**\n * Callback for featureEach\n *\n * @callback featureEachCallback\n * @param {Feature<any>} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Iterate over features in any GeoJSON object, similar to\n * Array.forEach.\n *\n * @name featureEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentFeature, featureIndex)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.featureEach(features, function (currentFeature, featureIndex) {\n * //=currentFeature\n * //=featureIndex\n * });\n */\nfunction featureEach(geojson, callback) {\n if (geojson.type === \"Feature\") {\n callback(geojson, 0);\n } else if (geojson.type === \"FeatureCollection\") {\n for (var i = 0; i < geojson.features.length; i++) {\n if (callback(geojson.features[i], i) === false) break;\n }\n }\n}\n\n/**\n * Callback for featureReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback featureReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n */\n\n/**\n * Reduce features in any GeoJSON object, similar to Array.reduce().\n *\n * @name featureReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentFeature, featureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {\"foo\": \"bar\"}),\n * turf.point([36, 53], {\"hello\": \"world\"})\n * ]);\n *\n * turf.featureReduce(features, function (previousValue, currentFeature, featureIndex) {\n * //=previousValue\n * //=currentFeature\n * //=featureIndex\n * return currentFeature\n * });\n */\nfunction featureReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n featureEach(geojson, function (currentFeature, featureIndex) {\n if (featureIndex === 0 && initialValue === undefined)\n previousValue = currentFeature;\n else previousValue = callback(previousValue, currentFeature, featureIndex);\n });\n return previousValue;\n}\n\n/**\n * Get all coordinates from any GeoJSON object.\n *\n * @name coordAll\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @returns {Array<Array<number>>} coordinate position array\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * var coords = turf.coordAll(features);\n * //= [[26, 37], [36, 53]]\n */\nfunction coordAll(geojson) {\n var coords = [];\n coordEach(geojson, function (coord) {\n coords.push(coord);\n });\n return coords;\n}\n\n/**\n * Callback for geomEach\n *\n * @callback geomEachCallback\n * @param {Geometry} currentGeometry The current Geometry being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {Object} featureProperties The current Feature Properties being processed.\n * @param {Array<number>} featureBBox The current Feature BBox being processed.\n * @param {number|string} featureId The current Feature Id being processed.\n */\n\n/**\n * Iterate over each geometry in any GeoJSON object, similar to Array.forEach()\n *\n * @name geomEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentGeometry, featureIndex, featureProperties, featureBBox, featureId)\n * @returns {void}\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.geomEach(features, function (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n * //=currentGeometry\n * //=featureIndex\n * //=featureProperties\n * //=featureBBox\n * //=featureId\n * });\n */\nfunction geomEach(geojson, callback) {\n var i,\n j,\n g,\n geometry,\n stopG,\n geometryMaybeCollection,\n isGeometryCollection,\n featureProperties,\n featureBBox,\n featureId,\n featureIndex = 0,\n isFeatureCollection = geojson.type === \"FeatureCollection\",\n isFeature = geojson.type === \"Feature\",\n stop = isFeatureCollection ? geojson.features.length : 1;\n\n // This logic may look a little weird. The reason why it is that way\n // is because it's trying to be fast. GeoJSON supports multiple kinds\n // of objects at its root: FeatureCollection, Features, Geometries.\n // This function has the responsibility of handling all of them, and that\n // means that some of the `for` loops you see below actually just don't apply\n // to certain inputs. For instance, if you give this just a\n // Point geometry, then both loops are short-circuited and all we do\n // is gradually rename the input until it's called 'geometry'.\n //\n // This also aims to allocate as few resources as possible: just a\n // few numbers and booleans, rather than any temporary arrays as would\n // be required with the normalization approach.\n for (i = 0; i < stop; i++) {\n geometryMaybeCollection = isFeatureCollection\n ? geojson.features[i].geometry\n : isFeature\n ? geojson.geometry\n : geojson;\n featureProperties = isFeatureCollection\n ? geojson.features[i].properties\n : isFeature\n ? geojson.properties\n : {};\n featureBBox = isFeatureCollection\n ? geojson.features[i].bbox\n : isFeature\n ? geojson.bbox\n : undefined;\n featureId = isFeatureCollection\n ? geojson.features[i].id\n : isFeature\n ? geojson.id\n : undefined;\n isGeometryCollection = geometryMaybeCollection\n ? geometryMaybeCollection.type === \"GeometryCollection\"\n : false;\n stopG = isGeometryCollection\n ? geometryMaybeCollection.geometries.length\n : 1;\n\n for (g = 0; g < stopG; g++) {\n geometry = isGeometryCollection\n ? geometryMaybeCollection.geometries[g]\n : geometryMaybeCollection;\n\n // Handle null Geometry\n if (geometry === null) {\n if (\n callback(\n null,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false\n )\n return false;\n continue;\n }\n switch (geometry.type) {\n case \"Point\":\n case \"LineString\":\n case \"MultiPoint\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\": {\n if (\n callback(\n geometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false\n )\n return false;\n break;\n }\n case \"GeometryCollection\": {\n for (j = 0; j < geometry.geometries.length; j++) {\n if (\n callback(\n geometry.geometries[j],\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) === false\n )\n return false;\n }\n break;\n }\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n // Only increase `featureIndex` per each feature\n featureIndex++;\n }\n}\n\n/**\n * Callback for geomReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback geomReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Geometry} currentGeometry The current Geometry being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {Object} featureProperties The current Feature Properties being processed.\n * @param {Array<number>} featureBBox The current Feature BBox being processed.\n * @param {number|string} featureId The current Feature Id being processed.\n */\n\n/**\n * Reduce geometry in any GeoJSON object, similar to Array.reduce().\n *\n * @name geomReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.point([36, 53], {hello: 'world'})\n * ]);\n *\n * turf.geomReduce(features, function (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {\n * //=previousValue\n * //=currentGeometry\n * //=featureIndex\n * //=featureProperties\n * //=featureBBox\n * //=featureId\n * return currentGeometry\n * });\n */\nfunction geomReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n geomEach(\n geojson,\n function (\n currentGeometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n ) {\n if (featureIndex === 0 && initialValue === undefined)\n previousValue = currentGeometry;\n else\n previousValue = callback(\n previousValue,\n currentGeometry,\n featureIndex,\n featureProperties,\n featureBBox,\n featureId\n );\n }\n );\n return previousValue;\n}\n\n/**\n * Callback for flattenEach\n *\n * @callback flattenEachCallback\n * @param {Feature} currentFeature The current flattened feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n */\n\n/**\n * Iterate over flattened features in any GeoJSON object, similar to\n * Array.forEach.\n *\n * @name flattenEach\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (currentFeature, featureIndex, multiFeatureIndex)\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.multiPoint([[40, 30], [36, 53]], {hello: 'world'})\n * ]);\n *\n * turf.flattenEach(features, function (currentFeature, featureIndex, multiFeatureIndex) {\n * //=currentFeature\n * //=featureIndex\n * //=multiFeatureIndex\n * });\n */\nfunction flattenEach(geojson, callback) {\n geomEach(geojson, function (geometry, featureIndex, properties, bbox, id) {\n // Callback for single geometry\n var type = geometry === null ? null : geometry.type;\n switch (type) {\n case null:\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n if (\n callback(\n (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.feature)(geometry, properties, { bbox: bbox, id: id }),\n featureIndex,\n 0\n ) === false\n )\n return false;\n return;\n }\n\n var geomType;\n\n // Callback for multi-geometry\n switch (type) {\n case \"MultiPoint\":\n geomType = \"Point\";\n break;\n case \"MultiLineString\":\n geomType = \"LineString\";\n break;\n case \"MultiPolygon\":\n geomType = \"Polygon\";\n break;\n }\n\n for (\n var multiFeatureIndex = 0;\n multiFeatureIndex < geometry.coordinates.length;\n multiFeatureIndex++\n ) {\n var coordinate = geometry.coordinates[multiFeatureIndex];\n var geom = {\n type: geomType,\n coordinates: coordinate,\n };\n if (\n callback((0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.feature)(geom, properties), featureIndex, multiFeatureIndex) ===\n false\n )\n return false;\n }\n });\n}\n\n/**\n * Callback for flattenReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback flattenReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature} currentFeature The current Feature being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n */\n\n/**\n * Reduce flattened features in any GeoJSON object, similar to Array.reduce().\n *\n * @name flattenReduce\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON object\n * @param {Function} callback a method that takes (previousValue, currentFeature, featureIndex, multiFeatureIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var features = turf.featureCollection([\n * turf.point([26, 37], {foo: 'bar'}),\n * turf.multiPoint([[40, 30], [36, 53]], {hello: 'world'})\n * ]);\n *\n * turf.flattenReduce(features, function (previousValue, currentFeature, featureIndex, multiFeatureIndex) {\n * //=previousValue\n * //=currentFeature\n * //=featureIndex\n * //=multiFeatureIndex\n * return currentFeature\n * });\n */\nfunction flattenReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n flattenEach(\n geojson,\n function (currentFeature, featureIndex, multiFeatureIndex) {\n if (\n featureIndex === 0 &&\n multiFeatureIndex === 0 &&\n initialValue === undefined\n )\n previousValue = currentFeature;\n else\n previousValue = callback(\n previousValue,\n currentFeature,\n featureIndex,\n multiFeatureIndex\n );\n }\n );\n return previousValue;\n}\n\n/**\n * Callback for segmentEach\n *\n * @callback segmentEachCallback\n * @param {Feature<LineString>} currentSegment The current Segment being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n * @param {number} segmentIndex The current index of the Segment being processed.\n * @returns {void}\n */\n\n/**\n * Iterate over 2-vertex line segment in any GeoJSON object, similar to Array.forEach()\n * (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON\n * @param {Function} callback a method that takes (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex)\n * @returns {void}\n * @example\n * var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]);\n *\n * // Iterate over GeoJSON by 2-vertex segments\n * turf.segmentEach(polygon, function (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n * //=currentSegment\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * //=segmentIndex\n * });\n *\n * // Calculate the total number of segments\n * var total = 0;\n * turf.segmentEach(polygon, function () {\n * total++;\n * });\n */\nfunction segmentEach(geojson, callback) {\n flattenEach(geojson, function (feature, featureIndex, multiFeatureIndex) {\n var segmentIndex = 0;\n\n // Exclude null Geometries\n if (!feature.geometry) return;\n // (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n var type = feature.geometry.type;\n if (type === \"Point\" || type === \"MultiPoint\") return;\n\n // Generate 2-vertex line segments\n var previousCoords;\n var previousFeatureIndex = 0;\n var previousMultiIndex = 0;\n var prevGeomIndex = 0;\n if (\n coordEach(\n feature,\n function (\n currentCoord,\n coordIndex,\n featureIndexCoord,\n multiPartIndexCoord,\n geometryIndex\n ) {\n // Simulating a meta.coordReduce() since `reduce` operations cannot be stopped by returning `false`\n if (\n previousCoords === undefined ||\n featureIndex > previousFeatureIndex ||\n multiPartIndexCoord > previousMultiIndex ||\n geometryIndex > prevGeomIndex\n ) {\n previousCoords = currentCoord;\n previousFeatureIndex = featureIndex;\n previousMultiIndex = multiPartIndexCoord;\n prevGeomIndex = geometryIndex;\n segmentIndex = 0;\n return;\n }\n var currentSegment = (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.lineString)(\n [previousCoords, currentCoord],\n feature.properties\n );\n if (\n callback(\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n ) === false\n )\n return false;\n segmentIndex++;\n previousCoords = currentCoord;\n }\n ) === false\n )\n return false;\n });\n}\n\n/**\n * Callback for segmentReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback segmentReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature<LineString>} currentSegment The current Segment being processed.\n * @param {number} featureIndex The current index of the Feature being processed.\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed.\n * @param {number} geometryIndex The current index of the Geometry being processed.\n * @param {number} segmentIndex The current index of the Segment being processed.\n */\n\n/**\n * Reduce 2-vertex line segment in any GeoJSON object, similar to Array.reduce()\n * (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson any GeoJSON\n * @param {Function} callback a method that takes (previousValue, currentSegment, currentIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {void}\n * @example\n * var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]);\n *\n * // Iterate over GeoJSON by 2-vertex segments\n * turf.segmentReduce(polygon, function (previousSegment, currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {\n * //= previousSegment\n * //= currentSegment\n * //= featureIndex\n * //= multiFeatureIndex\n * //= geometryIndex\n * //= segmentIndex\n * return currentSegment\n * });\n *\n * // Calculate the total number of segments\n * var initialValue = 0\n * var total = turf.segmentReduce(polygon, function (previousValue) {\n * previousValue++;\n * return previousValue;\n * }, initialValue);\n */\nfunction segmentReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n var started = false;\n segmentEach(\n geojson,\n function (\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n ) {\n if (started === false && initialValue === undefined)\n previousValue = currentSegment;\n else\n previousValue = callback(\n previousValue,\n currentSegment,\n featureIndex,\n multiFeatureIndex,\n geometryIndex,\n segmentIndex\n );\n started = true;\n }\n );\n return previousValue;\n}\n\n/**\n * Callback for lineEach\n *\n * @callback lineEachCallback\n * @param {Feature<LineString>} currentLine The current LineString|LinearRing being processed\n * @param {number} featureIndex The current index of the Feature being processed\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed\n * @param {number} geometryIndex The current index of the Geometry being processed\n */\n\n/**\n * Iterate over line or ring coordinates in LineString, Polygon, MultiLineString, MultiPolygon Features or Geometries,\n * similar to Array.forEach.\n *\n * @name lineEach\n * @param {Geometry|Feature<LineString|Polygon|MultiLineString|MultiPolygon>} geojson object\n * @param {Function} callback a method that takes (currentLine, featureIndex, multiFeatureIndex, geometryIndex)\n * @example\n * var multiLine = turf.multiLineString([\n * [[26, 37], [35, 45]],\n * [[36, 53], [38, 50], [41, 55]]\n * ]);\n *\n * turf.lineEach(multiLine, function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n * //=currentLine\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * });\n */\nfunction lineEach(geojson, callback) {\n // validation\n if (!geojson) throw new Error(\"geojson is required\");\n\n flattenEach(geojson, function (feature, featureIndex, multiFeatureIndex) {\n if (feature.geometry === null) return;\n var type = feature.geometry.type;\n var coords = feature.geometry.coordinates;\n switch (type) {\n case \"LineString\":\n if (callback(feature, featureIndex, multiFeatureIndex, 0, 0) === false)\n return false;\n break;\n case \"Polygon\":\n for (\n var geometryIndex = 0;\n geometryIndex < coords.length;\n geometryIndex++\n ) {\n if (\n callback(\n (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.lineString)(coords[geometryIndex], feature.properties),\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n ) === false\n )\n return false;\n }\n break;\n }\n });\n}\n\n/**\n * Callback for lineReduce\n *\n * The first time the callback function is called, the values provided as arguments depend\n * on whether the reduce method has an initialValue argument.\n *\n * If an initialValue is provided to the reduce method:\n * - The previousValue argument is initialValue.\n * - The currentValue argument is the value of the first element present in the array.\n *\n * If an initialValue is not provided:\n * - The previousValue argument is the value of the first element present in the array.\n * - The currentValue argument is the value of the second element present in the array.\n *\n * @callback lineReduceCallback\n * @param {*} previousValue The accumulated value previously returned in the last invocation\n * of the callback, or initialValue, if supplied.\n * @param {Feature<LineString>} currentLine The current LineString|LinearRing being processed.\n * @param {number} featureIndex The current index of the Feature being processed\n * @param {number} multiFeatureIndex The current index of the Multi-Feature being processed\n * @param {number} geometryIndex The current index of the Geometry being processed\n */\n\n/**\n * Reduce features in any GeoJSON object, similar to Array.reduce().\n *\n * @name lineReduce\n * @param {Geometry|Feature<LineString|Polygon|MultiLineString|MultiPolygon>} geojson object\n * @param {Function} callback a method that takes (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex)\n * @param {*} [initialValue] Value to use as the first argument to the first call of the callback.\n * @returns {*} The value that results from the reduction.\n * @example\n * var multiPoly = turf.multiPolygon([\n * turf.polygon([[[12,48],[2,41],[24,38],[12,48]], [[9,44],[13,41],[13,45],[9,44]]]),\n * turf.polygon([[[5, 5], [0, 0], [2, 2], [4, 4], [5, 5]]])\n * ]);\n *\n * turf.lineReduce(multiPoly, function (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n * //=previousValue\n * //=currentLine\n * //=featureIndex\n * //=multiFeatureIndex\n * //=geometryIndex\n * return currentLine\n * });\n */\nfunction lineReduce(geojson, callback, initialValue) {\n var previousValue = initialValue;\n lineEach(\n geojson,\n function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) {\n if (featureIndex === 0 && initialValue === undefined)\n previousValue = currentLine;\n else\n previousValue = callback(\n previousValue,\n currentLine,\n featureIndex,\n multiFeatureIndex,\n geometryIndex\n );\n }\n );\n return previousValue;\n}\n\n/**\n * Finds a particular 2-vertex LineString Segment from a GeoJSON using `@turf/meta` indexes.\n *\n * Negative indexes are permitted.\n * Point & MultiPoint will always return null.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson Any GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.featureIndex=0] Feature Index\n * @param {number} [options.multiFeatureIndex=0] Multi-Feature Index\n * @param {number} [options.geometryIndex=0] Geometry Index\n * @param {number} [options.segmentIndex=0] Segment Index\n * @param {Object} [options.properties={}] Translate Properties to output LineString\n * @param {BBox} [options.bbox={}] Translate BBox to output LineString\n * @param {number|string} [options.id={}] Translate Id to output LineString\n * @returns {Feature<LineString>} 2-vertex GeoJSON Feature LineString\n * @example\n * var multiLine = turf.multiLineString([\n * [[10, 10], [50, 30], [30, 40]],\n * [[-10, -10], [-50, -30], [-30, -40]]\n * ]);\n *\n * // First Segment (defaults are 0)\n * turf.findSegment(multiLine);\n * // => Feature<LineString<[[10, 10], [50, 30]]>>\n *\n * // First Segment of 2nd Multi Feature\n * turf.findSegment(multiLine, {multiFeatureIndex: 1});\n * // => Feature<LineString<[[-10, -10], [-50, -30]]>>\n *\n * // Last Segment of Last Multi Feature\n * turf.findSegment(multiLine, {multiFeatureIndex: -1, segmentIndex: -1});\n * // => Feature<LineString<[[-50, -30], [-30, -40]]>>\n */\nfunction findSegment(geojson, options) {\n // Optional Parameters\n options = options || {};\n if (!(0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.isObject)(options)) throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var segmentIndex = options.segmentIndex || 0;\n\n // Find FeatureIndex\n var properties = options.properties;\n var geometry;\n\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n\n // Find SegmentIndex\n if (geometry === null) return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n if (segmentIndex < 0) segmentIndex = coords.length + segmentIndex - 1;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.lineString)(\n [coords[segmentIndex], coords[segmentIndex + 1]],\n properties,\n options\n );\n case \"Polygon\":\n if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[geometryIndex].length + segmentIndex - 1;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.lineString)(\n [\n coords[geometryIndex][segmentIndex],\n coords[geometryIndex][segmentIndex + 1],\n ],\n properties,\n options\n );\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (segmentIndex < 0)\n segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.lineString)(\n [\n coords[multiFeatureIndex][segmentIndex],\n coords[multiFeatureIndex][segmentIndex + 1],\n ],\n properties,\n options\n );\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (segmentIndex < 0)\n segmentIndex =\n coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.lineString)(\n [\n coords[multiFeatureIndex][geometryIndex][segmentIndex],\n coords[multiFeatureIndex][geometryIndex][segmentIndex + 1],\n ],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n}\n\n/**\n * Finds a particular Point from a GeoJSON using `@turf/meta` indexes.\n *\n * Negative indexes are permitted.\n *\n * @param {FeatureCollection|Feature|Geometry} geojson Any GeoJSON Feature or Geometry\n * @param {Object} [options={}] Optional parameters\n * @param {number} [options.featureIndex=0] Feature Index\n * @param {number} [options.multiFeatureIndex=0] Multi-Feature Index\n * @param {number} [options.geometryIndex=0] Geometry Index\n * @param {number} [options.coordIndex=0] Coord Index\n * @param {Object} [options.properties={}] Translate Properties to output Point\n * @param {BBox} [options.bbox={}] Translate BBox to output Point\n * @param {number|string} [options.id={}] Translate Id to output Point\n * @returns {Feature<Point>} 2-vertex GeoJSON Feature Point\n * @example\n * var multiLine = turf.multiLineString([\n * [[10, 10], [50, 30], [30, 40]],\n * [[-10, -10], [-50, -30], [-30, -40]]\n * ]);\n *\n * // First Segment (defaults are 0)\n * turf.findPoint(multiLine);\n * // => Feature<Point<[10, 10]>>\n *\n * // First Segment of the 2nd Multi-Feature\n * turf.findPoint(multiLine, {multiFeatureIndex: 1});\n * // => Feature<Point<[-10, -10]>>\n *\n * // Last Segment of last Multi-Feature\n * turf.findPoint(multiLine, {multiFeatureIndex: -1, coordIndex: -1});\n * // => Feature<Point<[-30, -40]>>\n */\nfunction findPoint(geojson, options) {\n // Optional Parameters\n options = options || {};\n if (!(0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.isObject)(options)) throw new Error(\"options is invalid\");\n var featureIndex = options.featureIndex || 0;\n var multiFeatureIndex = options.multiFeatureIndex || 0;\n var geometryIndex = options.geometryIndex || 0;\n var coordIndex = options.coordIndex || 0;\n\n // Find FeatureIndex\n var properties = options.properties;\n var geometry;\n\n switch (geojson.type) {\n case \"FeatureCollection\":\n if (featureIndex < 0)\n featureIndex = geojson.features.length + featureIndex;\n properties = properties || geojson.features[featureIndex].properties;\n geometry = geojson.features[featureIndex].geometry;\n break;\n case \"Feature\":\n properties = properties || geojson.properties;\n geometry = geojson.geometry;\n break;\n case \"Point\":\n case \"MultiPoint\":\n return null;\n case \"LineString\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n geometry = geojson;\n break;\n default:\n throw new Error(\"geojson is invalid\");\n }\n\n // Find Coord Index\n if (geometry === null) return null;\n var coords = geometry.coordinates;\n switch (geometry.type) {\n case \"Point\":\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.point)(coords, properties, options);\n case \"MultiPoint\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.point)(coords[multiFeatureIndex], properties, options);\n case \"LineString\":\n if (coordIndex < 0) coordIndex = coords.length + coordIndex;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.point)(coords[coordIndex], properties, options);\n case \"Polygon\":\n if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex;\n if (coordIndex < 0)\n coordIndex = coords[geometryIndex].length + coordIndex;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.point)(coords[geometryIndex][coordIndex], properties, options);\n case \"MultiLineString\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (coordIndex < 0)\n coordIndex = coords[multiFeatureIndex].length + coordIndex;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.point)(coords[multiFeatureIndex][coordIndex], properties, options);\n case \"MultiPolygon\":\n if (multiFeatureIndex < 0)\n multiFeatureIndex = coords.length + multiFeatureIndex;\n if (geometryIndex < 0)\n geometryIndex = coords[multiFeatureIndex].length + geometryIndex;\n if (coordIndex < 0)\n coordIndex =\n coords[multiFeatureIndex][geometryIndex].length - coordIndex;\n return (0,_turf_helpers__WEBPACK_IMPORTED_MODULE_0__.point)(\n coords[multiFeatureIndex][geometryIndex][coordIndex],\n properties,\n options\n );\n }\n throw new Error(\"geojson is invalid\");\n}\n\n\n\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/@turf/meta/dist/es/index.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/three-laser-pointer/package.json":
|
||
/*!*******************************************************!*\
|
||
!*** ./node_modules/three-laser-pointer/package.json ***!
|
||
\*******************************************************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("module.exports = JSON.parse('{\"_args\":[[\"three-laser-pointer@1.2.3\",\"/Users/pro/ttt/three-geo--debug-node10\"]],\"_development\":true,\"_from\":\"three-laser-pointer@1.2.3\",\"_id\":\"three-laser-pointer@1.2.3\",\"_inBundle\":false,\"_integrity\":\"sha512-YnRblI6KAHRh2rPrmG3k6K+TXftv+Lu2+9cxwj4aBxj41jNsnMkwSGhpoob+jNYvdHXJmDk56Y6oVKbw3v05aA==\",\"_location\":\"/three-laser-pointer\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"three-laser-pointer@1.2.3\",\"name\":\"three-laser-pointer\",\"escapedName\":\"three-laser-pointer\",\"rawSpec\":\"1.2.3\",\"saveSpec\":null,\"fetchSpec\":\"1.2.3\"},\"_requiredBy\":[\"#DEV:/\"],\"_resolved\":\"https://registry.npmjs.org/three-laser-pointer/-/three-laser-pointer-1.2.3.tgz\",\"_spec\":\"1.2.3\",\"_where\":\"/Users/pro/ttt/three-geo--debug-node10\",\"author\":{\"name\":\"j-devel\"},\"bugs\":{\"url\":\"https://github.com/w3reality/three-laser-pointer/issues\"},\"description\":\"Laser pointer object using three.js\",\"devDependencies\":{\"es-pack-js\":\"0.5.5\",\"three\":\"^0.137.0\"},\"directories\":{\"example\":\"examples\",\"test\":\"test\"},\"homepage\":\"https://github.com/w3reality/three-laser-pointer\",\"keywords\":[\"three\",\"laser\",\"pointer\"],\"license\":\"MIT\",\"main\":\"dist/three-laser-pointer.min.js\",\"name\":\"three-laser-pointer\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/w3reality/three-laser-pointer.git\"},\"scripts\":{\"build\":\"es-pack build -m umd\",\"build:esm\":\"es-pack build -m esm\",\"build:esm:compat\":\"es-pack build -m esm-compat\",\"build:examples:terrains\":\"es-pack build ./examples/demo-terrains -d ./examples/demo-terrains/dist -m esm\",\"dev\":\"es-pack build --dev\",\"dist\":\"es-pack build -d ./dist -m umd esm esm-compat\",\"test\":\"npm run test:verify && npm run test:main\",\"test:main\":\"es-pack test --node --browser\",\"test:verify\":\"es-pack build -m umd esm esm-compat --verify\"},\"version\":\"1.2.3\"}');\n\n//# sourceURL=webpack://ThreeGeo/./node_modules/three-laser-pointer/package.json?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./package.json":
|
||
/*!**********************!*\
|
||
!*** ./package.json ***!
|
||
\**********************/
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
eval("module.exports = JSON.parse('{\"name\":\"three-geo\",\"version\":\"1.4.5-dev.5\",\"description\":\"3D geographic visualization library\",\"main\":\"dist/three-geo.min.js\",\"directories\":{\"example\":\"examples\"},\"scripts\":{\"postinstall\":\"([ -d \\'./examples\\' ] && cd ./examples/geo-viewer && npm i || true);\",\"dist\":\"es-pack build -d ./dist -m umd esm esm-compat\",\"build\":\"es-pack build -m umd\",\"build:esm\":\"es-pack build -m esm\",\"build:esm:compat\":\"es-pack build -m esm-compat\",\"test\":\"npm run test:verify && npm run test:main && npm run test:viewer\",\"test:verify\":\"es-pack build -m umd esm esm-compat --verify\",\"test:main\":\"es-pack test --node --browser\",\"test:viewer\":\"(cd ./examples/geo-viewer && es-pack build);\",\"dev\":\"es-pack build --dev\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/w3reality/three-geo.git\"},\"keywords\":[\"three\",\"geo\",\"dataviz\"],\"author\":\"j-devel\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/w3reality/three-geo/issues\"},\"homepage\":\"https://github.com/w3reality/three-geo\",\"devDependencies\":{\"@mapbox/sphericalmercator\":\"^1.1.0\",\"@mapbox/tile-cover\":\"^3.0.2\",\"@mapbox/tilebelt\":\"^1.0.1\",\"@mapbox/vector-tile\":\"^1.3.1\",\"@turf/area\":\"^6.0.1\",\"@turf/destination\":\"^6.0.1\",\"@turf/helpers\":\"^6.1.4\",\"@turf/intersect\":\"^6.1.2\",\"@turf/transform-rotate\":\"^5.1.5\",\"@turf/transform-translate\":\"^5.1.5\",\"@turf/union\":\"6.2.0-alpha.2\",\"es-pack-js\":\"0.5.7\",\"get-pixels\":\"^3.3.3\",\"pbf\":\"^3.1.0\",\"regenerator\":\"^0.14.2\",\"three\":\"^0.138.0\",\"three-laser-pointer\":\"^1.2.3\",\"uniq\":\"^1.0.1\",\"xhr\":\"^2.6.0\"}}');\n\n//# sourceURL=webpack://ThreeGeo/./package.json?");
|
||
|
||
/***/ })
|
||
|
||
/******/ });
|
||
/************************************************************************/
|
||
/******/ // The module cache
|
||
/******/ var __webpack_module_cache__ = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/ // Check if module is in cache
|
||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||
/******/ if (cachedModule !== undefined) {
|
||
/******/ return cachedModule.exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||
/******/ // no module.id needed
|
||
/******/ // no module.loaded needed
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/************************************************************************/
|
||
/******/ /* webpack/runtime/compat get default export */
|
||
/******/ (() => {
|
||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||
/******/ __webpack_require__.n = (module) => {
|
||
/******/ var getter = module && module.__esModule ?
|
||
/******/ () => (module['default']) :
|
||
/******/ () => (module);
|
||
/******/ __webpack_require__.d(getter, { a: getter });
|
||
/******/ return getter;
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/define property getters */
|
||
/******/ (() => {
|
||
/******/ // define getter functions for harmony exports
|
||
/******/ __webpack_require__.d = (exports, definition) => {
|
||
/******/ for(var key in definition) {
|
||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||
/******/ }
|
||
/******/ }
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/global */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.g = (function() {
|
||
/******/ if (typeof globalThis === 'object') return globalThis;
|
||
/******/ try {
|
||
/******/ return this || new Function('return this')();
|
||
/******/ } catch (e) {
|
||
/******/ if (typeof window === 'object') return window;
|
||
/******/ }
|
||
/******/ })();
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/make namespace object */
|
||
/******/ (() => {
|
||
/******/ // define __esModule on exports
|
||
/******/ __webpack_require__.r = (exports) => {
|
||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||
/******/ }
|
||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/************************************************************************/
|
||
/******/
|
||
/******/ // startup
|
||
/******/ // Load entry module and return exports
|
||
/******/ // This entry module can't be inlined because the eval devtool is used.
|
||
/******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
|
||
/******/ __webpack_exports__ = __webpack_exports__["default"];
|
||
/******/
|
||
/******/ return __webpack_exports__;
|
||
/******/ })()
|
||
;
|
||
}); |