@loaders.gl/mvt 3.1.0-alpha.2 → 4.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,2287 @@
1
- !function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=10)}([function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){t.exports=r(8)},function(t,e){function r(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var s=t.apply(e,n);function a(t){r(s,i,o,a,u,"next",t)}function u(t){r(s,i,o,a,u,"throw",t)}a(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){"use strict";t.exports=i;var n=r(9);function i(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var o="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function s(t){return t.type===i.Bytes?t.readVarint()+t.pos:t.pos+1}function a(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function u(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function f(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function l(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function h(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function c(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function p(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function d(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function y(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function v(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function g(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function x(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function w(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function b(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}i.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=b(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=x(this.buf,this.pos)+4294967296*x(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=x(this.buf,this.pos)+4294967296*b(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(i=o[r.pos++],n=(112&i)>>4,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<3,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<10,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<17,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(127&i)<<24,i<128)return a(t,n,e);if(i=o[r.pos++],n|=(1&i)<<31,i<128)return a(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&o?function(t,e,r){return o.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){var n="",i=e;for(;i<r;){var o,s,a,u=t[i],f=null,l=u>239?4:u>223?3:u>191?2:1;if(i+l>r)break;1===l?u<128&&(f=u):2===l?128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)<=127&&(f=null):3===l?(o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&((f=(15&u)<<12|(63&o)<<6|63&s)<=2047||f>=55296&&f<=57343)&&(f=null)):4===l&&(o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((f=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||f>=1114112)&&(f=null)),null===f?(f=65533,l=1):f>65535&&(f-=65536,n+=String.fromCharCode(f>>>10&1023|55296),f=56320|1023&f),n+=String.fromCharCode(f),i+=l}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==i.Bytes)return t.push(this.readVarint(e));var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==i.Bytes)return t.push(this.readSVarint());var e=s(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==i.Bytes)return t.push(this.readBoolean());var e=s(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==i.Bytes)return t.push(this.readFloat());var e=s(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==i.Bytes)return t.push(this.readDouble());var e=s(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==i.Bytes)return t.push(this.readFixed32());var e=s(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==i.Bytes)return t.push(this.readSFixed32());var e=s(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==i.Bytes)return t.push(this.readFixed64());var e=s(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==i.Bytes)return t.push(this.readSFixed64());var e=s(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===i.Varint)for(;this.buf[this.pos++]>127;);else if(e===i.Bytes)this.pos=this.readVarint()+this.pos;else if(e===i.Fixed32)this.pos+=4;else{if(e!==i.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),w(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),w(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),w(this.buf,-1&t,this.pos),w(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),w(this.buf,-1&t,this.pos),w(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;if(e.buf[e.pos++]|=r|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&u(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&u(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,i.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,h,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,y,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,v,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,g,e)},writeBytesField:function(t,e){this.writeTag(t,i.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,i.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,i.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,i.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,i.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,i.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,i.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=r=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),r(e)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},,function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function a(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),s=new F(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=b(s,r);if(a){if(a===l)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,s),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function c(){}function p(){}var d={};d[i]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(_([])));v&&v!==e&&r.call(v,i)&&(d=v);var g=p.prototype=h.prototype=Object.create(d);function x(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;this._invoke=function(i,o){function s(){return new e((function(n,s){!function n(i,o,s,a){var u=f(t[i],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}(i,o,n,s)}))}return n=n?n.then(s,s):s()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function _(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return c.prototype=g.constructor=p,p.constructor=c,c.displayName=a(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===c||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,a(t,s,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},x(w.prototype),w.prototype[o]=function(){return this},t.AsyncIterator=w,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var s=new w(u(e,r,n,i),o);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},x(g),a(g,s,"Generator"),g[i]=function(){return this},g.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=_,F.prototype={constructor:F,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;P(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e){
1
+ (() => {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
+ var __commonJS = (cb, mod) => function __require() {
10
+ return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
12
+ var __reExport = (target, module, desc) => {
13
+ if (module && typeof module === "object" || typeof module === "function") {
14
+ for (let key of __getOwnPropNames(module))
15
+ if (!__hasOwnProp.call(target, key) && key !== "default")
16
+ __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toModule = (module) => {
21
+ return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
22
+ };
23
+
24
+ // ../../node_modules/ieee754/index.js
25
+ var require_ieee754 = __commonJS({
26
+ "../../node_modules/ieee754/index.js"(exports) {
27
+ exports.read = function(buffer, offset, isLE, mLen, nBytes) {
28
+ var e, m;
29
+ var eLen = nBytes * 8 - mLen - 1;
30
+ var eMax = (1 << eLen) - 1;
31
+ var eBias = eMax >> 1;
32
+ var nBits = -7;
33
+ var i2 = isLE ? nBytes - 1 : 0;
34
+ var d = isLE ? -1 : 1;
35
+ var s = buffer[offset + i2];
36
+ i2 += d;
37
+ e = s & (1 << -nBits) - 1;
38
+ s >>= -nBits;
39
+ nBits += eLen;
40
+ for (; nBits > 0; e = e * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
41
+ }
42
+ m = e & (1 << -nBits) - 1;
43
+ e >>= -nBits;
44
+ nBits += mLen;
45
+ for (; nBits > 0; m = m * 256 + buffer[offset + i2], i2 += d, nBits -= 8) {
46
+ }
47
+ if (e === 0) {
48
+ e = 1 - eBias;
49
+ } else if (e === eMax) {
50
+ return m ? NaN : (s ? -1 : 1) * Infinity;
51
+ } else {
52
+ m = m + Math.pow(2, mLen);
53
+ e = e - eBias;
54
+ }
55
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
56
+ };
57
+ exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
58
+ var e, m, c;
59
+ var eLen = nBytes * 8 - mLen - 1;
60
+ var eMax = (1 << eLen) - 1;
61
+ var eBias = eMax >> 1;
62
+ var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
63
+ var i2 = isLE ? 0 : nBytes - 1;
64
+ var d = isLE ? 1 : -1;
65
+ var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
66
+ value = Math.abs(value);
67
+ if (isNaN(value) || value === Infinity) {
68
+ m = isNaN(value) ? 1 : 0;
69
+ e = eMax;
70
+ } else {
71
+ e = Math.floor(Math.log(value) / Math.LN2);
72
+ if (value * (c = Math.pow(2, -e)) < 1) {
73
+ e--;
74
+ c *= 2;
75
+ }
76
+ if (e + eBias >= 1) {
77
+ value += rt / c;
78
+ } else {
79
+ value += rt * Math.pow(2, 1 - eBias);
80
+ }
81
+ if (value * c >= 2) {
82
+ e++;
83
+ c /= 2;
84
+ }
85
+ if (e + eBias >= eMax) {
86
+ m = 0;
87
+ e = eMax;
88
+ } else if (e + eBias >= 1) {
89
+ m = (value * c - 1) * Math.pow(2, mLen);
90
+ e = e + eBias;
91
+ } else {
92
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
93
+ e = 0;
94
+ }
95
+ }
96
+ for (; mLen >= 8; buffer[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8) {
97
+ }
98
+ e = e << mLen | m;
99
+ eLen += mLen;
100
+ for (; eLen > 0; buffer[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {
101
+ }
102
+ buffer[offset + i2 - d] |= s * 128;
103
+ };
104
+ }
105
+ });
106
+
107
+ // ../../node_modules/pbf/index.js
108
+ var require_pbf = __commonJS({
109
+ "../../node_modules/pbf/index.js"(exports, module) {
110
+ "use strict";
111
+ module.exports = Pbf;
112
+ var ieee754 = require_ieee754();
113
+ function Pbf(buf) {
114
+ this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
115
+ this.pos = 0;
116
+ this.type = 0;
117
+ this.length = this.buf.length;
118
+ }
119
+ Pbf.Varint = 0;
120
+ Pbf.Fixed64 = 1;
121
+ Pbf.Bytes = 2;
122
+ Pbf.Fixed32 = 5;
123
+ var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
124
+ var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
125
+ var TEXT_DECODER_MIN_LENGTH = 12;
126
+ var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
127
+ Pbf.prototype = {
128
+ destroy: function() {
129
+ this.buf = null;
130
+ },
131
+ readFields: function(readField, result, end) {
132
+ end = end || this.length;
133
+ while (this.pos < end) {
134
+ var val = this.readVarint(), tag = val >> 3, startPos = this.pos;
135
+ this.type = val & 7;
136
+ readField(tag, result, this);
137
+ if (this.pos === startPos)
138
+ this.skip(val);
139
+ }
140
+ return result;
141
+ },
142
+ readMessage: function(readField, result) {
143
+ return this.readFields(readField, result, this.readVarint() + this.pos);
144
+ },
145
+ readFixed32: function() {
146
+ var val = readUInt32(this.buf, this.pos);
147
+ this.pos += 4;
148
+ return val;
149
+ },
150
+ readSFixed32: function() {
151
+ var val = readInt32(this.buf, this.pos);
152
+ this.pos += 4;
153
+ return val;
154
+ },
155
+ readFixed64: function() {
156
+ var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
157
+ this.pos += 8;
158
+ return val;
159
+ },
160
+ readSFixed64: function() {
161
+ var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
162
+ this.pos += 8;
163
+ return val;
164
+ },
165
+ readFloat: function() {
166
+ var val = ieee754.read(this.buf, this.pos, true, 23, 4);
167
+ this.pos += 4;
168
+ return val;
169
+ },
170
+ readDouble: function() {
171
+ var val = ieee754.read(this.buf, this.pos, true, 52, 8);
172
+ this.pos += 8;
173
+ return val;
174
+ },
175
+ readVarint: function(isSigned) {
176
+ var buf = this.buf, val, b;
177
+ b = buf[this.pos++];
178
+ val = b & 127;
179
+ if (b < 128)
180
+ return val;
181
+ b = buf[this.pos++];
182
+ val |= (b & 127) << 7;
183
+ if (b < 128)
184
+ return val;
185
+ b = buf[this.pos++];
186
+ val |= (b & 127) << 14;
187
+ if (b < 128)
188
+ return val;
189
+ b = buf[this.pos++];
190
+ val |= (b & 127) << 21;
191
+ if (b < 128)
192
+ return val;
193
+ b = buf[this.pos];
194
+ val |= (b & 15) << 28;
195
+ return readVarintRemainder(val, isSigned, this);
196
+ },
197
+ readVarint64: function() {
198
+ return this.readVarint(true);
199
+ },
200
+ readSVarint: function() {
201
+ var num = this.readVarint();
202
+ return num % 2 === 1 ? (num + 1) / -2 : num / 2;
203
+ },
204
+ readBoolean: function() {
205
+ return Boolean(this.readVarint());
206
+ },
207
+ readString: function() {
208
+ var end = this.readVarint() + this.pos;
209
+ var pos = this.pos;
210
+ this.pos = end;
211
+ if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
212
+ return readUtf8TextDecoder(this.buf, pos, end);
213
+ }
214
+ return readUtf8(this.buf, pos, end);
215
+ },
216
+ readBytes: function() {
217
+ var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
218
+ this.pos = end;
219
+ return buffer;
220
+ },
221
+ readPackedVarint: function(arr, isSigned) {
222
+ if (this.type !== Pbf.Bytes)
223
+ return arr.push(this.readVarint(isSigned));
224
+ var end = readPackedEnd(this);
225
+ arr = arr || [];
226
+ while (this.pos < end)
227
+ arr.push(this.readVarint(isSigned));
228
+ return arr;
229
+ },
230
+ readPackedSVarint: function(arr) {
231
+ if (this.type !== Pbf.Bytes)
232
+ return arr.push(this.readSVarint());
233
+ var end = readPackedEnd(this);
234
+ arr = arr || [];
235
+ while (this.pos < end)
236
+ arr.push(this.readSVarint());
237
+ return arr;
238
+ },
239
+ readPackedBoolean: function(arr) {
240
+ if (this.type !== Pbf.Bytes)
241
+ return arr.push(this.readBoolean());
242
+ var end = readPackedEnd(this);
243
+ arr = arr || [];
244
+ while (this.pos < end)
245
+ arr.push(this.readBoolean());
246
+ return arr;
247
+ },
248
+ readPackedFloat: function(arr) {
249
+ if (this.type !== Pbf.Bytes)
250
+ return arr.push(this.readFloat());
251
+ var end = readPackedEnd(this);
252
+ arr = arr || [];
253
+ while (this.pos < end)
254
+ arr.push(this.readFloat());
255
+ return arr;
256
+ },
257
+ readPackedDouble: function(arr) {
258
+ if (this.type !== Pbf.Bytes)
259
+ return arr.push(this.readDouble());
260
+ var end = readPackedEnd(this);
261
+ arr = arr || [];
262
+ while (this.pos < end)
263
+ arr.push(this.readDouble());
264
+ return arr;
265
+ },
266
+ readPackedFixed32: function(arr) {
267
+ if (this.type !== Pbf.Bytes)
268
+ return arr.push(this.readFixed32());
269
+ var end = readPackedEnd(this);
270
+ arr = arr || [];
271
+ while (this.pos < end)
272
+ arr.push(this.readFixed32());
273
+ return arr;
274
+ },
275
+ readPackedSFixed32: function(arr) {
276
+ if (this.type !== Pbf.Bytes)
277
+ return arr.push(this.readSFixed32());
278
+ var end = readPackedEnd(this);
279
+ arr = arr || [];
280
+ while (this.pos < end)
281
+ arr.push(this.readSFixed32());
282
+ return arr;
283
+ },
284
+ readPackedFixed64: function(arr) {
285
+ if (this.type !== Pbf.Bytes)
286
+ return arr.push(this.readFixed64());
287
+ var end = readPackedEnd(this);
288
+ arr = arr || [];
289
+ while (this.pos < end)
290
+ arr.push(this.readFixed64());
291
+ return arr;
292
+ },
293
+ readPackedSFixed64: function(arr) {
294
+ if (this.type !== Pbf.Bytes)
295
+ return arr.push(this.readSFixed64());
296
+ var end = readPackedEnd(this);
297
+ arr = arr || [];
298
+ while (this.pos < end)
299
+ arr.push(this.readSFixed64());
300
+ return arr;
301
+ },
302
+ skip: function(val) {
303
+ var type = val & 7;
304
+ if (type === Pbf.Varint)
305
+ while (this.buf[this.pos++] > 127) {
306
+ }
307
+ else if (type === Pbf.Bytes)
308
+ this.pos = this.readVarint() + this.pos;
309
+ else if (type === Pbf.Fixed32)
310
+ this.pos += 4;
311
+ else if (type === Pbf.Fixed64)
312
+ this.pos += 8;
313
+ else
314
+ throw new Error("Unimplemented type: " + type);
315
+ },
316
+ writeTag: function(tag, type) {
317
+ this.writeVarint(tag << 3 | type);
318
+ },
319
+ realloc: function(min) {
320
+ var length2 = this.length || 16;
321
+ while (length2 < this.pos + min)
322
+ length2 *= 2;
323
+ if (length2 !== this.length) {
324
+ var buf = new Uint8Array(length2);
325
+ buf.set(this.buf);
326
+ this.buf = buf;
327
+ this.length = length2;
328
+ }
329
+ },
330
+ finish: function() {
331
+ this.length = this.pos;
332
+ this.pos = 0;
333
+ return this.buf.subarray(0, this.length);
334
+ },
335
+ writeFixed32: function(val) {
336
+ this.realloc(4);
337
+ writeInt32(this.buf, val, this.pos);
338
+ this.pos += 4;
339
+ },
340
+ writeSFixed32: function(val) {
341
+ this.realloc(4);
342
+ writeInt32(this.buf, val, this.pos);
343
+ this.pos += 4;
344
+ },
345
+ writeFixed64: function(val) {
346
+ this.realloc(8);
347
+ writeInt32(this.buf, val & -1, this.pos);
348
+ writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
349
+ this.pos += 8;
350
+ },
351
+ writeSFixed64: function(val) {
352
+ this.realloc(8);
353
+ writeInt32(this.buf, val & -1, this.pos);
354
+ writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
355
+ this.pos += 8;
356
+ },
357
+ writeVarint: function(val) {
358
+ val = +val || 0;
359
+ if (val > 268435455 || val < 0) {
360
+ writeBigVarint(val, this);
361
+ return;
362
+ }
363
+ this.realloc(4);
364
+ this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
365
+ if (val <= 127)
366
+ return;
367
+ this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
368
+ if (val <= 127)
369
+ return;
370
+ this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
371
+ if (val <= 127)
372
+ return;
373
+ this.buf[this.pos++] = val >>> 7 & 127;
374
+ },
375
+ writeSVarint: function(val) {
376
+ this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
377
+ },
378
+ writeBoolean: function(val) {
379
+ this.writeVarint(Boolean(val));
380
+ },
381
+ writeString: function(str) {
382
+ str = String(str);
383
+ this.realloc(str.length * 4);
384
+ this.pos++;
385
+ var startPos = this.pos;
386
+ this.pos = writeUtf8(this.buf, str, this.pos);
387
+ var len = this.pos - startPos;
388
+ if (len >= 128)
389
+ makeRoomForExtraLength(startPos, len, this);
390
+ this.pos = startPos - 1;
391
+ this.writeVarint(len);
392
+ this.pos += len;
393
+ },
394
+ writeFloat: function(val) {
395
+ this.realloc(4);
396
+ ieee754.write(this.buf, val, this.pos, true, 23, 4);
397
+ this.pos += 4;
398
+ },
399
+ writeDouble: function(val) {
400
+ this.realloc(8);
401
+ ieee754.write(this.buf, val, this.pos, true, 52, 8);
402
+ this.pos += 8;
403
+ },
404
+ writeBytes: function(buffer) {
405
+ var len = buffer.length;
406
+ this.writeVarint(len);
407
+ this.realloc(len);
408
+ for (var i2 = 0; i2 < len; i2++)
409
+ this.buf[this.pos++] = buffer[i2];
410
+ },
411
+ writeRawMessage: function(fn, obj) {
412
+ this.pos++;
413
+ var startPos = this.pos;
414
+ fn(obj, this);
415
+ var len = this.pos - startPos;
416
+ if (len >= 128)
417
+ makeRoomForExtraLength(startPos, len, this);
418
+ this.pos = startPos - 1;
419
+ this.writeVarint(len);
420
+ this.pos += len;
421
+ },
422
+ writeMessage: function(tag, fn, obj) {
423
+ this.writeTag(tag, Pbf.Bytes);
424
+ this.writeRawMessage(fn, obj);
425
+ },
426
+ writePackedVarint: function(tag, arr) {
427
+ if (arr.length)
428
+ this.writeMessage(tag, writePackedVarint, arr);
429
+ },
430
+ writePackedSVarint: function(tag, arr) {
431
+ if (arr.length)
432
+ this.writeMessage(tag, writePackedSVarint, arr);
433
+ },
434
+ writePackedBoolean: function(tag, arr) {
435
+ if (arr.length)
436
+ this.writeMessage(tag, writePackedBoolean, arr);
437
+ },
438
+ writePackedFloat: function(tag, arr) {
439
+ if (arr.length)
440
+ this.writeMessage(tag, writePackedFloat, arr);
441
+ },
442
+ writePackedDouble: function(tag, arr) {
443
+ if (arr.length)
444
+ this.writeMessage(tag, writePackedDouble, arr);
445
+ },
446
+ writePackedFixed32: function(tag, arr) {
447
+ if (arr.length)
448
+ this.writeMessage(tag, writePackedFixed32, arr);
449
+ },
450
+ writePackedSFixed32: function(tag, arr) {
451
+ if (arr.length)
452
+ this.writeMessage(tag, writePackedSFixed32, arr);
453
+ },
454
+ writePackedFixed64: function(tag, arr) {
455
+ if (arr.length)
456
+ this.writeMessage(tag, writePackedFixed64, arr);
457
+ },
458
+ writePackedSFixed64: function(tag, arr) {
459
+ if (arr.length)
460
+ this.writeMessage(tag, writePackedSFixed64, arr);
461
+ },
462
+ writeBytesField: function(tag, buffer) {
463
+ this.writeTag(tag, Pbf.Bytes);
464
+ this.writeBytes(buffer);
465
+ },
466
+ writeFixed32Field: function(tag, val) {
467
+ this.writeTag(tag, Pbf.Fixed32);
468
+ this.writeFixed32(val);
469
+ },
470
+ writeSFixed32Field: function(tag, val) {
471
+ this.writeTag(tag, Pbf.Fixed32);
472
+ this.writeSFixed32(val);
473
+ },
474
+ writeFixed64Field: function(tag, val) {
475
+ this.writeTag(tag, Pbf.Fixed64);
476
+ this.writeFixed64(val);
477
+ },
478
+ writeSFixed64Field: function(tag, val) {
479
+ this.writeTag(tag, Pbf.Fixed64);
480
+ this.writeSFixed64(val);
481
+ },
482
+ writeVarintField: function(tag, val) {
483
+ this.writeTag(tag, Pbf.Varint);
484
+ this.writeVarint(val);
485
+ },
486
+ writeSVarintField: function(tag, val) {
487
+ this.writeTag(tag, Pbf.Varint);
488
+ this.writeSVarint(val);
489
+ },
490
+ writeStringField: function(tag, str) {
491
+ this.writeTag(tag, Pbf.Bytes);
492
+ this.writeString(str);
493
+ },
494
+ writeFloatField: function(tag, val) {
495
+ this.writeTag(tag, Pbf.Fixed32);
496
+ this.writeFloat(val);
497
+ },
498
+ writeDoubleField: function(tag, val) {
499
+ this.writeTag(tag, Pbf.Fixed64);
500
+ this.writeDouble(val);
501
+ },
502
+ writeBooleanField: function(tag, val) {
503
+ this.writeVarintField(tag, Boolean(val));
504
+ }
505
+ };
506
+ function readVarintRemainder(l, s, p) {
507
+ var buf = p.buf, h, b;
508
+ b = buf[p.pos++];
509
+ h = (b & 112) >> 4;
510
+ if (b < 128)
511
+ return toNum(l, h, s);
512
+ b = buf[p.pos++];
513
+ h |= (b & 127) << 3;
514
+ if (b < 128)
515
+ return toNum(l, h, s);
516
+ b = buf[p.pos++];
517
+ h |= (b & 127) << 10;
518
+ if (b < 128)
519
+ return toNum(l, h, s);
520
+ b = buf[p.pos++];
521
+ h |= (b & 127) << 17;
522
+ if (b < 128)
523
+ return toNum(l, h, s);
524
+ b = buf[p.pos++];
525
+ h |= (b & 127) << 24;
526
+ if (b < 128)
527
+ return toNum(l, h, s);
528
+ b = buf[p.pos++];
529
+ h |= (b & 1) << 31;
530
+ if (b < 128)
531
+ return toNum(l, h, s);
532
+ throw new Error("Expected varint not more than 10 bytes");
533
+ }
534
+ function readPackedEnd(pbf) {
535
+ return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
536
+ }
537
+ function toNum(low, high, isSigned) {
538
+ if (isSigned) {
539
+ return high * 4294967296 + (low >>> 0);
540
+ }
541
+ return (high >>> 0) * 4294967296 + (low >>> 0);
542
+ }
543
+ function writeBigVarint(val, pbf) {
544
+ var low, high;
545
+ if (val >= 0) {
546
+ low = val % 4294967296 | 0;
547
+ high = val / 4294967296 | 0;
548
+ } else {
549
+ low = ~(-val % 4294967296);
550
+ high = ~(-val / 4294967296);
551
+ if (low ^ 4294967295) {
552
+ low = low + 1 | 0;
553
+ } else {
554
+ low = 0;
555
+ high = high + 1 | 0;
556
+ }
557
+ }
558
+ if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
559
+ throw new Error("Given varint doesn't fit into 10 bytes");
560
+ }
561
+ pbf.realloc(10);
562
+ writeBigVarintLow(low, high, pbf);
563
+ writeBigVarintHigh(high, pbf);
564
+ }
565
+ function writeBigVarintLow(low, high, pbf) {
566
+ pbf.buf[pbf.pos++] = low & 127 | 128;
567
+ low >>>= 7;
568
+ pbf.buf[pbf.pos++] = low & 127 | 128;
569
+ low >>>= 7;
570
+ pbf.buf[pbf.pos++] = low & 127 | 128;
571
+ low >>>= 7;
572
+ pbf.buf[pbf.pos++] = low & 127 | 128;
573
+ low >>>= 7;
574
+ pbf.buf[pbf.pos] = low & 127;
575
+ }
576
+ function writeBigVarintHigh(high, pbf) {
577
+ var lsb = (high & 7) << 4;
578
+ pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
579
+ if (!high)
580
+ return;
581
+ pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
582
+ if (!high)
583
+ return;
584
+ pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
585
+ if (!high)
586
+ return;
587
+ pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
588
+ if (!high)
589
+ return;
590
+ pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
591
+ if (!high)
592
+ return;
593
+ pbf.buf[pbf.pos++] = high & 127;
594
+ }
595
+ function makeRoomForExtraLength(startPos, len, pbf) {
596
+ var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
597
+ pbf.realloc(extraLen);
598
+ for (var i2 = pbf.pos - 1; i2 >= startPos; i2--)
599
+ pbf.buf[i2 + extraLen] = pbf.buf[i2];
600
+ }
601
+ function writePackedVarint(arr, pbf) {
602
+ for (var i2 = 0; i2 < arr.length; i2++)
603
+ pbf.writeVarint(arr[i2]);
604
+ }
605
+ function writePackedSVarint(arr, pbf) {
606
+ for (var i2 = 0; i2 < arr.length; i2++)
607
+ pbf.writeSVarint(arr[i2]);
608
+ }
609
+ function writePackedFloat(arr, pbf) {
610
+ for (var i2 = 0; i2 < arr.length; i2++)
611
+ pbf.writeFloat(arr[i2]);
612
+ }
613
+ function writePackedDouble(arr, pbf) {
614
+ for (var i2 = 0; i2 < arr.length; i2++)
615
+ pbf.writeDouble(arr[i2]);
616
+ }
617
+ function writePackedBoolean(arr, pbf) {
618
+ for (var i2 = 0; i2 < arr.length; i2++)
619
+ pbf.writeBoolean(arr[i2]);
620
+ }
621
+ function writePackedFixed32(arr, pbf) {
622
+ for (var i2 = 0; i2 < arr.length; i2++)
623
+ pbf.writeFixed32(arr[i2]);
624
+ }
625
+ function writePackedSFixed32(arr, pbf) {
626
+ for (var i2 = 0; i2 < arr.length; i2++)
627
+ pbf.writeSFixed32(arr[i2]);
628
+ }
629
+ function writePackedFixed64(arr, pbf) {
630
+ for (var i2 = 0; i2 < arr.length; i2++)
631
+ pbf.writeFixed64(arr[i2]);
632
+ }
633
+ function writePackedSFixed64(arr, pbf) {
634
+ for (var i2 = 0; i2 < arr.length; i2++)
635
+ pbf.writeSFixed64(arr[i2]);
636
+ }
637
+ function readUInt32(buf, pos) {
638
+ return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
639
+ }
640
+ function writeInt32(buf, val, pos) {
641
+ buf[pos] = val;
642
+ buf[pos + 1] = val >>> 8;
643
+ buf[pos + 2] = val >>> 16;
644
+ buf[pos + 3] = val >>> 24;
645
+ }
646
+ function readInt32(buf, pos) {
647
+ return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
648
+ }
649
+ function readUtf8(buf, pos, end) {
650
+ var str = "";
651
+ var i2 = pos;
652
+ while (i2 < end) {
653
+ var b0 = buf[i2];
654
+ var c = null;
655
+ var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
656
+ if (i2 + bytesPerSequence > end)
657
+ break;
658
+ var b1, b2, b3;
659
+ if (bytesPerSequence === 1) {
660
+ if (b0 < 128) {
661
+ c = b0;
662
+ }
663
+ } else if (bytesPerSequence === 2) {
664
+ b1 = buf[i2 + 1];
665
+ if ((b1 & 192) === 128) {
666
+ c = (b0 & 31) << 6 | b1 & 63;
667
+ if (c <= 127) {
668
+ c = null;
669
+ }
670
+ }
671
+ } else if (bytesPerSequence === 3) {
672
+ b1 = buf[i2 + 1];
673
+ b2 = buf[i2 + 2];
674
+ if ((b1 & 192) === 128 && (b2 & 192) === 128) {
675
+ c = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
676
+ if (c <= 2047 || c >= 55296 && c <= 57343) {
677
+ c = null;
678
+ }
679
+ }
680
+ } else if (bytesPerSequence === 4) {
681
+ b1 = buf[i2 + 1];
682
+ b2 = buf[i2 + 2];
683
+ b3 = buf[i2 + 3];
684
+ if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
685
+ c = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
686
+ if (c <= 65535 || c >= 1114112) {
687
+ c = null;
688
+ }
689
+ }
690
+ }
691
+ if (c === null) {
692
+ c = 65533;
693
+ bytesPerSequence = 1;
694
+ } else if (c > 65535) {
695
+ c -= 65536;
696
+ str += String.fromCharCode(c >>> 10 & 1023 | 55296);
697
+ c = 56320 | c & 1023;
698
+ }
699
+ str += String.fromCharCode(c);
700
+ i2 += bytesPerSequence;
701
+ }
702
+ return str;
703
+ }
704
+ function readUtf8TextDecoder(buf, pos, end) {
705
+ return utf8TextDecoder.decode(buf.subarray(pos, end));
706
+ }
707
+ function writeUtf8(buf, str, pos) {
708
+ for (var i2 = 0, c, lead; i2 < str.length; i2++) {
709
+ c = str.charCodeAt(i2);
710
+ if (c > 55295 && c < 57344) {
711
+ if (lead) {
712
+ if (c < 56320) {
713
+ buf[pos++] = 239;
714
+ buf[pos++] = 191;
715
+ buf[pos++] = 189;
716
+ lead = c;
717
+ continue;
718
+ } else {
719
+ c = lead - 55296 << 10 | c - 56320 | 65536;
720
+ lead = null;
721
+ }
722
+ } else {
723
+ if (c > 56319 || i2 + 1 === str.length) {
724
+ buf[pos++] = 239;
725
+ buf[pos++] = 191;
726
+ buf[pos++] = 189;
727
+ } else {
728
+ lead = c;
729
+ }
730
+ continue;
731
+ }
732
+ } else if (lead) {
733
+ buf[pos++] = 239;
734
+ buf[pos++] = 191;
735
+ buf[pos++] = 189;
736
+ lead = null;
737
+ }
738
+ if (c < 128) {
739
+ buf[pos++] = c;
740
+ } else {
741
+ if (c < 2048) {
742
+ buf[pos++] = c >> 6 | 192;
743
+ } else {
744
+ if (c < 65536) {
745
+ buf[pos++] = c >> 12 | 224;
746
+ } else {
747
+ buf[pos++] = c >> 18 | 240;
748
+ buf[pos++] = c >> 12 & 63 | 128;
749
+ }
750
+ buf[pos++] = c >> 6 & 63 | 128;
751
+ }
752
+ buf[pos++] = c & 63 | 128;
753
+ }
754
+ }
755
+ return pos;
756
+ }
757
+ }
758
+ });
759
+
760
+ // src/helpers/mapbox-util-functions.ts
761
+ function classifyRings(rings) {
762
+ const len = rings.length;
763
+ if (len <= 1)
764
+ return [rings];
765
+ const polygons = [];
766
+ let polygon;
767
+ let ccw;
768
+ for (let i2 = 0; i2 < len; i2++) {
769
+ const area2 = signedArea(rings[i2]);
770
+ if (area2 === 0)
771
+ continue;
772
+ if (ccw === void 0)
773
+ ccw = area2 < 0;
774
+ if (ccw === area2 < 0) {
775
+ if (polygon)
776
+ polygons.push(polygon);
777
+ polygon = [rings[i2]];
778
+ } else if (polygon)
779
+ polygon.push(rings[i2]);
780
+ }
781
+ if (polygon)
782
+ polygons.push(polygon);
783
+ return polygons;
784
+ }
785
+ function signedArea(ring) {
786
+ let sum = 0;
787
+ for (let i2 = 0, j = ring.length - 1, p1, p2; i2 < ring.length; j = i2++) {
788
+ p1 = ring[i2];
789
+ p2 = ring[j];
790
+ sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);
791
+ }
792
+ return sum;
793
+ }
794
+ function readFeature(tag, feature, pbf) {
795
+ if (feature && pbf) {
796
+ if (tag === 1)
797
+ feature.id = pbf.readVarint();
798
+ else if (tag === 2)
799
+ readTag(pbf, feature);
800
+ else if (tag === 3)
801
+ feature.type = pbf.readVarint();
802
+ else if (tag === 4)
803
+ feature._geometry = pbf.pos;
804
+ }
805
+ }
806
+ function readTag(pbf, feature) {
807
+ const end = pbf.readVarint() + pbf.pos;
808
+ while (pbf.pos < end) {
809
+ const key = feature._keys[pbf.readVarint()];
810
+ const value = feature._values[pbf.readVarint()];
811
+ feature.properties[key] = value;
812
+ }
813
+ }
814
+
815
+ // src/lib/mapbox-vector-tile/vector-tile-feature.ts
816
+ var VectorTileFeature = class {
817
+ static get types() {
818
+ return ["Unknown", "Point", "LineString", "Polygon"];
819
+ }
820
+ constructor(pbf, end, extent, keys, values) {
821
+ this.properties = {};
822
+ this.extent = extent;
823
+ this.type = 0;
824
+ this.id = null;
825
+ this._pbf = pbf;
826
+ this._geometry = -1;
827
+ this._keys = keys;
828
+ this._values = values;
829
+ pbf.readFields(readFeature, this, end);
830
+ }
831
+ loadGeometry() {
832
+ const pbf = this._pbf;
833
+ pbf.pos = this._geometry;
834
+ const end = pbf.readVarint() + pbf.pos;
835
+ let cmd2 = 1;
836
+ let length2 = 0;
837
+ let x2 = 0;
838
+ let y2 = 0;
839
+ const lines = [];
840
+ let line;
841
+ while (pbf.pos < end) {
842
+ if (length2 <= 0) {
843
+ const cmdLen2 = pbf.readVarint();
844
+ cmd2 = cmdLen2 & 7;
845
+ length2 = cmdLen2 >> 3;
846
+ }
847
+ length2--;
848
+ if (cmd2 === 1 || cmd2 === 2) {
849
+ x2 += pbf.readSVarint();
850
+ y2 += pbf.readSVarint();
851
+ if (cmd2 === 1) {
852
+ if (line)
853
+ lines.push(line);
854
+ line = [];
855
+ }
856
+ if (line)
857
+ line.push([x2, y2]);
858
+ } else if (cmd2 === 7) {
859
+ if (line) {
860
+ line.push(line[0].slice());
861
+ }
862
+ } else {
863
+ throw new Error(`unknown command ${cmd2}`);
864
+ }
865
+ }
866
+ if (line)
867
+ lines.push(line);
868
+ return lines;
869
+ }
870
+ bbox() {
871
+ const pbf = this._pbf;
872
+ pbf.pos = this._geometry;
873
+ const end = pbf.readVarint() + pbf.pos;
874
+ let cmd2 = 1;
875
+ let length2 = 0;
876
+ let x2 = 0;
877
+ let y2 = 0;
878
+ let x1 = Infinity;
879
+ let x22 = -Infinity;
880
+ let y1 = Infinity;
881
+ let y22 = -Infinity;
882
+ while (pbf.pos < end) {
883
+ if (length2 <= 0) {
884
+ const cmdLen2 = pbf.readVarint();
885
+ cmd2 = cmdLen2 & 7;
886
+ length2 = cmdLen2 >> 3;
887
+ }
888
+ length2--;
889
+ if (cmd2 === 1 || cmd2 === 2) {
890
+ x2 += pbf.readSVarint();
891
+ y2 += pbf.readSVarint();
892
+ if (x2 < x1)
893
+ x1 = x2;
894
+ if (x2 > x22)
895
+ x22 = x2;
896
+ if (y2 < y1)
897
+ y1 = y2;
898
+ if (y2 > y22)
899
+ y22 = y2;
900
+ } else if (cmd2 !== 7) {
901
+ throw new Error(`unknown command ${cmd2}`);
902
+ }
903
+ }
904
+ return [x1, y1, x22, y22];
905
+ }
906
+ _toGeoJSON(transform) {
907
+ let coords = this.loadGeometry();
908
+ let type = VectorTileFeature.types[this.type];
909
+ let i2;
910
+ let j;
911
+ switch (this.type) {
912
+ case 1:
913
+ const points = [];
914
+ for (i2 = 0; i2 < coords.length; i2++) {
915
+ points[i2] = coords[i2][0];
916
+ }
917
+ coords = points;
918
+ transform(coords, this);
919
+ break;
920
+ case 2:
921
+ for (i2 = 0; i2 < coords.length; i2++) {
922
+ transform(coords[i2], this);
923
+ }
924
+ break;
925
+ case 3:
926
+ coords = classifyRings(coords);
927
+ for (i2 = 0; i2 < coords.length; i2++) {
928
+ for (j = 0; j < coords[i2].length; j++) {
929
+ transform(coords[i2][j], this);
930
+ }
931
+ }
932
+ break;
933
+ }
934
+ if (coords.length === 1) {
935
+ coords = coords[0];
936
+ } else {
937
+ type = `Multi${type}`;
938
+ }
939
+ const result = {
940
+ type: "Feature",
941
+ geometry: {
942
+ type,
943
+ coordinates: coords
944
+ },
945
+ properties: this.properties
946
+ };
947
+ if (this.id !== null) {
948
+ result.id = this.id;
949
+ }
950
+ return result;
951
+ }
952
+ toGeoJSON(options) {
953
+ if (typeof options === "function") {
954
+ return this._toGeoJSON(options);
955
+ }
956
+ const { x: x2, y: y2, z } = options;
957
+ const size = this.extent * Math.pow(2, z);
958
+ const x0 = this.extent * x2;
959
+ const y0 = this.extent * y2;
960
+ function project2(line) {
961
+ for (let j = 0; j < line.length; j++) {
962
+ const p = line[j];
963
+ p[0] = (p[0] + x0) * 360 / size - 180;
964
+ const y22 = 180 - (p[1] + y0) * 360 / size;
965
+ p[1] = 360 / Math.PI * Math.atan(Math.exp(y22 * Math.PI / 180)) - 90;
966
+ }
967
+ }
968
+ return this._toGeoJSON(project2);
969
+ }
970
+ };
971
+
972
+ // src/lib/mapbox-vector-tile/vector-tile-layer.ts
973
+ var VectorTileLayer = class {
974
+ constructor(pbf, end) {
975
+ this.version = 1;
976
+ this.name = "";
977
+ this.extent = 4096;
978
+ this.length = 0;
979
+ this._pbf = pbf;
980
+ this._keys = [];
981
+ this._values = [];
982
+ this._features = [];
983
+ pbf.readFields(readLayer, this, end);
984
+ this.length = this._features.length;
985
+ }
986
+ feature(i2) {
987
+ if (i2 < 0 || i2 >= this._features.length) {
988
+ throw new Error("feature index out of bounds");
989
+ }
990
+ this._pbf.pos = this._features[i2];
991
+ const end = this._pbf.readVarint() + this._pbf.pos;
992
+ return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
993
+ }
994
+ };
995
+ function readLayer(tag, layer, pbf) {
996
+ if (layer && pbf) {
997
+ if (tag === 15)
998
+ layer.version = pbf.readVarint();
999
+ else if (tag === 1)
1000
+ layer.name = pbf.readString();
1001
+ else if (tag === 5)
1002
+ layer.extent = pbf.readVarint();
1003
+ else if (tag === 2)
1004
+ layer._features.push(pbf.pos);
1005
+ else if (tag === 3)
1006
+ layer._keys.push(pbf.readString());
1007
+ else if (tag === 4)
1008
+ layer._values.push(readValueMessage(pbf));
1009
+ }
1010
+ }
1011
+ function readValueMessage(pbf) {
1012
+ let value = null;
1013
+ const end = pbf.readVarint() + pbf.pos;
1014
+ while (pbf.pos < end) {
1015
+ const tag = pbf.readVarint() >> 3;
1016
+ value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
1017
+ }
1018
+ return value;
1019
+ }
1020
+
1021
+ // src/lib/mapbox-vector-tile/vector-tile.ts
1022
+ var VectorTile = class {
1023
+ constructor(pbf, end) {
1024
+ this.layers = pbf.readFields(readTile, {}, end);
1025
+ }
1026
+ };
1027
+ function readTile(tag, layers, pbf) {
1028
+ if (tag === 3) {
1029
+ if (pbf) {
1030
+ const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
1031
+ if (layer.length && layers) {
1032
+ layers[layer.name] = layer;
1033
+ }
1034
+ }
1035
+ }
1036
+ }
1037
+
1038
+ // ../../node_modules/@math.gl/polygon/dist/esm/polygon-utils.js
1039
+ function getPolygonSignedArea(points, options = {}) {
1040
+ const {
1041
+ start = 0,
1042
+ end = points.length
1043
+ } = options;
1044
+ const dim = options.size || 2;
1045
+ let area2 = 0;
1046
+ for (let i2 = start, j = end - dim; i2 < end; i2 += dim) {
1047
+ area2 += (points[i2] - points[j]) * (points[i2 + 1] + points[j + 1]);
1048
+ j = i2;
1049
+ }
1050
+ return area2 / 2;
1051
+ }
1052
+
1053
+ // ../../node_modules/@math.gl/polygon/dist/esm/earcut.js
1054
+ function earcut(data, holeIndices, dim, areas) {
1055
+ dim = dim || 2;
1056
+ const hasHoles = holeIndices && holeIndices.length;
1057
+ const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
1058
+ let outerNode = linkedList(data, 0, outerLen, dim, true, areas && areas[0]);
1059
+ const triangles = [];
1060
+ if (!outerNode || outerNode.next === outerNode.prev)
1061
+ return triangles;
1062
+ let invSize;
1063
+ let maxX;
1064
+ let maxY;
1065
+ let minX;
1066
+ let minY;
1067
+ let x2;
1068
+ let y2;
1069
+ if (hasHoles)
1070
+ outerNode = eliminateHoles(data, holeIndices, outerNode, dim, areas);
1071
+ if (data.length > 80 * dim) {
1072
+ minX = maxX = data[0];
1073
+ minY = maxY = data[1];
1074
+ for (let i2 = dim; i2 < outerLen; i2 += dim) {
1075
+ x2 = data[i2];
1076
+ y2 = data[i2 + 1];
1077
+ if (x2 < minX)
1078
+ minX = x2;
1079
+ if (y2 < minY)
1080
+ minY = y2;
1081
+ if (x2 > maxX)
1082
+ maxX = x2;
1083
+ if (y2 > maxY)
1084
+ maxY = y2;
1085
+ }
1086
+ invSize = Math.max(maxX - minX, maxY - minY);
1087
+ invSize = invSize !== 0 ? 1 / invSize : 0;
1088
+ }
1089
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
1090
+ return triangles;
1091
+ }
1092
+ function linkedList(data, start, end, dim, clockwise, area2) {
1093
+ let i2;
1094
+ let last;
1095
+ if (area2 === void 0) {
1096
+ area2 = getPolygonSignedArea(data, {
1097
+ start,
1098
+ end,
1099
+ size: dim
1100
+ });
1101
+ }
1102
+ if (clockwise === area2 < 0) {
1103
+ for (i2 = start; i2 < end; i2 += dim)
1104
+ last = insertNode(i2, data[i2], data[i2 + 1], last);
1105
+ } else {
1106
+ for (i2 = end - dim; i2 >= start; i2 -= dim)
1107
+ last = insertNode(i2, data[i2], data[i2 + 1], last);
1108
+ }
1109
+ if (last && equals(last, last.next)) {
1110
+ removeNode(last);
1111
+ last = last.next;
1112
+ }
1113
+ return last;
1114
+ }
1115
+ function filterPoints(start, end) {
1116
+ if (!start)
1117
+ return start;
1118
+ if (!end)
1119
+ end = start;
1120
+ let p = start;
1121
+ let again;
1122
+ do {
1123
+ again = false;
1124
+ if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
1125
+ removeNode(p);
1126
+ p = end = p.prev;
1127
+ if (p === p.next)
1128
+ break;
1129
+ again = true;
1130
+ } else {
1131
+ p = p.next;
1132
+ }
1133
+ } while (again || p !== end);
1134
+ return end;
1135
+ }
1136
+ function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
1137
+ if (!ear)
1138
+ return;
1139
+ if (!pass && invSize)
1140
+ indexCurve(ear, minX, minY, invSize);
1141
+ let stop = ear;
1142
+ let prev;
1143
+ let next;
1144
+ while (ear.prev !== ear.next) {
1145
+ prev = ear.prev;
1146
+ next = ear.next;
1147
+ if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
1148
+ triangles.push(prev.i / dim);
1149
+ triangles.push(ear.i / dim);
1150
+ triangles.push(next.i / dim);
1151
+ removeNode(ear);
1152
+ ear = next.next;
1153
+ stop = next.next;
1154
+ continue;
1155
+ }
1156
+ ear = next;
1157
+ if (ear === stop) {
1158
+ if (!pass) {
1159
+ earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
1160
+ } else if (pass === 1) {
1161
+ ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
1162
+ earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
1163
+ } else if (pass === 2) {
1164
+ splitEarcut(ear, triangles, dim, minX, minY, invSize);
1165
+ }
1166
+ break;
1167
+ }
1168
+ }
1169
+ }
1170
+ function isEar(ear) {
1171
+ const a = ear.prev;
1172
+ const b = ear;
1173
+ const c = ear.next;
1174
+ if (area(a, b, c) >= 0)
1175
+ return false;
1176
+ let p = ear.next.next;
1177
+ while (p !== ear.prev) {
1178
+ if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
1179
+ return false;
1180
+ p = p.next;
1181
+ }
1182
+ return true;
1183
+ }
1184
+ function isEarHashed(ear, minX, minY, invSize) {
1185
+ const a = ear.prev;
1186
+ const b = ear;
1187
+ const c = ear.next;
1188
+ if (area(a, b, c) >= 0)
1189
+ return false;
1190
+ const minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x;
1191
+ const minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y;
1192
+ const maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x;
1193
+ const maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y;
1194
+ const minZ = zOrder(minTX, minTY, minX, minY, invSize);
1195
+ const maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
1196
+ let p = ear.prevZ;
1197
+ let n = ear.nextZ;
1198
+ while (p && p.z >= minZ && n && n.z <= maxZ) {
1199
+ if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
1200
+ return false;
1201
+ p = p.prevZ;
1202
+ if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)
1203
+ return false;
1204
+ n = n.nextZ;
1205
+ }
1206
+ while (p && p.z >= minZ) {
1207
+ if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0)
1208
+ return false;
1209
+ p = p.prevZ;
1210
+ }
1211
+ while (n && n.z <= maxZ) {
1212
+ if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)
1213
+ return false;
1214
+ n = n.nextZ;
1215
+ }
1216
+ return true;
1217
+ }
1218
+ function cureLocalIntersections(start, triangles, dim) {
1219
+ let p = start;
1220
+ do {
1221
+ const a = p.prev;
1222
+ const b = p.next.next;
1223
+ if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
1224
+ triangles.push(a.i / dim);
1225
+ triangles.push(p.i / dim);
1226
+ triangles.push(b.i / dim);
1227
+ removeNode(p);
1228
+ removeNode(p.next);
1229
+ p = start = b;
1230
+ }
1231
+ p = p.next;
1232
+ } while (p !== start);
1233
+ return filterPoints(p);
1234
+ }
1235
+ function splitEarcut(start, triangles, dim, minX, minY, invSize) {
1236
+ let a = start;
1237
+ do {
1238
+ let b = a.next.next;
1239
+ while (b !== a.prev) {
1240
+ if (a.i !== b.i && isValidDiagonal(a, b)) {
1241
+ let c = splitPolygon(a, b);
1242
+ a = filterPoints(a, a.next);
1243
+ c = filterPoints(c, c.next);
1244
+ earcutLinked(a, triangles, dim, minX, minY, invSize);
1245
+ earcutLinked(c, triangles, dim, minX, minY, invSize);
1246
+ return;
1247
+ }
1248
+ b = b.next;
1249
+ }
1250
+ a = a.next;
1251
+ } while (a !== start);
1252
+ }
1253
+ function eliminateHoles(data, holeIndices, outerNode, dim, areas) {
1254
+ const queue = [];
1255
+ let i2;
1256
+ let len;
1257
+ let start;
1258
+ let end;
1259
+ let list;
1260
+ for (i2 = 0, len = holeIndices.length; i2 < len; i2++) {
1261
+ start = holeIndices[i2] * dim;
1262
+ end = i2 < len - 1 ? holeIndices[i2 + 1] * dim : data.length;
1263
+ list = linkedList(data, start, end, dim, false, areas && areas[i2 + 1]);
1264
+ if (list === list.next)
1265
+ list.steiner = true;
1266
+ queue.push(getLeftmost(list));
1267
+ }
1268
+ queue.sort(compareX);
1269
+ for (i2 = 0; i2 < queue.length; i2++) {
1270
+ eliminateHole(queue[i2], outerNode);
1271
+ outerNode = filterPoints(outerNode, outerNode.next);
1272
+ }
1273
+ return outerNode;
1274
+ }
1275
+ function compareX(a, b) {
1276
+ return a.x - b.x;
1277
+ }
1278
+ function eliminateHole(hole, outerNode) {
1279
+ outerNode = findHoleBridge(hole, outerNode);
1280
+ if (outerNode) {
1281
+ const b = splitPolygon(outerNode, hole);
1282
+ filterPoints(outerNode, outerNode.next);
1283
+ filterPoints(b, b.next);
1284
+ }
1285
+ }
1286
+ function findHoleBridge(hole, outerNode) {
1287
+ let p = outerNode;
1288
+ const hx = hole.x;
1289
+ const hy = hole.y;
1290
+ let qx = -Infinity;
1291
+ let m;
1292
+ do {
1293
+ if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
1294
+ const x2 = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
1295
+ if (x2 <= hx && x2 > qx) {
1296
+ qx = x2;
1297
+ if (x2 === hx) {
1298
+ if (hy === p.y)
1299
+ return p;
1300
+ if (hy === p.next.y)
1301
+ return p.next;
1302
+ }
1303
+ m = p.x < p.next.x ? p : p.next;
1304
+ }
1305
+ }
1306
+ p = p.next;
1307
+ } while (p !== outerNode);
1308
+ if (!m)
1309
+ return null;
1310
+ if (hx === qx)
1311
+ return m;
1312
+ const stop = m;
1313
+ const mx = m.x;
1314
+ const my = m.y;
1315
+ let tanMin = Infinity;
1316
+ let tan;
1317
+ p = m;
1318
+ do {
1319
+ if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
1320
+ tan = Math.abs(hy - p.y) / (hx - p.x);
1321
+ if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
1322
+ m = p;
1323
+ tanMin = tan;
1324
+ }
1325
+ }
1326
+ p = p.next;
1327
+ } while (p !== stop);
1328
+ return m;
1329
+ }
1330
+ function sectorContainsSector(m, p) {
1331
+ return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
1332
+ }
1333
+ function indexCurve(start, minX, minY, invSize) {
1334
+ let p = start;
1335
+ do {
1336
+ if (p.z === null)
1337
+ p.z = zOrder(p.x, p.y, minX, minY, invSize);
1338
+ p.prevZ = p.prev;
1339
+ p.nextZ = p.next;
1340
+ p = p.next;
1341
+ } while (p !== start);
1342
+ p.prevZ.nextZ = null;
1343
+ p.prevZ = null;
1344
+ sortLinked(p);
1345
+ }
1346
+ function sortLinked(list) {
1347
+ let e;
1348
+ let i2;
1349
+ let inSize = 1;
1350
+ let numMerges;
1351
+ let p;
1352
+ let pSize;
1353
+ let q;
1354
+ let qSize;
1355
+ let tail;
1356
+ do {
1357
+ p = list;
1358
+ list = null;
1359
+ tail = null;
1360
+ numMerges = 0;
1361
+ while (p) {
1362
+ numMerges++;
1363
+ q = p;
1364
+ pSize = 0;
1365
+ for (i2 = 0; i2 < inSize; i2++) {
1366
+ pSize++;
1367
+ q = q.nextZ;
1368
+ if (!q)
1369
+ break;
1370
+ }
1371
+ qSize = inSize;
1372
+ while (pSize > 0 || qSize > 0 && q) {
1373
+ if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
1374
+ e = p;
1375
+ p = p.nextZ;
1376
+ pSize--;
1377
+ } else {
1378
+ e = q;
1379
+ q = q.nextZ;
1380
+ qSize--;
1381
+ }
1382
+ if (tail)
1383
+ tail.nextZ = e;
1384
+ else
1385
+ list = e;
1386
+ e.prevZ = tail;
1387
+ tail = e;
1388
+ }
1389
+ p = q;
1390
+ }
1391
+ tail.nextZ = null;
1392
+ inSize *= 2;
1393
+ } while (numMerges > 1);
1394
+ return list;
1395
+ }
1396
+ function zOrder(x2, y2, minX, minY, invSize) {
1397
+ x2 = 32767 * (x2 - minX) * invSize;
1398
+ y2 = 32767 * (y2 - minY) * invSize;
1399
+ x2 = (x2 | x2 << 8) & 16711935;
1400
+ x2 = (x2 | x2 << 4) & 252645135;
1401
+ x2 = (x2 | x2 << 2) & 858993459;
1402
+ x2 = (x2 | x2 << 1) & 1431655765;
1403
+ y2 = (y2 | y2 << 8) & 16711935;
1404
+ y2 = (y2 | y2 << 4) & 252645135;
1405
+ y2 = (y2 | y2 << 2) & 858993459;
1406
+ y2 = (y2 | y2 << 1) & 1431655765;
1407
+ return x2 | y2 << 1;
1408
+ }
1409
+ function getLeftmost(start) {
1410
+ let p = start;
1411
+ let leftmost = start;
1412
+ do {
1413
+ if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y)
1414
+ leftmost = p;
1415
+ p = p.next;
1416
+ } while (p !== start);
1417
+ return leftmost;
1418
+ }
1419
+ function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
1420
+ return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
1421
+ }
1422
+ function isValidDiagonal(a, b) {
1423
+ return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
1424
+ }
1425
+ function area(p, q, r) {
1426
+ return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
1427
+ }
1428
+ function equals(p1, p2) {
1429
+ return p1.x === p2.x && p1.y === p2.y;
1430
+ }
1431
+ function intersects(p1, q1, p2, q2) {
1432
+ const o1 = sign(area(p1, q1, p2));
1433
+ const o2 = sign(area(p1, q1, q2));
1434
+ const o3 = sign(area(p2, q2, p1));
1435
+ const o4 = sign(area(p2, q2, q1));
1436
+ if (o1 !== o2 && o3 !== o4)
1437
+ return true;
1438
+ if (o1 === 0 && onSegment(p1, p2, q1))
1439
+ return true;
1440
+ if (o2 === 0 && onSegment(p1, q2, q1))
1441
+ return true;
1442
+ if (o3 === 0 && onSegment(p2, p1, q2))
1443
+ return true;
1444
+ if (o4 === 0 && onSegment(p2, q1, q2))
1445
+ return true;
1446
+ return false;
1447
+ }
1448
+ function onSegment(p, q, r) {
1449
+ return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
1450
+ }
1451
+ function sign(num) {
1452
+ return num > 0 ? 1 : num < 0 ? -1 : 0;
1453
+ }
1454
+ function intersectsPolygon(a, b) {
1455
+ let p = a;
1456
+ do {
1457
+ if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b))
1458
+ return true;
1459
+ p = p.next;
1460
+ } while (p !== a);
1461
+ return false;
1462
+ }
1463
+ function locallyInside(a, b) {
1464
+ return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
1465
+ }
1466
+ function middleInside(a, b) {
1467
+ let p = a;
1468
+ let inside = false;
1469
+ const px = (a.x + b.x) / 2;
1470
+ const py = (a.y + b.y) / 2;
1471
+ do {
1472
+ if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)
1473
+ inside = !inside;
1474
+ p = p.next;
1475
+ } while (p !== a);
1476
+ return inside;
1477
+ }
1478
+ function splitPolygon(a, b) {
1479
+ const a2 = new Node(a.i, a.x, a.y);
1480
+ const b2 = new Node(b.i, b.x, b.y);
1481
+ const an = a.next;
1482
+ const bp = b.prev;
1483
+ a.next = b;
1484
+ b.prev = a;
1485
+ a2.next = an;
1486
+ an.prev = a2;
1487
+ b2.next = a2;
1488
+ a2.prev = b2;
1489
+ bp.next = b2;
1490
+ b2.prev = bp;
1491
+ return b2;
1492
+ }
1493
+ function insertNode(i2, x2, y2, last) {
1494
+ const p = new Node(i2, x2, y2);
1495
+ if (!last) {
1496
+ p.prev = p;
1497
+ p.next = p;
1498
+ } else {
1499
+ p.next = last.next;
1500
+ p.prev = last;
1501
+ last.next.prev = p;
1502
+ last.next = p;
1503
+ }
1504
+ return p;
1505
+ }
1506
+ function removeNode(p) {
1507
+ p.next.prev = p.prev;
1508
+ p.prev.next = p.next;
1509
+ if (p.prevZ)
1510
+ p.prevZ.nextZ = p.nextZ;
1511
+ if (p.nextZ)
1512
+ p.nextZ.prevZ = p.prevZ;
1513
+ }
1514
+ function Node(i2, x2, y2) {
1515
+ this.i = i2;
1516
+ this.x = x2;
1517
+ this.y = y2;
1518
+ this.prev = null;
1519
+ this.next = null;
1520
+ this.z = null;
1521
+ this.prevZ = null;
1522
+ this.nextZ = null;
1523
+ this.steiner = false;
1524
+ }
1525
+
1526
+ // src/helpers/binary-util-functions.ts
1527
+ function classifyRings2(geom) {
1528
+ const len = geom.lines.length;
1529
+ if (len <= 1) {
1530
+ return {
1531
+ data: geom.data,
1532
+ areas: [[getPolygonSignedArea(geom.data)]],
1533
+ lines: [geom.lines]
1534
+ };
1535
+ }
1536
+ const areas = [];
1537
+ const polygons = [];
1538
+ let ringAreas = [];
1539
+ let polygon = [];
1540
+ let ccw;
1541
+ let offset = 0;
1542
+ for (let endIndex, i2 = 0, startIndex; i2 < len; i2++) {
1543
+ startIndex = geom.lines[i2] - offset;
1544
+ endIndex = geom.lines[i2 + 1] - offset || geom.data.length;
1545
+ const shape = geom.data.slice(startIndex, endIndex);
1546
+ const area2 = getPolygonSignedArea(shape);
1547
+ if (area2 === 0) {
1548
+ const before = geom.data.slice(0, startIndex);
1549
+ const after = geom.data.slice(endIndex);
1550
+ geom.data = before.concat(after);
1551
+ offset += endIndex - startIndex;
1552
+ continue;
1553
+ }
1554
+ if (ccw === void 0)
1555
+ ccw = area2 < 0;
1556
+ if (ccw === area2 < 0) {
1557
+ if (polygon.length) {
1558
+ areas.push(ringAreas);
1559
+ polygons.push(polygon);
1560
+ }
1561
+ polygon = [startIndex];
1562
+ ringAreas = [area2];
1563
+ } else {
1564
+ ringAreas.push(area2);
1565
+ polygon.push(startIndex);
1566
+ }
1567
+ }
1568
+ if (ringAreas)
1569
+ areas.push(ringAreas);
1570
+ if (polygon.length)
1571
+ polygons.push(polygon);
1572
+ return { areas, lines: polygons, data: geom.data };
1573
+ }
1574
+ function project(data, x0, y0, size) {
1575
+ for (let j = 0, jl = data.length; j < jl; j += 2) {
1576
+ data[j] = (data[j] + x0) * 360 / size - 180;
1577
+ const y2 = 180 - (data[j + 1] + y0) * 360 / size;
1578
+ data[j + 1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
1579
+ }
1580
+ }
1581
+ function readFeature2(tag, feature, pbf) {
1582
+ if (feature && pbf) {
1583
+ if (tag === 1)
1584
+ feature.id = pbf.readVarint();
1585
+ else if (tag === 2)
1586
+ readTag2(pbf, feature);
1587
+ else if (tag === 3)
1588
+ feature.type = pbf.readVarint();
1589
+ else if (tag === 4)
1590
+ feature._geometry = pbf.pos;
1591
+ }
1592
+ }
1593
+ function readTag2(pbf, feature) {
1594
+ const end = pbf.readVarint() + pbf.pos;
1595
+ while (pbf.pos < end) {
1596
+ const key = feature._keys[pbf.readVarint()];
1597
+ const value = feature._values[pbf.readVarint()];
1598
+ feature.properties[key] = value;
1599
+ }
1600
+ }
1601
+
1602
+ // src/lib/binary-vector-tile/vector-tile-feature.ts
1603
+ var endPos;
1604
+ var cmd;
1605
+ var cmdLen;
1606
+ var length;
1607
+ var x;
1608
+ var y;
1609
+ var i;
1610
+ var VectorTileFeature2 = class {
1611
+ static get types() {
1612
+ return ["Unknown", "Point", "LineString", "Polygon"];
1613
+ }
1614
+ constructor(pbf, end, extent, keys, values, firstPassData) {
1615
+ this.properties = {};
1616
+ this.extent = extent;
1617
+ this.type = 0;
1618
+ this.id = null;
1619
+ this._pbf = pbf;
1620
+ this._geometry = -1;
1621
+ this._keys = keys;
1622
+ this._values = values;
1623
+ this._firstPassData = firstPassData;
1624
+ pbf.readFields(readFeature2, this, end);
1625
+ }
1626
+ loadGeometry() {
1627
+ const pbf = this._pbf;
1628
+ pbf.pos = this._geometry;
1629
+ endPos = pbf.readVarint() + pbf.pos;
1630
+ cmd = 1;
1631
+ length = 0;
1632
+ x = 0;
1633
+ y = 0;
1634
+ i = 0;
1635
+ const lines = [];
1636
+ const data = [];
1637
+ while (pbf.pos < endPos) {
1638
+ if (length <= 0) {
1639
+ cmdLen = pbf.readVarint();
1640
+ cmd = cmdLen & 7;
1641
+ length = cmdLen >> 3;
1642
+ }
1643
+ length--;
1644
+ if (cmd === 1 || cmd === 2) {
1645
+ x += pbf.readSVarint();
1646
+ y += pbf.readSVarint();
1647
+ if (cmd === 1) {
1648
+ lines.push(i);
1649
+ }
1650
+ data.push(x, y);
1651
+ i += 2;
1652
+ } else if (cmd === 7) {
1653
+ if (i > 0) {
1654
+ const start = lines[lines.length - 1];
1655
+ data.push(data[start], data[start + 1]);
1656
+ i += 2;
1657
+ }
1658
+ } else {
1659
+ throw new Error(`unknown command ${cmd}`);
1660
+ }
1661
+ }
1662
+ return { data, lines };
1663
+ }
1664
+ _toBinaryCoordinates(transform) {
1665
+ let geom = this.loadGeometry();
1666
+ transform(geom.data, this);
1667
+ const coordLength = 2;
1668
+ switch (this.type) {
1669
+ case 1:
1670
+ this._firstPassData.pointFeaturesCount++;
1671
+ this._firstPassData.pointPositionsCount += geom.lines.length;
1672
+ break;
1673
+ case 2:
1674
+ this._firstPassData.lineFeaturesCount++;
1675
+ this._firstPassData.linePathsCount += geom.lines.length;
1676
+ this._firstPassData.linePositionsCount += geom.data.length / coordLength;
1677
+ break;
1678
+ case 3:
1679
+ const classified = classifyRings2(geom);
1680
+ this._firstPassData.polygonFeaturesCount++;
1681
+ this._firstPassData.polygonObjectsCount += classified.lines.length;
1682
+ for (const lines of classified.lines) {
1683
+ this._firstPassData.polygonRingsCount += lines.length;
1684
+ }
1685
+ this._firstPassData.polygonPositionsCount += classified.data.length / coordLength;
1686
+ geom = classified;
1687
+ break;
1688
+ }
1689
+ geom.type = VectorTileFeature2.types[this.type];
1690
+ if (geom.lines.length > 1) {
1691
+ geom.type = `Multi${geom.type}`;
1692
+ }
1693
+ const result = {
1694
+ type: "Feature",
1695
+ geometry: geom,
1696
+ properties: this.properties
1697
+ };
1698
+ if (this.id !== null) {
1699
+ result.id = this.id;
1700
+ }
1701
+ return result;
1702
+ }
1703
+ toBinaryCoordinates(options) {
1704
+ if (typeof options === "function") {
1705
+ return this._toBinaryCoordinates(options);
1706
+ }
1707
+ return this._toBinaryCoordinates(project);
1708
+ }
1709
+ };
1710
+
1711
+ // src/lib/binary-vector-tile/vector-tile-layer.ts
1712
+ var VectorTileLayer2 = class {
1713
+ constructor(pbf, end) {
1714
+ this.version = 1;
1715
+ this.name = "";
1716
+ this.extent = 4096;
1717
+ this.length = 0;
1718
+ this._pbf = pbf;
1719
+ this._keys = [];
1720
+ this._values = [];
1721
+ this._features = [];
1722
+ pbf.readFields(readLayer2, this, end);
1723
+ this.length = this._features.length;
1724
+ }
1725
+ feature(i2, firstPassData) {
1726
+ if (i2 < 0 || i2 >= this._features.length) {
1727
+ throw new Error("feature index out of bounds");
1728
+ }
1729
+ this._pbf.pos = this._features[i2];
1730
+ const end = this._pbf.readVarint() + this._pbf.pos;
1731
+ return new VectorTileFeature2(this._pbf, end, this.extent, this._keys, this._values, firstPassData);
1732
+ }
1733
+ };
1734
+ function readLayer2(tag, layer, pbf) {
1735
+ if (layer && pbf) {
1736
+ if (tag === 15)
1737
+ layer.version = pbf.readVarint();
1738
+ else if (tag === 1)
1739
+ layer.name = pbf.readString();
1740
+ else if (tag === 5)
1741
+ layer.extent = pbf.readVarint();
1742
+ else if (tag === 2)
1743
+ layer._features.push(pbf.pos);
1744
+ else if (tag === 3)
1745
+ layer._keys.push(pbf.readString());
1746
+ else if (tag === 4)
1747
+ layer._values.push(readValueMessage2(pbf));
1748
+ }
1749
+ }
1750
+ function readValueMessage2(pbf) {
1751
+ let value = null;
1752
+ const end = pbf.readVarint() + pbf.pos;
1753
+ while (pbf.pos < end) {
1754
+ const tag = pbf.readVarint() >> 3;
1755
+ value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
1756
+ }
1757
+ return value;
1758
+ }
1759
+
1760
+ // src/lib/binary-vector-tile/vector-tile.ts
1761
+ var VectorTile2 = class {
1762
+ constructor(pbf, end) {
1763
+ this.layers = pbf.readFields(readTile2, {}, end);
1764
+ }
1765
+ };
1766
+ function readTile2(tag, layers, pbf) {
1767
+ if (tag === 3) {
1768
+ if (pbf) {
1769
+ const layer = new VectorTileLayer2(pbf, pbf.readVarint() + pbf.pos);
1770
+ if (layer.length && layers) {
1771
+ layers[layer.name] = layer;
1772
+ }
1773
+ }
1774
+ }
1775
+ }
1776
+
1777
+ // src/lib/binary-vector-tile/features-to-binary.ts
1778
+ function featuresToBinary(features, firstPassData, options) {
1779
+ return fillArrays(features, firstPassData, {
1780
+ numericPropKeys: options ? options.numericPropKeys : extractNumericPropKeys(features),
1781
+ PositionDataType: options ? options.PositionDataType : Float32Array
1782
+ });
1783
+ }
1784
+ function extractNumericPropKeys(features) {
1785
+ const numericPropKeys = {};
1786
+ for (const feature of features) {
1787
+ if (feature.properties) {
1788
+ for (const key in feature.properties) {
1789
+ const numericSoFar = numericPropKeys[key];
1790
+ if (numericSoFar || numericSoFar === void 0) {
1791
+ const val = feature.properties[key];
1792
+ numericPropKeys[key] = isNumeric(val);
1793
+ }
1794
+ }
1795
+ }
1796
+ }
1797
+ return Object.keys(numericPropKeys).filter((k) => numericPropKeys[k]);
1798
+ }
1799
+ function fillArrays(features, firstPassData, options) {
1800
+ const {
1801
+ pointPositionsCount,
1802
+ pointFeaturesCount,
1803
+ linePositionsCount,
1804
+ linePathsCount,
1805
+ lineFeaturesCount,
1806
+ polygonPositionsCount,
1807
+ polygonObjectsCount,
1808
+ polygonRingsCount,
1809
+ polygonFeaturesCount
1810
+ } = firstPassData;
1811
+ const { numericPropKeys, PositionDataType = Float32Array } = options;
1812
+ const hasGlobalId = features[0] && "id" in features[0];
1813
+ const coordLength = 2;
1814
+ const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
1815
+ const points = {
1816
+ positions: new PositionDataType(pointPositionsCount * coordLength),
1817
+ globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),
1818
+ featureIds: pointFeaturesCount > 65535 ? new Uint32Array(pointPositionsCount) : new Uint16Array(pointPositionsCount),
1819
+ numericProps: {},
1820
+ properties: [],
1821
+ fields: []
1822
+ };
1823
+ const lines = {
1824
+ pathIndices: linePositionsCount > 65535 ? new Uint32Array(linePathsCount + 1) : new Uint16Array(linePathsCount + 1),
1825
+ positions: new PositionDataType(linePositionsCount * coordLength),
1826
+ globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),
1827
+ featureIds: lineFeaturesCount > 65535 ? new Uint32Array(linePositionsCount) : new Uint16Array(linePositionsCount),
1828
+ numericProps: {},
1829
+ properties: [],
1830
+ fields: []
1831
+ };
1832
+ const polygons = {
1833
+ polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),
1834
+ primitivePolygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonRingsCount + 1) : new Uint16Array(polygonRingsCount + 1),
1835
+ positions: new PositionDataType(polygonPositionsCount * coordLength),
1836
+ triangles: [],
1837
+ globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),
1838
+ featureIds: polygonFeaturesCount > 65535 ? new Uint32Array(polygonPositionsCount) : new Uint16Array(polygonPositionsCount),
1839
+ numericProps: {},
1840
+ properties: [],
1841
+ fields: []
1842
+ };
1843
+ for (const object of [points, lines, polygons]) {
1844
+ for (const propName of numericPropKeys) {
1845
+ object.numericProps[propName] = new Float32Array(object.positions.length / coordLength);
1846
+ }
1847
+ }
1848
+ lines.pathIndices[linePathsCount] = linePositionsCount;
1849
+ polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;
1850
+ polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;
1851
+ const indexMap = {
1852
+ pointPosition: 0,
1853
+ pointFeature: 0,
1854
+ linePosition: 0,
1855
+ linePath: 0,
1856
+ lineFeature: 0,
1857
+ polygonPosition: 0,
1858
+ polygonObject: 0,
1859
+ polygonRing: 0,
1860
+ polygonFeature: 0,
1861
+ feature: 0
1862
+ };
1863
+ for (const feature of features) {
1864
+ const geometry = feature.geometry;
1865
+ const properties = feature.properties || {};
1866
+ switch (geometry.type) {
1867
+ case "Point":
1868
+ case "MultiPoint":
1869
+ handlePoint(geometry, points, indexMap, coordLength, properties);
1870
+ points.properties.push(keepStringProperties(properties, numericPropKeys));
1871
+ if (hasGlobalId) {
1872
+ points.fields.push({ id: feature.id });
1873
+ }
1874
+ indexMap.pointFeature++;
1875
+ break;
1876
+ case "LineString":
1877
+ case "MultiLineString":
1878
+ handleLineString(geometry, lines, indexMap, coordLength, properties);
1879
+ lines.properties.push(keepStringProperties(properties, numericPropKeys));
1880
+ if (hasGlobalId) {
1881
+ lines.fields.push({ id: feature.id });
1882
+ }
1883
+ indexMap.lineFeature++;
1884
+ break;
1885
+ case "Polygon":
1886
+ case "MultiPolygon":
1887
+ handlePolygon(geometry, polygons, indexMap, coordLength, properties);
1888
+ polygons.properties.push(keepStringProperties(properties, numericPropKeys));
1889
+ if (hasGlobalId) {
1890
+ polygons.fields.push({ id: feature.id });
1891
+ }
1892
+ indexMap.polygonFeature++;
1893
+ break;
1894
+ default:
1895
+ throw new Error("Invalid geometry type");
1896
+ }
1897
+ indexMap.feature++;
1898
+ }
1899
+ return makeAccessorObjects(points, lines, polygons, coordLength);
1900
+ }
1901
+ function handlePoint(geometry, points, indexMap, coordLength, properties) {
1902
+ points.positions.set(geometry.data, indexMap.pointPosition * coordLength);
1903
+ const nPositions = geometry.data.length / coordLength;
1904
+ fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);
1905
+ points.globalFeatureIds.fill(indexMap.feature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
1906
+ points.featureIds.fill(indexMap.pointFeature, indexMap.pointPosition, indexMap.pointPosition + nPositions);
1907
+ indexMap.pointPosition += nPositions;
1908
+ }
1909
+ function handleLineString(geometry, lines, indexMap, coordLength, properties) {
1910
+ lines.positions.set(geometry.data, indexMap.linePosition * coordLength);
1911
+ const nPositions = geometry.data.length / coordLength;
1912
+ fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);
1913
+ lines.globalFeatureIds.fill(indexMap.feature, indexMap.linePosition, indexMap.linePosition + nPositions);
1914
+ lines.featureIds.fill(indexMap.lineFeature, indexMap.linePosition, indexMap.linePosition + nPositions);
1915
+ for (let i2 = 0, il = geometry.lines.length; i2 < il; ++i2) {
1916
+ const start = geometry.lines[i2];
1917
+ const end = i2 === il - 1 ? geometry.data.length : geometry.lines[i2 + 1];
1918
+ lines.pathIndices[indexMap.linePath++] = indexMap.linePosition;
1919
+ indexMap.linePosition += (end - start) / coordLength;
1920
+ }
1921
+ }
1922
+ function handlePolygon(geometry, polygons, indexMap, coordLength, properties) {
1923
+ polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);
1924
+ const nPositions = geometry.data.length / coordLength;
1925
+ fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
1926
+ polygons.globalFeatureIds.fill(indexMap.feature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
1927
+ polygons.featureIds.fill(indexMap.polygonFeature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
1928
+ for (let l = 0, ll = geometry.lines.length; l < ll; ++l) {
1929
+ const startPosition = indexMap.polygonPosition;
1930
+ polygons.polygonIndices[indexMap.polygonObject++] = startPosition;
1931
+ const areas = geometry.areas[l];
1932
+ const lines = geometry.lines[l];
1933
+ const nextLines = geometry.lines[l + 1];
1934
+ for (let i2 = 0, il = lines.length; i2 < il; ++i2) {
1935
+ const start = lines[i2];
1936
+ const end = i2 === il - 1 ? nextLines === void 0 ? geometry.data.length : nextLines[0] : lines[i2 + 1];
1937
+ polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
1938
+ indexMap.polygonPosition += (end - start) / coordLength;
1939
+ }
1940
+ const endPosition = indexMap.polygonPosition;
1941
+ triangulatePolygon(polygons, areas, lines, { startPosition, endPosition, coordLength });
1942
+ }
1943
+ }
1944
+ function triangulatePolygon(polygons, areas, lines, {
1945
+ startPosition,
1946
+ endPosition,
1947
+ coordLength
1948
+ }) {
1949
+ const start = startPosition * coordLength;
1950
+ const end = endPosition * coordLength;
1951
+ const polygonPositions = polygons.positions.subarray(start, end);
1952
+ const offset = lines[0];
1953
+ const holes = lines.slice(1).map((n) => (n - offset) / coordLength);
1954
+ const indices = earcut(polygonPositions, holes, coordLength, areas);
1955
+ for (let t = 0, tl = indices.length; t < tl; ++t) {
1956
+ polygons.triangles.push(startPosition + indices[t]);
1957
+ }
1958
+ }
1959
+ function makeAccessorObjects(points, lines, polygons, coordLength) {
1960
+ const returnObj = {
1961
+ points: {
1962
+ ...points,
1963
+ positions: { value: points.positions, size: coordLength },
1964
+ globalFeatureIds: { value: points.globalFeatureIds, size: 1 },
1965
+ featureIds: { value: points.featureIds, size: 1 }
1966
+ },
1967
+ lines: {
1968
+ ...lines,
1969
+ pathIndices: { value: lines.pathIndices, size: 1 },
1970
+ positions: { value: lines.positions, size: coordLength },
1971
+ globalFeatureIds: { value: lines.globalFeatureIds, size: 1 },
1972
+ featureIds: { value: lines.featureIds, size: 1 }
1973
+ },
1974
+ polygons: {
1975
+ ...polygons,
1976
+ polygonIndices: { value: polygons.polygonIndices, size: 1 },
1977
+ primitivePolygonIndices: { value: polygons.primitivePolygonIndices, size: 1 },
1978
+ positions: { value: polygons.positions, size: coordLength },
1979
+ triangles: { value: new Uint32Array(polygons.triangles), size: 1 },
1980
+ globalFeatureIds: { value: polygons.globalFeatureIds, size: 1 },
1981
+ featureIds: { value: polygons.featureIds, size: 1 }
1982
+ }
1983
+ };
1984
+ for (const geomType in returnObj) {
1985
+ for (const numericProp in returnObj[geomType].numericProps) {
1986
+ returnObj[geomType].numericProps[numericProp] = {
1987
+ value: returnObj[geomType].numericProps[numericProp],
1988
+ size: 1
1989
+ };
1990
+ }
1991
+ }
1992
+ return returnObj;
1993
+ }
1994
+ function fillNumericProperties(object, properties, index, length2) {
1995
+ for (const numericPropName in object.numericProps) {
1996
+ if (numericPropName in properties) {
1997
+ object.numericProps[numericPropName].fill(properties[numericPropName], index, index + length2);
1998
+ }
1999
+ }
2000
+ }
2001
+ function keepStringProperties(properties, numericKeys) {
2002
+ const props = {};
2003
+ for (const key in properties) {
2004
+ if (!numericKeys.includes(key)) {
2005
+ props[key] = properties[key];
2006
+ }
2007
+ }
2008
+ return props;
2009
+ }
2010
+ function isNumeric(x2) {
2011
+ return Number.isFinite(x2);
2012
+ }
2013
+
2014
+ // src/lib/parse-mvt.ts
2015
+ var import_pbf = __toModule(require_pbf());
2016
+ function parseMVT(arrayBuffer, options) {
2017
+ options = normalizeOptions(options);
2018
+ const features = [];
2019
+ if (options) {
2020
+ const binary = options.gis.format === "binary";
2021
+ const firstPassData = {
2022
+ pointPositionsCount: 0,
2023
+ pointFeaturesCount: 0,
2024
+ linePositionsCount: 0,
2025
+ linePathsCount: 0,
2026
+ lineFeaturesCount: 0,
2027
+ polygonPositionsCount: 0,
2028
+ polygonObjectsCount: 0,
2029
+ polygonRingsCount: 0,
2030
+ polygonFeaturesCount: 0
2031
+ };
2032
+ if (arrayBuffer.byteLength > 0) {
2033
+ const tile = binary ? new VectorTile2(new import_pbf.default(arrayBuffer)) : new VectorTile(new import_pbf.default(arrayBuffer));
2034
+ const loaderOptions = options.mvt;
2035
+ const selectedLayers = Array.isArray(loaderOptions.layers) ? loaderOptions.layers : Object.keys(tile.layers);
2036
+ selectedLayers.forEach((layerName) => {
2037
+ const vectorTileLayer = tile.layers[layerName];
2038
+ const featureOptions = { ...loaderOptions, layerName };
2039
+ if (!vectorTileLayer) {
2040
+ return;
2041
+ }
2042
+ for (let i2 = 0; i2 < vectorTileLayer.length; i2++) {
2043
+ const vectorTileFeature = vectorTileLayer.feature(i2, firstPassData);
2044
+ const decodedFeature = binary ? getDecodedFeatureBinary(vectorTileFeature, featureOptions) : getDecodedFeature(vectorTileFeature, featureOptions);
2045
+ features.push(decodedFeature);
2046
+ }
2047
+ });
2048
+ }
2049
+ if (binary) {
2050
+ const data = featuresToBinary(features, firstPassData);
2051
+ data.byteLength = arrayBuffer.byteLength;
2052
+ return data;
2053
+ }
2054
+ }
2055
+ return features;
2056
+ }
2057
+ function normalizeOptions(options) {
2058
+ if (options) {
2059
+ options = {
2060
+ ...options,
2061
+ mvt: options.mvt || {},
2062
+ gis: options.gis || {}
2063
+ };
2064
+ const wgs84Coordinates = options.coordinates === "wgs84";
2065
+ const { tileIndex } = options;
2066
+ const hasTileIndex = tileIndex && Number.isFinite(tileIndex.x) && Number.isFinite(tileIndex.y) && Number.isFinite(tileIndex.z);
2067
+ if (wgs84Coordinates && !hasTileIndex) {
2068
+ throw new Error("MVT Loader: WGS84 coordinates need tileIndex property. Check documentation.");
2069
+ }
2070
+ }
2071
+ return options;
2072
+ }
2073
+ function getDecodedFeature(feature, options) {
2074
+ const decodedFeature = feature.toGeoJSON(options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinates);
2075
+ if (options.layerProperty) {
2076
+ decodedFeature.properties[options.layerProperty] = options.layerName;
2077
+ }
2078
+ return decodedFeature;
2079
+ }
2080
+ function getDecodedFeatureBinary(feature, options) {
2081
+ const decodedFeature = feature.toBinaryCoordinates(options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinatesBinary);
2082
+ if (options.layerProperty) {
2083
+ decodedFeature.properties[options.layerProperty] = options.layerName;
2084
+ }
2085
+ return decodedFeature;
2086
+ }
2087
+ function transformToLocalCoordinates(line, feature) {
2088
+ const { extent } = feature;
2089
+ for (let i2 = 0; i2 < line.length; i2++) {
2090
+ const p = line[i2];
2091
+ p[0] /= extent;
2092
+ p[1] /= extent;
2093
+ }
2094
+ }
2095
+ function transformToLocalCoordinatesBinary(data, feature) {
2096
+ const { extent } = feature;
2097
+ for (let i2 = 0, il = data.length; i2 < il; ++i2) {
2098
+ data[i2] /= extent;
2099
+ }
2100
+ }
2101
+
2102
+ // src/mvt-loader.ts
2103
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
2104
+ var MVTWorkerLoader = {
2105
+ name: "Mapbox Vector Tile",
2106
+ id: "mvt",
2107
+ module: "mvt",
2108
+ version: VERSION,
2109
+ extensions: ["mvt", "pbf"],
2110
+ mimeTypes: [
2111
+ "application/vnd.mapbox-vector-tile",
2112
+ "application/x-protobuf"
2113
+ ],
2114
+ worker: true,
2115
+ category: "geometry",
2116
+ options: {
2117
+ mvt: {
2118
+ coordinates: "local",
2119
+ layerProperty: "layerName",
2120
+ layers: null,
2121
+ tileIndex: null
2122
+ }
2123
+ }
2124
+ };
2125
+ var MVTLoader = {
2126
+ ...MVTWorkerLoader,
2127
+ parse: async (arrayBuffer, options) => parseMVT(arrayBuffer, options),
2128
+ parseSync: parseMVT,
2129
+ binary: true
2130
+ };
2131
+
2132
+ // ../worker-utils/src/lib/worker-utils/get-transfer-list.ts
2133
+ function getTransferList(object, recursive = true, transfers) {
2134
+ const transfersSet = transfers || new Set();
2135
+ if (!object) {
2136
+ } else if (isTransferable(object)) {
2137
+ transfersSet.add(object);
2138
+ } else if (isTransferable(object.buffer)) {
2139
+ transfersSet.add(object.buffer);
2140
+ } else if (ArrayBuffer.isView(object)) {
2141
+ } else if (recursive && typeof object === "object") {
2142
+ for (const key in object) {
2143
+ getTransferList(object[key], recursive, transfersSet);
2144
+ }
2145
+ }
2146
+ return transfers === void 0 ? Array.from(transfersSet) : [];
2147
+ }
2148
+ function isTransferable(object) {
2149
+ if (!object) {
2150
+ return false;
2151
+ }
2152
+ if (object instanceof ArrayBuffer) {
2153
+ return true;
2154
+ }
2155
+ if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
2156
+ return true;
2157
+ }
2158
+ if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
2159
+ return true;
2160
+ }
2161
+ if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
2162
+ return true;
2163
+ }
2164
+ return false;
2165
+ }
2166
+
2167
+ // ../worker-utils/src/lib/worker-farm/worker-body.ts
2168
+ var onMessageWrapperMap = new Map();
2169
+ var WorkerBody = class {
2170
+ static set onmessage(onMessage) {
2171
+ self.onmessage = (message) => {
2172
+ if (!isKnownMessage(message)) {
2173
+ return;
2174
+ }
2175
+ const { type, payload } = message.data;
2176
+ onMessage(type, payload);
2177
+ };
2178
+ }
2179
+ static addEventListener(onMessage) {
2180
+ let onMessageWrapper = onMessageWrapperMap.get(onMessage);
2181
+ if (!onMessageWrapper) {
2182
+ onMessageWrapper = (message) => {
2183
+ if (!isKnownMessage(message)) {
2184
+ return;
2185
+ }
2186
+ const { type, payload } = message.data;
2187
+ onMessage(type, payload);
2188
+ };
2189
+ }
2190
+ self.addEventListener("message", onMessageWrapper);
2191
+ }
2192
+ static removeEventListener(onMessage) {
2193
+ const onMessageWrapper = onMessageWrapperMap.get(onMessage);
2194
+ onMessageWrapperMap.delete(onMessage);
2195
+ self.removeEventListener("message", onMessageWrapper);
2196
+ }
2197
+ static postMessage(type, payload) {
2198
+ if (self) {
2199
+ const data = { source: "loaders.gl", type, payload };
2200
+ const transferList = getTransferList(payload);
2201
+ self.postMessage(data, transferList);
2202
+ }
2203
+ }
2204
+ };
2205
+ function isKnownMessage(message) {
2206
+ const { type, data } = message;
2207
+ return type === "message" && data && typeof data.source === "string" && data.source.startsWith("loaders.gl");
2208
+ }
2209
+
2210
+ // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
2211
+ var requestId = 0;
2212
+ function createLoaderWorker(loader) {
2213
+ if (typeof self === "undefined") {
2214
+ return;
2215
+ }
2216
+ WorkerBody.onmessage = async (type, payload) => {
2217
+ switch (type) {
2218
+ case "process":
2219
+ try {
2220
+ const { input, options = {} } = payload;
2221
+ const result = await parseData({
2222
+ loader,
2223
+ arrayBuffer: input,
2224
+ options,
2225
+ context: {
2226
+ parse: parseOnMainThread
2227
+ }
2228
+ });
2229
+ WorkerBody.postMessage("done", { result });
2230
+ } catch (error) {
2231
+ const message = error instanceof Error ? error.message : "";
2232
+ WorkerBody.postMessage("error", { error: message });
2233
+ }
2234
+ break;
2235
+ default:
2236
+ }
2237
+ };
2238
+ }
2239
+ function parseOnMainThread(arrayBuffer, options) {
2240
+ return new Promise((resolve, reject) => {
2241
+ const id = requestId++;
2242
+ const onMessage = (type, payload2) => {
2243
+ if (payload2.id !== id) {
2244
+ return;
2245
+ }
2246
+ switch (type) {
2247
+ case "done":
2248
+ WorkerBody.removeEventListener(onMessage);
2249
+ resolve(payload2.result);
2250
+ break;
2251
+ case "error":
2252
+ WorkerBody.removeEventListener(onMessage);
2253
+ reject(payload2.error);
2254
+ break;
2255
+ default:
2256
+ }
2257
+ };
2258
+ WorkerBody.addEventListener(onMessage);
2259
+ const payload = { id, input: arrayBuffer, options };
2260
+ WorkerBody.postMessage("process", payload);
2261
+ });
2262
+ }
2263
+ async function parseData({ loader, arrayBuffer, options, context }) {
2264
+ let data;
2265
+ let parser;
2266
+ if (loader.parseSync || loader.parse) {
2267
+ data = arrayBuffer;
2268
+ parser = loader.parseSync || loader.parse;
2269
+ } else if (loader.parseTextSync) {
2270
+ const textDecoder = new TextDecoder();
2271
+ data = textDecoder.decode(arrayBuffer);
2272
+ parser = loader.parseTextSync;
2273
+ } else {
2274
+ throw new Error(`Could not load data with ${loader.name} loader`);
2275
+ }
2276
+ options = {
2277
+ ...options,
2278
+ modules: loader && loader.options && loader.options.modules || {},
2279
+ worker: false
2280
+ };
2281
+ return await parser(data, { ...options }, context, loader);
2282
+ }
2283
+
2284
+ // src/workers/mvt-worker.ts
2285
+ createLoaderWorker(MVTLoader);
2286
+ })();
2
2287
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
3
- e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,f=u>>1,l=-7,h=r?i-1:0,c=r?-1:1,p=t[e+h];for(h+=c,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=c,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+t[e+h],h+=c,l-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,f=8*o-i-1,l=(1<<f)-1,h=l>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?c/u:c*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;t[r+p]=255&s,p+=d,s/=256,f-=8);t[r+p-d]|=128*y}},function(t,e,r){"use strict";r.r(e);var n=r(4),i=r.n(n),o=r(0),s=r.n(o),a=r(3),u=r.n(a),f=r(1),l=r.n(f),h=r(2),c=r.n(h);function p(t){for(var e,r,n=0,i=0,o=t.length-1;i<t.length;o=i++)e=t[i],n+=((r=t[o])[0]-e[0])*(e[1]+r[1]);return n}function d(t,e,r){e&&r&&(1===t?e.id=r.readVarint():2===t?function(t,e){var r=t.readVarint()+t.pos;for(;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3===t?e.type=r.readVarint():4===t&&(e._geometry=r.pos))}var y=function(){function t(e,r,n,i,o){l()(this,t),s()(this,"properties",void 0),s()(this,"extent",void 0),s()(this,"type",void 0),s()(this,"id",void 0),s()(this,"_pbf",void 0),s()(this,"_geometry",void 0),s()(this,"_keys",void 0),s()(this,"_values",void 0),this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,e.readFields(d,this,r)}return c()(t,[{key:"loadGeometry",value:function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=[];t.pos<r;){if(i<=0){var u=t.readVarint();n=7&u,i=u>>3}if(i--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&a.push(e),e=[]),e&&e.push([o,s]);else{if(7!==n)throw new Error("unknown command ".concat(n));e&&e.push(e[0].slice())}}return e&&a.push(e),a}},{key:"bbox",value:function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,s=1/0,a=-1/0,u=1/0,f=-1/0;t.pos<e;){if(n<=0){var l=t.readVarint();r=7&l,n=l>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<s&&(s=i),i>a&&(a=i),(o+=t.readSVarint())<u&&(u=o),o>f&&(f=o);else if(7!==r)throw new Error("unknown command ".concat(r))}return[s,u,a,f]}},{key:"_toGeoJSON",value:function(e){var r,n,i=this.loadGeometry(),o=t.types[this.type];switch(this.type){case 1:var s=[];for(r=0;r<i.length;r++)s[r]=i[r][0];e(i=s,this);break;case 2:for(r=0;r<i.length;r++)e(i[r],this);break;case 3:for(i=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],o=0;o<e;o++){var s=p(t[o]);0!==s&&(void 0===n&&(n=s<0),n===s<0?(r&&i.push(r),r=[t[o]]):r&&r.push(t[o]))}return r&&i.push(r),i}(i),r=0;r<i.length;r++)for(n=0;n<i[r].length;n++)e(i[r][n],this)}1===i.length?i=i[0]:o="Multi".concat(o);var a={type:"Feature",geometry:{type:o,coordinates:i},properties:this.properties};return null!==this.id&&(a.id=this.id),a}},{key:"toGeoJSON",value:function(t){if("function"==typeof t)return this._toGeoJSON(t);var e=t.x,r=t.y,n=t.z,i=this.extent*Math.pow(2,n),o=this.extent*e,s=this.extent*r;return this._toGeoJSON((function(t){for(var e=0;e<t.length;e++){var r=t[e];r[0]=360*(r[0]+o)/i-180;var n=180-360*(r[1]+s)/i;r[1]=360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90}}))}}],[{key:"types",get:function(){return["Unknown","Point","LineString","Polygon"]}}]),t}(),v=function(){function t(e,r){l()(this,t),s()(this,"version",void 0),s()(this,"name",void 0),s()(this,"extent",void 0),s()(this,"length",void 0),s()(this,"_pbf",void 0),s()(this,"_keys",void 0),s()(this,"_values",void 0),s()(this,"_features",void 0),this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(g,this,r),this.length=this._features.length}return c()(t,[{key:"feature",value:function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new y(this._pbf,e,this.extent,this._keys,this._values)}}]),t}();function g(t,e,r){e&&r&&(15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){var e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r)))}var x=function t(e,r){l()(this,t),s()(this,"layers",void 0),this.layers=e.readFields(w,{},r)};function w(t,e,r){if(3===t&&r){var n=new v(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}Math.PI,Math.PI;const b={};b.EPSILON=1e-12,b.debug=!1,b.precision=4,b.printTypes=!1,b.printDegrees=!1,b.printRowMajor=!0;function m(t,e={}){const{start:r=0,end:n=t.length}=e,i=e.size||2;let o=0;for(let e=r,s=n-i;e<n;e+=i)o+=(t[e]-t[s])*(t[e+1]+t[s+1]),s=e;return o/2}function P(t,e,r,n){r=r||2;const i=e&&e.length,o=i?e[0]*r:t.length;let s=F(t,0,o,r,!0,n&&n[0]);const a=[];if(!s||s.next===s.prev)return a;let u,f,l,h,c,p,d;if(i&&(s=function(t,e,r,n,i){const o=[];let s,a,u,f,l;for(s=0,a=e.length;s<a;s++)u=e[s]*n,f=s<a-1?e[s+1]*n:t.length,l=F(t,u,f,n,!1,i&&i[s+1]),l===l.next&&(l.steiner=!0),o.push(B(l));for(o.sort(M),s=0;s<o.length;s++)I(o[s],r),r=_(r,r.next);return r}(t,e,s,r,n)),t.length>80*r){h=f=t[0],c=l=t[1];for(let e=r;e<o;e+=r)p=t[e],d=t[e+1],p<h&&(h=p),d<c&&(c=d),p>f&&(f=p),d>l&&(l=d);u=Math.max(f-h,l-c),u=0!==u?1/u:0}return O(s,a,r,h,c,u),a}function F(t,e,r,n,i,o){let s,a;if(void 0===o&&(o=m(t,{start:e,end:r,size:n})),i===o<0)for(s=e;s<r;s+=n)a=R(s,t[s],t[s+1],a);else for(s=r-n;s>=e;s-=n)a=R(s,t[s],t[s+1],a);return a&&T(a,a.next)&&(J(a),a=a.next),a}function _(t,e){if(!t)return t;e||(e=t);let r,n=t;do{if(r=!1,n.steiner||!T(n,n.next)&&0!==A(n.prev,n,n.next))n=n.next;else{if(J(n),n=e=n.prev,n===n.next)break;r=!0}}while(r||n!==e);return e}function O(t,e,r,n,i,o,s){if(!t)return;!s&&o&&function(t,e,r,n){let i=t;do{null===i.z&&(i.z=L(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,r,n,i,o,s,a,u,f=1;do{for(i=t,t=null,u=null,n=0;i;){for(n++,s=i,o=0,r=0;r<f&&(o++,s=s.nextZ,s);r++);for(a=f;o>0||a>0&&s;)0!==o&&(0===a||!s||i.z<=s.z)?(e=i,i=i.nextZ,o--):(e=s,s=s.nextZ,a--),u?u.nextZ=e:t=e,e.prevZ=u,u=e;i=s}u.nextZ=null,f*=2}while(n>1)}(i)}(t,n,i,o);let a,u,f=t;for(;t.prev!==t.next;)if(a=t.prev,u=t.next,o?k(t,n,i,o):S(t))e.push(a.i/r),e.push(t.i/r),e.push(u.i/r),J(t),t=u.next,f=u.next;else if((t=u)===f){s?1===s?O(t=V(_(t),e,r),e,r,n,i,o,2):2===s&&j(t,e,r,n,i,o):O(_(t),e,r,n,i,o,1);break}}function S(t){const e=t.prev,r=t,n=t.next;if(A(e,r,n)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(D(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&A(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function k(t,e,r,n){const i=t.prev,o=t,s=t.next;if(A(i,o,s)>=0)return!1;const a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,u=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,f=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,l=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,h=L(a,u,e,r,n),c=L(f,l,e,r,n);let p=t.prevZ,d=t.nextZ;for(;p&&p.z>=h&&d&&d.z<=c;){if(p!==t.prev&&p!==t.next&&D(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&A(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&D(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&A(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&D(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&A(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&D(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&A(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function V(t,e,r){let n=t;do{const i=n.prev,o=n.next.next;!T(i,o)&&N(i,n,n.next,o)&&U(i,o)&&U(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),J(n),J(n.next),n=t=o),n=n.next}while(n!==t);return _(n)}function j(t,e,r,n,i,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&C(s,t)){let a=G(s,t);return s=_(s,s.next),a=_(a,a.next),O(s,e,r,n,i,o),void O(a,e,r,n,i,o)}t=t.next}s=s.next}while(s!==t)}function M(t,e){return t.x-e.x}function I(t,e){if(e=function(t,e){let r=e;const n=t.x,i=t.y;let o,s=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const t=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=n&&t>s){if(s=t,t===n){if(i===r.y)return r;if(i===r.next.y)return r.next}o=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!o)return null;if(n===s)return o;const a=o,u=o.x,f=o.y;let l,h=1/0;r=o;do{n>=r.x&&r.x>=u&&n!==r.x&&D(i<f?n:s,i,u,f,i<f?s:n,i,r.x,r.y)&&(l=Math.abs(i-r.y)/(n-r.x),U(r,t)&&(l<h||l===h&&(r.x>o.x||r.x===o.x&&E(o,r)))&&(o=r,h=l)),r=r.next}while(r!==a);return o}(t,e)){const r=G(e,t);_(e,e.next),_(r,r.next)}}function E(t,e){return A(t.prev,t,e.prev)<0&&A(e.next,t,t.next)<0}function L(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function B(t){let e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function D(t,e,r,n,i,o,s,a){return(i-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(n-a)-(r-s)*(e-a)>=0&&(r-s)*(o-a)-(i-s)*(n-a)>=0}function C(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&N(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(U(t,e)&&U(e,t)&&function(t,e){let r=t,n=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(A(t.prev,t,e.prev)||A(t,e.prev,e))||T(t,e)&&A(t.prev,t,t.next)>0&&A(e.prev,e,e.next)>0)}function A(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function T(t,e){return t.x===e.x&&t.y===e.y}function N(t,e,r,n){const i=Z(A(t,e,r)),o=Z(A(t,e,n)),s=Z(A(r,n,t)),a=Z(A(r,n,e));return i!==o&&s!==a||(!(0!==i||!z(t,r,e))||(!(0!==o||!z(t,n,e))||(!(0!==s||!z(r,t,n))||!(0!==a||!z(r,e,n)))))}function z(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Z(t){return t>0?1:t<0?-1:0}function U(t,e){return A(t.prev,t,t.next)<0?A(t,e,t.next)>=0&&A(t,t.prev,e)>=0:A(t,e,t.prev)<0||A(t,t.next,e)<0}function G(t,e){const r=new K(t.i,t.x,t.y),n=new K(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function R(t,e,r,n){const i=new K(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function J(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function K(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function W(t){var e=t.lines.length;if(e<=1)return{data:t.data,areas:[[m(t.data)]],lines:[t.lines]};for(var r,n,i,o=[],s=[],a=[],u=[],f=0,l=0;l<e;l++){i=t.lines[l]-f,n=t.lines[l+1]-f||t.data.length;var h=m(t.data.slice(i,n));if(0!==h)void 0===r&&(r=h<0),r===h<0?(u.length&&(o.push(a),s.push(u)),u=[i],a=[h]):(a.push(h),u.push(i));else{var c=t.data.slice(0,i),p=t.data.slice(n);t.data=c.concat(p),f+=n-i}}return a&&o.push(a),u.length&&s.push(u),{areas:o,lines:s,data:t.data}}function Y(t,e,r,n){for(var i=0,o=t.length;i<o;i+=2){t[i]=360*(t[i]+e)/n-180;var s=180-360*(t[i+1]+r)/n;t[i+1]=360/Math.PI*Math.atan(Math.exp(s*Math.PI/180))-90}}function $(t,e,r){e&&r&&(1===t?e.id=r.readVarint():2===t?function(t,e){var r=t.readVarint()+t.pos;for(;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3===t?e.type=r.readVarint():4===t&&(e._geometry=r.pos))}function q(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return H(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Q,X,tt,et,rt,nt,it,ot=function(){function t(e,r,n,i,o,a){l()(this,t),s()(this,"properties",void 0),s()(this,"extent",void 0),s()(this,"type",void 0),s()(this,"id",void 0),s()(this,"_pbf",void 0),s()(this,"_geometry",void 0),s()(this,"_keys",void 0),s()(this,"_values",void 0),s()(this,"_firstPassData",void 0),this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,this._firstPassData=a,e.readFields($,this,r)}return c()(t,[{key:"loadGeometry",value:function(){var t=this._pbf;t.pos=this._geometry,Q=t.readVarint()+t.pos,X=1,et=0,rt=0,nt=0,it=0;for(var e=[],r=[];t.pos<Q;)if(et<=0&&(tt=t.readVarint(),X=7&tt,et=tt>>3),et--,1===X||2===X)rt+=t.readSVarint(),nt+=t.readSVarint(),1===X&&e.push(it),r.push(rt,nt),it+=2;else{if(7!==X)throw new Error("unknown command ".concat(X));if(it>0){var n=e[e.length-1];r.push(r[n],r[n+1]),it+=2}}return{data:r,lines:e}}},{key:"_toBinaryCoordinates",value:function(e){var r=this.loadGeometry();e(r.data,this);switch(this.type){case 1:this._firstPassData.pointFeaturesCount++,this._firstPassData.pointPositionsCount+=r.lines.length;break;case 2:this._firstPassData.lineFeaturesCount++,this._firstPassData.linePathsCount+=r.lines.length,this._firstPassData.linePositionsCount+=r.data.length/2;break;case 3:var n=W(r);this._firstPassData.polygonFeaturesCount++,this._firstPassData.polygonObjectsCount+=n.lines.length;var i,o=q(n.lines);try{for(o.s();!(i=o.n()).done;){var s=i.value;this._firstPassData.polygonRingsCount+=s.length}}catch(t){o.e(t)}finally{o.f()}this._firstPassData.polygonPositionsCount+=n.data.length/2,r=n}r.type=t.types[this.type],r.lines.length>1&&(r.type="Multi".concat(r.type));var a={type:"Feature",geometry:r,properties:this.properties};return null!==this.id&&(a.id=this.id),a}},{key:"toBinaryCoordinates",value:function(t){return"function"==typeof t?this._toBinaryCoordinates(t):this._toBinaryCoordinates(Y)}}],[{key:"types",get:function(){return["Unknown","Point","LineString","Polygon"]}}]),t}(),st=function(){function t(e,r){l()(this,t),s()(this,"version",void 0),s()(this,"name",void 0),s()(this,"extent",void 0),s()(this,"length",void 0),s()(this,"_pbf",void 0),s()(this,"_keys",void 0),s()(this,"_values",void 0),s()(this,"_features",void 0),this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(at,this,r),this.length=this._features.length}return c()(t,[{key:"feature",value:function(t,e){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var r=this._pbf.readVarint()+this._pbf.pos;return new ot(this._pbf,r,this.extent,this._keys,this._values,e)}}]),t}();function at(t,e,r){e&&r&&(15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){var e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r)))}var ut=function t(e,r){l()(this,t),s()(this,"layers",void 0),this.layers=e.readFields(ft,{},r)};function ft(t,e,r){if(3===t&&r){var n=new st(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}function lt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ht(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?lt(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ct(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return pt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pt(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}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 o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function pt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function dt(t){var e,r={},n=ct(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;if(i.properties)for(var o in i.properties){var s=r[o];if(s||void 0===s){var a=i.properties[o];r[o]=Pt(a)}}}}catch(t){n.e(t)}finally{n.f()}return Object.keys(r).filter((function(t){return r[t]}))}function yt(t,e,r){for(var n=e.pointPositionsCount,i=e.pointFeaturesCount,o=e.linePositionsCount,s=e.linePathsCount,a=e.lineFeaturesCount,u=e.polygonPositionsCount,f=e.polygonObjectsCount,l=e.polygonRingsCount,h=e.polygonFeaturesCount,c=r.numericPropKeys,p=r.PositionDataType,d=void 0===p?Float32Array:p,y=(t[0]&&"id"in t[0]),v=t.length>65535?Uint32Array:Uint16Array,g={positions:new d(2*n),globalFeatureIds:new v(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},x={pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new d(2*o),globalFeatureIds:new v(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},w={polygonIndices:u>65535?new Uint32Array(f+1):new Uint16Array(f+1),primitivePolygonIndices:u>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new d(2*u),triangles:[],globalFeatureIds:new v(u),featureIds:h>65535?new Uint32Array(u):new Uint16Array(u),numericProps:{},properties:[],fields:[]},b=0,m=[g,x,w];b<m.length;b++){var P,F=m[b],_=ct(c);try{for(_.s();!(P=_.n()).done;){var O=P.value;F.numericProps[O]=new Float32Array(F.positions.length/2)}}catch(t){_.e(t)}finally{_.f()}}x.pathIndices[s]=o,w.polygonIndices[f]=u,w.primitivePolygonIndices[l]=u;var S,k={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0},V=ct(t);try{for(V.s();!(S=V.n()).done;){var j=S.value,M=j.geometry,I=j.properties||{};switch(M.type){case"Point":case"MultiPoint":vt(M,g,k,2,I),g.properties.push(mt(I,c)),y&&g.fields.push({id:j.id}),k.pointFeature++;break;case"LineString":case"MultiLineString":gt(M,x,k,2,I),x.properties.push(mt(I,c)),y&&x.fields.push({id:j.id}),k.lineFeature++;break;case"Polygon":case"MultiPolygon":xt(M,w,k,2,I),w.properties.push(mt(I,c)),y&&w.fields.push({id:j.id}),k.polygonFeature++;break;default:throw new Error("Invalid geometry type")}k.feature++}}catch(t){V.e(t)}finally{V.f()}return function(t,e,r,n){var i={points:ht(ht({},t),{},{positions:{value:t.positions,size:n},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1}}),lines:ht(ht({},e),{},{pathIndices:{value:e.pathIndices,size:1},positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1}}),polygons:ht(ht({},r),{},{polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},positions:{value:r.positions,size:n},triangles:{value:new Uint32Array(r.triangles),size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1}})};for(var o in i)for(var s in i[o].numericProps)i[o].numericProps[s]={value:i[o].numericProps[s],size:1};return i}(g,x,w,2)}function vt(t,e,r,n,i){e.positions.set(t.data,r.pointPosition*n);var o=t.data.length/n;bt(e,i,r.pointPosition,o),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function gt(t,e,r,n,i){e.positions.set(t.data,r.linePosition*n);var o=t.data.length/n;bt(e,i,r.linePosition,o),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(var s=0,a=t.lines.length;s<a;++s){var u=t.lines[s],f=s===a-1?t.data.length:t.lines[s+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(f-u)/n}}function xt(t,e,r,n,i){e.positions.set(t.data,r.polygonPosition*n);var o=t.data.length/n;bt(e,i,r.polygonPosition,o),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(var s=0,a=t.lines.length;s<a;++s){var u=r.polygonPosition;e.polygonIndices[r.polygonObject++]=u;for(var f=t.areas[s],l=t.lines[s],h=t.lines[s+1],c=0,p=l.length;c<p;++c){var d=l[c],y=c===p-1?void 0===h?t.data.length:h[0]:l[c+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(y-d)/n}wt(e,f,l,{startPosition:u,endPosition:r.polygonPosition,coordLength:n})}}function wt(t,e,r,n){for(var i=n.startPosition,o=n.endPosition,s=n.coordLength,a=i*s,u=o*s,f=t.positions.subarray(a,u),l=r[0],h=P(f,r.slice(1).map((function(t){return(t-l)/s})),s,e),c=0,p=h.length;c<p;++c)t.triangles.push(i+h[c])}function bt(t,e,r,n){for(var i in t.numericProps)i in e&&t.numericProps[i].fill(e[i],r,r+n)}function mt(t,e){var r={};for(var n in t)e.includes(n)||(r[n]=t[n]);return r}function Pt(t){return Number.isFinite(t)}var Ft=r(5),_t=r.n(Ft);function Ot(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function St(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ot(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ot(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function kt(t,e){e=function(t){if(t){var e="wgs84"===(t=St(St({},t),{},{mvt:t.mvt||{},gis:t.gis||{}})).coordinates,r=t.tileIndex,n=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(e&&!n)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property. Check documentation.")}return t}(e);var r=[];if(e){var n="binary"===e.gis.format,i={pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength>0){var o=n?new ut(new _t.a(t)):new x(new _t.a(t)),s=e.mvt;(Array.isArray(s.layers)?s.layers:Object.keys(o.layers)).forEach((function(t){var e=o.layers[t],a=St(St({},s),{},{layerName:t});if(e)for(var u=0;u<e.length;u++){var f=e.feature(u,i),l=n?jt(f,a):Vt(f,a);r.push(l)}}))}if(n){var a=function(t,e,r){return yt(t,e,{numericPropKeys:r?r.numericPropKeys:dt(t),PositionDataType:r?r.PositionDataType:Float32Array})}(r,i);return a.byteLength=t.byteLength,a}}return r}function Vt(t,e){var r=t.toGeoJSON("wgs84"===e.coordinates?e.tileIndex:Mt);return e.layerProperty&&(r.properties[e.layerProperty]=e.layerName),r}function jt(t,e){var r=t.toBinaryCoordinates("wgs84"===e.coordinates?e.tileIndex:It);return e.layerProperty&&(r.properties[e.layerProperty]=e.layerName),r}function Mt(t,e){for(var r=e.extent,n=0;n<t.length;n++){var i=t[n];i[0]/=r,i[1]/=r}}function It(t,e){for(var r=e.extent,n=0,i=t.length;n<i;++n)t[n]/=r}function Et(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Lt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Et(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Et(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var Bt,Dt=Lt(Lt({},{name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:"3.1.0-alpha.2",extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{coordinates:"local",layerProperty:"layerName",layers:null,tileIndex:null}}}),{},{parse:(Bt=i()(u.a.mark((function t(e,r){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",kt(e,r));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return Bt.apply(this,arguments)}),parseSync:kt,binary:!0}),Ct=r(6),At=r.n(Ct);function Tt(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}var Nt=new Map,zt=function(){function t(){l()(this,t)}return c()(t,null,[{key:"onmessage",set:function(t){self.onmessage=function(e){if(Zt(e)){var r=e.data,n=r.type,i=r.payload;t(n,i)}}}},{key:"addEventListener",value:function(t){var e=Nt.get(t);e||(e=function(e){if(Zt(e)){var r=e.data,n=r.type,i=r.payload;t(n,i)}}),self.addEventListener("message",e)}},{key:"removeEventListener",value:function(t){var e=Nt.get(t);Nt.delete(t),self.removeEventListener("message",e)}},{key:"postMessage",value:function(t,e){if(self){var r={source:"loaders.gl",type:t,payload:e},n=function t(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,i=n||new Set;if(e){if(Tt(e))i.add(e);else if(Tt(e.buffer))i.add(e.buffer);else if(ArrayBuffer.isView(e));else if(r&&"object"===At()(e))for(var o in e)t(e[o],r,i)}else;return void 0===n?Array.from(i):[]}(e);self.postMessage(r,n)}}}]),t}();function Zt(t){var e=t.type,r=t.data;return"message"===e&&r&&"string"==typeof r.source&&r.source.startsWith("loaders.gl")}function Ut(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Gt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ut(Object(r),!0).forEach((function(e){s()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ut(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var Rt,Jt=0;function Kt(t,e){return new Promise((function(r,n){var i=Jt++;zt.addEventListener((function t(e,o){if(o.id===i)switch(e){case"done":zt.removeEventListener(t),r(o.result);break;case"error":zt.removeEventListener(t),n(o.error)}}));var o={id:i,input:t,options:e};zt.postMessage("process",o)}))}function Wt(t){return Yt.apply(this,arguments)}function Yt(){return(Yt=i()(u.a.mark((function t(e){var r,n,i,o,s,a,f;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.loader,n=e.arrayBuffer,i=e.options,o=e.context,!r.parseSync&&!r.parse){t.next=6;break}s=n,a=r.parseSync||r.parse,t.next=13;break;case 6:if(!r.parseTextSync){t.next=12;break}f=new TextDecoder,s=f.decode(n),a=r.parseTextSync,t.next=13;break;case 12:throw new Error("Could not load data with ".concat(r.name," loader"));case 13:return i=Gt(Gt({},i),{},{modules:r&&r.options&&r.options.modules||{},worker:!1}),t.next=16,a(s,Gt({},i),o,r);case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}Rt=Dt,"undefined"!=typeof self&&(zt.onmessage=function(){var t=i()(u.a.mark((function t(e,r){var n,i,o,s,a;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=e,t.next="process"===t.t0?3:16;break;case 3:return t.prev=3,n=r.input,i=r.options,o=void 0===i?{}:i,t.next=7,Wt({loader:Rt,arrayBuffer:n,options:o,context:{parse:Kt}});case 7:s=t.sent,zt.postMessage("done",{result:s}),t.next=15;break;case 11:t.prev=11,t.t1=t.catch(3),a=t.t1 instanceof Error?t.t1.message:"",zt.postMessage("error",{error:a});case 15:return t.abrupt("break",16);case 16:case"end":return t.stop()}}),t,null,[[3,11]])})));return function(e,r){return t.apply(this,arguments)}}())}]);
4
- //# sourceMappingURL=mvt-worker.js.map