(window.webpackJsonpNVIV=window.webpackJsonpNVIV||[]).push([[20],{1672:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(2),s=(r(1935),r(0)),a=r(1935);o.module("MeshModule",["IVWebApp"]);var i=function(){function e(e){this.MeshLayerFactor=e}return e.prototype.createLayer=function(e,t){return this.MeshLayerFactor.create(e,t,void 0)},e.ɵfac=function(t){return new(t||e)(s.ɵɵinject(a.MeshLayerFactory))},e.ɵprov=s.ɵɵdefineInjectable({token:e,factory:e.ɵfac,providedIn:"root"}),e}();t.MeshModuleService=i,s.ɵsetClassMetadata(i,[{type:n.Injectable,args:[{providedIn:"root"}]}],(function(){return[{type:a.MeshLayerFactory}]}),null);var u=function(){function e(){this.entry=i}return e.ɵmod=s.ɵɵdefineNgModule({type:e}),e.ɵinj=s.ɵɵdefineInjector({factory:function(t){return new(t||e)}}),e}();t.MeshModule=u,s.ɵsetClassMetadata(u,[{type:n.NgModule}],null,null)},1849:function(e,t,r){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.LOADING=0]="LOADING",e[e.LOADED=1]="LOADED",e[e.PENDING=2]="PENDING"}(n=t.Status||(t.Status={}));var o=function(e,t,r,o){this.name=e,this.active=t,this.available=r,this.path=o,this.status=n.PENDING};t.DatasetState=o},1860:function(e,t,r){"use strict";function n(e){this.content=[],this.scoreFunction=e}r.r(t),r.d(t,"BinaryHeap",(function(){return n})),n.prototype={push:function(e){this.content.push(e),this.bubbleUp(this.content.length-1)},empty:function(){return 0===this.size()},clean:function(){this.content=[]},peek:function(){return this.content[0]},pop:function(){var e=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.sinkDown(0)),e},remove:function(e){for(var t=this.content.length,r=0;r0;){var n=Math.floor((e+1)/2)-1,o=this.content[n];if(r>=this.scoreFunction(o))break;this.content[n]=t,this.content[e]=o,e=n}},sinkDown:function(e){for(var t=this.content.length,r=this.content[e],n=this.scoreFunction(r);;){var o=2*(e+1),s=o-1,a=null;if(s0;)this.sceneGroup.remove(this.sceneGroup.children[0]);a.Cache.enabled=!0,this.maxGPULoads=e,this.showBBoxThree=t,this.showBBoxGLTF=r,this.updateDatasetState()},t.prototype.processClosestMeshes=function(){var e=this,t=this.view.getCamera(),r=this.getViewport();return this.updateFrustum(t),Promise.all(m.map(this.loaders,(function(e){return e})).map((function(n){return n.getClosestMeshes(t,r,e.frustum)}))).then((function(t){t.forEach((function(t){t.filter((function(e){return e})).forEach((function(t){return e.meshQueue.push(t)}))}))}))},t.prototype.processMeshQueue=function(){for(var e,t=this,r=0,n=function(){var n=o.meshQueue.pop(),s=o.view.getCamera();o.updateFrustum(s),n.geometry.computeBoundingBox();var i=n.geometry.boundingBox,u=i.distanceToPoint(s.position),c=[];c.push((function(){return!t.frustum.intersectsBox(i)})),c.push((function(){return!t.isDatasetActive(n.datasetName)})),c.push((function(){return u>=t.loaderConfig.maxDistance})),c.some((function(e){return e()}))?null===(e=o.loaders[n.datasetName])||void 0===e||e.remove(n):(o.showBBoxThree&&o.sceneGroup.add(new a.BoxHelper(n,new a.Color(1,0,0))),o.showBBoxGLTF&&o.sceneGroup.add(new a.Box3Helper(n.GLTFBox,new a.Color(1,0,0))),o.sceneGroup.add(n),r++),o.view.invalidateScene()},o=this;!this.meshQueue.empty()&&rt._taskLoad?-1:1}));return(n=r.workerPool[r.workerPool.length-1])._taskCosts[e]=t,n._taskLoad+=t,n}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))},dispose:function(){for(var e=0;e=2.0 are supported."));else{if(g.extensionsUsed)for(var y=0;y=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+M+'".')}}var T=new B(g,f,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});T.fileLoader.setRequestHeader(this.requestHeader),this.parserOnly?o({parser:T}):T.parse(o,c)}}});var r={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function s(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=r.MSFT_TEXTURE_DDS,this.ddsLoader=e}function a(e){this.name=r.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[r.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function i(){this.name=r.KHR_MATERIALS_UNLIT}a.prototype.loadLight=function(e){var t,r=this.lightDefs[e],o=new n.Color(16777215);void 0!==r.color&&o.fromArray(r.color);var s=void 0!==r.range?r.range:0;switch(r.type){case"directional":(t=new n.DirectionalLight(o)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new n.PointLight(o)).distance=s;break;case"spot":(t=new n.SpotLight(o)).distance=s,r.spot=r.spot||{},r.spot.innerConeAngle=void 0!==r.spot.innerConeAngle?r.spot.innerConeAngle:0,r.spot.outerConeAngle=void 0!==r.spot.outerConeAngle?r.spot.outerConeAngle:Math.PI/4,t.angle=r.spot.outerConeAngle,t.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+r.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==r.intensity&&(t.intensity=r.intensity),t.name=r.name||"light_"+e,Promise.resolve(t)},i.prototype.getMaterialType=function(){return n.MeshBasicMaterial},i.prototype.extendParams=function(e,t,r){var o=[];e.color=new n.Color(1,1,1),e.opacity=1;var s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){var a=s.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==s.baseColorTexture&&o.push(r.assignTexture(e,"map",s.baseColorTexture))}return Promise.all(o)};var u="glTF",c=1313821514,l=5130562;function h(e){this.name=r.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:n.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==u)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var o=new DataView(e,12),s=0;s",t),e.fragmentShader=e.fragmentShader.replace("#include ",r),e.fragmentShader=e.fragmentShader.replace("#include ",o),e.fragmentShader=e.fragmentShader.replace("#include ",s),e.fragmentShader=e.fragmentShader.replace("#include ",a)},Object.defineProperties(this,{specular:{get:function(){return i.specular.value},set:function(e){i.specular.value=e}},specularMap:{get:function(){return i.specularMap.value},set:function(e){i.specularMap.value=e}},glossiness:{get:function(){return i.glossiness.value},set:function(e){i.glossiness.value=e}},glossinessMap:{get:function(){return i.glossinessMap.value},set:function(e){i.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function m(){return{name:r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return f},extendParams:function(e,t,r){var o=t.extensions[this.name];e.color=new n.Color(1,1,1),e.opacity=1;var s=[];if(Array.isArray(o.diffuseFactor)){var a=o.diffuseFactor;e.color.fromArray(a),e.opacity=a[3]}if(void 0!==o.diffuseTexture&&s.push(r.assignTexture(e,"map",o.diffuseTexture)),e.emissive=new n.Color(0,0,0),e.glossiness=void 0!==o.glossinessFactor?o.glossinessFactor:1,e.specular=new n.Color(1,1,1),Array.isArray(o.specularFactor)&&e.specular.fromArray(o.specularFactor),void 0!==o.specularGlossinessTexture){var i=o.specularGlossinessTexture;s.push(r.assignTexture(e,"glossinessMap",i)),s.push(r.assignTexture(e,"specularMap",i))}return Promise.all(s)},createMaterial:function(e){var t=new f(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=n.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function v(){this.name=r.KHR_MESH_QUANTIZATION}function g(e,t,r,o){n.Interpolant.call(this,e,t,r,o)}d.prototype.decodePrimitive=function(e,t){var r=this.json,n=this.dracoLoader,o=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,a={},i={},u={};for(var c in s){var l=E[c]||c.toLowerCase();a[l]=s[c]}for(c in e.attributes){l=E[c]||c.toLowerCase();if(void 0!==s[c]){var h=r.accessors[e.attributes[c]],d=A[h.componentType];u[l]=d,i[l]=!0===h.normalized}}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t){n.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r],o=i[r];void 0!==o&&(n.normalized=o)}t(e)}),a,u)}))}))},p.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},f.prototype=Object.create(n.MeshStandardMaterial.prototype),f.prototype.constructor=f,f.prototype.copy=function(e){return n.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},g.prototype=Object.create(n.Interpolant.prototype),g.prototype.constructor=g,g.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,o=e*n*3+n,s=0;s!==n;s++)t[s]=r[o+s];return t},g.prototype.beforeStart_=g.prototype.copySampleValue_,g.prototype.afterEnd_=g.prototype.copySampleValue_,g.prototype.interpolate_=function(e,t,r,n){for(var o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,i=2*a,u=3*a,c=n-t,l=(r-t)/c,h=l*l,d=h*l,p=e*u,f=p-u,m=-2*d+3*h,v=d-h,g=1-m,y=v-h+l,M=0;M!==a;M++){var w=s[f+M+a],T=s[f+M+i]*c,b=s[p+M+a],S=s[p+M]*c;o[M]=g*w+y*T+m*b+v*S}return o};var y=0,M=1,w=2,T=3,b=4,S=5,L=6,A={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},_={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},x={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.RepeatWrapping},R={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},E={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},D={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},C={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete},I="OPAQUE",P="MASK",O="BLEND",U={"image/png":n.RGBAFormat,"image/jpeg":n.RGBFormat};function F(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function k(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function G(e,t){void 0!==t.extras&&("object"===o(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function N(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,n=t.weights.length;r=2&&a.setY(x,S[L*u+1]),u>=3&&a.setZ(x,S[L*u+2]),u>=4&&a.setW(x,S[L*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a}))},B.prototype.loadTexture=function(e){var t,o=this,s=this.json,a=this.options,i=this.textureLoader,u=window.URL||window.webkitURL,c=s.textures[e],l=c.extensions||{},h=(t=l[r.MSFT_TEXTURE_DDS]?s.images[l[r.MSFT_TEXTURE_DDS].source]:s.images[c.source]).uri,d=!1;return void 0!==t.bufferView&&(h=o.getDependency("bufferView",t.bufferView).then((function(e){d=!0;var r=new Blob([e],{type:t.mimeType});return h=u.createObjectURL(r)}))),Promise.resolve(h).then((function(e){var t=a.manager.getHandler(e);return t||(t=l[r.MSFT_TEXTURE_DDS]?o.extensions[r.MSFT_TEXTURE_DDS].ddsLoader:i),new Promise((function(r,n){t.load(F(e,a.path),r,void 0,n)}))})).then((function(e){!0===d&&u.revokeObjectURL(h),e.flipY=!1,c.name&&(e.name=c.name),t.mimeType in U&&(e.format=U[t.mimeType]);var r=(s.samplers||{})[c.sampler]||{};return e.magFilter=_[r.magFilter]||n.LinearFilter,e.minFilter=_[r.minFilter]||n.LinearMipmapLinearFilter,e.wrapS=x[r.wrapS]||n.RepeatWrapping,e.wrapT=x[r.wrapT]||n.RepeatWrapping,e}))},B.prototype.assignTexture=function(e,t,o){var s=this;return this.getDependency("texture",o.index).then((function(a){if(!a.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=n.RGBFormat}if(void 0===o.texCoord||0==o.texCoord||"aoMap"===t&&1==o.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+o.texCoord+" for texture "+t+" not yet supported."),s.extensions[r.KHR_TEXTURE_TRANSFORM]){var i=void 0!==o.extensions?o.extensions[r.KHR_TEXTURE_TRANSFORM]:void 0;i&&(a=s.extensions[r.KHR_TEXTURE_TRANSFORM].extendTexture(a,i))}e[t]=a}))},B.prototype.assignFinalMaterial=function(e){var t=e.geometry,r=e.material,o=void 0!==t.attributes.tangent,s=void 0!==t.attributes.color,a=void 0===t.attributes.normal,i=!0===e.isSkinnedMesh,u=Object.keys(t.morphAttributes).length>0,c=u&&void 0!==t.morphAttributes.normal;if(e.isPoints){var l="PointsMaterial:"+r.uuid,h=this.cache.get(l);h||(h=new n.PointsMaterial,n.Material.prototype.copy.call(h,r),h.color.copy(r.color),h.map=r.map,h.sizeAttenuation=!1,this.cache.add(l,h)),r=h}else if(e.isLine){l="LineBasicMaterial:"+r.uuid;var d=this.cache.get(l);d||(d=new n.LineBasicMaterial,n.Material.prototype.copy.call(d,r),d.color.copy(r.color),this.cache.add(l,d)),r=d}if(o||s||a||i||u){l="ClonedMaterial:"+r.uuid+":";r.isGLTFSpecularGlossinessMaterial&&(l+="specular-glossiness:"),i&&(l+="skinning:"),o&&(l+="vertex-tangents:"),s&&(l+="vertex-colors:"),a&&(l+="flat-shading:"),u&&(l+="morph-targets:"),c&&(l+="morph-normals:");var p=this.cache.get(l);p||(p=r.clone(),i&&(p.skinning=!0),o&&(p.vertexTangents=!0),s&&(p.vertexColors=!0),a&&(p.flatShading=!0),u&&(p.morphTargets=!0),c&&(p.morphNormals=!0),this.cache.add(l,p)),r=p}r.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",new n.BufferAttribute(t.attributes.uv.array,2)),r.normalScale&&!o&&(r.normalScale.y=-r.normalScale.y),e.material=r},B.prototype.loadMaterial=function(e){var t,o=this.json,s=this.extensions,a=o.materials[e],i={},u=a.extensions||{},c=[];if(u[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var l=s[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=l.getMaterialType(),c.push(l.extendParams(i,a,this))}else if(u[r.KHR_MATERIALS_UNLIT]){var h=s[r.KHR_MATERIALS_UNLIT];t=h.getMaterialType(),c.push(h.extendParams(i,a,this))}else{t=n.MeshStandardMaterial;var d=a.pbrMetallicRoughness||{};if(i.color=new n.Color(1,1,1),i.opacity=1,Array.isArray(d.baseColorFactor)){var p=d.baseColorFactor;i.color.fromArray(p),i.opacity=p[3]}void 0!==d.baseColorTexture&&c.push(this.assignTexture(i,"map",d.baseColorTexture)),i.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,i.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(c.push(this.assignTexture(i,"metalnessMap",d.metallicRoughnessTexture)),c.push(this.assignTexture(i,"roughnessMap",d.metallicRoughnessTexture)))}!0===a.doubleSided&&(i.side=n.DoubleSide);var m=a.alphaMode||I;return m===O?(i.transparent=!0,i.depthWrite=!1):(i.transparent=!1,m===P&&(i.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==n.MeshBasicMaterial&&(c.push(this.assignTexture(i,"normalMap",a.normalTexture)),i.normalScale=new n.Vector2(1,1),void 0!==a.normalTexture.scale&&i.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==n.MeshBasicMaterial&&(c.push(this.assignTexture(i,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(i.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==n.MeshBasicMaterial&&(i.emissive=(new n.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==n.MeshBasicMaterial&&c.push(this.assignTexture(i,"emissiveMap",a.emissiveTexture)),Promise.all(c).then((function(){var e;return e=t===f?s[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(i):new t(i),a.name&&(e.name=a.name),e.map&&(e.map.encoding=n.sRGBEncoding),e.emissiveMap&&(e.emissiveMap.encoding=n.sRGBEncoding),G(e,a),a.extensions&&k(s,e,a),e}))},B.prototype.loadGeometries=function(e){var t=this,o=this.extensions,s=this.primitiveCache;function a(e){return o[r.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return j(r,e,t)}))}for(var i,u,c=[],l=0,h=e.length;l0&&N(h,o),h.name=o.name||"mesh_"+e,i.length>1&&(h.name+="_"+c),G(h,o),r.assignFinalMaterial(h),u.push(h)}if(1===u.length)return u[0];var m=new n.Group;for(c=0,l=u.length;c1){var r=u[c.mesh]++;(t=e.clone()).name+="_instance_"+r}else t=e;return void 0!==c.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=c.weights.length;t1?new n.Group:1===e.length?e[0]:new n.Object3D)!==e[0])for(var r=0,o=e.length;r=a.config.getCurrentVertexBudget()})),f.push((function(){return d>=a.config.maxDistance})),f.some((function(e){return e()})))return u.removeMesh(c),"continue";c.requested||(u.requestQueue.push(new s.RequestQueueItem(c.id,i,c.vertexCount,d,u.setLOD(c))),c.requested=!0)},u=this;for(var c in this.gltfMeshes)i(c)},e.prototype.setLOD=function(e){var t=this,r=e.materials.map((function(e){return t.parser.json.materials[e]})).filter((function(e){return e.extensions&&e.extensions.MSFT_lod})).map((function(e){return e.extensions.MSFT_lod.ids}));return 0===r.length?[]:(this.parser.json.meshes[e.id].primitives.forEach((function(e,t){e.material=r[t].slice(-1).pop()})),r[0])},e.projectSphereDiameter=function(e,t,r,n){var o=t/2*Math.PI/180,s=e/Math.tan(o)/Math.sqrt(r*r-e*e);return 2*Math.floor(s*n*.5)||1/0},e.prototype.getDistance=function(e,t){var r=this.gltfMeshes[t],o=new n.Sphere,s=r.box.clone();return s.getBoundingSphere(o),s.distanceToPoint(e.position)},e.prototype.processRequestQueues=function(e,t){for(var r=this,n=0,o=[],s=function(){var s=a.requestQueue.pop();if(a.currentVertexCount+s.vertexCount>a.config.getCurrentVertexBudget())return a.requestQueue.push(s),"break";var i=[];if(i.push((function(){return t.intersectsBox(r.gltfMeshes[s.meshName].box)})),i.push((function(){return r.getDistance(e,s.meshName)<=s.weight})),i.every((function(e){return e()})))return o.push(a.requestMesh(s,e)),a.currentVertexCount+=s.vertexCount,n++,"continue";a.gltfMeshes[s.meshName].requested=!1},a=this;!this.requestQueue.empty()&&n<=this.config.maxLoadRequests;){if("break"===s())break}return this.requestQueue.size()>this.MAX_REQUEST_QUEUE_SIZE&&this.requestQueue.clean(),o},e.prototype.requestMesh=function(e,t){var r=this;return this.parser.getDependency("mesh",e.id).then((function(n){if(r.active){var o=new a.GLTFMesh(n,e.weight,r.datasetName,r.config.showWireframe,r.gltfMeshes[e.meshName].box);return o.time=Date.now(),o.cameraPosition=t.position.clone(),o.onAfterRender=r.getOnAfterRender(e,o),o}}))},e.prototype.requestMaterial=function(e,t){var r=this;return this.parser.getDependency("material",e).then((function(e){if(r.active){var n=t.material;n.name=e.name,n.uniforms.tDiffuse.value.dispose(),n.uniforms.tDiffuse={value:e.map},n.uniformsNeedUpdate=!0,t.textureLoading=u.Status.LOADED,r.view.invalidateScene()}}))},e.prototype.getOnAfterRender=function(e,t){var r=this;return function(n,o,s,a){a.computeBoundingBox();var c=a.boundingBox.distanceToPoint(s.position),l=s.position.distanceTo(t.cameraPosition),h=Date.now()-t.time,d=l/h/1e3;if(c<=r.config.maxDistance/3&&h<50&&d0)){var p=0;r.config.lod>=0&&e.LOD.length>r.config.lod&&(p=r.config.lod),r.requestMaterial(e.LOD[p],t).catch(i.handleWarning)}t.cameraPosition=s.position.clone(),t.time=Date.now()}},e.prototype.removeMesh=function(e){e.requested=!1;for(var t=this.sceneGroup.getObjectByName(e.name);void 0!==t;)this.currentVertexCount-=e.vertexCount,this.sceneGroup.remove(t),this.disposeMesh(t,!0),t=this.sceneGroup.getObjectByName(e.name)},e.prototype.disposeMesh=function(e,t){var r,n;if(e){this.gltfMeshes[e.name].requested=!1,t&&e.geometry.dispose();var o=e.material,s=null===(n=null===(r=o.uniforms)||void 0===r?void 0:r.tDiffuse)||void 0===n?void 0:n.value;s&&s.dispose(),o.dispose()}},e}();t.MeshLoader=c},1902:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,r,n,o,s){this.id=e,this.box=t,this.vertexCount=r,this.name=n,this.materials=o,this.requested=s};t.GLTFMeshItem=n;var o=function(e,t,r,n,o){this.id=e,this.meshName=t,this.vertexCount=r,this.weight=n,this.LOD=o};t.RequestQueueItem=o},1903:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var s=r(4),a=r(1849),i=function(e){function t(t,n,o,i,u){var c=e.call(this,t.geometry,t.material)||this;c.weight=n,c.datasetName=o,c.showWireframe=i,c.GLTFBox=u,c.textureLoading=a.Status.PENDING,c.name=t.name;var l=c.material,h=new s.ShaderMaterial;return h.wireframe=i,h.side=s.DoubleSide,h.name=l.name,h.fragmentShader=r(1904),h.vertexShader=r(1905),h.uniforms={tDiffuse:{value:l.map}},c.material=h,c}return o(t,e),t}(s.Mesh);t.GLTFMesh=i},1904:function(e,t){e.exports="varying vec2 vUv;\nuniform sampler2D tDiffuse;\n\nvoid main()\n{\n\tgl_FragColor = texture2D(tDiffuse, vUv);\n}"},1905:function(e,t){e.exports="varying vec2 vUv;\n\nvoid main()\n{\n\tvUv = uv;\n\tmat4 transformation = projectionMatrix * modelViewMatrix;\n\tgl_Position = transformation * vec4(position, 1.0);\n}"},1935:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var s=r(80),a=r(0),i=r(1898),u=(r(65),r(31),r(72),r(0)),c=r(65),l=r(72),h=r(31),d=function(e){function t(t,r,n){var o=e.call(this)||this;return o.ViewMenuService=t,o.JWTTokenService=r,o.DatasetRepository=n,o}return o(t,e),t.prototype.create=function(e,t,r){return new i.MeshLayer(e,t,this.ViewMenuService,this.JWTTokenService,this.DatasetRepository)},t.ɵfac=function(e){return new(e||t)(u.ɵɵinject(c.ViewMenuService),u.ɵɵinject(l.JWTTokenService),u.ɵɵinject(h.DatasetRepository))},t.ɵprov=u.ɵɵdefineInjectable({token:t,factory:t.ɵfac,providedIn:"root"}),t}(s.SceneLayerFactory);t.MeshLayerFactory=d,u.ɵsetClassMetadata(d,[{type:a.Injectable,args:[{providedIn:"root"}]}],(function(){return[{type:c.ViewMenuService},{type:l.JWTTokenService},{type:h.DatasetRepository}]}),null)}}]);