@splnlss/3d-story-viewer 0.5.7 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -75,6 +75,49 @@ viewer.enableContentLayers(['default']);
75
75
  viewer.alignCamera(-105.18896, 39.93, 9000);
76
76
  ```
77
77
 
78
+ ## Geospatial Precision Contract
79
+
80
+ Longitude and latitude are WGS84 decimal degrees. Altitude is WGS84
81
+ ellipsoidal height in meters. Caller-supplied positions are accepted from
82
+ -12,000 through 100,000 meters. Internal conversions do not clamp or range-limit
83
+ derived heights, so orbiting above 100 km and changing view mode remain valid.
84
+ ECEF positions and local east-north-up (ENU) translations are meters;
85
+ camera pitch, yaw, and roll and Gaussian XYZ rotations are degrees. Gaussian
86
+ scale is positive and dimensionless. 3D Tiles and mesh longitude/latitude
87
+ offsets are degrees, and their altitude offsets are ellipsoidal meters. Missing
88
+ offset members default independently to zero, while an explicit zero is
89
+ preserved.
90
+
91
+ Nonzero mesh offsets require `options.offsetOrigin`, an explicit WGS84
92
+ `{ longitude, latitude, altitude }` reference point for calculating the ECEF
93
+ translation. The GLB root is never assumed to be ECEF. The offset translates
94
+ the existing geometry; it does not georeference a local model. A missing or
95
+ invalid origin emits `CONTENT_LAYER_ERROR` and leaves the loaded mesh attached
96
+ without the offset.
97
+
98
+ All accepted geospatial and camera values must be finite. Labels require
99
+ longitude, latitude, and altitude on every update. At an exact pole, ECEF to
100
+ geodetic conversion returns longitude 0 degrees because longitude is
101
+ mathematically undefined there. ECEF `(0, 0, 0)` has no geodetic solution and
102
+ is rejected.
103
+
104
+ Within this declared domain, the viewer adds less than 2 cm of numerical
105
+ displacement. WGS84 reference conversions and round trips are bounded to 1 mm;
106
+ centimeter ENU changes and locally rebased GeoJSON buffers through a 50 km
107
+ feature extent are bounded to 5 mm. This numerical guarantee does not certify
108
+ source survey accuracy, terrain geometry, asset georeferencing, vertical datum
109
+ conversion, or screen-pixel measurement.
110
+
111
+ ### Migrating From 0.5.x
112
+
113
+ Version 0.6.0 requires all three label and GeoJSON coordinates. Camera targets,
114
+ labels, and Gaussian anchors reject non-finite or out-of-range inputs.
115
+ GeoJSON features exceeding 50 km from their local origin are rejected.
116
+ Update callers that relied on missing coordinates defaulting to zero, and
117
+ provide `offsetOrigin` for nonzero mesh offsets. Perimeters support Polygon
118
+ outer rings only; interior rings and MultiPolygon geometry remain outside this
119
+ precision change.
120
+
78
121
  ## Gaussian Splat Layers
79
122
 
80
123
  Gaussian splat content layers support `ply`, `sog`, `spz`, and `rad` data. Every
@@ -0,0 +1 @@
1
+ !function(){"use strict";const t=2e3,s={};function i(...t){t=function(t){const s=t[0];if("string"==typeof s&&s.startsWith("TSL:")){const s=t[1];s&&s.isStackTrace?t[0]+=" "+s.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}(t);t.shift();{const s=t[0];s&&s.isStackTrace}}function e(...t){const e=t.join(" ");e in s||(s[e]=!0,i(...t))}function r(t,s,i){return Math.max(s,Math.min(i,t))}const h=class{constructor(t=0,s=0){this.x=t,this.y=s}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const s=this.x,i=this.y,e=t.elements;return this.x=e[0]*s+e[3]*i+e[6],this.y=e[1]*s+e[4]*i+e[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===s)return Math.PI/2;const i=this.dot(t)/s;return Math.acos(r(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,i=this.y-t.y;return s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this}rotateAround(t,s){const i=Math.cos(s),e=Math.sin(s),r=this.x-t.x,h=this.y-t.y;return this.x=r*i-h*e+t.x,this.y=r*e+h*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};h.prototype.isVector2=!0;class n{constructor(t=0,s=0,i=0,e=1){this.isQuaternion=!0,this._x=t,this._y=s,this._z=i,this._w=e}static slerpFlat(t,s,i,e,r,h,n){let a=i[e+0],o=i[e+1],l=i[e+2],u=i[e+3],y=r[h+0],x=r[h+1],c=r[h+2],m=r[h+3];if(u!==m||a!==y||o!==x||l!==c){let t=a*y+o*x+l*c+u*m;t<0&&(y=-y,x=-x,c=-c,m=-m,t=-t);let s=1-n;if(t<.9995){const i=Math.acos(t),e=Math.sin(i);s=Math.sin(s*i)/e,a=a*s+y*(n=Math.sin(n*i)/e),o=o*s+x*n,l=l*s+c*n,u=u*s+m*n}else{a=a*s+y*n,o=o*s+x*n,l=l*s+c*n,u=u*s+m*n;const t=1/Math.sqrt(a*a+o*o+l*l+u*u);a*=t,o*=t,l*=t,u*=t}}t[s]=a,t[s+1]=o,t[s+2]=l,t[s+3]=u}static multiplyQuaternionsFlat(t,s,i,e,r,h){const n=i[e],a=i[e+1],o=i[e+2],l=i[e+3],u=r[h],y=r[h+1],x=r[h+2],c=r[h+3];return t[s]=n*c+l*u+a*x-o*y,t[s+1]=a*c+l*y+o*u-n*x,t[s+2]=o*c+l*x+n*y-a*u,t[s+3]=l*c-n*u-a*y-o*x,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,i,e){return this._x=t,this._y=s,this._z=i,this._w=e,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t._x,r=t._y,h=t._z,n=t._order,a=Math.cos,o=Math.sin,l=a(e/2),u=a(r/2),y=a(h/2),x=o(e/2),c=o(r/2),m=o(h/2);switch(n){case"XYZ":this._x=x*u*y+l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y-x*c*m;break;case"YXZ":this._x=x*u*y+l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y+x*c*m;break;case"ZXY":this._x=x*u*y-l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y-x*c*m;break;case"ZYX":this._x=x*u*y-l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y+x*c*m;break;case"YZX":this._x=x*u*y+l*c*m,this._y=l*c*y+x*u*m,this._z=l*u*m-x*c*y,this._w=l*u*y-x*c*m;break;case"XZY":this._x=x*u*y-l*c*m,this._y=l*c*y-x*u*m,this._z=l*u*m+x*c*y,this._w=l*u*y+x*c*m;break;default:i("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===s&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const i=s/2,e=Math.sin(i);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,i=s[0],e=s[4],r=s[8],h=s[1],n=s[5],a=s[9],o=s[2],l=s[6],u=s[10],y=i+n+u;if(y>0){const t=.5/Math.sqrt(y+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-o)*t,this._z=(h-e)*t}else if(i>n&&i>u){const t=2*Math.sqrt(1+i-n-u);this._w=(l-a)/t,this._x=.25*t,this._y=(e+h)/t,this._z=(r+o)/t}else if(n>u){const t=2*Math.sqrt(1+n-i-u);this._w=(r-o)/t,this._x=(e+h)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+u-i-n);this._w=(h-e)/t,this._x=(r+o)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let i=t.dot(s)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(r(this.dot(t),-1,1)))}rotateTowards(t,s){const i=this.angleTo(t);if(0===i)return this;const e=Math.min(1,s/i);return this.slerp(t,e),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const i=t._x,e=t._y,r=t._z,h=t._w,n=s._x,a=s._y,o=s._z,l=s._w;return this._x=i*l+h*n+e*o-r*a,this._y=e*l+h*a+r*n-i*o,this._z=r*l+h*o+i*a-e*n,this._w=h*l-i*n-e*a-r*o,this._onChangeCallback(),this}slerp(t,s){let i=t._x,e=t._y,r=t._z,h=t._w,n=this.dot(t);n<0&&(i=-i,e=-e,r=-r,h=-h,n=-n);let a=1-s;if(n<.9995){const t=Math.acos(n),o=Math.sin(t);a=Math.sin(a*t)/o,s=Math.sin(s*t)/o,this._x=this._x*a+i*s,this._y=this._y*a+e*s,this._z=this._z*a+r*s,this._w=this._w*a+h*s,this._onChangeCallback()}else this._x=this._x*a+i*s,this._y=this._y*a+e*s,this._z=this._z*a+r*s,this._w=this._w*a+h*s,this.normalize();return this}slerpQuaternions(t,s,i){return this.copy(t).slerp(s,i)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),i=Math.random(),e=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(e*Math.sin(t),e*Math.cos(t),r*Math.sin(s),r*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}fromBufferAttribute(t,s){return this._x=t.getX(s),this._y=t.getY(s),this._z=t.getZ(s),this._w=t.getW(s),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const a=class{constructor(t=0,s=0,i=0){this.x=t,this.y=s,this.z=i}set(t,s,i){return void 0===i&&(i=this.z),this.x=t,this.y=s,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(u.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(u.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,i=this.y,e=this.z,r=t.elements;return this.x=r[0]*s+r[3]*i+r[6]*e,this.y=r[1]*s+r[4]*i+r[7]*e,this.z=r[2]*s+r[5]*i+r[8]*e,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const s=this.x,i=this.y,e=this.z,r=t.elements,h=1/(r[3]*s+r[7]*i+r[11]*e+r[15]);return this.x=(r[0]*s+r[4]*i+r[8]*e+r[12])*h,this.y=(r[1]*s+r[5]*i+r[9]*e+r[13])*h,this.z=(r[2]*s+r[6]*i+r[10]*e+r[14])*h,this}applyQuaternion(t){const s=this.x,i=this.y,e=this.z,r=t.x,h=t.y,n=t.z,a=t.w,o=2*(h*e-n*i),l=2*(n*s-r*e),u=2*(r*i-h*s);return this.x=s+a*o+h*u-n*l,this.y=i+a*l+n*o-r*u,this.z=e+a*u+r*l-h*o,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const s=this.x,i=this.y,e=this.z,r=t.elements;return this.x=r[0]*s+r[4]*i+r[8]*e,this.y=r[1]*s+r[5]*i+r[9]*e,this.z=r[2]*s+r[6]*i+r[10]*e,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this.z=r(this.z,t.z,s.z),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this.z=r(this.z,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this.z=t.z+(s.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const i=t.x,e=t.y,r=t.z,h=s.x,n=s.y,a=s.z;return this.x=e*a-r*n,this.y=r*h-i*a,this.z=i*n-e*h,this}projectOnVector(t){const s=t.lengthSq();if(0===s)return this.set(0,0,0);const i=t.dot(this)/s;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return l.copy(this).projectOnVector(t),this.sub(l)}reflect(t){return this.sub(l.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===s)return Math.PI/2;const i=this.dot(t)/s;return Math.acos(r(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,i=this.y-t.y,e=this.z-t.z;return s*s+i*i+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,s,i){const e=Math.sin(s)*t;return this.x=e*Math.sin(i),this.y=Math.cos(s)*t,this.z=e*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,s,i){return this.x=t*Math.sin(s),this.y=i,this.z=t*Math.cos(s),this}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),e=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=i,this.z=e,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,4*s)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,3*s)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this.z=t.getZ(s),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=2*Math.random()-1,i=Math.sqrt(1-s*s);return this.x=i*Math.cos(t),this.y=s,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};a.prototype.isVector3=!0;let o=a;const l=new o,u=new n,y=class{constructor(t,s,i,e,r,h,n,a,o){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,s,i,e,r,h,n,a,o)}set(t,s,i,e,r,h,n,a,o){const l=this.elements;return l[0]=t,l[1]=e,l[2]=n,l[3]=s,l[4]=r,l[5]=a,l[6]=i,l[7]=h,l[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,i=t.elements;return s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],s[4]=i[4],s[5]=i[5],s[6]=i[6],s[7]=i[7],s[8]=i[8],this}extractBasis(t,s,i){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const i=t.elements,e=s.elements,r=this.elements,h=i[0],n=i[3],a=i[6],o=i[1],l=i[4],u=i[7],y=i[2],x=i[5],c=i[8],m=e[0],z=e[3],d=e[6],M=e[1],p=e[4],w=e[7],_=e[2],f=e[5],g=e[8];return r[0]=h*m+n*M+a*_,r[3]=h*z+n*p+a*f,r[6]=h*d+n*w+a*g,r[1]=o*m+l*M+u*_,r[4]=o*z+l*p+u*f,r[7]=o*d+l*w+u*g,r[2]=y*m+x*M+c*_,r[5]=y*z+x*p+c*f,r[8]=y*d+x*w+c*g,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8];return s*h*l-s*n*o-i*r*l+i*n*a+e*r*o-e*h*a}invert(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8],u=l*h-n*o,y=n*a-l*r,x=o*r-h*a,c=s*u+i*y+e*x;if(0===c)return this.set(0,0,0,0,0,0,0,0,0);const m=1/c;return t[0]=u*m,t[1]=(e*o-l*i)*m,t[2]=(n*i-e*h)*m,t[3]=y*m,t[4]=(l*s-e*a)*m,t[5]=(e*r-n*s)*m,t[6]=x*m,t[7]=(i*a-o*s)*m,t[8]=(h*s-i*r)*m,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t[0]=s[0],t[1]=s[3],t[2]=s[6],t[3]=s[1],t[4]=s[4],t[5]=s[7],t[6]=s[2],t[7]=s[5],t[8]=s[8],this}setUvTransform(t,s,i,e,r,h,n){const a=Math.cos(r),o=Math.sin(r);return this.set(i*a,i*o,-i*(a*h+o*n)+h+t,-e*o,e*a,-e*(-o*h+a*n)+n+s,0,0,1),this}scale(t,s){return e("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(c.makeScale(t,s)),this}rotate(t){return e("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(c.makeRotation(-t)),this}translate(t,s){return e("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(c.makeTranslation(t,s)),this}makeTranslation(t,s){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,-i,0,i,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,i=t.elements;for(let e=0;e<9;e++)if(s[e]!==i[e])return!1;return!0}fromArray(t,s=0){for(let i=0;i<9;i++)this.elements[i]=t[i+s];return this}toArray(t=[],s=0){const i=this.elements;return t[s]=i[0],t[s+1]=i[1],t[s+2]=i[2],t[s+3]=i[3],t[s+4]=i[4],t[s+5]=i[5],t[s+6]=i[6],t[s+7]=i[7],t[s+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}};y.prototype.isMatrix3=!0;let x=y;const c=new x,m=class{constructor(t=0,s=0,i=0,e=1){this.x=t,this.y=s,this.z=i,this.w=e}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,s,i,e){return this.x=t,this.y=s,this.z=i,this.w=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;case 3:this.w=s;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this.w=t.w+s.w,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this.w+=t.w*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this.w=t.w-s.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const s=this.x,i=this.y,e=this.z,r=this.w,h=t.elements;return this.x=h[0]*s+h[4]*i+h[8]*e+h[12]*r,this.y=h[1]*s+h[5]*i+h[9]*e+h[13]*r,this.z=h[2]*s+h[6]*i+h[10]*e+h[14]*r,this.w=h[3]*s+h[7]*i+h[11]*e+h[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const s=Math.sqrt(1-t.w*t.w);return s<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/s,this.y=t.y/s,this.z=t.z/s),this}setAxisAngleFromRotationMatrix(t){let s,i,e,r;const h=.01,n=.1,a=t.elements,o=a[0],l=a[4],u=a[8],y=a[1],x=a[5],c=a[9],m=a[2],z=a[6],d=a[10];if(Math.abs(l-y)<h&&Math.abs(u-m)<h&&Math.abs(c-z)<h){if(Math.abs(l+y)<n&&Math.abs(u+m)<n&&Math.abs(c+z)<n&&Math.abs(o+x+d-3)<n)return this.set(1,0,0,0),this;s=Math.PI;const t=(o+1)/2,a=(x+1)/2,M=(d+1)/2,p=(l+y)/4,w=(u+m)/4,_=(c+z)/4;return t>a&&t>M?t<h?(i=0,e=.707106781,r=.707106781):(i=Math.sqrt(t),e=p/i,r=w/i):a>M?a<h?(i=.707106781,e=0,r=.707106781):(e=Math.sqrt(a),i=p/e,r=_/e):M<h?(i=.707106781,e=.707106781,r=0):(r=Math.sqrt(M),i=w/r,e=_/r),this.set(i,e,r,s),this}let M=Math.sqrt((z-c)*(z-c)+(u-m)*(u-m)+(y-l)*(y-l));return Math.abs(M)<.001&&(M=1),this.x=(z-c)/M,this.y=(u-m)/M,this.z=(y-l)/M,this.w=Math.acos((o+x+d-1)/2),this}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this.w=s[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,s){return this.x=r(this.x,t.x,s.x),this.y=r(this.y,t.y,s.y),this.z=r(this.z,t.z,s.z),this.w=r(this.w,t.w,s.w),this}clampScalar(t,s){return this.x=r(this.x,t,s),this.y=r(this.y,t,s),this.z=r(this.z,t,s),this.w=r(this.w,t,s),this}clampLength(t,s){const i=this.length();return this.divideScalar(i||1).multiplyScalar(r(i,t,s))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this.w+=(t.w-this.w)*s,this}lerpVectors(t,s,i){return this.x=t.x+(s.x-t.x)*i,this.y=t.y+(s.y-t.y)*i,this.z=t.z+(s.z-t.z)*i,this.w=t.w+(s.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this.w=t[s+3],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t[s+3]=this.w,t}fromBufferAttribute(t,s){return this.x=t.getX(s),this.y=t.getY(s),this.z=t.getZ(s),this.w=t.getW(s),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};m.prototype.isVector4=!0;const z=class s{constructor(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z)}set(t,s,i,e,r,h,n,a,o,l,u,y,x,c,m,z){const d=this.elements;return d[0]=t,d[4]=s,d[8]=i,d[12]=e,d[1]=r,d[5]=h,d[9]=n,d[13]=a,d[2]=o,d[6]=l,d[10]=u,d[14]=y,d[3]=x,d[7]=c,d[11]=m,d[15]=z,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new s).fromArray(this.elements)}copy(t){const s=this.elements,i=t.elements;return s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],s[4]=i[4],s[5]=i[5],s[6]=i[6],s[7]=i[7],s[8]=i[8],s[9]=i[9],s[10]=i[10],s[11]=i[11],s[12]=i[12],s[13]=i[13],s[14]=i[14],s[15]=i[15],this}copyPosition(t){const s=this.elements,i=t.elements;return s[12]=i[12],s[13]=i[13],s[14]=i[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}extractBasis(t,s,i){return 0===this.determinantAffine()?(t.set(1,0,0),s.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,s,i){return this.set(t.x,s.x,i.x,0,t.y,s.y,i.y,0,t.z,s.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinantAffine())return this.identity();const s=this.elements,i=t.elements,e=1/M.setFromMatrixColumn(t,0).length(),r=1/M.setFromMatrixColumn(t,1).length(),h=1/M.setFromMatrixColumn(t,2).length();return s[0]=i[0]*e,s[1]=i[1]*e,s[2]=i[2]*e,s[3]=0,s[4]=i[4]*r,s[5]=i[5]*r,s[6]=i[6]*r,s[7]=0,s[8]=i[8]*h,s[9]=i[9]*h,s[10]=i[10]*h,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromEuler(t){const s=this.elements,i=t.x,e=t.y,r=t.z,h=Math.cos(i),n=Math.sin(i),a=Math.cos(e),o=Math.sin(e),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=h*l,i=h*u,e=n*l,r=n*u;s[0]=a*l,s[4]=-a*u,s[8]=o,s[1]=i+e*o,s[5]=t-r*o,s[9]=-n*a,s[2]=r-t*o,s[6]=e+i*o,s[10]=h*a}else if("YXZ"===t.order){const t=a*l,i=a*u,e=o*l,r=o*u;s[0]=t+r*n,s[4]=e*n-i,s[8]=h*o,s[1]=h*u,s[5]=h*l,s[9]=-n,s[2]=i*n-e,s[6]=r+t*n,s[10]=h*a}else if("ZXY"===t.order){const t=a*l,i=a*u,e=o*l,r=o*u;s[0]=t-r*n,s[4]=-h*u,s[8]=e+i*n,s[1]=i+e*n,s[5]=h*l,s[9]=r-t*n,s[2]=-h*o,s[6]=n,s[10]=h*a}else if("ZYX"===t.order){const t=h*l,i=h*u,e=n*l,r=n*u;s[0]=a*l,s[4]=e*o-i,s[8]=t*o+r,s[1]=a*u,s[5]=r*o+t,s[9]=i*o-e,s[2]=-o,s[6]=n*a,s[10]=h*a}else if("YZX"===t.order){const t=h*a,i=h*o,e=n*a,r=n*o;s[0]=a*l,s[4]=r-t*u,s[8]=e*u+i,s[1]=u,s[5]=h*l,s[9]=-n*l,s[2]=-o*l,s[6]=i*u+e,s[10]=t-r*u}else if("XZY"===t.order){const t=h*a,i=h*o,e=n*a,r=n*o;s[0]=a*l,s[4]=-u,s[8]=o*l,s[1]=t*u+r,s[5]=h*l,s[9]=i*u-e,s[2]=e*u-i,s[6]=n*l,s[10]=r*u+t}return s[3]=0,s[7]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(w,t,_)}lookAt(t,s,i){const e=this.elements;return b.subVectors(t,s),0===b.lengthSq()&&(b.z=1),b.normalize(),f.crossVectors(i,b),0===f.lengthSq()&&(1===Math.abs(i.z)?b.x+=1e-4:b.z+=1e-4,b.normalize(),f.crossVectors(i,b)),f.normalize(),g.crossVectors(b,f),e[0]=f.x,e[4]=g.x,e[8]=b.x,e[1]=f.y,e[5]=g.y,e[9]=b.y,e[2]=f.z,e[6]=g.z,e[10]=b.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const i=t.elements,e=s.elements,r=this.elements,h=i[0],n=i[4],a=i[8],o=i[12],l=i[1],u=i[5],y=i[9],x=i[13],c=i[2],m=i[6],z=i[10],d=i[14],M=i[3],p=i[7],w=i[11],_=i[15],f=e[0],g=e[4],b=e[8],v=e[12],S=e[1],A=e[5],k=e[9],C=e[13],E=e[2],Z=e[6],T=e[10],q=e[14],F=e[3],V=e[7],R=e[11],X=e[15];return r[0]=h*f+n*S+a*E+o*F,r[4]=h*g+n*A+a*Z+o*V,r[8]=h*b+n*k+a*T+o*R,r[12]=h*v+n*C+a*q+o*X,r[1]=l*f+u*S+y*E+x*F,r[5]=l*g+u*A+y*Z+x*V,r[9]=l*b+u*k+y*T+x*R,r[13]=l*v+u*C+y*q+x*X,r[2]=c*f+m*S+z*E+d*F,r[6]=c*g+m*A+z*Z+d*V,r[10]=c*b+m*k+z*T+d*R,r[14]=c*v+m*C+z*q+d*X,r[3]=M*f+p*S+w*E+_*F,r[7]=M*g+p*A+w*Z+_*V,r[11]=M*b+p*k+w*T+_*R,r[15]=M*v+p*C+w*q+_*X,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],i=t[4],e=t[8],r=t[12],h=t[1],n=t[5],a=t[9],o=t[13],l=t[2],u=t[6],y=t[10],x=t[14],c=t[3],m=t[7],z=t[11],d=t[15],M=a*x-o*y,p=n*x-o*u,w=n*y-a*u,_=h*x-o*l,f=h*y-a*l,g=h*u-n*l;return s*(m*M-z*p+d*w)-i*(c*M-z*_+d*f)+e*(c*p-m*_+d*g)-r*(c*w-m*f+z*g)}determinantAffine(){const t=this.elements,s=t[0],i=t[4],e=t[8],r=t[1],h=t[5],n=t[9],a=t[2],o=t[6],l=t[10];return s*(h*l-n*o)-i*(r*l-n*a)+e*(r*o-h*a)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,i){const e=this.elements;return t.isVector3?(e[12]=t.x,e[13]=t.y,e[14]=t.z):(e[12]=t,e[13]=s,e[14]=i),this}invert(){const t=this.elements,s=t[0],i=t[1],e=t[2],r=t[3],h=t[4],n=t[5],a=t[6],o=t[7],l=t[8],u=t[9],y=t[10],x=t[11],c=t[12],m=t[13],z=t[14],d=t[15],M=s*n-i*h,p=s*a-e*h,w=s*o-r*h,_=i*a-e*n,f=i*o-r*n,g=e*o-r*a,b=l*m-u*c,v=l*z-y*c,S=l*d-x*c,A=u*z-y*m,k=u*d-x*m,C=y*d-x*z,E=M*C-p*k+w*A+_*S-f*v+g*b;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Z=1/E;return t[0]=(n*C-a*k+o*A)*Z,t[1]=(e*k-i*C-r*A)*Z,t[2]=(m*g-z*f+d*_)*Z,t[3]=(y*f-u*g-x*_)*Z,t[4]=(a*S-h*C-o*v)*Z,t[5]=(s*C-e*S+r*v)*Z,t[6]=(z*w-c*g-d*p)*Z,t[7]=(l*g-y*w+x*p)*Z,t[8]=(h*k-n*S+o*b)*Z,t[9]=(i*S-s*k-r*b)*Z,t[10]=(c*f-m*w+d*M)*Z,t[11]=(u*w-l*f-x*M)*Z,t[12]=(n*v-h*A-a*b)*Z,t[13]=(s*A-i*v+e*b)*Z,t[14]=(m*p-c*_-z*M)*Z,t[15]=(l*_-u*p+y*M)*Z,this}scale(t){const s=this.elements,i=t.x,e=t.y,r=t.z;return s[0]*=i,s[4]*=e,s[8]*=r,s[1]*=i,s[5]*=e,s[9]*=r,s[2]*=i,s[6]*=e,s[10]*=r,s[3]*=i,s[7]*=e,s[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],e=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,i,e))}makeTranslation(t,s,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,i,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,s,-i,0,0,i,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,0,i,0,0,1,0,0,-i,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),i=Math.sin(t);return this.set(s,-i,0,0,i,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const i=Math.cos(s),e=Math.sin(s),r=1-i,h=t.x,n=t.y,a=t.z,o=r*h,l=r*n;return this.set(o*h+i,o*n-e*a,o*a+e*n,0,o*n+e*a,l*n+i,l*a-e*h,0,o*a-e*n,l*a+e*h,r*a*a+i,0,0,0,0,1),this}makeScale(t,s,i){return this.set(t,0,0,0,0,s,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,s,i,e,r,h){return this.set(1,i,r,0,t,1,h,0,s,e,1,0,0,0,0,1),this}compose(t,s,i){const e=this.elements,r=s._x,h=s._y,n=s._z,a=s._w,o=r+r,l=h+h,u=n+n,y=r*o,x=r*l,c=r*u,m=h*l,z=h*u,d=n*u,M=a*o,p=a*l,w=a*u,_=i.x,f=i.y,g=i.z;return e[0]=(1-(m+d))*_,e[1]=(x+w)*_,e[2]=(c-p)*_,e[3]=0,e[4]=(x-w)*f,e[5]=(1-(y+d))*f,e[6]=(z+M)*f,e[7]=0,e[8]=(c+p)*g,e[9]=(z-M)*g,e[10]=(1-(y+m))*g,e[11]=0,e[12]=t.x,e[13]=t.y,e[14]=t.z,e[15]=1,this}decompose(t,s,i){const e=this.elements;t.x=e[12],t.y=e[13],t.z=e[14];const r=this.determinantAffine();if(0===r)return i.set(1,1,1),s.identity(),this;let h=M.set(e[0],e[1],e[2]).length();const n=M.set(e[4],e[5],e[6]).length(),a=M.set(e[8],e[9],e[10]).length();r<0&&(h=-h),p.copy(this);const o=1/h,l=1/n,u=1/a;return p.elements[0]*=o,p.elements[1]*=o,p.elements[2]*=o,p.elements[4]*=l,p.elements[5]*=l,p.elements[6]*=l,p.elements[8]*=u,p.elements[9]*=u,p.elements[10]*=u,s.setFromRotationMatrix(p),i.x=h,i.y=n,i.z=a,this}makePerspective(s,i,e,r,h,n,a=2e3,o=!1){const l=this.elements,u=2*h/(i-s),y=2*h/(e-r),x=(i+s)/(i-s),c=(e+r)/(e-r);let m,z;if(o)m=h/(n-h),z=n*h/(n-h);else if(a===t)m=-(n+h)/(n-h),z=-2*n*h/(n-h);else{if(2001!==a)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);m=-n/(n-h),z=-n*h/(n-h)}return l[0]=u,l[4]=0,l[8]=x,l[12]=0,l[1]=0,l[5]=y,l[9]=c,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=z,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(s,i,e,r,h,n,a=2e3,o=!1){const l=this.elements,u=2/(i-s),y=2/(e-r),x=-(i+s)/(i-s),c=-(e+r)/(e-r);let m,z;if(o)m=1/(n-h),z=n/(n-h);else if(a===t)m=-2/(n-h),z=-(n+h)/(n-h);else{if(2001!==a)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);m=-1/(n-h),z=-h/(n-h)}return l[0]=u,l[4]=0,l[8]=0,l[12]=x,l[1]=0,l[5]=y,l[9]=0,l[13]=c,l[2]=0,l[6]=0,l[10]=m,l[14]=z,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const s=this.elements,i=t.elements;for(let e=0;e<16;e++)if(s[e]!==i[e])return!1;return!0}fromArray(t,s=0){for(let i=0;i<16;i++)this.elements[i]=t[i+s];return this}toArray(t=[],s=0){const i=this.elements;return t[s]=i[0],t[s+1]=i[1],t[s+2]=i[2],t[s+3]=i[3],t[s+4]=i[4],t[s+5]=i[5],t[s+6]=i[6],t[s+7]=i[7],t[s+8]=i[8],t[s+9]=i[9],t[s+10]=i[10],t[s+11]=i[11],t[s+12]=i[12],t[s+13]=i[13],t[s+14]=i[14],t[s+15]=i[15],t}};z.prototype.isMatrix4=!0;let d=z;const M=new o,p=new d,w=new o(0,0,0),_=new o(1,1,1),f=new o,g=new o,b=new o,v=class{constructor(t,s,i,e){this.elements=[1,0,0,1],void 0!==t&&this.set(t,s,i,e)}identity(){return this.set(1,0,0,1),this}fromArray(t,s=0){for(let i=0;i<4;i++)this.elements[i]=t[i+s];return this}set(t,s,i,e){const r=this.elements;return r[0]=t,r[2]=s,r[1]=i,r[3]=e,this}};v.prototype.isMatrix2=!0;"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}})),"undefined"!=typeof window&&(window.__THREE__?i("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");(new x).set(-1,0,0,0,1,0,0,0,1);(new x).set(-1,0,0,0,1,0,0,0,1);const S=.0066943799901413165,A=-12e3,k=1e5,C=Math.PI/180;function E(t,s){if(!Number.isFinite(t))throw new TypeError(`${s} must be a finite number.`);return t}function Z(t,s,i="Geodetic position"){if(E(t,`${i} longitude`),E(s,`${i} latitude`),t<-180||t>180)throw new RangeError(`${i} longitude must be within [-180, 180] degrees.`);if(s<-90||s>90)throw new RangeError(`${i} latitude must be within [-90, 90] degrees.`)}function T(t,s,i){E(t,"Longitude"),E(s,"Latitude"),E(i,"Altitude");const e=s*C,r=t*C,h=Math.sin(e),n=90===Math.abs(s)?0:Math.cos(e),a=6378137/Math.sqrt(1-S*h**2);return[(a+i)*n*Math.cos(r),(a+i)*n*Math.sin(r),(.9933056200098587*a+i)*h]}function q(t,s,i=2){const e=t.length;let r=function(t,s,i,e,r){let h;if(r===function(t,s,i,e){let r=0;for(let h=s,n=i-e;h<i;h+=e)r+=(t[n]-t[h])*(t[h+1]+t[n+1]),n=h;return r}(t,s,i,e)>0)for(let n=s;n<i;n+=e)h=W(n/e|0,t[n],t[n+1],h);else for(let n=i-e;n>=s;n-=e)h=W(n/e|0,t[n],t[n+1],h);h&&H(h,h.next)&&($(h),h=h.next);return h}(t,0,e,i,!0);const h=[];if(!r||r.next===r.prev)return h;let n,a,o;if(t.length>80*i){n=1/0,a=1/0;let s=-1/0,r=-1/0;for(let h=i;h<e;h+=i){const i=t[h],e=t[h+1];i<n&&(n=i),e<a&&(a=e),i>s&&(s=i),e>r&&(r=e)}o=Math.max(s-n,r-a),o=0!==o?32767/o:0}return V(r,h,i,n,a,o,0),h}function F(t,s){if(!t)return t;s||(s=t);let i,e=t;do{if(i=!1,e.steiner||!H(e,e.next)&&0!==I(e.prev,e,e.next))e=e.next;else{if($(e),e=s=e.prev,e===e.next)break;i=!0}}while(i||e!==s);return s}function V(t,s,i,e,r,h,n){if(!t)return;!n&&h&&function(t,s,i,e){let r=t;do{0===r.z&&(r.z=O(r.x,r.y,s,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let s,i=1;do{let e,r=t;t=null;let h=null;for(s=0;r;){s++;let n=r,a=0;for(let t=0;t<i&&(a++,n=n.nextZ,n);t++);let o=i;for(;a>0||o>0&&n;)0!==a&&(0===o||!n||r.z<=n.z)?(e=r,r=r.nextZ,a--):(e=n,n=n.nextZ,o--),h?h.nextZ=e:t=e,e.prevZ=h,h=e;r=n}h.nextZ=null,i*=2}while(s>1)}(r)}(t,e,r,h);let a=t;for(;t.prev!==t.next;){const o=t.prev,l=t.next;if(h?X(t,e,r,h):R(t))s.push(o.i,t.i,l.i),$(t),t=l.next,a=l.next;else if((t=l)===a){n?1===n?V(t=Y(F(t),s),s,i,e,r,h,2):2===n&&L(t,s,i,e,r,h):V(F(t),s,i,e,r,h,1);break}}}function R(t){const s=t.prev,i=t,e=t.next;if(I(s,i,e)>=0)return!1;const r=s.x,h=i.x,n=e.x,a=s.y,o=i.y,l=e.y,u=Math.min(r,h,n),y=Math.min(a,o,l),x=Math.max(r,h,n),c=Math.max(a,o,l);let m=e.next;for(;m!==s;){if(m.x>=u&&m.x<=x&&m.y>=y&&m.y<=c&&P(r,a,h,o,n,l,m.x,m.y)&&I(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function X(t,s,i,e){const r=t.prev,h=t,n=t.next;if(I(r,h,n)>=0)return!1;const a=r.x,o=h.x,l=n.x,u=r.y,y=h.y,x=n.y,c=Math.min(a,o,l),m=Math.min(u,y,x),z=Math.max(a,o,l),d=Math.max(u,y,x),M=O(c,m,s,i,e),p=O(z,d,s,i,e);let w=t.prevZ,_=t.nextZ;for(;w&&w.z>=M&&_&&_.z<=p;){if(w.x>=c&&w.x<=z&&w.y>=m&&w.y<=d&&w!==r&&w!==n&&P(a,u,o,y,l,x,w.x,w.y)&&I(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,_.x>=c&&_.x<=z&&_.y>=m&&_.y<=d&&_!==r&&_!==n&&P(a,u,o,y,l,x,_.x,_.y)&&I(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;w&&w.z>=M;){if(w.x>=c&&w.x<=z&&w.y>=m&&w.y<=d&&w!==r&&w!==n&&P(a,u,o,y,l,x,w.x,w.y)&&I(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;_&&_.z<=p;){if(_.x>=c&&_.x<=z&&_.y>=m&&_.y<=d&&_!==r&&_!==n&&P(a,u,o,y,l,x,_.x,_.y)&&I(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Y(t,s){let i=t;do{const e=i.prev,r=i.next.next;!H(e,r)&&N(e,i,i.next,r)&&G(e,r)&&G(r,e)&&(s.push(e.i,i.i,r.i),$(i),$(i.next),i=t=r),i=i.next}while(i!==t);return F(i)}function L(t,s,i,e,r,h){let n=t;do{let t=n.next.next;for(;t!==n.prev;){if(n.i!==t.i&&B(n,t)){let a=U(n,t);return n=F(n,n.next),a=F(a,a.next),V(n,s,i,e,r,h,0),void V(a,s,i,e,r,h,0)}t=t.next}n=n.next}while(n!==t)}function O(t,s,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-e)*r|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function P(t,s,i,e,r,h,n,a){return!(t===n&&s===a)&&function(t,s,i,e,r,h,n,a){return(r-n)*(s-a)>=(t-n)*(h-a)&&(t-n)*(e-a)>=(i-n)*(s-a)&&(i-n)*(h-a)>=(r-n)*(e-a)}(t,s,i,e,r,h,n,a)}function B(t,s){return t.next.i!==s.i&&t.prev.i!==s.i&&!function(t,s){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==s.i&&i.next.i!==s.i&&N(i,i.next,t,s))return!0;i=i.next}while(i!==t);return!1}(t,s)&&(G(t,s)&&G(s,t)&&function(t,s){let i=t,e=!1;const r=(t.x+s.x)/2,h=(t.y+s.y)/2;do{i.y>h!=i.next.y>h&&i.next.y!==i.y&&r<(i.next.x-i.x)*(h-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,s)&&(I(t.prev,t,s.prev)||I(t,s.prev,s))||H(t,s)&&I(t.prev,t,t.next)>0&&I(s.prev,s,s.next)>0)}function I(t,s,i){return(s.y-t.y)*(i.x-s.x)-(s.x-t.x)*(i.y-s.y)}function H(t,s){return t.x===s.x&&t.y===s.y}function N(t,s,i,e){const r=j(I(t,s,i)),h=j(I(t,s,e)),n=j(I(i,e,t)),a=j(I(i,e,s));return r!==h&&n!==a||(!(0!==r||!Q(t,i,s))||(!(0!==h||!Q(t,e,s))||(!(0!==n||!Q(i,t,e))||!(0!==a||!Q(i,s,e)))))}function Q(t,s,i){return s.x<=Math.max(t.x,i.x)&&s.x>=Math.min(t.x,i.x)&&s.y<=Math.max(t.y,i.y)&&s.y>=Math.min(t.y,i.y)}function j(t){return t>0?1:t<0?-1:0}function G(t,s){return I(t.prev,t,t.next)<0?I(t,s,t.next)>=0&&I(t,t.prev,s)>=0:I(t,s,t.prev)<0||I(t,t.next,s)<0}function U(t,s){const i=D(t.i,t.x,t.y),e=D(s.i,s.x,s.y),r=t.next,h=s.prev;return t.next=s,s.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,h.next=e,e.prev=h,e}function W(t,s,i,e){const r=D(t,s,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function $(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function D(t,s,i){return{i:t,x:s,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const J=5e4;function K(t){return 255*(t=(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))}function tt(t,s){if(!Array.isArray(t)||t.length<3)throw new TypeError("Every GeoJSON position must contain longitude, latitude, and altitude.");!function(t,s,i,e="Geodetic position"){if(Z(t,s,e),E(i,`${e} altitude`),i<A||i>k)throw new RangeError(`${e} altitude must be within [-12000, 100000] WGS84 ellipsoidal meters.`)}(t[0],t[1],t[2],"GeoJSON position");const i=(new o).fromArray(T(t[0],t[1],t[2])).sub(s);if(i.length()>J)throw new RangeError("GeoJSON feature exceeds the 50000 meter local precision envelope.");return i}function st(t){for(let s=0;s<t.length;s+=3)if(Math.hypot(t[s],t[s+1],t[s+2])>J)throw new RangeError("GeoJSON feature exceeds the 50000 meter local precision envelope.");return new Float32Array(t)}function it(t){const{geometry:s}=t;if(!Array.isArray(null==s?void 0:s.coordinates)||2!==s.coordinates.length)throw new TypeError("Arrow geometry must contain exactly two positions.");const i=(new o).fromArray(T(...s.coordinates[0])),e=tt(s.coordinates[0],i),r=tt(s.coordinates[1],i),h=(new o).fromArray(function(t,s){Z(t,s,"ENU origin");const i=t*C,e=s*C,r=Math.sin(i),h=Math.cos(i),n=Math.sin(e),a=Math.cos(e);return{east:[-r,h,0],north:[-n*h,-n*r,a],up:[a*h,a*r,n]}}(s.coordinates[0][0],s.coordinates[0][1]).up),n=(new o).subVectors(r,e),a=n.length(),l=n.clone().normalize(),u=(new o).crossVectors(h,l).normalize().multiplyScalar(10),y=e.clone(),x=r.clone(),c=y.clone().add(l.clone().multiplyScalar(a*(1-100/a))),m=y.clone().add(u),z=y.clone().sub(u),d=c.clone().add(u.clone()),M=c.clone().sub(u.clone()),p=c.clone().add(u.clone().multiplyScalar(4)),w=c.clone().sub(u.clone().multiplyScalar(4)),_=x,f=st([...m.toArray(),...z.toArray(),...d.toArray(),...d.toArray(),...z.toArray(),...M.toArray(),...p.toArray(),...w.toArray(),..._.toArray()]);return{origin:i.toArray(),meshVertexBuffer:f}}self.addEventListener("message",(async t=>{const{type:s,data:i,color:e}=t.data;try{let t={};switch(s){case"arrow":t=it(i);break;case"perimeter":t=function(t,s){var i,e;const r=null==(e=null==(i=null==t?void 0:t.geometry)?void 0:i.coordinates)?void 0:e[0];if(!Array.isArray(r)||0===r.length)throw new TypeError("Perimeter geometry must contain a non-empty ring.");const h=(new o).fromArray(T(...r[0])),n=[(a=s)>>16&255,a>>8&255,255&a];var a;n[0]=K(n[0]),n[1]=K(n[1]),n[2]=K(n[2]);const l=q(r.flat(),0,r[0].length),u=[],y=[],x=[],c=[];for(let o=0;o<r.length;o++){const t=tt(r[o],h).toArray();u.push(...t),c.push(...n),x.push(...t),y.push(...n),o>0&&(x.push(...t),y.push(...n))}return{origin:h.toArray(),lineVertexBuffer:st(x),lineVertexRGBBuffer:new Uint8Array(y),meshVertexBuffer:st(u),meshVertexRGBBuffer:new Uint8Array(c),meshIndexBuffer:new Uint16Array(l.flat())}}(i,e);break;default:throw new TypeError(`Unsupported GeoJSON feature type: ${String(s)}.`)}self.postMessage({success:!0,code:0,...t})}catch(r){self.postMessage({success:!1,code:1,error:{name:r instanceof Error?r.name:"Error",message:r instanceof Error?r.message:String(r)}})}}))}();
@@ -1 +1 @@
1
- "use strict";const e=require("./index-CMipzbxp.cjs");module.exports=e.computeElevation;
1
+ "use strict";const e=require("./index-wUFLgXbb.cjs");module.exports=e.computeElevation;
@@ -1,4 +1,4 @@
1
- import { bz } from "./index-C7Ow38PB.js";
1
+ import { bJ } from "./index-CsZhc21b.js";
2
2
  export {
3
- bz as default
3
+ bJ as default
4
4
  };