@loaders.gl/terrain 3.0.10 → 3.0.14

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,2 +1,2 @@
1
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=20)}([function(e,t,r){e.exports=r(13)},function(e,t){function r(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(14),i=r(15),o=r(9),a=r(16);e.exports=function(e,t){return n(e)||i(e,t)||o(e,t)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(17),i=r(18),o=r(9),a=r(19);e.exports=function(e){return n(e)||i(e)||o(e)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=r=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){},function(e,t,r){var n=r(10);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.default=e.exports,e.exports.__esModule=!0},,,function(e,t,r){var n=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof h?t:h,o=Object.create(i.prototype),a=new w(n||[]);return o._invoke=function(e,t,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 S()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===l)continue;return s}}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=c(e,t,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)}}}(e,r,a),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function h(){}function f(){}function d(){}var p={};p[i]=function(){return this};var v=Object.getPrototypeOf,g=v&&v(v(T([])));g&&g!==t&&r.call(g,i)&&(p=g);var y=d.prototype=h.prototype=Object.create(p);function _(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function E(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=y.constructor=d,d.constructor=f,f.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},_(m.prototype),m.prototype[o]=function(){return this},e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},_(y),s(y,a,"Generator"),y[i]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=T,w.prototype={constructor:w,reset:function(e){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(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){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(e,t){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"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(10);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";r.r(t);var n=r(4),i=r.n(n),o=r(1),a=r.n(o),s=r(0),u=r.n(s),c=r(5),l=r.n(c),h=r(6),f=r.n(h),d=r(7),p=r.n(d);function v(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}var g=new Map,y=function(){function e(){l()(this,e)}return f()(e,null,[{key:"onmessage",set:function(e){self.onmessage=function(t){if(_(t)){var r=t.data,n=r.type,i=r.payload;e(n,i)}}}},{key:"addEventListener",value:function(e){var t=g.get(e);t||(t=function(t){if(_(t)){var r=t.data,n=r.type,i=r.payload;e(n,i)}}),self.addEventListener("message",t)}},{key:"removeEventListener",value:function(e){var t=g.get(e);g.delete(e),self.removeEventListener("message",t)}},{key:"postMessage",value:function(e,t){if(self){var r={source:"loaders.gl",type:e,payload:t},n=function e(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,i=n||new Set;if(t){if(v(t))i.add(t);else if(v(t.buffer))i.add(t.buffer);else if(ArrayBuffer.isView(t));else if(r&&"object"===p()(t))for(var o in t)e(t[o],r,i)}else;return void 0===n?Array.from(i):[]}(t);self.postMessage(r,n)}}}]),e}();function _(e){var t=e.type,r=e.data;return"message"===t&&r&&"string"==typeof r.source&&r.source.startsWith("loaders.gl")}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=0;function x(e,t){return new Promise((function(r,n){var i=b++;y.addEventListener((function e(t,o){if(o.id===i)switch(t){case"done":y.removeEventListener(e),r(o.result);break;case"error":y.removeEventListener(e),n(o.error)}}));var o={id:i,input:e,options:t};y.postMessage("process",o)}))}function w(e){return T.apply(this,arguments)}function T(){return(T=a()(u.a.mark((function e(t){var r,n,i,o,a,s,c;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.loader,n=t.arrayBuffer,i=t.options,o=t.context,!r.parseSync&&!r.parse){e.next=6;break}a=n,s=r.parseSync||r.parse,e.next=13;break;case 6:if(!r.parseTextSync){e.next=12;break}c=new TextDecoder,a=c.decode(n),s=r.parseTextSync,e.next=13;break;case 12:throw new Error("Could not load data with ".concat(r.name," loader"));case 13:return i=E(E({},i),{},{modules:r&&r.options&&r.options.modules||{},worker:!1}),e.next=16,s(a,E({},i),o,r);case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var S=r(2),O=r.n(S);function P(e){for(var t=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,a=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length,c=0;c<u;c+=3){var l=s[c],h=s[c+1],f=s[c+2];t=l<t?l:t,r=h<r?h:r,n=f<n?f:n,i=l>i?l:i,o=h>o?h:o,a=f>a?f:a}return[[t,r,n],[i,o,a]]}function M(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return I(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var L=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function k(e){return e>>1^-(1&e)}function A(e,t,r,n){var i,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(i=2===n?new Uint16Array(e,t,r):new Uint32Array(e,t,r),!o)return i;for(var a=0,s=0;s<i.length;++s){var u=i[s];i[s]=a-u,0===u&&++a}return i}function j(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}var q=1,N=2,D=3,R=4,U={maxDecodingStep:R};function B(e,t){var r=Object.assign({},U,t),n=new DataView(e),i=function(e){var t,r=0,n={},i=M(L);try{for(i.s();!(t=i.n()).done;){var o=O()(t.value,2),a=o[0],s=o[1],u=8===s?e.getFloat64:e.getFloat32;n[a]=u.call(e,r,!0),r+=s}}catch(e){i.e(e)}finally{i.f()}return{header:n,headerEndPosition:r}}(n),o=i.header,a=i.headerEndPosition;if(r.maxDecodingStep<q)return{header:o};var s=function(e,t){var r=t,n=e.getUint32(r,!0),i=new Uint16Array(3*n);r+=Uint32Array.BYTES_PER_ELEMENT;for(var o=Uint16Array.BYTES_PER_ELEMENT,a=n*o,s=r,u=s+a,c=u+a,l=0,h=0,f=0,d=0;d<n;d++)l+=k(e.getUint16(s+o*d,!0)),h+=k(e.getUint16(u+o*d,!0)),f+=k(e.getUint16(c+o*d,!0)),i[d]=l,i[d+n]=h,i[d+2*n]=f;return{vertexData:i,vertexDataEndPosition:r+=3*a}}(n,a),u=s.vertexData,c=s.vertexDataEndPosition;if(r.maxDecodingStep<N)return{header:o,vertexData:u};var l=function(e,t,r){var n=r,i=t.length/3>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%i!=0&&(n+=i-n%i);var o=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var a=3*o,s=A(e.buffer,n,a,i);return{triangleIndicesEndPosition:n+=a*i,triangleIndices:s}}(n,u,c),h=l.triangleIndices,f=l.triangleIndicesEndPosition;if(r.maxDecodingStep<D)return{header:o,vertexData:u,triangleIndices:h};var d=function(e,t,r){var n=r,i=t.length/3>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,o=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var a=A(e.buffer,n,o,i,!1);n+=o*i;var s=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var u=A(e.buffer,n,s,i,!1);n+=s*i;var c=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var l=A(e.buffer,n,c,i,!1);n+=c*i;var h=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var f=A(e.buffer,n,h,i,!1);return{edgeIndicesEndPosition:n+=h*i,westIndices:a,southIndices:u,eastIndices:l,northIndices:f}}(n,u,f),p=d.westIndices,v=d.southIndices,g=d.eastIndices,y=d.northIndices,_=d.edgeIndicesEndPosition;return r.maxDecodingStep<R?{header:o,vertexData:u,triangleIndices:h,westIndices:p,northIndices:y,eastIndices:g,southIndices:v}:{header:o,vertexData:u,triangleIndices:h,westIndices:p,northIndices:y,eastIndices:g,southIndices:v,extensions:function(e,t){var r={};if(e.byteLength<=t)return{extensions:r,extensionsEndPosition:t};for(var n,i=t;i<e.byteLength;){var o=e.getUint8(i,!0);i+=Uint8Array.BYTES_PER_ELEMENT;var a=e.getUint32(i,!0);i+=Uint32Array.BYTES_PER_ELEMENT;var s=new DataView(e.buffer,i,a);switch(o){case 1:r.vertexNormals=(n=s,new Uint8Array(n.buffer,n.byteOffset,n.byteLength));break;case 2:r.waterMask=j(s)}i+=a}return{extensions:r,extensionsEndPosition:i}}(n,_).extensions}}var z=r(3),Y=r.n(z);r(8);function F(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t,i=n&&n.length>1&&n[0].constructor||null;if(!i)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');for(var o=n.reduce((function(e,t){return e+t.length}),0),a=new i(o),s=0,u=0,c=n;u<c.length;u++){var l=c[u];a.set(l,s),s+=l.length}return a}function C(e,t,r){for(var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=n?X(n,e.POSITION.value):H(t),o=new e.POSITION.value.constructor(6*i.length),a=new e.TEXCOORD_0.value.constructor(4*i.length),s=new t.constructor(6*i.length),u=0;u<i.length;u++){var c=i[u];G({edge:c,edgeIndex:u,attributes:e,skirtHeight:r,newPosition:o,newTexcoord0:a,newTriangles:s})}e.POSITION.value=F(e.POSITION.value,o),e.TEXCOORD_0.value=F(e.TEXCOORD_0.value,a);var l=t instanceof Array?t.concat(s):F(t,s);return{attributes:e,triangles:l}}function H(e){for(var t=[],r=0;r<e.length;r+=3)t.push([e[r],e[r+1]]),t.push([e[r+1],e[r+2]]),t.push([e[r+2],e[r]]);t.sort((function(e,t){return Math.min.apply(Math,Y()(e))-Math.min.apply(Math,Y()(t))||Math.max.apply(Math,Y()(e))-Math.max.apply(Math,Y()(t))}));for(var n=[],i=1;i<t.length;)t[i][0]===t[i-1][1]&&t[i][1]===t[i-1][0]?i+=2:(n.push(t[i-1]),i++);return n}function X(e,t){e.westIndices.sort((function(e,r){return t[3*e+1]-t[3*r+1]})),e.eastIndices.sort((function(e,r){return t[3*r+1]-t[3*e+1]})),e.southIndices.sort((function(e,r){return t[3*r]-t[3*e]})),e.northIndices.sort((function(e,r){return t[3*e]-t[3*r]}));var r=[];for(var n in e)for(var i=e[n],o=0;o<i.length-1;o++)r.push([i[o],i[o+1]]);return r}function G(e){var t=e.edge,r=e.edgeIndex,n=e.attributes,i=e.skirtHeight,o=e.newPosition,a=e.newTexcoord0,s=e.newTriangles,u=n.POSITION.value.length,c=2*r,l=2*r+1;o.set(n.POSITION.value.subarray(3*t[0],3*t[0]+3),3*c),o[3*c+2]=o[3*c+2]-i,o.set(n.POSITION.value.subarray(3*t[1],3*t[1]+3),3*l),o[3*l+2]=o[3*l+2]-i,a.set(n.TEXCOORD_0.value.subarray(2*t[0],2*t[0]+2),2*c),a.set(n.TEXCOORD_0.value.subarray(2*t[1],2*t[1]+2),2*l);var h=2*r*3;s[h]=t[0],s[h+1]=t[1],s[h+2]=u/3+l,s[h+3]=u/3+l,s[h+4]=u/3+c,s[h+5]=t[0]}function $(e,t){if(!e)return null;var r=t.bounds,n=B(e,N),i=n.header,o=n.vertexData,a=n.triangleIndices,s=n.westIndices,u=n.northIndices,c=n.eastIndices,l=n.southIndices,h=a,f=function(e,t,r){for(var n=t.minHeight,i=t.maxHeight,o=r||[0,0,1,1],a=O()(o,4),s=a[0],u=a[1],c=a[2]-s,l=a[3]-u,h=i-n,f=e.length/3,d=new Float32Array(3*f),p=new Float32Array(2*f),v=0;v<f;v++){var g=e[v]/32767,y=e[v+f]/32767,_=e[v+2*f]/32767;d[3*v+0]=g*c+s,d[3*v+1]=y*l+u,d[3*v+2]=_*h+n,p[2*v+0]=g,p[2*v+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}(o,i,r),d=P(f);if(t.skirtHeight){var p=C(f,h,t.skirtHeight,{westIndices:s,northIndices:u,eastIndices:c,southIndices:l});f=p.attributes,h=p.triangles}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:d},mode:4,indices:{value:h,size:1},attributes:f}}function V(e,t){return $(e,t["quantized-mesh"])}class Z{constructor(e=257){this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(4*this.numTriangles);for(let e=0;e<this.numTriangles;e++){let r=e+2,n=0,i=0,o=0,a=0,s=0,u=0;for(1&r?o=a=s=t:n=i=u=t;(r>>=1)>1;){const e=n+o>>1,t=i+a>>1;1&r?(o=n,a=i,n=s,i=u):(n=o,i=a,o=s,a=u),s=e,u=t}const c=4*e;this.coords[c+0]=n,this.coords[c+1]=i,this.coords[c+2]=o,this.coords[c+3]=a}}createTile(e){return new Q(e,this)}}class Q{constructor(e,t){const r=t.gridSize;if(e.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:r,gridSize:n}=this.martini,{terrain:i,errors:o}=this;for(let a=e-1;a>=0;a--){const e=4*a,s=r[e+0],u=r[e+1],c=r[e+2],l=r[e+3],h=s+c>>1,f=u+l>>1,d=h+f-u,p=f+s-h,v=(i[u*n+s]+i[l*n+c])/2,g=f*n+h,y=Math.abs(v-i[g]);if(o[g]=Math.max(o[g],y),a<t){const e=(u+p>>1)*n+(s+d>>1),t=(l+p>>1)*n+(c+d>>1);o[g]=Math.max(o[g],o[e],o[t])}}}getMesh(e=0){const{gridSize:t,indices:r}=this.martini,{errors:n}=this;let i=0,o=0;const a=t-1;function s(a,u,c,l,h,f){const d=a+c>>1,p=u+l>>1;Math.abs(a-h)+Math.abs(u-f)>1&&n[p*t+d]>e?(s(h,f,a,u,d,p),s(c,l,h,f,d,p)):(r[u*t+a]=r[u*t+a]||++i,r[l*t+c]=r[l*t+c]||++i,r[f*t+h]=r[f*t+h]||++i,o++)}r.fill(0),s(0,0,a,a,a,0),s(a,a,0,0,0,a);const u=new Uint16Array(2*i),c=new Uint32Array(3*o);let l=0;function h(i,o,a,s,f,d){const p=i+a>>1,v=o+s>>1;if(Math.abs(i-f)+Math.abs(o-d)>1&&n[v*t+p]>e)h(f,d,i,o,p,v),h(a,s,f,d,p,v);else{const e=r[o*t+i]-1,n=r[s*t+a]-1,h=r[d*t+f]-1;u[2*e]=i,u[2*e+1]=o,u[2*n]=a,u[2*n+1]=s,u[2*h]=f,u[2*h+1]=d,c[l++]=e,c[l++]=n,c[l++]=h}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:u,triangles:c}}}var W=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r;l()(this,e),this.data=t,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;var i=r-1,o=n-1,a=this._addPoint(0,0),s=this._addPoint(i,0),u=this._addPoint(0,o),c=this._addPoint(i,o),h=this._addTriangle(c,a,u,-1,-1,-1);this._addTriangle(a,c,s,h,-1,-1),this._flush()}return f()(e,[{key:"run",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.getMaxError()>e;)this.refine()}},{key:"refine",value:function(){this._step(),this._flush()}},{key:"getMaxError",value:function(){return this._errors[0]}},{key:"getRMSD",value:function(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}},{key:"heightAt",value:function(e,t){return this.data[this.width*t+e]}},{key:"_flush",value:function(){for(var e=this.coords,t=0;t<this._pendingLen;t++){var r=this._pending[t],n=2*this.triangles[3*r+0],i=2*this.triangles[3*r+1],o=2*this.triangles[3*r+2];this._findCandidate(e[n],e[n+1],e[i],e[i+1],e[o],e[o+1],r)}this._pendingLen=0}},{key:"_findCandidate",value:function(e,t,r,n,i,o,a){for(var s=Math.min(e,r,i),u=Math.min(t,n,o),c=Math.max(e,r,i),l=Math.max(t,n,o),h=J(r,n,i,o,s,u),f=J(i,o,e,t,s,u),d=J(e,t,r,n,s,u),p=n-t,v=e-r,g=o-n,y=r-i,_=t-o,m=i-e,E=J(e,t,r,n,i,o),b=this.heightAt(e,t)/E,x=this.heightAt(r,n)/E,w=this.heightAt(i,o)/E,T=0,S=0,O=0,P=0,M=u;M<=l;M++){var I=0;h<0&&0!==g&&(I=Math.max(I,Math.floor(-h/g))),f<0&&0!==_&&(I=Math.max(I,Math.floor(-f/_))),d<0&&0!==p&&(I=Math.max(I,Math.floor(-d/p)));for(var L=h+g*I,k=f+_*I,A=d+p*I,j=!1,q=s+I;q<=c;q++){if(L>=0&&k>=0&&A>=0){j=!0;var N=b*L+x*k+w*A,D=Math.abs(N-this.heightAt(q,M));P+=D*D,D>T&&(T=D,S=q,O=M)}else if(j)break;L+=g,k+=_,A+=p}h+=y,f+=m,d+=v}(S===e&&O===t||S===r&&O===n||S===i&&O===o)&&(T=0),this._candidates[2*a]=S,this._candidates[2*a+1]=O,this._rms[a]=P,this._queuePush(a,T,P)}},{key:"_step",value:function(){var e=this._queuePop(),t=3*e+0,r=3*e+1,n=3*e+2,i=this.triangles[t],o=this.triangles[r],a=this.triangles[n],s=this.coords[2*i],u=this.coords[2*i+1],c=this.coords[2*o],l=this.coords[2*o+1],h=this.coords[2*a],f=this.coords[2*a+1],d=this._candidates[2*e],p=this._candidates[2*e+1],v=this._addPoint(d,p);if(0===J(s,u,c,l,d,p))this._handleCollinear(v,t);else if(0===J(c,l,h,f,d,p))this._handleCollinear(v,r);else if(0===J(h,f,s,u,d,p))this._handleCollinear(v,n);else{var g=this._halfedges[t],y=this._halfedges[r],_=this._halfedges[n],m=this._addTriangle(i,o,v,g,-1,-1,t),E=this._addTriangle(o,a,v,y,-1,m+1),b=this._addTriangle(a,i,v,_,m+2,E+1);this._legalize(m),this._legalize(E),this._legalize(b)}}},{key:"_addPoint",value:function(e,t){var r=this.coords.length>>1;return this.coords.push(e,t),r}},{key:"_addTriangle",value:function(e,t,r,n,i,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this.triangles.length,s=a/3;return this.triangles[a+0]=e,this.triangles[a+1]=t,this.triangles[a+2]=r,this._halfedges[a+0]=n,this._halfedges[a+1]=i,this._halfedges[a+2]=o,n>=0&&(this._halfedges[n]=a+0),i>=0&&(this._halfedges[i]=a+1),o>=0&&(this._halfedges[o]=a+2),this._candidates[2*s+0]=0,this._candidates[2*s+1]=0,this._queueIndices[s]=-1,this._rms[s]=0,this._pending[this._pendingLen++]=s,a}},{key:"_legalize",value:function(e){var t=this._halfedges[e];if(!(t<0)){var r=e-e%3,n=t-t%3,i=r+(e+1)%3,o=r+(e+2)%3,a=n+(t+2)%3,s=n+(t+1)%3,u=this.triangles[o],c=this.triangles[e],l=this.triangles[i],h=this.triangles[a],f=this.coords;if(d=f[2*u],p=f[2*u+1],v=f[2*c],g=f[2*c+1],y=f[2*l],_=f[2*l+1],m=f[2*h],E=f[2*h+1],(b=d-m)*((T=g-E)*(M=(S=y-m)*S+(O=_-E)*O)-(P=(w=v-m)*w+T*T)*O)-(x=p-E)*(w*M-P*S)+(b*b+x*x)*(w*O-T*S)<0){var d,p,v,g,y,_,m,E,b,x,w,T,S,O,P,M,I=this._halfedges[i],L=this._halfedges[o],k=this._halfedges[a],A=this._halfedges[s];this._queueRemove(r/3),this._queueRemove(n/3);var j=this._addTriangle(u,h,l,-1,k,I,r),q=this._addTriangle(h,u,c,j,L,A,n);this._legalize(j+1),this._legalize(q+2)}}}},{key:"_handleCollinear",value:function(e,t){var r=t-t%3,n=r+(t+1)%3,i=r+(t+2)%3,o=this.triangles[i],a=this.triangles[t],s=this.triangles[n],u=this._halfedges[n],c=this._halfedges[i],l=this._halfedges[t];if(l<0){var h=this._addTriangle(e,o,a,-1,c,-1,r),f=this._addTriangle(o,e,s,h,-1,u);return this._legalize(h+1),void this._legalize(f+2)}var d=l-l%3,p=d+(l+2)%3,v=d+(l+1)%3,g=this.triangles[p],y=this._halfedges[p],_=this._halfedges[v];this._queueRemove(d/3);var m=this._addTriangle(o,a,e,c,-1,-1,r),E=this._addTriangle(a,g,e,_,-1,m+1,d),b=this._addTriangle(g,s,e,y,-1,E+1),x=this._addTriangle(s,o,e,u,m+2,b+1);this._legalize(m),this._legalize(E),this._legalize(b),this._legalize(x)}},{key:"_queuePush",value:function(e,t,r){var n=this._queue.length;this._queueIndices[e]=n,this._queue.push(e),this._errors.push(t),this._rmsSum+=r,this._queueUp(n)}},{key:"_queuePop",value:function(){var e=this._queue.length-1;return this._queueSwap(0,e),this._queueDown(0,e),this._queuePopBack()}},{key:"_queuePopBack",value:function(){var e=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[e],this._queueIndices[e]=-1,e}},{key:"_queueRemove",value:function(e){var t=this._queueIndices[e];if(t<0){var r=this._pending.indexOf(e);if(-1===r)throw new Error("Broken triangulation (something went wrong).");this._pending[r]=this._pending[--this._pendingLen]}else{var n=this._queue.length-1;n!==t&&(this._queueSwap(t,n),this._queueDown(t,n)||this._queueUp(t)),this._queuePopBack()}}},{key:"_queueLess",value:function(e,t){return this._errors[e]>this._errors[t]}},{key:"_queueSwap",value:function(e,t){var r=this._queue[e],n=this._queue[t];this._queue[e]=n,this._queue[t]=r,this._queueIndices[r]=t,this._queueIndices[n]=e;var i=this._errors[e];this._errors[e]=this._errors[t],this._errors[t]=i}},{key:"_queueUp",value:function(e){for(var t=e;;){var r=t-1>>1;if(r===t||!this._queueLess(t,r))break;this._queueSwap(r,t),t=r}}},{key:"_queueDown",value:function(e,t){for(var r=e;;){var n=2*r+1;if(n>=t||n<0)break;var i=n+1,o=n;if(i<t&&this._queueLess(i,n)&&(o=i),!this._queueLess(o,r))break;this._queueSwap(r,o),r=o}return r>e}}]),e}();function J(e,t,r,n,i,o){return(r-i)*(t-o)-(n-o)*(e-i)}function K(e,t,r,n,i){for(var o=n.rScaler,a=n.bScaler,s=n.gScaler,u=n.offset,c=new Float32Array((t+1)*(r+1)),l=0,h=0;h<r;h++)for(var f=0;f<t;f++,l++){var d=4*l,p=e[d+0],v=e[d+1],g=e[d+2];c[l+h]=p*o+v*s+g*a+u}if("martini"===i){for(var y=(t+1)*t,_=0;_<t;_++,y++)c[y]=c[y-t-1];for(var m=r,E=0;E<r+1;E++,m+=r+1)c[m]=c[m-1]}return c}function ee(e,t){if(null===e)return null;var r,n,i=t.meshMaxError,o=t.bounds,a=t.elevationDecoder,s=e.data,u=e.width,c=e.height;switch(t.tesselator){case"martini":n=te(i,u,r=K(s,u,c,a,t.tesselator));break;case"delatin":n=re(i,u,c,r=K(s,u,c,a,t.tesselator));break;default:n=u!==c||c&u-1?re(i,u,c,r=K(s,u,c,a,"delatin")):te(i,u,r=K(s,u,c,a,"martini"))}var l=n.vertices,h=n.triangles,f=function(e,t,r,n,i){for(var o=r+1,a=e.length/2,s=new Float32Array(3*a),u=new Float32Array(2*a),c=i||[0,0,r,n],l=O()(c,4),h=l[0],f=l[1],d=l[2],p=l[3],v=(d-h)/r,g=(p-f)/n,y=0;y<a;y++){var _=e[2*y],m=e[2*y+1],E=m*o+_;s[3*y+0]=_*v+h,s[3*y+1]=-m*g+p,s[3*y+2]=t[E],u[2*y+0]=_/r,u[2*y+1]=m/n}return{POSITION:{value:s,size:3},TEXCOORD_0:{value:u,size:2}}}(l,r,u,c,o),d=P(f);if(t.skirtHeight){var p=C(f,h,t.skirtHeight);f=p.attributes,h=p.triangles}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(h),size:1},attributes:f}}function te(e,t,r){var n=new Z(t+1).createTile(r).getMesh(e);return{vertices:n.vertices,triangles:n.triangles}}function re(e,t,r,n){var i=new W(n,t+1,r+1);return i.run(e),{vertices:i.coords,triangles:i.triangles}}function ne(){return(ne=a()(u.a.mark((function e(t,r,n){var i;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.image=r.image||{},r.image.type="data",e.next=4,n.parse(t,r,r.baseUri);case 4:return i=e.sent,e.abrupt("return",ee(i,r.terrain));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ie={name:"Terrain",id:"terrain",module:"terrain",version:"3.0.10",worker:!0,extensions:["png","pngraw"],mimeTypes:["image/png"],options:{terrain:{tesselator:"auto",bounds:null,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:null}}},oe={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:"3.0.10",worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}se(se({},ie),{},{parse:function(e,t,r){return ne.apply(this,arguments)}});var ue,ce,le=se(se({},oe),{},{parseSync:V,parse:(ue=a()(u.a.mark((function e(t,r){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",V(t,r));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return ue.apply(this,arguments)})});ce=le,"undefined"!=typeof self&&(y.onmessage=function(){var e=a()(u.a.mark((function e(t,r){var n,i,o,a,s;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t,e.next="process"===e.t0?3:16;break;case 3:return e.prev=3,n=r.input,i=r.options,o=void 0===i?{}:i,e.next=7,w({loader:ce,arrayBuffer:n,options:o,context:{parse:x}});case 7:a=e.sent,y.postMessage("done",{result:a}),e.next=15;break;case 11:e.prev=11,e.t1=e.catch(3),s=e.t1 instanceof Error?e.t1.message:"",y.postMessage("error",{error:s});case 15:return e.abrupt("break",16);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(t,r){return e.apply(this,arguments)}}())}]);
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=20)}([function(e,t,r){e.exports=r(13)},function(e,t){function r(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=r=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(14),i=r(15),o=r(9),a=r(16);e.exports=function(e,t){return n(e)||i(e,t)||o(e,t)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(17),i=r(18),o=r(9),a=r(19);e.exports=function(e){return n(e)||i(e)||o(e)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(10);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.default=e.exports,e.exports.__esModule=!0},,,function(e,t,r){var n=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof h?t:h,o=Object.create(i.prototype),a=new w(n||[]);return o._invoke=function(e,t,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 S()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===l)continue;return s}}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=c(e,t,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)}}}(e,r,a),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function h(){}function f(){}function d(){}var p={};p[i]=function(){return this};var v=Object.getPrototypeOf,g=v&&v(v(T([])));g&&g!==t&&r.call(g,i)&&(p=g);var y=d.prototype=h.prototype=Object.create(p);function _(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,s){var u=c(e[i],e,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(h).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function E(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=y.constructor=d,d.constructor=f,f.displayName=s(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},_(m.prototype),m.prototype[o]=function(){return this},e.AsyncIterator=m,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new m(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},_(y),s(y,a,"Generator"),y[i]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=T,w.prototype={constructor:w,reset:function(e){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(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){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(e,t){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"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(10);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";r.r(t);var n=r(6),i=r.n(n),o=r(1),a=r.n(o),s=r(0),u=r.n(s),c=r(7),l=r.n(c),h=r(8),f=r.n(h),d=r(2),p=r.n(d);function v(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}var g=new Map,y=function(){function e(){l()(this,e)}return f()(e,null,[{key:"onmessage",set:function(e){self.onmessage=function(t){if(_(t)){var r=t.data,n=r.type,i=r.payload;e(n,i)}}}},{key:"addEventListener",value:function(e){var t=g.get(e);t||(t=function(t){if(_(t)){var r=t.data,n=r.type,i=r.payload;e(n,i)}}),self.addEventListener("message",t)}},{key:"removeEventListener",value:function(e){var t=g.get(e);g.delete(e),self.removeEventListener("message",t)}},{key:"postMessage",value:function(e,t){if(self){var r={source:"loaders.gl",type:e,payload:t},n=function e(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,i=n||new Set;if(t){if(v(t))i.add(t);else if(v(t.buffer))i.add(t.buffer);else if(ArrayBuffer.isView(t));else if(r&&"object"===p()(t))for(var o in t)e(t[o],r,i)}else;return void 0===n?Array.from(i):[]}(t);self.postMessage(r,n)}}}]),e}();function _(e){var t=e.type,r=e.data;return"message"===t&&r&&"string"==typeof r.source&&r.source.startsWith("loaders.gl")}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=0;function x(e,t){return new Promise((function(r,n){var i=b++;y.addEventListener((function e(t,o){if(o.id===i)switch(t){case"done":y.removeEventListener(e),r(o.result);break;case"error":y.removeEventListener(e),n(o.error)}}));var o={id:i,input:e,options:t};y.postMessage("process",o)}))}function w(e){return T.apply(this,arguments)}function T(){return(T=a()(u.a.mark((function e(t){var r,n,i,o,a,s,c;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.loader,n=t.arrayBuffer,i=t.options,o=t.context,!r.parseSync&&!r.parse){e.next=6;break}a=n,s=r.parseSync||r.parse,e.next=13;break;case 6:if(!r.parseTextSync){e.next=12;break}c=new TextDecoder,a=c.decode(n),s=r.parseTextSync,e.next=13;break;case 12:throw new Error("Could not load data with ".concat(r.name," loader"));case 13:return i=E(E({},i),{},{modules:r&&r.options&&r.options.modules||{},worker:!1}),e.next=16,s(a,E({},i),o,r);case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var S=r(3),O=r.n(S);function P(e){for(var t=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,a=-1/0,s=e.POSITION?e.POSITION.value:[],u=s&&s.length,c=0;c<u;c+=3){var l=s[c],h=s[c+1],f=s[c+2];t=l<t?l:t,r=h<r?h:r,n=f<n?f:n,i=l>i?l:i,o=h>o?h:o,a=f>a?f:a}return[[t,r,n],[i,o,a]]}function M(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return I(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var L=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function k(e){return e>>1^-(1&e)}function A(e,t,r,n){var i,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(i=2===n?new Uint16Array(e,t,r):new Uint32Array(e,t,r),!o)return i;for(var a=0,s=0;s<i.length;++s){var u=i[s];i[s]=a-u,0===u&&++a}return i}function j(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}var q=1,N=2,D=3,R=4,U={maxDecodingStep:R};function B(e,t){var r=Object.assign({},U,t),n=new DataView(e),i=function(e){var t,r=0,n={},i=M(L);try{for(i.s();!(t=i.n()).done;){var o=O()(t.value,2),a=o[0],s=o[1],u=8===s?e.getFloat64:e.getFloat32;n[a]=u.call(e,r,!0),r+=s}}catch(e){i.e(e)}finally{i.f()}return{header:n,headerEndPosition:r}}(n),o=i.header,a=i.headerEndPosition;if(r.maxDecodingStep<q)return{header:o};var s=function(e,t){var r=t,n=e.getUint32(r,!0),i=new Uint16Array(3*n);r+=Uint32Array.BYTES_PER_ELEMENT;for(var o=Uint16Array.BYTES_PER_ELEMENT,a=n*o,s=r,u=s+a,c=u+a,l=0,h=0,f=0,d=0;d<n;d++)l+=k(e.getUint16(s+o*d,!0)),h+=k(e.getUint16(u+o*d,!0)),f+=k(e.getUint16(c+o*d,!0)),i[d]=l,i[d+n]=h,i[d+2*n]=f;return{vertexData:i,vertexDataEndPosition:r+=3*a}}(n,a),u=s.vertexData,c=s.vertexDataEndPosition;if(r.maxDecodingStep<N)return{header:o,vertexData:u};var l=function(e,t,r){var n=r,i=t.length/3>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%i!=0&&(n+=i-n%i);var o=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var a=3*o,s=A(e.buffer,n,a,i);return{triangleIndicesEndPosition:n+=a*i,triangleIndices:s}}(n,u,c),h=l.triangleIndices,f=l.triangleIndicesEndPosition;if(r.maxDecodingStep<D)return{header:o,vertexData:u,triangleIndices:h};var d=function(e,t,r){var n=r,i=t.length/3>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,o=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var a=A(e.buffer,n,o,i,!1);n+=o*i;var s=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var u=A(e.buffer,n,s,i,!1);n+=s*i;var c=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var l=A(e.buffer,n,c,i,!1);n+=c*i;var h=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;var f=A(e.buffer,n,h,i,!1);return{edgeIndicesEndPosition:n+=h*i,westIndices:a,southIndices:u,eastIndices:l,northIndices:f}}(n,u,f),p=d.westIndices,v=d.southIndices,g=d.eastIndices,y=d.northIndices,_=d.edgeIndicesEndPosition;return r.maxDecodingStep<R?{header:o,vertexData:u,triangleIndices:h,westIndices:p,northIndices:y,eastIndices:g,southIndices:v}:{header:o,vertexData:u,triangleIndices:h,westIndices:p,northIndices:y,eastIndices:g,southIndices:v,extensions:function(e,t){var r={};if(e.byteLength<=t)return{extensions:r,extensionsEndPosition:t};for(var n,i=t;i<e.byteLength;){var o=e.getUint8(i,!0);i+=Uint8Array.BYTES_PER_ELEMENT;var a=e.getUint32(i,!0);i+=Uint32Array.BYTES_PER_ELEMENT;var s=new DataView(e.buffer,i,a);switch(o){case 1:r.vertexNormals=(n=s,new Uint8Array(n.buffer,n.byteOffset,n.byteLength));break;case 2:r.waterMask=j(s)}i+=a}return{extensions:r,extensionsEndPosition:i}}(n,_).extensions}}var z=r(4),Y=r.n(z);r(5);function F(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t,i=n&&n.length>1&&n[0].constructor||null;if(!i)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');for(var o=n.reduce((function(e,t){return e+t.length}),0),a=new i(o),s=0,u=0,c=n;u<c.length;u++){var l=c[u];a.set(l,s),s+=l.length}return a}function C(e,t,r){for(var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=n?X(n,e.POSITION.value):H(t),o=new e.POSITION.value.constructor(6*i.length),a=new e.TEXCOORD_0.value.constructor(4*i.length),s=new t.constructor(6*i.length),u=0;u<i.length;u++){var c=i[u];G({edge:c,edgeIndex:u,attributes:e,skirtHeight:r,newPosition:o,newTexcoord0:a,newTriangles:s})}e.POSITION.value=F(e.POSITION.value,o),e.TEXCOORD_0.value=F(e.TEXCOORD_0.value,a);var l=t instanceof Array?t.concat(s):F(t,s);return{attributes:e,triangles:l}}function H(e){for(var t=[],r=0;r<e.length;r+=3)t.push([e[r],e[r+1]]),t.push([e[r+1],e[r+2]]),t.push([e[r+2],e[r]]);t.sort((function(e,t){return Math.min.apply(Math,Y()(e))-Math.min.apply(Math,Y()(t))||Math.max.apply(Math,Y()(e))-Math.max.apply(Math,Y()(t))}));for(var n=[],i=1;i<t.length;)t[i][0]===t[i-1][1]&&t[i][1]===t[i-1][0]?i+=2:(n.push(t[i-1]),i++);return n}function X(e,t){e.westIndices.sort((function(e,r){return t[3*e+1]-t[3*r+1]})),e.eastIndices.sort((function(e,r){return t[3*r+1]-t[3*e+1]})),e.southIndices.sort((function(e,r){return t[3*r]-t[3*e]})),e.northIndices.sort((function(e,r){return t[3*e]-t[3*r]}));var r=[];for(var n in e)for(var i=e[n],o=0;o<i.length-1;o++)r.push([i[o],i[o+1]]);return r}function G(e){var t=e.edge,r=e.edgeIndex,n=e.attributes,i=e.skirtHeight,o=e.newPosition,a=e.newTexcoord0,s=e.newTriangles,u=n.POSITION.value.length,c=2*r,l=2*r+1;o.set(n.POSITION.value.subarray(3*t[0],3*t[0]+3),3*c),o[3*c+2]=o[3*c+2]-i,o.set(n.POSITION.value.subarray(3*t[1],3*t[1]+3),3*l),o[3*l+2]=o[3*l+2]-i,a.set(n.TEXCOORD_0.value.subarray(2*t[0],2*t[0]+2),2*c),a.set(n.TEXCOORD_0.value.subarray(2*t[1],2*t[1]+2),2*l);var h=2*r*3;s[h]=t[0],s[h+1]=t[1],s[h+2]=u/3+l,s[h+3]=u/3+l,s[h+4]=u/3+c,s[h+5]=t[0]}function $(e,t){if(!e)return null;var r=t.bounds,n=B(e,N),i=n.header,o=n.vertexData,a=n.triangleIndices,s=n.westIndices,u=n.northIndices,c=n.eastIndices,l=n.southIndices,h=a,f=function(e,t,r){for(var n=t.minHeight,i=t.maxHeight,o=r||[0,0,1,1],a=O()(o,4),s=a[0],u=a[1],c=a[2]-s,l=a[3]-u,h=i-n,f=e.length/3,d=new Float32Array(3*f),p=new Float32Array(2*f),v=0;v<f;v++){var g=e[v]/32767,y=e[v+f]/32767,_=e[v+2*f]/32767;d[3*v+0]=g*c+s,d[3*v+1]=y*l+u,d[3*v+2]=_*h+n,p[2*v+0]=g,p[2*v+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}(o,i,r),d=P(f);if(t.skirtHeight){var p=C(f,h,t.skirtHeight,{westIndices:s,northIndices:u,eastIndices:c,southIndices:l});f=p.attributes,h=p.triangles}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:d},mode:4,indices:{value:h,size:1},attributes:f}}function V(e,t){return $(e,t["quantized-mesh"])}class Z{constructor(e=257){this.gridSize=e;const t=e-1;if(t&t-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=t*t*2-2,this.numParentTriangles=this.numTriangles-t*t,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(4*this.numTriangles);for(let e=0;e<this.numTriangles;e++){let r=e+2,n=0,i=0,o=0,a=0,s=0,u=0;for(1&r?o=a=s=t:n=i=u=t;(r>>=1)>1;){const e=n+o>>1,t=i+a>>1;1&r?(o=n,a=i,n=s,i=u):(n=o,i=a,o=s,a=u),s=e,u=t}const c=4*e;this.coords[c+0]=n,this.coords[c+1]=i,this.coords[c+2]=o,this.coords[c+3]=a}}createTile(e){return new Q(e,this)}}class Q{constructor(e,t){const r=t.gridSize;if(e.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${e.length}.`);this.terrain=e,this.martini=t,this.errors=new Float32Array(e.length),this.update()}update(){const{numTriangles:e,numParentTriangles:t,coords:r,gridSize:n}=this.martini,{terrain:i,errors:o}=this;for(let a=e-1;a>=0;a--){const e=4*a,s=r[e+0],u=r[e+1],c=r[e+2],l=r[e+3],h=s+c>>1,f=u+l>>1,d=h+f-u,p=f+s-h,v=(i[u*n+s]+i[l*n+c])/2,g=f*n+h,y=Math.abs(v-i[g]);if(o[g]=Math.max(o[g],y),a<t){const e=(u+p>>1)*n+(s+d>>1),t=(l+p>>1)*n+(c+d>>1);o[g]=Math.max(o[g],o[e],o[t])}}}getMesh(e=0){const{gridSize:t,indices:r}=this.martini,{errors:n}=this;let i=0,o=0;const a=t-1;function s(a,u,c,l,h,f){const d=a+c>>1,p=u+l>>1;Math.abs(a-h)+Math.abs(u-f)>1&&n[p*t+d]>e?(s(h,f,a,u,d,p),s(c,l,h,f,d,p)):(r[u*t+a]=r[u*t+a]||++i,r[l*t+c]=r[l*t+c]||++i,r[f*t+h]=r[f*t+h]||++i,o++)}r.fill(0),s(0,0,a,a,a,0),s(a,a,0,0,0,a);const u=new Uint16Array(2*i),c=new Uint32Array(3*o);let l=0;function h(i,o,a,s,f,d){const p=i+a>>1,v=o+s>>1;if(Math.abs(i-f)+Math.abs(o-d)>1&&n[v*t+p]>e)h(f,d,i,o,p,v),h(a,s,f,d,p,v);else{const e=r[o*t+i]-1,n=r[s*t+a]-1,h=r[d*t+f]-1;u[2*e]=i,u[2*e+1]=o,u[2*n]=a,u[2*n+1]=s,u[2*h]=f,u[2*h+1]=d,c[l++]=e,c[l++]=n,c[l++]=h}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:u,triangles:c}}}var W=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r;l()(this,e),this.data=t,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;var i=r-1,o=n-1,a=this._addPoint(0,0),s=this._addPoint(i,0),u=this._addPoint(0,o),c=this._addPoint(i,o),h=this._addTriangle(c,a,u,-1,-1,-1);this._addTriangle(a,c,s,h,-1,-1),this._flush()}return f()(e,[{key:"run",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.getMaxError()>e;)this.refine()}},{key:"refine",value:function(){this._step(),this._flush()}},{key:"getMaxError",value:function(){return this._errors[0]}},{key:"getRMSD",value:function(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}},{key:"heightAt",value:function(e,t){return this.data[this.width*t+e]}},{key:"_flush",value:function(){for(var e=this.coords,t=0;t<this._pendingLen;t++){var r=this._pending[t],n=2*this.triangles[3*r+0],i=2*this.triangles[3*r+1],o=2*this.triangles[3*r+2];this._findCandidate(e[n],e[n+1],e[i],e[i+1],e[o],e[o+1],r)}this._pendingLen=0}},{key:"_findCandidate",value:function(e,t,r,n,i,o,a){for(var s=Math.min(e,r,i),u=Math.min(t,n,o),c=Math.max(e,r,i),l=Math.max(t,n,o),h=J(r,n,i,o,s,u),f=J(i,o,e,t,s,u),d=J(e,t,r,n,s,u),p=n-t,v=e-r,g=o-n,y=r-i,_=t-o,m=i-e,E=J(e,t,r,n,i,o),b=this.heightAt(e,t)/E,x=this.heightAt(r,n)/E,w=this.heightAt(i,o)/E,T=0,S=0,O=0,P=0,M=u;M<=l;M++){var I=0;h<0&&0!==g&&(I=Math.max(I,Math.floor(-h/g))),f<0&&0!==_&&(I=Math.max(I,Math.floor(-f/_))),d<0&&0!==p&&(I=Math.max(I,Math.floor(-d/p)));for(var L=h+g*I,k=f+_*I,A=d+p*I,j=!1,q=s+I;q<=c;q++){if(L>=0&&k>=0&&A>=0){j=!0;var N=b*L+x*k+w*A,D=Math.abs(N-this.heightAt(q,M));P+=D*D,D>T&&(T=D,S=q,O=M)}else if(j)break;L+=g,k+=_,A+=p}h+=y,f+=m,d+=v}(S===e&&O===t||S===r&&O===n||S===i&&O===o)&&(T=0),this._candidates[2*a]=S,this._candidates[2*a+1]=O,this._rms[a]=P,this._queuePush(a,T,P)}},{key:"_step",value:function(){var e=this._queuePop(),t=3*e+0,r=3*e+1,n=3*e+2,i=this.triangles[t],o=this.triangles[r],a=this.triangles[n],s=this.coords[2*i],u=this.coords[2*i+1],c=this.coords[2*o],l=this.coords[2*o+1],h=this.coords[2*a],f=this.coords[2*a+1],d=this._candidates[2*e],p=this._candidates[2*e+1],v=this._addPoint(d,p);if(0===J(s,u,c,l,d,p))this._handleCollinear(v,t);else if(0===J(c,l,h,f,d,p))this._handleCollinear(v,r);else if(0===J(h,f,s,u,d,p))this._handleCollinear(v,n);else{var g=this._halfedges[t],y=this._halfedges[r],_=this._halfedges[n],m=this._addTriangle(i,o,v,g,-1,-1,t),E=this._addTriangle(o,a,v,y,-1,m+1),b=this._addTriangle(a,i,v,_,m+2,E+1);this._legalize(m),this._legalize(E),this._legalize(b)}}},{key:"_addPoint",value:function(e,t){var r=this.coords.length>>1;return this.coords.push(e,t),r}},{key:"_addTriangle",value:function(e,t,r,n,i,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this.triangles.length,s=a/3;return this.triangles[a+0]=e,this.triangles[a+1]=t,this.triangles[a+2]=r,this._halfedges[a+0]=n,this._halfedges[a+1]=i,this._halfedges[a+2]=o,n>=0&&(this._halfedges[n]=a+0),i>=0&&(this._halfedges[i]=a+1),o>=0&&(this._halfedges[o]=a+2),this._candidates[2*s+0]=0,this._candidates[2*s+1]=0,this._queueIndices[s]=-1,this._rms[s]=0,this._pending[this._pendingLen++]=s,a}},{key:"_legalize",value:function(e){var t=this._halfedges[e];if(!(t<0)){var r=e-e%3,n=t-t%3,i=r+(e+1)%3,o=r+(e+2)%3,a=n+(t+2)%3,s=n+(t+1)%3,u=this.triangles[o],c=this.triangles[e],l=this.triangles[i],h=this.triangles[a],f=this.coords;if(d=f[2*u],p=f[2*u+1],v=f[2*c],g=f[2*c+1],y=f[2*l],_=f[2*l+1],m=f[2*h],E=f[2*h+1],(b=d-m)*((T=g-E)*(M=(S=y-m)*S+(O=_-E)*O)-(P=(w=v-m)*w+T*T)*O)-(x=p-E)*(w*M-P*S)+(b*b+x*x)*(w*O-T*S)<0){var d,p,v,g,y,_,m,E,b,x,w,T,S,O,P,M,I=this._halfedges[i],L=this._halfedges[o],k=this._halfedges[a],A=this._halfedges[s];this._queueRemove(r/3),this._queueRemove(n/3);var j=this._addTriangle(u,h,l,-1,k,I,r),q=this._addTriangle(h,u,c,j,L,A,n);this._legalize(j+1),this._legalize(q+2)}}}},{key:"_handleCollinear",value:function(e,t){var r=t-t%3,n=r+(t+1)%3,i=r+(t+2)%3,o=this.triangles[i],a=this.triangles[t],s=this.triangles[n],u=this._halfedges[n],c=this._halfedges[i],l=this._halfedges[t];if(l<0){var h=this._addTriangle(e,o,a,-1,c,-1,r),f=this._addTriangle(o,e,s,h,-1,u);return this._legalize(h+1),void this._legalize(f+2)}var d=l-l%3,p=d+(l+2)%3,v=d+(l+1)%3,g=this.triangles[p],y=this._halfedges[p],_=this._halfedges[v];this._queueRemove(d/3);var m=this._addTriangle(o,a,e,c,-1,-1,r),E=this._addTriangle(a,g,e,_,-1,m+1,d),b=this._addTriangle(g,s,e,y,-1,E+1),x=this._addTriangle(s,o,e,u,m+2,b+1);this._legalize(m),this._legalize(E),this._legalize(b),this._legalize(x)}},{key:"_queuePush",value:function(e,t,r){var n=this._queue.length;this._queueIndices[e]=n,this._queue.push(e),this._errors.push(t),this._rmsSum+=r,this._queueUp(n)}},{key:"_queuePop",value:function(){var e=this._queue.length-1;return this._queueSwap(0,e),this._queueDown(0,e),this._queuePopBack()}},{key:"_queuePopBack",value:function(){var e=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[e],this._queueIndices[e]=-1,e}},{key:"_queueRemove",value:function(e){var t=this._queueIndices[e];if(t<0){var r=this._pending.indexOf(e);if(-1===r)throw new Error("Broken triangulation (something went wrong).");this._pending[r]=this._pending[--this._pendingLen]}else{var n=this._queue.length-1;n!==t&&(this._queueSwap(t,n),this._queueDown(t,n)||this._queueUp(t)),this._queuePopBack()}}},{key:"_queueLess",value:function(e,t){return this._errors[e]>this._errors[t]}},{key:"_queueSwap",value:function(e,t){var r=this._queue[e],n=this._queue[t];this._queue[e]=n,this._queue[t]=r,this._queueIndices[r]=t,this._queueIndices[n]=e;var i=this._errors[e];this._errors[e]=this._errors[t],this._errors[t]=i}},{key:"_queueUp",value:function(e){for(var t=e;;){var r=t-1>>1;if(r===t||!this._queueLess(t,r))break;this._queueSwap(r,t),t=r}}},{key:"_queueDown",value:function(e,t){for(var r=e;;){var n=2*r+1;if(n>=t||n<0)break;var i=n+1,o=n;if(i<t&&this._queueLess(i,n)&&(o=i),!this._queueLess(o,r))break;this._queueSwap(r,o),r=o}return r>e}}]),e}();function J(e,t,r,n,i,o){return(r-i)*(t-o)-(n-o)*(e-i)}function K(e,t,r,n,i){for(var o=n.rScaler,a=n.bScaler,s=n.gScaler,u=n.offset,c=new Float32Array((t+1)*(r+1)),l=0,h=0;h<r;h++)for(var f=0;f<t;f++,l++){var d=4*l,p=e[d+0],v=e[d+1],g=e[d+2];c[l+h]=p*o+v*s+g*a+u}if("martini"===i){for(var y=(t+1)*t,_=0;_<t;_++,y++)c[y]=c[y-t-1];for(var m=r,E=0;E<r+1;E++,m+=r+1)c[m]=c[m-1]}return c}function ee(e,t){if(null===e)return null;var r,n,i=t.meshMaxError,o=t.bounds,a=t.elevationDecoder,s=e.data,u=e.width,c=e.height;switch(t.tesselator){case"martini":n=te(i,u,r=K(s,u,c,a,t.tesselator));break;case"delatin":n=re(i,u,c,r=K(s,u,c,a,t.tesselator));break;default:n=u!==c||c&u-1?re(i,u,c,r=K(s,u,c,a,"delatin")):te(i,u,r=K(s,u,c,a,"martini"))}var l=n.vertices,h=n.triangles,f=function(e,t,r,n,i){for(var o=r+1,a=e.length/2,s=new Float32Array(3*a),u=new Float32Array(2*a),c=i||[0,0,r,n],l=O()(c,4),h=l[0],f=l[1],d=l[2],p=l[3],v=(d-h)/r,g=(p-f)/n,y=0;y<a;y++){var _=e[2*y],m=e[2*y+1],E=m*o+_;s[3*y+0]=_*v+h,s[3*y+1]=-m*g+p,s[3*y+2]=t[E],u[2*y+0]=_/r,u[2*y+1]=m/n}return{POSITION:{value:s,size:3},TEXCOORD_0:{value:u,size:2}}}(l,r,u,c,o),d=P(f);if(t.skirtHeight){var p=C(f,h,t.skirtHeight);f=p.attributes,h=p.triangles}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(h),size:1},attributes:f}}function te(e,t,r){var n=new Z(t+1).createTile(r).getMesh(e);return{vertices:n.vertices,triangles:n.triangles}}function re(e,t,r,n){var i=new W(n,t+1,r+1);return i.run(e),{vertices:i.coords,triangles:i.triangles}}function ne(){return(ne=a()(u.a.mark((function e(t,r,n){var i;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.image=r.image||{},r.image.type="data",e.next=4,n.parse(t,r,r.baseUri);case 4:return i=e.sent,e.abrupt("return",ee(i,r.terrain));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ie={name:"Terrain",id:"terrain",module:"terrain",version:"3.0.14",worker:!0,extensions:["png","pngraw"],mimeTypes:["image/png"],options:{terrain:{tesselator:"auto",bounds:null,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:null}}},oe={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:"3.0.14",worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ae(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}se(se({},ie),{},{parse:function(e,t,r){return ne.apply(this,arguments)}});var ue,ce,le=se(se({},oe),{},{parseSync:V,parse:(ue=a()(u.a.mark((function e(t,r){return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",V(t,r));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return ue.apply(this,arguments)})});ce=le,"undefined"!=typeof self&&(y.onmessage=function(){var e=a()(u.a.mark((function e(t,r){var n,i,o,a,s;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t,e.next="process"===e.t0?3:16;break;case 3:return e.prev=3,n=r.input,i=r.options,o=void 0===i?{}:i,e.next=7,w({loader:ce,arrayBuffer:n,options:o,context:{parse:x}});case 7:a=e.sent,y.postMessage("done",{result:a}),e.next=15;break;case 11:e.prev=11,e.t1=e.catch(3),s=e.t1 instanceof Error?e.t1.message:"",y.postMessage("error",{error:s});case 15:return e.abrupt("break",16);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(t,r){return e.apply(this,arguments)}}())}]);
2
2
  //# sourceMappingURL=quantized-mesh-worker.js.map