@loaders.gl/i3s 3.1.0-alpha.5 → 3.1.0-beta.7

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.
Files changed (94) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +10364 -0
  4. package/dist/es5/i3s-attribute-loader.js +1 -1
  5. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  6. package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
  7. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
  8. package/dist/es5/i3s-content-loader.js +1 -1
  9. package/dist/es5/i3s-content-loader.js.map +1 -1
  10. package/dist/es5/i3s-loader.js +1 -1
  11. package/dist/es5/i3s-loader.js.map +1 -1
  12. package/dist/es5/i3s-node-page-loader.js +1 -1
  13. package/dist/es5/i3s-node-page-loader.js.map +1 -1
  14. package/dist/es5/lib/parsers/constants.js +61 -25
  15. package/dist/es5/lib/parsers/constants.js.map +1 -1
  16. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +42 -36
  17. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  18. package/dist/es5/lib/utils/url-utils.js.map +1 -1
  19. package/dist/es5/types.js +19 -0
  20. package/dist/es5/types.js.map +1 -1
  21. package/dist/esm/i3s-attribute-loader.js +1 -1
  22. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  23. package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
  24. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
  25. package/dist/esm/i3s-content-loader.js +1 -1
  26. package/dist/esm/i3s-content-loader.js.map +1 -1
  27. package/dist/esm/i3s-loader.js +1 -1
  28. package/dist/esm/i3s-loader.js.map +1 -1
  29. package/dist/esm/i3s-node-page-loader.js +1 -1
  30. package/dist/esm/i3s-node-page-loader.js.map +1 -1
  31. package/dist/esm/lib/parsers/constants.js +54 -22
  32. package/dist/esm/lib/parsers/constants.js.map +1 -1
  33. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +41 -37
  34. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  35. package/dist/esm/lib/utils/url-utils.js.map +1 -1
  36. package/dist/esm/types.js +13 -1
  37. package/dist/esm/types.js.map +1 -1
  38. package/dist/i3s-attribute-loader.d.ts +1 -0
  39. package/dist/i3s-attribute-loader.d.ts.map +1 -0
  40. package/dist/i3s-attribute-loader.js +177 -0
  41. package/dist/i3s-building-scene-layer-loader.d.ts +1 -0
  42. package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -0
  43. package/dist/i3s-building-scene-layer-loader.js +26 -0
  44. package/dist/i3s-content-loader.d.ts +1 -0
  45. package/dist/i3s-content-loader.d.ts.map +1 -0
  46. package/dist/i3s-content-loader.js +28 -0
  47. package/dist/i3s-content-worker.js +7657 -2
  48. package/dist/i3s-loader.d.ts +1 -0
  49. package/dist/i3s-loader.d.ts.map +1 -0
  50. package/dist/i3s-loader.js +100 -0
  51. package/dist/i3s-node-page-loader.d.ts +1 -0
  52. package/dist/i3s-node-page-loader.d.ts.map +1 -0
  53. package/dist/i3s-node-page-loader.js +26 -0
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +14 -0
  57. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -0
  58. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -0
  59. package/dist/lib/helpers/i3s-nodepages-tiles.js +231 -0
  60. package/dist/lib/parsers/constants.d.ts +34 -27
  61. package/dist/lib/parsers/constants.d.ts.map +1 -0
  62. package/dist/lib/parsers/constants.js +107 -0
  63. package/dist/lib/parsers/parse-i3s-attribute.d.ts +2 -1
  64. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -0
  65. package/dist/lib/parsers/parse-i3s-attribute.js +98 -0
  66. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts +1 -0
  67. package/dist/lib/parsers/parse-i3s-building-scene-layer.d.ts.map +1 -0
  68. package/dist/lib/parsers/parse-i3s-building-scene-layer.js +46 -0
  69. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +2 -1
  70. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -0
  71. package/dist/lib/parsers/parse-i3s-tile-content.js +508 -0
  72. package/dist/lib/parsers/parse-i3s.d.ts +1 -0
  73. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -0
  74. package/dist/lib/parsers/parse-i3s.js +84 -0
  75. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts +1 -0
  76. package/dist/lib/utils/convert-i3s-obb-to-mbs.d.ts.map +1 -0
  77. package/dist/lib/utils/convert-i3s-obb-to-mbs.js +20 -0
  78. package/dist/lib/utils/url-utils.d.ts +2 -1
  79. package/dist/lib/utils/url-utils.d.ts.map +1 -0
  80. package/dist/lib/utils/url-utils.js +44 -0
  81. package/dist/types.d.ts +98 -13
  82. package/dist/types.d.ts.map +1 -0
  83. package/dist/types.js +15 -0
  84. package/dist/workers/i3s-content-worker.d.ts +1 -0
  85. package/dist/workers/i3s-content-worker.d.ts.map +1 -0
  86. package/dist/workers/i3s-content-worker.js +5 -0
  87. package/package.json +11 -12
  88. package/src/lib/parsers/constants.ts +69 -36
  89. package/src/lib/parsers/parse-i3s-tile-content.ts +110 -85
  90. package/src/lib/utils/url-utils.ts +1 -1
  91. package/src/types.ts +153 -22
  92. package/dist/dist.min.js +0 -2
  93. package/dist/dist.min.js.map +0 -1
  94. package/dist/i3s-content-worker.js.map +0 -1
package/dist/dist.min.js DELETED
@@ -1,2 +0,0 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("loaders"));else if("function"==typeof define&&define.amd)define(["loaders"],e);else{var r="object"==typeof exports?e(require("loaders")):e(t.loaders);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=10)}([,function(e,r){e.exports=t},function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return s})),r.d(e,"b",(function(){return o})),r.d(e,"c",(function(){return a}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},s=i.global||i.self||i.window||{},o="object"!=typeof n||"[object process]"!==String(n)||n.browser,a="function"==typeof importScripts,c=("undefined"!=typeof window&&window.orientation,void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version));c&&parseFloat(c[1])}).call(this,r(7),r(8))},function(t,e){},,,,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){var r,n,i=t.exports={};function s(){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===s||!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:s}catch(t){r=s}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var c,u=[],h=!1,l=-1;function d(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&f())}function f(){if(!h){var t=a(d);h=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function _(t,e){this.fun=t,this.array=e}function m(){}i.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];u.push(new _(t,e)),1!==u.length||h||a(f)},_.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},,function(t,e,r){const n=r(13);globalThis.loaders=globalThis.loaders||{},t.exports=Object.assign(globalThis.loaders,n)},,,function(t,e,r){"use strict";r.r(e),r.d(e,"I3SLoader",(function(){return Si})),r.d(e,"I3SContentLoader",(function(){return on})),r.d(e,"I3SAttributeLoader",(function(){return gi})),r.d(e,"loadFeatureAttributes",(function(){return Ai})),r.d(e,"I3SBuildingSceneLayerLoader",(function(){return wi})),r.d(e,"COORDINATE_SYSTEM",(function(){return Qr}));var n=r(1);function i(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const s=1/Math.PI*180,o=1/180*Math.PI,a={};function c(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 u(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function h(t,e,r){if(u(t)){r=r||((n=t).clone?n.clone():new Array(n.length));for(let n=0;n<r.length&&n<t.length;++n)r[n]=e(t[n],n,r);return r}var n;return e(t)}function l(t){return function(t,e){return h(t,t=>t*o,e)}(t)}function d(t){return function(t,e){return h(t,t=>t*s,e)}(t)}function f(t,e,r){const n=a.EPSILON;r&&(a.EPSILON=r);try{if(t===e)return!0;if(u(t)&&u(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!f(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=n}}a.EPSILON=1e-12,a.debug=!1,a.precision=4,a.printTypes=!1,a.printDegrees=!1,a.printRowMajor=!0;class _ 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 i(!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:u(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?", ":"")+c(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(!f(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 n=0;n<this.ELEMENTS;++n){const i=t[n];this[n]=i+r*(e[n]-i)}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}}function m(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function S(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}const E={};function p(t,e){E[t]||(E[t]=!0,console.warn("".concat(t," has been removed in version ").concat(e,", see upgrade guide for more information")))}class R extends _{get ELEMENTS(){return i(!1),0}copy(t){return i(!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 n=this[r]-t[r];e+=n*n}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 i(t>=0&&t<this.ELEMENTS,"index is out of range"),m(this[t])}setComponent(t,e){return i(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))}}var g=1e-6,A="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function y(){var t=new A(3);return A!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function T(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function b(t,e,r){var n=new A(3);return n[0]=t,n[1]=e,n[2]=r,n}function M(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function C(t,e,r){var n=e[0],i=e[1],s=e[2],o=r[0],a=r[1],c=r[2];return t[0]=i*c-s*a,t[1]=s*o-n*c,t[2]=n*a-i*o,t}function w(t,e,r){var n=e[0],i=e[1],s=e[2],o=r[3]*n+r[7]*i+r[11]*s+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*s+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*s+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*s+r[14])/o,t}function D(t,e,r){var n=e[0],i=e[1],s=e[2];return t[0]=n*r[0]+i*r[3]+s*r[6],t[1]=n*r[1]+i*r[4]+s*r[7],t[2]=n*r[2]+i*r[5]+s*r[8],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var P,O=T;P=y();function x(t,e,r){const n=e[0],i=e[1],s=e[2],o=r[3]*n+r[7]*i+r[11]*s||1;return t[0]=(r[0]*n+r[4]*i+r[8]*s)/o,t[1]=(r[1]*n+r[5]*i+r[9]*s)/o,t[2]=(r[2]*n+r[6]*i+r[10]*s)/o,t}const I=[0,0,0],v={};class B extends R{static get ZERO(){return v.ZERO=v.ZERO||Object.freeze(new B(0,0,0,0))}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&u(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,n=(e=this)[0],i=e[1],s=e[2],o=r[0],a=r[1],c=r[2],u=Math.sqrt(n*n+i*i+s*s)*Math.sqrt(o*o+a*a+c*c),h=u&&M(e,r)/u,Math.acos(Math.min(Math.max(h,-1),1));var e,r,n,i,s,o,a,c,u,h}cross(t){return C(this,this,t),this.check()}rotateX({radians:t,origin:e=I}){var r,n,i,s,o,a;return r=this,i=e,s=t,a=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],a[0]=o[0],a[1]=o[1]*Math.cos(s)-o[2]*Math.sin(s),a[2]=o[1]*Math.sin(s)+o[2]*Math.cos(s),r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}rotateY({radians:t,origin:e=I}){var r,n,i,s,o,a;return r=this,i=e,s=t,a=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],a[0]=o[2]*Math.sin(s)+o[0]*Math.cos(s),a[1]=o[1],a[2]=o[2]*Math.cos(s)-o[0]*Math.sin(s),r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}rotateZ({radians:t,origin:e=I}){var r,n,i,s,o,a;return r=this,i=e,s=t,a=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],a[0]=o[0]*Math.cos(s)-o[1]*Math.sin(s),a[1]=o[0]*Math.sin(s)+o[1]*Math.cos(s),a[2]=o[2],r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return w(this,this,t),this.check()}transformAsVector(t){return x(this,this,t),this.check()}transformByMatrix3(t){return D(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const n=e[0],i=e[1];t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){var e,r,n,i,s,o,a,c,u,h,l,d,f,_,m,S,E;return e=this,r=this,i=(n=t)[0],s=n[1],o=n[2],a=n[3],c=r[0],u=r[1],h=r[2],_=s*(f=i*u-s*c)-o*(d=o*c-i*h),m=o*(l=s*h-o*u)-i*f,S=i*d-s*l,l*=E=2*a,d*=E,f*=E,_*=2,m*=2,S*=2,e[0]=c+l+_,e[1]=u+d+m,e[2]=h+f+S,this.check()}}class G extends _{get ELEMENTS(){return i(!1),0}get RANK(){return i(!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 L(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],u=e[6],h=e[7],l=e[8],d=e[9],f=e[10],_=e[11],m=e[12],S=e[13],E=e[14],p=e[15],R=r[0],g=r[1],A=r[2],y=r[3];return t[0]=R*n+g*a+A*l+y*m,t[1]=R*i+g*c+A*d+y*S,t[2]=R*s+g*u+A*f+y*E,t[3]=R*o+g*h+A*_+y*p,R=r[4],g=r[5],A=r[6],y=r[7],t[4]=R*n+g*a+A*l+y*m,t[5]=R*i+g*c+A*d+y*S,t[6]=R*s+g*u+A*f+y*E,t[7]=R*o+g*h+A*_+y*p,R=r[8],g=r[9],A=r[10],y=r[11],t[8]=R*n+g*a+A*l+y*m,t[9]=R*i+g*c+A*d+y*S,t[10]=R*s+g*u+A*f+y*E,t[11]=R*o+g*h+A*_+y*p,R=r[12],g=r[13],A=r[14],y=r[15],t[12]=R*n+g*a+A*l+y*m,t[13]=R*i+g*c+A*d+y*S,t[14]=R*s+g*u+A*f+y*E,t[15]=R*o+g*h+A*_+y*p,t}function N(t,e,r){var n=r[0],i=r[1],s=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function U(t,e){var r=e[0],n=e[1],i=e[2],s=e[4],o=e[5],a=e[6],c=e[8],u=e[9],h=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(s,o,a),t[2]=Math.hypot(c,u,h),t}!function(){var t,e=(t=new A(2),A!=Float32Array&&(t[0]=0,t[1]=0),t)}();function H(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function F(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}!function(){var t,e=(t=new A(4),A!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();const X=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),k=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),z=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}),K={};class j extends G{static get IDENTITY(){return K.IDENTITY=K.IDENTITY||Object.freeze(new j(X)),K.IDENTITY}static get ZERO(){return K.ZERO=K.ZERO||Object.freeze(new j(k)),K.ZERO}get INDICES(){return z}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,n,i,s,o,a,c,u,h,l,d,f,_,m){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this[9]=u,this[10]=h,this[11]=l,this[12]=d,this[13]=f,this[14]=_,this[15]=m,this.check()}setRowMajor(t,e,r,n,i,s,o,a,c,u,h,l,d,f,_,m){return this[0]=t,this[1]=i,this[2]=c,this[3]=d,this[4]=e,this[5]=s,this[6]=u,this[7]=f,this[8]=r,this[9]=o,this[10]=h,this[11]=_,this[12]=n,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(X)}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],o=r+r,a=n+n,c=i+i,u=r*o,h=n*o,l=n*a,d=i*o,f=i*a,_=i*c,m=s*o,S=s*a,E=s*c;t[0]=1-l-_,t[1]=h+E,t[2]=d-S,t[3]=0,t[4]=h-E,t[5]=1-u-_,t[6]=f+m,t[7]=0,t[8]=d+S,t[9]=f-m,t[10]=1-u-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:n,near:i,far:s}){return s===1/0?j._computeInfinitePerspectiveOffCenter(this,t,e,r,n,i):function(t,e,r,n,i,s,o){var a=1/(r-e),c=1/(i-n),u=1/(s-o);t[0]=2*s*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(i+n)*c,t[10]=(o+s)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*u,t[15]=0}(this,t,e,r,n,i,s),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,r,n,i,s){const o=2*s/(r-e),a=2*s/(i-n),c=(r+e)/(r-e),u=(i+n)/(i-n),h=-2*s;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]=c,t[9]=u,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=h,t[15]=0,t}lookAt(t,e,r){return 1===arguments.length&&({eye:t,center:e,up:r}=t),function(t,e,r,n){var i,s,o,a,c,u,h,l,d,f,_=e[0],m=e[1],S=e[2],E=n[0],p=n[1],R=n[2],A=r[0],y=r[1],T=r[2];Math.abs(_-A)<g&&Math.abs(m-y)<g&&Math.abs(S-T)<g?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):(h=_-A,l=m-y,d=S-T,i=p*(d*=f=1/Math.hypot(h,l,d))-R*(l*=f),s=R*(h*=f)-E*d,o=E*l-p*h,(f=Math.hypot(i,s,o))?(i*=f=1/f,s*=f,o*=f):(i=0,s=0,o=0),a=l*o-d*s,c=d*i-h*o,u=h*s-l*i,(f=Math.hypot(a,c,u))?(a*=f=1/f,c*=f,u*=f):(a=0,c=0,u=0),t[0]=i,t[1]=a,t[2]=h,t[3]=0,t[4]=s,t[5]=c,t[6]=l,t[7]=0,t[8]=o,t[9]=u,t[10]=d,t[11]=0,t[12]=-(i*_+s*m+o*S),t[13]=-(a*_+c*m+u*S),t[14]=-(h*_+l*m+d*S),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:n,near:i=.1,far:s=500}){return function(t,e,r,n,i,s,o){var a=1/(e-r),c=1/(n-i),u=1/(s-o);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*a,t[13]=(i+n)*c,t[14]=(o+s)*u,t[15]=1}(this,t,e,r,n,i,s),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:r=1,near:n=.1,far:i=500}){if(t>2*Math.PI)throw Error("radians");const s=t/2,o=r*Math.tan(s),a=o*e;return(new j).ortho({left:-a,right:a,bottom:-o,top:o,near:n,far:i})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return function(t,e,r,n,i){var s,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!=i&&i!==1/0?(s=1/(n-i),t[10]=(i+n)*s,t[14]=2*i*n*s):(t[10]=-1,t[14]=-2*n)}(this,t,r,n,i),this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],u=t[8],h=t[9],l=t[10],d=t[11],f=t[12],_=t[13],m=t[14],S=t[15],(e*o-r*s)*(l*S-d*m)-(e*a-n*s)*(h*S-d*_)+(e*c-i*s)*(h*m-l*_)+(r*a-n*o)*(u*S-d*f)-(r*c-i*o)*(u*m-l*f)+(n*c-i*a)*(u*_-h*f);var t,e,r,n,i,s,o,a,c,u,h,l,d,f,_,m,S}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]),n=1/r[0],i=1/r[1],s=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*i,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*i,t[10]=this[10]*s,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]),n=1/r[0],i=1/r[1],s=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*s,t[3]=this[4]*n,t[4]=this[5]*i,t[5]=this[6]*s,t[6]=this[8]*n,t[7]=this[9]*i,t[8]=this[10]*s,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],s=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]=n,t[9]=s,t[11]=e[14],t[12]=i,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(){var t,e,r,n,i,s,o,a,c,u,h,l,d,f,_,m,S,E,p,R,g,A,y,T,b,M,C,w,D,P,O;return t=this,r=(e=this)[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],u=e[7],h=e[8],l=e[9],d=e[10],f=e[11],_=e[12],m=e[13],S=e[14],E=e[15],(O=(p=r*a-n*o)*(P=d*E-f*S)-(R=r*c-i*o)*(D=l*E-f*m)+(g=r*u-s*o)*(w=l*S-d*m)+(A=n*c-i*a)*(C=h*E-f*_)-(y=n*u-s*a)*(M=h*S-d*_)+(T=i*u-s*c)*(b=h*m-l*_))&&(O=1/O,t[0]=(a*P-c*D+u*w)*O,t[1]=(i*D-n*P-s*w)*O,t[2]=(m*T-S*y+E*A)*O,t[3]=(d*y-l*T-f*A)*O,t[4]=(c*C-o*P-u*M)*O,t[5]=(r*P-i*C+s*M)*O,t[6]=(S*g-_*T-E*R)*O,t[7]=(h*T-d*g+f*R)*O,t[8]=(o*D-a*C+u*b)*O,t[9]=(n*C-r*D-s*b)*O,t[10]=(_*y-m*g+E*p)*O,t[11]=(l*g-h*y-f*p)*O,t[12]=(a*M-o*w-c*b)*O,t[13]=(r*w-n*M+i*b)*O,t[14]=(m*R-_*A-S*p)*O,t[15]=(h*A-l*R+d*p)*O),this.check()}multiplyLeft(t){return L(this,t,this),this.check()}multiplyRight(t){return L(this,this,t),this.check()}rotateX(t){var e,r,n,i,s,o,a,c,u,h,l,d,f;return e=this,r=this,n=t,i=Math.sin(n),s=Math.cos(n),o=r[4],a=r[5],c=r[6],u=r[7],h=r[8],l=r[9],d=r[10],f=r[11],r!==e&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[4]=o*s+h*i,e[5]=a*s+l*i,e[6]=c*s+d*i,e[7]=u*s+f*i,e[8]=h*s-o*i,e[9]=l*s-a*i,e[10]=d*s-c*i,e[11]=f*s-u*i,this.check()}rotateY(t){var e,r,n,i,s,o,a,c,u,h,l,d,f;return e=this,r=this,n=t,i=Math.sin(n),s=Math.cos(n),o=r[0],a=r[1],c=r[2],u=r[3],h=r[8],l=r[9],d=r[10],f=r[11],r!==e&&(e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=o*s-h*i,e[1]=a*s-l*i,e[2]=c*s-d*i,e[3]=u*s-f*i,e[8]=o*i+h*s,e[9]=a*i+l*s,e[10]=c*i+d*s,e[11]=u*i+f*s,this.check()}rotateZ(t){var e,r,n,i,s,o,a,c,u,h,l,d,f;return e=this,r=this,n=t,i=Math.sin(n),s=Math.cos(n),o=r[0],a=r[1],c=r[2],u=r[3],h=r[4],l=r[5],d=r[6],f=r[7],r!==e&&(e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=o*s+h*i,e[1]=a*s+l*i,e[2]=c*s+d*i,e[3]=u*s+f*i,e[4]=h*s-o*i,e[5]=l*s-a*i,e[6]=d*s-c*i,e[7]=f*s-u*i,this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return function(t,e,r,n){var i,s,o,a,c,u,h,l,d,f,_,m,S,E,p,R,A,y,T,b,M,C,w,D,P=n[0],O=n[1],x=n[2],I=Math.hypot(P,O,x);I<g||(P*=I=1/I,O*=I,x*=I,i=Math.sin(r),o=1-(s=Math.cos(r)),a=e[0],c=e[1],u=e[2],h=e[3],l=e[4],d=e[5],f=e[6],_=e[7],m=e[8],S=e[9],E=e[10],p=e[11],R=P*P*o+s,A=O*P*o+x*i,y=x*P*o-O*i,T=P*O*o-x*i,b=O*O*o+s,M=x*O*o+P*i,C=P*x*o+O*i,w=O*x*o-P*i,D=x*x*o+s,t[0]=a*R+l*A+m*y,t[1]=c*R+d*A+S*y,t[2]=u*R+f*A+E*y,t[3]=h*R+_*A+p*y,t[4]=a*T+l*b+m*M,t[5]=c*T+d*b+S*M,t[6]=u*T+f*b+E*M,t[7]=h*T+_*b+p*M,t[8]=a*C+l*w+m*D,t[9]=c*C+d*w+S*D,t[10]=u*C+f*w+E*D,t[11]=h*C+_*w+p*D,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)?N(this,this,t):N(this,this,[t,t,t]),this.check()}translate(t){var e,r,n,i,s,o,a,c,u,h,l,d,f,_,m,S,E,p;return e=this,r=this,S=(n=t)[0],E=n[1],p=n[2],r===e?(e[12]=r[0]*S+r[4]*E+r[8]*p+r[12],e[13]=r[1]*S+r[5]*E+r[9]*p+r[13],e[14]=r[2]*S+r[6]*E+r[10]*p+r[14],e[15]=r[3]*S+r[7]*E+r[11]*p+r[15]):(i=r[0],s=r[1],o=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],d=r[8],f=r[9],_=r[10],m=r[11],e[0]=i,e[1]=s,e[2]=o,e[3]=a,e[4]=c,e[5]=u,e[6]=h,e[7]=l,e[8]=d,e[9]=f,e[10]=_,e[11]=m,e[12]=i*S+c*E+d*p+r[12],e[13]=s*S+u*E+f*p+r[13],e[14]=o*S+h*E+_*p+r[14],e[15]=a*S+l*E+m*p+r[15]),this.check()}transform(t,e){return 4===t.length?(r=e||[-0,-0,-0,-0],i=this,s=(n=t)[0],o=n[1],a=n[2],c=n[3],r[0]=i[0]*s+i[4]*o+i[8]*a+i[12]*c,r[1]=i[1]*s+i[5]*o+i[9]*a+i[13]*c,r[2]=i[2]*s+i[6]*o+i[10]*a+i[14]*c,r[3]=i[3]*s+i[7]*o+i[11]*a+i[15]*c,S(e=r,4),e):this.transformAsPoint(t,e);var r,n,i,s,o,a,c}transformAsPoint(t,e){const{length:r}=t;switch(r){case 2:n=e||[-0,-0],s=this,o=(i=t)[0],a=i[1],n[0]=s[0]*o+s[4]*a+s[12],n[1]=s[1]*o+s[5]*a+s[13],e=n;break;case 3:e=w(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}var n,i,s,o,a;return S(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=function(t,e,r){const n=e[0],i=e[1],s=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/s,t[1]=(r[1]*n+r[5]*i)/s,t}(e||[-0,-0],t,this);break;case 3:e=x(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return S(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 p("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return p("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return p("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}var q=.1,V=1e-12,W=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const $=t=>t,Z=new B;function Q(t,e,r=$){return u(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 Y(t,e,r=$){return u(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 J=new B,tt=new B,et=new B;const rt=new B,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"}},it={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},st={east:new B,north:new B,up:new B,west:new B,south:new B,down:new B},ot=new B,at=new B,ct=new B;function ut(t,e,r,n,s,o){const a=nt[e]&&nt[e][r];let c,u,h;i(a&&(!n||n===a));const l=rt.copy(s);if(f(l.x,0,1e-14)&&f(l.y,0,1e-14)){const t=Math.sign(l.z);c=ot.fromArray(it[e]),"east"!==e&&"west"!==e&&c.scale(t),u=at.fromArray(it[r]),"east"!==r&&"west"!==r&&u.scale(t),h=ct.fromArray(it[n]),"east"!==n&&"west"!==n&&h.scale(t)}else{const{up:i,east:s,north:o}=st;s.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,i),o.copy(i).cross(s);const{down:a,west:d,south:f}=st;a.copy(i).scale(-1),d.copy(s).scale(-1),f.copy(o).scale(-1),c=st[e],u=st[r],h=st[n]}return o[0]=c.x,o[1]=c.y,o[2]=c.z,o[3]=0,o[4]=u.x,o[5]=u.y,o[6]=u.z,o[7]=0,o[8]=h.x,o[9]=h.y,o[10]=h.z,o[11]=0,o[12]=l.x,o[13]=l.y,o[14]=l.z,o[15]=1,o}const ht=new B,lt=new B,dt=new B,ft=new B,_t=new B,mt=new B;let St;class Et{static get WGS84(){return St=St||new Et(6378137,6378137,6356752.314245179),St}constructor(t=0,e=0,r=0){i(t>=0),i(e>=0),i(r>=0),this.radii=new B(t,e,r),this.radiiSquared=new B(t*t,e*e,r*r),this.radiiToTheFourth=new B(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new B(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new B(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=q,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=lt,n=dt,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const s=Math.sqrt(r.dot(n));return n.scale(1/s),r.scale(i),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){mt.from(t);const r=this.scaleToGeodeticSurface(mt,ft);if(!r)return;const n=this.geodeticSurfaceNormal(r,lt),i=_t;i.copy(mt).subtract(r);const s=Math.atan2(n.y,n.x),o=Math.asin(n.z),c=Math.sign(M(i,mt))*T(i);return Y([s,o,c],e,a._cartographicRadians?$:d)}eastNorthUpToFixedFrame(t,e=new j){return ut(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new j){return ut(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return ht.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=function(t,e=Z){return Q(t,e,a._cartographicRadians?$:l)}(t),n=r[0],i=r[1],s=Math.cos(i);return ht.set(s*Math.cos(n),s*Math.sin(n),Math.sin(i)).normalize(),ht.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return ht.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new B){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:s}=e;J.from(t);const o=t.x,a=t.y,c=t.z,u=n.x,h=n.y,l=n.z,d=o*o*u*u,f=a*a*h*h,_=c*c*l*l,m=d+f+_,S=Math.sqrt(1/m);if(!Number.isFinite(S))return;const E=tt;if(E.copy(t).scale(S),m<s)return E.to(r);const p=i.x,R=i.y,g=i.z,A=et;A.set(E.x*p*2,E.y*R*2,E.z*g*2);let y,T,b,M,C=(1-S)*t.len()/(.5*A.len()),w=0;do{C-=w,y=1/(1+C*p),T=1/(1+C*R),b=1/(1+C*g);const t=y*y,e=T*T,r=b*b;M=d*t+f*e+_*r-1;w=M/(-2*(d*(t*y)*p+f*(e*T)*R+_*(r*b)*g))}while(Math.abs(M)>V);return J.scale([y,T,b]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){ft.from(t);const r=ft.x,n=ft.y,i=ft.z,s=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*s.x+n*n*s.y+i*i*s.z);return ft.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return ft.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return ft.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){i(f(this.radii.x,this.radii.y,W)),i(this.radii.z>0),ft.from(t);const n=ft.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return ft.set(0,0,n).to(r)}}function pt(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var Rt=r(17);const{_parseImageNode:gt}=globalThis,At="undefined"!=typeof Image,yt="undefined"!=typeof ImageBitmap,Tt=Boolean(gt),bt=!!Rt.a||Tt;function Mt(t){const e=wt(t);if(!e)throw new Error("Not an image");return e}function Ct(t){switch(Mt(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function wt(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&t instanceof Image?"image":t&&"object"==typeof t&&t.data&&t.width&&t.height?"data":null}const Dt=/^data:image\/svg\+xml/,Pt=/\.svg((\?|#).*)?$/;function Ot(t){return t&&(Dt.test(t)||Pt.test(t))}function xt(t,e){if(Ot(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function It(t,e,r){const n=function(t,e){if(Ot(e)){let e=(new TextDecoder).decode(t);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(e=unescape(encodeURIComponent(e)))}catch(t){throw new Error(t.message)}return"data:image/svg+xml;base64,"+btoa(e)}return xt(t,e)}(t,r),i=self.URL||self.webkitURL,s="string"!=typeof n&&i.createObjectURL(n);try{return await async function(t,e){const r=new Image;if(r.src=t,e.image&&e.image.decode&&r.decode)return await r.decode(),r;return await new Promise((e,n)=>{try{r.onload=()=>e(r),r.onerror=e=>n(new Error(`Could not load image ${t}: ${e}`))}catch(t){n(t)}})}(s||n,e)}finally{s&&i.revokeObjectURL(s)}}const vt={};let Bt=!0;async function Gt(t,e,r){let n;if(Ot(r)){n=await It(t,e,r)}else n=xt(t,r);const i=e&&e.imagebitmap;return await async function(t,e=null){!function(t){for(const e in t||vt)return!1;return!0}(e)&&Bt||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),Bt=!1}return await createImageBitmap(t)}(n,i)}function Lt(t){const e=Nt(t);return function(t){const e=Nt(t);if(!(e.byteLength>=24&&2303741511===e.getUint32(0,!1)))return null;return{mimeType:"image/png",width:e.getUint32(16,!1),height:e.getUint32(20,!1)}}(e)||function(t){const e=Nt(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,!1)&&255===e.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);const e=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:t,sofMarkers:e}}();let i=2;for(;i+9<e.byteLength;){const t=e.getUint16(i,!1);if(n.has(t))return{mimeType:"image/jpeg",height:e.getUint16(i+5,!1),width:e.getUint16(i+7,!1)};if(!r.has(t))return null;i+=2,i+=e.getUint16(i,!1)}return null}(e)||function(t){const e=Nt(t);if(!(e.byteLength>=10&&1195984440===e.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:e.getUint16(6,!0),height:e.getUint16(8,!0)}}(e)||function(t){const e=Nt(t);if(!(e.byteLength>=14&&16973===e.getUint16(0,!1)&&e.getUint32(2,!0)===e.byteLength))return null;return{mimeType:"image/bmp",width:e.getUint32(18,!0),height:e.getUint32(22,!0)}}(e)}function Nt(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}const Ut={id:"image",module:"images",name:"Images",version:"3.1.0-alpha.5",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(t,e,r){const n=((e=e||{}).image||{}).type||"auto",{url:i}=r||{};let s;switch(function(t){switch(t){case"auto":case"data":return function(){if(yt)return"imagebitmap";if(At)return"image";if(bt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return yt||At||bt;case"imagebitmap":return yt;case"image":return At;case"data":return bt;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}(t),t}}(n)){case"imagebitmap":s=await Gt(t,e,i);break;case"image":s=await It(t,e,i);break;case"data":s=await async function(t,e){const{mimeType:r}=Lt(t)||{},n=globalThis._parseImageNode;return pt(n),await n(t,r)}(t);break;default:pt(!1)}return"data"===n&&(s=Ct(s)),s},tests:[t=>Boolean(Lt(new DataView(t)))],options:{image:{type:"auto",decode:!0}}},Ht={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:"3.1.0-alpha.5",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Ft(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class Xt{constructor(t,e){Ft(this,"fields",void 0),Ft(this,"metadata",void 0),function(t,e){if(!t)throw new Error(e||"loader assertion failed.")}(Array.isArray(t)),function(t){const e={};for(const r of t)e[r.name]&&console.warn("Schema: duplicated field name",r.name,r),e[r.name]=!0}(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(let e=0;e<this.fields.length;++e)if(!this.fields[e].compareTo(t.fields[e]))return!1;return!0}select(...t){const e=Object.create(null);for(const r of t)e[r]=!0;const r=this.fields.filter(t=>e[t.name]);return new Xt(r,this.metadata)}selectAt(...t){const e=t.map(t=>this.fields[t]).filter(Boolean);return new Xt(e,this.metadata)}assign(t){let e,r=this.metadata;if(t instanceof Xt){const n=t;e=n.fields,r=kt(kt(new Map,this.metadata),n.metadata)}else e=t;const n=Object.create(null);for(const t of this.fields)n[t.name]=t;for(const t of e)n[t.name]=t;const i=Object.values(n);return new Xt(i,r)}}function kt(t,e){return new Map([...t||new Map,...e||new Map])}function zt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class Kt{constructor(t,e,r=!1,n=new Map){zt(this,"name",void 0),zt(this,"type",void 0),zt(this,"nullable",void 0),zt(this,"metadata",void 0),this.name=t,this.type=e,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new Kt(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}let jt,qt,Vt,Wt,$t,Zt,Qt,Yt,Jt;function te(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(jt||(jt={}));class ee{static isNull(t){return t&&t.typeId===jt.Null}static isInt(t){return t&&t.typeId===jt.Int}static isFloat(t){return t&&t.typeId===jt.Float}static isBinary(t){return t&&t.typeId===jt.Binary}static isUtf8(t){return t&&t.typeId===jt.Utf8}static isBool(t){return t&&t.typeId===jt.Bool}static isDecimal(t){return t&&t.typeId===jt.Decimal}static isDate(t){return t&&t.typeId===jt.Date}static isTime(t){return t&&t.typeId===jt.Time}static isTimestamp(t){return t&&t.typeId===jt.Timestamp}static isInterval(t){return t&&t.typeId===jt.Interval}static isList(t){return t&&t.typeId===jt.List}static isStruct(t){return t&&t.typeId===jt.Struct}static isUnion(t){return t&&t.typeId===jt.Union}static isFixedSizeBinary(t){return t&&t.typeId===jt.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===jt.FixedSizeList}static isMap(t){return t&&t.typeId===jt.Map}static isDictionary(t){return t&&t.typeId===jt.Dictionary}get typeId(){return jt.NONE}compareTo(t){return this===t}}Symbol.toStringTag;Symbol.toStringTag;qt=Symbol.toStringTag;class re extends ee{constructor(t,e){super(),te(this,"isSigned",void 0),te(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return jt.Int}get[qt](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class ne extends re{constructor(){super(!0,8)}}class ie extends re{constructor(){super(!0,16)}}class se extends re{constructor(){super(!0,32)}}class oe extends re{constructor(){super(!1,8)}}class ae extends re{constructor(){super(!1,16)}}class ce extends re{constructor(){super(!1,32)}}const ue=32,he=64;Vt=Symbol.toStringTag;class le extends ee{constructor(t){super(),te(this,"precision",void 0),this.precision=t}get typeId(){return jt.Float}get[Vt](){return"Float"}toString(){return"Float"+this.precision}}class de extends le{constructor(){super(ue)}}class fe extends le{constructor(){super(he)}}Symbol.toStringTag;Symbol.toStringTag;Wt=Symbol.toStringTag;$t=Symbol.toStringTag;Zt=Symbol.toStringTag;Qt=Symbol.toStringTag;Yt=Symbol.toStringTag;class _e extends ee{constructor(t,e){super(),te(this,"listSize",void 0),te(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return jt.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[Yt](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Jt=Symbol.toStringTag;function me(t,e,r){const n=function(t){switch(t.constructor){case Int8Array:return new ne;case Uint8Array:return new oe;case Int16Array:return new ie;case Uint16Array:return new ae;case Int32Array:return new se;case Uint32Array:return new ce;case Float32Array:return new de;case Float64Array:return new fe;default:throw new Error("array type not supported")}}(e.value),i=r||function(t){const e=new Map;"byteOffset"in t&&e.set("byteOffset",t.byteOffset.toString(10));"byteStride"in t&&e.set("byteStride",t.byteStride.toString(10));"normalized"in t&&e.set("normalized",t.normalized.toString());return e}(e);return new Kt(t,new _e(e.size,new Kt("value",n)),!1,i)}function Se(t,e,r){return me(t,e,r?Ee(r.metadata):void 0)}function Ee(t){const e=new Map;for(const r in t)e.set(r+".string",JSON.stringify(t[r]));return e}function pe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Re={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},ge={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Ae{constructor(t){pe(this,"draco",void 0),pe(this,"decoder",void 0),pe(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,e={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const n=this.decoder.GetEncodedGeometryType(r),i=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(n){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!i.ptr){const e="DRACO decompression failed: "+t.error_msg();throw new Error(e)}const s=this._getDracoLoaderData(i,n,e),o=this._getMeshData(i,s,e),a=function(t){let e=1/0,r=1/0,n=1/0,i=-1/0,s=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let t=0;t<c;t+=3){const c=a[t],u=a[t+1],h=a[t+2];e=c<e?c:e,r=u<r?u:r,n=h<n?h:n,i=c>i?c:i,s=u>s?u:s,o=h>o?h:o}return[[e,r,n],[i,s,o]]}(o.attributes),c=function(t,e,r){const n=Ee(e.metadata),i=[],s=function(t){const e={};for(const r in t){const n=t[r];e[n.name||"undefined"]=n}return e}(e.attributes);for(const e in t){const r=Se(e,t[e],s[e]);i.push(r)}if(r){const t=Se("indices",r);i.push(t)}return new Xt(i,n)}(o.attributes,s,o.indices);return{loader:"draco",loaderData:s,header:{vertexCount:i.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,r){const n=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:n,attributes:i}}_getDracoAttributes(t,e){const r={};for(let n=0;n<t.num_attributes();n++){const i=this.decoder.GetAttribute(t,n),s=this._getAttributeMetadata(t,n);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:n,metadata:s};const o=this._getQuantizationTransform(i,e);o&&(r[i.unique_id()].quantization_transform=o);const a=this._getOctahedronTransform(i,e);a&&(r[i.unique_id()].octahedron_transform=a)}return r}_getMeshData(t,e,r){const n=this._getMeshAttributes(e,t,r);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(t,e,r){const n={};for(const i of Object.values(t.attributes)){const t=this._deduceAttributeName(i,r);i.name=t;const{value:s,size:o}=this._getAttributeValues(e,i);n[t]={value:s,size:o,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return n}_getTriangleListIndices(t){const e=3*t.num_faces(),r=4*e,n=this.draco._malloc(r);try{return this.decoder.GetTrianglesUInt32Array(t,r,n),new Uint32Array(this.draco.HEAPF32.buffer,n,e).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(t){const e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),function(t){const e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){const r=ge[e.data_type],n=e.num_components,i=t.num_points()*n,s=i*r.BYTES_PER_ELEMENT,o=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}(this.draco,r);let a;const c=this.draco._malloc(s);try{const n=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,n,o,s,c),a=new r(this.draco.HEAPF32.buffer,c,i).slice()}finally{this.draco._free(c)}return{value:a,size:n}}_deduceAttributeName(t,e){const r=t.unique_id;for(const[t,n]of Object.entries(e.extraAttributes||{}))if(n===r)return t;const n=t.attribute_type;for(const t in Re){if(this.draco[t]===n)return Re[t]}const i=e.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:"CUSTOM_ATTRIBUTE_"+r}_getTopLevelMetadata(t){const e=this.decoder.GetMetadata(t);return this._getDracoMetadata(e)}_getAttributeMetadata(t,e){const r=this.decoder.GetAttributeMetadata(t,e);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};const e={},r=this.metadataQuerier.NumEntries(t);for(let n=0;n<r;n++){const r=this.metadataQuerier.GetEntryName(t,n);e[r]=this._getDracoMetadataField(t,r)}return e}_getDracoMetadataField(t,e){const r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,r);const n=function(t){const e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}(r);return{int:this.metadataQuerier.GetIntEntry(t,e),string:this.metadataQuerier.GetStringEntry(t,e),double:this.metadataQuerier.GetDoubleEntry(t,e),intArray:n}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){const{quantizedAttributes:e=[],octahedronAttributes:r=[]}=t,n=[...e,...r];for(const t of n)this.decoder.SkipAttributeTransform(this.draco[t])}_getQuantizationTransform(t,e){const{quantizedAttributes:r=[]}=e,n=t.attribute_type();if(r.map(t=>this.decoder[t]).includes(n)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits(),range:e.range(),min_values:new Float32Array([1,2,3]).map(t=>e.min_value(t))}}finally{this.draco.destroy(e)}}return null}_getOctahedronTransform(t,e){const{octahedronAttributes:r=[]}=e,n=t.attribute_type();if(r.map(t=>this.decoder[t]).includes(n)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits()}}finally{this.draco.destroy(e)}}return null}}var ye=r(2),Te=r(3);const be={};async function Me(t,e=null,r={}){return e&&(t=function(t,e,r){if(t.startsWith("http"))return t;const n=r.modules||{};if(n[t])return n[t];if(!ye.b)return`modules/${e}/dist/libs/${t}`;if(r.CDN)return function(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}(r.CDN.startsWith("http")),`${r.CDN}/${e}@3.1.0-alpha.5/dist/libs/${t}`;if(ye.c)return"../src/libs/"+t;return`modules/${e}/src/libs/${t}`}(t,e,r)),be[t]=be[t]||async function(t){if(t.endsWith("wasm")){const e=await fetch(t);return await e.arrayBuffer()}if(!ye.b)return Te.requireFromFile&&await Te.requireFromFile(t);if(ye.c)return importScripts(t);const e=await fetch(t);return function(t,e){if(!ye.b)return Te.requireFromString&&Te.requireFromString(t,e);if(ye.c)return eval.call(ye.a,t),null;const r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch(e){r.text=t}return document.body.appendChild(r),null}(await e.text(),t)}(t),await be[t]}let Ce;async function we(t){const e=t.modules||{};return Ce=e.draco3d?Ce||e.draco3d.createDecoderModule({}).then(t=>({draco:t})):Ce||async function(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await Me("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",t);break;case"wasm":default:[e,r]=await Promise.all([await Me("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",t),await Me("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",t)])}return e=e||globalThis.DracoDecoderModule,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise(e=>{t({...r,onModuleLoaded:t=>e({draco:t})})})}(e,r)}(t),await Ce}const De={...Ht,parse:async function(t,e){const{draco:r}=await we(e),n=new Ae(r);try{return n.parseSync(t,null==e?void 0:e.draco)}finally{n.destroy()}}};new Uint8Array([0]);const Pe=[171,75,84,88,32,50,48,187,13,10,26,10];var Oe,xe,Ie,ve,Be,Ge,Le,Ne,Ue;(Ue=Oe||(Oe={}))[Ue.NONE=0]="NONE",Ue[Ue.BASISLZ=1]="BASISLZ",Ue[Ue.ZSTD=2]="ZSTD",Ue[Ue.ZLIB=3]="ZLIB",function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(xe||(xe={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(Ie||(Ie={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(ve||(ve={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}(Be||(Be={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Ge||(Ge={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(Le||(Le={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(Ne||(Ne={}));class He{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=Oe.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:xe.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:Ie.UNSPECIFIED,colorPrimaries:ve.SRGB,transferFunction:ve.SRGB,flags:Ge.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}class Fe{constructor(t,e,r,n){this._dataView=new DataView(t.buffer,t.byteOffset+e,r),this._littleEndian=n,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_skip(t){return this._offset+=t,this}_scan(t,e=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}function Xe(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function ke(t,e){const r=new Array(e.mipMapLevels);let n=e.width,i=e.height,s=0;for(let o=0;o<e.mipMapLevels;++o){const a=Ke(e,n,i,t,o),c=ze(t,o,s,a);r[o]={compressed:!0,format:e.internalFormat,data:c,width:n,height:i,levelSize:a},n=Math.max(1,n>>1),i=Math.max(1,i>>1),s+=a}return r}function ze(t,e,r,n){return Array.isArray(t)?t[e].levelData:new Uint8Array(t.buffer,t.byteOffset+r,n)}function Ke(t,e,r,n,i){return Array.isArray(n)?t.sizeFunction(n[i]):t.sizeFunction(e,r)}const je={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919},qe={131:je.COMPRESSED_RGB_S3TC_DXT1_EXT,132:je.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:je.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:je.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:je.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:je.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:je.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:je.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:je.COMPRESSED_RED_RGTC1_EXT,140:je.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:je.COMPRESSED_RED_GREEN_RGTC2_EXT,142:je.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:je.COMPRESSED_RGB8_ETC2,148:je.COMPRESSED_SRGB8_ETC2,149:je.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:je.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:je.COMPRESSED_RGBA8_ETC2_EAC,152:je.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:je.COMPRESSED_R11_EAC,154:je.COMPRESSED_SIGNED_R11_EAC,155:je.COMPRESSED_RG11_EAC,156:je.COMPRESSED_SIGNED_RG11_EAC,157:je.COMPRESSED_RGBA_ASTC_4x4_KHR,158:je.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:je.COMPRESSED_RGBA_ASTC_5x4_KHR,160:je.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:je.COMPRESSED_RGBA_ASTC_5x5_KHR,162:je.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:je.COMPRESSED_RGBA_ASTC_6x5_KHR,164:je.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:je.COMPRESSED_RGBA_ASTC_6x6_KHR,166:je.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:je.COMPRESSED_RGBA_ASTC_8x5_KHR,168:je.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:je.COMPRESSED_RGBA_ASTC_8x6_KHR,170:je.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:je.COMPRESSED_RGBA_ASTC_8x8_KHR,172:je.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:je.COMPRESSED_RGBA_ASTC_10x5_KHR,174:je.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:je.COMPRESSED_RGBA_ASTC_10x6_KHR,176:je.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:je.COMPRESSED_RGBA_ASTC_10x8_KHR,178:je.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:je.COMPRESSED_RGBA_ASTC_10x10_KHR,180:je.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:je.COMPRESSED_RGBA_ASTC_12x10_KHR,182:je.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:je.COMPRESSED_RGBA_ASTC_12x12_KHR,184:je.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:je.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:je.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:je.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:je.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:je.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:je.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:je.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:je.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:je.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:je.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:je.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:je.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:je.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:je.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:je.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:je.COMPRESSED_RGBA_ASTC_12x12_KHR};const Ve=[171,75,84,88,32,50,48,187,13,10,26,10];function We(t){const e=new Uint8Array(t.buffer||t,t.byteOffset||0,Ve.length);return!(e[0]!==Ve[0]||e[1]!==Ve[1]||e[2]!==Ve[2]||e[3]!==Ve[3]||e[4]!==Ve[4]||e[5]!==Ve[5]||e[6]!==Ve[6]||e[7]!==Ve[7]||e[8]!==Ve[8]||e[9]!==Ve[9]||e[10]!==Ve[10]||e[11]!==Ve[11])}function $e(t){const e=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,Pe.length);if(e[0]!==Pe[0]||e[1]!==Pe[1]||e[2]!==Pe[2]||e[3]!==Pe[3]||e[4]!==Pe[4]||e[5]!==Pe[5]||e[6]!==Pe[6]||e[7]!==Pe[7]||e[8]!==Pe[8]||e[9]!==Pe[9]||e[10]!==Pe[10]||e[11]!==Pe[11])throw new Error("Missing KTX 2.0 identifier.");const r=new He,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Fe(t,Pe.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();const s=i._nextUint32();r.supercompressionScheme=i._nextUint32();const o=i._nextUint32(),a=i._nextUint32(),c=i._nextUint32(),u=i._nextUint32(),h=i._nextUint64(),l=i._nextUint64(),d=new Fe(t,Pe.length+n,3*s*8,!0);for(let e=0;e<s;e++)r.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const f=new Fe(t,o,a,!0),_={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:{x:f._nextUint8()+1,y:f._nextUint8()+1,z:f._nextUint8()+1,w:f._nextUint8()+1},bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},m=(_.descriptorBlockSize/4-6)/4;for(let t=0;t<m;t++)_.samples[t]={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelID:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:f._nextUint32(),sampleUpper:f._nextUint32()};r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(_);const S=new Fe(t,c,u,!0);for(;S._offset<u;){const t=S._nextUint32(),e=S._scan(t),n=Xe(e),i=S._scan(t-e.byteLength);r.keyValue[n]=n.match(/^ktx/i)?Xe(i):i,t%4&&S._skip(4-t%4)}if(l<=0)return r;const E=new Fe(t,h,l,!0),p=E._nextUint16(),R=E._nextUint16(),g=E._nextUint32(),A=E._nextUint32(),y=E._nextUint32(),T=E._nextUint32(),b=[];for(let t=0;t<s;t++)b.push({imageFlags:E._nextUint32(),rgbSliceByteOffset:E._nextUint32(),rgbSliceByteLength:E._nextUint32(),alphaSliceByteOffset:E._nextUint32(),alphaSliceByteLength:E._nextUint32()});const M=h+E._offset,C=M+g,w=C+A,D=w+y,P=new Uint8Array(t.buffer,t.byteOffset+M,g),O=new Uint8Array(t.buffer,t.byteOffset+C,A),x=new Uint8Array(t.buffer,t.byteOffset+w,y),I=new Uint8Array(t.buffer,t.byteOffset+D,T);return r.globalData={endpointCount:p,selectorCount:R,imageDescs:b,endpointsData:P,selectorsData:O,tablesData:x,extendedData:I},r}(new Uint8Array(t)),r=Math.max(1,e.levels.length),n=e.pixelWidth,i=e.pixelHeight,s=(o=e.vkFormat,qe[o]);var o;return ke(e.levels,{mipMapLevels:r,width:n,height:i,sizeFunction:t=>t.uncompressedByteLength,internalFormat:s})}const Ze={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4,PIXEL_FORMATS:{DXT1:je.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:je.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:je.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":je.COMPRESSED_RGB_ATC_WEBGL,ATCA:je.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:je.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},SIZE_FUNCTIONS:{DXT1:Ye,DXT3:Je,DXT5:Je,"ATC ":Ye,ATCA:Je,ATCI:Je}};function Qe(t){const e=new Int32Array(t,0,Ze.HEADER_LENGTH),r=e[Ze.HEADER_PF_FOURCC_INDEX];pt(Boolean(e[Ze.HEADER_PF_FLAGS_INDEX]&Ze.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");const n=(i=r,String.fromCharCode(255&i,i>>8&255,i>>16&255,i>>24&255));var i;const s=Ze.PIXEL_FORMATS[n],o=Ze.SIZE_FUNCTIONS[n];pt(s&&o,"DDS: Unknown pixel format "+r);let a=1;e[Ze.HEADER_FLAGS_INDEX]&Ze.DDSD_MIPMAPCOUNT&&(a=Math.max(1,e[Ze.MIPMAPCOUNT_INDEX]));const c=e[Ze.HEADER_WIDTH_INDEX],u=e[Ze.HEADER_HEIGHT_INDEX],h=e[Ze.HEADER_SIZE_INDEX]+4;return ke(new Uint8Array(t,h),{mipMapLevels:a,width:c,height:u,sizeFunction:o,internalFormat:s})}function Ye(t,e){return(t+3>>2)*(e+3>>2)*8}function Je(t,e){return(t+3>>2)*(e+3>>2)*16}const tr=55727696,er=1347834371,rr=13,nr=52,ir=0,sr=2,or=4,ar=6,cr=7,ur=11,hr=12,lr={0:[je.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[je.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[je.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[je.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[je.COMPRESSED_RGB_ETC1_WEBGL],7:[je.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[je.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[je.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[je.COMPRESSED_RGB8_ETC2],23:[je.COMPRESSED_RGBA8_ETC2_EAC],24:[je.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[je.COMPRESSED_R11_EAC],26:[je.COMPRESSED_RG11_EAC],27:[je.COMPRESSED_RGBA_ASTC_4X4_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[je.COMPRESSED_RGBA_ASTC_5X4_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[je.COMPRESSED_RGBA_ASTC_5X5_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[je.COMPRESSED_RGBA_ASTC_6X5_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[je.COMPRESSED_RGBA_ASTC_6X6_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[je.COMPRESSED_RGBA_ASTC_8X5_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[je.COMPRESSED_RGBA_ASTC_8X6_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[je.COMPRESSED_RGBA_ASTC_8X8_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[je.COMPRESSED_RGBA_ASTC_10X5_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[je.COMPRESSED_RGBA_ASTC_10X6_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[je.COMPRESSED_RGBA_ASTC_10X8_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[je.COMPRESSED_RGBA_ASTC_10X10_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[je.COMPRESSED_RGBA_ASTC_12X10_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[je.COMPRESSED_RGBA_ASTC_12X12_KHR,je.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},dr={0:fr,1:fr,2:_r,3:_r,6:mr,7:mr,9:Sr,11:Sr,22:mr,23:Sr,24:mr,25:mr,26:Sr,27:Sr,28:function(t,e){return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16},29:function(t,e){return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16},30:function(t,e){return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16},31:function(t,e){return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16},32:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16},33:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16},34:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16},35:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16},36:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16},37:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16},38:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16},39:function(t,e){return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16},40:function(t,e){return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16}};function fr(t,e){return(t=Math.max(t,16))*(e=Math.max(e,8))/4}function _r(t,e){return(t=Math.max(t,8))*(e=Math.max(e,8))/2}function mr(t,e){return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8}function Sr(t,e){return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16}function Er(t){if(We(t))return $e(t);if(function(t){return new Uint32Array(t,0,Ze.HEADER_LENGTH)[Ze.MAGIC_NUMBER_INDEX]===Ze.MAGIC_NUMBER}(t))return Qe(t);if(function(t){const e=new Uint32Array(t,0,rr)[ir];return e===tr||e===er}(t))return function(t){const e=new Uint32Array(t,0,rr),r=e[sr],n=e[or],i=lr[r]||[],s=i.length>1&&n?i[1]:i[0],o=dr[r],a=e[ur],c=e[cr],u=e[ar],h=nr+e[hr];return ke(new Uint8Array(t,h),{mipMapLevels:a,width:c,height:u,sizeFunction:o,internalFormat:s})}(t);throw new Error("Texture container format not recognized")}let pr,Rr;async function gr(t){const e=t.modules||{};return e.basis?e.basis:(pr=pr||async function(t){let e=null,r=null;return[e,r]=await Promise.all([await Me("basis_transcoder.js","textures",t),await Me("basis_transcoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise(e=>{t(r).then(t=>{const{BasisFile:r,initializeBasis:n}=t;n(),e({BasisFile:r})})})}(e,r)}(t),await pr)}async function Ar(t){const e=t.modules||{};return e.basisEncoder?e.basisEncoder:(Rr=Rr||async function(t){let e=null,r=null;return[e,r]=await Promise.all([await Me("https://unpkg.com/@loaders.gl/textures@3.1.0-alpha.5/dist/libs/basis_encoder.js","textures",t),await Me("https://unpkg.com/@loaders.gl/textures@3.1.0-alpha.5/dist/libs/basis_encoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise(e=>{t(r).then(t=>{const{BasisFile:r,KTX2File:n,initializeBasis:i,BasisEncoder:s}=t;i(),e({BasisFile:r,KTX2File:n,BasisEncoder:s})})})}(e,r)}(t),await Rr)}const yr=["","WEBKIT_","MOZ_"],Tr={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let br=null;function Mr(t){if(!br){t=t||function(){try{return document.createElement("canvas").getContext("webgl")}catch(t){return null}}()||void 0,br=new Set;for(const e of yr)for(const r in Tr)if(t&&t.getExtension(`${e}${r}`)){const t=Tr[r];br.add(t)}}return br}const Cr={etc1:{basisFormat:0,compressed:!0,format:je.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:je.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:je.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:je.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:je.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:je.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function wr(t,e){if("auto"===e.basis.containerFormat){if(We(t)){return Or((await Ar(e)).KTX2File,t,e)}const{BasisFile:r}=await gr(e);return Dr(r,t,e)}switch(e.basis.module){case"encoder":const r=await Ar(e);switch(e.basis.containerFormat){case"ktx2":return Or(r.KTX2File,t,e);case"basis":default:return Dr(r.BasisFile,t,e)}case"transcoder":default:const{BasisFile:n}=await gr(e);return Dr(n,t,e)}}function Dr(t,e,r){const n=new t(new Uint8Array(e));try{if(!n.startTranscoding())return null;const t=n.getNumImages(),e=[];for(let i=0;i<t;i++){const t=n.getNumLevels(i),s=[];for(let e=0;e<t;e++)s.push(Pr(n,i,e,r));e.push(s)}return e}finally{n.close(),n.delete()}}function Pr(t,e,r,n){const i=t.getImageWidth(e,r),s=t.getImageHeight(e,r),o=t.getHasAlpha(),{compressed:a,format:c,basisFormat:u}=Ir(n,o),h=t.getImageTranscodedSizeInBytes(e,r,u),l=new Uint8Array(h);return t.transcodeImage(l,e,r,u,0,0)?{width:i,height:s,data:l,compressed:a,hasAlpha:o,format:c}:null}function Or(t,e,r){const n=new t(new Uint8Array(e));try{if(!n.startTranscoding())return null;const t=n.getLevels(),e=[];for(let i=0;i<t;i++){e.push(xr(n,i,r));break}return e}finally{n.close(),n.delete()}}function xr(t,e,r){const{alphaFlag:n,height:i,width:s}=t.getImageLevelInfo(e,0,0),{compressed:o,format:a,basisFormat:c}=Ir(r,n),u=t.getImageTranscodedSizeInBytes(e,0,0,c),h=new Uint8Array(u);return t.transcodeImage(h,e,0,0,c,0,-1,-1)?{width:s,height:i,data:h,compressed:o,alphaFlag:n,format:a}:null}function Ir(t,e){let r=t&&t.basis&&t.basis.format;return"auto"===r&&(r=vr()),"object"==typeof r&&(r=e?r.alpha:r.noAlpha),r=r.toLowerCase(),Cr[r]}function vr(){const t=Mr();return t.has("astc")?"astc-4x4":t.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:t.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:t.has("etc1")?"etc1":t.has("etc2")?"etc2":"rgb565"}const Br={name:"Texture Containers",id:"compressed-texture",module:"textures",version:"3.1.0-alpha.5",worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},Gr={...Br,parse:async(t,e)=>e["compressed-texture"].useBasis?(e.basis={format:{alpha:"BC3",noAlpha:"BC1"},...e.basis,containerFormat:"ktx2",module:"encoder"},await wr(t,e)):Er(t)},Lr={name:"Basis",id:"basis",module:"textures",version:"3.1.0-alpha.5",worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},Nr={...Lr,parse:wr};function Ur(t,e=null){return e?`${t}?token=${e}`:t}var Hr=5121,Fr=5125,Xr=5126,kr=5130;const zr={UInt8:Uint8Array,UInt16:Uint16Array,UInt32:Uint32Array,Float32:Float32Array,UInt64:Float64Array},Kr={UInt8:Hr,UInt16:Fr,Float32:Xr,UInt32:Fr,UInt64:kr},jr={position:"position",normal:"normal",uv0:"uv0",color:"color",region:"region"},qr={vertexAttributes:"vertexAttributes",featureAttributeOrder:"featureAttributeOrder",featureAttributes:"featureAttributes"},Vr="header",Wr="vertexCount",$r="featureCount",Zr={UInt8:1,UInt16:2,UInt32:4,Float32:4,UInt64:8},Qr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0},Yr=new B([0,0,0]),Jr={jpeg:Ut,png:Ut,"ktx-etc2":Gr,dds:Gr,ktx2:Nr};async function tn(t,e,r,i,s){if(e.content=e.content||{},e.content.featureIds=e.content.featureIds||null,e.content.featureData=function(t,e){const r=e.store.defaultGeometrySchema,n=r;for(const t in qr)for(const e in jr){const i=r[t][e];if(i){const{byteOffset:r=0,count:s=0,valueType:o,valuesPerElement:a}=i;n[t][e]={valueType:o,valuesPerElement:a,byteOffset:r,count:s}}}return n.attributesOrder=r.ordering,n}(0,r),e.content.attributes={},e.textureUrl){var o;const t=Ur(e.textureUrl,null==i||null===(o=i.i3s)||void 0===o?void 0:o.token),r=Jr[e.textureFormat]||Ut,a=await fetch(t),c=await a.arrayBuffer();if(null!=i&&i.i3s.decodeTextures){if(r===Ut){const t={...e.textureLoaderOptions,image:{type:"data"}};try{e.content.texture=await s.parse(c,t)}catch(i){e.content.texture=await Object(n.parse)(c,r,t)}}else if(r===Gr||r===Nr){const t=await Object(n.load)(c,r,e.textureLoaderOptions);e.content.texture={compressed:!0,mipmaps:!1,width:t[0].width,height:t[0].height,data:t}}}else e.content.texture=c}return e.content.material=function(t,e){let r;t?r={...t,pbrMetallicRoughness:t.pbrMetallicRoughness?{...t.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},e?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]);r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase());r.emissiveFactor&&(r.emissiveFactor=sn(r.emissiveFactor));r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=sn(r.pbrMetallicRoughness.baseColorFactor));return function(t,e){const r={source:{image:e}};t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture?t.pbrMetallicRoughness.baseColorTexture={...t.pbrMetallicRoughness.baseColorTexture,texture:r}:t.emissiveTexture?t.emissiveTexture={...t.emissiveTexture,texture:r}:t.pbrMetallicRoughness&&t.pbrMetallicRoughness.metallicRoughnessTexture?t.pbrMetallicRoughness.metallicRoughnessTexture={...t.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:t.normalTexture?t.normalTexture={...t.normalTexture,texture:r}:t.occlusionTexture&&(t.occlusionTexture={...t.occlusionTexture,texture:r})}(r,e),r}(e.materialDefinition,e.content.texture),e.content.material&&(e.content.texture=null),await async function(t,e={},r,i){var s;if(!e.content)return e;const o=e.content;let a,c,u=0,h=0;if(e.isDracoGeometry){const e=await Object(n.parse)(t,De,{draco:{attributeNameEntry:"i3s-attribute-type"}});c=e.header.vertexCount;const r=e.indices.value,{POSITION:i,NORMAL:s,COLOR_0:o,TEXCOORD_0:u,"feature-index":h,"uv-region":l}=e.attributes;a={position:i,normal:s,color:o,uv0:u,uvRegion:l,id:h,indices:r},function(t,e){for(const r in e.loaderData.attributes){const n=e.loaderData.attributes[r];switch(n.name){case"POSITION":t.position.metadata=n.metadata;break;case"feature-index":t.id.metadata=n.metadata}}}(a,e);const d=function(t){return t&&t.metadata&&t.metadata["i3s-feature-ids"]&&t.metadata["i3s-feature-ids"].intArray}(h);d&&function(t,e){const r=t.id.value,n=new Float32Array(r.length);for(let t=0;t<r.length;t++)n[t]=e[r[t]];t.id.value=n}(a,d)}else{const{vertexAttributes:e,attributesOrder:r,featureAttributes:n,featureAttributeOrder:i}=o.featureData,s=function(t,e){let r=0,n=0,i=0;const s=t.featureData[Vr];for(const t in s){const{property:o,type:a}=s[t],c=zr[a];o===Wr&&(n=new c(e,0,4)[0],r+=Zr[a]),o===$r&&(i=new c(e,4,4)[0],r+=Zr[a])}return{vertexCount:n,featureCount:i,byteOffset:r}}(o,t);u=s.byteOffset,c=s.vertexCount,h=s.featureCount;const{attributes:l,byteOffset:d}=rn(t,u,e,c,r),{attributes:f}=rn(t,d,n,h,i);!function(t){const{id:e,faceRange:r}=t;if(!e||!r)return;const n=e.value,i=r.value,s=i[i.length-1]+1,o=new Uint32Array(3*s);let a=0,c=0;for(let t=1;t<i.length;t+=2){const e=Number(n[a]),r=i[t],s=i[t-1],u=c+3*(r-s+1);o.fill(e,c,u),a++,c=u}t.id.value=o}(f),a=function(t,e){return{...t,...e}}(l,f)}if(null!=r&&null!==(s=r.i3s)&&void 0!==s&&s.coordinateSystem&&r.i3s.coordinateSystem!==Qr.METER_OFFSETS)o.modelMatrix=function(t){var e,r;const n=t.metadata,i=(null==n||null===(e=n["i3s-scale_x"])||void 0===e?void 0:e.double)||1,s=(null==n||null===(r=n["i3s-scale_y"])||void 0===r?void 0:r.double)||1,o=new j;return o[0]=i,o[5]=s,o}(a.position),o.coordinateSystem=Qr.LNGLAT_OFFSETS;else{const{enuMatrix:t}=function(t,e){const r=e.mbs,n=t.value,i=t.metadata,s=new j,o=new B(r[0],r[1],r[2]),a=new B;return Et.WGS84.cartographicToCartesian(o,a),Et.WGS84.eastNorthUpToFixedFrame(a,s),t.value=function(t,e={},r){const n=new Float64Array(t.length),i=e["i3s-scale_x"]&&e["i3s-scale_x"].double||1,s=e["i3s-scale_y"]&&e["i3s-scale_y"].double||1;for(let e=0;e<n.length;e+=3)n[e]=t[e]*i+r.x,n[e+1]=t[e+1]*s+r.y,n[e+2]=t[e+2]+r.z;for(let t=0;t<n.length;t+=3)Et.WGS84.cartographicToCartesian(n.subarray(t,t+3),Yr),n[t]=Yr.x,n[t+1]=Yr.y,n[t+2]=Yr.z;return n}(n,i,o),{enuMatrix:s}}(a.position,e);o.modelMatrix=t.invert(),o.coordinateSystem=Qr.METER_OFFSETS}o.attributes={positions:a.position,normals:a.normal,colors:en(a.color),texCoords:a.uv0,uvRegions:en(a.uvRegion)},o.indices=a.indices||null,a.id&&a.id.value&&(e.content.featureIds=a.id.value);for(const t in o.attributes)o.attributes[t]||delete o.attributes[t];return o.vertexCount=c,o.byteLength=t.byteLength,e}(t,e,i)}function en(t){return t?(t.normalized=!0,t):t}function rn(t,e,r,n,i){const s={};for(const o of i)if(r[o]){const{valueType:i,valuesPerElement:a}=r[o],c=n;if(e+c*a>t.byteLength)break;const u=t.slice(e);let h=[];if("UInt64"===i)h=nn(u,c*a,Zr[i]);else{h=new(0,zr[i])(u,0,c*a)}switch(s[o]={value:h,type:Kr[i],size:a},o){case"color":s.color.normalized=!0}e+=c*a*Zr[i]}return{attributes:s,byteOffset:e}}function nn(t,e,r){const n=[],i=new DataView(t);let s=0;for(let t=0;t<e;t++){const t=i.getUint32(s,!0)+2**32*i.getUint32(s+4,!0);n.push(t),s+=r}return n}function sn(t){const e=[...t];for(let r=0;r<t.length;r++)e[r]=t[r]/255;return e}const on={name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:"3.1.0-alpha.5",mimeTypes:["application/octet-stream"],parse:async function(t,e,r){const{tile:n,tileset:i}=(null==e?void 0:e.i3s)||{};return await tn(t,n,i,e,r),n.content},extensions:["bin"],options:{"i3s-content":{}}};const an=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new B,new B;const cn=new B,un=new B;class hn{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new B,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=cn.from(e),this.center=(new B).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 hn(this.center,this.radius)}union(t){const e=this.center,r=this.radius,n=t.center,i=t.radius,s=cn.copy(n).subtract(e),o=s.magnitude();if(r>=o+i)return this.clone();if(i>=o+r)return t.clone();const a=.5*(r+o+i);return un.copy(s).scale((-r+a)/o).add(e),this.center.copy(un),this.radius=a,this}expand(t){const e=(t=cn.from(t)).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=U(cn,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){return(t=cn.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,n=t.normal.dot(e)+t.distance;return n<-r?an.OUTSIDE:n<r?an.INTERSECTING:an.INSIDE}}function ln(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=e[5],u=e[6],h=e[7],l=e[8],d=r[0],f=r[1],_=r[2],m=r[3],S=r[4],E=r[5],p=r[6],R=r[7],g=r[8];return t[0]=d*n+f*o+_*u,t[1]=d*i+f*a+_*h,t[2]=d*s+f*c+_*l,t[3]=m*n+S*o+E*u,t[4]=m*i+S*a+E*h,t[5]=m*s+S*c+E*l,t[6]=p*n+R*o+g*u,t[7]=p*i+R*a+g*h,t[8]=p*s+R*c+g*l,t}function dn(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}const fn=Object.freeze([1,0,0,0,1,0,0,0,1]),_n=Object.freeze([0,0,0,0,0,0,0,0,0]),mn=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Sn={};class En extends G{static get IDENTITY(){return Sn.IDENTITY=Sn.IDENTITY||Object.freeze(new En(fn)),Sn.IDENTITY}static get ZERO(){return Sn.ZERO=Sn.ZERO||Object.freeze(new En(_n)),Sn.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return mn}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,n,i,s,o,a,c){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=s,this[6]=o,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,r,n,i,s,o,a,c){return this[0]=t,this[1]=n,this[2]=o,this[3]=e,this[4]=i,this[5]=a,this[6]=r,this[7]=s,this[8]=c,this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],u=t[8],e*(u*s-o*c)+r*(-u*i+o*a)+n*(c*i-s*a);var t,e,r,n,i,s,o,a,c,u}identity(){return this.copy(fn)}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],o=r+r,a=n+n,c=i+i,u=r*o,h=n*o,l=n*a,d=i*o,f=i*a,_=i*c,m=s*o,S=s*a,E=s*c;t[0]=1-l-_,t[3]=h-E,t[6]=d+S,t[1]=h+E,t[4]=1-u-_,t[7]=f-m,t[2]=d-S,t[5]=f+m,t[8]=1-u-l}(this,t),this.check()}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}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(){var t,e,r,n,i,s,o,a,c,u,h,l,d,f,_;return t=this,r=(e=this)[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],u=e[7],h=e[8],(_=r*(l=h*o-a*u)+n*(d=-h*s+a*c)+i*(f=u*s-o*c))&&(_=1/_,t[0]=l*_,t[1]=(-h*n+i*u)*_,t[2]=(a*n-i*o)*_,t[3]=d*_,t[4]=(h*r-i*c)*_,t[5]=(-a*r+i*s)*_,t[6]=f*_,t[7]=(-u*r+n*c)*_,t[8]=(o*r-n*s)*_),this.check()}multiplyLeft(t){return ln(this,t,this),this.check()}multiplyRight(t){return ln(this,this,t),this.check()}rotate(t){var e,r,n,i,s,o,a,c,u,h,l,d,f,_;return e=this,n=t,i=(r=this)[0],s=r[1],o=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],d=r[8],f=Math.sin(n),_=Math.cos(n),e[0]=_*i+f*a,e[1]=_*s+f*c,e[2]=_*o+f*u,e[3]=_*a-f*i,e[4]=_*c-f*s,e[5]=_*u-f*o,e[6]=h,e[7]=l,e[8]=d,this.check()}scale(t){return Array.isArray(t)?dn(this,this,t):dn(this,this,[t,t,t]),this.check()}translate(t){var e,r,n,i,s,o,a,c,u,h,l,d,f,_;return e=this,n=t,i=(r=this)[0],s=r[1],o=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],d=r[8],f=n[0],_=n[1],e[0]=i,e[1]=s,e[2]=o,e[3]=a,e[4]=c,e[5]=u,e[6]=f*i+_*a+h,e[7]=f*s+_*c+l,e[8]=f*o+_*u+d,this.check()}transform(t,e){switch(t.length){case 2:r=e||[-0,-0],i=this,s=(n=t)[0],o=n[1],r[0]=i[0]*s+i[3]*o+i[6],r[1]=i[1]*s+i[4]*o+i[7],e=r;break;case 3:e=D(e||[-0,-0,-0],t,this);break;case 4:e=function(t,e,r){const n=e[0],i=e[1],s=e[2];return t[0]=r[0]*n+r[3]*i+r[6]*s,t[1]=r[1]*n+r[4]*i+r[7]*s,t[2]=r[2]*n+r[5]*i+r[8]*s,t[3]=e[3],t}(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}var r,n,i,s,o;return S(e,t.length),e}transformVector(t,e){return p("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return p("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return p("Matrix3.transformVector"),this.transform(t,e)}}function pn(){var t=new A(4);return A!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Rn(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function gn(t,e,r){var n=e[0],i=e[1],s=e[2],o=e[3],a=r[0],c=r[1],u=r[2],h=r[3];return t[0]=n*h+o*a+i*u-s*c,t[1]=i*h+o*c+s*a-n*u,t[2]=s*h+o*u+n*c-i*a,t[3]=o*h-n*a-i*c-s*u,t}function An(t,e,r,n){var i,s,o,a,c,u=e[0],h=e[1],l=e[2],d=e[3],f=r[0],_=r[1],m=r[2],S=r[3];return(s=u*f+h*_+l*m+d*S)<0&&(s=-s,f=-f,_=-_,m=-m,S=-S),1-s>g?(i=Math.acos(s),o=Math.sin(i),a=Math.sin((1-n)*i)/o,c=Math.sin(n*i)/o):(a=1-n,c=n),t[0]=a*u+c*f,t[1]=a*h+c*_,t[2]=a*l+c*m,t[3]=a*d+c*S,t}function yn(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+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 i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var s=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*s+s]-e[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*s+o]-e[3*o+s])*r,t[s]=(e[3*s+i]+e[3*i+s])*r,t[o]=(e[3*o+i]+e[3*i+o])*r}return t}var Tn,bn,Mn,Cn,wn,Dn,Pn,On=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},xn=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},In=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},vn=function(t,e,r,n){var i=e[0],s=e[1],o=e[2],a=e[3];return t[0]=i+n*(r[0]-i),t[1]=s+n*(r[1]-s),t[2]=o+n*(r[2]-o),t[3]=a+n*(r[3]-a),t},Bn=H,Gn=F,Ln=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],o=r*r+n*n+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=s*o,t},Nn=(Tn=y(),bn=b(1,0,0),Mn=b(0,1,0),function(t,e,r){var n=M(e,r);return n<-.999999?(C(Tn,bn,e),O(Tn)<1e-6&&C(Tn,Mn,e),function(t,e){var r=e[0],n=e[1],i=e[2],s=r*r+n*n+i*i;s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s}(Tn,Tn),Rn(t,Tn,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(C(Tn,e,r),t[0]=Tn[0],t[1]=Tn[1],t[2]=Tn[2],t[3]=1+n,Ln(t,t))});Cn=pn(),wn=pn(),Dn=new A(9),A!=Float32Array&&(Dn[1]=0,Dn[2]=0,Dn[3]=0,Dn[5]=0,Dn[6]=0,Dn[7]=0),Dn[0]=1,Dn[4]=1,Dn[8]=1,Pn=Dn;const Un=[0,0,0,1];class Hn extends _{constructor(t=0,e=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,r,n)}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,n){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this.check()}fromMatrix3(t){return yn(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 Rn(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 Bn(this)}lengthSquared(){return Gn(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return In(this,t)}rotationTo(t,e){return Nn(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return On(this,this,t),this.check()}calculateW(){return function(t,e){var r=e[0],n=e[1],i=e[2];t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i))}(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],n=e[1],i=e[2],s=e[3],o=r*r+n*n+i*i+s*s,a=o?1/o:0;t[0]=-r*a,t[1]=-n*a,t[2]=-i*a,t[3]=s*a}(this,this),this.check()}lerp(t,e,r){return vn(this,t,e,r),this.check()}multiplyRight(t,e){return i(!e),gn(this,this,t),this.check()}multiplyLeft(t,e){return i(!e),gn(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 n=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+o*a,t[1]=i*c+s*a,t[2]=s*c-i*a,t[3]=o*c-n*a}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c-s*a,t[1]=i*c+o*a,t[2]=s*c+n*a,t[3]=o*c-i*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+i*a,t[1]=i*c-n*a,t[2]=s*c+o*a,t[3]=o*c-s*a}(this,this,t),this.check()}scale(t){return xn(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=Un,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return An(this,t,e,r),this.check()}transformVector4(t,e=t){return function(t,e,r){var n=e[0],i=e[1],s=e[2],o=r[0],a=r[1],c=r[2],u=r[3],h=u*n+a*s-c*i,l=u*i+c*n-o*s,d=u*s+o*i-a*n,f=-o*n-a*i-c*s;t[0]=h*u+f*-o+l*-c-d*-a,t[1]=l*u+f*-a+d*-o-h*-c,t[2]=d*u+f*-c+h*-a-l*-o,t[3]=e[3]}(e,t,this),S(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 Fn=new B,Xn=new B,kn=new B,zn=new B,Kn=new B,jn=new B,qn=new B,Vn=0,Wn=1,$n=2,Zn=3,Qn=4,Yn=5,Jn=6,ti=7,ei=8;class ri{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=(new B).from(t),this.halfAxes=new En(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new B(t).len(),new B(e).len(),new B(r).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new B(t).normalize(),i=new B(e).normalize(),s=new B(r).normalize();return(new Hn).fromMatrix3(new En([...n,...i,...s]))}fromCenterHalfSizeQuaternion(t,e,r){const n=new Hn(r),i=(new En).fromQuaternion(n);return i[0]=i[0]*e[0],i[1]=i[1]*e[0],i[2]=i[2]*e[0],i[3]=i[3]*e[1],i[4]=i[4]*e[1],i[5]=i[5]*e[1],i[6]=i[6]*e[2],i[7]=i[7]*e[2],i[8]=i[8]*e[2],this.center=(new B).from(t),this.halfAxes=i,this}clone(){return new ri(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new hn){const e=this.halfAxes,r=e.getColumn(0,kn),n=e.getColumn(1,zn),i=e.getColumn(2,Kn),s=Fn.copy(r).add(n).add(i);return t.center.copy(this.center),t.radius=s.magnitude(),t}intersectPlane(t){const e=this.center,r=t.normal,n=this.halfAxes,i=r.x,s=r.y,o=r.z,a=Math.abs(i*n[Vn]+s*n[Wn]+o*n[$n])+Math.abs(i*n[Zn]+s*n[Qn]+o*n[Yn])+Math.abs(i*n[Jn]+s*n[ti]+o*n[ei]),c=r.dot(e)+t.distance;return c<=-a?an.OUTSIDE:c>=a?an.INSIDE:an.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Xn.from(t).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,kn),i=r.getColumn(1,zn),s=r.getColumn(2,Kn),o=n.magnitude(),a=i.magnitude(),c=s.magnitude();n.normalize(),i.normalize(),s.normalize();let u,h=0;return u=Math.abs(e.dot(n))-o,u>0&&(h+=u*u),u=Math.abs(e.dot(i))-a,u>0&&(h+=u*u),u=Math.abs(e.dot(s))-c,u>0&&(h+=u*u),h}computePlaneDistances(t,e,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const s=this.center,o=this.halfAxes,a=o.getColumn(0,kn),c=o.getColumn(1,zn),u=o.getColumn(2,Kn),h=jn.copy(a).add(c).add(u).add(s),l=qn.copy(h).subtract(t);let d=e.dot(l);return n=Math.min(d,n),i=Math.max(d,i),h.copy(s).add(a).add(c).subtract(u),l.copy(h).subtract(t),d=e.dot(l),n=Math.min(d,n),i=Math.max(d,i),h.copy(s).add(a).subtract(c).add(u),l.copy(h).subtract(t),d=e.dot(l),n=Math.min(d,n),i=Math.max(d,i),h.copy(s).add(a).subtract(c).subtract(u),l.copy(h).subtract(t),d=e.dot(l),n=Math.min(d,n),i=Math.max(d,i),s.copy(h).subtract(a).add(c).add(u),l.copy(h).subtract(t),d=e.dot(l),n=Math.min(d,n),i=Math.max(d,i),s.copy(h).subtract(a).add(c).subtract(u),l.copy(h).subtract(t),d=e.dot(l),n=Math.min(d,n),i=Math.max(d,i),s.copy(h).subtract(a).subtract(c).add(u),l.copy(h).subtract(t),d=e.dot(l),n=Math.min(d,n),i=Math.max(d,i),s.copy(h).subtract(a).subtract(c).subtract(u),l.copy(h).subtract(t),d=e.dot(l),n=Math.min(d,n),i=Math.max(d,i),r[0]=n,r[1]=i,r}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,kn);e.transformAsPoint(t);const r=this.halfAxes.getColumn(1,zn);r.transformAsPoint(t);const n=this.halfAxes.getColumn(2,Kn);return n.transformAsPoint(t),this.halfAxes=new En([...e,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const ni=new B,ii=new B;class si{constructor(t=[0,0,1],e=0){this.normal=new B,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return i(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=ni.from(t),this.normal.from(e).normalize();const r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,e,r,n){return this.normal.set(t,e,r),i(f(this.normal.len(),1)),this.distance=n,this}clone(t){return new si(this.normal,this.distance)}equals(t){return f(this.distance,t.distance)&&f(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=ii.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=ni.from(t);const r=this.getPointDistance(t),n=ii.copy(this.normal).scale(r);return t.subtract(n).to(e)}}new B([1,0,0]),new B([0,1,0]),new B([0,0,1]),new B,new B,new si(new B(1,0,0),0);new B,new B,new B,new B,new B;new B,new B,new B,new B,new B,new B,new B,new B,new B,new B,new B,new B,Math.PI;new En,new En,new En,new En,new En;new B,new B,new B,new B,new B,new En,new En,new En;const oi=2,ai="mesh",ci="I3S";async function ui(t){return JSON.parse((new TextDecoder).decode(t))}const hi={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:"3.1.0-alpha.5",mimeTypes:["application/json"],parse:async function(t){return t=ui(t)},extensions:["json"],options:{}};function li(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class di{constructor(t,e){li(this,"tileset",void 0),li(this,"nodePages",[]),li(this,"pendingNodePages",[]),li(this,"nodesPerPage",void 0),li(this,"options",void 0),li(this,"lodSelectionMetricType",void 0),li(this,"textureDefinitionsSelectedFormats",[]),li(this,"textureLoaderOptions",{}),this.tileset={...t},this.nodesPerPage=t.nodePages.nodesPerPage,this.lodSelectionMetricType=t.nodePages.lodSelectionMetricType,this.options=e,this.initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){const e=Math.floor(t/this.nodesPerPage);if(!this.nodePages[e]&&!this.pendingNodePages[e]){var r;const t=Ur(`${this.tileset.url}/nodepages/${e}`,null===(r=this.options.i3s)||void 0===r?void 0:r.token);this.pendingNodePages[e]={status:"Pending",promise:Object(n.load)(t,hi,this.options)},this.nodePages[e]=await this.pendingNodePages[e].promise,this.pendingNodePages[e].status="Done"}"Pending"===this.pendingNodePages[e].status&&(this.nodePages[e]=await this.pendingNodePages[e].promise);const i=t%this.nodesPerPage;return this.nodePages[e].nodes[i]}async formTileFromNodePages(t){const e=await this.getNodeById(t),r=[];for(const t of e.children||[]){const e=await this.getNodeById(t);r.push({id:t,obb:e.obb})}let n=null,i=null,s=null,o="jpeg",a=[],c=!1;if(e&&e.mesh){const{url:t,isDracoGeometry:r}=e.mesh.geometry&&this.getContentUrl(e.mesh.geometry)||{url:null,isDracoGeometry:null};n=t,c=r;const[u,h]=this.getInformationFromMaterial(e.mesh.material);s=h,o=u.format||o,u.name&&(i=`${this.tileset.url}/nodes/${e.mesh.material.resource}/textures/${u.name}`),this.tileset.attributeStorageInfo&&(a=function(t,e){const r=[],{attributeStorageInfo:n,url:i}=t;for(let t=0;t<n.length;t++){const s=n[t].key;r.push(`${i}/nodes/${e}/attributes/${s}/0`)}return r}(this.tileset,e.mesh.attribute.resource))}return fi({id:t,lodSelection:this.getLodSelection(e),obb:e.obb,contentUrl:n,textureUrl:i,attributeUrls:a,materialDefinition:s,textureFormat:o,textureLoaderOptions:this.textureLoaderOptions,children:r,isDracoGeometry:c})}getContentUrl(t){let e={};const r=this.tileset.geometryDefinitions[t.definition];let n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=r.geometryBuffers.findIndex(t=>t.compressedAttributes&&"draco"===t.compressedAttributes.encoding)),-1===n&&(n=r.geometryBuffers.findIndex(t=>!t.compressedAttributes)),-1!==n){const i=Boolean(r.geometryBuffers[n].compressedAttributes);e={url:`${this.tileset.url}/nodes/${t.resource}/geometries/${n}`,isDracoGeometry:i}}return e}getLodSelection(t){const e=[];return"maxScreenThresholdSQ"===this.lodSelectionMetricType&&e.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(t.lodThreshold/(.25*Math.PI))}),e.push({metricType:this.lodSelectionMetricType,maxError:t.lodThreshold}),e}getInformationFromMaterial(t){const e={name:null,format:null};if(t){const r=this.tileset.materialDefinitions[t.definition],n=r&&r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId;if(n||0===n){return[this.textureDefinitionsSelectedFormats[n]||e,r]}return[e,r]}return[e,null]}initSelectedFormatsForTextureDefinitions(t){this.textureDefinitionsSelectedFormats=[];const e=this.getSupportedTextureFormats(),r=t.textureSetDefinitions||[];for(const t of r){const r=t&&t.formats||[];let n=null;for(const t of e){const e=r.find(e=>e.format===t);if(e){n=e;break}}n&&"ktx2"===n.format&&(this.textureLoaderOptions.basis={format:vr(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(n)}}getSupportedTextureFormats(){const t=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){const e=Mr();e.has("etc2")&&t.push("ktx-etc2"),e.has("dxt")&&t.push("dds"),t.push("ktx2")}return t.push("jpg"),t.push("png"),t}}function fi(t){const e=t.obb?[...Et.WGS84.cartographicToCartesian(t.obb.center),...t.obb.halfSize,...t.obb.quaternion]:void 0;let r;if(t.mbs)r=[...Et.WGS84.cartographicToCartesian(t.mbs.slice(0,3)),t.mbs[3]];else if(e){const n=(new ri).fromCenterHalfSizeQuaternion(e.slice(0,3),t.obb.halfSize,t.obb.quaternion).getBoundingSphere();r=[...n.center,n.radius],t.mbs=[...t.obb.center,n.radius]}return t.boundingVolume={sphere:r,box:e},t.lodMetricType=t.lodSelection[0].metricType,t.lodMetricValue=t.lodSelection[0].maxError,t.transformMatrix=t.transform,t.type=ai,t.refine=oi,t}const _i=/layers\/[0-9]+$/,mi=/nodes\/([0-9-]+|root)$/,Si={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:"3.1.0-alpha.5",mimeTypes:["application/octet-stream"],parse:async function(t,e,r){const i=r.url;e.i3s=e.i3s||{};if("504b0304"===function(t){if(t instanceof ArrayBuffer)return[...new Uint8Array(t,0,4)].map(t=>t.toString(16).padStart(2,"0")).join("");return null}(t))throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let s,o;s="auto"===e.i3s.isTileset?_i.test(i):e.i3s.isTileset;o="auto"===e.isTileHeader?mi.test(i):e.i3s.isTileHeader;s?t=await async function(t,e,r){const i=JSON.parse((new TextDecoder).decode(t));return i.loader=Si,await async function(t,e,r){if(t.url=r.url,t.nodePages)t.nodePagesTile=new di(t,e),t.root=await t.nodePagesTile.formTileFromNodePages(0);else{var i;const r=Ur(t.url+"/nodes/root",null===(i=e.i3s)||void 0===i?void 0:i.token);t.root=await Object(n.load)(r,t.loader,{i3s:{loadContent:!1,isTileHeader:!0,isTileset:!1}})}t.basePath=t.url,t.type=ci,t.lodMetricType=t.root.lodMetricType,t.lodMetricValue=t.root.lodMetricValue}(i,e,r),i}(t,e,r):o?(t=await async function(t,e,r){return function(t,e,r){return t.url=r.url,t.featureData&&(t.featureUrl=`${t.url}/${t.featureData[0].href}`),t.geometryData&&(t.contentUrl=`${t.url}/${t.geometryData[0].href}`),t.textureData&&(t.textureUrl=`${t.url}/${t.textureData[0].href}`),t.attributeData&&(t.attributeUrls=function(t){const{url:e,attributeData:r}=t,n=[];for(let t=0;t<r.length;t++){const i=r[t].href.replace("./","");n.push(`${e}/${i}`)}return n}(t)),fi(t)}(t=JSON.parse((new TextDecoder).decode(t)),0,r)}(t,0,r),e.i3s.loadContent&&(e.i3s.tile=t,await Object(n.load)(t.contentUrl,Si,e))):t=await async function(t,e){return await Object(n.parse)(t,on,e)}(t,e);return t},extensions:["bin"],options:{i3s:{loadContent:!0,token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:Qr.METER_OFFSETS}}};async function Ei(t,e){const{attributeName:r,attributeType:n}=e;return r?{[r]:n?pi(n,t):null}:{}}function pi(t,e){switch(t){case"String":return function(t){const e=[];try{const r=new DataView(t,0,4).getUint32(0,!0),n=new Uint32Array(t,8,r);let i=8+4*r;for(const r of n){const n=new TextDecoder("utf-8"),s=new Uint8Array(t,i,r);e.push(n.decode(s)),i+=r}}catch(t){console.error("Parse string attribute error: ",t.message)}return e}(e);case"Oid32":return Ri(e);case"Float64":return function(t){return new Float64Array(t,8)}(e);case"Int16":return function(t){return new Int16Array(t,4)}(e);default:return Ri(e)}}function Ri(t){return new Uint32Array(t,4)}const gi={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:"3.1.0-alpha.5",mimeTypes:["application/binary"],parse:async function(t,e){return t=Ei(t,e)},extensions:["bin"],options:{},binary:!0};async function Ai(t,e,r={}){const{attributeStorageInfo:i,attributeUrls:s,tilesetFields:o}=function(t){var e,r,n,i,s;const o=null===(e=t.tileset)||void 0===e||null===(r=e.tileset)||void 0===r?void 0:r.attributeStorageInfo,a=null===(n=t.header)||void 0===n?void 0:n.attributeUrls,c=(null===(i=t.tileset)||void 0===i||null===(s=i.tileset)||void 0===s?void 0:s.fields)||[];return{attributeStorageInfo:o,attributeUrls:a,tilesetFields:c}}(t);if(!i||!s||!e)return null;let a=[];const c=[];for(let t=0;t<i.length;t++){var u;const e=Ur(s[t],null===(u=r.i3s)||void 0===u?void 0:u.token),o=i[t].name,a=yi(i[t]),h={...r,attributeName:o,attributeType:a},l=Object(n.load)(e,gi,h);c.push(l)}try{a=await Promise.allSettled(c)}catch(t){}return a.length?function(t,e,r,n){const i=function(t){const e=t.find(t=>t.name.includes("OBJECTID"));return null==e?void 0:e.name}(e),s=t.find(t=>t.value[i]);if(!s)return null;const o=s.value[i].indexOf(r);if(o<0)return null;return function(t,e,r,n){const i={};for(let s=0;s<r.length;s++){const o=r[s].name,a=Ti(o,n),c=bi(t,s,o);i[o]=Mi(c,e,a)}return i}(t,o,e,n)}(a,i,e,o):null}function yi(t){return t.hasOwnProperty("objectIds")?"Oid32":t.hasOwnProperty("attributeValues")?t.attributeValues.valueType:""}function Ti(t,e){var r;const n=e.find(e=>e.name===t||e.alias===t);return(null==n||null===(r=n.domain)||void 0===r?void 0:r.codedValues)||[]}function bi(t,e,r){const n=t[e];return"rejected"===n.status?null:n.value[r]}function Mi(t,e,r){let n="";if(t&&e in t&&(n=String(t[e]).replace(/\u0000|NaN/g,"").trim()),r.length){const t=r.find(t=>t.code===Number(n));n=(null==t?void 0:t.name)||""}return n}function Ci(t,e){let r=[];for(let i=0;i<t.length;i++){var n;const s=t[i],{id:o,layerType:a,visibility:c=!0,...u}=s;if("3DObject"===a){const t=`${e}/sublayers/${o}`;r.push({url:t,id:o,layerType:a,visibility:c,...u})}null!=s&&null!==(n=s.sublayers)&&void 0!==n&&n.length&&(r=[...r,...Ci(s.sublayers,e)])}return r}const wi={name:"I3S Building Scene Layer",id:"i3s-building-scene-layer",module:"i3s",version:"3.1.0-alpha.5",mimeTypes:["application/json"],parse:async function(t,e,r){if(null==r||!r.url)throw new Error("Url is not provided");return async function(t,e){const r=JSON.parse((new TextDecoder).decode(t)),{sublayers:n}=r;return{header:r,sublayers:Ci(n,e)}}(t,r.url)},extensions:["json"],options:{}}},,,,function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return i}));"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof document&&document;const i=Boolean("object"!=typeof n||"[object process]"!==String(n)||n.browser),s=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);s&&parseFloat(s[1])}).call(this,r(7),r(8))}])}));
2
- //# sourceMappingURL=dist.min.js.map