itowns
Version:
A JS/WebGL framework for 3D geospatial data visualization
2 lines • 2.02 MB
JavaScript
/*! For license information please see itowns.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("itowns",[],t):"object"==typeof exports?exports.itowns=t():e.itowns=t()}(self,(()=>(()=>{var e,t={80353:(e,t,r)=>{"use strict";r.d(t,{tC:()=>n,NT:()=>j,E$:()=>I,C1:()=>c,zR:()=>V,SZ:()=>i,Ql:()=>a});var n={};r.r(n),r.d(n,{UNIT:()=>u,axisOrder:()=>x,defs:()=>_,getUnit:()=>f,is4326:()=>d,isGeocentric:()=>A,isGeographic:()=>g,isMetricUnit:()=>m,isValid:()=>y,reasonableEpsilon:()=>v});var i={};r.r(i),r.d(i,{quaternionFromAttitude:()=>re,quaternionFromCRSToCRS:()=>fe,quaternionFromCRSToEnu:()=>pe,quaternionFromEnuToCRS:()=>de,quaternionFromEnuToGeocent:()=>ne,quaternionFromEnuToLCC:()=>oe,quaternionFromEnuToLongLat:()=>he,quaternionFromEnuToTMerc:()=>le,quaternionFromGeocentToEnu:()=>ie,quaternionFromLCCToEnu:()=>se,quaternionFromLongLatToEnu:()=>ce,quaternionFromOmegaPhiKappa:()=>te,quaternionFromRollPitchHeading:()=>ee,quaternionFromTMercToEnu:()=>ae,quaternionUnimplemented:()=>ue});var s=r(39437),o=r(68721);const a=new s.Vector3(o.A.WGS84.a,o.A.WGS84.a,o.A.WGS84.b),l=new s.Vector3,c=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;this.size=new s.Vector3,this._radiiSquared=new s.Vector3,this._invRadiiSquared=new s.Vector3,this.eccentricity=0,this.setSize(e)}geodeticSurfaceNormal(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Vector3;return e.toVector3(t).multiply(this._invRadiiSquared).normalize()}geodeticSurfaceNormalCartographic(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Vector3;const r=s.MathUtils.degToRad(e.longitude),n=s.MathUtils.degToRad(e.latitude),i=Math.cos(n);return t.set(i*Math.cos(r),i*Math.sin(r),Math.sin(n))}setSize(e){return this.size.set(e.x,e.y,e.z),this._radiiSquared.multiplyVectors(e,e),this._invRadiiSquared.x=0===e.x?0:1/this._radiiSquared.x,this._invRadiiSquared.y=0===e.y?0:1/this._radiiSquared.y,this._invRadiiSquared.z=0===e.z?0:1/this._radiiSquared.z,this.eccentricity=Math.sqrt(this._radiiSquared.x-this._radiiSquared.z)/this.size.x,this}cartographicToCartesian(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Vector3;l.copy(e.geodesicNormal),t.multiplyVectors(this._radiiSquared,l);const r=Math.sqrt(l.dot(t));return t.divideScalar(r),l.multiplyScalar(e.altitude),t.add(l)}cartesianToCartographic(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new I("EPSG:4326",0,0,0);const r=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z),n=this.size.x,i=this.size.z,o=Math.abs((n*n-i*i)/(n*n)),a=1-Math.sqrt(1-o),l=Math.sqrt(e.x*e.x+e.y*e.y),c=Math.atan2(e.y,e.x),h=Math.atan(e.z/l*(1-a+o*n/r)),u=Math.sin(h),d=Math.cos(h),p=Math.atan((e.z*(1-a)+o*n*u*u*u)/((1-a)*(l-o*n*d*d*d))),f=l*Math.cos(p)+e.z*Math.sin(p)-n*Math.sqrt(1-o*Math.sin(p)*Math.sin(p));return t.setFromValues(s.MathUtils.radToDeg(c),s.MathUtils.radToDeg(p),f)}cartographicToCartesianArray(e){const t=[];for(let r=0;r<e.length;r++)t.push(this.cartographicToCartesian(e[r]));return t}intersection(e){const t=1e-4,r=e.origin,n=e.direction,i=n.x*n.x*this._invRadiiSquared.x+n.y*n.y*this._invRadiiSquared.y+n.z*n.z*this._invRadiiSquared.z,o=2*r.x*n.x*this._invRadiiSquared.x+2*r.y*n.y*this._invRadiiSquared.y+2*r.z*n.z*this._invRadiiSquared.z,a=r.x*r.x*this._invRadiiSquared.x+r.y*r.y*this._invRadiiSquared.y+r.z*r.z*this._invRadiiSquared.z-1;let l=o*o-4*i*a;if(l<0||0===i||0===o||0===a)return!1;l=Math.sqrt(l);const c=(-o+l)/(2*i),h=(-o-l)/(2*i);if(c<=t&&h<=t)return!1;let u=0;if(u=c<=t?h:h<=t||c<h?c:h,u<t)return!1;const d=new s.Vector3;return d.addVectors(e.origin,n.clone().setLength(u)),d}geodesicDistance(e,t){const r=s.MathUtils.degToRad(e.longitude),n=s.MathUtils.degToRad(e.latitude),i=s.MathUtils.degToRad(t.longitude),o=s.MathUtils.degToRad(t.latitude),a=Math.acos(Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos(i-r)),l=this.eccentricity,c=.5*(n+o),h=(l*Math.sin(c))**2,u=this.size.x*(1-l**2)/(1-h)**1.5,d=this.size.x/Math.sqrt(1-h);return a*Math.sqrt(u*d)}};function h(e){if(!("string"==typeof(t=e)||t instanceof String))throw new Error(`Crs parameter value must be a string: '${e}'`);var t}o.A.defs("EPSG:4978","+proj=geocent +datum=WGS84 +units=m +no_defs"),o.A.defs("EPSG:4326").axis="neu",o.A.defs("EPSG:4269").axis="neu",o.A.defs("WGS84").axis="neu";const u={DEGREE:1,METER:2,FOOT:3};function d(e){return"EPSG:4326"===e}function p(e){return"degrees"===e.units?u.DEGREE:"m"===e.units||"meter"===e.units?u.METER:"foot"===e.units?u.FOOT:void 0===e.units&&void 0===e.to_meter?u.METER:void 0}function f(e){h(e);const t=o.A.defs(e);if(t)return p(t)}function m(e){return f(e)===u.METER}function g(e){return f(e)===u.DEGREE}function A(e){h(e);const t=o.A.defs(e);return!!t&&"geocent"==t.projName}function y(e){const t=o.A.defs(e);if(!t)throw new Error(`Undefined crs '${e}'. Add it with proj4.defs('${e}', string)`);if(!p(t))throw new Error(`No valid unit found for crs '${e}', found ${t.units}`)}function v(e){return d(e)?.01:.001}function x(e){h(e);const t=o.A.defs(e);return t?t.axis:void 0}const _=(e,t)=>o.A.defs(e,t),b=new c,w={},E=new s.Vector3,M=new s.Vector3;let S,C;class T{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.isCoordinates=!0,y(e),this.crs=e,this.x=0,this.y=0,this.z=0,this._normal=new s.Vector3,t.length>0?(console.warn("Deprecated Coordinates#constructor(string, number[]),","use `new Coordinates(string).setFromArray(number[])` instead."),this.setFromArray(t)):t.isVector3||t.isCoordinates?(console.warn("Deprecated Coordinates#constructor(string, Vector3),","use `new Coordinates(string).setFromVector3(Vector3)` instead."),this.setFromVector3(t)):this.setFromValues(t,r,n),this._normalNeedsUpdate=!0}setCrs(e){return y(e),this.crs=e,this}setFromValues(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.x=e,this.y=t,this.z=r,this._normalNeedsUpdate=!0,this}setFromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.setFromValues(e[t],e[t+1],e[t+2])}setFromVector3(e){return this.setFromValues(e.x,e.y,e.z)}clone(){return new T(this.crs,this.x,this.y,this.z)}copy(e){return this.crs=e.crs,this.setFromVector3(e)}get longitude(){return this.x}get latitude(){return this.y}get altitude(){return this.z}set altitude(e){this.z=e}get geodesicNormal(){return this._normalNeedsUpdate&&(this._normalNeedsUpdate=!1,d(this.crs)?b.geodeticSurfaceNormalCartographic(this,this._normal):"EPSG:4978"==this.crs?b.geodeticSurfaceNormal(this,this._normal):this._normal.set(0,0,1)),this._normal}toVector3(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.Vector3).copy(this)}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return s.Vector3.prototype.toArray.call(this,e,t)}planarDistanceTo(e){return this.toVector3(E).setZ(0),e.toVector3(M).setZ(0),E.distanceTo(M)}geodeticDistanceTo(e){return this.as("EPSG:4326",S),e.as("EPSG:4326",C),b.geodesicDistance(S,C)}spatialEuclideanDistanceTo(e){return this.as("EPSG:4978",S).toVector3(E),e.as("EPSG:4978",C).toVector3(M),E.distanceTo(M)}applyMatrix4(e){return s.Vector3.prototype.applyMatrix4.call(this,e),this}as(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new T(e);var r,n;return this.crs==e?t.copy(this):(d(this.crs)&&"EPSG:3857"==e&&(this.y=s.MathUtils.clamp(this.y,-89.999999,89.999999)),t.setFromArray((r=this.crs,n=e,w[r]||(w[r]={}),w[r][n]||(w[r][n]=(0,o.A)(r,n)),w[r][n]).forward([this.x,this.y,this.z]))),t.crs=e,t}}S=new T("EPSG:4326",0,0,0),C=new T("EPSG:4326",0,0,0);const I=T,R=new s.Vector2,B=new s.Vector2,L=new s.Box3,P=new s.Vector2(2,2),D=new I("EPSG:4326",0,0,0),O=new I("EPSG:4326",0,0,0),F=new I("EPSG:4326",0,0,0),U=new s.Vector3,N=new s.Vector3;let k;const z=new Array(8);for(let e=z.length-1;e>=0;e--)z[e]=new I("EPSG:4326",0,0,0);const G=new I("EPSG:4326",0,0);class Q{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(A(e))throw new Error(`Non-compatible geocentric projection ${e} to build a geographical extent`);this.isExtent=!0,this.crs=e,this.west=0,this.east=0,this.south=0,this.north=0,this.set(t,r,n,i)}clone(){return new Q(this.crs,this.west,this.east,this.south,this.north)}as(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Q("EPSG:4326");if(y(e),this.crs!=e){const r=this.center(G);z[0].setFromValues(this.west,this.north),z[1].setFromValues(r.x,this.north),z[2].setFromValues(this.east,this.north),z[3].setFromValues(this.east,r.y),z[4].setFromValues(this.east,this.south),z[5].setFromValues(r.x,this.south),z[6].setFromValues(this.west,this.south),z[7].setFromValues(this.west,r.y),t.set(1/0,-1/0,1/0,-1/0);for(let r=0;r<z.length;r++)z[r].crs=this.crs,z[r].as(e,G),t.north=Math.max(t.north,G.y),t.south=Math.min(t.south,G.y),t.east=Math.max(t.east,G.x),t.west=Math.min(t.west,G.x);return t.crs=e,t}return t.crs=e,t.set(this.west,this.east,this.south,this.north),t}center(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new I(this.crs);return this.planarDimensions(R),e.crs=this.crs,e.setFromValues(this.west+.5*R.x,this.south+.5*R.y),e}planarDimensions(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.Vector2).set(Math.abs(this.east-this.west),Math.abs(this.north-this.south))}geodeticDimensions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.Vector2;return D.crs=this.crs,O.crs=this.crs,F.crs=this.crs,D.setFromValues(this.west,this.north,0),O.setFromValues(this.west,this.south,0),F.setFromValues(this.east,this.north,0),e.set(D.geodeticDistanceTo(F),D.geodeticDistanceTo(O))}spatialEuclideanDimensions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.Vector2;return D.crs=this.crs,O.crs=this.crs,F.crs=this.crs,D.setFromValues(this.west,this.north,0),O.setFromValues(this.west,this.south,0),F.setFromValues(this.east,this.north,0),e.set(D.spatialEuclideanDistanceTo(F),D.spatialEuclideanDistanceTo(O))}isPointInside(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.crs==e.crs?G.copy(e):e.as(this.crs,G),G.x<=this.east+t&&G.x>=this.west-t&&G.y<=this.north+t&&G.y>=this.south-t}isInside(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v(this.crs);return e.as(this.crs,k),this.east-k.east<=t&&k.west-this.west<=t&&this.north-k.north<=t&&k.south-this.south<=t}offsetToParent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Vector4;if(this.crs!=e.crs)throw new Error("unsupported mix");e.planarDimensions(R),this.planarDimensions(B);const r=(this.west-e.west)/R.x,n=(e.north-this.north)/R.y,i=B.x/R.x,o=B.y/R.y;return t.set(r,n,i,o)}intersectsExtent(e){return Q.intersectsExtent(this,e)}static intersectsExtent(e,t){const r=t.crs==e.crs?t:t.as(e.crs,k);return!(e.west>=r.east||e.east<=r.west||e.south>=r.north||e.north<=r.south)}intersect(e){return this.intersectsExtent(e)?(e.crs!=this.crs&&(e=e.as(this.crs,k)),new Q(this.crs,Math.max(this.west,e.west),Math.min(this.east,e.east),Math.max(this.south,e.south),Math.min(this.north,e.north))):new Q(this.crs)}set(e,t,r,n){if(null==e)throw new Error("No values to set in the extent");return void 0!==e.west?(console.warn("Deprecated Extent#constructor(string, Extent) and Extent#set(Extent),","use new Extent(string).setFromExtent(Extent) instead."),this.setFromExtent(e)):4==e.length?(console.warn("Deprecated Extent#constructor(string, number[]) and Extent#set(number[]),","use new Extent(string).setFromArray(number[]) instead."),this.setFromArray(e)):void 0!==n&&(this.west=e,this.east=t,this.south=r,this.north=n),this}setFromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.west=e[t],this.east=e[t+1],this.south=e[t+2],this.north=e[t+3],this}setFromExtent(e){return this.west=e.west,this.east=e.east,this.south=e.south,this.north=e.north,this}copy(e){return this.crs=e.crs,this.setFromExtent(e)}union(e){if(e.crs!=this.crs)throw new Error("unsupported union between 2 diff crs");if(this.west===1/0)this.copy(e);else{const t=e.west;t<this.west&&(this.west=t);const r=e.east;r>this.east&&(this.east=r);const n=e.south;n<this.south&&(this.south=n);const i=e.north;i>this.north&&(this.north=i)}}expandByCoordinates(e){const t=e.crs==this.crs?e:e.as(this.crs,G);this.expandByValuesCoordinates(t.x,t.y)}expandByValuesCoordinates(e,t){e<this.west&&(this.west=e),e>this.east&&(this.east=e),t<this.south&&(this.south=t),t>this.north&&(this.north=t)}static fromBox3(e,t){return A(e)&&(e="EPSG:4326",t=L.copy(t),O.crs=e,O.setFromVector3(t.min).as(e,O).toVector3(t.min),F.crs=e,F.setFromVector3(t.max).as(e,F).toVector3(t.max)),new Q(e).setFromExtent({west:t.min.x,east:t.max.x,south:t.min.y,north:t.max.y})}toString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return`${this.east}${e}${this.north}${e}${this.west}${e}${this.south}`}subdivision(){return this.subdivisionByScheme()}subdivisionByScheme(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:P;const t=[],r=this.planarDimensions(R).divide(e);for(let n=e.x-1;n>=0;n--)for(let i=e.y-1;i>=0;i--){const e=this.west+n*r.x,s=this.south+i*r.y;t.push(new Q(this.crs,e,e+r.x,s,s+r.y))}return t}applyMatrix4(e){if(U.set(this.west,this.south,0).applyMatrix4(e),N.set(this.east,this.north,0).applyMatrix4(e),this.west=U.x,this.east=N.x,this.south=U.y,this.north=N.y,this.west>this.east){const e=this.west;this.west=this.east,this.east=e}if(this.south>this.north){const e=this.south;this.south=this.north,this.north=e}return this}clampSouthNorth(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.south,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.north;return this.south=Math.max(this.south,e),this.north=Math.min(this.north,t),this}clampWestEast(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.west,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.east;return this.west=Math.max(this.west,e),this.east=Math.min(this.east,t),this}clampByExtent(e){return this.clampSouthNorth(e.south,e.north),this.clampWestEast(e.west,e.east)}}k=new Q("EPSG:4326");const V=Q,H={getSunPosition(){const e=Math,t=e.PI,r=e.sin,n=e.cos,i=e.tan,s=e.asin,o=e.atan2,a=t/180,l=23.4397*a;function c(e,t,s){return o(r(e),n(e)*r(t)-i(s)*n(t))}function h(e,t,i){return s(r(t)*r(i)+n(t)*n(i)*n(e))}return function(e,u,d){const p=a*-d,f=a*u,m=function(e){return function(e){return e.valueOf()/864e5-.5+2440588}(e)-2451545}(e),g=function(e){return a*(357.5291+.98560028*e)}(m),A=function(e){return a*(1.9148*r(e)+.02*r(2*e)+3e-4*r(3*e))}(g),y=function(e,r){return e+r+102.9372*a+t}(g,A),v=(x=y,s(r(0)*n(l)+n(0)*r(l)*r(x)));var x;const _=function(e){return o(r(e)*n(l)-i(0)*r(l),n(e))}(y),b=function(e,t){return a*(280.16+360.9856235*e)-t}(m,p),w=b-_;return{EclipticLongitude:y,declinaison:v,ascension:_,H:w,SiderealTime:b,altitude:h(w,f,v),azimuth:c(w,f,v)+t/2}}},getSunPositionInScene(e,t,r){"number"!=typeof e&&(e=e.valueOf());const n=864e5,i=H.getSunPosition()(e,t,r).ascension+e%n/n*-360+180;return new I("EPSG:4326",i,t,5e7).as("EPSG:4978").toVector3()}},j=H,W=s.MathUtils.DEG2RAD,q=new s.Matrix4,Y=new s.Vector3,X=new s.Vector3,$=(new s.Vector3).set(0,0,1),K=new I("EPSG:4326",0,0,0),J=new s.Euler,Z=new s.Quaternion;function ee(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new s.Quaternion;return e*=W,t*=W,r*=W,n.setFromEuler(J.set(-t,-e,-r,"YXZ"))}function te(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new s.Quaternion;return e*=W,t*=W,r*=W,n.setFromEuler(J.set(e,t,r,"XYZ")),n.set(n.w,n.z,-n.y,-n.x),n}function re(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return"roll"in e||"pitch"in e||"heading"in e?ee(e.roll,e.pitch,e.heading,t):"omega"in e||"phi"in e||"kappa"in e?te(e.omega,e.phi,e.kappa,t):t.set(0,0,0,1)}function ne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return e?ne()(e,t):function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;const r=e.geodesicNormal;return 0==r.x&&0==r.y?t.set(0,0,0,1):(X.set(-r.y,r.x,0).normalize(),Y.crossVectors(r,X),q.makeBasis(X,Y,r),t.setFromRotationMatrix(q))}}function ie(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;if(e)return ie()(e,t);const r=ne();return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return r(e,t).conjugate()}}function se(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new s.Quaternion;if(t)return se(e)(t,r);const n=Math.sin(e.lat0);return function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;const i=t.as(K.crs,K).longitude*W;return r.setFromAxisAngle($,n*(e.long0-i))}}function oe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new s.Quaternion;if(t)return oe(e)(t,r);const n=se(e);return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return n(e,t).conjugate()}}function ae(e,t){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new s.Quaternion;if(t)return ae(e)(t,n);if(e.e){const t=e.e*e.e;r=t/(1-t)}else{const t=e.a*e.a,n=e.b*e.b;r=t/n-1}return function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;t.as(K.crs,K);const i=K.longitude*W,o=K.latitude*W,a=e.long0-i,l=Math.cos(o),c=Math.sin(o),h=l*l,u=a*a*h,d=r*h,p=a*c*(1+u/3*(1+3*d+2*d*d)+u*u*(2-c/l)/15);return n.setFromAxisAngle($,p)}}function le(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new s.Quaternion;if(t)return le(e)(t,r);const n=ae(e);return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return n(e,t).conjugate()}}function ce(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return e?t.set(0,0,0,1):function(e){return ce(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion)}}function he(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return e?t.set(0,0,0,1):function(e){return he(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion)}}function ue(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new s.Quaternion;return console.warn("This quaternion function is not implemented for projections of type",e.projName),t?r.set(0,0,0,1):function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return ue(e,t,r)}}function de(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new s.Quaternion;if(t)return de(e)(t,r);const n="string"==typeof e?o.A.defs(e):e;switch(n.projName){case"geocent":return ne();case"lcc":return oe(n);case"tmerc":return le(n);case"longlat":return he();default:return ue(n)}}function pe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new s.Quaternion;if(t)return pe(e)(t,r);const n="string"==typeof e?o.A.defs(e):e;switch(n.projName){case"geocent":return ie();case"lcc":return se(n);case"tmerc":return ae(n);case"longlat":return ce();default:return ue(n)}}function fe(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new s.Quaternion;if(r)return fe(e,t)(r,n);if(e==t)return function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion).set(0,0,0,1)};const i=pe(e),o=de(t);return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new s.Quaternion;return o(e,t).multiply(i(e,Z))}}},50329:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hierarchyItemLength=t.infoLength=void 0,t.infoLength=160,t.hierarchyItemLength=32},86601:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Copc=void 0;const o=s(r(30549)),a=r(876),l=r(98363),c=r(15690);async function h(e,{pointDataRecordFormat:t,pointDataRecordLength:r},n,i){const s=await async function(e,{pointDataOffset:t,pointDataLength:r}){return a.Getter.create(e)(t,t+r)}(e,n),{pointCount:l}=n;return o.PointData.decompressChunk(s,{pointCount:l,pointDataRecordFormat:t,pointDataRecordLength:r},i)}t.Copc={create:async function(e){const t=a.Getter.create(e),r=t(0,65536);async function n(e,n){return n>=65536?t(e,n):(await r).slice(e,n)}const i=o.Header.parse(await n(0,o.Constants.minHeaderLength)),s=await o.Vlr.walk(n,i),l=o.Vlr.find(s,"copc",1);if(!l)throw new Error("COPC info VLR is required");const h=c.Info.parse(await o.Vlr.fetch(n,l));let u;const d=o.Vlr.find(s,"LASF_Projection",2112);d&&d.contentLength&&(u=a.Binary.toCString(await o.Vlr.fetch(n,d)),""===u&&(u=void 0));let p=[];const f=o.Vlr.find(s,"LASF_Spec",4);return f&&(p=o.ExtraBytes.parse(await o.Vlr.fetch(n,f))),{header:i,vlrs:s,info:h,wkt:u,eb:p}},loadHierarchyPage:async function(e,t){const r=a.Getter.create(e);return l.Hierarchy.load(r,t)},loadPointDataBuffer:h,loadPointDataView:async function(e,t,r,{lazPerf:n,include:i}={}){const s=await h(e,t.header,r,n);return o.View.create(s,t.header,t.eb,i)}}},98363:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hierarchy=void 0;const n=r(876),i=r(50329);function s(e){const t=n.Binary.toDataView(e);if(t.byteLength%i.hierarchyItemLength!=0)throw new Error(`Invalid hierarchy page length: ${t.byteLength}`);const r={},s={};for(let e=0;e<t.byteLength;e+=i.hierarchyItemLength){const i=t.getInt32(e+0,!0),o=t.getInt32(e+4,!0),a=t.getInt32(e+8,!0),l=t.getInt32(e+12,!0),c=(0,n.parseBigInt)((0,n.getBigUint64)(t,e+16,!0)),h=t.getInt32(e+24,!0),u=t.getInt32(e+28,!0),d=n.Key.toString([i,o,a,l]);if(u<-1)throw new Error(`Invalid hierarchy point count at key: ${d}`);-1===u?s[d]={pageOffset:c,pageLength:h}:r[d]={pointCount:u,pointDataOffset:c,pointDataLength:h}}return{nodes:r,pages:s}}t.Hierarchy={parse:s,load:async function(e,t){const r=n.Getter.create(e);return s(await r(t.pageOffset,t.pageOffset+t.pageLength))}}},36564:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Info=t.Hierarchy=t.Copc=t.Constants=void 0,t.Constants=s(r(50329));var o=r(86601);Object.defineProperty(t,"Copc",{enumerable:!0,get:function(){return o.Copc}});var a=r(98363);Object.defineProperty(t,"Hierarchy",{enumerable:!0,get:function(){return a.Hierarchy}});var l=r(15690);Object.defineProperty(t,"Info",{enumerable:!0,get:function(){return l.Info}})},15690:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Info=void 0;const n=r(876),i=r(50329);t.Info={parse:function(e){const t=n.Binary.toDataView(e);if(t.byteLength!==i.infoLength)throw new Error(`Invalid COPC info VLR length (should be ${i.infoLength}): ${t.byteLength}`);const r=[t.getFloat64(0,!0),t.getFloat64(8,!0),t.getFloat64(16,!0)],s=t.getFloat64(24,!0);return{cube:[r[0]-s,r[1]-s,r[2]-s,r[0]+s,r[1]+s,r[2]+s],spacing:t.getFloat64(32,!0),rootHierarchyPage:{pageOffset:(0,n.parseBigInt)((0,n.getBigUint64)(t,40,!0)),pageLength:(0,n.parseBigInt)((0,n.getBigUint64)(t,48,!0))},gpsTimeRange:[t.getFloat64(56,!0),t.getFloat64(64,!0)]}}}},69545:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},24305:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hierarchy=void 0,t.Hierarchy={parse:function(e){return Object.entries(e).reduce(((e,[t,r])=>(-1===r?e.pages[t]={}:r&&(e.nodes[t]={pointCount:r}),e)),{nodes:{},pages:{}})}}},68962:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(69545),t),i(r(24305),t)},15234:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Las=t.Ept=void 0,t.Ept=s(r(68962)),o(r(36564),t),t.Las=s(r(30549)),o(r(876),t)},48300:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evlrHeaderLength=t.vlrHeaderLength=t.minHeaderLength=void 0,t.minHeaderLength=375,t.vlrHeaderLength=54,t.evlrHeaderLength=60},51652:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Dimensions=void 0;const n=r(876),i=r(94553);t.Dimensions={create:function(e,t=[]){return Object.keys(e).reduce(((e,r)=>{const n=o[r];if(n)return{...e,[r]:n};const s=t.find((e=>e.name===r)),a=s&&i.ExtraBytes.getDimension(s);if(a)return{...e,[r]:a};throw new Error(`Failed to look up LAS type: ${r}`)}),{})}};const{Type:s}=n.Dimension,o={X:s.float64,Y:s.float64,Z:s.float64,Intensity:s.uint16,ReturnNumber:s.uint8,NumberOfReturns:s.uint8,ScanDirectionFlag:s.boolean,EdgeOfFlightLine:s.boolean,Classification:s.uint8,Synthetic:s.boolean,KeyPoint:s.boolean,Withheld:s.boolean,Overlap:s.boolean,ScanAngle:s.float32,UserData:s.uint8,PointSourceId:s.uint16,GpsTime:s.float64,Red:s.uint16,Green:s.uint16,Blue:s.uint16,ScannerChannel:s.uint8,Infrared:s.uint16}},94553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtraBytes=void 0;const n=r(876);t.ExtraBytes={getDimension:function({type:e,length:t}){switch(e){case"signed":case"unsigned":switch(t){case 1:case 2:case 4:case 8:return{type:e,size:t}}case"float":switch(t){case 4:case 8:return{type:e,size:t}}}},parse:function(e){if(e.byteLength%i!=0)throw new Error(`Invalid extra bytes VLR length: ${e.byteLength}`);const t=[];for(let r=0;r<e.byteLength;r+=i)t.push(s(e.slice(r,r+i)));return t},parseOne:s};const i=192;function s(e){if(e.byteLength!==i)throw new Error(`Invalid extra bytes entry length: ${e.byteLength}`);const t=n.Binary.toDataView(e),r=n.Binary.toCString(e.slice(4,36)),s=n.Binary.toCString(e.slice(60,192)),o=t.getUint8(2),a=t.getUint8(3);if(o>=11)throw new Error(`Invalid extra bytes "type" value: ${o}`);if(0===o)return{name:r,description:s,length:a};const l=(c=a,{hasNodata:Boolean(1&c),hasMin:Boolean(c>>1&1),hasMax:Boolean(c>>2&1),hasScale:Boolean(c>>3&1),hasOffset:Boolean(c>>4&1)});var c;const h=function(e){switch(e){case 1:return n.Dimension.Type.uint8;case 2:return n.Dimension.Type.int8;case 3:return n.Dimension.Type.uint16;case 4:return n.Dimension.Type.int16;case 5:return n.Dimension.Type.uint32;case 6:return n.Dimension.Type.int32;case 7:return n.Dimension.Type.uint64;case 8:return n.Dimension.Type.int64;case 9:return n.Dimension.Type.float32;case 10:return n.Dimension.Type.float64}}(o);if(!h)throw new Error(`Failed to extract dimension type: ${o}`);const{type:u,size:d}=h;function p(e){switch(u){case"signed":return(0,n.parseBigInt)(t.getBigInt64(e,!0));case"unsigned":return(0,n.parseBigInt)((0,n.getBigUint64)(t,e,!0));case"float":return t.getFloat64(e,!0)}}const f={name:r,description:s,type:u,length:d};return l.hasNodata&&(f.nodata=p(40)),l.hasMin&&(f.min=p(64)),l.hasMax&&(f.max=p(88)),l.hasScale&&(f.scale=t.getFloat64(112)),l.hasOffset&&(f.offset=t.getFloat64(136)),f}},11677:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Extractor=void 0;const n=r(876);function i(e){const{scale:t,offset:r}=e,i=a(e);function s(e,t){return e.getUint8(i(t)+14)}function o(e,t){return e.getUint8(i(t)+15)}function l(e,t){return 31&o(e,t)}return{X:(e,s)=>n.Scale.unapply(e.getInt32(i(s),!0),t[0],r[0]),Y:(e,s)=>n.Scale.unapply(e.getInt32(i(s)+4,!0),t[1],r[1]),Z:(e,s)=>n.Scale.unapply(e.getInt32(i(s)+8,!0),t[2],r[2]),Intensity:(e,t)=>e.getUint16(i(t)+12,!0),ReturnNumber:(e,t)=>7&s(e,t),NumberOfReturns:(e,t)=>(56&s(e,t))>>3,ScanDirectionFlag:(e,t)=>(64&s(e,t))>>6,EdgeOfFlightLine:(e,t)=>(128&s(e,t))>>7,Classification:(e,t)=>{const r=l(e,t);return 12===r?0:r},Synthetic:(e,t)=>(32&o(e,t))>>5,KeyPoint:(e,t)=>(64&o(e,t))>>6,Withheld:(e,t)=>(128&o(e,t))>>7,Overlap:(e,t)=>12===l(e,t)?1:0,ScanAngle:(e,t)=>e.getInt8(i(t)+16),UserData:(e,t)=>e.getUint8(i(t)+17),PointSourceId:(e,t)=>e.getUint16(i(t)+18,!0)}}function s(e){const{scale:t,offset:r}=e,i=a(e);function s(e,t){return e.getUint8(i(t)+15)}return{X:(e,s)=>n.Scale.unapply(e.getInt32(i(s),!0),t[0],r[0]),Y:(e,s)=>n.Scale.unapply(e.getInt32(i(s)+4,!0),t[1],r[1]),Z:(e,s)=>n.Scale.unapply(e.getInt32(i(s)+8,!0),t[2],r[2]),Intensity:(e,t)=>e.getUint16(i(t)+12,!0),ReturnNumber:(e,t)=>15&e.getUint16(i(t)+14,!0),NumberOfReturns:(e,t)=>(240&e.getUint16(i(t)+14,!0))>>4,Synthetic:(e,t)=>1&s(e,t),KeyPoint:(e,t)=>(2&s(e,t))>>1,Withheld:(e,t)=>(4&s(e,t))>>2,Overlap:(e,t)=>(8&s(e,t))>>3,ScannerChannel:(e,t)=>(48&s(e,t))>>4,ScanDirectionFlag:(e,t)=>(64&s(e,t))>>6,EdgeOfFlightLine:(e,t)=>(128&s(e,t))>>7,Classification:(e,t)=>e.getUint8(i(t)+16),UserData:(e,t)=>e.getUint8(i(t)+17),ScanAngle:(e,t)=>.006*e.getInt16(i(t)+18,!0),PointSourceId:(e,t)=>e.getUint16(i(t)+20,!0),GpsTime:(e,t)=>e.getFloat64(i(t)+22,!0)}}function o(e){const t=a(e);return{...s(e),Red:(e,r)=>e.getUint16(t(r)+30,!0),Green:(e,r)=>e.getUint16(t(r)+32,!0),Blue:(e,r)=>e.getUint16(t(r)+34,!0)}}function a(e){const{pointDataRecordLength:t}=e;return function(e){return e*t}}t.Extractor={create:function(e,t=[]){const r=function(e,t){let r=function(e){switch(e){case 0:return 20;case 1:return 28;case 2:return 26;case 3:return 34;case 6:return 30;case 7:return 36;case 8:return 38;default:throw new Error(`Unsupported point data record format: ${e}`)}}(e.pointDataRecordFormat);return t.reduce(((t,i)=>{const s=r;r+=i.length;const o=function(e,t,{type:r,length:i}){const s=a(e);switch(r){case"signed":switch(i){case 1:return(e,r)=>e.getInt8(s(r)+t);case 2:return(e,r)=>e.getInt16(s(r)+t,!0);case 4:return(e,r)=>e.getInt32(s(r)+t,!0);case 8:return(e,r)=>(0,n.parseBigInt)(e.getBigInt64(s(r)+t,!0))}case"unsigned":switch(i){case 1:return(e,r)=>e.getUint8(s(r)+t);case 2:return(e,r)=>e.getUint16(s(r)+t,!0);case 4:return(e,r)=>e.getUint32(s(r)+t,!0);case 8:return(e,r)=>(0,n.parseBigInt)((0,n.getBigUint64)(e,s(r)+t,!0))}case"float":switch(i){case 4:return(e,r)=>e.getFloat32(s(r)+t,!0);case 8:return(e,r)=>e.getFloat64(s(r)+t,!0)}}}(e,s,i);if(!o)return t;return{...t,[i.name]:(e,t)=>n.Scale.unapply(o(e,t),i.scale,i.offset)}}),{})}(e,t);return{...(()=>{const{pointDataRecordFormat:t}=e;switch(t){case 0:return i(e);case 1:return function(e){const t=a(e);return{...i(e),GpsTime:(e,r)=>e.getFloat64(t(r)+20,!0)}}(e);case 2:return function(e){const t=a(e);return{...i(e),Red:(e,r)=>e.getUint16(t(r)+20,!0),Green:(e,r)=>e.getUint16(t(r)+22,!0),Blue:(e,r)=>e.getUint16(t(r)+24,!0)}}(e);case 3:return function(e){const t=a(e);return{...i(e),GpsTime:(e,r)=>e.getFloat64(t(r)+20,!0),Red:(e,r)=>e.getUint16(t(r)+28,!0),Green:(e,r)=>e.getUint16(t(r)+30,!0),Blue:(e,r)=>e.getUint16(t(r)+32,!0)}}(e);case 6:return s(e);case 7:return o(e);case 8:return function(e){const t=a(e);return{...o(e),Infrared:(e,r)=>e.getUint16(t(r)+36,!0)}}(e);default:throw new Error(`Unsupported point data record format: ${t}`)}})(),...r}}}},68916:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Header=void 0;const n=r(876),i=r(48300),s=r(47952);function o(e){const t=n.Binary.toDataView(e),r=[];for(let e=0;e<120;e+=8)r.push((0,n.getBigUint64)(t,e,!0));return r.map((e=>(0,n.parseBigInt)(e)))}function a(e){const t=n.Binary.toDataView(e),r=[];for(let e=0;e<20;e+=4)r.push(t.getUint32(e,!0));return r}t.Header={parse:function(e){if(e.byteLength<i.minHeaderLength)throw new Error(`Invalid header: must be at least ${i.minHeaderLength} bytes`);const t=n.Binary.toDataView(e),r=n.Binary.toCString(e.slice(0,4));if("LASF"!==r)throw new Error(`Invalid file signature: ${r}`);const l=t.getUint8(24),c=t.getUint8(25);if(1!==l||2!==c&&4!==c)throw new Error(`Invalid version (only 1.2 and 1.4 supported): ${l}.${c}`);const h={fileSignature:r,fileSourceId:t.getUint16(4,!0),globalEncoding:t.getUint16(6,!0),projectId:(0,s.formatGuid)(e.slice(8,24)),majorVersion:l,minorVersion:c,systemIdentifier:n.Binary.toCString(e.slice(26,58)),generatingSoftware:n.Binary.toCString(e.slice(58,90)),fileCreationDayOfYear:t.getUint16(90,!0),fileCreationYear:t.getUint16(92,!0),headerLength:t.getUint16(94,!0),pointDataOffset:t.getUint32(96,!0),vlrCount:t.getUint32(100,!0),pointDataRecordFormat:15&t.getUint8(104),pointDataRecordLength:t.getUint16(105,!0),pointCount:t.getUint32(107,!0),pointCountByReturn:a(e.slice(111,131)),scale:(0,s.parsePoint)(e.slice(131,155)),offset:(0,s.parsePoint)(e.slice(155,179)),min:[t.getFloat64(187,!0),t.getFloat64(203,!0),t.getFloat64(219,!0)],max:[t.getFloat64(179,!0),t.getFloat64(195,!0),t.getFloat64(211,!0)],waveformDataOffset:0,evlrOffset:0,evlrCount:0};return 2==c?h:{...h,pointCount:(0,n.parseBigInt)((0,n.getBigUint64)(t,247,!0)),pointCountByReturn:o(e.slice(255,375)),waveformDataOffset:(0,n.parseBigInt)((0,n.getBigUint64)(t,227,!0)),evlrOffset:(0,n.parseBigInt)((0,n.getBigUint64)(t,235,!0)),evlrCount:t.getUint32(243,!0)}}}},30549:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Vlr=t.View=t.PointData=t.Header=t.Extractor=t.ExtraBytes=t.Dimensions=t.Constants=void 0,t.Constants=s(r(48300));var o=r(51652);Object.defineProperty(t,"Dimensions",{enumerable:!0,get:function(){return o.Dimensions}});var a=r(94553);Object.defineProperty(t,"ExtraBytes",{enumerable:!0,get:function(){return a.ExtraBytes}});var l=r(11677);Object.defineProperty(t,"Extractor",{enumerable:!0,get:function(){return l.Extractor}});var c=r(68916);Object.defineProperty(t,"Header",{enumerable:!0,get:function(){return c.Header}});var h=r(90380);Object.defineProperty(t,"PointData",{enumerable:!0,get:function(){return h.PointData}});var u=r(58148);Object.defineProperty(t,"View",{enumerable:!0,get:function(){return u.View}});var d=r(32101);Object.defineProperty(t,"Vlr",{enumerable:!0,get:function(){return d.Vlr}})},90380:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decompressFile=t.decompressChunk=t.PointData=void 0;const n=r(26977),i=r(68916);let s;async function o(e){return e||(s||(s=(0,n.createLazPerf)()),s)}async function a(e,{pointCount:t,pointDataRecordFormat:r,pointDataRecordLength:n},i){const s=await o(i),a=new Uint8Array(t*n),l=s._malloc(e.byteLength),c=s._malloc(n),h=new s.ChunkDecoder;try{s.HEAPU8.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),l),h.open(r,n,l);for(let e=0;e<t;++e)h.getPoint(c),a.set(new Uint8Array(s.HEAPU8.buffer,c,n),e*n)}finally{s._free(l),s._free(c),h.delete()}return a}async function l(e,t){const r=await o(t),n=i.Header.parse(e),{pointCount:s,pointDataRecordLength:a}=n,l=new Uint8Array(s*a),c=r._malloc(e.byteLength),h=r._malloc(a),u=new r.LASZip;try{r.HEAPU8.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),c),u.open(c,e.byteLength);for(let e=0;e<s;++e)u.getPoint(h),l.set(new Uint8Array(r.HEAPU8.buffer,h,a),e*a)}finally{u.delete()}return l}t.PointData={createLazPerf:n.createLazPerf,decompressChunk:a,decompressFile:l},t.decompressChunk=a,t.decompressFile=l},47952:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatGuid=t.parsePoint=void 0;const n=r(876);t.parsePoint=function(e){const t=n.Binary.toDataView(e);if(24!==t.byteLength)throw new Error(`Invalid tuple buffer length: ${t.byteLength}`);return[t.getFloat64(0,!0),t.getFloat64(8,!0),t.getFloat64(16,!0)]},t.formatGuid=function(e){const t=n.Binary.toDataView(e);if(16!==t.byteLength)throw new Error(`Invalid GUID buffer length: ${t.byteLength}`);let r="";for(let e=0;e<t.byteLength;e+=4)r+=t.getUint32(e,!0).toString(16).padStart(8,"0");return[r.slice(0,8),r.slice(8,12),r.slice(12,16),r.slice(16,32)].join("-")}},58148:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.View=void 0;const n=r(876),i=r(51652),s=r(11677);t.View={create:function(e,t,r=[],o){let a=s.Extractor.create(t,r);if(o){const e=new Set([...o]);a=Object.entries(a).reduce(((t,[r,n])=>(e.has(r)&&(t[r]=n),t)),{})}const l=i.Dimensions.create(a,r),c=n.Binary.toDataView(e),h=t.pointDataRecordLength;if(c.byteLength%h!=0)throw new Error(`Invalid buffer length (${c.byteLength}) for point length ${h}`);const u=c.byteLength/t.pointDataRecordLength;return{pointCount:u,dimensions:l,getter:function(e){const t=a[e];if(!t)throw new Error(`No extractor for dimension: ${e}`);return function(e){if(e>=u)throw new RangeError(`View index (${e}) out of range: ${u}`);return t(c,e)}}}}}},32101:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Vlr=void 0;const n=r(876),i=r(48300);function s(e,t,r){return e.find((e=>e.userId===t&&e.recordId===r))}function o(e,t){return(t?l:a)(e)}function a(e){const t=n.Binary.toDataView(e);if(t.byteLength!==i.vlrHeaderLength)throw new Error(`Invalid VLR header length (must be ${i.vlrHeaderLength}): ${t.byteLength}`);return{userId:n.Binary.toCString(e.slice(2,18)),recordId:t.getUint16(18,!0),contentLength:t.getUint16(20,!0),description:n.Binary.toCString(e.slice(22,54)),isExtended:!1}}function l(e){const t=n.Binary.toDataView(e);if(t.byteLength!==i.evlrHeaderLength)throw new Error(`Invalid EVLR header length (must be ${i.evlrHeaderLength}): ${t.byteLength}`);return{userId:n.Binary.toCString(e.slice(2,18)),recordId:t.getUint16(18,!0),contentLength:(0,n.parseBigInt)((0,n.getBigUint64)(t,20,!0)),description:n.Binary.toCString(e.slice(28,60)),isExtended:!0}}async function c({get:e,startOffset:t,count:r,isExtended:n}){const s=[];let a=t;const l=n?i.evlrHeaderLength:i.vlrHeaderLength;for(let t=0;t<r;++t){const t=l?await e(a,a+l):new Uint8Array,{userId:r,recordId:i,contentLength:c,description:h}=o(t,n);s.push({userId:r,recordId:i,contentOffset:a+l,contentLength:c,description:h,isExtended:n}),a+=l+c}return s}t.Vlr={walk:async function(e,t){const r=n.Getter.create(e);return[...await c({get:r,startOffset:t.headerLength,count:t.vlrCount,isExtended:!1}),...await c({get:r,startOffset:t.evlrOffset,count:t.evlrCount,isExtended:!0})]},parse:o,find:s,at:function(e,t,r){const n=s(e,t,r);if(!n)throw new Error(`VLR not found: ${t}/${r}`);return n},fetch:function(e,{contentOffset:t,contentLength:r}){return 0===r?new Uint8Array:n.Getter.create(e)(t,t+r)}}},16882:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBigUint64=t.parseBigInt=void 0,t.parseBigInt=function(e){if(e>BigInt(Number.MAX_SAFE_INTEGER)||e<BigInt(-Number.MAX_SAFE_INTEGER))throw new Error(`Cannot convert bigint to number: ${e}`);return Number(e)},t.getBigUint64=function(e,t,r){if(e.getBigUint64)return e.getBigUint64(t,r);const[n,i]=r?[4,0]:[0,4],s=BigInt(e.getUint32(t+n,r)),o=BigInt(e.getUint32(t+i,r));return(s<<BigInt(32))+o}},33359:(e,t)=>{"use strict";function r(e){return new DataView(e.buffer,e.byteOffset,e.length)}function n(e){const t=r(e);let n="";for(let e=0;e<t.byteLength;++e){const r=t.getInt8(e);if(0===r)return n;n+=String.fromCharCode(r)}return n}Object.defineProperty(t,"__esModule",{value:!0}),t.toCString=t.toDataView=t.Binary=void 0,t.Binary={toDataView:r,toCString:n},t.toDataView=r,t.toCString=n},19459:(e,t)=>{"use strict";function r([e,t,r,n,i,s]){return[e+(n-e)/2,t+(i-t)/2,r+(s-r)/2]}function n(e){return e[3]-e[0]}function i(e){return e[4]-e[1]}function s(e){return e[5]-e[2]}function o(e,[t,n,i]){const[s,o,a,l,c,h]=e,[u,d,p]=r(e);return[t?u:s,n?d:o,i?p:a,t?l:u,n?c:d,i?h:p]}Object.defineProperty(t,"__esModule",{value:!0}),t.Bounds=void 0,t.Bounds={min:function(e){return[e[0],e[1],e[2]]},max:function(e){return[e[3],e[4],e[5]]},mid:r,width:n,depth:i,height:s,cube:function(e){const t=r(e),o=Math.max(n(e),i(e),s(e))/2;return[t[0]-o,t[1]-o,t[2]-o,t[0]+o,t[1]+o,t[2]+o]},step:o,stepTo:function(e,[t,r,n,i]){for(let s=t-1;s>=0;--s)e=o(e,[r>>s&1,n>>s&1,i>>s&1]);return e},intersection:function(e,t){return[Math.max(e[0],t[0]),Math.max(e[1],t[1]),Math.max(e[2],t[2]),Math.min(e[3],t[3]),Math.min(e[4],t[4]),Math.min(e[5],t[5])]}}},44324:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Dimension=void 0,t.Dimension={Type:{int8:{type:"signed",size:1},int16:{type:"signed",size:2},int32:{type:"signed",size:4},int64:{type:"signed",size:8},uint8:{type:"unsigned",size:1},uint16:{type:"unsigned",size:2},uint32:{type:"unsigned",size:4},uint64:{type:"unsigned",size:8},float32:{type:"float",size:4},float64:{type:"float",size:8},float:{type:"float",size:4},double:{type:"float",size:8},bool:{type:"unsigned",size:1},boolean:{type:"unsigned",size:1}},ctype:function({type:e,size:t}){switch(e){case"signed":switch(t){case 1:return"int8";case 2:return"int16";case 4:return"int32";case 8:return"int64"}case"unsigned":switch(t){case 1:return"uint8";case 2:return"uint16";case 4:return"uint32";case 8:return"uint64"}case"float":switch(t){case 4:return"float";case 8:return"double"}}throw new Error(`Invalid dimension type/size: ${e}/${t}`)}}},27201:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Getter=void 0;const a=o(r(74945));function l(e){return async function(t,r){if(t<0||r<0||t>r)throw new Error("Invalid range");const n=await(0,a.default)(e,{headers:{Range:`bytes=${t}-${r-1}`}}),i=await n.arrayBuffer();return new Uint8Array(i)}}function c(e){return async function(t,n){const i=await Promise.resolve().then((()=>s(r(10539))));return async function(t=0,r=1/0){if(t<0||r<0||t>r)throw new Error("Invalid range");return await i.promises.access(e),async function(e){return await new Promise(((t,r)=>{const n=[];e.on("data",(e=>n.push(e))),e.on("error",r),e.on("end",(()=>t(Buffer.concat(n))))}))}(i.createReadStream(e,{start:t,end:r-1,autoClose:!0}))}(t,n)}}t.Getter={create:function(e){return"function"==typeof e?e:e.startsWith("http://")||e.startsWith("https://")?l(e):c(e)},http:l,file:c}},876:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Step=t.Scale=t.Key=t.Getter=t.Dimension=t.Bounds=t.Binary=void 0,i(r(16882),t);var s=r(33359);Object.defineProperty(t,"Binary",{enumerable:!0,get:function(){return s.Binary}});var o=r(19459);Object.defineProperty(t,"Bounds",{enumerable:!0,get:function(){return o.Bounds}});var a=r(44324);Object.defineProperty(t,"Dimension",{enumerable:!0,get:function(){return a.Dimension}});var l=r(27201);Object.defineProperty(t,"Getter",{enumerable:!0,get:function(){return l.Getter}});var c=r(54623);Object.defineProperty(t,"Key",{enumerable:!0,get:function(){return c.Key}});var h=r(66838);Object.defineProperty(t,"Scale",{enumerable:!0,get:function(){return h.Scale}});var u=r(95192);Object.defineProperty(t,"Step",{enumerable:!0,get:function(){return u.Step}})},54623:(e,t)=>{"use strict";function r(e){if("string"!=typeof e)return e;const[t,r,n,i,...s]=e.split("-").map((e=>parseInt(e,10))),o=[t,r,n,i];if(0!==s.length||o.some((e=>"number"!=typeof e||Number.isNaN(e))))throw new Error(`Invalid key: ${e}`);return o}Object.defineProperty(t,"__esModule",{value:!0}),t.Key=void 0,t.Key={create:function(e,t=0,n=0,i=0){return"number"!=typeof e?r(e):[e,t,n,i]},parse:r,toString:function(e){return"string"==typeof e?e:e.join("-")},step:function(e,[r,n,i]){const[s,o,a,l]=t.Key.create(e);return[s+1,2*o+r,2*a+n,2*l+i]},up:function(e,r=1){const[n,i,s,o]=t.Key.create(e);return[n-r,i>>r,s>>r,o>>r]},compare:function(e,t){for(let r=0;r<e.length;++r){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},depth:function(e){return e[0]}}},66838:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Scale=void 0,t.Scale={apply:(e,t=1,r=0)=>(e-r)/t,unapply:(e,t=1,r=0)=>e*t+r}},95192:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Step=void 0,t.Step={fromIndex:function(e){if(e<0||e>=8)throw new Error(`Invalid step index: ${e}`);return[1&e?1:0,e>>1&1?1:0,e>>2&1?1:0]},list:function(){return[[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]]}}},74945:function(e,t){var r="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in e,o="ArrayBuffer"in e;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function h(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function m(e){var t=new FileReader,r=f(t);return t.readAsArrayBuffer(e),r}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function A