@loaders.gl/tiles 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.
- package/dist/bundle.js +2 -4
- package/dist/bundle.js.map +1 -1
- package/dist/tileset/helpers/transform-utils.js +4 -1
- package/dist/tileset/helpers/transform-utils.js.map +1 -1
- package/dist/tileset/tile-3d.js +1 -1
- package/dist/tileset/tile-3d.js.map +1 -1
- package/dist/tileset/tileset-3d.js +5 -5
- package/dist/tileset/tileset-3d.js.map +1 -1
- package/dist/tileset/traversers/i3s-tileset-traverser.js +2 -2
- package/dist/tileset/traversers/i3s-tileset-traverser.js.map +1 -1
- package/package.json +8 -6
- package/src/bundle.ts +2 -3
- package/src/tileset/helpers/transform-utils.ts +3 -1
- package/dist/dist.min.js +0 -2
- package/dist/dist.min.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tiles",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
4
|
"description": "Common components for different tiles loaders.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -30,17 +30,19 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"pre-build": "npm run build-bundle",
|
|
33
|
-
"build-bundle": "
|
|
33
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/
|
|
37
|
-
"@loaders.gl/
|
|
38
|
-
"@loaders.gl/math": "3.1.0-alpha.2",
|
|
36
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.3",
|
|
37
|
+
"@loaders.gl/math": "4.0.0-alpha.3",
|
|
39
38
|
"@math.gl/core": "^3.5.1",
|
|
40
39
|
"@math.gl/culling": "^3.5.1",
|
|
41
40
|
"@math.gl/geospatial": "^3.5.1",
|
|
42
41
|
"@math.gl/web-mercator": "^3.5.1",
|
|
43
42
|
"@probe.gl/stats": "^3.4.0"
|
|
44
43
|
},
|
|
45
|
-
"
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@loaders.gl/core": "^3.0.0"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "ded84630d02ba4fc97277ebecea3e42ae1bc2616"
|
|
46
48
|
}
|
package/src/bundle.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
const moduleExports = require('./index');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = Object.assign(_global.loaders, moduleExports);
|
|
3
|
+
globalThis.loaders = globalThis.loaders || {};
|
|
4
|
+
module.exports = Object.assign(globalThis.loaders, moduleExports);
|
|
@@ -59,5 +59,7 @@ export function calculateTransformProps(tileHeader, tile) {
|
|
|
59
59
|
tile.cartographicOrigin = cartographicOrigin;
|
|
60
60
|
|
|
61
61
|
// Deprecated, drop
|
|
62
|
-
tile.
|
|
62
|
+
if (!tile.coordinateSystem) {
|
|
63
|
+
tile.modelMatrix = tile.cartographicModelMatrix;
|
|
64
|
+
}
|
|
63
65
|
}
|
package/dist/dist.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var i in r)("object"==typeof exports?exports:t)[i]=r[i]}}(window,(function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(i,s,function(e){return t[e]}.bind(null,s));return i},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=20)}([,function(t,e,r){"use strict";(function(t,i){r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return o}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},n=s.global||s.self||s.window||{},o="object"!=typeof i||"[object process]"!==String(i)||i.browser,a=void 0!==i&&i.version&&/v([0-9]*)/.exec(i.version);a&&parseFloat(a[1])}).call(this,r(6),r(3))},function(t,e,r){"use strict";(function(t,i){r.d(e,"b",(function(){return n})),r.d(e,"a",(function(){return o}));const s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document,process:"object"==typeof i&&i},n=s.window||s.self||s.global,o=s.process||{};console}).call(this,r(6),r(3))},function(t,e){var r,i,s=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===n||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:n}catch(t){r=n}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var h,c=[],u=!1,l=-1;function d(){u&&h&&(u=!1,h.length?c=h.concat(c):l=-1,c.length&&f())}function f(){if(!u){var t=a(d);u=!0;for(var e=c.length;e;){for(h=c,c=[];++l<e;)h&&h[l].run();l=-1,e=c.length}h=null,u=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||u||a(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=m,s.addListener=m,s.once=m,s.off=m,s.removeListener=m,s.removeAllListeners=m,s.emit=m,s.prependListener=m,s.prependOnceListener=m,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(t,e,r){"use strict";(function(t){function i(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if(void 0!==t&&t.hrtime){const r=t.hrtime();e=1e3*r[0]+r[1]/1e6}else e=Date.now();return e}r.d(e,"a",(function(){return i}))}).call(this,r(3))},,function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},,,function(t,e){},,,function(t,e){},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return s}));var i=r(14);function s(){return!("object"==typeof t&&"[object process]"===String(t)&&!t.browser)||Object(i.a)()}}).call(this,r(3))},function(t,e,r){"use strict";(function(t){function i(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if(void 0!==t&&"object"==typeof t.versions&&Boolean(t.versions.electron))return!0;const r="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,i=e||r;return!!(i&&i.indexOf("Electron")>=0)}r.d(e,"a",(function(){return i}))}).call(this,r(3))},function(t,e,r){"use strict";(function(t,i){r.d(e,"a",(function(){return s}));"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof document&&document,"object"!=typeof i||"[object process]"!==String(i)||i.browser;const s="undefined"!=typeof window&&void 0!==window.orientation,n=void 0!==i&&i.version&&/v([0-9]*)/.exec(i.version);n&&parseFloat(n[1])}).call(this,r(6),r(3))},,,,,function(t,e,r){(function(e){const i=r(23),s="undefined"==typeof window?e:window;s.loaders=s.loaders||{},t.exports=Object.assign(s.loaders,i)}).call(this,r(6))},,function(t,e){},function(t,e,r){"use strict";r.r(e),r.d(e,"Tileset3D",(function(){return ss})),r.d(e,"Tile3D",(function(){return Hi})),r.d(e,"TilesetTraverser",(function(){return $i})),r.d(e,"TilesetCache",(function(){return Nt})),r.d(e,"createBoundingVolume",(function(){return qi})),r.d(e,"calculateTransformProps",(function(){return Pt})),r.d(e,"getFrameState",(function(){return ze})),r.d(e,"TILE_CONTENT_STATE",(function(){return xi})),r.d(e,"TILE_REFINEMENT",(function(){return Ci})),r.d(e,"TILE_TYPE",(function(){return Ai})),r.d(e,"TILESET_TYPE",(function(){return Ri})),r.d(e,"LOD_METRIC_TYPE",(function(){return Oi}));var i={};function s(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}r.r(i),r.d(i,"dirname",(function(){return Mt})),r.d(i,"join",(function(){return St}));const n=1/Math.PI*180,o=1/180*Math.PI,a={};function h(t,{precision:e=a.precision||4}={}){return t=function(t){return Math.round(t/a.EPSILON)*a.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function c(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function u(t,e,r){if(c(t)){r=r||((i=t).clone?i.clone():new Array(i.length));for(let i=0;i<r.length&&i<t.length;++i)r[i]=e(t[i],i,r);return r}var i;return e(t)}function l(t){return function(t,e){return u(t,t=>t*o,e)}(t)}function d(t){return f(t)}function f(t,e){return u(t,t=>t*n,e)}function p(t,e,r){const i=a.EPSILON;r&&(a.EPSILON=r);try{if(t===e)return!0;if(c(t)&&c(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!p(t[r],e[r]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):!(!Number.isFinite(t)||!Number.isFinite(e))&&Math.abs(t-e)<=a.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{a.EPSILON=i}}function m(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function g(t,e,r=""){if(a.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}a.EPSILON=1e-12,a.debug=!1,a.precision=4,a.printTypes=!1,a.printDegrees=!1,a.printRowMajor=!0;const y={};function w(t,e){y[t]||(y[t]=!0,console.warn("".concat(t," has been removed in version ").concat(e,", see upgrade guide for more information")))}class v extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){get ELEMENTS(){return s(!1),0}clone(){return(new this.constructor).copy(this)}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}fromArray(t,e=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+e];return this.check()}to(t){return t===this?this:c(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toArray(t=[],e=0){for(let r=0;r<this.ELEMENTS;++r)t[e+r]=this[r];return t}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(a)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+h(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!p(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,r){void 0===r&&(r=e,e=t,t=this);for(let i=0;i<this.ELEMENTS;++i){const s=t[i];this[i]=s+r*(e[i]-s)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),e[r]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if(Array.isArray(t))return this.multiply(t);for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.scale(1/t)}clampScalar(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),e);return this.check()}multiplyByScalar(t){return this.scale(t)}get elements(){return this}check(){if(a.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}}class _ extends v{get ELEMENTS(){return s(!1),0}get RANK(){return s(!1),0}toString(){let t="[";if(a.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,r){return this[e*this.RANK+t]=m(r),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[r+t];return e}setColumn(t,e){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)this[r+t]=e[t];return this}}function T(t,e,r){const i=e[0],s=e[1],n=e[2],o=r[3]*i+r[7]*s+r[11]*n||1;return t[0]=(r[0]*i+r[4]*s+r[8]*n)/o,t[1]=(r[1]*i+r[5]*s+r[9]*n)/o,t[2]=(r[2]*i+r[6]*s+r[10]*n)/o,t}var b=1e-6,E="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function M(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=e[9],f=e[10],p=e[11],m=e[12],g=e[13],y=e[14],w=e[15],v=r[0],_=r[1],T=r[2],b=r[3];return t[0]=v*i+_*a+T*l+b*m,t[1]=v*s+_*h+T*d+b*g,t[2]=v*n+_*c+T*f+b*y,t[3]=v*o+_*u+T*p+b*w,v=r[4],_=r[5],T=r[6],b=r[7],t[4]=v*i+_*a+T*l+b*m,t[5]=v*s+_*h+T*d+b*g,t[6]=v*n+_*c+T*f+b*y,t[7]=v*o+_*u+T*p+b*w,v=r[8],_=r[9],T=r[10],b=r[11],t[8]=v*i+_*a+T*l+b*m,t[9]=v*s+_*h+T*d+b*g,t[10]=v*n+_*c+T*f+b*y,t[11]=v*o+_*u+T*p+b*w,v=r[12],_=r[13],T=r[14],b=r[15],t[12]=v*i+_*a+T*l+b*m,t[13]=v*s+_*h+T*d+b*g,t[14]=v*n+_*c+T*f+b*y,t[15]=v*o+_*u+T*p+b*w,t}function S(t,e,r){var i=r[0],s=r[1],n=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function x(t,e){var r=e[0],i=e[1],s=e[2],n=e[4],o=e[5],a=e[6],h=e[8],c=e[9],u=e[10];return t[0]=Math.hypot(r,i,s),t[1]=Math.hypot(n,o,a),t[2]=Math.hypot(h,c,u),t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var C,A;C=new E(2),E!=Float32Array&&(C[0]=0,C[1]=0),A=C;function R(){var t=new E(3);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function O(t){var e=t[0],r=t[1],i=t[2];return Math.hypot(e,r,i)}function L(t,e,r){var i=new E(3);return i[0]=t,i[1]=e,i[2]=r,i}function k(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function N(t,e,r){var i=e[0],s=e[1],n=e[2],o=r[0],a=r[1],h=r[2];return t[0]=s*h-n*a,t[1]=n*o-i*h,t[2]=i*a-s*o,t}function P(t,e,r){var i=e[0],s=e[1],n=e[2],o=r[3]*i+r[7]*s+r[11]*n+r[15];return o=o||1,t[0]=(r[0]*i+r[4]*s+r[8]*n+r[12])/o,t[1]=(r[1]*i+r[5]*s+r[9]*n+r[13])/o,t[2]=(r[2]*i+r[6]*s+r[10]*n+r[14])/o,t}function I(t,e,r){var i=e[0],s=e[1],n=e[2];return t[0]=i*r[0]+s*r[3]+n*r[6],t[1]=i*r[1]+s*r[4]+n*r[7],t[2]=i*r[2]+s*r[5]+n*r[8],t}var q=O;!function(){var t=R()}();function D(t){var e=t[0],r=t[1],i=t[2],s=t[3];return Math.hypot(e,r,i,s)}function V(t){var e=t[0],r=t[1],i=t[2],s=t[3];return e*e+r*r+i*i+s*s}!function(){var t=function(){var t=new E(4);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}();const j=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),z=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),U=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),F={};class B extends _{static get IDENTITY(){return F.IDENTITY=F.IDENTITY||Object.freeze(new B(j)),F.IDENTITY}static get ZERO(){return F.ZERO=F.ZERO||Object.freeze(new B(z)),F.ZERO}get INDICES(){return U}get ELEMENTS(){return 16}get RANK(){return 4}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,r,i,s,n,o,a,h,c,u,l,d,f,p,m){return this[0]=t,this[1]=e,this[2]=r,this[3]=i,this[4]=s,this[5]=n,this[6]=o,this[7]=a,this[8]=h,this[9]=c,this[10]=u,this[11]=l,this[12]=d,this[13]=f,this[14]=p,this[15]=m,this.check()}setRowMajor(t,e,r,i,s,n,o,a,h,c,u,l,d,f,p,m){return this[0]=t,this[1]=s,this[2]=h,this[3]=d,this[4]=e,this[5]=n,this[6]=c,this[7]=f,this[8]=r,this[9]=o,this[10]=u,this[11]=p,this[12]=i,this[13]=a,this[14]=l,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(j)}fromQuaternion(t){return function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=r+r,a=i+i,h=s+s,c=r*o,u=i*o,l=i*a,d=s*o,f=s*a,p=s*h,m=n*o,g=n*a,y=n*h;t[0]=1-l-p,t[1]=u+y,t[2]=d-g,t[3]=0,t[4]=u-y,t[5]=1-c-p,t[6]=f+m,t[7]=0,t[8]=d+g,t[9]=f-m,t[10]=1-c-l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum({left:t,right:e,bottom:r,top:i,near:s,far:n}){return n===1/0?B._computeInfinitePerspectiveOffCenter(this,t,e,r,i,s):function(t,e,r,i,s,n,o){var a=1/(r-e),h=1/(s-i),c=1/(n-o);t[0]=2*n*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*n*h,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+i)*h,t[10]=(o+n)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*n*2*c,t[15]=0}(this,t,e,r,i,s,n),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,r,i,s,n){const o=2*n/(r-e),a=2*n/(s-i),h=(r+e)/(r-e),c=(s+i)/(s-i),u=-2*n;return t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=h,t[9]=c,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=u,t[15]=0,t}lookAt(t,e,r){return 1===arguments.length&&({eye:t,center:e,up:r}=t),function(t,e,r,i){var s,n,o,a,h,c,u,l,d,f,p=e[0],m=e[1],g=e[2],y=i[0],w=i[1],v=i[2],_=r[0],T=r[1],E=r[2];Math.abs(p-_)<b&&Math.abs(m-T)<b&&Math.abs(g-E)<b?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(u=p-_,l=m-T,d=g-E,s=w*(d*=f=1/Math.hypot(u,l,d))-v*(l*=f),n=v*(u*=f)-y*d,o=y*l-w*u,(f=Math.hypot(s,n,o))?(s*=f=1/f,n*=f,o*=f):(s=0,n=0,o=0),a=l*o-d*n,h=d*s-u*o,c=u*n-l*s,(f=Math.hypot(a,h,c))?(a*=f=1/f,h*=f,c*=f):(a=0,h=0,c=0),t[0]=s,t[1]=a,t[2]=u,t[3]=0,t[4]=n,t[5]=h,t[6]=l,t[7]=0,t[8]=o,t[9]=c,t[10]=d,t[11]=0,t[12]=-(s*p+n*m+o*g),t[13]=-(a*p+h*m+c*g),t[14]=-(u*p+l*m+d*g),t[15]=1)}(this,t,e=e||[0,0,0],r=r||[0,1,0]),this.check()}ortho({left:t,right:e,bottom:r,top:i,near:s=.1,far:n=500}){return function(t,e,r,i,s,n,o){var a=1/(e-r),h=1/(i-s),c=1/(n-o);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+r)*a,t[13]=(s+i)*h,t[14]=(o+n)*c,t[15]=1}(this,t,e,r,i,s,n),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:r=1,near:i=.1,far:s=500}){if(t>2*Math.PI)throw Error("radians");const n=t/2,o=r*Math.tan(n),a=o*e;return(new B).ortho({left:-a,right:a,bottom:-o,top:o,near:i,far:s})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:i=.1,far:s=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return function(t,e,r,i,s){var n,o=1/Math.tan(e/2);t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=s&&s!==1/0?(n=1/(i-s),t[10]=(s+i)*n,t[14]=2*s*i*n):(t[10]=-1,t[14]=-2*i)}(this,t,r,i,s),this.check()}determinant(){return e=(t=this)[0],r=t[1],i=t[2],s=t[3],n=t[4],o=t[5],a=t[6],h=t[7],c=t[8],u=t[9],l=t[10],d=t[11],f=t[12],p=t[13],m=t[14],g=t[15],(e*o-r*n)*(l*g-d*m)-(e*a-i*n)*(u*g-d*p)+(e*h-s*n)*(u*m-l*p)+(r*a-i*o)*(c*g-d*f)-(r*h-s*o)*(c*m-l*f)+(i*h-s*a)*(c*p-u*f);var t,e,r,i,s,n,o,a,h,c,u,l,d,f,p,m,g}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),i=1/r[0],s=1/r[1],n=1/r[2];return t[0]=this[0]*i,t[1]=this[1]*s,t[2]=this[2]*n,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*s,t[6]=this[6]*n,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*s,t[10]=this[10]*n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),i=1/r[0],s=1/r[1],n=1/r[2];return t[0]=this[0]*i,t[1]=this[1]*s,t[2]=this[2]*n,t[3]=this[4]*i,t[4]=this[5]*s,t[5]=this[6]*n,t[6]=this[8]*i,t[7]=this[9]*s,t[8]=this[10]*n,t}transpose(){return function(t,e){if(t===e){var r=e[1],i=e[2],s=e[3],n=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=n,t[11]=e[14],t[12]=s,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=e[4],a=e[5],h=e[6],c=e[7],u=e[8],l=e[9],d=e[10],f=e[11],p=e[12],m=e[13],g=e[14],y=e[15],w=r*a-i*o,v=r*h-s*o,_=r*c-n*o,T=i*h-s*a,b=i*c-n*a,E=s*c-n*h,M=u*m-l*p,S=u*g-d*p,x=u*y-f*p,C=l*g-d*m,A=l*y-f*m,R=d*y-f*g,O=w*R-v*A+_*C+T*x-b*S+E*M;O&&(O=1/O,t[0]=(a*R-h*A+c*C)*O,t[1]=(s*A-i*R-n*C)*O,t[2]=(m*E-g*b+y*T)*O,t[3]=(d*b-l*E-f*T)*O,t[4]=(h*x-o*R-c*S)*O,t[5]=(r*R-s*x+n*S)*O,t[6]=(g*_-p*E-y*v)*O,t[7]=(u*E-d*_+f*v)*O,t[8]=(o*A-a*x+c*M)*O,t[9]=(i*x-r*A-n*M)*O,t[10]=(p*b-m*_+y*w)*O,t[11]=(l*_-u*b-f*w)*O,t[12]=(a*S-o*C-h*M)*O,t[13]=(r*C-i*S+s*M)*O,t[14]=(m*v-p*T-g*w)*O,t[15]=(u*T-l*v+d*w)*O)}(this,this),this.check()}multiplyLeft(t){return M(this,t,this),this.check()}multiplyRight(t){return M(this,this,t),this.check()}rotateX(t){return function(t,e,r){var i=Math.sin(r),s=Math.cos(r),n=e[4],o=e[5],a=e[6],h=e[7],c=e[8],u=e[9],l=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=n*s+c*i,t[5]=o*s+u*i,t[6]=a*s+l*i,t[7]=h*s+d*i,t[8]=c*s-n*i,t[9]=u*s-o*i,t[10]=l*s-a*i,t[11]=d*s-h*i}(this,this,t),this.check()}rotateY(t){return function(t,e,r){var i=Math.sin(r),s=Math.cos(r),n=e[0],o=e[1],a=e[2],h=e[3],c=e[8],u=e[9],l=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*s-c*i,t[1]=o*s-u*i,t[2]=a*s-l*i,t[3]=h*s-d*i,t[8]=n*i+c*s,t[9]=o*i+u*s,t[10]=a*i+l*s,t[11]=h*i+d*s}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){var i=Math.sin(r),s=Math.cos(r),n=e[0],o=e[1],a=e[2],h=e[3],c=e[4],u=e[5],l=e[6],d=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*s+c*i,t[1]=o*s+u*i,t[2]=a*s+l*i,t[3]=h*s+d*i,t[4]=c*s-n*i,t[5]=u*s-o*i,t[6]=l*s-a*i,t[7]=d*s-h*i}(this,this,t),this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return function(t,e,r,i){var s,n,o,a,h,c,u,l,d,f,p,m,g,y,w,v,_,T,E,M,S,x,C,A,R=i[0],O=i[1],L=i[2],k=Math.hypot(R,O,L);k<b||(R*=k=1/k,O*=k,L*=k,s=Math.sin(r),o=1-(n=Math.cos(r)),a=e[0],h=e[1],c=e[2],u=e[3],l=e[4],d=e[5],f=e[6],p=e[7],m=e[8],g=e[9],y=e[10],w=e[11],v=R*R*o+n,_=O*R*o+L*s,T=L*R*o-O*s,E=R*O*o-L*s,M=O*O*o+n,S=L*O*o+R*s,x=R*L*o+O*s,C=O*L*o-R*s,A=L*L*o+n,t[0]=a*v+l*_+m*T,t[1]=h*v+d*_+g*T,t[2]=c*v+f*_+y*T,t[3]=u*v+p*_+w*T,t[4]=a*E+l*M+m*S,t[5]=h*E+d*M+g*S,t[6]=c*E+f*M+y*S,t[7]=u*E+p*M+w*S,t[8]=a*x+l*C+m*A,t[9]=h*x+d*C+g*A,t[10]=c*x+f*C+y*A,t[11]=u*x+p*C+w*A,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return Array.isArray(t)?S(this,this,t):S(this,this,[t,t,t]),this.check()}translate(t){return function(t,e,r){var i,s,n,o,a,h,c,u,l,d,f,p,m=r[0],g=r[1],y=r[2];e===t?(t[12]=e[0]*m+e[4]*g+e[8]*y+e[12],t[13]=e[1]*m+e[5]*g+e[9]*y+e[13],t[14]=e[2]*m+e[6]*g+e[10]*y+e[14],t[15]=e[3]*m+e[7]*g+e[11]*y+e[15]):(i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=e[9],f=e[10],p=e[11],t[0]=i,t[1]=s,t[2]=n,t[3]=o,t[4]=a,t[5]=h,t[6]=c,t[7]=u,t[8]=l,t[9]=d,t[10]=f,t[11]=p,t[12]=i*m+a*g+l*y+e[12],t[13]=s*m+h*g+d*y+e[13],t[14]=n*m+c*g+f*y+e[14],t[15]=o*m+u*g+p*y+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(g(e=function(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3];return t[0]=r[0]*i+r[4]*s+r[8]*n+r[12]*o,t[1]=r[1]*i+r[5]*s+r[9]*n+r[13]*o,t[2]=r[2]*i+r[6]*s+r[10]*n+r[14]*o,t[3]=r[3]*i+r[7]*s+r[11]*n+r[15]*o,t}(e||[-0,-0,-0,-0],t,this),4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;switch(r){case 2:e=function(t,e,r){var i=e[0],s=e[1];return t[0]=r[0]*i+r[4]*s+r[12],t[1]=r[1]*i+r[5]*s+r[13],t}(e||[-0,-0],t,this);break;case 3:e=P(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return g(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=function(t,e,r){const i=e[0],s=e[1],n=r[3]*i+r[7]*s||1;return t[0]=(r[0]*i+r[4]*s)/n,t[1]=(r[1]*i+r[5]*s)/n,t}(e||[-0,-0],t,this);break;case 3:e=T(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return g(e,t.length),e}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,r){return this.identity().translate([t,e,r])}transformPoint(t,e){return w("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return w("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return w("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}class W extends v{get ELEMENTS(){return s(!1),0}copy(t){return s(!1),this}get x(){return this[0]}set x(t){this[0]=m(t)}get y(){return this[1]}set y(t){this[1]=m(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let r=0;r<this.ELEMENTS;++r){const i=this[r]-t[r];e+=i*i}return m(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return m(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return s(t>=0&&t<this.ELEMENTS,"index is out of range"),m(this[t])}setComponent(t,e){return s(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}const G=[0,0,0],$={};class Q extends W{static get ZERO(){return $.ZERO=$.ZERO||Object.freeze(new Q(0,0,0,0))}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&c(t)?this.copy(t):(a.debug&&(m(t),m(e),m(r)),this[0]=t,this[1]=e,this[2]=r)}set(t,e,r){return this[0]=t,this[1]=e,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return a.debug&&(m(t.x),m(t.y),m(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=m(t)}angle(t){return r=t,i=(e=this)[0],s=e[1],n=e[2],o=r[0],a=r[1],h=r[2],c=Math.sqrt(i*i+s*s+n*n)*Math.sqrt(o*o+a*a+h*h),u=c&&k(e,r)/c,Math.acos(Math.min(Math.max(u,-1),1));var e,r,i,s,n,o,a,h,c,u}cross(t){return N(this,this,t),this.check()}rotateX({radians:t,origin:e=G}){return function(t,e,r,i){var s=[],n=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],n[0]=s[0],n[1]=s[1]*Math.cos(i)-s[2]*Math.sin(i),n[2]=s[1]*Math.sin(i)+s[2]*Math.cos(i),t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2]}(this,this,e,t),this.check()}rotateY({radians:t,origin:e=G}){return function(t,e,r,i){var s=[],n=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],n[0]=s[2]*Math.sin(i)+s[0]*Math.cos(i),n[1]=s[1],n[2]=s[2]*Math.cos(i)-s[0]*Math.sin(i),t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2]}(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=G}){return function(t,e,r,i){var s=[],n=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],n[0]=s[0]*Math.cos(i)-s[1]*Math.sin(i),n[1]=s[0]*Math.sin(i)+s[1]*Math.cos(i),n[2]=s[2],t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2]}(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return P(this,this,t),this.check()}transformAsVector(t){return T(this,this,t),this.check()}transformByMatrix3(t){return I(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const i=e[0],s=e[1];t[0]=r[0]*i+r[2]*s,t[1]=r[1]*i+r[3]*s,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,r){var i=r[0],s=r[1],n=r[2],o=r[3],a=e[0],h=e[1],c=e[2],u=s*c-n*h,l=n*a-i*c,d=i*h-s*a,f=s*d-n*l,p=n*u-i*d,m=i*l-s*u,g=2*o;u*=g,l*=g,d*=g,f*=2,p*=2,m*=2,t[0]=a+u+f,t[1]=h+l+p,t[2]=c+d+m}(this,this,t),this.check()}}var Y=.1,H=1e-12,K=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const Z=t=>t,X=new Q;function J(t,e,r=Z){return c(t)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z),e}function tt(t,e,r=Z){return c(e)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]),e}const et=new Q,rt=new Q,it=new Q;const st=new Q,nt={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},ot={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},at={east:new Q,north:new Q,up:new Q,west:new Q,south:new Q,down:new Q},ht=new Q,ct=new Q,ut=new Q;function lt(t,e,r,i,n,o){const a=nt[e]&&nt[e][r];let h,c,u;s(a&&(!i||i===a));const l=st.copy(n);if(p(l.x,0,1e-14)&&p(l.y,0,1e-14)){const t=Math.sign(l.z);h=ht.fromArray(ot[e]),"east"!==e&&"west"!==e&&h.scale(t),c=ct.fromArray(ot[r]),"east"!==r&&"west"!==r&&c.scale(t),u=ut.fromArray(ot[i]),"east"!==i&&"west"!==i&&u.scale(t)}else{const{up:s,east:n,north:o}=at;n.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,s),o.copy(s).cross(n);const{down:a,west:d,south:f}=at;a.copy(s).scale(-1),d.copy(n).scale(-1),f.copy(o).scale(-1),h=at[e],c=at[r],u=at[i]}return o[0]=h.x,o[1]=h.y,o[2]=h.z,o[3]=0,o[4]=c.x,o[5]=c.y,o[6]=c.z,o[7]=0,o[8]=u.x,o[9]=u.y,o[10]=u.z,o[11]=0,o[12]=l.x,o[13]=l.y,o[14]=l.z,o[15]=1,o}const dt=new Q,ft=new Q,pt=new Q,mt=new Q,gt=new Q,yt=new Q;let wt;class vt{static get WGS84(){return wt=wt||new vt(6378137,6378137,6356752.314245179),wt}constructor(t=0,e=0,r=0){s(t>=0),s(e>=0),s(r>=0),this.radii=new Q(t,e,r),this.radiiSquared=new Q(t*t,e*e,r*r),this.radiiToTheFourth=new Q(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new Q(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new Q(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),this.centerToleranceSquared=Y,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=ft,i=pt,[,,s]=t;this.geodeticSurfaceNormalCartographic(t,r),i.copy(this.radiiSquared).scale(r);const n=Math.sqrt(r.dot(i));return i.scale(1/n),r.scale(s),i.add(r),i.to(e)}cartesianToCartographic(t,e=[0,0,0]){yt.from(t);const r=this.scaleToGeodeticSurface(yt,mt);if(!r)return;const i=this.geodeticSurfaceNormal(r,ft),s=gt;s.copy(yt).subtract(r);const n=Math.atan2(i.y,i.x),o=Math.asin(i.z),h=Math.sign(k(s,yt))*O(s);return tt([n,o,h],e,a._cartographicRadians?Z:d)}eastNorthUpToFixedFrame(t,e=new B){return lt(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,i,s=new B){return lt(this,t,e,r,i,s)}geocentricSurfaceNormal(t,e=[0,0,0]){return dt.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=function(t,e=X){return J(t,e,a._cartographicRadians?Z:l)}(t),i=r[0],s=r[1],n=Math.cos(s);return dt.set(n*Math.cos(i),n*Math.sin(i),Math.sin(s)).normalize(),dt.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return dt.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new Q){const{oneOverRadii:i,oneOverRadiiSquared:s,centerToleranceSquared:n}=e;et.from(t);const o=t.x,a=t.y,h=t.z,c=i.x,u=i.y,l=i.z,d=o*o*c*c,f=a*a*u*u,p=h*h*l*l,m=d+f+p,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;const y=rt;if(y.copy(t).scale(g),m<n)return y.to(r);const w=s.x,v=s.y,_=s.z,T=it;T.set(y.x*w*2,y.y*v*2,y.z*_*2);let b,E,M,S,x=(1-g)*t.len()/(.5*T.len()),C=0;do{x-=C,b=1/(1+x*w),E=1/(1+x*v),M=1/(1+x*_);const t=b*b,e=E*E,r=M*M;S=d*t+f*e+p*r-1;C=S/(-2*(d*(t*b)*w+f*(e*E)*v+p*(r*M)*_))}while(Math.abs(S)>H);return et.scale([b,E,M]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){mt.from(t);const r=mt.x,i=mt.y,s=mt.z,n=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*n.x+i*i*n.y+s*s*n.z);return mt.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return mt.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return mt.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){s(p(this.radii.x,this.radii.y,K)),s(this.radii.z>0),mt.from(t);const i=mt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-e))return mt.set(0,0,i).to(r)}}var _t=r(4);class Tt{constructor(t,e){this.name=t,this.type=e,this.sampleSize=1,this.reset()}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Object(_t.a)(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Object(_t.a)()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class bt{constructor({id:t,stats:e}){this.id=t,this.stats={},this._initializeStats(e),Object.seal(this)}get(t,e="count"){return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t in this.stats)this.stats[t].reset();return this}forEach(t){for(const e in this.stats)t(this.stats[e])}getTable(){const t={};return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(t=>this._getOrCreate(t))}_getOrCreate(t){if(!t||!t.name)return null;const{name:e,type:r}=t;return this.stats[e]||(this.stats[e]=t instanceof Tt?t:new Tt(e,r)),this.stats[e]}}function Et(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function Mt(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(0,e):""}function St(...t){return(t=t.map((e,r)=>(r&&(e=e.replace(new RegExp("^/"),"")),r!==t.length-1&&(e=e.replace(new RegExp("/$"),"")),e))).join("/")}r(12);function xt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Ct={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class At{constructor(t={}){xt(this,"props",void 0),xt(this,"stats",void 0),xt(this,"activeRequestCount",0),xt(this,"requestQueue",[]),xt(this,"requestMap",new Map),xt(this,"deferredUpdate",null),this.props={...Ct,...t},this.stats=new bt({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t,e=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const r={handle:t,priority:0,getPriority:e},i=new Promise(t=>(r.resolve=t,r));return this.requestQueue.push(r),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){const{handle:e,resolve:r}=t;let i=!1;const s=()=>{i||(i=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:s}):Promise.resolve({done:s})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;e<t;++e){const t=this.requestQueue.shift();t&&this._issueRequest(t)}}}_updateAllRequests(){const t=this.requestQueue;for(let e=0;e<t.length;++e){const r=t[e];this._updateRequest(r)||(t.splice(e,1),this.requestMap.delete(r.handle),e--)}t.sort((t,e)=>t.priority-e.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0)||(t.resolve(null),!1)}}class Rt{constructor(t,e,r){this.item=t,this.previous=e,this.next=r}}class Ot{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(t){const e=new Rt(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),++this._length,e}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,e){t!==e&&(this.remove(e),this._insert(t,e))}_insert(t,e){const r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,++this._length}}function Lt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kt(t){return null!=t}class Nt{constructor(){Lt(this,"_list",void 0),Lt(this,"_sentinel",void 0),Lt(this,"_trimTiles",void 0),this._list=new Ot,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;kt(e)&&this._list.splice(this._sentinel,e)}add(t,e,r){kt(e._cacheNode)||(e._cacheNode=this._list.add(e),r&&r(t,e))}unloadTile(t,e,r){const i=e._cacheNode;kt(i)&&(this._list.remove(i),e._cacheNode=void 0,r&&r(t,e))}unloadTiles(t,e){const r=this._trimTiles;this._trimTiles=!1;const i=this._list,s=1024*t.maximumMemoryUsage*1024,n=this._sentinel;let o=i.head;for(;o!==n&&(t.gpuMemoryUsageInBytes>s||r);){const r=o.item;o=o.next,this.unloadTile(t,r,e)}}trim(){this._trimTiles=!0}}function Pt(t,e){Et(t),Et(e);const{rtcCenter:r,gltfUpAxis:i}=e,{computedTransform:s,boundingVolume:{center:n}}=t;let o=new B(s);switch(r&&o.translate(r),i){case"Z":break;case"Y":const t=(new B).rotateX(Math.PI/2);o=o.multiplyRight(t);break;case"X":const e=(new B).rotateY(-Math.PI/2);o=o.multiplyRight(e)}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const a=new Q(n);e.cartesianModelMatrix=o,e.cartesianOrigin=a;const h=vt.WGS84.cartesianToCartographic(a,new Q),c=vt.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=c.multiplyRight(o),e.cartographicOrigin=h,e.modelMatrix=e.cartographicModelMatrix}const It=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new Q,new Q;const qt=new Q,Dt=new Q;class Vt{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new Q,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=qt.from(e),this.center=(new Q).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new Vt(this.center,this.radius)}union(t){const e=this.center,r=this.radius,i=t.center,s=t.radius,n=qt.copy(i).subtract(e),o=n.magnitude();if(r>=o+s)return this.clone();if(s>=o+r)return t.clone();const a=.5*(r+o+s);return Dt.copy(n).scale((-r+a)/o).add(e),this.center.copy(Dt),this.radius=a,this}expand(t){const e=(t=qt.from(t)).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=x(qt,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){return(t=qt.from(t)).subtract(this.center).lengthSquared()-this.radius*this.radius}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}intersectPlane(t){const e=this.center,r=this.radius,i=t.normal.dot(e)+t.distance;return i<-r?It.OUTSIDE:i<r?It.INTERSECTING:It.INSIDE}}function jt(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=r[0],f=r[1],p=r[2],m=r[3],g=r[4],y=r[5],w=r[6],v=r[7],_=r[8];return t[0]=d*i+f*o+p*c,t[1]=d*s+f*a+p*u,t[2]=d*n+f*h+p*l,t[3]=m*i+g*o+y*c,t[4]=m*s+g*a+y*u,t[5]=m*n+g*h+y*l,t[6]=w*i+v*o+_*c,t[7]=w*s+v*a+_*u,t[8]=w*n+v*h+_*l,t}function zt(t,e,r){var i=r[0],s=r[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}const Ut=Object.freeze([1,0,0,0,1,0,0,0,1]),Ft=Object.freeze([0,0,0,0,0,0,0,0,0]),Bt=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Wt={};class Gt extends _{static get IDENTITY(){return Wt.IDENTITY=Wt.IDENTITY||Object.freeze(new Gt(Ut)),Wt.IDENTITY}static get ZERO(){return Wt.ZERO=Wt.ZERO||Object.freeze(new Gt(Ft)),Wt.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Bt}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}set(t,e,r,i,s,n,o,a,h){return this[0]=t,this[1]=e,this[2]=r,this[3]=i,this[4]=s,this[5]=n,this[6]=o,this[7]=a,this[8]=h,this.check()}setRowMajor(t,e,r,i,s,n,o,a,h){return this[0]=t,this[1]=i,this[2]=o,this[3]=e,this[4]=s,this[5]=a,this[6]=r,this[7]=n,this[8]=h,this.check()}determinant(){return e=(t=this)[0],r=t[1],i=t[2],s=t[3],n=t[4],o=t[5],a=t[6],h=t[7],c=t[8],e*(c*n-o*h)+r*(-c*s+o*a)+i*(h*s-n*a);var t,e,r,i,s,n,o,a,h,c}identity(){return this.copy(Ut)}fromQuaternion(t){return function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=r+r,a=i+i,h=s+s,c=r*o,u=i*o,l=i*a,d=s*o,f=s*a,p=s*h,m=n*o,g=n*a,y=n*h;t[0]=1-l-p,t[3]=u-y,t[6]=d+g,t[1]=u+y,t[4]=1-c-p,t[7]=f-m,t[2]=d-g,t[5]=f+m,t[8]=1-c-l}(this,t),this.check()}transpose(){return function(t,e){if(t===e){var r=e[1],i=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=i,t[7]=s}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=e[4],a=e[5],h=e[6],c=e[7],u=e[8],l=u*o-a*c,d=-u*n+a*h,f=c*n-o*h,p=r*l+i*d+s*f;p&&(p=1/p,t[0]=l*p,t[1]=(-u*i+s*c)*p,t[2]=(a*i-s*o)*p,t[3]=d*p,t[4]=(u*r-s*h)*p,t[5]=(-a*r+s*n)*p,t[6]=f*p,t[7]=(-c*r+i*h)*p,t[8]=(o*r-i*n)*p)}(this,this),this.check()}multiplyLeft(t){return jt(this,t,this),this.check()}multiplyRight(t){return jt(this,this,t),this.check()}rotate(t){return function(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=Math.sin(r),f=Math.cos(r);t[0]=f*i+d*o,t[1]=f*s+d*a,t[2]=f*n+d*h,t[3]=f*o-d*i,t[4]=f*a-d*s,t[5]=f*h-d*n,t[6]=c,t[7]=u,t[8]=l}(this,this,t),this.check()}scale(t){return Array.isArray(t)?zt(this,this,t):zt(this,this,[t,t,t]),this.check()}translate(t){return function(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=e[6],u=e[7],l=e[8],d=r[0],f=r[1];t[0]=i,t[1]=s,t[2]=n,t[3]=o,t[4]=a,t[5]=h,t[6]=d*i+f*o+c,t[7]=d*s+f*a+u,t[8]=d*n+f*h+l}(this,this,t),this.check()}transform(t,e){switch(t.length){case 2:e=function(t,e,r){var i=e[0],s=e[1];return t[0]=r[0]*i+r[3]*s+r[6],t[1]=r[1]*i+r[4]*s+r[7],t}(e||[-0,-0],t,this);break;case 3:e=I(e||[-0,-0,-0],t,this);break;case 4:e=function(t,e,r){const i=e[0],s=e[1],n=e[2];return t[0]=r[0]*i+r[3]*s+r[6]*n,t[1]=r[1]*i+r[4]*s+r[7]*n,t[2]=r[2]*i+r[5]*s+r[8]*n,t[3]=e[3],t}(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return g(e,t.length),e}transformVector(t,e){return w("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return w("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return w("Matrix3.transformVector"),this.transform(t,e)}}function $t(){var t=new E(4);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Qt(t,e,r){r*=.5;var i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function Yt(t,e,r){var i=e[0],s=e[1],n=e[2],o=e[3],a=r[0],h=r[1],c=r[2],u=r[3];return t[0]=i*u+o*a+s*c-n*h,t[1]=s*u+o*h+n*a-i*c,t[2]=n*u+o*c+i*h-s*a,t[3]=o*u-i*a-s*h-n*c,t}function Ht(t,e,r,i){var s,n,o,a,h,c=e[0],u=e[1],l=e[2],d=e[3],f=r[0],p=r[1],m=r[2],g=r[3];return(n=c*f+u*p+l*m+d*g)<0&&(n=-n,f=-f,p=-p,m=-m,g=-g),1-n>b?(s=Math.acos(n),o=Math.sin(s),a=Math.sin((1-i)*s)/o,h=Math.sin(i*s)/o):(a=1-i,h=i),t[0]=a*c+h*f,t[1]=a*u+h*p,t[2]=a*l+h*m,t[3]=a*d+h*g,t}function Kt(t,e){var r,i=e[0]+e[4]+e[8];if(i>0)r=Math.sqrt(i+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var s=0;e[4]>e[0]&&(s=1),e[8]>e[3*s+s]&&(s=2);var n=(s+1)%3,o=(s+2)%3;r=Math.sqrt(e[3*s+s]-e[3*n+n]-e[3*o+o]+1),t[s]=.5*r,r=.5/r,t[3]=(e[3*n+o]-e[3*o+n])*r,t[n]=(e[3*n+s]+e[3*s+n])*r,t[o]=(e[3*o+s]+e[3*s+o])*r}return t}var Zt,Xt,Jt,te,ee,re,ie=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},se=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},ne=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},oe=function(t,e,r,i){var s=e[0],n=e[1],o=e[2],a=e[3];return t[0]=s+i*(r[0]-s),t[1]=n+i*(r[1]-n),t[2]=o+i*(r[2]-o),t[3]=a+i*(r[3]-a),t},ae=D,he=V,ce=function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=r*r+i*i+s*s+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=i*o,t[2]=s*o,t[3]=n*o,t},ue=(Zt=R(),Xt=L(1,0,0),Jt=L(0,1,0),function(t,e,r){var i=k(e,r);return i<-.999999?(N(Zt,Xt,e),q(Zt)<1e-6&&N(Zt,Jt,e),function(t,e){var r=e[0],i=e[1],s=e[2],n=r*r+i*i+s*s;n>0&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n}(Zt,Zt),Qt(t,Zt,Math.PI),t):i>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(N(Zt,e,r),t[0]=Zt[0],t[1]=Zt[1],t[2]=Zt[2],t[3]=1+i,ce(t,t))});te=$t(),ee=$t(),re=function(){var t=new E(9);return E!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}();const le=[0,0,0,1];class de extends v{constructor(t=0,e=0,r=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,r,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,r,i){return this[0]=t,this[1]=e,this[2]=r,this[3]=i,this.check()}fromMatrix3(t){return Kt(this,t),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}fromAxisRotation(t,e){return Qt(this,t,e),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=m(t)}get y(){return this[1]}set y(t){this[1]=m(t)}get z(){return this[2]}set z(t){this[2]=m(t)}get w(){return this[3]}set w(t){this[3]=m(t)}len(){return ae(this)}lengthSquared(){return he(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return ne(this,t)}rotationTo(t,e){return ue(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return ie(this,this,t),this.check()}calculateW(){return function(t,e){var r=e[0],i=e[1],s=e[2];t[0]=r,t[1]=i,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-i*i-s*s))}(this,this),this.check()}conjugate(){return function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],i=e[1],s=e[2],n=e[3],o=r*r+i*i+s*s+n*n,a=o?1/o:0;t[0]=-r*a,t[1]=-i*a,t[2]=-s*a,t[3]=n*a}(this,this),this.check()}lerp(t,e,r){return oe(this,t,e,r),this.check()}multiplyRight(t,e){return s(!e),Yt(this,this,t),this.check()}multiplyLeft(t,e){return s(!e),Yt(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,r){r*=.5;var i=e[0],s=e[1],n=e[2],o=e[3],a=Math.sin(r),h=Math.cos(r);t[0]=i*h+o*a,t[1]=s*h+n*a,t[2]=n*h-s*a,t[3]=o*h-i*a}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var i=e[0],s=e[1],n=e[2],o=e[3],a=Math.sin(r),h=Math.cos(r);t[0]=i*h-n*a,t[1]=s*h+o*a,t[2]=n*h+i*a,t[3]=o*h-s*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var i=e[0],s=e[1],n=e[2],o=e[3],a=Math.sin(r),h=Math.cos(r);t[0]=i*h+s*a,t[1]=s*h-i*a,t[2]=n*h+o*a,t[3]=o*h-n*a}(this,this,t),this.check()}scale(t){return se(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=le,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return Ht(this,t,e,r),this.check()}transformVector4(t,e=t){return function(t,e,r){var i=e[0],s=e[1],n=e[2],o=r[0],a=r[1],h=r[2],c=r[3],u=c*i+a*n-h*s,l=c*s+h*i-o*n,d=c*n+o*s-a*i,f=-o*i-a*s-h*n;t[0]=u*c+f*-o+l*-h-d*-a,t[1]=l*c+f*-a+d*-o-u*-h,t[2]=d*c+f*-h+u*-a-l*-o,t[3]=e[3]}(e,t,this),g(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t,e){return this.multiplyLeft(t,e)}multiply(t,e){return this.multiplyRight(t,e)}}const fe=new Q,pe=new Q,me=new Q,ge=new Q,ye=new Q,we=new Q,ve=new Q,_e=0,Te=1,be=2,Ee=3,Me=4,Se=5,xe=6,Ce=7,Ae=8;class Re{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=(new Q).from(t),this.halfAxes=new Gt(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Q(t).len(),new Q(e).len(),new Q(r).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),i=new Q(t).normalize(),s=new Q(e).normalize(),n=new Q(r).normalize();return(new de).fromMatrix3(new Gt([...i,...s,...n]))}fromCenterHalfSizeQuaternion(t,e,r){const i=new de(r),s=(new Gt).fromQuaternion(i);return s[0]=s[0]*e[0],s[1]=s[1]*e[0],s[2]=s[2]*e[0],s[3]=s[3]*e[1],s[4]=s[4]*e[1],s[5]=s[5]*e[1],s[6]=s[6]*e[2],s[7]=s[7]*e[2],s[8]=s[8]*e[2],this.center=(new Q).from(t),this.halfAxes=s,this}clone(){return new Re(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Vt){const e=this.halfAxes,r=e.getColumn(0,me),i=e.getColumn(1,ge),s=e.getColumn(2,ye),n=fe.copy(r).add(i).add(s);return t.center.copy(this.center),t.radius=n.magnitude(),t}intersectPlane(t){const e=this.center,r=t.normal,i=this.halfAxes,s=r.x,n=r.y,o=r.z,a=Math.abs(s*i[_e]+n*i[Te]+o*i[be])+Math.abs(s*i[Ee]+n*i[Me]+o*i[Se])+Math.abs(s*i[xe]+n*i[Ce]+o*i[Ae]),h=r.dot(e)+t.distance;return h<=-a?It.OUTSIDE:h>=a?It.INSIDE:It.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=pe.from(t).subtract(this.center),r=this.halfAxes,i=r.getColumn(0,me),s=r.getColumn(1,ge),n=r.getColumn(2,ye),o=i.magnitude(),a=s.magnitude(),h=n.magnitude();i.normalize(),s.normalize(),n.normalize();let c,u=0;return c=Math.abs(e.dot(i))-o,c>0&&(u+=c*c),c=Math.abs(e.dot(s))-a,c>0&&(u+=c*c),c=Math.abs(e.dot(n))-h,c>0&&(u+=c*c),u}computePlaneDistances(t,e,r=[-0,-0]){let i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const n=this.center,o=this.halfAxes,a=o.getColumn(0,me),h=o.getColumn(1,ge),c=o.getColumn(2,ye),u=we.copy(a).add(h).add(c).add(n),l=ve.copy(u).subtract(t);let d=e.dot(l);return i=Math.min(d,i),s=Math.max(d,s),u.copy(n).add(a).add(h).subtract(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),u.copy(n).add(a).subtract(h).add(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),u.copy(n).add(a).subtract(h).subtract(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),n.copy(u).subtract(a).add(h).add(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),n.copy(u).subtract(a).add(h).subtract(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),n.copy(u).subtract(a).subtract(h).add(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),n.copy(u).subtract(a).subtract(h).subtract(c),l.copy(u).subtract(t),d=e.dot(l),i=Math.min(d,i),s=Math.max(d,s),r[0]=i,r[1]=s,r}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,me);e.transformAsPoint(t);const r=this.halfAxes.getColumn(1,ge);r.transformAsPoint(t);const i=this.halfAxes.getColumn(2,ye);return i.transformAsPoint(t),this.halfAxes=new Gt([...e,...r,...i]),this}getTransform(){throw new Error("not implemented")}}const Oe=new Q,Le=new Q;class ke{constructor(t=[0,0,1],e=0){this.normal=new Q,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return s(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Oe.from(t),this.normal.from(e).normalize();const r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,e,r,i){return this.normal.set(t,e,r),s(p(this.normal.len(),1)),this.distance=i,this}clone(t){return new ke(this.normal,this.distance)}equals(t){return p(this.distance,t.distance)&&p(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=Le.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,e)}projectPointOntoPlane(t,e=[0,0,0]){t=Oe.from(t);const r=this.getPointDistance(t),i=Le.copy(this.normal).scale(r);return t.subtract(i).to(e)}}const Ne=[new Q([1,0,0]),new Q([0,1,0]),new Q([0,0,1])],Pe=new Q,Ie=new Q;new ke(new Q(1,0,0),0);class qe{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(t=[]){this.planes=t,s(this.planes.every(t=>t instanceof ke))}fromBoundingSphere(t){this.planes.length=2*Ne.length;const e=t.center,r=t.radius;let i=0;for(const t of Ne){let s=this.planes[i],n=this.planes[i+1];s||(s=this.planes[i]=new ke),n||(n=this.planes[i+1]=new ke);const o=Pe.copy(t).scale(-r).add(e);t.dot(o);s.fromPointNormal(o,t);const a=Pe.copy(t).scale(r).add(e),h=Ie.copy(t).negate();h.dot(a);n.fromPointNormal(a,h),i+=2}return this}computeVisibility(t){s(t);let e=It.INSIDE;for(const r of this.planes){switch(t.intersectPlane(r)){case It.OUTSIDE:return It.OUTSIDE;case It.INTERSECTING:e=It.INTERSECTING}}return e}computeVisibilityWithPlaneMask(t,e){if(s(t,"boundingVolume is required."),s(Number.isFinite(e),"parentPlaneMask is required."),e===qe.MASK_OUTSIDE||e===qe.MASK_INSIDE)return e;let r=qe.MASK_INSIDE;const i=this.planes;for(let s=0;s<this.planes.length;++s){const n=s<31?1<<s:0;if(s<31&&0==(e&n))continue;const o=i[s],a=t.intersectPlane(o);if(a===It.OUTSIDE)return qe.MASK_OUTSIDE;a===It.INTERSECTING&&(r|=n)}return r}}new Q,new Q,new Q,new Q,new Q;new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q,Math.PI;new Gt,new Gt,new Gt,new Gt,new Gt;new Q,new Q,new Q,new Q,new Q,new Gt,new Gt,new Gt;const De=new Q,Ve=new Q,je=new qe([new ke,new ke,new ke,new ke,new ke,new ke]);function ze(t,e){const{cameraDirection:r,cameraUp:i,height:s}=t,{metersPerUnit:n}=t.distanceScales,o=[t.longitude,t.latitude,0],a=vt.WGS84.cartographicToCartesian(o,new Q),h=vt.WGS84.eastNorthUpToFixedFrame(a),c=t.unprojectPosition(t.cameraPosition),u=vt.WGS84.cartographicToCartesian(c,new Q),l=new Q(h.transformAsVector(new Q(r).scale(n))).normalize(),d=new Q(h.transformAsVector(new Q(i).scale(n))).normalize();return function(t,e){const r=t.getFrustumPlanes();let i=0;for(const s in r){const n=r[s],o=n.normal.dot(t.center);Ve.copy(n.normal).scale(n.distance-o).add(t.center);const a=t.unprojectPosition(Ve),h=vt.WGS84.cartographicToCartesian(a,new Q);je.planes[i++].fromPointNormal(h,De.copy(e).subtract(h))}}(t,a),{camera:{position:u,direction:l,up:d},viewport:t,height:s,cullingVolume:je,frameNumber:e,sseDenominator:1.15}}const Ue=new Q;function Fe(t){const{halfAxes:e,radius:r,width:i,height:s}=t;if(e){const t=function(t){t.getColumn(0,Ue);const e=t.getColumn(1),r=t.getColumn(2),i=Ue.add(e).add(r);return i.len()}(e);return Math.log2(6356752.314245179/t)}if(r)return Math.log2(6356752.314245179/r);if(s&&i){return(Math.log2(6378137/i)+Math.log2(6378137/s))/2}return 1}const Be=t=>"boolean"==typeof t,We=t=>"function"==typeof t,Ge=t=>null!==t&&"object"==typeof t,$e=t=>Ge(t)&&t.constructor==={}.constructor,Qe=t=>t&&"function"==typeof t[Symbol.iterator],Ye=t=>t&&"function"==typeof t[Symbol.asyncIterator],He=t=>"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,Ke=t=>"undefined"!=typeof Blob&&t instanceof Blob,Ze=t=>(t=>"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||Ge(t)&&We(t.tee)&&We(t.cancel)&&We(t.getReader))(t)||(t=>Ge(t)&&We(t.read)&&We(t.pipe)&&Be(t.readable))(t);function Xe(t){var e;if(!t)return!1;Array.isArray(t)&&(t=t[0]);return Array.isArray(null===(e=t)||void 0===e?void 0:e.extensions)}function Je(t){var e,r;let i;return Et(t,"null loader"),Et(Xe(t),"invalid loader"),Array.isArray(t)&&(i=t[1],t=t[0],t={...t,options:{...t.options,...i}}),(null!==(e=t)&&void 0!==e&&e.parseTextSync||null!==(r=t)&&void 0!==r&&r.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var tr=r(1);let er="";const rr={};const ir=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,sr=/^([-\w.]+\/[-\w.+]+)/;function nr(t){const e=sr.exec(t);return e?e[1]:t}function or(t){const e=ir.exec(t);return e?e[1]:""}const ar=/\?.*/;function hr(t){if(He(t)){const e=cr(t.url||"");return{url:e,type:nr(t.headers.get("content-type")||"")||or(e)}}return Ke(t)?{url:cr(t.name||""),type:t.type||""}:"string"==typeof t?{url:cr(t),type:or(t)}:{url:"",type:""}}function cr(t){return t.replace(ar,"")}async function ur(t){if(He(t))return t;const e={},r=function(t){return He(t)?t.headers["content-length"]||-1:Ke(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);r>=0&&(e["content-length"]=String(r));const{url:i,type:s}=hr(t);s&&(e["content-type"]=s);const n=await async function(t){if("string"==typeof t)return"data:,"+t.slice(0,5);if(t instanceof Blob){const e=t.slice(0,5);return await new Promise(t=>{const r=new FileReader;r.onload=e=>{var r;return t(null==e||null===(r=e.target)||void 0===r?void 0:r.result)},r.readAsDataURL(e)})}if(t instanceof ArrayBuffer){const e=t.slice(0,5);return"data:base64,"+function(t){let e="";const r=new Uint8Array(t);for(let t=0;t<r.byteLength;t++)e+=String.fromCharCode(r[t]);return btoa(e)}(e)}return null}(t);n&&(e["x-first-bytes"]=n),"string"==typeof t&&(t=(new TextEncoder).encode(t));const o=new Response(t,{headers:e});return Object.defineProperty(o,"url",{value:i}),o}async function lr(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const r=t.headers.get("Content-Type");let i=t.statusText;r.includes("application/json")&&(i+=" "+await t.text()),e+=i,e=e.length>60?e.slice(60)+"...":e}catch(t){}return e}(t);throw new Error(e)}}async function dr(t,e){if("string"==typeof t){t=function(t){for(const e in rr)if(t.startsWith(e)){const r=rr[e];t=t.replace(e,r)}return t.startsWith("http://")||t.startsWith("https://")||(t=`${er}${t}`),t}(t);let r=e;return null!=e&&e.fetch&&"function"!=typeof(null==e?void 0:e.fetch)&&(r=e.fetch),await fetch(t,r)}return await ur(t)}var fr=r(13);const pr=Object(fr.a)();class mr{constructor(t,e,r="sessionStorage"){this.storage=function(t){try{const e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch(t){return null}}(r),this.id=t,this.config={},Object.assign(this.config,e),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){return this.config={},this.updateConfiguration(t)}updateConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function gr(t,e,r,i=600){const s=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>i&&(r=Math.min(r,i/t.width));const n=t.width*r,o=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(n/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(n,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}const yr={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function wr(t){return"string"==typeof t?yr[t.toUpperCase()]||yr.WHITE:t}function vr(t,e){if(!t)throw new Error(e||"Assertion failed")}var _r=r(2);function Tr(){let t;if(pr&&_r.b.performance)t=_r.b.performance.now();else if(_r.a.hrtime){const e=_r.a.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}const br={debug:pr&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Er={enabled:!0,level:0};function Mr(){}const Sr={},xr={once:!0};function Cr(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}class Ar{constructor({id:t}={id:""}){this.id=t,this.VERSION="3.1.0-alpha.2",this._startTs=Tr(),this._deltaTs=Tr(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new mr("__probe-".concat(this.id,"__"),Er),this.userData={},this.timeStamp("".concat(this.id," started")),function(t,e=["constructor"]){const r=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(r);for(const r of i)"function"==typeof t[r]&&(e.find(t=>r===t)||(t[r]=t[r].bind(t)))}(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Tr()-this._startTs).toPrecision(10))}getDelta(){return Number((Tr()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.updateConfiguration({enabled:t}),this}setLevel(t){return this._storage.updateConfiguration({level:t}),this}assert(t,e){vr(t,e)}warn(t){return this._getLogFunction(0,t,br.warn,arguments,xr)}error(t){return this._getLogFunction(0,t,br.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,br.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,br.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,br.debug||br.info,arguments,xr)}table(t,e,r){return e?this._getLogFunction(t,e,console.table||Mr,r&&[r],{tag:Cr(e)}):Mr}image({logLevel:t,priority:e,image:i,message:s="",scale:n=1}){return this._shouldLog(t||e)?pr?function({image:t,message:e="",scale:r=1}){if("string"==typeof t){const i=new Image;return i.onload=()=>{const t=gr(i,e,r);console.log(...t)},i.src=t,Mr}const i=t.nodeName||"";if("img"===i.toLowerCase())return console.log(...gr(t,e,r)),Mr;if("canvas"===i.toLowerCase()){const i=new Image;return i.onload=()=>console.log(...gr(i,e,r)),i.src=t.toDataURL(),Mr}return Mr}({image:i,message:s,scale:n}):function({image:t,message:e="",scale:i=1}){let s=null;try{s=r(22)}catch(t){}if(s)return()=>s(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then(t=>console.log(t));return Mr}({image:i,message:s,scale:n}):Mr}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(t){return this._storage.config[t]}set(t,e){this._storage.updateConfiguration({[t]:e})}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||Mr)}group(t,e,r={collapsed:!1}){r=Or({logLevel:t,message:e,opts:r});const{collapsed:i}=r;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e,r={}){return this.group(t,e,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Mr)}withGroup(t,e,r){this.group(t,e)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Rr(t)}_getLogFunction(t,e,r,i=[],s){if(this._shouldLog(t)){s=Or({logLevel:t,message:e,args:i,opts:s}),vr(r=r||s.method),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=Tr();const n=s.tag||s.message;if(s.once){if(Sr[n])return Mr;Sr[n]=Tr()}return e=function(t,e,r){if("string"==typeof e){const o=r.time?function(t,e=8){const r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).concat(t)}(function(t){let e;return e=t<10?"".concat(t.toFixed(2),"ms"):t<100?"".concat(t.toFixed(1),"ms"):t<1e3?"".concat(t.toFixed(0),"ms"):"".concat((t/1e3).toFixed(2),"s"),e}(r.total)):"";e=r.time?"".concat(t,": ").concat(o," ").concat(e):"".concat(t,": ").concat(e),i=e,s=r.color,n=r.background,pr||"string"!=typeof i||(s&&(s=wr(s),i="[".concat(s,"m").concat(i,"[39m")),n&&(s=wr(n),i="[".concat(n+10,"m").concat(i,"[49m"))),e=i}var i,s,n;return e}(this.id,s.message,s),r.bind(console,e,...s.args)}return Mr}}function Rr(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return vr(Number.isFinite(e)&&e>=0),e}function Or(t){const{logLevel:e,message:r}=t;t.logLevel=Rr(e);const i=t.args?Array.from(t.args):[];for(;i.length&&i.shift()!==r;);switch(t.args=i,typeof e){case"string":case"function":void 0!==r&&i.unshift(r),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const s=typeof t.message;return vr("string"===s||"object"===s),Object.assign(t,t.opts)}Ar.VERSION="3.1.0-alpha.2";const Lr=new Ar({id:"loaders.gl"});class kr{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const Nr={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){var t,e,r;r=void 0,(e="console")in(t=this)?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},Pr={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function Ir(){tr.a.loaders=tr.a.loaders||{};const{loaders:t}=tr.a;return t._state=t._state||{},t._state}const qr=()=>{const t=Ir();return t.globalOptions=t.globalOptions||{...Nr},t.globalOptions};function Dr(t,e,r,i){return r=r||[],function(t,e){jr(t,null,Nr,Pr,e);for(const r of e){const i=t&&t[r.id]||{},s=r.options&&r.options[r.id]||{},n=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};jr(i,r.id,s,n,e)}}(t,r=Array.isArray(r)?r:[r]),Ur(e,t,i)}function Vr(t,e){const r=qr(),i=t||r;return"function"==typeof i.fetch?i.fetch:Ge(i.fetch)?t=>dr(t,i):null!=e&&e.fetch?null==e?void 0:e.fetch:dr}function jr(t,e,r,i,s){const n=e||"Top level",o=e?e+".":"";for(const a in t){const h=!e&&Ge(t[a]),c="baseUri"===a&&!e,u="workerUrl"===a&&e;if(!(a in r)&&!c&&!u)if(a in i)Lr.warn(`${n} loader option '${o}${a}' no longer supported, use '${i[a]}'`)();else if(!h){const t=zr(a,s);Lr.warn(`${n} loader option '${o}${a}' not recognized. ${t}`)()}}}function zr(t,e){const r=t.toLowerCase();let i="";for(const s of e)for(const e in s.options){if(t===e)return`Did you mean '${s.id}.${e}'?`;const n=e.toLowerCase();(r.startsWith(n)||n.startsWith(r))&&(i=i||`Did you mean '${s.id}.${e}'?`)}return i}function Ur(t,e,r){const i={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(i,r),null===i.log&&(i.log=new kr),Fr(i,qr()),Fr(i,e),i}function Fr(t,e){for(const r in e)if(r in e){const i=e[r];$e(i)&&$e(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function Br(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var Wr=r(15);const Gr=new Map;function $r(t){Br(t.source&&!t.url||!t.source&&t.url);let e=Gr.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return Qr((e=t,`try {\n importScripts('${e}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var e}(t.url),Gr.set(t.url,e)),t.source&&(e=Qr(t.source),Gr.set(t.source,e))),Br(e),e}function Qr(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function Yr(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}function Hr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Kr=()=>{};class Zr{static isSupported(){return"undefined"!=typeof Worker}constructor(t){Hr(this,"name",void 0),Hr(this,"source",void 0),Hr(this,"url",void 0),Hr(this,"terminated",!1),Hr(this,"worker",void 0),Hr(this,"onMessage",void 0),Hr(this,"onError",void 0),Hr(this,"_loadableURL","");const{name:e,source:r,url:i}=t;Br(r||i),this.name=e,this.source=r,this.url=i,this.onMessage=Kr,this.onError=t=>console.log(t),this.worker=this._createBrowserWorker()}destroy(){this.onMessage=Kr,this.onError=Kr,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||function t(e,r=!0,i){const s=i||new Set;if(e){if(Yr(e))s.add(e);else if(Yr(e.buffer))s.add(e.buffer);else if(ArrayBuffer.isView(e));else if(r&&"object"==typeof e)for(const i in e)t(e[i],r,s)}else;return void 0===i?Array.from(s):[]}(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=t.message+" in "),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=$r({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}}function Xr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class Jr{constructor(t,e){Xr(this,"name",void 0),Xr(this,"workerThread",void 0),Xr(this,"isRunning",void 0),Xr(this,"result",void 0),Xr(this,"_resolve",void 0),Xr(this,"_reject",void 0),this.name=t,this.workerThread=e,this.isRunning=!0,this._resolve=()=>{},this._reject=()=>{},this.result=new Promise((t,e)=>{this._resolve=t,this._reject=e})}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){Br(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Br(this.isRunning),this.isRunning=!1,this._reject(t)}}function ti(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class ei{constructor(t){ti(this,"name","unnamed"),ti(this,"source",void 0),ti(this,"url",void 0),ti(this,"maxConcurrency",1),ti(this,"maxMobileConcurrency",1),ti(this,"onDebug",()=>{}),ti(this,"reuseWorkers",!0),ti(this,"props",{}),ti(this,"jobQueue",[]),ti(this,"idleQueue",[]),ti(this,"count",0),ti(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t,e=((t,e,r)=>t.done(r)),r=((t,e)=>t.error(e))){const i=new Promise(i=>(this.jobQueue.push({name:t,onMessage:e,onError:r,onStart:i}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const r=new Jr(e.name,t);t.onMessage=t=>e.onMessage(r,t.type,t.payload),t.onError=t=>e.onError(r,t),e.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Zr({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Wr.a?this.maxMobileConcurrency:this.maxConcurrency}}function ri(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const ii={maxConcurrency:3,maxMobileConcurrency:1,onDebug:()=>{},reuseWorkers:!0};class si{static isSupported(){return Zr.isSupported()}static getWorkerFarm(t={}){return si._workerFarm=si._workerFarm||new si({}),si._workerFarm.setProps(t),si._workerFarm}constructor(t){ri(this,"props",void 0),ri(this,"workerPools",new Map),this.props={...ii},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy()}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:r,url:i}=t;let s=this.workerPools.get(e);return s||(s=new ei({name:e,source:r,url:i}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}ri(si,"_workerFarm",void 0);async function ni(t,e,r,i,s){const n=t.id,o=function(t,e={}){const r=e[t.id]||{},i=t.id+"-worker.js";let s=r.workerUrl;if("test"===e._workerType&&(s=`modules/${t.module}/dist/${i}`),!s){let e=t.version;"latest"===e&&(e="beta");const r=e?"@"+e:"";s=`https://unpkg.com/@loaders.gl/${t.module}${r}/dist/${i}`}return Br(s),s}(t,r),a=si.getWorkerFarm(r).getWorkerPool({name:n,url:o});r=JSON.parse(JSON.stringify(r));const h=await a.startJob("process-on-worker",oi.bind(null,s));h.postMessage("process",{input:e,options:r});const c=await h.result;return await c.result}async function oi(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(i.error);break;case"process":const{id:s,input:n,options:o}=i;try{const r=await t(n,o);e.postMessage("done",{id:s,result:r})}catch(t){const r=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:s,error:r})}break;default:console.warn("parse-with-worker unknown message "+r)}}r(9);function ai(t){return t&&"object"==typeof t&&t.isBuffer}function hi(t){if(ai(t))return function(t){if(ai(t)){return new Uint8Array(t.buffer,t.byteOffset,t.length).slice().buffer}return t}(t);if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if("string"==typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"==typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}async function ci(t){const e=[];for await(const r of t)e.push(r);return function(...t){const e=t.map(t=>t instanceof ArrayBuffer?new Uint8Array(t):t),r=e.reduce((t,e)=>t+e.byteLength,0),i=new Uint8Array(r);let s=0;for(const t of e)i.set(t,s),s+=t.byteLength;return i.buffer}(...e)}const ui=262144;function li(t,e){return tr.b?async function*(t,e){const r=t.getReader();let i;try{for(;;){const t=i||r.read();null!=e&&e._streamReadAhead&&(i=r.read());const{done:s,value:n}=await t;if(s)return;yield hi(n)}}catch(t){r.releaseLock()}}(t,e):async function*(t,e){for await(const e of t)yield hi(e)}(t)}function di(t,e){if("string"==typeof t)return function*(t,e){const r=(null==e?void 0:e.chunkSize)||262144;let i=0;const s=new TextEncoder;for(;i<t.length;){const e=Math.min(t.length-i,r),n=t.slice(i,i+e);i+=e,yield s.encode(n)}}(t,e);if(t instanceof ArrayBuffer)return function*(t,e={}){const{chunkSize:r=ui}=e;let i=0;for(;i<t.byteLength;){const e=Math.min(t.byteLength-i,r),s=new ArrayBuffer(e),n=new Uint8Array(t,i,e);new Uint8Array(s).set(n),i+=e,yield s}}(t,e);if(Ke(t))return async function*(t,e){const r=(null==e?void 0:e.chunkSize)||1048576;let i=0;for(;i<t.size;){const e=i+r,s=await t.slice(i,e).arrayBuffer();i=e,yield s}}(t,e);if(Ze(t))return li(t,e);if(He(t)){return li(t.body,e)}throw new Error("makeIterator")}const fi="Cannot convert supplied data type";async function pi(t,e,r){const i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if("string"==typeof t||i)return function(t,e,r){if(e.text&&"string"==typeof t)return t;var i;if((i=t)&&"object"==typeof i&&i.isBuffer&&(t=t.buffer),t instanceof ArrayBuffer){const r=t;if(e.text&&!e.binary){return new TextDecoder("utf8").decode(r)}return r}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary){return new TextDecoder("utf8").decode(t)}let r=t.buffer;const i=t.byteLength||t.length;return 0===t.byteOffset&&i===r.byteLength||(r=r.slice(t.byteOffset,t.byteOffset+i)),r}throw new Error(fi)}(t,e);if(Ke(t)&&(t=await ur(t)),He(t)){const r=t;return await lr(r),e.binary?await r.arrayBuffer():await r.text()}if(Ze(t)&&(t=di(t,r)),Qe(t)||Ye(t))return ci(t);throw new Error(fi)}const mi=()=>{const t=Ir();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};const gi=/\.([^.]+)$/;function yi(t,e=[],r,i){if(!wi(t))return null;if(e&&!Array.isArray(e))return Je(e);let s=[];e&&(s=s.concat(e)),null!=r&&r.ignoreRegisteredLoaders||s.push(...mi()),function(t){for(const e of t)Je(e)}(s);const n=function(t,e,r,i){const{url:s,type:n}=hr(t),o=s||(null==i?void 0:i.url);let a=null;null!=r&&r.mimeType&&(a=_i(e,null==r?void 0:r.mimeType));return a=a||function(t,e){const r=e&&gi.exec(e),i=r&&r[1];return i?function(t,e){e=e.toLowerCase();for(const r of t)for(const t of r.extensions)if(t.toLowerCase()===e)return r;return null}(t,i):null}(e,o),a=a||_i(e,n),a=a||function(t,e){if(!e)return null;for(const r of t)if("string"==typeof e){if(Ti(e,r))return r}else if(ArrayBuffer.isView(e)){if(bi(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer){if(bi(e,0,r))return r}return null}(e,t),a=a||_i(e,null==r?void 0:r.fallbackMimeType),a}(t,s,r,i);if(!(n||null!=r&&r.nothrow))throw new Error(vi(t));return n}function wi(t){return!(t instanceof Response&&204===t.status)}function vi(t){const{url:e,type:r}=hr(t);let i="No valid loader found";return t&&(i+=` data: "${function(t,e=5){if("string"==typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return Ei(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return Ei(t,0,e)}return""}(t)}", contentType: "${r}"`),e&&(i+=" url: "+e),i}function _i(t,e){for(const r of t){if(r.mimeTypes&&r.mimeTypes.includes(e))return r;if(e==="application/x."+r.id)return r}return null}function Ti(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some(e=>t.startsWith(e))}function bi(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(i=>function(t,e,r,i){if(i instanceof ArrayBuffer)return function(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;const i=new Uint8Array(t),s=new Uint8Array(e);for(let t=0;t<i.length;++t)if(i[t]!==s[t])return!1;return!0}(i,t,i.byteLength);switch(typeof i){case"function":return i(t,r);case"string":const s=Ei(t,e,i.length);return i===s;default:return!1}}(t,e,r,i))}function Ei(t,e,r){if(t.byteLength<e+r)return"";const i=new DataView(t);let s="";for(let t=0;t<r;t++)s+=String.fromCharCode(i.getUint8(e+t));return s}async function Mi(t,e,r,i){Br(!i||"object"==typeof i),!e||Array.isArray(e)||Xe(e)||(i=void 0,r=e,e=void 0),t=await t,r=r||{};const{url:s}=hr(t),n=function(t,e){if(!e&&t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...t]:t}return r&&r.length?r:null}(e,i),o=await async function(t,e=[],r,i){if(!wi(t))return null;let s=yi(t,e,{...r,nothrow:!0},i);if(s)return s;if(Ke(t)&&(s=yi(t=await t.slice(0,10).arrayBuffer(),e,r,i)),!(s||null!=r&&r.nothrow))throw new Error(vi(t));return s}(t,n,r);return o?(i=function(t,e,r=null){if(r)return r;const i={fetch:Vr(e,t),...t};return Array.isArray(i.loaders)||(i.loaders=null),i}({url:s,parse:Mi,loaders:n},r=Dr(r,o,n,s),i),await async function(t,e,r,i){if(function(t,e="3.1.0-alpha.2"){Br(t,"no worker provided");const r=t.version}(t),e=await pi(e,t,r),t.parseTextSync&&"string"==typeof e)return r.dataType="text",t.parseTextSync(e,r,i,t);if(function(t,e){return!!si.isSupported()&&(t.worker&&(null==e?void 0:e.worker))}(t,r))return await ni(t,e,r,0,Mi);if(t.parseText&&"string"==typeof e)return await t.parseText(e,r,i,t);if(t.parse)return await t.parse(e,r,i,t);throw Br(!t.parseSync),new Error(t.id+" loader - no parser found and worker is disabled")}(o,t,r,i)):null}async function Si(t,e,r,i){Array.isArray(e)||Xe(e)||(void 0,r=e,e=void 0);const s=Vr(r);let n=t;return"string"==typeof t&&(n=await s(t)),Ke(t)&&(n=await s(t)),await Mi(n,e,r)}const xi={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Ci={ADD:1,REPLACE:2},Ai={EMPTY:"empty",SCENEGRAPH:"scenegraph",POINTCLOUD:"pointcloud",MESH:"mesh"},Ri={I3S:"I3S",TILES3D:"TILES3D"},Oi={GEOMETRIC_ERROR:"geometricError",MAX_SCREEN_THRESHOLD:"maxScreenThreshold"},Li=1;function ki(t){return null!=t}const Ni=new Q,Pi=new Q,Ii=new Q;function qi(t,e,r){if(Et(t,"3D Tile: boundingVolume must be defined"),t.box)return function(t,e,r){const i=new Q(t[0],t[1],t[2]);e.transform(i,i);let s=[];if(10===t.length){const e=t.slice(3,6),r=new de;r.fromArray(t,6);const i=new Q([1,0,0]),n=new Q([0,1,0]),o=new Q([0,0,1]);i.transformByQuaternion(r),i.scale(e[0]),n.transformByQuaternion(r),n.scale(e[1]),o.transformByQuaternion(r),o.scale(e[2]),s=[...i.toArray(),...n.toArray(),...o.toArray()]}else s=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];const n=e.transformAsVector(s.slice(0,3)),o=e.transformAsVector(s.slice(3,6)),a=e.transformAsVector(s.slice(6,9)),h=new Gt([n[0],n[1],n[2],o[0],o[1],o[2],a[0],a[1],a[2]]);if(ki(r))return r.center=i,r.halfAxes=h,r;return new Re(i,h)}(t.box,e,r);if(t.region){const[e,r,i,s,n,o]=t.region,a=vt.WGS84.cartographicToCartesian([f(e),f(s),n],Pi),h=vt.WGS84.cartographicToCartesian([f(i),f(r),o],Ii),c=(new Q).addVectors(a,h).multiplyScalar(.5),u=(new Q).subVectors(a,h).len()/2;return Di([c[0],c[1],c[2],u],new B)}if(t.sphere)return Di(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Di(t,e,r){const i=new Q(t[0],t[1],t[2]);e.transform(i,i);const s=e.getScale(Ni),n=Math.max(Math.max(s[0],s[1]),s[2]),o=t[3]*n;return ki(r)?(r.center=i,r.radius=o,r):new Vt(i,o)}new Q,new Q,new B,new Q,new Q,new Q;function Vi(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){const r=t.dynamicScreenSpaceErrorComputedDensity,i=t.dynamicScreenSpaceErrorFactor;return function(t,e){const r=t*e;return 1-Math.exp(-r*r)}(e,r)*i}return 0}const ji=Math.PI/2;function zi([t,e,r]){const i=l(t),s=l(e),n=1+r/6378137,o=n*Math.cos(s);return[t=o*Math.cos(i),e=o*Math.sin(i),r=n*Math.sin(s)]}function Ui(t,e){const[r,i,s=0]=t,[n,o,a=0]=e,h=zi([n,o,a]),c=zi([r,i,s]),u=c[0]-h[0],l=c[1]-h[1],d=c[2]-h[2];return u*u+l*l+d*d}function Fi(t,e){const r=e.viewport,i=t.header.mbs[1],s=[t.header.mbs[0],i,t.header.mbs[2]],n=t.header.mbs[3]/6378137,o=Ui(r.unprojectPosition(r.cameraPosition),s)-n*n;if(o<=0)return 170141175e30;return function(t){const{projectionMatrix:e}=t.viewport;return e[5]}(e)*n/Math.sqrt(o)*300}class Bi{constructor(t=0){this._array=new Array(t),this._map=new Map,this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return Et(t<this._array.length),this._array[t]}set(t,e){Et(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=e,this._map.set(e,t)}delete(t){const e=this._map.get(t);e>=0&&(this._array.splice(e,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){const e=this.length++;this._array[e]=t,this._map.set(t,e)}}pop(){const t=this._array[--this.length];return this._map.delete(t),t}reserve(t){Et(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){Et(t>=0),this.length=t}trim(t){null==t&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}}function Wi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Gi={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class $i{constructor(t){Wi(this,"options",void 0),Wi(this,"root",void 0),Wi(this,"requestedTiles",void 0),Wi(this,"selectedTiles",void 0),Wi(this,"emptyTiles",void 0),Wi(this,"_traversalStack",void 0),Wi(this,"_emptyTraversalStack",void 0),Wi(this,"_frameNumber",void 0),this.options={...Gi,...t},this._traversalStack=new Bi,this._emptyTraversalStack=new Bi,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(t,e,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,e),this._frameNumber=e.frameNumber,this.executeTraversal(t,e)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,e){const r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){const t=r.pop();let i=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),i=this.updateAndPushChildren(t,e,r,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const s=t.parent,n=Boolean(!s||s._shouldRefine),o=!i;t.hasRenderContent?t.refine===Ci.ADD?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===Ci.REPLACE&&(this.loadTile(t,e),o&&this.selectTile(t,e)):(this.emptyTiles[t.id]=t,this.loadTile(t,e),o&&this.selectTile(t,e)),this.touchTile(t,e),t._shouldRefine=i&&n}this.options.onTraversalEnd(e)}updateChildTiles(t,e){const r=t.children;for(const t of r)this.updateTile(t,e);return!0}updateAndPushChildren(t,e,r,i){const{loadSiblings:s,skipLevelOfDetail:n}=this.options,o=t.children;o.sort(this.compareDistanceToCamera.bind(this));const a=t.refine===Ci.REPLACE&&t.hasRenderContent&&!n;let h=!1,c=!0;for(const t of o)if(t._selectionDepth=i,t.isVisibleAndInRequestVolume?(r.find(t)&&r.delete(t),r.push(t),h=!0):(a||s)&&(this.loadTile(t,e),this.touchTile(t,e)),a){let r;if(r=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),c=c&&r,!c)return!1}return h||(c=!1),c}updateTile(t,e){this.updateTileVisibility(t,e)}selectTile(t,e){this.shouldSelectTile(t)&&(t._selectedFrame=e.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,e){this.shouldLoadTile(t)&&(t._requestedFrame=e.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,e){t.tileset._cache.touch(t),t._touchedFrame=e.frameNumber}canTraverse(t,e,r=!1,i=!1){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:!(!i&&!t.isVisibleAndInRequestVolume)&&this.shouldRefine(t,e,r))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,r){let i=t._screenSpaceError;return r&&(i=t.getScreenSpaceError(e,!0)),i>this.options.maximumScreenSpaceError}updateTileVisibility(t,e){const r=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap){this.options.viewportTraversersMap[t]===e.viewport.id&&r.push(t)}else r.push(e.viewport.id);t.updateVisibility(e,r)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let r=!1;for(const i of t.children)i.updateVisibility(e),r=r||i.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,e){let r=!0;const i=this._emptyTraversalStack;for(i.push(t);i.length>0&&r;){const t=i.pop();this.updateTile(t,e),t.isVisibleAndInRequestVolume||this.loadTile(t,e),this.touchTile(t,e);if(!t.hasRenderContent&&this.canTraverse(t,e,!1,!0)){const e=t.children;for(const t of e)i.find(t)&&i.delete(t),i.push(t)}else t.contentAvailable||(r=!1)}return r}}function Qi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Yi=new Q;class Hi{constructor(t,e,r,i=""){Qi(this,"tileset",void 0),Qi(this,"header",void 0),Qi(this,"id",void 0),Qi(this,"url",void 0),Qi(this,"parent",void 0),Qi(this,"refine",void 0),Qi(this,"type",void 0),Qi(this,"contentUrl",void 0),Qi(this,"lodMetricType",void 0),Qi(this,"lodMetricValue",void 0),Qi(this,"boundingVolume",void 0),Qi(this,"content",void 0),Qi(this,"contentState",void 0),Qi(this,"gpuMemoryUsageInBytes",void 0),Qi(this,"children",void 0),Qi(this,"depth",void 0),Qi(this,"viewportIds",void 0),Qi(this,"transform",void 0),Qi(this,"userData",void 0),Qi(this,"computedTransform",void 0),Qi(this,"hasEmptyContent",void 0),Qi(this,"hasTilesetContent",void 0),Qi(this,"traverser",void 0),Qi(this,"_cacheNode",void 0),Qi(this,"_frameNumber",void 0),Qi(this,"_lodJudge",void 0),Qi(this,"_expireDate",void 0),Qi(this,"_expiredContent",void 0),Qi(this,"_shouldRefine",void 0),Qi(this,"_distanceToCamera",void 0),Qi(this,"_centerZDepth",void 0),Qi(this,"_screenSpaceError",void 0),Qi(this,"_visibilityPlaneMask",void 0),Qi(this,"_visible",void 0),Qi(this,"_inRequestVolume",void 0),Qi(this,"_stackLength",void 0),Qi(this,"_selectionDepth",void 0),Qi(this,"_touchedFrame",void 0),Qi(this,"_visitedFrame",void 0),Qi(this,"_selectedFrame",void 0),Qi(this,"_requestedFrame",void 0),Qi(this,"_priority",void 0),Qi(this,"_contentBoundingVolume",void 0),Qi(this,"_viewerRequestVolume",void 0),Qi(this,"_initialTransform",void 0),this.header=e,this.tileset=t,this.id=i||e.id,this.url=e.url,this.parent=r,this.refine=this._getRefine(e.refine),this.type=e.type,this.contentUrl=e.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=xi.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new $i({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new B,this.transform=new B,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===xi.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===xi.UNLOADED}get contentExpired(){return this.contentState===xi.EXPIRED}get contentFailed(){return this.contentState===xi.FAILED}getScreenSpaceError(t,e){switch(this.tileset.type){case Ri.I3S:return Fi(this,t);case Ri.TILES3D:return function(t,e,r){const i=t.tileset,s=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,n=r?s:t.lodMetricValue;if(0===n)return 0;const o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:h}=e,{viewDistanceScale:c}=i.options;let u=n*a*(c||1)/(o*h);return u-=Vi(i,o),u}(this,t,e);default:throw new Error("Unsupported tileset type")}}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,r=this.refine===Ci.ADD||e;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===xi.UNLOADED)return-1;const i=this.parent,s=i&&(!r||0===this._screenSpaceError||i.hasTilesetContent)?i._screenSpaceError:this._screenSpaceError,n=t.root?t.root._screenSpaceError:0;return Math.max(n-s,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=xi.LOADING;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=xi.UNLOADED,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,i={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await Si(e,r,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=xi.READY,this._onContentLoaded(),!0}catch(t){throw this.contentState=xi.FAILED,t}finally{t.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=xi.UNLOADED,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const r=this.parent,i=r?r._visibilityPlaneMask:qe.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,i),this._visible=this._visibilityPlaneMask!==qe.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:r}=t,{boundingVolume:i}=this;return r.computeVisibilityWithPlaneMask(i,e)}contentVisibility(){return!0}distanceToTile(t){const e=this.boundingVolume;return Math.sqrt(Math.max(e.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){const e=this.boundingVolume;return Yi.subVectors(e.center,t.position),t.direction.dot(Yi)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=xi.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new B(t.transform):new B;const e=this.parent,r=this.tileset,i=e&&e.computedTransform?e.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new B(i).multiplyRight(this.transform);const s=e&&e._initialTransform?e._initialTransform.clone():new B;this._initialTransform=new B(s).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=xi.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=qe.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||Ci.REPLACE}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}_updateBoundingVolume(t){this.boundingVolume=qi(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=qi(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=qi(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new B){const e=t.clone().multiplyRight(this.transform);!e.equals(this.computedTransform)&&(this.computedTransform=e,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return{...this.tileset.options.i3s,tile:this.header,tileset:this.tileset.tileset,isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(e=this.tileset.tileset).asset&&e.asset.gltfUpAxis||"Y"}}var e}}class Ki extends $i{compareDistanceToCamera(t,e){return 0===e._distanceToCamera&&0===t._distanceToCamera?e._centerZDepth-t._centerZDepth:e._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,e){if(super.updateTileVisibility(t,e),!t.isVisibleAndInRequestVolume)return;const r=t.children.length>0;if(t.hasTilesetContent&&r){const r=t.children[0];return this.updateTileVisibility(r,e),void(t._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const i=t.refine===Ci.REPLACE,s=t._optimChildrenWithinParent===Li;i&&s&&r&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:r}=t;return!(!r||r.hasTilesetContent||r.refine!==Ci.ADD)&&!this.shouldRefine(t,e,!0)}}const Zi="REQUESTED",Xi="COMPLETED",Ji="ERROR";class ts{constructor(){var t,e,r;r=void 0,(e="_statusMap")in(t=this)?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,this._statusMap={}}add(t,e,r,i){this._statusMap[e]||(this._statusMap[e]={request:t,callback:r,key:e,frameState:i,status:Zi},t().then(t=>{this._statusMap[e].status=Xi,this._statusMap[e].callback(t,i)}).catch(t=>{this._statusMap[e].status=Ji,r(t)}))}update(t,e){this._statusMap[t]&&(this._statusMap[t].frameState=e)}find(t){return this._statusMap[t]}}class es extends $i{constructor(t){var e,r,i;super(t),i=void 0,(r="_tileManager")in(e=this)?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,this._tileManager=new ts}shouldRefine(t,e){return t._lodJudge=function(t,e){const r=e.viewport,i=r.metersPerPixel,s=t.header.mbs[1],n=t.header.mbs[0],o=t.header.mbs[2],a=t.header.mbs[3],{height:h,width:c,latitude:u,longitude:l}=r,d=[l,u],f=[n,s,o],p=[l,s],m=[n,u],g=Math.sqrt(h*h+c*c)*i[0],y=.5*h+a/6378137,w=.5*c+a/6378137;if(Ui(d,f)>g+a/6378137)return"OUT";if(Ui(d,p)>y)return"OUT";if(Ui(d,m)>w)return"OUT";if(0===t.lodMetricValue)return"DIG";let v=Fi(t,e);return v*=ji,v<.5?"OUT":!t.header.children||v<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const r=t.header.children||[],i=t.children,s=t.tileset;for(const n of r){const r=`${n.id}-${e.viewport.id}`,o=i&&i.find(t=>t.id===r);if(o)o&&this.updateTile(o,e);else{let i=()=>this._loadTile(n.id,s);this._tileManager.find(r)?this._tileManager.update(r,e):(s.tileset.nodePages&&(i=()=>s.tileset.nodePagesTile.formTileFromNodePages(n.id)),this._tileManager.add(i,r,e=>this._onTileLoad(e,t,r),e))}}return!1}async _loadTile(t,e){const{loader:r}=e,i=e.getTileUrl(`${e.url}/nodes/${t}`),s={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0,loadContent:!1}};return await Si(i,r,s)}_onTileLoad(t,e,r){const i=new Hi(e.tileset,t,e,r);e.children.push(i);const s=this._tileManager.find(i.id).frameState;this.updateTile(i,s),this._frameNumber===s.frameNumber&&this.executeTraversal(i,s)}}function rs(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const is={description:"",ellipsoid:vt.WGS84,modelMatrix:new B,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}};class ss{constructor(t,e){rs(this,"options",void 0),rs(this,"loadOptions",void 0),rs(this,"type",void 0),rs(this,"tileset",void 0),rs(this,"loader",void 0),rs(this,"url",void 0),rs(this,"basePath",void 0),rs(this,"modelMatrix",void 0),rs(this,"ellipsoid",void 0),rs(this,"lodMetricType",void 0),rs(this,"lodMetricValue",void 0),rs(this,"refine",void 0),rs(this,"root",void 0),rs(this,"roots",void 0),rs(this,"asset",void 0),rs(this,"description",void 0),rs(this,"properties",void 0),rs(this,"extras",void 0),rs(this,"attributions",void 0),rs(this,"credits",void 0),rs(this,"stats",void 0),rs(this,"traverseCounter",void 0),rs(this,"geometricError",void 0),rs(this,"selectedTiles",void 0),rs(this,"cartographicCenter",void 0),rs(this,"cartesianCenter",void 0),rs(this,"zoom",void 0),rs(this,"boundingVolume",void 0),rs(this,"gpuMemoryUsageInBytes",void 0),rs(this,"dynamicScreenSpaceErrorComputedDensity",void 0),rs(this,"_traverser",void 0),rs(this,"_cache",void 0),rs(this,"_requestScheduler",void 0),rs(this,"_frameNumber",void 0),rs(this,"_queryParamsString",void 0),rs(this,"_queryParams",void 0),rs(this,"_extensionsUsed",void 0),rs(this,"_tiles",void 0),rs(this,"_pendingCount",void 0),rs(this,"lastUpdatedVieports",void 0),rs(this,"_requestedTiles",void 0),rs(this,"_emptyTiles",void 0),rs(this,"frameStateData",void 0),rs(this,"maximumMemoryUsage",void 0),Et(t),this.options={...is,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||i.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new Nt,this._requestScheduler=new At({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new bt({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(t){const e=[];for(const r of Object.keys(t))e.push(`${r}=${t[r]}`);switch(e.length){case 0:return"";case 1:return"?"+e[0];default:return"?"+e.join("&")}}(this._queryParams)),this._queryParamsString}setProps(t){this.options={...this.options,...t}}setOptions(t){this.options={...this.options,...t}}getTileUrl(t){return t.startsWith("data:")?t:`${t}${this.queryParams}`}hasExtension(t){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(t)>-1)}update(t){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t instanceof Array||(t=[t]),this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const e=[];for(const r of t){const t=r.id;this._needTraverse(t)?e.push(t):this.traverseCounter--}for(const r of t){const t=r.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!e.includes(t))continue;const i=ze(r,this._frameNumber);this._traverser.traverse(this.roots[t],i,this.options)}}_needTraverse(t){let e=t;return this.options.viewportTraversersMap&&(e=this.options.viewportTraversersMap[t]),e===t}_onTraversalEnd(t){const e=t.viewport.id;this.frameStateData[e]||(this.frameStateData[e]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const r=this.frameStateData[e],i=Object.values(this._traverser.selectedTiles);r.selectedTiles=i,r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const t in this.frameStateData){const e=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(e.selectedTiles),this._requestedTiles=this._requestedTiles.concat(e._requestedTiles),this._emptyTiles=this._emptyTiles.concat(e._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,e){if(t.length!==e.length)return!0;const r=new Set(t.map(t=>t.id)),i=new Set(e.map(t=>t.id));let s=t.filter(t=>!i.has(t.id)).length>0;return s=s||e.filter(t=>!r.has(t.id)).length>0,s}_loadTiles(){for(const t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,e)=>t._unloadTile(e))}_updateStats(){let t=0,e=0;for(const r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount&&(e+=r.content.pointCount));this.stats.get("Tiles In View").count=this.selectedTiles.length,this.stats.get("Tiles To Render").count=t,this.stats.get("Points").count=e}_initializeTileSet(t){this.root=this._initializeTileHeaders(t,null),this.type===Ri.TILES3D&&this._initializeCesiumTileset(t),this.type===Ri.I3S&&this._initializeI3STileset(),this._calculateViewProps()}_calculateViewProps(){const t=this.root;Et(t);const{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Q,void(this.zoom=1);this.cartographicCenter=vt.WGS84.cartesianToCartographic(e,new Q),this.cartesianCenter=e,this.zoom=Fe(t.boundingVolume)}_initializeStats(){this.stats.get("Tiles In Tileset(s)"),this.stats.get("Tiles Loading"),this.stats.get("Tiles In Memory"),this.stats.get("Tiles In View"),this.stats.get("Tiles To Render"),this.stats.get("Tiles Loaded"),this.stats.get("Tiles Unloaded"),this.stats.get("Failed Tile Loads"),this.stats.get("Points","memory"),this.stats.get("Tile Memory Use","memory")}_initializeTileHeaders(t,e){const r=new Hi(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===Ri.TILES3D){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get("Tiles In Tileset(s)").incrementCount();const r=e.header.children||[];for(const i of r){const r=new Hi(this,i,e);e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case Ri.TILES3D:t=Ki;break;case Ri.I3S:t=es;break;default:t=$i}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let e;try{this._onStartTileLoading(),e=await t.loadContent()}catch(e){this._onTileLoadError(t,e)}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get("Failed Tile Loads").incrementCount();const r=e.message||e.toString(),i=t.url;console.error(`A 3D tile failed to load: ${t.url} ${r}`),this.options.onTileError(t,r,i)}_onTileLoad(t,e){e&&(t&&t.content&&Pt(t,t.content),this._addTileToCache(t),this.options.onTileLoad(t))}_onStartTileLoading(){this._pendingCount++,this.stats.get("Tiles Loading").incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get("Tiles Loading").decrementCount()}_addTileToCache(t){this._cache.add(this,t,e=>e._updateCacheStats(t))}_updateCacheStats(t){this.stats.get("Tiles Loaded").incrementCount(),this.stats.get("Tiles In Memory").incrementCount(),this.gpuMemoryUsageInBytes+=t.content.byteLength||0,this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.content&&t.content.byteLength||0,this.stats.get("Tiles In Memory").decrementCount(),this.stats.get("Tiles Unloaded").incrementCount(),this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){const t=[];for(this.root&&t.push(this.root);t.length>0;){const e=t.pop();for(const r of e.children)t.push(r);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,r=[];for(r.push(e);r.length>0;){t=r.pop();for(const e of t.children)r.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeCesiumTileset(t){if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed,this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}}])}));
|
|
2
|
-
//# sourceMappingURL=dist.min.js.map
|