@avs/go 0.12.71730

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.
@@ -0,0 +1,61 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
2
+
3
+ /**
4
+ * @fileoverview
5
+ * @suppress {checkPrototypalTypes}
6
+ * @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
7
+ * This code may only be used under the BSD style license found at
8
+ * http://polymer.github.io/LICENSE.txt The complete set of authors may be found
9
+ * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may
10
+ * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by
11
+ * Google as part of the polymer project is also subject to an additional IP
12
+ * rights grant found at http://polymer.github.io/PATENTS.txt
13
+ */
14
+
15
+ /**
16
+ * @license
17
+ * Copyright 2010-2025 Three.js Authors
18
+ * SPDX-License-Identifier: MIT
19
+ */
20
+
21
+ /**
22
+ * @license
23
+ * Copyright 2018 Advanced Visual Systems Inc.
24
+ *
25
+ * Licensed under the Apache License, Version 2.0 (the "License");
26
+ * you may not use this file except in compliance with the License.
27
+ * You may obtain a copy of the License at
28
+ *
29
+ * http://www.apache.org/licenses/LICENSE-2.0
30
+ *
31
+ * Unless required by applicable law or agreed to in writing, software
32
+ * distributed under the License is distributed on an "AS IS" BASIS,
33
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ * See the License for the specific language governing permissions and
35
+ * limitations under the License.
36
+ *
37
+ * This product includes software developed at
38
+ * Advanced Visual Systems Inc. (http://www.avs.com)
39
+ */
40
+
41
+ /**
42
+ @license
43
+ Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
44
+ This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
45
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
46
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
47
+ Code distributed by Google as part of the polymer project is also
48
+ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
49
+ */
50
+
51
+ /**
52
+ @license @nocompile
53
+ Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
54
+ This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
55
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
56
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
57
+ Code distributed by Google as part of the polymer project is also
58
+ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
59
+ */
60
+
61
+ // @license Licensed by Advanced Visual Systems Inc. to You under the Apache License, Version 2.0.
@@ -0,0 +1,41 @@
1
+ avsthree.js
2
+ Copyright 2018 Advanced Visual Systems Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ This product includes software developed at
17
+ Advanced Visual Systems Inc. (http://www.avs.com)
18
+
19
+ This software contains code derived from three.js (http://threejs.org)
20
+
21
+ The MIT License
22
+
23
+ Copyright © 2010-2018 three.js authors
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ of this software and associated documentation files (the "Software"), to deal
27
+ in the Software without restriction, including without limitation the rights
28
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ copies of the Software, and to permit persons to whom the Software is
30
+ furnished to do so, subject to the following conditions:
31
+
32
+ The above copyright notice and this permission notice shall be included in
33
+ all copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
41
+ THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ // @license Licensed by Advanced Visual Systems Inc. to You under the Apache License, Version 2.0.
2
+ import{Vector3 as t,Group as e,Matrix4 as i,Points as n,LineSegments as a,Mesh as r,PointLight as s,DirectionalLight as o,AmbientLight as l,OrthographicCamera as c,PerspectiveCamera as h,Scene as d,ShaderMaterial as p,Color as u,LessEqualDepth as f,AlwaysStencilFunc as m,KeepStencilOp as g,Matrix3 as v,Vector2 as y,UniformsUtils as b,UniformsLib as x,MaterialLoader as w,Plane as S,Float32BufferAttribute as O,Box3 as E,InstancedBufferGeometry as C,InstancedInterleavedBuffer as k,InterleavedBufferAttribute as _,Sphere as P,Ray as L,Object3D as T,MathUtils as j,ObjectLoader as A,BufferGeometryLoader as D,SphereGeometry as I,Fog as M,FogExp2 as N,Raycaster as R,WebGLRenderTarget as G,SRGBColorSpace as F,InstancedBufferAttribute as z,BufferGeometry as H,EventDispatcher as W,TOUCH as Y,Quaternion as B,Vector4 as U,MOUSE as X,NumberKeyframeTrack as Z,BooleanKeyframeTrack as V,AnimationClip as q,Euler as J,VectorKeyframeTrack as K,QuaternionKeyframeTrack as Q,AnimationObjectGroup as $,AnimationMixer as tt,Clock as et}from"three";var it="1",nt=400,at=400,rt=.03,st={All:0,Closest:1},ot={Ray:0,Rectangle:1},lt={Cell:0,CellSet:1,SceneNode:2},ct={Points:1,Lines:2,Triangles:3,Quads:4};const ht=new t;class dt extends e{constructor(){super(),this.scaleFactorX=1,this.scaleFactorY=1,this.scaleFactorZ=1}updateMatrix(){ht.set(this.scale.x*this.scaleFactorX,this.scale.y*this.scaleFactorY,this.scale.z*this.scaleFactorZ),this.matrix.compose(this.position,this.quaternion,ht),this.matrixWorldNeedsUpdate=!0}toJSON(t){const e=super.toJSON(t);return"{}"!==JSON.stringify(this.internalData)&&(e.object.internalData=this.internalData),e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),e}}const pt=new t,ut=new t;class ft extends n{constructor(t,e){super(t,e),this.scaleFactorX=1,this.scaleFactorY=1,this.scaleFactorZ=1}updateMatrix(){ut.set(this.scale.x*this.scaleFactorX,this.scale.y*this.scaleFactorY,this.scale.z*this.scaleFactorZ),this.matrix.compose(this.position,this.quaternion,ut),this.matrixWorldNeedsUpdate=!0}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),e}raycast(t,e){const i=this.geometry.attributes,n=i.position.array;let a,r,s,o,l,c,h=.5;void 0===this.material.vertexSizes&&(h=this.material.size/2);for(let d=0,p=n.length/3;d<p;d++)pt.fromArray(n,3*d),pt.applyMatrix4(this.matrixWorld),pt.project(t.camera),a=(pt.x+1)/2*t.landscapeWidth,r=(1-(pt.y+1)/2)*t.landscapeHeight,this.material.vertexSizes&&(h=i.vsize.array[d]/2),s=a-h,o=a+h,l=r-h,c=r+h,t.x>=s&&t.x<=o&&t.y>=l&&t.y<=c&&e.push({distance:null,distanceToRay:null,point:null,index:d,face:null,object:this})}}const mt=new t;class gt extends a{constructor(t,e){super(t,e),this.scaleFactorX=1,this.scaleFactorY=1,this.scaleFactorZ=1}updateMatrix(){mt.set(this.scale.x*this.scaleFactorX,this.scale.y*this.scaleFactorY,this.scale.z*this.scaleFactorZ),this.matrix.compose(this.position,this.quaternion,mt),this.matrixWorldNeedsUpdate=!0}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),e}}const vt=new i,yt=new i,bt=new i,xt=[],wt=new r,St=new t;class Ot extends r{constructor(t,e){super(t,e),this.scaleFactorX=1,this.scaleFactorY=1,this.scaleFactorZ=1}updateMatrix(){St.set(this.scale.x*this.scaleFactorX,this.scale.y*this.scaleFactorY,this.scale.z*this.scaleFactorZ),this.matrix.compose(this.position,this.quaternion,St),this.matrixWorldNeedsUpdate=!0}raycast(t,e){if(wt.geometry=this.geometry,wt.material=this.material,void 0===wt.material||void 0===wt.geometry)return;if(!wt.material.glyphs)return super.raycast(t,e);const i=this.matrixWorld,n=wt.geometry.attributes.glyphOffset.array,a=n.length/3;let r,s,o;for(let l=0;l<a;l++){if(r=3*l,wt.material.vertexGlyphScales?(s=wt.geometry.attributes.glyphScale.array,vt.makeScale(s[r],s[r+1],s[r+2])):vt.makeScale(wt.material.glyphScale.x,wt.material.glyphScale.y,wt.material.glyphScale.z),wt.material.vertexGlyphOrientations&&(o=wt.geometry.attributes.glyphOrientation.array,bt.set(o[r],o[r+3],o[r+6],0,o[r+1],o[r+4],o[r+7],0,o[r+2],o[r+5],o[r+8],0,0,0,0,1),vt.multiply(bt)),vt.setPosition(n[r],n[r+1],n[r+2]),yt.multiplyMatrices(i,vt),wt.matrixWorld=yt,wt.raycast(t,xt),xt.length>0){const t=xt[0];t.faceIndex=l,t.object=this,e.push(t)}xt.length=0}}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),e}}class Et extends s{constructor(t,e=Math.PI){super(t,e)}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),16777215===this.color.getHex()&&(e.object.color=void 0),this.intensity===Math.PI&&(e.object.intensity=void 0),e.object.shadow=void 0,e}}class Ct extends o{constructor(t,e=Math.PI){super(t,e)}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),16777215===this.color.getHex()&&(e.object.color=void 0),this.intensity===Math.PI&&(e.object.intensity=void 0),e.object.shadow=void 0,e}}class kt extends l{constructor(t,e=Math.PI){super(t,e)}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),16777215===this.color.getHex()&&(e.object.color=void 0),this.intensity===Math.PI&&(e.object.intensity=void 0),e}}class _t extends c{constructor(t,e,i,n,a,r){super(t,e,i,n,a,r),this.keepAspectRatio=!1,this.origLeft=t,this.origRight=e,this.origTop=i,this.origBottom=n}toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),1===this.zoom&&(e.object.zoom=void 0),-1===this.left&&(e.object.left=void 0),1===this.right&&(e.object.right=void 0),1===this.top&&(e.object.top=void 0),-1===this.bottom&&(e.object.bottom=void 0),.1===this.near&&(e.object.near=void 0),2e3===this.far&&(e.object.far=void 0),this.keepAspectRatio&&(e.object.keepAspectRatio=!0),e}}class Pt extends h{toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),50===this.fov&&(e.object.fov=void 0),1===this.zoom&&(e.object.zoom=void 0),.1===this.near&&(e.object.near=void 0),2e3===this.far&&(e.object.far=void 0),10===this.focus&&(e.object.focus=void 0),1===this.aspect&&(e.object.aspect=void 0),35===this.filmGauge&&(e.object.filmGauge=void 0),0===this.filmOffset&&(e.object.filmOffset=void 0),e}}class Lt extends d{toJSON(t){const e=super.toJSON(t);return e.metadata=void 0,1===this.layers.mask&&(e.object.layers=void 0),this.matrix.equals(new i)&&(e.object.matrix=void 0),e}}class Tt extends p{constructor(t){super(),Object.defineProperties(this,{pickState:{get:function(){return this.uniforms.pickState.value},set:function(t){this.uniforms.pickState.value=t}},startCell:{get:function(){return this.uniforms.startCell.value},set:function(t){this.uniforms.startCell.value=t}},glyphs:{get:function(){return this.defines.GLYPH},set:function(t){this.defines.GLYPH=t}},glyphScale:{get:function(){return this.uniforms.uGlyphScale.value},set:function(t){this.uniforms.uGlyphScale.value=t}},glyphScaleFactorX:{get:function(){return this.uniforms.glyphScaleFactorX.value},set:function(t){this.uniforms.glyphScaleFactorX.value=t}},glyphScaleFactorY:{get:function(){return this.uniforms.glyphScaleFactorY.value},set:function(t){this.uniforms.glyphScaleFactorY.value=t}},glyphScaleFactorZ:{get:function(){return this.uniforms.glyphScaleFactorZ.value},set:function(t){this.uniforms.glyphScaleFactorZ.value=t}},vertexGlyphScales:{get:function(){return this.defines.USE_GLYPH_SCALE},set:function(t){this.defines.USE_GLYPH_SCALE=t}},glyphOrientation:{get:function(){return this.uniforms.uGlyphOrientation.value},set:function(t){this.uniforms.uGlyphOrientation.value=t}},vertexGlyphOrientations:{get:function(){return this.defines.USE_GLYPH_ORIENTATION},set:function(t){this.defines.USE_GLYPH_ORIENTATION=t}},opacityFactor:{get:function(){return this.uniforms.opacityFactor.value},set:function(t){this.uniforms.opacityFactor.value=t}}}),this.color=new u(16777215),this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}toJSON(t){const e=super.toJSON(t);return this.depthFunc===f&&(e.depthFunc=void 0),!0===this.depthTest&&(e.depthTest=void 0),!0===this.depthWrite&&(e.depthWrite=void 0),!1===this.stencilWrite&&(e.stencilWrite=void 0),255===this.stencilWriteMask&&(e.stencilWriteMask=void 0),this.stencilFunc===m&&(e.stencilFunc=void 0),0===this.stencilRef&&(e.stencilRef=void 0),255===this.stencilFuncMask&&(e.stencilFuncMask=void 0),this.stencilFail===g&&(e.stencilFail=void 0),this.stencilZFail===g&&(e.stencilZFail=void 0),this.stencilZPass===g&&(e.stencilZPass=void 0),this.vertexGlyphScales&&(e.vertexGlyphScales=!0),this.vertexGlyphOrientations&&(e.vertexGlyphOrientations=!0),e.uniforms=void 0,e.fragmentShader=void 0,e.vertexShader=void 0,e}equals(t){return t.color.getHex()===this.color.getHex()&&(t.opacity===this.opacity&&(t.transparent===this.transparent&&(t.side===this.side&&t.vertexColors===this.vertexColors)))}}const jt={base:{pickState:{value:new Float32Array(1)},startCell:{value:0},uGlyphScale:{value:new t(1,1,1)},glyphScaleFactorX:{value:1},glyphScaleFactorY:{value:1},glyphScaleFactorZ:{value:1},uGlyphOrientation:{value:new v},opacityFactor:{value:1}},line:{linePattern:{value:65535},resolution:{value:new y(1,1)}},mesh:{stipple:{value:0},stippleColor:{value:new u(0)},stipplePattern:{value:new Float32Array(64)},textureBlending:{value:1}}},At="uniform vec3 diffuse;\nuniform float opacity;\nuniform float opacityFactor;\nuniform float linePattern;\nuniform float pickState[ 1 ];\nvarying vec3 vPickColor;\n#ifdef USE_PATTERN\nvarying float vPattern;\n#endif\nvarying float vDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity * opacityFactor );\n\t#include <clipping_planes_fragment>\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tgl_FragColor = vec4( vPickColor, 1.0 );\n\t} else {\n\tfloat pattern;\n#ifdef USE_PATTERN\n\tpattern = floor( vPattern );\n#else\n\tpattern = linePattern;\n#endif\n\tfloat shift = pow( 2.0, floor( mod( vDistance, 16.0 ) ) );\n\tif( mod( floor( pattern / shift ), 2.0 ) < 0.5 ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t}\n}",Dt="attribute float vsize;\nattribute float cellCount;\nattribute vec3 glyphOffset;\nattribute vec3 glyphScale;\nuniform vec3 uGlyphScale;\nuniform float glyphScaleFactorX;\nuniform float glyphScaleFactorY;\nuniform float glyphScaleFactorZ;\nattribute mat3 glyphOrientation;\nuniform mat3 uGlyphOrientation;\nuniform float size;\nuniform float pickState[ 1 ];\nuniform float startCell;\nvarying vec3 vPickColor;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n\t#include <color_vertex>\n\t#include <begin_vertex>\n#ifdef GLYPH\n#ifdef USE_GLYPH_SCALE\n\ttransformed *= glyphScale;\n#else\n\ttransformed *= uGlyphScale;\n#endif\n\tvec3 glyphScaleFactor = vec3( glyphScaleFactorX, glyphScaleFactorY, glyphScaleFactorZ );\n\ttransformed *= glyphScaleFactor;\n#ifdef USE_GLYPH_ORIENTATION\n\ttransformed = glyphOrientation * transformed;\n#else\n\ttransformed = uGlyphOrientation * transformed;\n#endif\n\ttransformed += glyphOffset;\n#endif\n\t#include <project_vertex>\n#ifdef USE_SIZE\n\tgl_PointSize = vsize;\n#else\n\tgl_PointSize = size;\n#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",It="uniform vec3 diffuse;\nuniform float opacity;\nuniform float opacityFactor;\nuniform float pickState[ 1 ];\nvarying vec3 vPickColor;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity * opacityFactor );\n\t#include <clipping_planes_fragment>\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tgl_FragColor = vec4( vPickColor, 1.0 );\n\t} else {\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t}\n}",Mt="attribute vec3 otherPosition;\nattribute float pattern;\nattribute float cellCount;\nattribute vec3 glyphOffset;\nattribute vec3 glyphScale;\nuniform vec3 uGlyphScale;\nuniform float glyphScaleFactorX;\nuniform float glyphScaleFactorY;\nuniform float glyphScaleFactorZ;\nattribute mat3 glyphOrientation;\nuniform mat3 uGlyphOrientation;\nuniform float pickState[ 1 ];\nuniform float startCell;\nuniform vec2 resolution;\n#ifdef USE_PATTERN\nvarying float vPattern;\n#endif\nvarying float vDistance;\nvarying vec3 vPickColor;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n\t#include <color_vertex>\n\tvec3 transformed = vec3( position );\n\tvec3 otherTransformed = vec3( otherPosition );\n#ifdef GLYPH\n#ifdef USE_GLYPH_SCALE\n\ttransformed *= glyphScale;\n\totherTransformed *= glyphScale;\n#else\n\ttransformed *= uGlyphScale;\n\totherTransformed *= uGlyphScale;\n#endif\n\tvec3 glyphScaleFactor = vec3( glyphScaleFactorX, glyphScaleFactorY, glyphScaleFactorZ );\n\ttransformed *= glyphScaleFactor;\n\totherTransformed *= glyphScaleFactor;\n#ifdef USE_GLYPH_ORIENTATION\n\ttransformed = glyphOrientation * transformed;\n\totherTransformed = glyphOrientation * otherTransformed;\n#else\n\ttransformed = uGlyphOrientation * transformed;\n\totherTransformed = uGlyphOrientation * otherTransformed;\n#endif\n\ttransformed += glyphOffset;\n\totherTransformed += glyphOffset;\n#endif\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\tvec2 ndcPos1 = gl_Position.xy / gl_Position.w;\n\tvec4 other_Position = projectionMatrix * modelViewMatrix * vec4( otherTransformed, 1.0 );\n\tvec2 ndcPos2 = other_Position.xy / other_Position.w;\n\tfloat aspect = resolution.x / resolution.y;\n\tvec2 dir = ndcPos2 - ndcPos1;\n\tdir.x *= aspect;\n\tbool end = false;\n\tif ( dir.y < -EPSILON ) {\n\t\tend = true;\n\t}\n\telse if ( dir.y > EPSILON ) {\n\t\tend = false;\n\t}\n\telse if ( dir.x < -EPSILON ) {\n\t\tend = true;\n\t}\n\tvDistance = end ? 0.0 : length( dir * resolution ) / 2.0;\n#ifdef USE_PATTERN\n\tvPattern = pattern + 0.5;\n#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Nt=At,Rt="attribute vec3 instanceStart;\nattribute vec3 instanceEnd;\nattribute vec3 instanceColorStart;\nattribute vec3 instanceColorEnd;\nattribute float instancePattern;\nattribute float instanceLinewidthStart;\nattribute float instanceLinewidthEnd;\nattribute float cellCount;\nuniform float pickState[ 1 ];\nuniform float startCell;\nuniform float linewidth;\nuniform vec2 resolution;\n#ifdef USE_PATTERN\nvarying float vPattern;\n#endif\nvarying float vDistance;\nvarying vec3 vPickColor;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n#ifdef USE_COLOR\n\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart.xyz : instanceColorEnd.xyz;\n#endif\n#ifdef USE_PATTERN\n\tvPattern = instancePattern + 0.5;\n#endif\n\tfloat widthFactor, avgWidthFactor;\n#ifdef USE_LINEWIDTH\n\twidthFactor = ( position.y < 0.5 ) ? instanceLinewidthStart : instanceLinewidthEnd;\n\tavgWidthFactor = ( instanceLinewidthStart + instanceLinewidthEnd ) / 2.0;\n#else\n\twidthFactor = avgWidthFactor = linewidth;\n#endif\n\tfloat aspect = resolution.x / resolution.y;\n\tvec4 localStart = vec4( instanceStart, 1.0 );\n\tvec4 localEnd = vec4( instanceEnd, 1.0 );\n\tvec4 start = modelViewMatrix * localStart;\n\tvec4 end = modelViewMatrix * localEnd;\n\tvec4 clipStart = projectionMatrix * start;\n\tvec4 clipEnd = projectionMatrix * end;\n\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n#ifdef LINEWIDTH_SCALE\n\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\tif ( perspective ) {\n\t\tvec2 xyStart = localStart.xy;\n\t\tvec2 xyEnd = localEnd.xy;\n\t\tvec2 scaleDir = xyEnd - xyStart;\n\t\tscaleDir = normalize( scaleDir );\n\t\tvec2 scaleOffset = vec2( scaleDir.y, -scaleDir.x );\n\t\tscaleOffset.y /= aspect;\n\t\tif ( position.x < 0.5 ) scaleOffset *= -1.0;\n\t\tscaleOffset *= ( widthFactor * 0.5 );\n\t\tvec4 startEnd = ( position.y < 0.5 ) ? localStart : localEnd;\n\t\tvec4 scaleClip = vec4( startEnd );\n\t\tscaleClip.xy += scaleOffset;\n\t\tvec4 scalePosition = projectionMatrix * modelViewMatrix * scaleClip;\n\t\tvec4 scalePosition2 = projectionMatrix * modelViewMatrix * startEnd;\n\t\twidthFactor = avgWidthFactor = length( scalePosition2.xy - scalePosition.xy ) * resolution.y * 2.0;\n\t} else {\n\t\tvec4 localScale = ( position.y < 0.5 ) ? localStart : localEnd;\n\t\tlocalScale.y += widthFactor;\n\t\tvec4 clipScale = projectionMatrix * modelViewMatrix * localScale;\n\t\twidthFactor = avgWidthFactor = length( clipScale.xy - clip.xy ) * resolution.y / 2.0;\n\t}\n#endif\n\tif ( widthFactor < 1.0 ) {\n\t\twidthFactor = 1.0;\n\t}\n\tif ( avgWidthFactor < 1.0 ) {\n\t\tavgWidthFactor = 1.0;\n\t}\n\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\tvec2 dirOrig = dir;\n\tdir.x *= aspect;\n\tdir = normalize( dir );\n\tvec2 offset = vec2( dir.y, -dir.x );\n\tdir.x /= aspect;\n\toffset.x /= aspect;\n\tif ( position.x < 0.5 ) offset *= -1.0;\n\toffset += ( position.y < 0.5 ) ? -dir * 0.3 : dir * 0.3;\n\toffset *= widthFactor;\n\tdir *= widthFactor;\n\toffset /= resolution.y;\n\tdir /= resolution.y;\n\toffset *= clip.w;\n\tclip.xy += offset;\n\tif ( clip.z > -1.0 ) {\n\t\tclip.z -= 5.0e-4;\n\t\tif ( clip.z < -1.0 ) clip.z = -1.0;\n\t}\n\tgl_Position = clip;\n\tvDistance = ( position.y < 0.5 ) ? 0.0 : ( length( dirOrig * resolution ) + 2.0 * length( dir * resolution ) ) / avgWidthFactor / 2.0;\n\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Gt=At,Ft="attribute float cellCount;\nattribute vec3 glyphOffset;\nattribute vec3 glyphScale;\nuniform vec3 uGlyphScale;\nuniform float glyphScaleFactorX;\nuniform float glyphScaleFactorY;\nuniform float glyphScaleFactorZ;\nattribute mat3 glyphOrientation;\nuniform mat3 uGlyphOrientation;\nuniform float pickState[ 1 ];\nuniform float startCell;\nvarying vec3 vPickColor;\n#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n#ifdef GLYPH\n#ifdef USE_GLYPH_SCALE\n\ttransformed *= glyphScale;\n#else\n\ttransformed *= uGlyphScale;\n#endif\n\tvec3 glyphScaleFactor = vec3( glyphScaleFactorX, glyphScaleFactorY, glyphScaleFactorZ );\n\ttransformed *= glyphScaleFactor;\n#ifdef USE_GLYPH_ORIENTATION\n\ttransformed = glyphOrientation * transformed;\n#else\n\ttransformed = uGlyphOrientation * transformed;\n#endif\n\ttransformed += glyphOffset;\n#endif\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",zt="uniform float stipple;\nuniform vec3 stippleColor;\nuniform vec4 stipplePattern[ 16 ];\nuniform vec3 diffuse;\nuniform float opacity;\nuniform float opacityFactor;\nuniform float textureBlending;\nuniform float pickState[ 1 ];\nvarying vec3 vPickColor;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity * opacityFactor );\n\t#include <clipping_planes_fragment>\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tgl_FragColor = vec4( vPickColor, 1.0 );\n\t} else {\n\tif ( stipple > 0.5 ) {\n\t\tvec2 coord = floor( mod( gl_FragCoord.xy, 32.0 ) );\n\t\tint index = int( floor( coord.x / 64.0 ) + ( coord.y / 2.0 ) );\n\t\tint comp = int( floor( coord.x / 16.0 ) + mod( coord.y , 2.0 ) * 2.0 );\n\t\tfor ( int i = 0; i < 16; i ++ ) {\n\t\t\tif ( i == index ) {\n\t\t\t\tfloat shift = pow( 2.0, floor( mod( gl_FragCoord.x, 16.0 ) ) );\n\t\t\t\tfloat shortPattern;\n\t\t\t\tif ( comp == 0 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].x;\n\t\t\t\t} else if ( comp == 1 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].y;\n\t\t\t\t} else if ( comp == 2 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].z;\n\t\t\t\t} else {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].w;\n\t\t\t\t}\n\t\t\t\tif ( mod( floor( shortPattern / shift ), 2.0 ) > 0.5 ) {\n\t\t\t\t\tdiffuseColor = vec4( stippleColor, opacity );\n\t\t\t\t} else if ( stipple < 1.5 ) {\n\t\t\t\t\tdiscard;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tif ( textureBlending > 1.5 ) {\n\t\tvec3 temp = mix( diffuseColor.rgb, sampledDiffuseColor.rgb, sampledDiffuseColor.a );\n\t\tdiffuseColor = vec4( temp, diffuseColor.a );\n\t} else if ( textureBlending < 0.5 ) {\n\t\tdiffuseColor = sampledDiffuseColor;\n\t} else {\n\t\tdiffuseColor *= sampledDiffuseColor;\n\t}\n#endif\n\t#include <alphatest_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\t}\n}",Ht="attribute float cellCount;\nattribute vec3 glyphOffset;\nattribute vec3 glyphScale;\nuniform vec3 uGlyphScale;\nuniform float glyphScaleFactorX;\nuniform float glyphScaleFactorY;\nuniform float glyphScaleFactorZ;\nattribute mat3 glyphOrientation;\nuniform mat3 uGlyphOrientation;\nuniform float pickState[ 1 ];\nuniform float startCell;\nvarying vec3 vPickColor;\n#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tfloat cellNum = startCell + cellCount;\n\t\t\n\t\tfloat red = fract( cellNum / (255.0*255.0*255.0) );\n\t\tif ( pickState[ 0 ] > 1.5 ) {\n\t\n\t\t\tfloat red2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat green2 = fract( cellNum / (255.0*255.0*255.0*255.0*255.0) );\n\t\t\tfloat blue2 = fract( cellNum / (255.0*255.0*255.0*255.0) );\n\t\n\t\t\tred2 -= green2 / 255.0;\n\t\t\tgreen2 -= blue2 / 255.0;\n\t\t\tblue2 -= red / 255.0;\n\t\t\tvPickColor = vec3( red2, green2, blue2 );\n\t\t} else {\n\t\t\tfloat green = fract( cellNum / (255.0*255.0) );\n\t\t\tfloat blue = fract( cellNum / 255.0 );\n\t\t\tred -= green / 255.0;\n\t\t\tgreen -= blue / 255.0;\n\t\t\tvPickColor = vec3( red, green, blue );\n\t\t}\n\t}\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n#ifdef GLYPH\n#ifdef USE_GLYPH_SCALE\n\ttransformed *= glyphScale;\n#else\n\ttransformed *= uGlyphScale;\n#endif\n\tvec3 glyphScaleFactor = vec3( glyphScaleFactorX, glyphScaleFactorY, glyphScaleFactorZ );\n\ttransformed *= glyphScaleFactor;\n#ifdef USE_GLYPH_ORIENTATION\n\ttransformed = glyphOrientation * transformed;\n#else\n\ttransformed = uGlyphOrientation * transformed;\n#endif\n\ttransformed += glyphOffset;\n#endif\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Wt="uniform float ambientIntensity;\nuniform float diffuseIntensity;\nuniform float stipple;\nuniform vec3 stippleColor;\nuniform vec4 stipplePattern[ 16 ];\nuniform float textureBlending;\nuniform float pickState[ 1 ];\nvarying vec3 vPickColor;\n#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\nuniform float opacityFactor;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity * opacityFactor );\n\t#include <clipping_planes_fragment>\n\tif ( pickState[ 0 ] > 0.5 ) {\n\t\tgl_FragColor = vec4( vPickColor, 1.0 );\n\t} else {\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\tif ( stipple > 0.5 ) {\n\t\tvec2 coord = floor( mod( gl_FragCoord.xy, 32.0 ) );\n\t\tint index = int( floor( coord.x / 64.0 ) + ( coord.y / 2.0 ) );\n\t\tint comp = int( floor( coord.x / 16.0 ) + mod( coord.y , 2.0 ) * 2.0 );\n\t\tfor ( int i = 0; i < 16; i ++ ) {\n\t\t\tif ( i == index ) {\n\t\t\t\tfloat shift = pow( 2.0, floor( mod( gl_FragCoord.x, 16.0 ) ) );\n\t\t\t\tfloat shortPattern;\n\t\t\t\tif ( comp == 0 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].x;\n\t\t\t\t} else if ( comp == 1 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].y;\n\t\t\t\t} else if ( comp == 2 ) {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].z;\n\t\t\t\t} else {\n\t\t\t\t\tshortPattern = stipplePattern[ i ].w;\n\t\t\t\t}\n\t\t\t\tif ( mod( floor( shortPattern / shift ), 2.0 ) > 0.5 ) {\n\t\t\t\t\tdiffuseColor = vec4( stippleColor, opacity );\n\t\t\t\t} else if ( stipple < 1.5 ) {\n\t\t\t\t\tdiscard;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tif ( textureBlending > 1.5 ) {\n\t\tvec3 temp = mix( diffuseColor.rgb, sampledDiffuseColor.rgb, sampledDiffuseColor.a );\n\t\tdiffuseColor = vec4( temp, diffuseColor.a );\n\t} else if ( textureBlending < 0.5 ) {\n\t\tdiffuseColor = sampledDiffuseColor;\n\t} else {\n\t\tdiffuseColor *= sampledDiffuseColor;\n\t}\n#endif\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\tvec3 outgoingLight = ( reflectedLight.directDiffuse * diffuseIntensity ) + ( reflectedLight.indirectDiffuse * ambientIntensity ) + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\t}\n}",Yt={points:{uniforms:b.merge([x.points,x.fog,jt.base]),vertexShader:Dt,fragmentShader:It},line:{uniforms:b.merge([x.common,x.fog,jt.base,jt.line]),vertexShader:Mt,fragmentShader:Nt},thick:{uniforms:b.merge([x.common,x.fog,jt.base,jt.line,{linewidth:{value:1}}]),vertexShader:Rt,fragmentShader:Gt},basic:{uniforms:b.merge([x.common,x.fog,jt.base,jt.mesh]),vertexShader:Ft,fragmentShader:zt},phong:{uniforms:b.merge([x.common,x.fog,x.lights,jt.base,jt.mesh,{ambientIntensity:{value:.31},diffuseIntensity:{value:.7},emissive:{value:new u(0)},specular:{value:new u(2039583)},shininess:{value:63.8386159788056}}]),vertexShader:Ht,fragmentShader:Wt}};class Bt extends Tt{constructor(t){super({uniforms:b.clone(Yt.points.uniforms),vertexShader:Yt.points.vertexShader,fragmentShader:Yt.points.fragmentShader}),this.isPointsMaterial=!0,Object.defineProperties(this,{vertexSizes:{get:function(){return this.defines.USE_SIZE},set:function(t){this.defines.USE_SIZE=t}}}),this.map=null,this.size=1,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.size=t.size,this}toJSON(t){const e=super.toJSON(t);return e.type="PointsMaterial",this.vertexSizes&&(e.vertexSizes=!0),e}equals(t){return!1!==super.equals(t)&&!!t.isPointsMaterial}}class Ut extends Tt{constructor(t){super({uniforms:b.clone(Yt.basic.uniforms),vertexShader:Yt.basic.vertexShader,fragmentShader:Yt.basic.fragmentShader}),this.isMeshBasicMaterial=!0,Object.defineProperties(this,{stipple:{get:function(){return this.uniforms.stipple.value},set:function(t){this.uniforms.stipple.value=t}},stippleColor:{get:function(){return this.uniforms.stippleColor.value},set:function(t){this.uniforms.stippleColor.value=t}},stipplePattern:{get:function(){return this.uniforms.stipplePattern.value},set:function(t){this.uniforms.stipplePattern.value=t}},textureBlending:{get:function(){return this.uniforms.textureBlending.value},set:function(t){this.uniforms.textureBlending.value=t}}}),this.map=null,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this}toJSON(t){const e=super.toJSON(t);return e.type="MeshBasicMaterial",0!==this.stipple&&(e.stipple=this.stipple),0!==this.stippleColor.getHex()&&(e.stippleColor=this.stippleColor.getHex()),JSON.stringify(this.stipplePattern)!==JSON.stringify(new Float32Array(64))&&(e.stipplePattern=Array.prototype.slice.call(this.stipplePattern)),1!==this.textureBlending&&(e.textureBlending=this.textureBlending),e}equals(t){return!1!==super.equals(t)&&!(!t.isMeshBasicMaterial&&!t.isMeshPhongMaterial)}}class Xt extends Ut{constructor(t){super({uniforms:b.clone(Yt.phong.uniforms),vertexShader:Yt.phong.vertexShader,fragmentShader:Yt.phong.fragmentShader}),this.isMeshPhongMaterial=!0,this.isMeshBasicMaterial=!1,Object.defineProperties(this,{ambientIntensity:{get:function(){return this.uniforms.ambientIntensity.value},set:function(t){this.uniforms.ambientIntensity.value=t}},diffuseIntensity:{get:function(){return this.uniforms.diffuseIntensity.value},set:function(t){this.uniforms.diffuseIntensity.value=t}}}),this.specular=new u(4737096),this.shininess=63.8386159788056,this.emissive=new u(0),this.emissiveIntensity=1,this.lights=!0,this.setValues(t)}copy(t){return super.copy(t),this.specular.copy(t.specular),this.shininess=t.shininess,this.flatShading=t.flatShading,this}toJSON(t){const e=super.toJSON(t);return e.type="MeshPhongMaterial",.31!==this.ambientIntensity&&(e.ambientIntensity=this.ambientIntensity),.7!==this.diffuseIntensity&&(e.diffuseIntensity=this.diffuseIntensity),4737096===this.specular.getHex()&&(e.specular=void 0),63.8386159788056===this.shininess&&(e.shininess=void 0),e}equals(t){return!1!==super.equals(t)&&(!!t.isMeshPhongMaterial&&(t.ambientIntensity===this.ambientIntensity&&(t.diffuseIntensity===this.diffuseIntensity&&(t.specular.getHex()===this.specular.getHex()&&t.shininess===this.shininess))))}}class Zt extends Tt{constructor(t){super({uniforms:b.clone(Yt.line.uniforms),vertexShader:Yt.line.vertexShader,fragmentShader:Yt.line.fragmentShader}),this.isLineBasicMaterial=!0,Object.defineProperties(this,{pattern:{get:function(){return this.uniforms.linePattern.value},set:function(t){this.uniforms.linePattern.value=t}},vertexPatterns:{get:function(){return this.defines.USE_PATTERN},set:function(t){this.defines.USE_PATTERN=t}},resolution:{get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value=t}}}),this.setValues(t)}toJSON(t){const e=super.toJSON(t);return e.type="LineMaterial",65535!==this.pattern&&(e.pattern=this.pattern),this.vertexPatterns&&(e.vertexPatterns=!0),e}equals(t){return!1!==super.equals(t)&&!!t.isLineBasicMaterial}}class Vt extends Zt{constructor(t){super({uniforms:b.clone(Yt.thick.uniforms),vertexShader:Yt.thick.vertexShader,fragmentShader:Yt.thick.fragmentShader}),this.isThickLineMaterial=!0,Object.defineProperties(this,{linewidth:{get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},vertexLinewidths:{get:function(){return this.defines.USE_LINEWIDTH},set:function(t){this.defines.USE_LINEWIDTH=t}},linewidthScale:{get:function(){return this.defines.LINEWIDTH_SCALE},set:function(t){this.defines.LINEWIDTH_SCALE=t}}}),this.setValues(t)}toJSON(t){const e=super.toJSON(t);return e.type="ThickLineMaterial",this.vertexLinewidths&&(e.vertexLinewidths=!0),this.linewidthScale&&(e.linewidthScale=!0),e}equals(t){return!1!==super.equals(t)&&(!!t.isThickLineMaterial&&t.vertexLinewidths===this.vertexLinewidths)}}w.createMaterialFromType=function(t){return new{PointsMaterial:Bt,MeshPhongMaterial:Xt,MeshBasicMaterial:Ut,LineMaterial:Zt,ThickLineMaterial:Vt}[t]};class qt extends w{parse(e){const i=super.parse(e);if(void 0!==e.glyphs&&(i.glyphs=e.glyphs),void 0!==e.vertexGlyphScales&&(i.vertexGlyphScales=e.vertexGlyphScales),void 0!==e.glyphScale&&i.glyphScale.fromArray(e.glyphScale),void 0!==e.vertexGlyphOrientations&&(i.vertexGlyphOrientations=e.vertexGlyphOrientations),void 0!==e.glyphOrientation&&i.glyphOrientation.fromArray(e.glyphOrientation),void 0!==e.vertexSizes&&(i.vertexSizes=e.vertexSizes),void 0!==e.pattern&&(i.pattern=e.pattern),void 0!==e.vertexPatterns&&(i.vertexPatterns=e.vertexPatterns),void 0!==e.vertexLinewidths&&(i.vertexLinewidths=e.vertexLinewidths),void 0!==e.linewidthScale&&(i.linewidthScale=e.linewidthScale),void 0!==e.stipple&&(i.stipple=e.stipple),void 0!==e.stippleColor&&void 0!==i.stippleColor&&i.stippleColor.setHex(e.stippleColor),void 0!==e.stipplePattern&&(i.stipplePattern=e.stipplePattern),void 0!==e.textureBlending&&(i.textureBlending=e.textureBlending),void 0!==e.ambientIntensity&&(i.ambientIntensity=e.ambientIntensity),void 0!==e.diffuseIntensity&&(i.diffuseIntensity=e.diffuseIntensity),void 0!==e.clippingPlanes){i.clippingPlanes=[];for(let n=0,a=e.clippingPlanes.length;n<a;n++){const a=e.clippingPlanes[n],r=new S(new t(a.normal[0],a.normal[1],a.normal[2]),a.constant);i.clippingPlanes.push(r)}}return i.origTransparent=i.transparent,i}}class Jt{constructor(t){this.bufferGeometryLoader=t}parse(t){const e=this.bufferGeometryLoader.parse(t),i=e.attributes.position;if(void 0!==i){const t=new O(i.array.length,3);for(let e=0,n=i.array.length/6;e<n;e++)t.array[6*e+0]=i.array[6*e+3],t.array[6*e+1]=i.array[6*e+4],t.array[6*e+2]=i.array[6*e+5],t.array[6*e+3]=i.array[6*e+0],t.array[6*e+4]=i.array[6*e+1],t.array[6*e+5]=i.array[6*e+2];e.setAttribute("otherPosition",t)}return e}}const Kt=new E,Qt=new t;class $t extends C{constructor(){super(),this.isThickLineSegmentsBufferGeometry=!0,this.type="ThickLineSegmentsBufferGeometry";this.setAttribute("position",new O([0,0,0,1,1,0,0,1,0,0,0,0,1,0,0,1,1,0],3))}applyMatrix4(t){const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new k(e,6,1);return this.setAttribute("instanceStart",new _(i,3,0)),this.setAttribute("instanceEnd",new _(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new k(e,6,1);return this.setAttribute("instanceColorStart",new _(i,3,0)),this.setAttribute("instanceColorEnd",new _(i,3,3)),this}setPatterns(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new k(e,2,1);return this.setAttribute("instancePattern",new _(i,1,0)),this}setLinewidths(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new k(e,2,1);return this.setAttribute("instanceLinewidthStart",new _(i,1,0)),this.setAttribute("instanceLinewidthEnd",new _(i,1,1)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new E);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),Kt.setFromBufferAttribute(e),this.boundingBox.union(Kt))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new P),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let a=0,r=t.count;a<r;a++)Qt.fromBufferAttribute(t,a),n=Math.max(n,i.distanceToSquared(Qt)),Qt.fromBufferAttribute(e,a),n=Math.max(n,i.distanceToSquared(Qt));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("AVS.Three.ThickLineSegmentsBufferGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}applyMatrix(t){return console.warn("AVS.Three.ThickLineSegmentsBufferGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}class te{parse(t){const e=new $t,i=t.data.attributes;return void 0!==i.position&&e.setPositions(i.position.array),void 0!==i.color&&e.setColors(i.color.array),void 0!==i.pattern&&e.setPatterns(i.pattern.array),void 0!==i.linewidth&&e.setLinewidths(i.linewidth.array),e}}const ee=new i,ie=new L,ne=new P;class ae extends Ot{constructor(t,e){super(t,e),this.isThickLineSegments=!0,this.type="ThickLineSegments"}raycast(e,i){const n=this.geometry,a=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ne.copy(n.boundingSphere),ne.applyMatrix4(a),ne.radius+=r,!1===e.ray.intersectsSphere(ne))return;ee.copy(a).invert(),ie.copy(e.ray).applyMatrix4(ee);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new t,h=new t,d=new t,p=new t,u=n.attributes.instanceStart;for(let t=Math.max(0,s.start),n=Math.min(u.count,s.start+s.count)-1;t<n;t+=2){c.fromBufferAttribute(u,t),h.fromBufferAttribute(u,t+1);if(ie.distanceSqToSegment(c,h,p,d)>l)continue;p.applyMatrix4(this.matrixWorld);const n=e.ray.origin.distanceTo(p);n<e.near||n>e.far||i.push({distance:n,point:d.clone().applyMatrix4(this.matrixWorld),index:t,face:null,faceIndex:null,object:this})}}}class re{constructor(){this.uuid=j.generateUUID(),this.transparent=!1,this.opacity=1,this.opacityFactor=1}dispose(){}}class se extends T{constructor(){super(),this.isBillboardText=!0,this.type="BillboardText",this.text="Label",this.fontSize=16,this.fontStyle="normal",this.fontWeight="normal",this.textDecoration="",this.fontFamily="sans-serif",this.color=new u(0),this.textAlign="",this.transform="",this.transformOrigin="",this.material=new re,this.div=document.createElement("div"),this.div.style.position="absolute",this.div.style.whiteSpace="nowrap",this.div.style.userSelect="none",this.scene=null,this.scaleFactor=1,this.left=0,this.top=0,this.updateStyle()}addToScene(t){null===this.scene&&(this.scene=t,t.labels.push(this),t.landscapeDiv.appendChild(this.div),this.updateStyle())}updateStyle(){this.div.innerHTML=this.text,this.div.style.fontStyle=this.fontStyle,this.div.style.fontWeight=this.fontWeight,this.div.style.textDecoration=this.textDecoration,this.div.style.color="#"+this.color.getHexString(),this.div.style.transform=this.transform,this.div.style.transformOrigin=this.transformOrigin,this.material.transparent?this.div.style.opacity=this.material.opacity*this.material.opacityFactor:this.div.style.opacity=1,this.div.style.visibility=this.visible?"visible":"hidden",void 0!==this.div.firstChild.style&&(this.div.firstChild.style.float="left"),/\s/.test(this.fontFamily)?this.div.style.fontFamily="'"+this.fontFamily+"'":this.div.style.fontFamily=this.fontFamily,this.textScale||(this.div.style.fontSize=this.fontSize+"px")}updatePosition(){this.updateMatrixWorld();const e=(new t).setFromMatrixPosition(this.matrixWorld);if(e.project(this.scene.camera),this.left=(e.x+1)/2*this.scene.landscapeWidth,this.top=(1-(e.y+1)/2)*this.scene.landscapeHeight,this.moveText(),this.textScale){const e=new t(0,1,0).multiplyScalar(this.fontSize).add(this.position);e.applyMatrix4(this.parent.matrixWorld),e.project(this.scene.camera);const i=(1-(e.y+1)/2)*this.scene.landscapeHeight,n=Math.abs(i-this.top);this.div.style.fontSize=n+"px"}this.material.transparent?this.div.style.opacity=this.material.opacity*this.material.opacityFactor:this.div.style.opacity=1,this.div.style.visibility=this.visible?"visible":"hidden"}moveText(){this.div.style.left=Math.floor((this.panOffsetX??0)+this.left)+"px",this.div.style.top=Math.floor((this.panOffsetY??0)+this.top)+"px"}}class oe extends A{parse(t,e,i,n,a,r,s){const o=this.parseGeometries(t.geometries);r=Object.assign(r??{},o);const l=this.parseImages(t.images,(function(){void 0!==e&&e(d)}));i=Object.assign(i??{},l);const c=this.parseTextures(t.textures,i);n=Object.assign(n??{},c);const h=this.parseMaterials(t.materials,n);a=Object.assign(a??{},h);const d=this.parseObject(t.object,r,a,n);if(void 0!==s&&(s.add(d),d.saveVisible=d.visible,d.visible=!1),void 0!==e){let t=!1;for(const e in l)if(l[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(d)}return d}parseGeometries(t,e){const i={};if(void 0!==t){const e=new D,n=new Jt(e),a=new te;for(let r=0,s=t.length;r<s;r++){let s;const o=t[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=e.parse(o);break;case"LinePatternBufferGeometry":s=n.parse(o);break;case"ThickLineBufferGeometry":s=a.parse(o);break;case"SphereGeometry":s=I.fromJSON(o);break;default:console.warn(`AVS.Three.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),!0===s.isBufferGeometry&&void 0!==o.userData&&(s.userData=o.userData),i[o.uuid]=s}}return i}parseMaterials(t,e){const i={};if(void 0!==t){const n=new qt;n.setTextures(e);for(let e=0,a=t.length;e<a;e++){const a=t[e];i[a.uuid]=n.parse(a)}}return i}parseObject(t,e,i,n){let a,r,s;function o(t){return void 0===e[t]&&console.warn("AVS.Three.ObjectLoader: Undefined geometry",t),e[t]}function l(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];void 0===i[a]&&console.warn("AVS.Three.ObjectLoader: Undefined material",a),e.push(i[a])}return e}return void 0===i[t]&&console.warn("AVS.Three.ObjectLoader: Undefined material",t),i[t]}}function c(t){return void 0===n[t]&&console.warn("AVS.Three.ObjectLoader: Undefined texture",t),n[t]}switch(t.type){case"Scene":a=new Lt,void 0!==t.background&&(Number.isInteger(t.background)?a.background=new u(t.background):a.background=c(t.background)),void 0!==t.environment&&(a.environment=c(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?a.fog=new M(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(a.fog=new N(t.fog.color,t.fog.density))),void 0!==t.backgroundBlurriness&&(a.backgroundBlurriness=t.backgroundBlurriness);break;case"PerspectiveCamera":a=new Pt(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(a.focus=t.focus),void 0!==t.zoom&&(a.zoom=t.zoom),void 0!==t.filmGauge&&(a.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(a.filmOffset=t.filmOffset),void 0!==t.view&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new _t(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(a.zoom=t.zoom),void 0!==t.view&&(a.view=Object.assign({},t.view)),void 0!==t.keepAspectRatio&&(a.keepAspectRatio=t.keepAspectRatio);break;case"AmbientLight":a=new kt(t.color,t.intensity);break;case"DirectionalLight":a=new Ct(t.color,t.intensity);break;case"PointLight":a=new Et(t.color,t.intensity,t.distance,t.decay);break;case"Mesh":case"Quads":r=o(t.geometry),s=l(t.material),a=new Ot(r,s),a.cellType="Quads"===t.type?ct.Quads:ct.Triangles,a.frustumCulled=void 0===s.glyphs;break;case"LineSegments":a=new gt(o(t.geometry),l(t.material)),a.cellType=ct.Lines,a.frustumCulled=void 0===a.material.glyphs;break;case"ThickLineSegments":a=new ae(o(t.geometry),l(t.material)),a.cellType=ct.Quads,a.frustumCulled=void 0===a.material.glyphs;break;case"PointCloud":case"Points":a=new ft(o(t.geometry),l(t.material)),a.cellType=ct.Points,a.frustumCulled=void 0===a.material.glyphs;break;case"Group":a=new dt;break;case"BillboardText":a=new se,void 0!==t.text&&(a.text=t.text),void 0!==t.fontSize&&(a.fontSize=t.fontSize),void 0!==t.fontStyle&&(a.fontStyle=t.fontStyle),void 0!==t.fontWeight&&(a.fontWeight=t.fontWeight),void 0!==t.fontFamily&&(a.fontFamily=t.fontFamily),void 0!==t.textDecoration&&(a.textDecoration=t.textDecoration),void 0!==t.color&&a.color.setHex(t.color),void 0!==t.transform&&(a.transform=t.transform),void 0!==t.transformOrigin&&(a.transformOrigin=t.transformOrigin),void 0!==t.textScale&&(a.textScale=t.textScale),void 0!==t.width&&(a.width=t.width),void 0!==t.height&&(a.height=t.height);break;default:a=new T}if(a.uuid=t.uuid,void 0!==t.name&&(a.name=t.name),void 0!==t.matrix?(a.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(a.matrixAutoUpdate=t.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==t.position&&a.position.fromArray(t.position),void 0!==t.rotation&&a.rotation.fromArray(t.rotation),void 0!==t.quaternion&&a.quaternion.fromArray(t.quaternion),void 0!==t.scale&&a.scale.fromArray(t.scale)),void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(a.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(a.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(a.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&a.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(a.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.frustumCulled&&(a.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(a.renderOrder=t.renderOrder),void 0!==t.userData&&(a.userData=t.userData),void 0!==t.layers&&(a.layers.mask=t.layers),a.internalData={},void 0!==t.internalData&&(a.internalData=t.internalData),void 0!==t.children){const r=t.children;for(let t=0;t<r.length;t++)a.add(this.parseObject(r[t],e,i,n))}return a}}class le{constructor(t){var e=t;this.getID=function(){return e},this.container=document.createElement("div"),this.container.style.position="relative",this.container.style.outline="none",this.container.style.overflow="hidden",this.container.style.width="100%",this.container.style.height="100%",this.container.id="avsthreeDiv",this.domElement=this.container,this.scenes=[],this.currentScene=null,this.renderNextFrame=!1,this.objectLoader=new oe,this.startCell=1,this.raycaster=new R,this.raycaster.params.Line.threshold=.001,this.validPick=!1,this.pickType=ot.Ray,this.pickDepth=st.Closest,this.pickRayX=0,this.pickRayY=0,this.pickRectangleLeft=0,this.pickRectangleTop=0,this.pickRectangleRight=1,this.pickRectangleBottom=1,this.selectionListeners=[],this.intersects=[],this.highlightList=[],this.updateHighlight=!1,this.highlightColor=new u(16711680),this.updatePicking=!1,this.pickState=new Float32Array(1),this.resolution=new y,this.loading=!1,this.firstChunk=!1,this.animator=null,this.animatedGlyphs=[],this.enableAnimatedGlyphs=!1,this.visibleAnimatedGlyphs=!1,this.displayCanvas=!1,this.animate()}setWebGLRenderer(t){this.renderer=t,this.renderer.autoClear=!1,this.renderer.localClippingEnabled=!0,this.renderer.sortObjects=!1}updateSize(){var t=this.container.clientWidth,e=this.container.clientHeight;if(t!==this.width||e!==this.height){this.width=t,this.height=e,this.updateHighlight=!0,this.updatePicking=!0,this.validPick=!1;for(var i=0;i<this.scenes.length;i++)this.updateSceneSize(this.scenes[i])}}updateSceneSize(t){if(t.windowX=Math.floor(t.windowFractionX*this.width),t.windowWidth=Math.floor(t.windowFractionWidth*this.width),t.windowY=Math.floor(t.windowFractionY*this.height),t.windowHeight=Math.floor(t.windowFractionHeight*this.height),t.windowTop=this.height-t.windowHeight-t.windowY,t.windowDiv.style.left=t.windowX+"px",t.windowDiv.style.width=t.windowWidth+"px",t.windowDiv.style.top=t.windowTop+"px",t.windowDiv.style.height=t.windowHeight+"px",t.panScene||(t.landscapeWidth=t.windowWidth,t.landscapeHeight=t.windowHeight),t.landscapeDiv.style.width=t.landscapeWidth+"px",t.landscapeDiv.style.height=t.landscapeHeight+"px",t.landscapeDiv.style.left=(t.baseLeft??0)+(t.panOffsetX??0)+"px",t.landscapeDiv.style.top=(t.baseTop??0)+(t.panOffsetY??0)+"px",t.landscapeGrid&&this.sizeLandscapeGrid(t),t.rectCanvas&&(t.rectCanvas.width=t.windowWidth,t.rectCanvas.height=t.windowHeight),t.camera.isOrthographicCamera&&t.camera.keepAspectRatio){var e=t.landscapeWidth/t.internalData.width,i=t.landscapeHeight/t.internalData.height,n=t.internalData.width/t.internalData.height;t.landscapeWidth,t.landscapeHeight,n<1||(t.camera.left=t.camera.origLeft*e/i,t.camera.right=t.camera.origRight*e/i),t.camera.updateProjectionMatrix()}}sizeLandscapeGrid(t){for(var e=[],i=[],n=Math.floor(t.landscapeHeight/t.landscapeRows),a=0,r=0;r<t.landscapeRows;r++){var s=r==t.landscapeRows-1?t.landscapeHeight-a:n;e.push(a),i.push(s),a+=s}for(var o=[],l=[],c=Math.floor(t.landscapeWidth/t.landscapeColumns),h=0,d=0;d<t.landscapeColumns;d++){var p=d==t.landscapeColumns-1?t.landscapeWidth-h:c;o.push(h),l.push(p),h+=p}for(r=0;r<t.landscapeRows;r++)for(d=0;d<t.landscapeColumns;d++){var u=t.landscapeGrid[r][d];u.left=o[d],u.top=e[r];var f=!1;u.width===l[d]&&u.height===i[r]||(u.width=l[d],u.height=i[r],f=!0),this.isGridItemVisible(u)?u.initialized&&!f||(u.initialized||this.initializeGridItem(u),this.sizeGridItem(u)):u.initialized&&this.disposeGridItem(u)}}sizeGridItem(t){t.initialized&&(t.canvas.style.left=t.left+"px",t.canvas.style.top=t.top+"px",t.canvas.style.width=t.width+"px",t.canvas.style.height=t.height+"px",t.highlightCanvas.style.left=t.left+"px",t.highlightCanvas.style.top=t.top+"px",t.highlightCanvas.style.width=t.width+"px",t.highlightCanvas.style.height=t.height+"px",t.pixelX=Math.floor(t.left*window.devicePixelRatio),t.pixelY=Math.floor(t.top*window.devicePixelRatio),t.pixelWidth=Math.floor(t.width*window.devicePixelRatio),t.pixelHeight=Math.floor(t.height*window.devicePixelRatio),t.canvas.width=t.pixelWidth,t.canvas.height=t.pixelHeight,t.highlightCanvas.width=t.pixelWidth,t.highlightCanvas.height=t.pixelHeight,t.renderTarget.setSize(t.pixelWidth,t.pixelHeight),t.pixelBuffer=new Uint8Array(4*t.pixelWidth*t.pixelHeight),t.pickingRenderTarget.setSize(t.pixelWidth,t.pixelHeight),t.pickingPixelBuffer=new Uint8Array(4*t.pixelWidth*t.pixelHeight))}clearGeometry(){for(;this.container.lastChild;)this.container.removeChild(this.container.lastChild);this.panInteractor&&this.panInteractor.clear();for(let t=0;t<this.scenes.length;t++)this.scenes[t].traverse((function(t){t.material&&(t.material.map&&t.material.map.dispose(),t.material.dispose()),t.geometry&&t.geometry.dispose()}));this.scenes=[],this.currentScene=null,this.startCell=1,null!==this.animator&&this.animator.clear(),this.animatedGlyphs=[]}setPickDepth(t){void 0===t&&(t=st.Closest),this.pickDepth!==t&&(this.pickDepth=t)}setPickRay(t,e){if(t<0||e<0||t>this.width||e>this.height)return this.validPick=!1,void console.error("AVS.Three.Viewer: pick ray coordinates out of range.");this.pickType=ot.Ray,this.pickRayX=t,this.pickRayY=e,this.validPick=!0}setPickRectangle(t,e,i,n){if(t<0||e<0||i>this.width||n>this.height)return this.validPick=!1,void console.error("AVS.Three.Viewer: pick rectangle coordinates out of range.");this.pickType=ot.Rectangle,this.pickRectangleLeft=t,this.pickRectangleTop=e,this.pickRectangleRight=i,this.pickRectangleBottom=n,this.validPick=!0}interactorUpdate(t){t===this.transformInteractor&&void 0!==this.zoomRectangleInteractor&&t.object===this.zoomRectangleInteractor.object&&(this.zoomRectangleInteractor.scale.copy(t.object.scale),this.zoomRectangleInteractor.position.copy(t.object.position)),t===this.zoomRectangleInteractor&&void 0!==this.transformInteractor&&t.object===this.transformInteractor.object&&(this.transformInteractor.scale.copy(t.object.scale),this.transformInteractor.position.copy(t.object.position)),this.updatePicking=!0,this.renderNextFrame=!0,void 0!==this.stats&&this.stats.update()}panInteractorUpdate(){for(var t=0;t<this.scenes.length;t++){var e=this.scenes[t];if(e.landscapeGrid)for(var i=0;i<e.landscapeRows;i++)for(var n=0;n<e.landscapeColumns;n++){var a=e.landscapeGrid[i][n];this.isGridItemVisible(a)?a.initialized||(this.initializeGridItem(a),this.sizeGridItem(a),this.renderGridItem(a,!0),this.updatePicking=!0):a.initialized&&this.disposeGridItem(a)}}}addInteractor(t){if(t.isTransformInteractor)this.transformInteractor=t,t.addEventListener("change",this.interactorUpdate.bind(this,t));else if(t.isZoomRectangleInteractor)this.zoomRectangleInteractor=t,t.addEventListener("change",this.interactorUpdate.bind(this,t));else{if(!t.isPanInteractor)return;this.panInteractor=t,t.addEventListener("change",this.panInteractorUpdate.bind(this))}t.domElement=this.domElement}removeInteractor(t){t.isTransformInteractor?(t.removeEventListener("change",this.interactorUpdate.bind(this,this.transformInteractor)),this.transformInteractor=void 0):t.isZoomRectangleInteractor?(t.removeEventListener("change",this.interactorUpdate.bind(this,this.zoomRectangleInteractor)),this.zoomRectangleInteractor=void 0):t.isPanInteractor&&(this.panInteractor=void 0)}setAnimator(t){this.animator=t,t.addEventListener("change",this.interactorUpdate.bind(this))}addStats(){void 0===this.stats&&(this.stats=new Stats,this.container.appendChild(this.stats.dom))}addGeometry(t){t.updateMatrixWorld(),void 0!==t.internalData.background?this.container.style.backgroundColor="#"+t.internalData.background.toString(16).padStart(6,"0"):this.container.style.backgroundColor="transparent",this.processGeometry(t);for(var e=0;e<this.scenes.length;e++){var i=this.scenes[e];i.parent&&i.parent.remove(i)}}processGeometry(t){if(t.isScene){for(var e=0;e<t.children.length;e++){var i=t.children[e];if(i.isPerspectiveCamera||i.isOrthographicCamera){t.camera=i,t.remove(i);break}}null==t.camera&&null!==t.background&&(t.camera=new c),void 0!==t.camera&&this.addScene(t)}this.attachInteractors(t),this.addLabels(t),this.createPickingInfo(t),this.addMaterialReferences(t),t.internalData.animatedGlyphs&&this.animatedGlyphs.push(t);var n=t.children,a=n.length;for(e=0;e<a;)this.processGeometry(n[e]),n.length<a?a=n.length:e++}addScene(t,i=!1){this.scenes.push(t),this.currentScene=t,i||(this.currentRealScene=t),t.labels=[],this.calculateSceneFractions(t);var n=document.createElement("div");n.style.position="absolute",n.style.overflow="hidden",n.id=t.name+"-Window";var a=document.createElement("div");a.style.position="absolute",a.style.overflow="hidden",a.id=t.name+"-Landscape",n.appendChild(a),t.landscapeDiv=a,t.windowDiv=n,this.container.appendChild(n),this.updateSceneSize(t),t.startCell=this.startCell,t.highlightScene=new d,t.highlightScene.add(new e);for(var r=0;r<t.children.length;r++)t.children[r].isLight&&t.highlightScene.add(t.children[r].clone())}calculateSceneFractions(t){t.windowFractionX=t.internalData.x?Math.max(0,t.internalData.x/this.width):0,t.windowFractionWidth=t.internalData.width?Math.min(1,t.internalData.width/this.width):1,t.windowFractionY=t.internalData.y?Math.max(0,t.internalData.y/this.height):0,t.windowFractionHeight=t.internalData.height?Math.min(1,t.internalData.height/this.height):1}createLandscapeGrid(t){void 0===t.landscapeRows&&(t.landscapeRows=1),void 0===t.landscapeColumns&&(t.landscapeColumns=1),t.landscapeGrid=[];for(var e=0;e<t.landscapeRows;e++){t.landscapeGrid.push([]);for(var i=0;i<t.landscapeColumns;i++){var n={};n.container=t.landscapeDiv,n.scene=t,n.name=t.name+"-Landscape-Grid-Row"+e+"-Col"+i,n.initialized=!1,t.landscapeGrid[e].push(n)}}this.sizeLandscapeGrid(t)}isGridItemVisible(t){var e=t.scene,i=(e.baseLeft??0)+(e.panOffsetX??0)+t.left,n=i+t.width,a=(e.baseTop??0)+(e.panOffsetY??0)+t.top,r=a+t.height;return!(n<0||i>e.windowWidth||r<0||a>e.windowHeight)}initializeGridItem(t){var e=document.createElement("canvas");e.style.position="absolute",e.id=t.name,t.container.insertBefore(e,t.container.firstChild),t.canvas=e,t.ctx=e.getContext("2d"),this.displayCanvas&&(e.style.backgroundColor="rgba("+255*Math.random()+","+255*Math.random()+","+255*Math.random()+",0.1)");var i=document.createElement("canvas");i.style.position="absolute",i.id=t.name+"-Highlight",t.container.appendChild(i),t.highlightCanvas=i,t.highlightCtx=i.getContext("2d"),t.renderTarget=new G,t.renderTarget.texture.colorSpace=F,t.pickingRenderTarget=new G,t.initialized=!0}disposeGridItem(t){t.container.removeChild(t.canvas),t.canvas=null,t.ctx=null,t.container.removeChild(t.highlightCanvas),t.highlightCanvas=null,t.highlightCtx=null,t.renderTarget=null,t.pickingRenderTarget=null,t.initialized=!1}attachInteractors(e){if(e.internalData.attachTransformInteractor&&this.transformInteractor&&this.transformInteractor.setObjectScene(e,this.currentScene),e.internalData.attachZoomRectangleInteractor&&this.zoomRectangleInteractor&&this.zoomRectangleInteractor.setObjectScene(e,this.currentScene),e.internalData.attachPanInteractor&&this.panInteractor){var i=this.currentRealScene,n=e.parent;n.matrix.copy(e.parent.matrixWorld),n.matrixAutoUpdate=!1,n.isScene=!0,n.autoUpdate=!0,n.overrideMaterial=null,n.internalData.is3D=!1,n.internalData.pickable=this.isObjectPickable(e.parent),n.name=e.name,n.panScene=!0,i.origCamera||(i.origCamera=i.camera.clone(),i.internalData.origWidth=i.internalData.width,i.internalData.origHeight=i.internalData.height),n.camera=i.origCamera.clone();for(var a=n.camera.right-n.camera.left,r=n.camera.top-n.camera.bottom,s=0;s<i.children.length;s++)i.children[s].isLight&&n.add(i.children[s].clone());var o=new t;o.set(-e.internalData.xSize/2,-e.internalData.ySize/2,0),o.applyMatrix4(n.matrix);var l=new t;l.set(e.internalData.xSize/2,e.internalData.ySize/2,0),l.applyMatrix4(n.matrix);var c=i.internalData.origWidth,h=i.internalData.origHeight,d=Math.floor((o.x-n.camera.left)/a*c),p=Math.floor((1-(l.x-n.camera.left)/a)*c),u=Math.floor((o.y-n.camera.bottom)/r*h),f=Math.floor((1-(l.y-n.camera.bottom)/r)*h);this.panInteractor.leftLimit=(c-this.width)/2,this.panInteractor.rightLimit=-this.panInteractor.leftLimit,this.panInteractor.topLimit=(h-this.height)/2,this.panInteractor.bottomLimit=-this.panInteractor.topLimit,n.baseLeft=this.panInteractor.rightLimit-d,n.baseTop=this.panInteractor.bottomLimit-f,n.landscapeWidth=c,n.landscapeHeight=h,n.landscapeRows=Math.ceil(h/this.height),n.landscapeColumns=Math.ceil(c/this.width),n.centerWidth=c-d-p,n.centerHeight=h-u-f,n.zoomOffsetLeft=2*d+n.baseLeft,n.zoomOffsetTop=2*f+n.baseTop,"center"===e.internalData.attachPanInteractor?(n.internalData.x=d,n.internalData.width=this.width-d-p,n.internalData.y=u,n.internalData.height=this.height-u-f,i.internalData.x=n.internalData.x,i.internalData.width=n.internalData.width,i.internalData.y=n.internalData.y,i.internalData.height=n.internalData.height,i.camera.left=o.x,i.camera.right=l.x,i.camera.bottom=o.y,i.camera.top=l.y,this.calculateSceneFractions(i),this.updateSceneSize(i)):"bottom"===e.internalData.attachPanInteractor?(n.landscapeHeight=this.height,n.landscapeRows=1,n.camera.top=n.camera.bottom+r*this.height/h,n.internalData.x=d,n.internalData.width=this.width-d-p,n.internalData.y=0,n.internalData.height=this.height-f,n.baseTop=-f):"top"===e.internalData.attachPanInteractor?(n.landscapeHeight=this.height,n.landscapeRows=1,n.camera.bottom=n.camera.top-r*this.height/h,n.internalData.x=d,n.internalData.width=this.width-d-p,n.internalData.y=u,n.internalData.height=this.height-u,n.baseTop=0):"left"===e.internalData.attachPanInteractor?(n.landscapeWidth=this.width,n.landscapeColumns=1,n.camera.right=n.camera.left+a*this.width/c,n.internalData.x=0,n.internalData.width=this.width-p,n.internalData.y=u,n.internalData.height=this.height-u-f,n.baseLeft=0):"right"===e.internalData.attachPanInteractor&&(n.landscapeWidth=this.width,n.landscapeColumns=1,n.camera.left=n.camera.right-a*this.width/c,n.internalData.x=d,n.internalData.width=this.width-d,n.internalData.y=u,n.internalData.height=this.height-u-f,n.baseLeft=-d),this.addScene(n,!0),n.parent&&n.parent.remove(n),"center"===e.internalData.attachPanInteractor?this.panInteractor.object=n:"bottom"===e.internalData.attachPanInteractor?this.panInteractor.linkObjectsBottom.push(n):"top"===e.internalData.attachPanInteractor?this.panInteractor.linkObjectsTop.push(n):"left"===e.internalData.attachPanInteractor?this.panInteractor.linkObjectsLeft.push(n):"right"===e.internalData.attachPanInteractor&&this.panInteractor.linkObjectsRight.push(n),this.panInteractor.restorePanOffset(n),this.panInteractor.update()}else if(e.internalData.attachPanInteractorStatic&&this.panInteractor){var m=this;e.traverseAncestors((function(t){"bottom"===t.internalData.attachPanInteractor?(m.panInteractor.linkObjectsBottomStatic.push(e),e.linkBottom=t):"top"===t.internalData.attachPanInteractor?(m.panInteractor.linkObjectsTopStatic.push(e),e.linkTop=t):"left"===t.internalData.attachPanInteractor?(m.panInteractor.linkObjectsLeftStatic.push(e),e.linkLeft=t):"right"===t.internalData.attachPanInteractor&&(m.panInteractor.linkObjectsRightStatic.push(e),e.linkRight=t)}))}}createPickingInfo(t){if(void 0!==t.geometry&&void 0!==t.material){if(void 0===t.geometry.attributes.cellCount){var e,i;if(t.material.glyphs){var n=t.geometry.attributes.glyphOffset.array.length/3;i=n;for(var a=new Float32Array(n),r=0;r<n;r++)a[r]=r;e=new z(a,1)}else if(t.isThickLineSegments){i=(s=t.geometry.attributes.instanceStart.array.length/3)/2;for(a=new Float32Array(i),r=0;r<i;r++)a[r]=r;e=new z(a,1)}else{var s,o=1;t.isPoints?o=1:t.isLineSegments?o=2:t.isMesh&&(o=3),i=(s=t.geometry.attributes.position.array.length/3)/o,e=new O(s,1);for(r=0;r<i;r++)for(var l=0;l<o;l++)e.array[r*o+l]=r}t.geometry.setAttribute("cellCount",e),t.geometry.nCells=i}t.nCells=t.geometry.nCells,t.startCell=this.startCell,t.onBeforeRender=function(t,e,i,n,a,r){a.uniforms.startCell.value=this.startCell,a.uniformsNeedUpdate=!0},this.startCell+=t.nCells,this.currentScene.landscapeGrid||this.createLandscapeGrid(this.currentScene),!this.pickingRenderTarget2&&this.startCell>16777215&&(this.pickingRenderTarget2=new G(this.pixelWidth,this.pixelHeight),this.pickingPixelBuffer2=new Uint8Array(4*this.pixelWidth*this.pixelHeight)),this.updatePicking=!0}}addLabels(t){t.isBillboardText&&t.addToScene(this.currentScene)}addMaterialReferences(t){void 0!==t.material&&(t.material.pickState=this.pickState,void 0!==t.material.isLineBasicMaterial&&(t.material.resolution=this.resolution))}loadGeometryAsJson(t){var e=this;this.objectLoader.parse(t,(function(t){e.clearGeometry(),e.updateSize(),e.addGeometry(t),e.renderNextFrame=!0}))}runAnimation(){if(null!==this.animator){this.animator.clear();for(var t=0;t<this.scenes.length;t++)this.animator.attach(this.scenes[t]);this.animator.hasAnimations()&&this.animator.play()}}animate(t){requestAnimationFrame(this.animate.bind(this)),this.visibleAnimatedGlyphs&&this.updateAnimatedGlyphs(this.enableAnimatedGlyphs?t:0),this.renderNextFrame&&(this.renderNextFrame=!1,this.render()),this.pickDepth===st.Closest&&this.updatePicking&&(this.updatePicking=!1,this.pickRender())}setVisibleAnimatedGlyphs(t){this.visibleAnimatedGlyphs=t;for(let e=0;e<this.animatedGlyphs.length;e++)this.animatedGlyphs[e].traverse((function(e){e.visible=t}));this.renderNextFrame=!0}setEnableAnimatedGlyphs(t){this.enableAnimatedGlyphs=t}updateAnimatedGlyphs(e){const i=new t,n=new t,a=new t,r=new t,s=new t,o=new v,l=new u;for(let t=0;t<this.animatedGlyphs.length;t++){const c=this.animatedGlyphs[t];void 0===c.animatedGlyphsInitialized&&(c.animatedGlyphsInfo=JSON.parse(c.internalData.animatedGlyphs));const h=c.animatedGlyphsInfo.colorPalette,d=c.animatedGlyphsInfo.coordinates,p=c.animatedGlyphsInfo.segmentStartCoordIndex,u=c.animatedGlyphsInfo.segmentEndCoordIndex,f=c.animatedGlyphsInfo.segmentSpacing,m=c.animatedGlyphsInfo.segmentSpeed,g=c.animatedGlyphsInfo.segmentSurfaceColorIndex;if(void 0===c.animatedGlyphsInitialized){let t=0;for(let e=0;e<p.length;e++){if(f[e]<=0||0===m[e])continue;const a=p[e],r=u[e],s=f[e];let o=0;for(let t=a;t<r;t++)i.set(d[3*t],d[3*t+1],d[3*t+2]),n.set(d[3*t+3],d[3*t+4],d[3*t+5]),o+=i.distanceTo(n);t+=Math.ceil(o/s)}c.traverse((function(e){let i=e.geometry;if(void 0!==i){const n=i.getAttribute("position");i.dispose();const a=new C;a.setAttribute("position",n),a.setAttribute("glyphOffset",new z(new Float32Array(3*t),3)),a.setAttribute("glyphOrientation",new z(new Float32Array(9*t),9)),e.isMesh&&e.material.vertexColors&&a.setAttribute("color",new z(new Float32Array(3*t),3)),e.geometry=a}})),c.animatedGlyphsInitialized=!0}const v=[],y=[],b=[];let x=0;for(let t=0;t<p.length;t++){if(f[t]<=0||0===m[t])continue;let c=g[t];(c<0||c>h.length)&&(c=0),l.set(h[c]);const w=m[t]>0?1:-1,S=f[t],O=w<0?u[t]-1:p[t],E=w<0?p[t]-1:u[t],C=S/Math.abs(m[t]);let k=S*(e%(1e3*C)/(1e3*C));for(let t=O;t!=E;t+=w){i.set(d[3*t],d[3*t+1],d[3*t+2]),n.set(d[3*t+3],d[3*t+4],d[3*t+5]);const e=i.distanceTo(n);a.subVectors(n,i).multiplyScalar(w).normalize(),r.copy(a).multiplyScalar(S),s.copy(a).multiplyScalar(k).add(w<0?n:i);const c=Math.atan2(-a.x,a.y);for(o.makeRotation(c);k<e;)v.push(s.x),v.push(s.y),v.push(s.z),y.push(o.elements[0]),y.push(o.elements[1]),y.push(o.elements[2]),y.push(o.elements[3]),y.push(o.elements[4]),y.push(o.elements[5]),y.push(o.elements[6]),y.push(o.elements[7]),y.push(o.elements[8]),b.push(l.r),b.push(l.g),b.push(l.b),s.add(r),k+=S,x++;k-=e}}c.traverse((function(t){const e=t.geometry;if(void 0!==e){const i=e.getAttribute("glyphOffset");i.set(v,0),i.needsUpdate=!0;const n=e.getAttribute("glyphOrientation");if(n.set(y,0),n.needsUpdate=!0,t.material.vertexColors){const t=e.getAttribute("color");t.set(b,0),t.needsUpdate=!0}e.instanceCount=x}})),this.renderNextFrame=!0}}loadGeometryAsEvents(t){var e=this,i=0,n=-1,a=0;function r(t){if(a--,t.layers.set(1),t.visible=t.saveVisible,n>0&&0==a)return e.render(),e.loading=!1,void(e.firstChunk=!1)}function s(t){if("Group"===t.type){var n=e.objectLoader.parse(t);null!==e.curGroup&&e.curGroup.add(n),"SceneRoot"===n.name&&(void 0!==n.internalData.background?e.container.style.backgroundColor="#"+n.internalData.background.toString(16).padStart(6,"0"):e.container.style.backgroundColor="transparent"),n.updateMatrixWorld(!0),e.attachInteractors(n),e.curGroup=n}else if("FinishGroup"===t.type)null!==e.curGroup.parent&&(e.curGroup=e.curGroup.parent);else if("Geometry"===t.type){a++;var s=e.objectLoader.parse(t,r,e.images,e.textures,e.materials,e.geometries,e.curGroup);i++,e.addLabels(s),e.createPickingInfo(s),e.addMaterialReferences(s)}else if("Layout"===t.type){for(var o=e.objectLoader.parse(t),l=0;l<o.children.length;l++){var h=o.children[l];if(h.isPerspectiveCamera||h.isOrthographicCamera){o.camera=h,o.remove(h);break}}null==o.camera&&null!==o.background&&(o.camera=new c),void 0!==o.camera&&e.addScene(o),e.curGroup=o}else console.log("ERROR: unknown type: "+t.type)}if(void 0!==this.chunkId&&this.chunkId===t.chunkId||(this.clearGeometry(),this.curGroup=null,this.images=[],this.textures=[],this.materials=[],this.geometries=[],this.firstChunk=!0,this.chunkId=t.chunkId),this.loading=!0,this.updateSize(),void 0!==t&&void 0!==t.events&&0!==t.events.length){for(var o=0;o<t.events.length;o++)s(t.events[o]);!0===t.moreChunks?this.render():(n=i-1,0==a&&(this.render(),this.loading=!1)),this.firstChunk=!1}else console.error("AVS.Three.Viewer.loadGeometryAsEvents: Can't get events")}highlightRender(){if(void 0!==this.renderer)for(var t=0;t<this.scenes.length;t++){var e=this.scenes[t];if(e.landscapeGrid){for(var i=0;i<e.landscapeRows;i++)for(var n=0;n<e.landscapeColumns;n++){var a=e.landscapeGrid[i][n];a.initialized&&(this.resolution.x=a.pixelWidth,this.resolution.y=a.pixelHeight,this.renderer.setSize(a.pixelWidth,a.pixelHeight),this.renderer.setClearColor(0,0),this.renderer.clear(),e.camera.setViewOffset(e.landscapeWidth,e.landscapeHeight,a.left,a.top,a.width,a.height),this.renderer.render(e.highlightScene,e.camera),a.highlightCtx.clearRect(0,0,a.pixelWidth,a.pixelHeight),a.highlightCtx.drawImage(this.renderer.domElement,0,0))}e.camera.clearViewOffset()}}else console.error("AVS.Three.Viewer: WebGLRenderer not set.")}pickRender(){if(void 0!==this.renderer){for(var t=0;t<this.scenes.length;t++){var e=this.scenes[t];if(e.landscapeGrid){e.traverse((function(t){void 0!==t.material&&(t.material.transparent=!1)}));for(var i=0;i<e.landscapeRows;i++)for(var n=0;n<e.landscapeColumns;n++){var a=e.landscapeGrid[i][n];a.initialized&&(this.resolution.x=a.pixelWidth,this.resolution.y=a.pixelHeight,this.renderer.setRenderTarget(a.pickingRenderTarget),this.pickState[0]=1,this.renderer.setClearColor(0,0),this.renderer.clear(),e.camera.setViewOffset(e.landscapeWidth,e.landscapeHeight,a.left,a.top,a.width,a.height),this.renderer.render(e,e.camera),this.renderer.readRenderTargetPixels(a.pickingRenderTarget,0,0,a.pixelWidth,a.pixelHeight,a.pickingPixelBuffer),a.pickingRenderTarget2&&(this.renderer.setRenderTarget(a.pickingRenderTarget2),this.pickState[0]=2,this.renderer.clear(),this.renderer.render(e,e.camera),this.renderer.readRenderTargetPixels(a.pickingRenderTarget2,0,0,a.pixelWidth,a.pixelHeight,a.pickingPixelBuffer2)))}e.camera.clearViewOffset(),e.traverse((function(t){void 0!==t.material&&(t.material.transparent=t.material.origTransparent)}))}}this.pickState[0]=0,this.renderer.setRenderTarget(null)}else console.error("AVS.Three.Viewer: WebGLRenderer not set.")}render(t){if(void 0!==this.renderer){if(null!==this.domElement.offsetParent){this.updateSize();for(var e=this.loading,i=t||!e,n=0;n<this.scenes.length;n++){var a=this.scenes[n];if(a.landscapeGrid){if(!i){a.camera.layers.set(1);for(var r=0;r<a.children.length;r++)a.children[r].isLight&&a.children[r].layers.set(1)}for(var s=0;s<a.landscapeRows;s++)for(var o=0;o<a.landscapeColumns;o++){var l=a.landscapeGrid[s][o];this.renderGridItem(l,i)}i||(a.camera.layers.set(0),a.traverse((function(t){t.layers.set(0)})))}for(r=0;r<a.labels.length;r++)a.labels[r].updatePosition()}this.updateHighlight&&(this.highlightRender(),this.updateHighlight=!1)}}else console.error("AVS.Three.Viewer: WebGLRenderer not set.")}renderGridItem(t,e){if(t.initialized){var i=t.scene;if(this.resolution.x=t.pixelWidth,this.resolution.y=t.pixelHeight,e?this.renderer.setSize(t.pixelWidth,t.pixelHeight):this.renderer.setRenderTarget(t.renderTarget),(e||this.firstChunk)&&(i.internalData.background?this.renderer.setClearColor(i.internalData.background,1):this.renderer.setClearColor(0,0),this.renderer.clear()),i.camera.setViewOffset(i.landscapeWidth,i.landscapeHeight,t.left,t.top,t.width,t.height),this.renderer.render(i,i.camera),e)t.ctx.clearRect(0,0,t.pixelWidth,t.pixelHeight),t.ctx.drawImage(this.renderer.domElement,0,0);else{this.renderer.readRenderTargetPixels(t.renderTarget,0,0,t.pixelWidth,t.pixelHeight,t.pixelBuffer);for(var n,a,r=t.ctx.createImageData(t.pixelWidth,t.pixelHeight),s=4*t.pixelWidth,o=0;o<t.pixelBuffer.length;o++)n=Math.floor(o/s),a=o%s,r.data[(t.pixelHeight-n-1)*s+a]=t.pixelBuffer[o];t.ctx.putImageData(r,0,0),this.renderer.setRenderTarget(null)}i.camera.clearViewOffset()}}addSelectionListener(t){void 0!==t&&this.selectionListeners.push(t)}concatObjectsFromCellNums(t,e,i,n){if(void 0!==i&&0!==i.length&&0!==i[0]){for(void 0===n&&(n=e.startCell,i.sort((function(t,e){return t-e})));void 0!==e.nCells&&i[0]>=n&&i[0]<n+e.nCells;)if(e.material.glyphs||e.isThickLineSegments?t.push({object:e,index:i[0]-n}):e.isMesh?t.push({object:e,faceIndex:i[0]-n}):t.push({object:e,index:(e.isLineSegments?2:1)*(i[0]-n)}),i.splice(0,1),0===i.length)return;void 0!==e.nCells&&(n+=e.nCells);for(var a=0;a<e.children.length&&void 0!==(n=this.concatObjectsFromCellNums(t,e.children[a],i,n));a++);return n}}pick(){if(!1!==this.validPick){this.intersects=[];for(var t=0;t<this.scenes.length;t++){var e=this.scenes[t];if(e.landscapeGrid)if(this.pickType===ot.Rectangle){var i=Math.max(this.pickRectangleLeft,e.windowX),n=Math.max(this.pickRectangleTop,e.windowTop),a=Math.min(this.pickRectangleRight,e.windowX+e.windowWidth),r=Math.min(this.pickRectangleBottom,e.windowTop+e.windowHeight);i-=e.windowX,n-=e.windowTop,a-=e.windowX,r-=e.windowTop,i-=(e.panOffsetX??0)+(e.baseLeft??0),a-=(e.panOffsetX??0)+(e.baseLeft??0),n-=(e.panOffsetY??0)+(e.baseTop??0),r-=(e.panOffsetY??0)+(e.baseTop??0);for(var s=[],o=i;o<a;o++)for(var l=n;l<r;l++)if(this.pickDepth===st.All){var c=o/e.landscapeWidth*2-1,h=(e.landscapeHeight-l-1)/e.landscapeHeight*2-1;this.raycaster.setFromCamera(new y(c,h),e.camera),this.raycaster.landscapeWidth=e.landscapeWidth,this.raycaster.landscapeHeight=e.landscapeHeight,this.raycaster.x=o,this.raycaster.y=l;var d=this.raycaster.intersectObjects(e.children,!0);this.intersects=this.intersects.concat(d)}else for(var p=0;p<e.landscapeRows;p++)for(var u=0;u<e.landscapeColumns;u++){if((b=e.landscapeGrid[p][u]).initialized&&!(o<b.left||o>b.left+b.width||l<b.top||l>b.top+b.height)){var f=Math.floor(o*window.devicePixelRatio),m=Math.floor(l*window.devicePixelRatio),g=4*(f-b.pixelX+(b.pixelHeight-(m-b.pixelY)-1)*b.pixelWidth),v=255*b.pickingPixelBuffer[g]*255+255*b.pickingPixelBuffer[g+1]+b.pickingPixelBuffer[g+2];b.pickingPixelBuffer2&&(v+=255*b.pickingPixelBuffer2[g]*255*255*255*255+255*b.pickingPixelBuffer2[g+1]*255*255*255+255*b.pickingPixelBuffer2[g+2]*255*255),v>0&&-1===s.indexOf(v)&&s.push(v)}}this.pickDepth===st.Closest&&this.concatObjectsFromCellNums(this.intersects,e,s)}else{if(this.pickRayX<e.windowX||this.pickRayX>e.windowX+e.windowWidth||this.pickRayY<e.windowTop||this.pickRayY>e.windowTop+e.windowHeight)continue;o=this.pickRayX-e.windowX,l=this.pickRayY-e.windowTop;if(o-=(e.panOffsetX??0)+(e.baseLeft??0),l-=(e.panOffsetY??0)+(e.baseTop??0),this.pickDepth===st.All){c=o/e.landscapeWidth*2-1,h=(e.landscapeHeight-l-1)/e.landscapeHeight*2-1;this.raycaster.setFromCamera(new y(c,h),e.camera),this.raycaster.landscapeWidth=e.landscapeWidth,this.raycaster.landscapeHeight=e.landscapeHeight,this.raycaster.x=o,this.raycaster.y=l;d=this.raycaster.intersectObjects(e.children,!0);this.intersects=this.intersects.concat(d)}else for(p=0;p<e.landscapeRows;p++)for(u=0;u<e.landscapeColumns;u++){var b;if((b=e.landscapeGrid[p][u]).initialized&&!(o<b.left||o>b.left+b.width||l<b.top||l>b.top+b.height)){f=Math.floor(o*window.devicePixelRatio),m=Math.floor(l*window.devicePixelRatio),g=4*(f-b.pixelX+(b.pixelHeight-(m-b.pixelY)-1)*b.pixelWidth),v=255*b.pickingPixelBuffer[g]*255+255*b.pickingPixelBuffer[g+1]+b.pickingPixelBuffer[g+2];b.pickingPixelBuffer2&&(v+=255*b.pickingPixelBuffer2[g]*255*255*255*255+255*b.pickingPixelBuffer2[g+1]*255*255*255+255*b.pickingPixelBuffer2[g+2]*255*255),this.concatObjectsFromCellNums(this.intersects,e,[v])}}}}for(t=0;t<this.selectionListeners.length;t++)this.selectionListeners[t]()}else console.error("AVS.Three.Viewer: invalid pick ray or rectangle.")}isObjectPickable(t){return void 0!==t.internalData.pickable?t.internalData.pickable:null===t.parent||this.isObjectPickable(t.parent)}getPickedCells(){for(var t=[],e=0;e<this.intersects.length;e++){var i=this.intersects[e].object;if(this.isObjectPickable(i)){for(var n=this.intersects[e].faceIndex??this.intersects[e].index,a=!1,r=0;r<t.length;r++)if(i===t[r].object){a=!0;for(var s=!1,o=0;o<t[r].indices.length;o++)if(n===t[r].indices[o]){s=!0;break}s||t[r].indices.push(n);break}a||t.push({object:i,indices:[n]})}}return t}getPickedCellSets(){for(var t=[],e=0;e<this.intersects.length;e++){var i=this.intersects[e].object;if(this.isObjectPickable(i)){for(var n=!1,a=0;a<t.length;a++)if(t[a].object===i){n=!0;break}n||t.push({object:i})}}return t}getPickedSceneNodes(){for(var t=[],e=0;e<this.intersects.length;e++){var i=this.intersects[e].object;if(this.isObjectPickable(i)){for(var n=i.parent,a=!1,r=0;r<t.length;r++)if(t[r].object===n){a=!0;break}a||t.push({object:n})}}return t}getSelectionInfo(t){for(var e=[],i=0;i<t.length;i++){var n=t[i].object,a=t[i].indices;if(void 0!==a)for(var r=0;r<a.length;r++)e.push(s(n,{},a[r]));else e.push(s(n,{}))}function s(t,e,i){for(var n in t.userData)void 0===e[n]&&(void 0!==i&&Array.isArray(t.userData[n])?e[n]=decodeURIComponent(t.userData[n][t.isLineSegments&&!t.material.glyphs?i/2:i]):e[n]=decodeURIComponent(t.userData[n]));return t.parent?s(t.parent,e):e}return e}highlightObjects(t,e){for(var i=!1,n=0;n<this.highlightList.length;n++){void 0!==(s=this.highlightList[n]).saveMaterial&&(s.material=s.saveMaterial,s.saveMaterial=void 0,i=!0),void 0!==s.saveGeometry&&(s.geometry=s.saveGeometry,s.saveGeometry=void 0,i=!0)}for(n=0;n<this.scenes.length;n++){var a=this.scenes[n].highlightScene.children[0].children;a.length>0&&(a.length=0,this.updateHighlight=!0)}this.highlightList.length=0;var r=this;for(n=0;n<t.length;n++){var s;o(s=t[n].object,t[n].indices)}function o(t,n){if(t.isMesh||t.isLineSegments||t.isPoints){r.highlightList.push(t);var a,s=t.material.clone();if(s.opacity=1,void 0!==n){var l=t.geometry;if(s.vertexColors=!0,s.color=new u(16777215),t.isThickLineSegments){var c;if(a=new C,l.attributes.instancedColorStart,void 0===oldColorStart){c=new k(new Float32Array(l.attributes.instanceStart.array.length),6,1);for(var h=0,d=0;d<c.array.length/3;d++)c.array[h++]=t.material.color.r,c.array[h++]=t.material.color.g,c.array[h++]=t.material.color.b}else c=oldColorStart.data.clone();h=null;var p=null;for(d=0;d<n.length;d++){h=6*Math.floor(n[d]/6),p=2;for(var f=0;f<p;f++)c.array[h++]=r.highlightColor.r,c.array[h++]=r.highlightColor.g,c.array[h++]=r.highlightColor.b}for(var m in a.setAttribute("instancedColorStart",new _(c,3,0)),a.setAttribute("instancedColorEnd",new _(c,3,3)),l.attributes)"instancedColorStart"!==m&&"instancedColorEnd"!==m&&a.setAttribute(m,l.attributes[m])}else{a=t.material.glyphs?new C:new H;var g=l.attributes.color,v=null;if(void 0===g){v=t.material.glyphs?new z(new Float32Array(l.attributes.offset.array.length),3):new O(l.attributes.position.array.length,3);for(h=0,d=0;d<v.array.length/3;d++)v.array[h++]=t.material.color.r,v.array[h++]=t.material.color.g,v.array[h++]=t.material.color.b}else v=g.clone();for(h=null,p=null,d=0;d<n.length;d++){t.material.glyphs||t.cellType===ct.Points?(h=3*n[d],p=1):t.cellType===ct.Lines?(h=3*n[d],p=2):t.cellType===ct.Triangles?(h=9*n[d],p=3):(h=18*Math.floor(n[d]/2),p=6);for(f=0;f<p;f++)v.array[h++]=r.highlightColor.r,v.array[h++]=r.highlightColor.g,v.array[h++]=r.highlightColor.b}for(var m in a.setAttribute("color",v),l.attributes)"color"!==m&&a.setAttribute(m,l.attributes[m])}}else s.vertexColors=!1,s.color=r.highlightColor,a=t.geometry;var y=r.getObjectScene(t);if(void 0!==y.internalData.is3D&&!1===y.internalData.is3D&&void 0!==e&&!0===e){var b=t.clone();b.material=s,b.geometry=a,b.matrixAutoUpdate=!1,b.matrix.copy(t.matrixWorld),y.highlightScene.children[0].add(b),r.updateHighlight=!0}else t.saveMaterial=t.material,t.material=s,t.saveGeometry=t.geometry,t.geometry=a,i=!0}for(var x=0;x<t.children.length;x++)o(t.children[x])}i?this.render(!0):this.updateHighlight&&(this.highlightRender(),this.updateHighlight=!1)}getObjectScene(t){return t.isScene?t:this.getObjectScene(t.parent)}}const ce={type:"change"},he={type:"start"},de={type:"end"};class pe extends W{constructor(e){super(),this.isTransformInteractor=!0,this.domElement=e,this.domElement.style.touchAction="none",this.object=new T,this.scene=null,this.enabled=!0,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.enablePan=!0,this.keyPanSpeed=7,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.touches={ONE:Y.ROTATE,TWO:Y.DOLLY_PAN},this.quaternion=this.object.quaternion.clone(),this.position=this.object.position.clone(),this.scale=this.object.scale.clone(),this.clientOnly=!1,this.fullReset=!1,this.quaternion0=this.object.quaternion.clone(),this.position0=this.object.position.clone(),this.scale0=this.object.scale.clone(),this._domElementKeyEvents=null,this.listenToKeyEvents=function(t){t.addEventListener("keydown",H),this._domElementKeyEvents=t},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",H),this._domElementKeyEvents=null},this.setObjectScene=function(t,e){n.object=t,n.scene=e,this.fullReset||t.internalData.transformFullReset?(n.quaternion.copy(n.object.quaternion),n.scale.copy(n.object.scale),n.position.copy(n.object.position),n.quaternion0.copy(n.object.quaternion),n.scale0.copy(n.object.scale),n.position0.copy(n.object.position),this.fullReset=!1):n.clientOnly&&(n.object.quaternion.copy(n.quaternion),n.object.scale.copy(n.scale),n.object.position.copy(n.position)),t.internalData.transformWheelActions&&(s=JSON.parse(t.internalData.transformWheelActions)),t.internalData.transformTriggers&&(o=JSON.parse(t.internalData.transformTriggers))},this.reset=function(){n.quaternion.copy(n.quaternion0),n.scale.copy(n.scale0),n.position.copy(n.position0),n.object.quaternion.copy(n.quaternion0),n.object.scale.copy(n.scale0),n.object.position.copy(n.position0),n.dispatchEvent(ce),r=a.NONE},this.zoomIn=function(){E(1/v(),0,0)&&n.dispatchEvent(ce)},this.zoomOut=function(){E(v(),0,0)&&n.dispatchEvent(ce)},this.panTo=function(t,e,i){var a=n.object.parent.matrixWorld,r=1/a.elements[0],s=1/a.elements[5],o=1/a.elements[10],l=a.elements[12]*r,c=a.elements[13]*s,h=a.elements[14]*o;t*=n.object.scale.x,e*=n.object.scale.y,i*=n.object.scale.z,t+=l,e+=c,i+=h,n.object.position.set(n.position0.x-t,n.position0.y-e,n.position0.z-i),n.position.copy(n.object.position),n.dispatchEvent(ce)},this.dispose=function(){n.domElement.removeEventListener("contextmenu",W),n.domElement.removeEventListener("pointerdown",R),n.domElement.removeEventListener("pointercancel",F),n.domElement.removeEventListener("wheel",z),n.domElement.removeEventListener("pointermove",G),n.domElement.removeEventListener("pointerup",F),null!==n._domElementKeyEvents&&(n._domElementKeyEvents.removeEventListener("keydown",H),n._domElementKeyEvents=null)};const n=this,a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=a.NONE,s=[{modifiers:0,param:"ZOOM_AT_POINTER"}],o=[{buttons:1,modifiers:0,param:"ROTATE"},{buttons:2,modifiers:0,param:"SCALE"},{buttons:4,modifiers:0,param:"TRANSLATE"}];const l=new y,c=new y,h=new y,d=new y,p=new y,u=new y,f=new y,m=[],g={};function v(){return Math.pow(.95,n.zoomSpeed)}function b(t){return 2*(t-n.scene.windowDiv.getBoundingClientRect().left)/n.scene.windowWidth-1}function x(t){return 1-2*(t-n.scene.windowDiv.getBoundingClientRect().top)/n.scene.windowHeight}const w=function(){const e=new i,a=new t,r=new t,s=new t,o=new i,h=new t;let d,p;const u=new B;return function(){return null!==n.object&&null!==n.object.parent&&(e.multiplyMatrices(n.scene.camera.matrixWorldInverse,n.object.parent.matrixWorld),a.set(0,0,0),r.set(l.x,l.y,1),s.set(c.x,c.y,1),o.copy(e).invert(),a.applyMatrix4(o),r.applyMatrix4(o),s.applyMatrix4(o),r.sub(a).normalize(),s.sub(a).normalize(),void 0!==n.scene.internalData.is3D&&!1===n.scene.internalData.is3D?(h.set(0,0,1),d=r.x*s.y-r.y*s.x,d<0&&(h.negate(),d=-d)):(h.crossVectors(r,s),d=h.length()),!(d<1e-5)&&(p=Math.abs(d)<1?2*Math.sin(d):Math.PI,r.dot(s)<0&&(p+=.5*Math.PI),u.setFromAxisAngle(h.normalize(),p),n.object.quaternion.premultiply(u),n.quaternion.copy(n.object.quaternion),!0))}}(),S=function(){const e=new i,a=new U,r=new t,s=new i,o=new U,l=new U,c=new t,p=new t,u=new t;return function(){return null!==n.object&&null!==n.object.parent&&(e.multiplyMatrices(n.scene.camera.matrixWorldInverse,n.object.parent.matrixWorld),e.premultiply(n.scene.camera.projectionMatrix),a.set(0,0,0,1).applyMatrix4(e),r.set(a.x/a.w,a.y/a.w,a.z/a.w),s.copy(e).invert(),o.set(h.x,h.y,r.z,1),l.set(d.x,d.y,r.z,1),o.applyMatrix4(s),l.applyMatrix4(s),c.set(o.x/o.w,o.y/o.w,o.z/o.w),p.set(l.x/l.w,l.y/l.w,l.z/l.w),u.subVectors(p,c),n.object.position.add(u),n.position.copy(n.object.position),!0)}}();function O(t){return null!==n.object&&(n.object.scale.multiplyScalar(t),n.scale.copy(n.object.scale),!0)}const E=function(){const e=new i,a=new i,r=new U,s=new U,o=new t,l=new t;return function(t,i,c){return null!==n.object&&null!==n.object.parent&&(e.multiplyMatrices(n.scene.camera.matrixWorldInverse,n.object.parent.matrixWorld),e.premultiply(n.scene.camera.projectionMatrix),r.set(0,0,0,1).applyMatrix4(e),a.copy(e).invert(),s.set(i,c,r.z/r.w,1).applyMatrix4(a),o.set(s.x/s.w,s.y/s.w,s.z/s.w),o.sub(n.object.position),l.copy(o).multiplyScalar(t).add(o.negate()),n.object.scale.multiplyScalar(t),n.object.position.sub(l),n.scale.copy(n.object.scale),n.position.copy(n.object.position),!0)}}();function C(t){l.set(b(t.clientX),x(t.clientY))}function k(t){p.set(t.clientX,t.clientY)}function _(t){h.set(b(t.clientX),x(t.clientY))}function P(t){O(t.deltaY>0?v():1/v())&&n.dispatchEvent(ce)}function L(t){const e=t.deltaY>0?v():1/v();E(e,b(t.clientX),x(t.clientY))&&n.dispatchEvent(ce)}function j(){if(1===m.length)l.set(b(m[0].clientX),x(m[0].clientY));else{const t=.5*(m[0].clientX+m[1].clientX),e=.5*(m[0].clientY+m[1].clientY);l.set(b(t),x(e))}}function A(){if(1===m.length)h.set(b(m[0].clientX),x(m[0].clientY));else{const t=.5*(m[0].clientX+m[1].clientX),e=.5*(m[0].clientY+m[1].clientY);h.set(b(t),x(e))}}function D(){const t=Math.abs(m[0].clientX-m[1].clientX),e=Math.abs(m[0].clientY-m[1].clientY),i=Math.sqrt(t*t+e*e);p.set(0,i)}function I(t){if(1==m.length)c.set(b(t.clientX),x(t.clientY));else{const e=Z(t),i=.5*(t.clientX+e.x),n=.5*(t.clientY+e.y);c.set(b(i),x(n))}w()&&n.dispatchEvent(ce),l.copy(c)}function M(t){if(1===m.length)d.set(b(t.clientX),x(t.clientY));else{const e=Z(t),i=.5*(t.clientX+e.x),n=.5*(t.clientY+e.y);d.set(b(i),x(n))}S()&&n.dispatchEvent(ce),h.copy(d)}function N(t){const e=Z(t),i=t.clientX-e.x,a=t.clientY-e.y,r=Math.sqrt(i*i+a*a);u.set(0,r),f.set(0,Math.pow(u.y/p.y,n.zoomSpeed)),O(f.y)&&n.dispatchEvent(ce),p.copy(u)}function R(t){!1!==n.enabled&&(0===m.length&&(n.domElement.setPointerCapture(t.pointerId),n.domElement.addEventListener("pointermove",G),n.domElement.addEventListener("pointerup",F)),function(t){m.push(t)}(t),"touch"===t.pointerType?function(t){switch(X(t),m.length){case 1:switch(n.touches.ONE){case Y.ROTATE:if(!1===n.enableRotate)return;j(),r=a.TOUCH_ROTATE;break;case Y.PAN:if(!1===n.enablePan)return;A(),r=a.TOUCH_PAN;break;default:r=a.NONE}break;case 2:switch(n.touches.TWO){case Y.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&D(),n.enablePan&&A(),r=a.TOUCH_DOLLY_PAN;break;case Y.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&D(),n.enableRotate&&j(),r=a.TOUCH_DOLLY_ROTATE;break;default:r=a.NONE}break;default:r=a.NONE}r!==a.NONE&&n.dispatchEvent(he)}(t):function(t){t.preventDefault();var e=0;e+=t.shiftKey?1:0,e+=t.ctrlKey?2:0,e+=t.metaKey?4:0;let i=0;switch(t.button){case 0:i=1;break;case 1:i=2;break;case 2:i=4}for(var s=0,l=o.length;s<l;s++)if(e===o[s].modifiers&&i&o[s].buttons){switch(o[s].param){case 0:case"ROTATE":if(!1===n.enableRotate)continue;C(t),r=a.ROTATE,n.domElement.ownerDocument.body.style.cursor="move";break;case 1:case"SCALE":if(!1===n.enableZoom)continue;k(t),r=a.DOLLY,n.domElement.ownerDocument.body.style.cursor="ne-resize";break;case 2:case"TRANSLATE":if(!1===n.enablePan)continue;_(t),r=a.PAN,n.domElement.ownerDocument.body.style.cursor="move";break;default:r=a.NONE}r!==a.NONE&&n.dispatchEvent(he);break}}(t))}function G(t){!1!==n.enabled&&("touch"===t.pointerType?function(t){switch(X(t),r){case a.TOUCH_ROTATE:if(!1===n.enableRotate)return;I(t);break;case a.TOUCH_PAN:if(!1===n.enablePan)return;M(t);break;case a.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(t){n.enableZoom&&N(t),n.enablePan&&M(t)}(t);break;case a.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(t){n.enableZoom&&N(t),n.enableRotate&&I(t)}(t);break;default:r=a.NONE}}(t):function(t){if(!1===n.enabled)return;switch(t.preventDefault(),r){case a.ROTATE:if(!1===n.enableRotate)return;!function(t){c.set(b(t.clientX),x(t.clientY)),w()&&n.dispatchEvent(ce),l.copy(c)}(t);break;case a.DOLLY:if(!1===n.enableZoom)return;!function(t){u.set(t.clientX,t.clientY),f.subVectors(u,p),O((Math.abs(f.x)>Math.abs(f.y)?-f.x:f.y)>0?v():1/v())&&n.dispatchEvent(ce),p.copy(u)}(t);break;case a.PAN:if(!1===n.enablePan)return;!function(t){d.set(b(t.clientX),x(t.clientY)),S()&&n.dispatchEvent(ce),h.copy(d)}(t)}}(t))}function F(t){!function(t){delete g[t.pointerId];for(let e=0;e<m.length;e++)if(m[e].pointerId==t.pointerId)return void m.splice(e,1)}(t),0===m.length&&(n.domElement.releasePointerCapture(t.pointerId),n.domElement.removeEventListener("pointermove",G),n.domElement.removeEventListener("pointerup",F)),n.domElement.ownerDocument.body.style.cursor="default",n.dispatchEvent(de),r=a.NONE}function z(t){if(!1!==n.enabled&&!1!==n.enableZoom&&r===a.NONE){var e=0;e+=t.shiftKey?1:0,e+=t.ctrlKey?2:0,e+=t.metaKey?4:0;for(var i=0,o=s.length;i<o;i++)if(e===s[i].modifiers){switch(t.preventDefault(),s[i].param){case 0:case"ZOOM":n.dispatchEvent(he),P(t),n.dispatchEvent(de);break;case 1:case"ZOOM_AT_POINTER":n.dispatchEvent(he),L(t),n.dispatchEvent(de)}return}}}function H(t){!1!==n.enabled&&!1!==n.enablePan&&function(t){let e=!1;switch(h.set(0,0),d.set(0,0),t.code){case n.keys.UP:d.y=n.keyPanSpeed/(n.scene.windowHeight/2),e=!0;break;case n.keys.BOTTOM:d.y=-n.keyPanSpeed/(n.scene.windowHeight/2),e=!0;break;case n.keys.LEFT:d.x=-n.keyPanSpeed/(n.scene.windowWidth/2),e=!0;break;case n.keys.RIGHT:d.x=n.keyPanSpeed/(n.scene.windowWidth/2),e=!0}let i=!1;e&&(i=S(),t.preventDefault()),i&&n.dispatchEvent(ce)}(t)}function W(t){!1!==n.enabled&&t.preventDefault()}function X(t){let e=g[t.pointerId];void 0===e&&(e=new y,g[t.pointerId]=e),e.set(t.clientX,t.clientY)}function Z(t){const e=t.pointerId===m[0].pointerId?m[1]:m[0];return g[e.pointerId]}n.domElement.addEventListener("contextmenu",W),n.domElement.addEventListener("pointerdown",R),n.domElement.addEventListener("pointercancel",F),n.domElement.addEventListener("wheel",z,{passive:!1}),n.listenToKeyEvents(window)}}const ue={type:"change"},fe={type:"zoom"},me={type:"zoomEnd"},ge={type:"start"},ve={type:"end"};class ye extends W{constructor(e){super(),void 0===e&&console.warn('AVS.Three.PanInteractor: The first parameter "domElement" is now mandatory.'),e===document&&console.error('AVS.Three.PanInteractor: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.isPanInteractor=!0,this.domElement=e,this.domElement.style.touchAction="none",this.object=new T,this.linkObjectsBottom=[],this.linkObjectsTop=[],this.linkObjectsLeft=[],this.linkObjectsRight=[],this.linkObjectsBottomStatic=[],this.linkObjectsTopStatic=[],this.linkObjectsLeftStatic=[],this.linkObjectsRightStatic=[],this.leftLimit=0,this.rightLimit=0,this.topLimit=0,this.bottomLimit=0,this.domElement=e,this.enabled=!0,this.enableZoom=!0,this.zoomSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.enableKeys=!0,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:X.PAN,MIDDLE:X.NONE,RIGHT:X.NONE},this.touches={ONE:Y.PAN,TWO:Y.DOLLY_PAN},this._domElementKeyEvents=null,this.listenToKeyEvents=function(t){t.addEventListener("keydown",R),this._domElementKeyEvents=t},this.saveState=function(){s.copy(r),c.copy(l)},this.reset=function(){l.equals(c)?(r.copy(s),i.update()):(l.copy(c),f.set(-1,-1),r.copy(s),P()),a=n.NONE},this.update=function(t=!0){if(void 0!==i.object&&void 0!==i.object.landscapeDiv){!function(){r.x>i.leftLimit?r.x=i.leftLimit:r.x<i.rightLimit&&(r.x=i.rightLimit);r.y<i.bottomLimit?r.y=i.bottomLimit:r.y>i.topLimit&&(r.y=i.topLimit)}(),i.object.panOffsetX=r.x,i.object.panOffsetY=r.y,i.object.landscapeDiv.style.left=i.object.baseLeft+r.x+"px",i.object.landscapeDiv.style.top=i.object.baseTop+r.y+"px";for(let t=0,e=i.linkObjectsBottom.length;t<e;t++){const e=i.linkObjectsBottom[t];e.panOffsetX=r.x,e.landscapeDiv.style.left=e.baseLeft+r.x+"px"}for(let t=0,e=i.linkObjectsBottomStatic.length;t<e;t++){i.linkObjectsBottomStatic[t].traverse((function(t){t.isBillboardText&&(t.panOffsetX=-r.x,t.moveText())}))}for(let t=0,e=i.linkObjectsTop.length;t<e;t++){const e=i.linkObjectsTop[t];e.panOffsetX=r.x,e.landscapeDiv.style.left=e.baseLeft+r.x+"px"}for(let t=0,e=i.linkObjectsTopStatic.length;t<e;t++){i.linkObjectsTopStatic[t].traverse((function(t){t.isBillboardText&&(t.panOffsetX=-r.x,t.moveText())}))}for(let t=0,e=i.linkObjectsLeft.length;t<e;t++){const e=i.linkObjectsLeft[t];e.panOffsetY=r.y,e.landscapeDiv.style.top=e.baseTop+r.y+"px"}for(let t=0,e=i.linkObjectsLeftStatic.length;t<e;t++){i.linkObjectsLeftStatic[t].traverse((function(t){t.isBillboardText&&(t.panOffsetY=-r.y,t.moveText())}))}for(let t=0,e=i.linkObjectsRight.length;t<e;t++){const e=i.linkObjectsRight[t];e.panOffsetY=r.y,e.landscapeDiv.style.top=e.baseTop+r.y+"px"}for(let t=0,e=i.linkObjectsRightStatic.length;t<e;t++){i.linkObjectsRightStatic[t].traverse((function(t){t.isBillboardText&&(t.panOffsetY=-r.y,t.moveText())}))}t&&(ue.detail={widthZoomLevel:l.x,heightZoomLevel:l.y,panX:-r.x,panY:-r.y},i.dispatchEvent(ue)),f.set(-1,-1)}},this.restorePanOffset=function(t){f.x<0||(r.x=f.x-t.zoomOffsetLeft-Math.floor(t.centerWidth*m.x),r.y=f.y-t.zoomOffsetTop-Math.floor(t.centerHeight*m.y),i.update(!1))},this.clear=function(){this.linkObjectsBottom=[],this.linkObjectsTop=[],this.linkObjectsLeft=[],this.linkObjectsRight=[],this.linkObjectsBottomStatic=[],this.linkObjectsTopStatic=[],this.linkObjectsLeftStatic=[],this.linkObjectsRightStatic=[]},this.setWidthZoomLevel=function(t){if(t<100)return;const e=l.x;l.x=t,l.x>h&&(l.x=h),l.x!=e&&P()},this.setHeightZoomLevel=function(t){if(t<100)return;const e=l.y;l.y=t,l.y>h&&(l.y=h),l.y!=e&&P()},this.setMaximumZoomLevel=function(t){t<100||(h=t,(l.x>h||l.y>h)&&(l.x>h&&(l.x=h),l.y>h&&(l.y=h),P()))},this.dispose=function(){i.domElement.removeEventListener("contextmenu",G),i.domElement.removeEventListener("pointerdown",A),i.domElement.removeEventListener("pointercancel",M),i.domElement.removeEventListener("wheel",N),i.domElement.removeEventListener("pointermove",D),i.domElement.removeEventListener("pointerup",I),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",R)};const i=this,n={NONE:-1,DOLLY:1,PAN:2,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5};let a=n.NONE;const r=new t,s=r.clone(),o=new y,l=new y(100,100),c=l.clone();let h=1e6;const d=new y,p=new y,u=new y,f=new y(-1,-1),m=new y,g=new y,v=new y,b=new y,x=[],w={};let S;function O(){return Math.pow(.95,i.zoomSpeed)}function E(){let t=!1;return l.x<100||l.y<100?(l.y<l.x?(l.x=100*l.x/l.y,l.y=100):(l.y=100*l.y/l.x,l.x=100),t=!0):(l.x>h||l.y>h)&&(l.y>l.x?(l.x=h*l.x/l.y,l.y=h):(l.y=h*l.y/l.x,l.x=h),t=!0),t}function C(t,e){var i;i=t,r.x+=i,function(t,e){r.y+=t}(e)}function k(t){l.multiplyScalar(t)}function _(t,e){if(!l.equals(o)){const n=i.domElement.getBoundingClientRect();f.x=Math.round(t-n.left),f.y=Math.round(e-n.top),f.x<i.object.windowX?f.x=i.object.windowX:f.x>i.object.windowX+i.object.windowWidth&&(f.x=i.object.windowX+i.object.windowWidth),f.y<i.object.windowTop?f.y=i.object.windowTop:f.y>i.object.windowTop+i.object.windowHeight&&(f.y=i.object.windowTop+i.object.windowHeight),m.x=(f.x-i.object.panOffsetX-i.object.zoomOffsetLeft)/i.object.centerWidth,m.y=(f.y-i.object.panOffsetY-i.object.zoomOffsetTop)/i.object.centerHeight,P()}}function P(){me.detail={widthZoomLevel:l.x,heightZoomLevel:l.y},i.dispatchEvent(me),o.copy(l)}function L(t){var e;clearTimeout(S),t.deltaY<0?(e=O(),l.divideScalar(e)):t.deltaY>0&&k(O());const n=E();fe.detail={widthZoomLevel:l.x,heightZoomLevel:l.y,clientX:t.clientX,clientY:t.clientY},i.dispatchEvent(fe),n?_(t.clientX,t.clientY):S=setTimeout(_,300,t.clientX,t.clientY)}function j(t){clearTimeout(S);const e=function(t){const e=t.pointerId===x[0].pointerId?x[1]:x[0];return w[e.pointerId]}(t),n=t.clientX-e.x,a=t.clientY-e.y,r=Math.sqrt(n*n+a*a);v.set(0,r),b.set(0,Math.pow(v.y/g.y,i.zoomSpeed)),k(b.y),g.copy(v);const s=.5*(t.clientX+e.x),o=.5*(t.clientY+e.y);E()?_(s,o):S=setTimeout(_,300,s,o)}function A(t){!1!==i.enabled&&(0===x.length&&(i.domElement.setPointerCapture(t.pointerId),i.domElement.addEventListener("pointermove",D),i.domElement.addEventListener("pointerup",I)),function(t){x.push(t)}(t),"touch"===t.pointerType?function(t){switch(z(t),x.length){case 1:if(i.touches.ONE===Y.PAN){if(!1===i.enablePan)return;d.set(x[0].clientX,x[0].clientY),a=n.TOUCH_PAN}else a=n.NONE;break;case 2:if(i.touches.TWO===Y.DOLLY_PAN){if(!1===i.enableZoom)return;!function(){const t=x[0].clientX-x[1].clientX,e=x[0].clientY-x[1].clientY,i=Math.sqrt(t*t+e*e);g.set(0,i)}(),a=n.TOUCH_DOLLY_PAN}else a=n.NONE;break;default:a=n.NONE}a!==n.NONE&&i.dispatchEvent(ge)}(t):function(t){let e;switch(t.preventDefault(),t.button){case 0:e=i.mouseButtons.LEFT;break;case 1:e=i.mouseButtons.MIDDLE;break;case 2:e=i.mouseButtons.RIGHT;break;default:e=-1}if(e===X.PAN){if(!1===i.enablePan)return;!function(t){d.set(t.clientX,t.clientY)}(t),a=n.PAN,i.domElement.ownerDocument.body.style.cursor="move"}else a=n.NONE;a!==n.NONE&&i.dispatchEvent(ge)}(t))}function D(t){!1!==i.enabled&&("touch"===t.pointerType?function(t){switch(z(t),a){case n.TOUCH_PAN:if(!1===i.enablePan)return;!function(t){p.set(t.clientX,t.clientY),u.subVectors(p,d).multiplyScalar(i.panSpeed),C(u.x,u.y),d.copy(p)}(t),i.update();break;case n.TOUCH_DOLLY_PAN:if(!1===i.enableZoom)return;j(t);break;default:a=n.NONE}}(t):function(t){if(!1===i.enabled)return;if(t.preventDefault(),a===n.PAN){if(!1===i.enablePan)return;!function(t){p.set(t.clientX,t.clientY),u.subVectors(p,d).multiplyScalar(i.panSpeed),C(u.x,u.y),d.copy(p),i.update()}(t)}}(t))}function I(t){F(t),0===x.length&&(i.domElement.releasePointerCapture(t.pointerId),i.domElement.removeEventListener("pointermove",D),i.domElement.removeEventListener("pointerup",I)),i.domElement.ownerDocument.body.style.cursor="default",i.dispatchEvent(ve),a=n.NONE}function M(t){F(t)}function N(t){!1!==i.enabled&&!1!==i.enableZoom&&a===n.NONE&&(t.preventDefault(),i.dispatchEvent(ge),L(t),i.dispatchEvent(ve))}function R(t){!1!==i.enabled&&!1!==i.enablePan&&function(t){let e=!1;switch(t.code){case i.keys.UP:C(0,i.keyPanSpeed),e=!0;break;case i.keys.BOTTOM:C(0,-i.keyPanSpeed),e=!0;break;case i.keys.LEFT:C(i.keyPanSpeed,0),e=!0;break;case i.keys.RIGHT:C(-i.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),i.update())}(t)}function G(t){!1!==i.enabled&&t.preventDefault()}function F(t){delete w[t.pointerId];for(let e=0;e<x.length;e++)if(x[e].pointerId==t.pointerId)return void x.splice(e,1)}function z(t){let e=w[t.pointerId];void 0===e&&(e=new y,w[t.pointerId]=e),e.set(t.clientX,t.clientY)}i.domElement.addEventListener("contextmenu",G),i.domElement.addEventListener("pointerdown",A),i.domElement.addEventListener("pointercancel",M),i.domElement.addEventListener("wheel",N,{passive:!1}),i.listenToKeyEvents(window)}}const be={type:"change"},xe={type:"start"},we={type:"end"};class Se extends W{constructor(e){super(),void 0===e&&console.warn('AVS.Three.ZoomRectangleInteractor: The first parameter "domElement" is now mandatory.'),e===document&&console.error('AVS.Three.ZoomRectangleInteractor: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.isZoomRectangleInteractor=!0,this.domElement=e,this.domElement.style.touchAction="none",this.object=new T,this.scene=null,this.enabled=!0,this.position=this.object.position.clone(),this.scale=this.object.scale.clone(),this.clientOnly=!1,this.fullReset=!1,this.scale0=this.object.scale.clone(),this.position0=this.object.position.clone(),this.setObjectScene=function(t,e){switch(n.object=t,n.scene=e,this.fullReset||t.internalData.zoomRectangleFullReset?(n.scale.copy(n.object.scale),n.position.copy(n.object.position),n.scale0.copy(n.object.scale),n.position0.copy(n.object.position),this.fullReset=!1):n.clientOnly&&(n.object.scale.copy(n.scale),n.object.position.copy(n.position)),t.internalData.zoomRectangleTriggers&&(l=JSON.parse(t.internalData.zoomRectangleTriggers)),r=t.internalData.zoomInMaxLimit,s=t.internalData.zoomOutMaxLimit,d=void 0!==t.internalData.zoomRectangleColor?"#"+t.internalData.zoomRectangleColor.toString(16).padStart(6,"0"):null,p=t.internalData.zoomRectangleWidth?t.internalData.zoomRectangleWidth:null,t.internalData.zoomRectanglePattern){case 0:u=[];break;case 1:u=[4,4];break;case 2:u=[1,3];break;case 3:u=[5,1,1,1];break;default:u=null}const i=document.createElement("canvas");i.style.position="absolute",i.style.width="100%",i.style.height="100%",i.id=n.scene.name+"RectCanvas",i.width=n.scene.windowWidth,i.height=n.scene.windowHeight,n.scene.windowDiv.appendChild(i),n.scene.rectCanvas=i,n.scene.rectCtx=i.getContext("2d")},this.reset=function(){n.scale.copy(n.scale0),n.position.copy(n.position0),n.object.scale.copy(n.scale0),n.object.position.copy(n.position0),n.dispatchEvent(be),o=a.NONE},this.dispose=function(){n.domElement.removeEventListener("contextmenu",_),n.domElement.removeEventListener("pointerdown",O),n.domElement.removeEventListener("pointercancel",k),n.domElement.removeEventListener("pointermove",E),n.domElement.removeEventListener("pointerup",C)};const n=this,a={NONE:-1,ZOOM_IN:0,ZOOM_OUT:1};let r,s,o=a.NONE,l=[{buttons:1,modifiers:0,param:"ZOOM_IN"},{buttons:1,modifiers:1,param:"ZOOM_OUT"}],c=0;const h=[];let d=null,p=null,u=null;const f=new y,m=new y,g=[],v={};function b(t){return Math.max(0,Math.min(t.clientX-n.scene.windowDiv.getBoundingClientRect().left,n.scene.windowWidth))}function x(t){return Math.max(0,Math.min(t.clientY-n.scene.windowDiv.getBoundingClientRect().top,n.scene.windowHeight))}const w=function(){const e=new i,l=new i,c=new U,h=new U,d=new t,p=new U,u=new t;return function(t,i,f,m){const g=n.scene.windowWidth/(i-t),v=n.scene.windowHeight/(m-f);e.multiplyMatrices(n.scene.camera.matrixWorldInverse,n.object.parent.matrixWorld),e.premultiply(n.scene.camera.projectionMatrix),c.set(0,0,0,1).applyMatrix4(e),l.copy(e).invert();let y=1;if(o===a.ZOOM_IN){if(y=v<g?v:g,void 0!==r){const t=Math.max(Math.max(n.object.scale.x,n.object.scale.y),n.object.scale.z);y*t>r&&(y=r/t)}const e=(t+i)/n.scene.windowWidth-1,a=1-(f+m)/n.scene.windowHeight;h.set(e,a,c.z/c.w,1).applyMatrix4(l),d.set(h.x/h.w,h.y/h.w,h.z/h.w),p.set(0,0,c.z/c.w,1).applyMatrix4(l),u.set(p.x/p.w,p.y/p.w,p.z/p.w),d.sub(n.object.position),u.sub(n.object.position),d.multiplyScalar(y).sub(u),n.object.position.sub(d)}else if(o===a.ZOOM_OUT){if(y=v>g?1/v:1/g,void 0!==s){const t=Math.max(Math.max(n.object.scale.x,n.object.scale.y),n.object.scale.z);y*t<1/s&&(y=1/s/t)}h.set(0,0,c.z/c.w,1).applyMatrix4(l),d.set(h.x/h.w,h.y/h.w,h.z/h.w),d.sub(n.object.position),u.copy(d),d.multiplyScalar(y).sub(u),n.object.position.sub(d)}return n.object.scale.multiplyScalar(y),!0}}();function S(t){f.set(b(t),x(t));const e=window.getComputedStyle(n.scene.rectCanvas);let i="#ff0000";const a=e.getPropertyValue("--avs-drag-rectangle-stroke-style").trim();null!==d?i=d:null!==a&&a.length>0&&(i=a),n.scene.rectCtx.strokeStyle=i;let r=1;const s=e.getPropertyValue("--avs-drag-rectangle-line-width").trim();null!==p?r=p:null!==s&&s.length>0&&(r=s),n.scene.rectCtx.lineWidth=r;let o=h;const l=e.getPropertyValue("--avs-drag-rectangle-line-dash").trim();null!==u?o=u:null!==l&&l.length>0&&(o=JSON.parse(l)),n.scene.rectCtx.setLineDash(o),c=1}function O(t){!1!==n.enabled&&(0===g.length&&(n.domElement.setPointerCapture(t.pointerId),n.domElement.addEventListener("pointermove",E),n.domElement.addEventListener("pointerup",C)),function(t){g.push(t)}(t),function(t){let e=0;e+=t.shiftKey?1:0,e+=t.ctrlKey?2:0,e+=t.metaKey?4:0;let i=0;switch(t.button){case 0:i=1;break;case 1:i=2;break;case 2:i=4}for(let r=0,s=l.length;r<s;r++)if(e===l[r].modifiers&&i&l[r].buttons){switch(l[r].param){case 1:case"ZOOM_IN":S(t),o=a.ZOOM_IN,n.domElement.ownerDocument.body.style.cursor="zoom-in";break;case 2:case"ZOOM_OUT":S(t),o=a.ZOOM_OUT,n.domElement.ownerDocument.body.style.cursor="zoom-out";break;default:o=a.NONE}o!==a.NONE&&n.dispatchEvent(xe);break}}(t))}function E(t){!1!==n.enabled&&function(t){if(!1===n.enabled)return;!function(t){if(c<1)return;if(m.set(b(t),x(t)),n.scene.rectCtx.clearRect(0,0,n.scene.windowWidth,n.scene.windowHeight),1==c){const t=Math.abs(f.x-m.x),e=Math.abs(f.y-m.y);if(t*t+e*e<25)return;c=2}const e=Math.min(f.x,m.x),i=Math.max(f.x,m.x),a=Math.min(f.y,m.y),r=Math.max(f.y,m.y);n.scene.rectCtx.strokeRect(e+.5,a+.5,i-e,r-a)}(t)}(t)}function C(t){!1!==n.enabled&&(!function(t){(function(t){if(c<2)return;m.set(b(t),x(t)),n.scene.rectCtx.clearRect(0,0,n.scene.windowWidth,n.scene.windowHeight);const e=Math.min(f.x,m.x),i=Math.max(f.x,m.x),a=Math.min(f.y,m.y),r=Math.max(f.y,m.y);w(e,i,a,r)&&(n.scale.copy(n.object.scale),n.position.copy(n.object.position),n.dispatchEvent(be)),c=0})(t),n.domElement.ownerDocument.body.style.cursor="default",n.dispatchEvent(we),o=a.NONE}(t),P(t),0===g.length&&(n.domElement.releasePointerCapture(t.pointerId),n.domElement.removeEventListener("pointermove",E),n.domElement.removeEventListener("pointerup",C)))}function k(t){P(t)}function _(t){!1!==n.enabled&&t.preventDefault()}function P(t){delete v[t.pointerId];for(let e=0;e<g.length;e++)if(g[e].pointerId==t.pointerId)return void g.splice(e,1)}n.domElement.addEventListener("contextmenu",_),n.domElement.addEventListener("pointerdown",O),n.domElement.addEventListener("pointercancel",k)}}const Oe={type:"change"},Ee={type:"start"},Ce={type:"end"};class ke extends W{constructor(t){super(),this.hasStyleAnimations=!1,this.hasObjectAnimations=!1,this.createAnimationLibrary(),this.animating=0,this.mixers=[]}createAnimationLibrary(){const t=[0,2],e=new Z(".material.opacityFactor",t,[0,1]),i=new V(".material.transparent",t,[!0,!1]);this.fadeInClip=new q("fade-in",-1,[e,i]),this.fadeInClip.setOnChildren=!0;const n=new Z(".material.opacityFactor",t,[1,0]),a=new V(".material.transparent",t,[!0,!0]);this.fadeOutClip=new q("fade-out",-1,[n,a]),this.fadeOutClip.setOnChildren=!0;const r=new Z(".scaleFactorX",t,[0,1]);this.growXClip=new q("grow-x",-1,[r]);const s=new Z(".scaleFactorY",t,[0,1]);this.growYClip=new q("grow-y",-1,[s]);const o=new Z(".scaleFactorZ",t,[0,1]);this.growZClip=new q("grow-z",-1,[o]);const l=new Z(".material.glyphScaleFactorX",t,[0,1]);this.growXGlyphClip=new q("grow-x-glyph",-1,[l]),this.growXGlyphClip.setOnChildren=!0;const c=new Z(".material.glyphScaleFactorY",t,[0,1]);this.growYGlyphClip=new q("grow-y-glyph",-1,[c]),this.growYGlyphClip.setOnChildren=!0;const h=new Z(".material.glyphScaleFactorZ",t,[0,1]);this.growZGlyphClip=new q("grow-z-glyph",-1,[h]),this.growZGlyphClip.setOnChildren=!0;const d=new V(".visible",t,[!1,!0]);this.enterAfterClip=new q("enter-after",-1,[d]),this.enterAfterClip.setOnChildren=!0}setStyleMap(t){if(this.hasStyleAnimations=!1,void 0===t)return;const e=["scene","sceneTitle","chart","chartTitle","axis","legend","legendTitle","glyph","transform"];this.styleAnimationClips={},this.transformAnimations=void 0;for(let i=0,n=e.length;i<n;i++){const n=e[i];void 0!==t[n]&&(n.startsWith("transform")?this.transformAnimations=JSON.parse(t[n]):this.styleAnimationClips[n]=this.fillStyleClipsArray(t[n].split(","),"glyph"===n))}}fillStyleClipsArray(t,e){const i=[];for(let n=0,a=t.length;n<a;n++){const a=t[n].trim();"fade-in"===a?(i.push(this.fadeInClip),this.hasStyleAnimations=!0):"fade-out"===a?(i.push(this.fadeOutClip),this.hasStyleAnimations=!0):"grow-x"===a?(i.push(e?this.growXGlyphClip:this.growXClip),this.hasStyleAnimations=!0):"grow-y"===a?(i.push(e?this.growYGlyphClip:this.growYClip),this.hasStyleAnimations=!0):"grow-z"===a?(i.push(e?this.growZGlyphClip:this.growZClip),this.hasStyleAnimations=!0):"enter-after"===a&&(i.push(this.enterAfterClip),this.hasStyleAnimations=!0)}return i}fillObjectClipsArray(t,e){const i=[];return 0!=(1&t)&&(i.push(this.fadeInClip),this.hasObjectAnimations=!0),0!=(2&t)&&(i.push(this.fadeOutClip),this.hasObjectAnimations=!0),0!=(4&t)&&(i.push(e?this.growXGlyphClip:this.growXClip),this.hasObjectAnimations=!0),0!=(8&t)&&(i.push(e?this.growYGlyphClip:this.growYClip),this.hasObjectAnimations=!0),0!=(16&t)&&(i.push(e?this.growZGlyphClip:this.growZClip),this.hasObjectAnimations=!0),0!=(32&t)&&(i.push(this.enterAfterClip),this.hasObjectAnimations=!0),i}hasAnimations(){return this.hasStyleAnimations||this.hasObjectAnimations||this.transformAnimations}clear(){this.mixers=[],this.hasObjectAnimations=!1}attach(e){const i=this,n=this.createMixers.bind(this);this.createMixers(e,this.styleAnimationClips.scene),e.traverse((function(e){if(e.internalData.animations){const t=i.fillObjectClipsArray(e.internalData.animations,"GLYPH"===e.internalData.visualizationGroup);n(e,t)}if(e.internalData.attachTransformInteractor&&i.transformAnimations){const a=new t,r=new B,s=new J,o=new t;e.matrix.decompose(a,r,o);const l=[],c=[],h=[],d=[];let p=!1;for(let t=0,e=i.transformAnimations.length;t<e;t++){const e=i.transformAnimations[t];void 0===e.time&&(console.error("AVS.Three.Animator: Missing time value from transform animation index "+t),p=!0),l.push(e.time/1e3),void 0!==e.position&&a.set(e.position[0],e.position[1],e.position[2]),c.push(a.x),c.push(a.y),c.push(a.z),void 0!==e.scale&&o.set(e.scale/100,e.scale/100,e.scale/100),d.push(o.x),d.push(o.y),d.push(o.z),void 0!==e.rotation&&(s.set(e.rotation[0]*Math.PI/180,e.rotation[1]*Math.PI/180,e.rotation[2]*Math.PI/180,e.rotation[3]),r.setFromEuler(s)),h.push(r.x),h.push(r.y),h.push(r.z),h.push(r.w)}if(!p){const t=new K(".position",l,c),i=new Q(".quaternion",l,h),a=new K(".scale",l,d),r=new q("transform",-1,[t,i,a]);n(e,[r])}}"SCENE_TITLE"===e.internalData.visualizationGroup&&n(e,i.styleAnimationClips.sceneTitle),"CHART"===e.internalData.visualizationGroup&&n(e,i.styleAnimationClips.chart),"CHART_TITLE"===e.internalData.visualizationGroup&&n(e,i.styleAnimationClips.chartTitle),"AXIS"===e.internalData.visualizationGroup&&n(e,i.styleAnimationClips.axis),"LEGEND"===e.internalData.visualizationGroup&&n(e,i.styleAnimationClips.legend),"LEGEND_TITLE"===e.internalData.visualizationGroup&&n(e,i.styleAnimationClips.legendTitle),"GLYPH"===e.internalData.visualizationGroup&&n(e,i.styleAnimationClips.glyph)}))}createMixers(t,e){if(void 0!==e)for(let i=0,n=e.length;i<n;i++){let n;if(e[i].setOnChildren?t.traverse((function(t){t.material&&(void 0===n&&(n=new $),n.add(t))})):n=t,void 0!==n){const t=new tt(n);t.clip=e[i],this.mixers.push(t)}}}play(){this.mixers.length<=0&&(this.dispatchEvent(Ee),this.dispatchEvent(Oe),this.dispatchEvent(Ce)),this.animating=0,this.finishedFunc=this.animationFinished.bind(this);for(let t=0,e=this.mixers.length;t<e;t++){const e=this.mixers[t];e.addEventListener("finished",this.finishedFunc);const i=e.clipAction(e.clip);e.action=i,i.repetitions=1,i.clampWhenFinished=!0,i.play(),this.animating++}this.dispatchEvent(Ee),this.clock=new et,this.animate()}animationFinished(t){t.target.removeEventListener("finished",this.finishedFunc),this.animating--}animate(){if(this.animating<=0)return void this.dispatchEvent(Ce);requestAnimationFrame(this.animate.bind(this));const t=this.clock.getDelta();for(let e=0,i=this.mixers.length;e<i;e++)this.mixers[e].action.isRunning()&&this.mixers[e].update(t);this.dispatchEvent(Oe)}}export{ke as Animator,ct as CellTypeEnum,at as DEFAULT_VIEWER_HEIGHT,nt as DEFAULT_VIEWER_WIDTH,ye as PanInteractor,st as PickDepthEnum,lt as PickLevelEnum,ot as PickTypeEnum,rt as RAYCASTER_LINE_PRECISION,it as REVISION,pe as TransformInteractor,le as Viewer,Se as ZoomRectangleInteractor};
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@avs/go",
3
+ "version": "0.12.71730",
4
+ "description": "AVS Go",
5
+ "keywords": [
6
+ "polymer",
7
+ "polymer 3.0",
8
+ "image",
9
+ "svg",
10
+ "three.js",
11
+ "3d",
12
+ "webgl",
13
+ "custom-element",
14
+ "web-components"
15
+ ],
16
+ "author": "Advanced Visual Systems Inc.",
17
+ "main": "dist/avs-go.min.js",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/avs/avs-go.git",
21
+ "directory": "packages/core"
22
+ },
23
+ "scripts": {
24
+ "build": "webpack --mode production",
25
+ "dev": "webpack --mode development --watch",
26
+ "type-check": "echo 'No TypeScript in core package'"
27
+ },
28
+ "license": "Apache-2.0",
29
+ "dependencies": {
30
+ "@polymer/iron-resizable-behavior": "^3.0.1",
31
+ "@polymer/polymer": "^3.5.2",
32
+ "three": "0.180.0"
33
+ }
34
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 Advanced Visual Systems Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ * This product includes software developed at
18
+ * Advanced Visual Systems Inc. (http://www.avs.com)
19
+ */
20
+
21
+ import {dedupingMixin} from '@polymer/polymer/lib/utils/mixin.js';
22
+
23
+ /**
24
+ * Mixin to add data source properties functionality.
25
+ *
26
+ * @polymer
27
+ * @mixinFunction
28
+ */
29
+ export const AvsDataSourceMixin = dedupingMixin((superClass) => class extends superClass {
30
+
31
+ static get properties() {
32
+ return {
33
+ /**
34
+ * Name of the data source registered in the library map on the server.
35
+ */
36
+ dataSourceName: {
37
+ type: String
38
+ },
39
+ /**
40
+ * User properties for the data source passed directly to the server.
41
+ */
42
+ dataSourceUserProperties: {
43
+ type: Object,
44
+ value: {}
45
+ }
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Add data-source-name and data-source-user-properties to model.
51
+ * @param model Model to add to.
52
+ */
53
+ _addDataSourceProperties(model) {
54
+ if (this.dataSourceName !== undefined) {
55
+ model.dataSourceProperties = {"name":this.dataSourceName};
56
+ if (this.dataSourceUserProperties !== undefined) {
57
+ model.dataSourceProperties.userProperties = this.dataSourceUserProperties;
58
+ }
59
+ }
60
+ }
61
+ });