- // node_modules/rbush/rbush.min.js
- var require_rbush_min = __commonJS({
- "node_modules/rbush/rbush.min.js"(exports2, module2) {
- !function(t2, i3) {
- "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = i3() : "function" == typeof define && define.amd ? define(i3) : (t2 = t2 || self).RBush = i3();
- }(exports2, function() {
- "use strict";
- function t2(t3, r3, e4, a3, h3) {
- !function t4(n4, r4, e6, a4, h4) {
- for (; a4 > e6; ) {
- if (a4 - e6 > 600) {
- var o3 = a4 - e6 + 1, s3 = r4 - e6 + 1, l3 = Math.log(o3), f3 = 0.5 * Math.exp(2 * l3 / 3), u3 = 0.5 * Math.sqrt(l3 * f3 * (o3 - f3) / o3) * (s3 - o3 / 2 < 0 ? -1 : 1), m3 = Math.max(e6, Math.floor(r4 - s3 * f3 / o3 + u3)), c3 = Math.min(a4, Math.floor(r4 + (o3 - s3) * f3 / o3 + u3));
- t4(n4, r4, m3, c3, h4);
- }
- var p3 = n4[r4], d4 = e6, x2 = a4;
- for (i3(n4, e6, r4), h4(n4[a4], p3) > 0 && i3(n4, e6, a4); d4 < x2; ) {
- for (i3(n4, d4, x2), d4++, x2--; h4(n4[d4], p3) < 0; )
- d4++;
- for (; h4(n4[x2], p3) > 0; )
- x2--;
- }
- 0 === h4(n4[e6], p3) ? i3(n4, e6, x2) : i3(n4, ++x2, a4), x2 <= r4 && (e6 = x2 + 1), r4 <= x2 && (a4 = x2 - 1);
- }
- }(t3, r3, e4 || 0, a3 || t3.length - 1, h3 || n3);
- }
- function i3(t3, i4, n4) {
- var r3 = t3[i4];
- t3[i4] = t3[n4], t3[n4] = r3;
- }
- function n3(t3, i4) {
- return t3 < i4 ? -1 : t3 > i4 ? 1 : 0;
- }
- var r2 = function(t3) {
- void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
- };
- function e3(t3, i4, n4) {
- if (!n4)
- return i4.indexOf(t3);
- for (var r3 = 0; r3 < i4.length; r3++)
- if (n4(t3, i4[r3]))
- return r3;
- return -1;
- }
- function a2(t3, i4) {
- h2(t3, 0, t3.children.length, i4, t3);
- }
- function h2(t3, i4, n4, r3, e4) {
- e4 || (e4 = p2(null)), e4.minX = 1 / 0, e4.minY = 1 / 0, e4.maxX = -1 / 0, e4.maxY = -1 / 0;
- for (var a3 = i4; a3 < n4; a3++) {
- var h3 = t3.children[a3];
- o2(e4, t3.leaf ? r3(h3) : h3);
- }
- return e4;
- }
- function o2(t3, i4) {
- return t3.minX = Math.min(t3.minX, i4.minX), t3.minY = Math.min(t3.minY, i4.minY), t3.maxX = Math.max(t3.maxX, i4.maxX), t3.maxY = Math.max(t3.maxY, i4.maxY), t3;
- }
- function s2(t3, i4) {
- return t3.minX - i4.minX;
- }
- function l2(t3, i4) {
- return t3.minY - i4.minY;
- }
- function f2(t3) {
- return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
- }
- function u2(t3) {
- return t3.maxX - t3.minX + (t3.maxY - t3.minY);
- }
- function m2(t3, i4) {
- return t3.minX <= i4.minX && t3.minY <= i4.minY && i4.maxX <= t3.maxX && i4.maxY <= t3.maxY;
- }
- function c2(t3, i4) {
- return i4.minX <= t3.maxX && i4.minY <= t3.maxY && i4.maxX >= t3.minX && i4.maxY >= t3.minY;
- }
- function p2(t3) {
- return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
- }
- function d2(i4, n4, r3, e4, a3) {
- for (var h3 = [n4, r3]; h3.length; )
- if (!((r3 = h3.pop()) - (n4 = h3.pop()) <= e4)) {
- var o3 = n4 + Math.ceil((r3 - n4) / e4 / 2) * e4;
- t2(i4, o3, n4, r3, a3), h3.push(n4, o3, o3, r3);
- }
- }
- return r2.prototype.all = function() {
- return this._all(this.data, []);
- }, r2.prototype.search = function(t3) {
- var i4 = this.data, n4 = [];
- if (!c2(t3, i4))
- return n4;
- for (var r3 = this.toBBox, e4 = []; i4; ) {
- for (var a3 = 0; a3 < i4.children.length; a3++) {
- var h3 = i4.children[a3], o3 = i4.leaf ? r3(h3) : h3;
- c2(t3, o3) && (i4.leaf ? n4.push(h3) : m2(t3, o3) ? this._all(h3, n4) : e4.push(h3));
- }
- i4 = e4.pop();
- }
- return n4;
- }, r2.prototype.collides = function(t3) {
- var i4 = this.data;
- if (!c2(t3, i4))
- return false;
- for (var n4 = []; i4; ) {
- for (var r3 = 0; r3 < i4.children.length; r3++) {
- var e4 = i4.children[r3], a3 = i4.leaf ? this.toBBox(e4) : e4;
- if (c2(t3, a3)) {
- if (i4.leaf || m2(t3, a3))
- return true;
- n4.push(e4);
- }
- }
- i4 = n4.pop();
- }
- return false;
- }, r2.prototype.load = function(t3) {
- if (!t3 || !t3.length)
- return this;
- if (t3.length < this._minEntries) {
- for (var i4 = 0; i4 < t3.length; i4++)
- this.insert(t3[i4]);
- return this;
- }
- var n4 = this._build(t3.slice(), 0, t3.length - 1, 0);
- if (this.data.children.length)
- if (this.data.height === n4.height)
- this._splitRoot(this.data, n4);
- else {
- if (this.data.height < n4.height) {
- var r3 = this.data;
- this.data = n4, n4 = r3;
- }
- this._insert(n4, this.data.height - n4.height - 1, true);
- }
- else
- this.data = n4;
- return this;
- }, r2.prototype.insert = function(t3) {
- return t3 && this._insert(t3, this.data.height - 1), this;
- }, r2.prototype.clear = function() {
- return this.data = p2([]), this;
- }, r2.prototype.remove = function(t3, i4) {
- if (!t3)
- return this;
- for (var n4, r3, a3, h3 = this.data, o3 = this.toBBox(t3), s3 = [], l3 = []; h3 || s3.length; ) {
- if (h3 || (h3 = s3.pop(), r3 = s3[s3.length - 1], n4 = l3.pop(), a3 = true), h3.leaf) {
- var f3 = e3(t3, h3.children, i4);
- if (-1 !== f3)
- return h3.children.splice(f3, 1), s3.push(h3), this._condense(s3), this;
- }
- a3 || h3.leaf || !m2(h3, o3) ? r3 ? (n4++, h3 = r3.children[n4], a3 = false) : h3 = null : (s3.push(h3), l3.push(n4), n4 = 0, r3 = h3, h3 = h3.children[0]);
- }
- return this;
- }, r2.prototype.toBBox = function(t3) {
- return t3;
- }, r2.prototype.compareMinX = function(t3, i4) {
- return t3.minX - i4.minX;
- }, r2.prototype.compareMinY = function(t3, i4) {
- return t3.minY - i4.minY;
- }, r2.prototype.toJSON = function() {
- return this.data;
- }, r2.prototype.fromJSON = function(t3) {
- return this.data = t3, this;
- }, r2.prototype._all = function(t3, i4) {
- for (var n4 = []; t3; )
- t3.leaf ? i4.push.apply(i4, t3.children) : n4.push.apply(n4, t3.children), t3 = n4.pop();
- return i4;
- }, r2.prototype._build = function(t3, i4, n4, r3) {
- var e4, h3 = n4 - i4 + 1, o3 = this._maxEntries;
- if (h3 <= o3)
- return a2(e4 = p2(t3.slice(i4, n4 + 1)), this.toBBox), e4;
- r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o3)), o3 = Math.ceil(h3 / Math.pow(o3, r3 - 1))), (e4 = p2([])).leaf = false, e4.height = r3;
- var s3 = Math.ceil(h3 / o3), l3 = s3 * Math.ceil(Math.sqrt(o3));
- d2(t3, i4, n4, l3, this.compareMinX);
- for (var f3 = i4; f3 <= n4; f3 += l3) {
- var u3 = Math.min(f3 + l3 - 1, n4);
- d2(t3, f3, u3, s3, this.compareMinY);
- for (var m3 = f3; m3 <= u3; m3 += s3) {
- var c3 = Math.min(m3 + s3 - 1, u3);
- e4.children.push(this._build(t3, m3, c3, r3 - 1));
- }
- }
- return a2(e4, this.toBBox), e4;
- }, r2.prototype._chooseSubtree = function(t3, i4, n4, r3) {
- for (; r3.push(i4), !i4.leaf && r3.length - 1 !== n4; ) {
- for (var e4 = 1 / 0, a3 = 1 / 0, h3 = void 0, o3 = 0; o3 < i4.children.length; o3++) {
- var s3 = i4.children[o3], l3 = f2(s3), u3 = (m3 = t3, c3 = s3, (Math.max(c3.maxX, m3.maxX) - Math.min(c3.minX, m3.minX)) * (Math.max(c3.maxY, m3.maxY) - Math.min(c3.minY, m3.minY)) - l3);
- u3 < a3 ? (a3 = u3, e4 = l3 < e4 ? l3 : e4, h3 = s3) : u3 === a3 && l3 < e4 && (e4 = l3, h3 = s3);
- }
- i4 = h3 || i4.children[0];
- }
- var m3, c3;
- return i4;
- }, r2.prototype._insert = function(t3, i4, n4) {
- var r3 = n4 ? t3 : this.toBBox(t3), e4 = [], a3 = this._chooseSubtree(r3, this.data, i4, e4);
- for (a3.children.push(t3), o2(a3, r3); i4 >= 0 && e4[i4].children.length > this._maxEntries; )
- this._split(e4, i4), i4--;
- this._adjustParentBBoxes(r3, e4, i4);
- }, r2.prototype._split = function(t3, i4) {
- var n4 = t3[i4], r3 = n4.children.length, e4 = this._minEntries;
- this._chooseSplitAxis(n4, e4, r3);
- var h3 = this._chooseSplitIndex(n4, e4, r3), o3 = p2(n4.children.splice(h3, n4.children.length - h3));
- o3.height = n4.height, o3.leaf = n4.leaf, a2(n4, this.toBBox), a2(o3, this.toBBox), i4 ? t3[i4 - 1].children.push(o3) : this._splitRoot(n4, o3);
- }, r2.prototype._splitRoot = function(t3, i4) {
- this.data = p2([t3, i4]), this.data.height = t3.height + 1, this.data.leaf = false, a2(this.data, this.toBBox);
- }, r2.prototype._chooseSplitIndex = function(t3, i4, n4) {
- for (var r3, e4, a3, o3, s3, l3, u3, m3 = 1 / 0, c3 = 1 / 0, p3 = i4; p3 <= n4 - i4; p3++) {
- var d4 = h2(t3, 0, p3, this.toBBox), x2 = h2(t3, p3, n4, this.toBBox), v2 = (e4 = d4, a3 = x2, o3 = void 0, s3 = void 0, l3 = void 0, u3 = void 0, o3 = Math.max(e4.minX, a3.minX), s3 = Math.max(e4.minY, a3.minY), l3 = Math.min(e4.maxX, a3.maxX), u3 = Math.min(e4.maxY, a3.maxY), Math.max(0, l3 - o3) * Math.max(0, u3 - s3)), M2 = f2(d4) + f2(x2);
- v2 < m3 ? (m3 = v2, r3 = p3, c3 = M2 < c3 ? M2 : c3) : v2 === m3 && M2 < c3 && (c3 = M2, r3 = p3);
- }
- return r3 || n4 - i4;
- }, r2.prototype._chooseSplitAxis = function(t3, i4, n4) {
- var r3 = t3.leaf ? this.compareMinX : s2, e4 = t3.leaf ? this.compareMinY : l2;
- this._allDistMargin(t3, i4, n4, r3) < this._allDistMargin(t3, i4, n4, e4) && t3.children.sort(r3);
- }, r2.prototype._allDistMargin = function(t3, i4, n4, r3) {
- t3.children.sort(r3);
- for (var e4 = this.toBBox, a3 = h2(t3, 0, i4, e4), s3 = h2(t3, n4 - i4, n4, e4), l3 = u2(a3) + u2(s3), f3 = i4; f3 < n4 - i4; f3++) {
- var m3 = t3.children[f3];
- o2(a3, t3.leaf ? e4(m3) : m3), l3 += u2(a3);
- }
- for (var c3 = n4 - i4 - 1; c3 >= i4; c3--) {
- var p3 = t3.children[c3];
- o2(s3, t3.leaf ? e4(p3) : p3), l3 += u2(s3);
- }
- return l3;
- }, r2.prototype._adjustParentBBoxes = function(t3, i4, n4) {
- for (var r3 = n4; r3 >= 0; r3--)
- o2(i4[r3], t3);
- }, r2.prototype._condense = function(t3) {
- for (var i4 = t3.length - 1, n4 = void 0; i4 >= 0; i4--)
- 0 === t3[i4].children.length ? i4 > 0 ? (n4 = t3[i4 - 1].children).splice(n4.indexOf(t3[i4]), 1) : this.clear() : a2(t3[i4], this.toBBox);
- }, r2;
- });
- }
- });
-
- // node_modules/ieee754/index.js
- var require_ieee754 = __commonJS({
- "node_modules/ieee754/index.js"(exports2) {
- exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
- var e3, m2;
- var eLen = nBytes * 8 - mLen - 1;
- var eMax = (1 << eLen) - 1;
- var eBias = eMax >> 1;
- var nBits = -7;
- var i3 = isLE ? nBytes - 1 : 0;
- var d2 = isLE ? -1 : 1;
- var s2 = buffer[offset + i3];
- i3 += d2;
- e3 = s2 & (1 << -nBits) - 1;
- s2 >>= -nBits;
- nBits += eLen;
- for (; nBits > 0; e3 = e3 * 256 + buffer[offset + i3], i3 += d2, nBits -= 8) {
- }
- m2 = e3 & (1 << -nBits) - 1;
- e3 >>= -nBits;
- nBits += mLen;
- for (; nBits > 0; m2 = m2 * 256 + buffer[offset + i3], i3 += d2, nBits -= 8) {
- }
- if (e3 === 0) {
- e3 = 1 - eBias;
- } else if (e3 === eMax) {
- return m2 ? NaN : (s2 ? -1 : 1) * Infinity;
- } else {
- m2 = m2 + Math.pow(2, mLen);
- e3 = e3 - eBias;
- }
- return (s2 ? -1 : 1) * m2 * Math.pow(2, e3 - mLen);
- };
- exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
- var e3, m2, c2;
- var eLen = nBytes * 8 - mLen - 1;
- var eMax = (1 << eLen) - 1;
- var eBias = eMax >> 1;
- var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
- var i3 = isLE ? 0 : nBytes - 1;
- var d2 = isLE ? 1 : -1;
- var s2 = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
- value = Math.abs(value);
- if (isNaN(value) || value === Infinity) {
- m2 = isNaN(value) ? 1 : 0;
- e3 = eMax;
- } else {
- e3 = Math.floor(Math.log(value) / Math.LN2);
- if (value * (c2 = Math.pow(2, -e3)) < 1) {
- e3--;
- c2 *= 2;
- }
- if (e3 + eBias >= 1) {
- value += rt / c2;
- } else {
- value += rt * Math.pow(2, 1 - eBias);
- }
- if (value * c2 >= 2) {
- e3++;
- c2 /= 2;
- }
- if (e3 + eBias >= eMax) {
- m2 = 0;
- e3 = eMax;
- } else if (e3 + eBias >= 1) {
- m2 = (value * c2 - 1) * Math.pow(2, mLen);
- e3 = e3 + eBias;
- } else {
- m2 = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
- e3 = 0;
- }
- }
- for (; mLen >= 8; buffer[offset + i3] = m2 & 255, i3 += d2, m2 /= 256, mLen -= 8) {
- }
- e3 = e3 << mLen | m2;
- eLen += mLen;
- for (; eLen > 0; buffer[offset + i3] = e3 & 255, i3 += d2, e3 /= 256, eLen -= 8) {
- }
- buffer[offset + i3 - d2] |= s2 * 128;
- };
- }
- });
-
- // node_modules/pbf/index.js
- var require_pbf = __commonJS({
- "node_modules/pbf/index.js"(exports2, module2) {
- "use strict";
- module2.exports = Pbf;
- var ieee754 = require_ieee754();
- function Pbf(buf) {
- this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
- this.pos = 0;
- this.type = 0;
- this.length = this.buf.length;
- }
- Pbf.Varint = 0;
- Pbf.Fixed64 = 1;
- Pbf.Bytes = 2;
- Pbf.Fixed32 = 5;
- var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
- var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
- var TEXT_DECODER_MIN_LENGTH = 12;
- var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
- Pbf.prototype = {
- destroy: function() {
- this.buf = null;
- },
- // === READING =================================================================
- readFields: function(readField, result, end) {
- end = end || this.length;
- while (this.pos < end) {
- var val = this.readVarint(), tag2 = val >> 3, startPos = this.pos;
- this.type = val & 7;
- readField(tag2, result, this);
- if (this.pos === startPos)
- this.skip(val);
- }
- return result;
- },
- readMessage: function(readField, result) {
- return this.readFields(readField, result, this.readVarint() + this.pos);
- },
- readFixed32: function() {
- var val = readUInt32(this.buf, this.pos);
- this.pos += 4;
- return val;
- },
- readSFixed32: function() {
- var val = readInt32(this.buf, this.pos);
- this.pos += 4;
- return val;
- },
- // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
- readFixed64: function() {
- var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
- this.pos += 8;
- return val;
- },
- readSFixed64: function() {
- var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
- this.pos += 8;
- return val;
- },
- readFloat: function() {
- var val = ieee754.read(this.buf, this.pos, true, 23, 4);
- this.pos += 4;
- return val;
- },
- readDouble: function() {
- var val = ieee754.read(this.buf, this.pos, true, 52, 8);
- this.pos += 8;
- return val;
- },
- readVarint: function(isSigned) {
- var buf = this.buf, val, b2;
- b2 = buf[this.pos++];
- val = b2 & 127;
- if (b2 < 128)
- return val;
- b2 = buf[this.pos++];
- val |= (b2 & 127) << 7;
- if (b2 < 128)
- return val;
- b2 = buf[this.pos++];
- val |= (b2 & 127) << 14;
- if (b2 < 128)
- return val;
- b2 = buf[this.pos++];
- val |= (b2 & 127) << 21;
- if (b2 < 128)
- return val;
- b2 = buf[this.pos];
- val |= (b2 & 15) << 28;
- return readVarintRemainder(val, isSigned, this);
- },
- readVarint64: function() {
- return this.readVarint(true);
- },
- readSVarint: function() {
- var num = this.readVarint();
- return num % 2 === 1 ? (num + 1) / -2 : num / 2;
- },
- readBoolean: function() {
- return Boolean(this.readVarint());
- },
- readString: function() {
- var end = this.readVarint() + this.pos;
- var pos = this.pos;
- this.pos = end;
- if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
- return readUtf8TextDecoder(this.buf, pos, end);
- }
- return readUtf8(this.buf, pos, end);
- },
- readBytes: function() {
- var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
- this.pos = end;
- return buffer;
- },
- // verbose for performance reasons; doesn't affect gzipped size
- readPackedVarint: function(arr, isSigned) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readVarint(isSigned));
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readVarint(isSigned));
- return arr;
- },
- readPackedSVarint: function(arr) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readSVarint());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readSVarint());
- return arr;
- },
- readPackedBoolean: function(arr) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readBoolean());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readBoolean());
- return arr;
- },
- readPackedFloat: function(arr) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readFloat());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readFloat());
- return arr;
- },
- readPackedDouble: function(arr) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readDouble());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readDouble());
- return arr;
- },
- readPackedFixed32: function(arr) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readFixed32());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readFixed32());
- return arr;
- },
- readPackedSFixed32: function(arr) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readSFixed32());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readSFixed32());
- return arr;
- },
- readPackedFixed64: function(arr) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readFixed64());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readFixed64());
- return arr;
- },
- readPackedSFixed64: function(arr) {
- if (this.type !== Pbf.Bytes)
- return arr.push(this.readSFixed64());
- var end = readPackedEnd(this);
- arr = arr || [];
- while (this.pos < end)
- arr.push(this.readSFixed64());
- return arr;
- },
- skip: function(val) {
- var type2 = val & 7;
- if (type2 === Pbf.Varint)
- while (this.buf[this.pos++] > 127) {
- }
- else if (type2 === Pbf.Bytes)
- this.pos = this.readVarint() + this.pos;
- else if (type2 === Pbf.Fixed32)
- this.pos += 4;
- else if (type2 === Pbf.Fixed64)
- this.pos += 8;
- else
- throw new Error("Unimplemented type: " + type2);
- },
- // === WRITING =================================================================
- writeTag: function(tag2, type2) {
- this.writeVarint(tag2 << 3 | type2);
- },
- realloc: function(min3) {
- var length2 = this.length || 16;
- while (length2 < this.pos + min3)
- length2 *= 2;
- if (length2 !== this.length) {
- var buf = new Uint8Array(length2);
- buf.set(this.buf);
- this.buf = buf;
- this.length = length2;
- }
- },
- finish: function() {
- this.length = this.pos;
- this.pos = 0;
- return this.buf.subarray(0, this.length);
- },
- writeFixed32: function(val) {
- this.realloc(4);
- writeInt32(this.buf, val, this.pos);
- this.pos += 4;
- },
- writeSFixed32: function(val) {
- this.realloc(4);
- writeInt32(this.buf, val, this.pos);
- this.pos += 4;
- },
- writeFixed64: function(val) {
- this.realloc(8);
- writeInt32(this.buf, val & -1, this.pos);
- writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
- this.pos += 8;
- },
- writeSFixed64: function(val) {
- this.realloc(8);
- writeInt32(this.buf, val & -1, this.pos);
- writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
- this.pos += 8;
- },
- writeVarint: function(val) {
- val = +val || 0;
- if (val > 268435455 || val < 0) {
- writeBigVarint(val, this);
- return;
- }
- this.realloc(4);
- this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
- if (val <= 127)
- return;
- this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
- if (val <= 127)
- return;
- this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
- if (val <= 127)
- return;
- this.buf[this.pos++] = val >>> 7 & 127;
- },
- writeSVarint: function(val) {
- this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
- },
- writeBoolean: function(val) {
- this.writeVarint(Boolean(val));
- },
- writeString: function(str) {
- str = String(str);
- this.realloc(str.length * 4);
- this.pos++;
- var startPos = this.pos;
- this.pos = writeUtf8(this.buf, str, this.pos);
- var len = this.pos - startPos;
- if (len >= 128)
- makeRoomForExtraLength(startPos, len, this);
- this.pos = startPos - 1;
- this.writeVarint(len);
- this.pos += len;
- },
- writeFloat: function(val) {
- this.realloc(4);
- ieee754.write(this.buf, val, this.pos, true, 23, 4);
- this.pos += 4;
- },
- writeDouble: function(val) {
- this.realloc(8);
- ieee754.write(this.buf, val, this.pos, true, 52, 8);
- this.pos += 8;
- },
- writeBytes: function(buffer) {
- var len = buffer.length;
- this.writeVarint(len);
- this.realloc(len);
- for (var i3 = 0; i3 < len; i3++)
- this.buf[this.pos++] = buffer[i3];
- },
- writeRawMessage: function(fn, obj) {
- this.pos++;
- var startPos = this.pos;
- fn(obj, this);
- var len = this.pos - startPos;
- if (len >= 128)
- makeRoomForExtraLength(startPos, len, this);
- this.pos = startPos - 1;
- this.writeVarint(len);
- this.pos += len;
- },
- writeMessage: function(tag2, fn, obj) {
- this.writeTag(tag2, Pbf.Bytes);
- this.writeRawMessage(fn, obj);
- },
- writePackedVarint: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedVarint, arr);
- },
- writePackedSVarint: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedSVarint, arr);
- },
- writePackedBoolean: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedBoolean, arr);
- },
- writePackedFloat: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedFloat, arr);
- },
- writePackedDouble: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedDouble, arr);
- },
- writePackedFixed32: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedFixed32, arr);
- },
- writePackedSFixed32: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedSFixed32, arr);
- },
- writePackedFixed64: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedFixed64, arr);
- },
- writePackedSFixed64: function(tag2, arr) {
- if (arr.length)
- this.writeMessage(tag2, writePackedSFixed64, arr);
- },
- writeBytesField: function(tag2, buffer) {
- this.writeTag(tag2, Pbf.Bytes);
- this.writeBytes(buffer);
- },
- writeFixed32Field: function(tag2, val) {
- this.writeTag(tag2, Pbf.Fixed32);
- this.writeFixed32(val);
- },
- writeSFixed32Field: function(tag2, val) {
- this.writeTag(tag2, Pbf.Fixed32);
- this.writeSFixed32(val);
- },
- writeFixed64Field: function(tag2, val) {
- this.writeTag(tag2, Pbf.Fixed64);
- this.writeFixed64(val);
- },
- writeSFixed64Field: function(tag2, val) {
- this.writeTag(tag2, Pbf.Fixed64);
- this.writeSFixed64(val);
- },
- writeVarintField: function(tag2, val) {
- this.writeTag(tag2, Pbf.Varint);
- this.writeVarint(val);
- },
- writeSVarintField: function(tag2, val) {
- this.writeTag(tag2, Pbf.Varint);
- this.writeSVarint(val);
- },
- writeStringField: function(tag2, str) {
- this.writeTag(tag2, Pbf.Bytes);
- this.writeString(str);
- },
- writeFloatField: function(tag2, val) {
- this.writeTag(tag2, Pbf.Fixed32);
- this.writeFloat(val);
- },
- writeDoubleField: function(tag2, val) {
- this.writeTag(tag2, Pbf.Fixed64);
- this.writeDouble(val);
- },
- writeBooleanField: function(tag2, val) {
- this.writeVarintField(tag2, Boolean(val));
- }
- };
- function readVarintRemainder(l2, s2, p2) {
- var buf = p2.buf, h2, b2;
- b2 = buf[p2.pos++];
- h2 = (b2 & 112) >> 4;
- if (b2 < 128)
- return toNum(l2, h2, s2);
- b2 = buf[p2.pos++];
- h2 |= (b2 & 127) << 3;
- if (b2 < 128)
- return toNum(l2, h2, s2);
- b2 = buf[p2.pos++];
- h2 |= (b2 & 127) << 10;
- if (b2 < 128)
- return toNum(l2, h2, s2);
- b2 = buf[p2.pos++];
- h2 |= (b2 & 127) << 17;
- if (b2 < 128)
- return toNum(l2, h2, s2);
- b2 = buf[p2.pos++];
- h2 |= (b2 & 127) << 24;
- if (b2 < 128)
- return toNum(l2, h2, s2);
- b2 = buf[p2.pos++];
- h2 |= (b2 & 1) << 31;
- if (b2 < 128)
- return toNum(l2, h2, s2);
- throw new Error("Expected varint not more than 10 bytes");
- }
- function readPackedEnd(pbf) {
- return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
- }
- function toNum(low, high, isSigned) {
- if (isSigned) {
- return high * 4294967296 + (low >>> 0);
- }
- return (high >>> 0) * 4294967296 + (low >>> 0);
- }
- function writeBigVarint(val, pbf) {
- var low, high;
- if (val >= 0) {
- low = val % 4294967296 | 0;
- high = val / 4294967296 | 0;
- } else {
- low = ~(-val % 4294967296);
- high = ~(-val / 4294967296);
- if (low ^ 4294967295) {
- low = low + 1 | 0;
- } else {
- low = 0;
- high = high + 1 | 0;
- }
- }
- if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
- throw new Error("Given varint doesn't fit into 10 bytes");
- }
- pbf.realloc(10);
- writeBigVarintLow(low, high, pbf);
- writeBigVarintHigh(high, pbf);
- }
- function writeBigVarintLow(low, high, pbf) {
- pbf.buf[pbf.pos++] = low & 127 | 128;
- low >>>= 7;
- pbf.buf[pbf.pos++] = low & 127 | 128;
- low >>>= 7;
- pbf.buf[pbf.pos++] = low & 127 | 128;
- low >>>= 7;
- pbf.buf[pbf.pos++] = low & 127 | 128;
- low >>>= 7;
- pbf.buf[pbf.pos] = low & 127;
- }
- function writeBigVarintHigh(high, pbf) {
- var lsb = (high & 7) << 4;
- pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
- if (!high)
- return;
- pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
- if (!high)
- return;
- pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
- if (!high)
- return;
- pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
- if (!high)
- return;
- pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
- if (!high)
- return;
- pbf.buf[pbf.pos++] = high & 127;
- }
- function makeRoomForExtraLength(startPos, len, pbf) {
- var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
- pbf.realloc(extraLen);
- for (var i3 = pbf.pos - 1; i3 >= startPos; i3--)
- pbf.buf[i3 + extraLen] = pbf.buf[i3];
- }
- function writePackedVarint(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeVarint(arr[i3]);
- }
- function writePackedSVarint(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeSVarint(arr[i3]);
- }
- function writePackedFloat(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeFloat(arr[i3]);
- }
- function writePackedDouble(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeDouble(arr[i3]);
- }
- function writePackedBoolean(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeBoolean(arr[i3]);
- }
- function writePackedFixed32(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeFixed32(arr[i3]);
- }
- function writePackedSFixed32(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeSFixed32(arr[i3]);
- }
- function writePackedFixed64(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeFixed64(arr[i3]);
- }
- function writePackedSFixed64(arr, pbf) {
- for (var i3 = 0; i3 < arr.length; i3++)
- pbf.writeSFixed64(arr[i3]);
- }
- function readUInt32(buf, pos) {
- return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
- }
- function writeInt32(buf, val, pos) {
- buf[pos] = val;
- buf[pos + 1] = val >>> 8;
- buf[pos + 2] = val >>> 16;
- buf[pos + 3] = val >>> 24;
- }
- function readInt32(buf, pos) {
- return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
- }
- function readUtf8(buf, pos, end) {
- var str = "";
- var i3 = pos;
- while (i3 < end) {
- var b0 = buf[i3];
- var c2 = null;
- var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
- if (i3 + bytesPerSequence > end)
- break;
- var b1, b2, b3;
- if (bytesPerSequence === 1) {
- if (b0 < 128) {
- c2 = b0;
- }
- } else if (bytesPerSequence === 2) {
- b1 = buf[i3 + 1];
- if ((b1 & 192) === 128) {
- c2 = (b0 & 31) << 6 | b1 & 63;
- if (c2 <= 127) {
- c2 = null;
- }
- }
- } else if (bytesPerSequence === 3) {
- b1 = buf[i3 + 1];
- b2 = buf[i3 + 2];
- if ((b1 & 192) === 128 && (b2 & 192) === 128) {
- c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
- if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
- c2 = null;
- }
- }
- } else if (bytesPerSequence === 4) {
- b1 = buf[i3 + 1];
- b2 = buf[i3 + 2];
- b3 = buf[i3 + 3];
- if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
- c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
- if (c2 <= 65535 || c2 >= 1114112) {
- c2 = null;
- }
- }
- }
- if (c2 === null) {
- c2 = 65533;
- bytesPerSequence = 1;
- } else if (c2 > 65535) {
- c2 -= 65536;
- str += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
- c2 = 56320 | c2 & 1023;
- }
- str += String.fromCharCode(c2);
- i3 += bytesPerSequence;
- }
- return str;
- }
- function readUtf8TextDecoder(buf, pos, end) {
- return utf8TextDecoder.decode(buf.subarray(pos, end));
- }
- function writeUtf8(buf, str, pos) {
- for (var i3 = 0, c2, lead; i3 < str.length; i3++) {
- c2 = str.charCodeAt(i3);
- if (c2 > 55295 && c2 < 57344) {
- if (lead) {
- if (c2 < 56320) {
- buf[pos++] = 239;
- buf[pos++] = 191;
- buf[pos++] = 189;
- lead = c2;
- continue;
- } else {
- c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
- lead = null;
- }
- } else {
- if (c2 > 56319 || i3 + 1 === str.length) {
- buf[pos++] = 239;
- buf[pos++] = 191;
- buf[pos++] = 189;
- } else {
- lead = c2;
- }
- continue;
- }
- } else if (lead) {
- buf[pos++] = 239;
- buf[pos++] = 191;
- buf[pos++] = 189;
- lead = null;
- }
- if (c2 < 128) {
- buf[pos++] = c2;
- } else {
- if (c2 < 2048) {
- buf[pos++] = c2 >> 6 | 192;
- } else {
- if (c2 < 65536) {
- buf[pos++] = c2 >> 12 | 224;
- } else {
- buf[pos++] = c2 >> 18 | 240;
- buf[pos++] = c2 >> 12 & 63 | 128;
- }
- buf[pos++] = c2 >> 6 & 63 | 128;
- }
- buf[pos++] = c2 & 63 | 128;
- }
- }
- return pos;
- }
- }
- });
-
- // node_modules/@mapbox/point-geometry/index.js
- var require_point_geometry = __commonJS({
- "node_modules/@mapbox/point-geometry/index.js"(exports2, module2) {
- "use strict";
- module2.exports = Point;
- function Point(x2, y2) {
- this.x = x2;
- this.y = y2;
- }
- Point.prototype = {
- /**
- * Clone this point, returning a new point that can be modified
- * without affecting the old one.
- * @return {Point} the clone
- */
- clone: function() {
- return new Point(this.x, this.y);
- },
- /**
- * Add this point's x & y coordinates to another point,
- * yielding a new point.
- * @param {Point} p the other point
- * @return {Point} output point
- */
- add: function(p2) {
- return this.clone()._add(p2);
- },
- /**
- * Subtract this point's x & y coordinates to from point,
- * yielding a new point.
- * @param {Point} p the other point
- * @return {Point} output point
- */
- sub: function(p2) {
- return this.clone()._sub(p2);
- },
- /**
- * Multiply this point's x & y coordinates by point,
- * yielding a new point.
- * @param {Point} p the other point
- * @return {Point} output point
- */
- multByPoint: function(p2) {
- return this.clone()._multByPoint(p2);
- },
- /**
- * Divide this point's x & y coordinates by point,
- * yielding a new point.
- * @param {Point} p the other point
- * @return {Point} output point
- */
- divByPoint: function(p2) {
- return this.clone()._divByPoint(p2);
- },
- /**
- * Multiply this point's x & y coordinates by a factor,
- * yielding a new point.
- * @param {Point} k factor
- * @return {Point} output point
- */
- mult: function(k2) {
- return this.clone()._mult(k2);
- },
- /**
- * Divide this point's x & y coordinates by a factor,
- * yielding a new point.
- * @param {Point} k factor
- * @return {Point} output point
- */
- div: function(k2) {
- return this.clone()._div(k2);
- },
- /**
- * Rotate this point around the 0, 0 origin by an angle a,
- * given in radians
- * @param {Number} a angle to rotate around, in radians
- * @return {Point} output point
- */
- rotate: function(a2) {
- return this.clone()._rotate(a2);
- },
- /**
- * Rotate this point around p point by an angle a,
- * given in radians
- * @param {Number} a angle to rotate around, in radians
- * @param {Point} p Point to rotate around
- * @return {Point} output point
- */
- rotateAround: function(a2, p2) {
- return this.clone()._rotateAround(a2, p2);
- },
- /**
- * Multiply this point by a 4x1 transformation matrix
- * @param {Array<Number>} m transformation matrix
- * @return {Point} output point
- */
- matMult: function(m2) {
- return this.clone()._matMult(m2);
- },
- /**
- * Calculate this point but as a unit vector from 0, 0, meaning
- * that the distance from the resulting point to the 0, 0
- * coordinate will be equal to 1 and the angle from the resulting
- * point to the 0, 0 coordinate will be the same as before.
- * @return {Point} unit vector point
- */
- unit: function() {
- return this.clone()._unit();
- },
- /**
- * Compute a perpendicular point, where the new y coordinate
- * is the old x coordinate and the new x coordinate is the old y
- * coordinate multiplied by -1
- * @return {Point} perpendicular point
- */
- perp: function() {
- return this.clone()._perp();
- },
- /**
- * Return a version of this point with the x & y coordinates
- * rounded to integers.
- * @return {Point} rounded point
- */
- round: function() {
- return this.clone()._round();
- },
- /**
- * Return the magitude of this point: this is the Euclidean
- * distance from the 0, 0 coordinate to this point's x and y
- * coordinates.
- * @return {Number} magnitude
- */
- mag: function() {
- return Math.sqrt(this.x * this.x + this.y * this.y);
- },
- /**
- * Judge whether this point is equal to another point, returning
- * true or false.
- * @param {Point} other the other point
- * @return {boolean} whether the points are equal
- */
- equals: function(other) {
- return this.x === other.x && this.y === other.y;
- },
- /**
- * Calculate the distance from this point to another point
- * @param {Point} p the other point
- * @return {Number} distance
- */
- dist: function(p2) {
- return Math.sqrt(this.distSqr(p2));
- },
- /**
- * Calculate the distance from this point to another point,
- * without the square root step. Useful if you're comparing
- * relative distances.
- * @param {Point} p the other point
- * @return {Number} distance
- */
- distSqr: function(p2) {
- var dx = p2.x - this.x, dy = p2.y - this.y;
- return dx * dx + dy * dy;
- },
- /**
- * Get the angle from the 0, 0 coordinate to this point, in radians
- * coordinates.
- * @return {Number} angle
- */
- angle: function() {
- return Math.atan2(this.y, this.x);
- },
- /**
- * Get the angle from this point to another point, in radians
- * @param {Point} b the other point
- * @return {Number} angle
- */
- angleTo: function(b2) {
- return Math.atan2(this.y - b2.y, this.x - b2.x);
- },
- /**
- * Get the angle between this point and another point, in radians
- * @param {Point} b the other point
- * @return {Number} angle
- */
- angleWith: function(b2) {
- return this.angleWithSep(b2.x, b2.y);
- },
- /*
- * Find the angle of the two vectors, solving the formula for
- * the cross product a x b = |a||b|sin(θ) for θ.
- * @param {Number} x the x-coordinate
- * @param {Number} y the y-coordinate
- * @return {Number} the angle in radians
- */
- angleWithSep: function(x2, y2) {
- return Math.atan2(
- this.x * y2 - this.y * x2,
- this.x * x2 + this.y * y2
- );
- },
- _matMult: function(m2) {
- var x2 = m2[0] * this.x + m2[1] * this.y, y2 = m2[2] * this.x + m2[3] * this.y;
- this.x = x2;
- this.y = y2;
- return this;
- },
- _add: function(p2) {
- this.x += p2.x;
- this.y += p2.y;
- return this;
- },
- _sub: function(p2) {
- this.x -= p2.x;
- this.y -= p2.y;
- return this;
- },
- _mult: function(k2) {
- this.x *= k2;
- this.y *= k2;
- return this;
- },
- _div: function(k2) {
- this.x /= k2;
- this.y /= k2;
- return this;
- },
- _multByPoint: function(p2) {
- this.x *= p2.x;
- this.y *= p2.y;
- return this;
- },
- _divByPoint: function(p2) {
- this.x /= p2.x;
- this.y /= p2.y;
- return this;
- },
- _unit: function() {
- this._div(this.mag());
- return this;
- },
- _perp: function() {
- var y2 = this.y;
- this.y = this.x;
- this.x = -y2;
- return this;
- },
- _rotate: function(angle2) {
- var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
- this.x = x2;
- this.y = y2;
- return this;
- },
- _rotateAround: function(angle2, p2) {
- var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = p2.x + cos2 * (this.x - p2.x) - sin2 * (this.y - p2.y), y2 = p2.y + sin2 * (this.x - p2.x) + cos2 * (this.y - p2.y);
- this.x = x2;
- this.y = y2;
- return this;
- },
- _round: function() {
- this.x = Math.round(this.x);
- this.y = Math.round(this.y);
- return this;
- }
- };
- Point.convert = function(a2) {
- if (a2 instanceof Point) {
- return a2;
- }
- if (Array.isArray(a2)) {
- return new Point(a2[0], a2[1]);
- }
- return a2;
- };
- }
- });
-
- // node_modules/@mapbox/vector-tile/lib/vectortilefeature.js
- var require_vectortilefeature = __commonJS({
- "node_modules/@mapbox/vector-tile/lib/vectortilefeature.js"(exports2, module2) {
- "use strict";
- var Point = require_point_geometry();
- module2.exports = VectorTileFeature;
- function VectorTileFeature(pbf, end, extent, keys2, values) {
- this.properties = {};
- this.extent = extent;
- this.type = 0;
- this._pbf = pbf;
- this._geometry = -1;
- this._keys = keys2;
- this._values = values;
- pbf.readFields(readFeature, this, end);
- }
- function readFeature(tag2, feature3, pbf) {
- if (tag2 == 1)
- feature3.id = pbf.readVarint();
- else if (tag2 == 2)
- readTag(pbf, feature3);
- else if (tag2 == 3)
- feature3.type = pbf.readVarint();
- else if (tag2 == 4)
- feature3._geometry = pbf.pos;
- }
- function readTag(pbf, feature3) {
- var end = pbf.readVarint() + pbf.pos;
- while (pbf.pos < end) {
- var key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
- feature3.properties[key] = value;
- }
- }
- VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
- VectorTileFeature.prototype.loadGeometry = function() {
- var pbf = this._pbf;
- pbf.pos = this._geometry;
- var end = pbf.readVarint() + pbf.pos, cmd = 1, length2 = 0, x2 = 0, y2 = 0, lines = [], line;
- while (pbf.pos < end) {
- if (length2 <= 0) {
- var cmdLen = pbf.readVarint();
- cmd = cmdLen & 7;
- length2 = cmdLen >> 3;
- }
- length2--;
- if (cmd === 1 || cmd === 2) {
- x2 += pbf.readSVarint();
- y2 += pbf.readSVarint();
- if (cmd === 1) {
- if (line)
- lines.push(line);
- line = [];
- }
- line.push(new Point(x2, y2));
- } else if (cmd === 7) {
- if (line) {
- line.push(line[0].clone());
- }
- } else {
- throw new Error("unknown command " + cmd);
- }
- }
- if (line)
- lines.push(line);
- return lines;
- };
- VectorTileFeature.prototype.bbox = function() {
- var pbf = this._pbf;
- pbf.pos = this._geometry;
- var end = pbf.readVarint() + pbf.pos, cmd = 1, length2 = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
- while (pbf.pos < end) {
- if (length2 <= 0) {
- var cmdLen = pbf.readVarint();
- cmd = cmdLen & 7;
- length2 = cmdLen >> 3;
- }
- length2--;
- if (cmd === 1 || cmd === 2) {
- x2 += pbf.readSVarint();
- y2 += pbf.readSVarint();
- if (x2 < x12)
- x12 = x2;
- if (x2 > x22)
- x22 = x2;
- if (y2 < y12)
- y12 = y2;
- if (y2 > y22)
- y22 = y2;
- } else if (cmd !== 7) {
- throw new Error("unknown command " + cmd);
- }
- }
- return [x12, y12, x22, y22];
- };
- VectorTileFeature.prototype.toGeoJSON = function(x2, y2, z2) {
- var size = this.extent * Math.pow(2, z2), x05 = this.extent * x2, y05 = this.extent * y2, coords = this.loadGeometry(), type2 = VectorTileFeature.types[this.type], i3, j2;
- function project(line) {
- for (var j3 = 0; j3 < line.length; j3++) {
- var p2 = line[j3], y22 = 180 - (p2.y + y05) * 360 / size;
- line[j3] = [
- (p2.x + x05) * 360 / size - 180,
- 360 / Math.PI * Math.atan(Math.exp(y22 * Math.PI / 180)) - 90
- ];
- }
- }
- switch (this.type) {
- case 1:
- var points = [];
- for (i3 = 0; i3 < coords.length; i3++) {
- points[i3] = coords[i3][0];
- }
- coords = points;
- project(coords);
- break;
- case 2:
- for (i3 = 0; i3 < coords.length; i3++) {
- project(coords[i3]);
- }
- break;
- case 3:
- coords = classifyRings(coords);
- for (i3 = 0; i3 < coords.length; i3++) {
- for (j2 = 0; j2 < coords[i3].length; j2++) {
- project(coords[i3][j2]);
- }
- }
- break;
- }
- if (coords.length === 1) {
- coords = coords[0];
- } else {
- type2 = "Multi" + type2;
- }
- var result = {
- type: "Feature",
- geometry: {
- type: type2,
- coordinates: coords
- },
- properties: this.properties
- };
- if ("id" in this) {
- result.id = this.id;
- }
- return result;
- };
- function classifyRings(rings) {
- var len = rings.length;
- if (len <= 1)
- return [rings];
- var polygons = [], polygon2, ccw;
- for (var i3 = 0; i3 < len; i3++) {
- var area = signedArea(rings[i3]);
- if (area === 0)
- continue;
- if (ccw === void 0)
- ccw = area < 0;
- if (ccw === area < 0) {
- if (polygon2)
- polygons.push(polygon2);
- polygon2 = [rings[i3]];
- } else {
- polygon2.push(rings[i3]);
- }
- }
- if (polygon2)
- polygons.push(polygon2);
- return polygons;
- }
- function signedArea(ring) {
- var sum = 0;
- for (var i3 = 0, len = ring.length, j2 = len - 1, p1, p2; i3 < len; j2 = i3++) {
- p1 = ring[i3];
- p2 = ring[j2];
- sum += (p2.x - p1.x) * (p1.y + p2.y);
- }
- return sum;
- }
- }
- });
-
- // node_modules/@mapbox/vector-tile/lib/vectortilelayer.js
- var require_vectortilelayer = __commonJS({
- "node_modules/@mapbox/vector-tile/lib/vectortilelayer.js"(exports2, module2) {
- "use strict";
- var VectorTileFeature = require_vectortilefeature();
- module2.exports = VectorTileLayer;
- function VectorTileLayer(pbf, end) {
- this.version = 1;
- this.name = null;
- this.extent = 4096;
- this.length = 0;
- this._pbf = pbf;
- this._keys = [];
- this._values = [];
- this._features = [];
- pbf.readFields(readLayer, this, end);
- this.length = this._features.length;
- }
- function readLayer(tag2, layer, pbf) {
- if (tag2 === 15)
- layer.version = pbf.readVarint();
- else if (tag2 === 1)
- layer.name = pbf.readString();
- else if (tag2 === 5)
- layer.extent = pbf.readVarint();
- else if (tag2 === 2)
- layer._features.push(pbf.pos);
- else if (tag2 === 3)
- layer._keys.push(pbf.readString());
- else if (tag2 === 4)
- layer._values.push(readValueMessage(pbf));
- }
- function readValueMessage(pbf) {
- var value = null, end = pbf.readVarint() + pbf.pos;
- while (pbf.pos < end) {
- var tag2 = pbf.readVarint() >> 3;
- value = tag2 === 1 ? pbf.readString() : tag2 === 2 ? pbf.readFloat() : tag2 === 3 ? pbf.readDouble() : tag2 === 4 ? pbf.readVarint64() : tag2 === 5 ? pbf.readVarint() : tag2 === 6 ? pbf.readSVarint() : tag2 === 7 ? pbf.readBoolean() : null;
- }
- return value;
- }
- VectorTileLayer.prototype.feature = function(i3) {
- if (i3 < 0 || i3 >= this._features.length)
- throw new Error("feature index out of bounds");
- this._pbf.pos = this._features[i3];
- var end = this._pbf.readVarint() + this._pbf.pos;
- return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
- };
- }
- });
-
- // node_modules/@mapbox/vector-tile/lib/vectortile.js
- var require_vectortile = __commonJS({
- "node_modules/@mapbox/vector-tile/lib/vectortile.js"(exports2, module2) {
- "use strict";
- var VectorTileLayer = require_vectortilelayer();
- module2.exports = VectorTile3;
- function VectorTile3(pbf, end) {
- this.layers = pbf.readFields(readTile, {}, end);
- }
- function readTile(tag2, layers, pbf) {
- if (tag2 === 3) {
- var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
- if (layer.length)
- layers[layer.name] = layer;
- }
- }
- }
- });
-
- // node_modules/@mapbox/vector-tile/index.js
- var require_vector_tile = __commonJS({
- "node_modules/@mapbox/vector-tile/index.js"(exports2, module2) {
- module2.exports.VectorTile = require_vectortile();
- module2.exports.VectorTileFeature = require_vectortilefeature();
- module2.exports.VectorTileLayer = require_vectortilelayer();
- }
- });
-