@abi-software/scaffoldvuer 1.19.0 → 1.19.1

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.
@@ -29498,7 +29498,7 @@ var vF, yF, bF, xF, SF, CF, wF, TF, EF, DF, OF, kF, AF, jF, MF, NF, PF, FF, IF,
29498
29498
  e = f(e, 1), t = f(t, 1);
29499
29499
  var p = {
29500
29500
  name: "zincjs",
29501
- version: "2.2.0",
29501
+ version: "2.2.1",
29502
29502
  description: "ZincJS (Web-based-Zinc-Visualisation)",
29503
29503
  type: "module",
29504
29504
  main: "build/zinc.js",
@@ -31507,7 +31507,7 @@ var vF, yF, bF, xF, SF, CF, wF, TF, EF, DF, OF, kF, AF, jF, MF, NF, PF, FF, IF,
31507
31507
  let n = new ye(void 0, void 0, e, this), r = c ? c[e] : void 0;
31508
31508
  r ||= this.groupName, r && n.setLabel(r), l > 0 && n.setFrustumCulled(!1), t[e] = n, this.morph.add(n.getGroup());
31509
31509
  }
31510
- c && e && this.showLabel(), N(a[0], n[0], r[0], i[0], o[0]), s != null && P(s[0]), this.ready = !0, this.boundingBoxUpdateRequired = !0;
31510
+ c && c.length > 0 && e && this.showLabel(), N(a[0], n[0], r[0], i[0], o[0]), s != null && P(s[0]), this.ready = !0, this.boundingBoxUpdateRequired = !0;
31511
31511
  };
31512
31512
  this.addCustomGlyph = (e) => {
31513
31513
  e.isGlyph && t.push(e), this.ready = !0, this.boundingBoxUpdateRequired = !0;
@@ -34745,7 +34745,9 @@ var vF, yF, bF, xF, SF, CF, wF, TF, EF, DF, OF, kF, AF, jF, MF, NF, PF, FF, IF,
34745
34745
  let c = (e, t, r, i, a) => (o) => {
34746
34746
  let s = o;
34747
34747
  (typeof s == "string" || s instanceof String) && (s = JSON.parse(o));
34748
- let c = a && a.isInline ? a.isInline : void 0, l = a && a.anatomicalId ? a.anatomicalId : void 0, u = !a?.displayLabels || a.displayLabels, d = a && "renderOrder" in a ? a.renderOrder : void 0, f = new je();
34748
+ let c = a && a.isInline ? a.isInline : void 0, l = a && a.anatomicalId ? a.anatomicalId : void 0, u = a?.displayLabels;
34749
+ u === void 0 && (u = !0);
34750
+ let d = a && "renderOrder" in a ? a.renderOrder : void 0, f = new je();
34749
34751
  f.setDuration(n.getDuration()), f.groupName = r, ++this.toBeDownloaded, f.load(s, t, () => {
34750
34752
  --this.toBeDownloaded, i != null && typeof i == "function" && i(f);
34751
34753
  }, c, u), f.setAnatomicalId(l), f.setRenderOrder(d), e.addZincObject(f);
@@ -34910,7 +34912,7 @@ var vF, yF, bF, xF, SF, CF, wF, TF, EF, DF, OF, kF, AF, jF, MF, NF, PF, FF, IF,
34910
34912
  break;
34911
34913
  case "Glyph":
34912
34914
  let r;
34913
- o ? r = n.Inline.GlyphGeometriesURL : (r = n.GlyphGeometriesURL, r = C(n.GlyphGeometriesURL, t)), l.displayLabels = !n.displayLabels || n.displayLabels, l.loaderOptions.isGlyphsets = !0, this.loadGlyphsetURL(e, a, r, c, i, l);
34915
+ o ? r = n.Inline.GlyphGeometriesURL : (r = n.GlyphGeometriesURL, r = C(n.GlyphGeometriesURL, t)), l.displayLabels = n.DisplayLabels, l.displayLabels === void 0 && (l.displayLabels = !0), l.loaderOptions.isGlyphsets = !0, this.loadGlyphsetURL(e, a, r, c, i, l);
34914
34916
  break;
34915
34917
  case "Points":
34916
34918
  this.loadPointsetURL(e, a, n.MorphVertices, n.MorphColours, c, i, l);
@@ -3165,9 +3165,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3165
3165
  `),r=[`vec3 specularFactor = specular;`,`#ifdef USE_SPECULARMAP`,` vec4 texelSpecular = texture2D( specularMap, vUv );`,` texelSpecular = sRGBToLinear( texelSpecular );`,` // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture`,` specularFactor *= texelSpecular.rgb;`,`#endif`].join(`
3166
3166
  `),i=[`float glossinessFactor = glossiness;`,`#ifdef USE_GLOSSINESSMAP`,` vec4 texelGlossiness = texture2D( glossinessMap, vUv );`,` // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture`,` glossinessFactor *= texelGlossiness.a;`,`#endif`].join(`
3167
3167
  `),a=[`PhysicalMaterial material;`,`material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );`,`vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );`,`float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );`,`material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.`,`material.specularRoughness += geometryRoughness;`,`material.specularRoughness = min( material.specularRoughness, 1.0 );`,`material.specularColor = specularFactor;`].join(`
3168
- `),o={specular:{value:new Z().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(e){for(let t in o)e.uniforms[t]=o[t];e.fragmentShader=e.fragmentShader.replace(`uniform float roughness;`,`uniform vec3 specular;`).replace(`uniform float metalness;`,`uniform float glossiness;`).replace(`#include <roughnessmap_pars_fragment>`,t).replace(`#include <metalnessmap_pars_fragment>`,n).replace(`#include <roughnessmap_fragment>`,r).replace(`#include <metalnessmap_fragment>`,i).replace(`#include <lights_physical_fragment>`,a)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP=``:delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP=``,this.defines.USE_UV=``):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(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}},gP=class{constructor(){this.name=tP.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.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(){return hP}extendParams(e,t,n){let r=t.extensions[this.name];e.color=new Z(1,1,1),e.opacity=1;let i=[];if(Array.isArray(r.diffuseFactor)){let t=r.diffuseFactor;e.color.fromArray(t),e.opacity=t[3]}if(r.diffuseTexture!==void 0&&i.push(n.assignTexture(e,`map`,r.diffuseTexture)),e.emissive=new Z(0,0,0),e.glossiness=r.glossinessFactor===void 0?1:r.glossinessFactor,e.specular=new Z(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),r.specularGlossinessTexture!==void 0){let t=r.specularGlossinessTexture;i.push(n.assignTexture(e,`glossinessMap`,t)),i.push(n.assignTexture(e,`specularMap`,t))}return Promise.all(i)}createMaterial(e){let t=new hP(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}},_P=class{constructor(){this.name=tP.KHR_MESH_QUANTIZATION}},vP=class extends dA{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}},vP.prototype.beforeStart_=vP.prototype.copySampleValue_,vP.prototype.afterEnd_=vP.prototype.copySampleValue_,vP.prototype.interpolate_=function(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=_*t+v*n+h*r+g*c}return i},yP={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},bP={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},xP={9728:LS,9729:HS,9984:RS,9985:US,9986:BS,9987:GS},SP={33071:FS,33648:IS,10497:PS},CP={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},wP={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv2`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},TP={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},EP={CUBICSPLINE:void 0,LINEAR:lw,STEP:cw},DP={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},OP=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new BN,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},this.textureLoader=typeof createImageBitmap<`u`&&/Firefox/.test(navigator.userAgent)===!1?new mj(this.options.manager):new FA(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new kA(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};UN(i,a,r),WN(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone();return r.name+=`_instance_`+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this.loadNode(t);break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this.loadAnimation(t);break;case`camera`:r=this.loadCamera(t);break;default:throw Error(`Unknown type: `+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[tP.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(VN(t.uri,r.path),e,void 0,function(){i(Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0)return Promise.resolve(null);let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=CP[r.type],o=bP[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,p;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new aO(f,u/s),t.cache.add(n,c)),p=new sO(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),p=new wE(f,a,d);if(r.sparse!==void 0){let t=CP.SCALAR,n=bP[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(p=new wE(p.array.slice(),p.itemSize,p.normalized));for(let e=0,t=l.length;e<t;e++){let t=l[e];if(p.setX(t,u[e*a]),a>=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e],i=t.images[r.source],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=this.options,o=i.textures[e],s=(t.uri||t.bufferView)+`:`+o.sampler;if(this.textureCache[s])return this.textureCache[s];let c=self.URL||self.webkitURL,l=t.uri||``,u=!1,d=!0,f=l.search(/\.jpe?g($|\?)/i)>0||l.search(/^data\:image\/jpeg/)===0;if((t.mimeType===`image/jpeg`||f)&&(d=!1),t.bufferView!==void 0)l=r.getDependency(`bufferView`,t.bufferView).then(function(e){if(t.mimeType===`image/png`){let t=new DataView(e,25,1).getUint8(0,!1);d=t===6||t===4||t===3}u=!0;let n=new Blob([e],{type:t.mimeType});return l=c.createObjectURL(n),l});else if(t.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let p=Promise.resolve(l).then(function(e){return new Promise(function(t,r){let i=t;n.isImageBitmapLoader===!0&&(i=function(e){let n=new $w(e);n.needsUpdate=!0,t(n)}),n.load(VN(e,a.path),i,void 0,r)})}).then(function(t){u===!0&&c.revokeObjectURL(l),t.flipY=!1,o.name&&(t.name=o.name),d||(t.format=oC);let n=(i.samplers||{})[o.sampler]||{};return t.magFilter=xP[n.magFilter]||1006,t.minFilter=xP[n.minFilter]||1008,t.wrapS=SP[n.wrapS]||1e3,t.wrapT=SP[n.wrapT]||1e3,r.associations.set(t,{type:`textures`,index:e}),t}).catch(function(){return console.error(`THREE.GLTFLoader: Couldn't load texture`,l),null});return this.textureCache[s]=p,p}assignTexture(e,t,n){let r=this;return this.getDependency(`texture`,n.index).then(function(i){if(n.texCoord!==void 0&&n.texCoord!=0&&(t!==`aoMap`||n.texCoord!=1)&&console.warn(`THREE.GLTFLoader: Custom UV set `+n.texCoord+` for texture `+t+` not yet supported.`),r.extensions[tP.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[tP.KHR_TEXTURE_TRANSFORM];if(e){let t=r.associations.get(i);i=r.extensions[tP.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),r.associations.set(i,t)}}e[t]=i})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent!==void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0,o=Object.keys(t.morphAttributes).length>0,s=o&&t.morphAttributes.normal!==void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new $O,_E.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new HO,_E.prototype.copy.call(t,n),t.color.copy(n.color),this.cache.add(e,t)),n=t}if(r||i||a||o){let e=`ClonedMaterial:`+n.uuid+`:`;n.isGLTFSpecularGlossinessMaterial&&(e+=`specular-glossiness:`),r&&(e+=`vertex-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`),o&&(e+=`morph-targets:`),s&&(e+=`morph-normals:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),o&&(t.morphTargets=!0),s&&(t.morphNormals=!0),r&&(t.vertexTangents=!0,t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}n.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute(`uv2`,t.attributes.uv),e.material=n}getMaterialType(){return tA}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[tP.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){let e=r[tP.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else if(s[tP.KHR_MATERIALS_UNLIT]){let e=r[tP.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new Z(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.fromArray(e),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||DP.OPAQUE;return l===DP.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===DP.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==xE&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new J(1,-1),i.normalTexture.scale!==void 0&&o.normalScale.set(i.normalTexture.scale,-i.normalTexture.scale)),i.occlusionTexture!==void 0&&a!==xE&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==xE&&(o.emissive=new Z().fromArray(i.emissiveFactor)),i.emissiveTexture!==void 0&&a!==xE&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture)),Promise.all(c).then(function(){let n;return n=a===hP?r[tP.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new a(o),i.name&&(n.name=i.name),n.map&&(n.map.encoding=_w),n.emissiveMap&&(n.emissiveMap.encoding=_w),WN(n,i),t.associations.set(n,{type:`materials`,index:e}),i.extensions&&UN(r,n,i),n})}createUniqueName(e){let t=Zj.sanitizeNodeName(e||``),n=t;for(let e=1;this.nodeNamesUsed[n];++e)n=t+`_`+e;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[tP.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return QN(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=qN(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[tP.KHR_DRACO_MESH_COMPRESSION]?i(o):QN(new HE,o,t),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?HN(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,f=o[n];if(u.mode===yP.TRIANGLES||u.mode===yP.TRIANGLE_STRIP||u.mode===yP.TRIANGLE_FAN||u.mode===void 0)d=i.isSkinnedMesh===!0?new jO(l,f):new oD(l,f),d.isSkinnedMesh===!0&&!d.geometry.attributes.skinWeight.normalized&&d.normalizeSkinWeights(),u.mode===yP.TRIANGLE_STRIP?d.geometry=$N(d.geometry,1):u.mode===yP.TRIANGLE_FAN&&(d.geometry=$N(d.geometry,2));else if(u.mode===yP.LINES)d=new ZO(l,f);else if(u.mode===yP.LINE_STRIP)d=new JO(l,f);else if(u.mode===yP.LINE_LOOP)d=new QO(l,f);else if(u.mode===yP.POINTS)d=new ik(l,f);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&KN(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),WN(d,i),u.extensions&&UN(r,d,u),t.assignFinalMaterial(d),c.push(d)}if(c.length===1)return c[0];let l=new ZD;for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return n.type===`perspective`?t=new pD(Jw.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new QA(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),WN(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n={joints:t.joints};return t.inverseBindMatrices===void 0?Promise.resolve(n):this.getDependency(`accessor`,t.inverseBindMatrices).then(function(e){return n.inverseBindMatrices=e,n})}loadAnimation(e){let t=this.json.animations[e],n=[],r=[],i=[],a=[],o=[];for(let e=0,s=t.channels.length;e<s;e++){let s=t.channels[e],c=t.samplers[s.sampler],l=s.target,u=l.node===void 0?l.id:l.node,d=t.parameters===void 0?c.input:t.parameters[c.input],f=t.parameters===void 0?c.output:t.parameters[c.output];n.push(this.getDependency(`node`,u)),r.push(this.getDependency(`accessor`,d)),i.push(this.getDependency(`accessor`,f)),a.push(c),o.push(l)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(a),Promise.all(o)]).then(function(n){let r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=[];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=i[e],l=a[e],u=o[e],d=s[e];if(t===void 0)continue;t.updateMatrix(),t.matrixAutoUpdate=!0;let f;switch(TP[d.path]){case TP.weights:f=vA;break;case TP.rotation:f=bA;break;case TP.position:case TP.scale:default:f=SA}let p=t.name?t.name:t.uuid,m=u.interpolation===void 0?lw:EP[u.interpolation],h=[];TP[d.path]===TP.weights?t.traverse(function(e){e.isMesh===!0&&e.morphTargetInfluences&&h.push(e.name?e.name:e.uuid)}):h.push(p);let g=l.array;if(l.normalized){let e=YN(g.constructor),t=new Float32Array(g.length);for(let n=0,r=g.length;n<r;n++)t[n]=g[n]*e;g=t}for(let e=0,t=h.length;e<t;e++){let t=new f(h[e]+`.`+TP[d.path],n.array,g,m);u.interpolation===`CUBICSPLINE`&&(t.createInterpolant=function(e){return new vP(this.times,this.values,this.getValueSize()/3,e)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(t)}}let l=t.name?t.name:`animation_`+e;return new CA(l,void 0,c)})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this.extensions,r=this,i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``;return function(){let t=[],n=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return n&&t.push(n),i.camera!==void 0&&t.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){t.push(e)}),Promise.all(t)}().then(function(t){let o;if(o=i.isBone===!0?new MO:t.length>1?new ZD:t.length===1?t[0]:new iE,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),WN(o,i),i.extensions&&UN(n,o,i),i.matrix!==void 0){let e=new X;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);return r.associations.set(o,{type:`nodes`,index:e}),o})}loadScene(e){let t=this.json,n=this.extensions,r=this.json.scenes[e],i=this,a=new ZD;r.name&&(a.name=i.createUniqueName(r.name)),WN(a,r),r.extensions&&UN(n,a,r);let o=r.nodes||[],s=[];for(let e=0,n=o.length;e<n;e++)s.push(XN(o[e],a,t,i));return Promise.all(s).then(function(){return a})}}})),AP=p((e=>{e.deflate=Me,e.deflateSync=Ne,e.inflate=Ie,e.inflateSync=Le,e.gzip=Be,e.compress=Be,e.gzipSync=Ve,e.compressSync=Ve,e.gunzip=We,e.gunzipSync=Ge,e.zlib=qe,e.zlibSync=Je,e.unzlib=Ze,e.unzlibSync=Qe,e.gzip=Be,e.compress=Be,e.decompress=et,e.decompressSync=tt,e.strToU8=st,e.strFromU8=ct,e.zip=_t,e.zipSync=vt,e.unzip=xt,e.unzipSync=St;var t={},n={};n.default=(function(e,n,r,i,a){var o=new Worker(t[n]||(t[n]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return o.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],a(r,null)}else a(null,t)},o.postMessage(r,i),o});var r=Uint8Array,i=Uint16Array,a=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new i(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new a(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},u=l(o,2),d=u.b,f=u.r;d[28]=258,f[258]=28;for(var p=l(s,0),m=p.b,h=p.r,g=new i(32768),_=0;_<32768;++_){var v=(_&43690)>>1|(_&21845)<<1;v=(v&52428)>>2|(v&13107)<<2,v=(v&61680)>>4|(v&3855)<<4,g[_]=((v&65280)>>8|(v&255)<<8)>>1}for(var y=(function(e,t,n){for(var r=e.length,a=0,o=new i(t);a<r;++a)e[a]&&++o[e[a]-1];var s=new i(t);for(a=1;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(n){c=new i(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=s[e[a]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)c[g[f]>>l]=u}else for(c=new i(r),a=0;a<r;++a)e[a]&&(c[a]=g[s[e[a]-1]++]>>15-e[a]);return c}),b=new r(288),_=0;_<144;++_)b[_]=8;for(var _=144;_<256;++_)b[_]=9;for(var _=256;_<280;++_)b[_]=7;for(var _=280;_<288;++_)b[_]=8;for(var x=new r(32),_=0;_<32;++_)x[_]=5;var S=y(b,9,0),C=y(b,9,1),w=y(x,5,0),T=y(x,5,1),E=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},D=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},O=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},k=function(e){return(e+7)/8|0},A=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new r(e.subarray(t,n))};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var j=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],M=function(e,t,n){var r=Error(t||j[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,M),!n)throw r;return r},N=function(e,t,n,i){var a=e.length,l=i?i.length:0;if(!a||t.f&&!t.l)return n||new r(0);var u=!n,f=u||t.i!=2,p=t.i;u&&(n=new r(a*3));var h=function(e){var t=n.length;if(e>t){var i=new r(Math.max(t*2,e));i.set(n),n=i}},g=t.f||0,_=t.p||0,v=t.b||0,b=t.l,x=t.d,S=t.m,w=t.n,j=a*8;do{if(!b){g=D(e,_,1);var N=D(e,_+1,3);if(_+=3,!N){var P=k(_)+4,F=e[P-4]|e[P-3]<<8,ee=P+F;if(ee>a){p&&M(0);break}f&&h(v+F),n.set(e.subarray(P,ee),v),t.b=v+=F,t.p=_=ee*8,t.f=g;continue}if(N==1)b=C,x=T,S=9,w=5;else if(N==2){var te=D(e,_,31)+257,ne=D(e,_+10,15)+4,I=te+D(e,_+5,31)+1;_+=14;for(var L=new r(I),re=new r(19),R=0;R<ne;++R)re[c[R]]=D(e,_+R*3,7);_+=ne*3;for(var z=E(re),ie=(1<<z)-1,B=y(re,z,1),R=0;R<I;){var V=B[D(e,_,ie)];_+=V&15;var P=V>>4;if(P<16)L[R++]=P;else{var ae=0,oe=0;for(P==16?(oe=3+D(e,_,3),_+=2,ae=L[R-1]):P==17?(oe=3+D(e,_,7),_+=3):P==18&&(oe=11+D(e,_,127),_+=7);oe--;)L[R++]=ae}}var H=L.subarray(0,te),se=L.subarray(te);S=E(H),w=E(se),b=y(H,S,1),x=y(se,w,1)}else M(1);if(_>j){p&&M(0);break}}f&&h(v+131072);for(var ce=(1<<S)-1,le=(1<<w)-1,ue=_;;ue=_){var ae=b[O(e,_)&ce],U=ae>>4;if(_+=ae&15,_>j){p&&M(0);break}if(ae||M(2),U<256)n[v++]=U;else if(U==256){ue=_,b=null;break}else{var de=U-254;if(U>264){var R=U-257,fe=o[R];de=D(e,_,(1<<fe)-1)+d[R],_+=fe}var W=x[O(e,_)&le],pe=W>>4;W||M(3),_+=W&15;var se=m[pe];if(pe>3){var fe=s[pe];se+=O(e,_)&(1<<fe)-1,_+=fe}if(_>j){p&&M(0);break}f&&h(v+131072);var me=v+de;if(v<se){var he=l-se,ge=Math.min(se,me);for(he+v<0&&M(3);v<ge;++v)n[v]=i[he+v]}for(;v<me;++v)n[v]=n[v-se]}}t.l=b,t.p=ue,t.b=v,t.f=g,b&&(g=1,t.m=S,t.d=x,t.n=w)}while(!g);return v!=n.length&&u?A(n,0,v):n.subarray(0,v)},P=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},F=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ee=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return{t:z,l:0};if(o==1){var c=new r(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=o-1;)l=n[n[d].f<n[p].f?d++:p++],u=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};for(var m=s[0].s,a=1;a<o;++a)s[a].s>m&&(m=s[a].s);var h=new i(m+1),g=te(n[f-1],h,0);if(g>t){var a=0,_=0,v=g-t,y=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});a<o;++a){var b=s[a].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=s[a].s;h[x]<t?_-=1<<t-h[x]++-1:++a}for(;a>=0&&_;--a){var S=s[a].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new r(h),l:g}},te=function(e,t,n){return e.s==-1?Math.max(te(e.l,t,n+1),te(e.r,t,n+1)):t[e.s]=n},ne=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new i(++t),r=0,a=e[0],o=1,s=function(e){n[r++]=e},c=1;c<=t;++c)if(e[c]==a&&c!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[c]}return{c:n.subarray(0,r),n:t}},I=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},L=function(e,t,n){var r=n.length,i=k(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},re=function(e,t,n,r,a,l,u,d,f,p,m){P(t,m++,n),++a[256];for(var h=ee(a,15),g=h.t,_=h.l,v=ee(l,15),C=v.t,T=v.l,E=ne(g),D=E.c,O=E.n,k=ne(C),A=k.c,j=k.n,M=new i(19),N=0;N<D.length;++N)++M[D[N]&31];for(var N=0;N<A.length;++N)++M[A[N]&31];for(var te=ee(M,7),re=te.t,R=te.l,z=19;z>4&&!re[c[z-1]];--z);var ie=p+5<<3,B=I(a,b)+I(l,x)+u,V=I(a,g)+I(l,C)+u+14+3*z+I(M,re)+2*M[16]+3*M[17]+7*M[18];if(f>=0&&ie<=B&&ie<=V)return L(t,m,e.subarray(f,f+p));var ae,oe,H,se;if(P(t,m,1+(V<B)),m+=2,V<B){ae=y(g,_,0),oe=g,H=y(C,T,0),se=C;var ce=y(re,R,0);P(t,m,O-257),P(t,m+5,j-1),P(t,m+10,z-4),m+=14;for(var N=0;N<z;++N)P(t,m+3*N,re[c[N]]);m+=3*z;for(var le=[D,A],ue=0;ue<2;++ue)for(var U=le[ue],N=0;N<U.length;++N){var de=U[N]&31;P(t,m,ce[de]),m+=re[de],de>15&&(P(t,m,U[N]>>5&127),m+=U[N]>>12)}}else ae=S,oe=b,H=w,se=x;for(var N=0;N<d;++N){var fe=r[N];if(fe>255){var de=fe>>18&31;F(t,m,ae[de+257]),m+=oe[de+257],de>7&&(P(t,m,fe>>23&31),m+=o[de]);var W=fe&31;F(t,m,H[W]),m+=se[W],W>3&&(F(t,m,fe>>5&8191),m+=s[W])}else F(t,m,ae[fe]),m+=oe[fe]}return F(t,m,ae[256]),m+oe[256]},R=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),z=new r(0),ie=function(e,t,n,c,l,u){var d=u.z||e.length,p=new r(c+d+5*(1+Math.ceil(d/7e3))+l),m=p.subarray(c,p.length-l),g=u.l,_=(u.r||0)&7;if(t){_&&(m[0]=u.r>>3);for(var v=R[t-1],y=v>>13,b=v&8191,x=(1<<n)-1,S=u.p||new i(32768),C=u.h||new i(x+1),w=Math.ceil(n/3),T=2*w,E=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<T)&x},D=new a(25e3),O=new i(288),j=new i(32),M=0,N=0,P=u.i||0,F=0,ee=u.w||0,te=0;P+2<d;++P){var ne=E(P),I=P&32767,z=C[ne];if(S[I]=z,C[ne]=I,ee<=P){var ie=d-P;if((M>7e3||F>24576)&&(ie>423||!g)){_=re(e,m,0,D,O,j,N,F,te,P-te,_),F=M=N=0,te=P;for(var B=0;B<286;++B)O[B]=0;for(var B=0;B<30;++B)j[B]=0}var V=2,ae=0,oe=b,H=I-z&32767;if(ie>2&&ne==E(P-H))for(var se=Math.min(y,ie)-1,ce=Math.min(32767,P),le=Math.min(258,ie);H<=ce&&--oe&&I!=z;){if(e[P+V]==e[P+V-H]){for(var ue=0;ue<le&&e[P+ue]==e[P+ue-H];++ue);if(ue>V){if(V=ue,ae=H,ue>se)break;for(var U=Math.min(H,ue-2),de=0,B=0;B<U;++B){var fe=P-H+B&32767,W=fe-S[fe]&32767;W>de&&(de=W,z=fe)}}}I=z,z=S[I],H+=I-z&32767}if(ae){D[F++]=268435456|f[V]<<18|h[ae];var pe=f[V]&31,me=h[ae]&31;N+=o[pe]+s[me],++O[257+pe],++j[me],ee=P+V,++M}else D[F++]=e[P],++O[e[P]]}}for(P=Math.max(P,ee);P<d;++P)D[F++]=e[P],++O[e[P]];_=re(e,m,g,D,O,j,N,F,te,P-te,_),g||(u.r=_&7|m[_/8|0]<<3,_-=7,u.h=C,u.p=S,u.i=P,u.w=ee)}else{for(var P=u.w||0;P<d+g;P+=65535){var he=P+65535;he>=d&&(m[_/8|0]=g,he=d),_=L(m,_+1,e.subarray(P,he))}u.i=d}return A(p,0,c+k(_)+l)},B=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),V=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=B[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},ae=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},oe=function(e,t,n,i,a){if(!a&&(a={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,a.w=o.length}return ie(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,a)},H=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},se=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype){if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString()}else t+=l}else n[c]=s}return t},ce=[],le=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},ue=function(e,t,r,i){if(!ce[r]){for(var a=``,o={},s=e.length-1,c=0;c<s;++c)a=se(e[c],a,o);ce[r]={c:se(e[s],a,o),e:o}}var l=H({},ce[r].e);return(0,n.default)(ce[r].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,r,l,le(l),i)},U=function(){return[r,i,a,o,s,c,d,m,C,T,g,j,y,E,D,O,k,A,M,N,Le,he,ge]},de=function(){return[r,i,a,o,s,c,f,h,S,b,w,x,g,R,z,y,P,F,ee,te,ne,I,L,re,k,A,ie,oe,Ne,he]},fe=function(){return[Ce,Ee,Se,V,B]},W=function(){return[we,Te]},pe=function(){return[De,Se,ae]},me=function(){return[Oe]},he=function(e){return postMessage(e,[e.buffer])},ge=function(e){return e&&{out:e.size&&new r(e.size),dictionary:e.dictionary}},G=function(e,t,n,r,i,a){var o=ue(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},_e=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){t.data[0]?(e.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):e.flush(t.data[1])}},ve=function(e,t,n,r,i,a,o){var s,c=ue(e,r,i,function(e,n){e?(c.terminate(),t.ondata.call(t,e)):Array.isArray(n)?n.length==1?(t.queuedSize-=n[0],t.ondrain&&t.ondrain(n[0])):(n[1]&&c.terminate(),t.ondata.call(t,e,n[0],n[1])):o(n)});c.postMessage(n),t.queuedSize=0,t.push=function(e,n){t.ondata||M(5),s&&t.ondata(M(4,0,1),null,!!n),t.queuedSize+=e.length,c.postMessage([e,s=n],e.buffer instanceof ArrayBuffer?[e.buffer]:[])},t.terminate=function(){c.terminate()},a&&(t.flush=function(e){c.postMessage([0,e])})},ye=function(e,t){return e[t]|e[t+1]<<8},be=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},xe=function(e,t){return be(e,t)+be(e,t+4)*4294967296},Se=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Ce=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Se(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},we=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&M(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Te=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ee=function(e){return 10+(e.filename?e.filename.length+1:0)},De=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=ae();i.p(t.dictionary),Se(e,2,i.d())}},Oe=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&M(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&M(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function ke(e,t){return typeof e==`function`&&(t=e,e={}),this.ondata=t,e}var Ae=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(oe(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||M(5),this.s.l&&M(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var i=new r(n&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;this.b.set(e.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(a),32768),this.s.z=e.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2),t&&(this.s=this.o={},this.b=z)},e.prototype.flush=function(e){if(this.ondata||M(5),this.s.l&&M(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var t=new r(6);t[0]=this.s.r>>3;var n=L(t,this.s.r,z);this.s.r=0,this.ondata(t.subarray(0,n>>3),!1)}},e}();e.Deflate=Ae;var je=function(){function e(e,t){ve([de,function(){return[_e,Ae]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Ae(e.data))},6,1)}return e}();e.AsyncDeflate=je;function Me(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[de],function(e){return he(Ne(e.data[0],e.data[1]))},0,n)}function Ne(e,t){return oe(e,t||{},0,0)}var Pe=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new r(32768),this.p=new r(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||M(5),this.d&&M(4),!this.p.length)this.p=e;else if(e.length){var t=new r(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=N(this.p,this.s,this.o);this.ondata(A(n,t,this.s.b),this.d),this.o=A(n,this.s.b-32768),this.s.b=this.o.length,this.p=A(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();e.Inflate=Pe;var Fe=function(){function e(e,t){ve([U,function(){return[_e,Pe]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Pe(e.data))},7,0)}return e}();e.AsyncInflate=Fe;function Ie(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[U],function(e){return he(Le(e.data[0],ge(e.data[1])))},1,n)}function Le(e,t){return N(e,{i:2},t&&t.out,t&&t.dictionary)}var Re=function(){function e(e,t){this.c=V(),this.l=0,this.v=1,Ae.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,Ae.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=oe(e,this.o,this.v&&Ee(this.o),t&&8,this.s);this.v&&=(Ce(n,this.o),0),t&&(Se(n,n.length-8,this.c.d()),Se(n,n.length-4,this.l)),this.ondata(n,t)},e.prototype.flush=function(e){Ae.prototype.flush.call(this,e)},e}();e.Gzip=Re,e.Compress=Re;var ze=function(){function e(e,t){ve([de,fe,function(){return[_e,Ae,Re]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Re(e.data))},8,1)}return e}();e.AsyncGzip=ze,e.AsyncCompress=ze;function Be(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[de,fe,function(){return[Ve]}],function(e){return he(Ve(e.data[0],e.data[1]))},2,n)}function Ve(e,t){t||={};var n=V(),r=e.length;n.p(e);var i=oe(e,t,Ee(t),8),a=i.length;return Ce(i,t),Se(i,a-8,n.d()),Se(i,a-4,r),i}var He=function(){function e(e,t){this.v=1,this.r=0,Pe.call(this,e,t)}return e.prototype.push=function(e,t){if(Pe.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),i=n.length>3?we(n):4;if(i>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(i),this.v=0}Pe.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=k(this.s.p)+9,this.s={i:0},this.o=new r(0),this.push(new r(0),t)):t&&Pe.prototype.c.call(this,t)},e}();e.Gunzip=He;var Ue=function(){function e(e,t){var n=this;ve([U,W,function(){return[_e,Pe,He]}],this,ke.call(this,e,t),function(e){var t=new He(e.data);t.onmember=function(e){return postMessage(e)},onmessage=_e(t)},9,0,function(e){return n.onmember&&n.onmember(e)})}return e}();e.AsyncGunzip=Ue;function We(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[U,W,function(){return[Ge]}],function(e){return he(Ge(e.data[0],e.data[1]))},3,n)}function Ge(e,t){var n=we(e);return n+8>e.length&&M(6,`invalid gzip data`),N(e.subarray(n,-8),{i:2},t&&t.out||new r(Te(e)),t&&t.dictionary)}var Ke=function(){function e(e,t){this.c=ae(),this.v=1,Ae.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),Ae.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=oe(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&=(De(n,this.o),0),t&&Se(n,n.length-4,this.c.d()),this.ondata(n,t)},e.prototype.flush=function(e){Ae.prototype.flush.call(this,e)},e}();e.Zlib=Ke,e.AsyncZlib=function(){function e(e,t){ve([de,pe,function(){return[_e,Ae,Ke]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Ke(e.data))},10,1)}return e}();function qe(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[de,pe,function(){return[Je]}],function(e){return he(Je(e.data[0],e.data[1]))},4,n)}function Je(e,t){t||={};var n=ae();n.p(e);var r=oe(e,t,t.dictionary?6:2,4);return De(r,t),Se(r,r.length-4,n.d()),r}var Ye=function(){function e(e,t){Pe.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Pe.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(Oe(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&M(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),Pe.prototype.c.call(this,t)},e}();e.Unzlib=Ye;var Xe=function(){function e(e,t){ve([U,me,function(){return[_e,Pe,Ye]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Ye(e.data))},11,0)}return e}();e.AsyncUnzlib=Xe;function Ze(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[U,me,function(){return[Qe]}],function(e){return he(Qe(e.data[0],ge(e.data[1])))},5,n)}function Qe(e,t){return N(e.subarray(Oe(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var $e=function(){function e(e,t){this.o=ke.call(this,e,t)||{},this.G=He,this.I=Pe,this.Z=Ye}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n){e.ondata(t,n)}},e.prototype.push=function(e,t){if(this.ondata||M(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();e.Decompress=$e,e.AsyncDecompress=function(){function e(e,t){$e.call(this,e,t),this.queuedSize=0,this.G=Ue,this.I=Fe,this.Z=Xe}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n,r){e.ondata(t,n,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},e.prototype.push=function(e,t){this.queuedSize+=e.length,$e.prototype.push.call(this,e,t)},e}();function et(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),e[0]==31&&e[1]==139&&e[2]==8?We(e,t,n):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Ie(e,t,n):Ze(e,t,n)}function tt(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Ge(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Le(e,t):Qe(e,t)}var nt=function(e,t,n,i){for(var a in e){var o=e[a],s=t+a,c=i;Array.isArray(o)&&(c=H(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[s]=[o,c]:(n[s+=`/`]=[new r(0),c],nt(o,s,n,i))}},rt=typeof TextEncoder<`u`&&new TextEncoder,it=typeof TextDecoder<`u`&&new TextDecoder,at=0;try{it.decode(z,{stream:!0}),at=1}catch{}var ot=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:A(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};e.DecodeUTF8=function(){function e(e){this.ondata=e,at?this.t=new TextDecoder:this.p=z}return e.prototype.push=function(e,t){if(this.ondata||M(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&M(8),this.t=null);return}this.p||M(4);var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var i=ot(n),a=i.s,o=i.r;t?(o.length&&M(8),this.p=null):this.p=o,this.ondata(a,t)},e}(),e.EncodeUTF8=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){this.ondata||M(5),this.d&&M(4),this.ondata(st(e),this.d=t||!1)},e}();function st(e,t){if(t){for(var n=new r(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(rt)return rt.encode(e);for(var a=e.length,o=new r(e.length+(e.length>>1)),s=0,c=function(e){o[s++]=e},i=0;i<a;++i){if(s+5>o.length){var l=new r(s+8+(a-i<<1));l.set(o),o=l}var u=e.charCodeAt(i);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return A(o,0,s)}function ct(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(it)return it.decode(e);var i=ot(e),a=i.s,n=i.r;return n.length&&M(8),a}var lt=function(e){return e==1?3:e<6?2:+(e==9)},ut=function(e,t){return t+30+ye(e,t+26)+ye(e,t+28)},dt=function(e,t,n){var r=ye(e,t+28),i=ye(e,t+30),a=ct(e.subarray(t+46,t+46+r),!(ye(e,t+8)&2048)),o=t+46+r,s=ft(e,o,i,n,be(e,t+20),be(e,t+24),be(e,t+42)),c=s[0],l=s[1],u=s[2];return[ye(e,t+10),c,l,a,o+i+ye(e,t+32),u]},ft=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+ye(e,t+2))if(ye(e,t)==1)return[s?xe(e,t+4+8*c):i,c?xe(e,t+4):a,l?xe(e,t+4+8*(c+s)):o,1];r<2&&M(13)}return[i,a,o,0]},pt=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&M(9),t+=r+4}return t},mt=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=pt(l);Se(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&M(10),Se(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Se(e,t,n.crc),Se(e,t+4,a<0?-a-2:a),Se(e,t+8,n.size)),Se(e,t+12,c),Se(e,t+14,d),t+=16,o!=null&&(Se(e,t,u),Se(e,t+6,n.attrs),Se(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Se(e,t,+m),Se(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},ht=function(e,t,n,r,i){Se(e,t,101010256),Se(e,t+8,n),Se(e,t+10,n),Se(e,t+12,r),Se(e,t+16,i)},gt=function(){function e(e){this.filename=e,this.c=V(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||M(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();e.ZipPassThrough=gt,e.ZipDeflate=function(){function e(e,t){var n=this;t||={},gt.call(this,e),this.d=new Ae(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=lt(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){gt.prototype.push.call(this,e,t)},e}(),e.AsyncZipDeflate=function(){function e(e,t){var n=this;t||={},gt.call(this,e),this.d=new je(t,function(e,t,r){n.ondata(e,t,r)}),this.compression=8,this.flag=lt(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){gt.prototype.push.call(this,e,t)},e}(),e.Zip=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||M(5),this.d&2)this.ondata(M(4+(this.d&1)*8,0,1),null,!1);else{var n=st(e.filename),i=n.length,a=e.comment,o=a&&st(a),s=i!=e.filename.length||o&&a.length!=o.length,c=i+pt(e.extra)+30;i>65535&&this.ondata(M(11,0,1),null,!1);var l=new r(c);mt(l,0,e,n,s,-1);var u=[l],d=function(){for(var e=0,n=u;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}u=[]},f=this.d;this.d=0;var p=this.u.length,m=H(e,{f:n,u:s,o,t:function(){e.terminate&&e.terminate()},r:function(){if(d(),f){var e=t.u[p+1];e?e.r():t.d=1}f=1}}),h=0;e.ondata=function(n,i,a){if(n)t.ondata(n,i,a),t.terminate();else if(h+=i.length,u.push(i),a){var o=new r(16);Se(o,0,134695760),Se(o,4,e.crc),Se(o,8,h),Se(o,12,e.size),u.push(o),m.c=h,m.b=c+h+16,m.crc=e.crc,m.size=e.size,f&&m.r(),f=1}else f&&d()},this.u.push(m)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata(M(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,i=0,a=this.u;i<a.length;i++){var o=a[i];n+=46+o.f.length+pt(o.extra)+(o.o?o.o.length:0)}for(var s=new r(n+22),c=0,l=this.u;c<l.length;c++){var o=l[c];mt(s,e,o,o.f,o.u,-o.c-2,t,o.o),e+=46+o.f.length+pt(o.extra)+(o.o?o.o.length:0),t+=o.b}ht(s,e,this.u.length,n,t),this.ondata(null,s,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}();function _t(e,t,n){n||(n=t,t={}),typeof n!=`function`&&M(7);var i={};nt(e,``,i,t);var a=Object.keys(i),o=a.length,s=0,c=0,l=o,u=Array(o),d=[],f=function(){for(var e=0;e<d.length;++e)d[e]()},p=function(e,t){bt(function(){n(e,t)})};bt(function(){p=n});var m=function(){var e=new r(c+22),t=s,n=c-s;c=0;for(var i=0;i<l;++i){var a=u[i];try{var o=a.c.length;mt(e,c,a,a.f,a.u,o);var d=30+a.f.length+pt(a.extra),f=c+d;e.set(a.c,f),mt(e,s,a,a.f,a.u,o,c,a.m),s+=16+d+(a.m?a.m.length:0),c=f+o}catch(e){return p(e,null)}}ht(e,s,u.length,n,t),p(null,e)};o||m();for(var h=function(e){var t=a[e],n=i[t],r=n[0],l=n[1],h=V(),g=r.length;h.p(r);var _=st(t),v=_.length,y=l.comment,b=y&&st(y),x=b&&b.length,S=pt(l.extra),C=l.level==0?0:8,w=function(n,r){if(n)f(),p(n,null);else{var i=r.length;u[e]=H(l,{size:g,crc:h.d(),c:r,f:_,m:b,u:v!=t.length||b&&y.length!=x,compression:C}),s+=30+v+S+i,c+=76+2*(v+S)+(x||0)+i,--o||m()}};if(v>65535&&w(M(11,0,1),null),!C)w(null,r);else if(g<16e4)try{w(null,Ne(r,l))}catch(e){w(e,null)}else d.push(Me(r,l,w))},g=0;g<l;++g)h(g);return f}function vt(e,t){t||={};var n={},i=[];nt(e,``,n,t);var a=0,o=0;for(var s in n){var c=n[s],l=c[0],u=c[1],d=u.level==0?0:8,f=st(s),p=f.length,m=u.comment,h=m&&st(m),g=h&&h.length,_=pt(u.extra);p>65535&&M(11);var v=d?Ne(l,u):l,y=v.length,b=V();b.p(l),i.push(H(u,{size:l.length,crc:b.d(),c:v,f,m:h,u:p!=s.length||h&&m.length!=g,o:a,compression:d})),a+=30+p+_+y,o+=76+2*(p+_)+(g||0)+y}for(var x=new r(o+22),S=a,C=o-a,w=0;w<i.length;++w){var f=i[w];mt(x,f.o,f,f.f,f.u,f.c.length);var T=30+f.f.length+pt(f.extra);x.set(f.c,f.o+T),mt(x,a,f,f.f,f.u,f.c.length,f.o,f.m),a+=16+T+(f.m?f.m.length:0)}return ht(x,a,i.length,C,S),x}var yt=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();e.UnzipPassThrough=yt,e.UnzipInflate=function(){function e(){var e=this;this.i=new Pe(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),e.AsyncUnzipInflate=function(){function e(e,t){var n=this;t<32e4?this.i=new Pe(function(e,t){n.ondata(null,e,t)}):(this.i=new Fe(function(e,t,r){n.ondata(e,t,r)}),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=A(e,0)),this.i.push(e,t)},e.compression=8,e}(),e.Unzip=function(){function e(e){this.onfile=e,this.k=[],this.o={0:yt},this.p=z}return e.prototype.push=function(e,t){var n=this;if(this.onfile||M(5),this.p||M(4),this.c>0){var i=Math.min(this.c,e.length),a=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(a,!this.c):this.k[0].push(a),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,s=0,c=void 0,l=void 0;this.p.length?e.length?(l=new r(this.p.length+e.length),l.set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,d=this.c,f=d&&this.d,p=function(){var e=be(l,s);if(e==67324752){o=1,c=s,m.d=null,m.c=0;var t=ye(l,s+6),r=ye(l,s+8),i=t&2048,a=t&8,f=ye(l,s+26),p=ye(l,s+28);if(u>s+30+f+p){var h=[];m.k.unshift(h),o=2;var g=be(l,s+18),_=be(l,s+22),v=ct(l.subarray(s+30,s+=30+f),!i),y=ft(l,s,p,2,g,_,0),b=y[0],x=y[1],S=y[3];a&&(b=-1-S),s+=p,m.c=b;var C,w={name:v,compression:r,start:function(){if(w.ondata||M(5),!b)w.ondata(null,z,!0);else{var e=n.o[r];e||w.ondata(M(14,`unknown compression type `+r,1),null,!1),C=b<0?new e(v):new e(v,b,x),C.ondata=function(e,t,n){w.ondata(e,t,n)};for(var t=0,i=h;t<i.length;t++){var a=i[t];C.push(a,!1)}n.k[0]==h&&n.c?n.d=C:C.push(z,!0)}},terminate:function(){C&&C.terminate&&C.terminate()}};b>=0&&(w.size=b,w.originalSize=x),m.onfile(w)}return`break`}if(d){if(e==134695760)return c=s+=12+(d==-2&&8),o=3,m.c=0,`break`;if(e==33639248)return c=s-=4,o=3,m.c=0,`break`}},m=this;s<u-4&&p()!==`break`;++s);if(this.p=z,d<0){var h=o?l.subarray(0,c-12-(d==-2&&8)-(be(l,c-16)==134695760&&4)):l.subarray(0,s);f?f.push(h,!!o):this.k[+(o==2)].push(h)}if(o&2)return this.push(l.subarray(s),t);this.p=l.subarray(s)}t&&(this.c&&M(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}();var bt=typeof queueMicrotask==`function`?queueMicrotask:typeof setTimeout==`function`?setTimeout:function(e){e()};function xt(e,t,n){n||(n=t,t={}),typeof n!=`function`&&M(7);var i=[],a=function(){for(var e=0;e<i.length;++e)i[e]()},o={},s=function(e,t){bt(function(){n(e,t)})};bt(function(){s=n});for(var c=e.length-22;be(e,c)!=101010256;--c)if(!c||e.length-c>65558)return s(M(13,0,1),null),a;var l=ye(e,c+8);if(l){var u=l,d=be(e,c+16),f=be(e,c-20)==117853008;if(f){var p=be(e,c-12);f=be(e,p)==101075792,f&&(u=l=be(e,p+32),d=be(e,p+48))}for(var m=t&&t.filter,h=function(t){var n=dt(e,d,f),c=n[0],u=n[1],p=n[2],h=n[3],g=n[4],_=n[5],v=ut(e,_);d=g;var y=function(e,t){e?(a(),s(e,null)):(t&&(o[h]=t),--l||s(null,o))};if(!m||m({name:h,size:u,originalSize:p,compression:c})){if(!c)y(null,A(e,v,v+u));else if(c==8){var b=e.subarray(v,v+u);if(p<524288||u>.8*p)try{y(null,Le(b,{out:new r(p)}))}catch(e){y(e,null)}else i.push(Ie(b,{size:p},y))}else y(M(14,`unknown compression type `+c,1),null)}else y(null,null)},g=0;g<u;++g)h(g)}else s(null,{});return a}function St(e,t){for(var n={},i=e.length-22;be(e,i)!=101010256;--i)(!i||e.length-i>65558)&&M(13);var a=ye(e,i+8);if(!a)return{};var o=be(e,i+16),s=be(e,i-20)==117853008;if(s){var c=be(e,i-12);s=be(e,c)==101075792,s&&(a=be(e,c+32),o=be(e,c+48))}for(var l=t&&t.filter,u=0;u<a;++u){var d=dt(e,o,s),f=d[0],p=d[1],m=d[2],h=d[3],g=d[4],_=d[5],v=ut(e,_);o=g,(!l||l({name:h,size:p,originalSize:m,compression:f}))&&(f?f==8?n[h]=Le(e.subarray(v,v+p),{out:new r(m)}):M(14,`unknown compression type `+f):n[h]=A(e,v,v+p))}return n}})),jP=g(p(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t<`u`?t.exports=r((dN(),_(pv)),(FN(),_(fN)),RN(),(kP(),_(zN)),AP()):typeof define==`function`&&define.amd?define([`three`,`three-spritetext`,`css-element-queries`,`three/examples/jsm/loaders/GLTFLoader`,`fflate`],r):(n=typeof globalThis<`u`?globalThis:n||self,n.Zinc=r(n.THREE,n.SpriteText,n.cssElememtQueries,n.GLTFLoader,n.fflate))})(e,function(e,t,n,r,i){var a=Object.create,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=c(t),a=0,l=i.length,d;a<l;a++)d=i[a],!u.call(e,d)&&d!==n&&o(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=s(t,d))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:a(l(e)),d(t||!e||!e.__esModule||!u.call(e,`default`)?o(n,`default`,{value:e,enumerable:!0}):n,e));e=f(e,1),t=f(t,1);var p={name:`zincjs`,version:`2.2.0`,description:`ZincJS (Web-based-Zinc-Visualisation)`,type:`module`,main:`build/zinc.js`,directories:{doc:`docs`},files:[`package.json`,`LICENSE`,`README.md`,`src/*`,`build/zinc.js`,`build/zinc.js.map`,`vite.config.js`],scripts:{"build-bundle":`vite build`,"test-watch":`vitest`,test:`vitest run --reporter=junit --outputFile=test-results.xml`,"test-standard":`vitest run`,changelog:`auto-changelog -p --output CHANGELOG.md --template keepachangelog`,jsdoc:`jsdoc -c jsdoc_conf.json`,version:`npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs`,"release:beta":`npm version prerelease --preid=beta; npm publish --tag beta`,"release:major":`npm version major; npm publish`,"release:minor":`npm version minor; npm publish`,"release:patch":`npm version patch; npm publish`},repository:{type:`git`,url:`git+https://github.com/alan-wu/ZincJS.git`},keywords:[`library`,`webgl`,`3d`,`zincjs`],author:`Alan Wu <alan.wu@auckland.ac.nz>`,license:`MIT`,bugs:{url:`https://github.com/alan-wu/ZincJS/issues`},homepage:`http://alan-wu.github.io/ZincJS/`,engines:{node:`>=20`},devDependencies:{"@vitest/coverage-v8":`^4.1.11`,"auto-changelog":`^2.4.0`,chai:`^4.1.0`,gl:`^8.1.6`,"happy-dom":`^20.10.6`,jsdoc:`^4.0.2`,msw:`^2.14.6`,vite:`^8.2.1`,"vite-plugin-node-polyfills":`^0.28.0`,vitest:`^4.1.11`},dependencies:{"css-element-queries":`^1.2.2`,lodash:`^4.17.19`,"nifti-reader-js":`0.8.0`,three:`^0.130.1`,"three-spritetext":`1.6.2`}},m=new e.Matrix4,h=new e.Object3D,g=new e.Vector3,_=new e.Vector3;function v(){this.uuid=e.MathUtils.generateUUID(),this.name=``,this.type=`Geometry`,this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1,this.morphNormalsReady=!1}v.prototype=Object.assign(Object.create(e.EventDispatcher.prototype),{constructor:v,isGeometry:!0,applyMatrix4:function(t){let n=new e.Matrix3().getNormalMatrix(t);for(let e=0,n=this.vertices.length;e<n;e++)this.vertices[e].applyMatrix4(t);for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.normal.applyMatrix3(n).normalize();for(let e=0,r=t.vertexNormals.length;e<r;e++)t.vertexNormals[e].applyMatrix3(n).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return m.makeRotationX(e),this.applyMatrix4(m),this},rotateY:function(e){return m.makeRotationY(e),this.applyMatrix4(m),this},rotateZ:function(e){return m.makeRotationZ(e),this.applyMatrix4(m),this},translate:function(e,t,n){return m.makeTranslation(e,t,n),this.applyMatrix4(m),this},scale:function(e,t,n){return m.makeScale(e,t,n),this.applyMatrix4(m),this},lookAt:function(e){return h.lookAt(e),h.updateMatrix(),this.applyMatrix4(h.matrix),this},fromBufferGeometry:function(t){let n=this,r=t.index===null?void 0:t.index,i=t.attributes;if(i.position===void 0)return console.error(`THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.`),this;let a=i.position,o=i.normal,s=i.color,c=i.uv,l=i.uv2;l!==void 0&&(this.faceVertexUvs[1]=[]);for(let t=0;t<a.count;t++)n.vertices.push(new e.Vector3().fromBufferAttribute(a,t)),s!==void 0&&n.colors.push(new e.Color().fromBufferAttribute(s,t));function u(t,r,i,a){let u=s===void 0?[]:[n.colors[t].clone(),n.colors[r].clone(),n.colors[i].clone()],d=new b(t,r,i,o===void 0?[]:[new e.Vector3().fromBufferAttribute(o,t),new e.Vector3().fromBufferAttribute(o,r),new e.Vector3().fromBufferAttribute(o,i)],u,a);n.faces.push(d),c!==void 0&&n.faceVertexUvs[0].push([new e.Vector2().fromBufferAttribute(c,t),new e.Vector2().fromBufferAttribute(c,r),new e.Vector2().fromBufferAttribute(c,i)]),l!==void 0&&n.faceVertexUvs[1].push([new e.Vector2().fromBufferAttribute(l,t),new e.Vector2().fromBufferAttribute(l,r),new e.Vector2().fromBufferAttribute(l,i)])}let d=t.groups;if(d.length>0)for(let e=0;e<d.length;e++){let t=d[e],n=t.start,i=t.count;for(let e=n,a=n+i;e<a;e+=3)r===void 0?u(e,e+1,e+2,t.materialIndex):u(r.getX(e),r.getX(e+1),r.getX(e+2),t.materialIndex)}else if(r!==void 0)for(let e=0;e<r.count;e+=3)u(r.getX(e),r.getX(e+1),r.getX(e+2));else for(let e=0;e<a.count;e+=3)u(e,e+1,e+2);return this.computeFaceNormals(),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(g).negate(),this.translate(g.x,g.y,g.z),this},normalize:function(){this.computeBoundingSphere();let t=this.boundingSphere.center,n=this.boundingSphere.radius,r=n===0?1:1/n,i=new e.Matrix4;return i.set(r,0,0,-r*t.x,0,r,0,-r*t.y,0,0,r,-r*t.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){let t=new e.Vector3,n=new e.Vector3;for(let e=0,r=this.faces.length;e<r;e++){let r=this.faces[e],i=this.vertices[r.a],a=this.vertices[r.b],o=this.vertices[r.c];t.subVectors(o,a),n.subVectors(i,a),t.cross(n),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t=!0){let n=Array(this.vertices.length);for(let t=0,r=this.vertices.length;t<r;t++)n[t]=new e.Vector3;if(t){let t=new e.Vector3,r=new e.Vector3;for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];t.subVectors(s,o),r.subVectors(a,o),t.cross(r),n[i.a].add(t),n[i.b].add(t),n[i.c].add(t)}}else{this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];n[t.a].add(t.normal),n[t.b].add(t.normal),n[t.c].add(t.normal)}}for(let e=0,t=this.vertices.length;e<t;e++)n[e].normalize();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],r=t.vertexNormals;r.length===3?(r[0].copy(n[t.a]),r[1].copy(n[t.b]),r[2].copy(n[t.c])):(r[0]=n[t.a].clone(),r[1]=n[t.b].clone(),r[2]=n[t.c].clone())}return this.faces.length>0&&(this.normalsNeedUpdate=!0),n},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],n=t.vertexNormals;n.length===3?(n[0].copy(t.normal),n[1].copy(t.normal),n[2].copy(t.normal)):(n[0]=t.normal.clone(),n[1]=t.normal.clone(),n[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||=[];for(let e=0,n=t.vertexNormals.length;e<n;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}let t=new v;t.faces=this.faces;for(let n=0,r=this.morphTargets.length;n<r;n++){if(!this.morphNormals[n]){this.morphNormals[n]={},this.morphNormals[n].faceNormals=[],this.morphNormals[n].vertexNormals=[];let t=this.morphNormals[n].faceNormals,r=this.morphNormals[n].vertexNormals;for(let n=0,i=this.faces.length;n<i;n++){let n=new e.Vector3,i={a:new e.Vector3,b:new e.Vector3,c:new e.Vector3};t.push(n),r.push(i)}}let r=this.morphNormals[n];t.vertices=this.morphTargets[n].vertices,t.computeFaceNormals();let i=t.computeVertexNormals();if(i&&i.length>0){this.morphTargets[n].normals=Array(this.vertices.length);for(let e=0;e<i.length;e++)this.morphTargets[n].normals[e]=i[e].clone()}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],n=r.faceNormals[e],i=r.vertexNormals[e];n.copy(t.normal),i.a.copy(t.vertexNormals[0]),i.b.copy(t.vertexNormals[1]),i.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new e.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new e.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(e,t){let n=this.morphTargets.length,r=this.morphTargets,i=e.morphTargets,a=this.morphColors.length,o=this.morphColors,s=e.morphColors;if(n>0&&n==i.length)for(let e=0,n=r.length;e<n;e++){let n=r[e],a=i[e];for(let e=0,r=a.vertices.length;e<r;e++){let r=a.vertices[e].clone();t!==void 0&&r.applyMatrix4(t),n.vertices.push(r)}if(n.normals&&a.normals)for(let e=0;e<a.normals.length;e+=3)_.set(a.normals2[e],a.normals2[e+1],a.normals2[e+2]),t!==void 0&&_.applyMatrix4(t),n.normals.push(_.x,_.y,_.z)}if(a>0&&a==s.length)for(let e=0,t=o.length;e<t;e++){let t=o[e],n=s[e];for(let e=0,r=n.colors;e<r;e++)t.colors.push(n.colors[e].clone())}},merge:function(t,n,r=0){if(!(t&&t.isGeometry)){console.error(`THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.`,t);return}let i,a=this.vertices.length,o=this.vertices,s=t.vertices,c=t.normals,l=this.faces,u=t.faces,d=this.colors,f=t.colors;n!==void 0&&(i=new e.Matrix3().getNormalMatrix(n));for(let e=0,t=s.length;e<t;e++){let t=s[e].clone();n!==void 0&&t.applyMatrix4(n),o.push(t)}for(let e=0;e<c.length;e+=3)_.set(c[e],c[e+1],c[e+2]),n!==void 0&&_.applyMatrix4(n),this.normals.push(_.x,_.y,_.z);for(let e=0,t=f.length;e<t;e++)typeof f[e]==`number`?d.push(f[e]):d.push(f[e].clone());for(let e=0,t=u.length;e<t;e++){let t=u[e],n,o,s=t.vertexNormals,c=t.vertexColors,d=new b(t.a+a,t.b+a,t.c+a);d.normal.copy(t.normal),i!==void 0&&d.normal.applyMatrix3(i).normalize();for(let e=0,t=s.length;e<t;e++)n=s[e].clone(),i!==void 0&&n.applyMatrix3(i).normalize(),d.vertexNormals.push(n);d.color.copy(t.color);for(let e=0,t=c.length;e<t;e++)o=c[e],d.vertexColors.push(o.clone());d.materialIndex=t.materialIndex+r,l.push(d)}for(let e=0,n=t.faceVertexUvs.length;e<n;e++){let n=t.faceVertexUvs[e];this.faceVertexUvs[e]===void 0&&(this.faceVertexUvs[e]=[]);for(let t=0,r=n.length;t<r;t++){let r=n[t],i=[];for(let e=0,t=r.length;e<t;e++)i.push(r[e].clone());this.faceVertexUvs[e].push(i)}}this.mergeMorph(t,n)},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error(`THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.`,e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(e=4){let t={},n=[],r=[],i=10**e;for(let e=0,a=this.vertices.length;e<a;e++){let a=this.vertices[e],o=Math.round(a.x*i)+`_`+Math.round(a.y*i)+`_`+Math.round(a.z*i);t[o]===void 0?(t[o]=e,n.push(this.vertices[e]),r[e]=n.length-1):r[e]=r[t[o]]}let a=[];for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.a=r[t.a],t.b=r[t.b],t.c=r[t.c];let n=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(n[t]===n[(t+1)%3]){a.push(e);break}}for(let e=a.length-1;e>=0;e--){let t=a[e];this.faces.splice(t,1);for(let e=0,n=this.faceVertexUvs.length;e<n;e++)this.faceVertexUvs[e].splice(t,1)}let o=this.vertices.length-n.length;return this.vertices=n,o},setFromPoints:function(t){this.vertices=[];for(let n=0,r=t.length;n<r;n++){let r=t[n];this.vertices.push(new e.Vector3(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){let e=this.faces,t=e.length;for(let n=0;n<t;n++)e[n]._id=n;function n(e,t){return e.materialIndex-t.materialIndex}e.sort(n);let r=this.faceVertexUvs[0],i=this.faceVertexUvs[1],a,o;r&&r.length===t&&(a=[]),i&&i.length===t&&(o=[]);for(let n=0;n<t;n++){let t=e[n]._id;a&&a.push(r[t]),o&&o.push(i[t])}a&&(this.faceVertexUvs[0]=a),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){let e={metadata:{version:4.5,type:`Geometry`,generator:`Geometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}let t=[];for(let e=0;e<this.vertices.length;e++){let n=this.vertices[e];t.push(n.x,n.y,n.z)}let n=[],r=[],i={},a=[],o={},s=[],c={};for(let e=0;e<this.faces.length;e++){let t=this.faces[e],r=this.faceVertexUvs[0][e]!==void 0,i=t.normal.length()>0,a=t.vertexNormals.length>0,o=t.color.r!==1||t.color.g!==1||t.color.b!==1,s=t.vertexColors.length>0,c=0;if(c=l(c,0,0),c=l(c,1,!0),c=l(c,2,!1),c=l(c,3,r),c=l(c,4,i),c=l(c,5,a),c=l(c,6,o),c=l(c,7,s),n.push(c),n.push(t.a,t.b,t.c),n.push(t.materialIndex),r){let t=this.faceVertexUvs[0][e];n.push(f(t[0]),f(t[1]),f(t[2]))}if(i&&n.push(u(t.normal)),a){let e=t.vertexNormals;n.push(u(e[0]),u(e[1]),u(e[2]))}if(o&&n.push(d(t.color)),s){let e=t.vertexColors;n.push(d(e[0]),d(e[1]),d(e[2]))}}function l(e,t,n){return n?e|1<<t:e&~(1<<t)}function u(e){let t=e.x.toString()+e.y.toString()+e.z.toString();return i[t]===void 0?(i[t]=r.length/3,r.push(e.x,e.y,e.z),i[t]):i[t]}function d(e){let t=e.r.toString()+e.g.toString()+e.b.toString();return o[t]===void 0?(o[t]=a.length,a.push(e.getHex()),o[t]):o[t]}function f(e){let t=e.x.toString()+e.y.toString();return c[t]===void 0?(c[t]=s.length/2,s.push(e.x,e.y),c[t]):c[t]}return e.data={},e.data.vertices=t,e.data.normals=r,a.length>0&&(e.data.colors=a),s.length>0&&(e.data.uvs=[s]),e.data.faces=n,e},clone:function(){return new v().copy(this)},copy:function(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let e=0,n=t.length;e<n;e++)this.vertices.push(t[e].clone());let n=e.colors;for(let e=0,t=n.length;e<t;e++)this.colors.push(n[e].clone());let r=e.faces;for(let e=0,t=r.length;e<t;e++)this.faces.push(r[e].clone());for(let t=0,n=e.faceVertexUvs.length;t<n;t++){let n=e.faceVertexUvs[t];this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]);for(let e=0,r=n.length;e<r;e++){let r=n[e],i=[];for(let e=0,t=r.length;e<t;e++){let t=r[e];i.push(t.clone())}this.faceVertexUvs[t].push(i)}}let i=e.morphTargets;for(let e=0,t=i.length;e<t;e++){let t={};if(t.name=i[e].name,i[e].vertices!==void 0){t.vertices=[];for(let n=0,r=i[e].vertices.length;n<r;n++)t.vertices.push(i[e].vertices[n].clone())}if(i[e].normals!==void 0){t.normals=[];for(let n=0,r=i[e].normals.length;n<r;n++)t.normals.push(i[e].normals[n].clone())}this.morphTargets.push(t)}let a=e.morphNormals;for(let e=0,t=a.length;e<t;e++){let t={};if(a[e].vertexNormals!==void 0){t.vertexNormals=[];for(let n=0,r=a[e].vertexNormals.length;n<r;n++){let r=a[e].vertexNormals[n],i={};i.a=r.a.clone(),i.b=r.b.clone(),i.c=r.c.clone(),t.vertexNormals.push(i)}}if(a[e].faceNormals!==void 0){t.faceNormals=[];for(let n=0,r=a[e].faceNormals.length;n<r;n++)t.faceNormals.push(a[e].faceNormals[n].clone())}this.morphNormals.push(t)}let o=e.skinWeights;for(let e=0,t=o.length;e<t;e++)this.skinWeights.push(o[e].clone());let s=e.skinIndices;for(let e=0,t=s.length;e<t;e++)this.skinIndices.push(s[e].clone());let c=e.lineDistances;for(let e=0,t=c.length;e<t;e++)this.lineDistances.push(c[e]);let l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());let u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},computeGroups(){let e=[],t,n,r,i=this.faces;for(n=0;n<i.length;n++){let a=i[n];a.materialIndex!==r&&(r=a.materialIndex,t!==void 0&&(t.count=n*3-t.start,e.push(t)),t={start:n*3,materialIndex:r})}return t!==void 0&&(t.count=n*3-t.start,e.push(t)),e},toBufferGeometry:function(){let t=new y().fromGeometry(this),n=new e.BufferGeometry,r=new Float32Array(t.vertices.length*3);if(n.setAttribute(`position`,new e.BufferAttribute(r,3).copyVector3sArray(t.vertices)),t.normals.length>0){let r=new Float32Array(t.normals.length*3);n.setAttribute(`normal`,new e.BufferAttribute(r,3).copyVector3sArray(t.normals))}if(t.colors.length>0){let r=new Float32Array(t.colors.length*3);n.setAttribute(`color`,new e.BufferAttribute(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){let r=new Float32Array(t.uvs.length*2);n.setAttribute(`uv`,new e.BufferAttribute(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){let r=new Float32Array(t.uvs2.length*2);n.setAttribute(`uv2`,new e.BufferAttribute(r,2).copyVector2sArray(t.uvs2))}n.groups=t.groups;for(let r in t.morphTargets){let i=[],a=t.morphTargets[r];for(let t=0,n=a.length;t<n;t++){let n=a[t],r=new e.Float32BufferAttribute(n.data.length*3,3);r.name=n.name,i.push(r.copyVector3sArray(n.data))}n.morphAttributes[r]=i}if(t.skinIndices.length>0){let r=new e.Float32BufferAttribute(t.skinIndices.length*4,4);n.setAttribute(`skinIndex`,r.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){let r=new e.Float32BufferAttribute(t.skinWeights.length*4,4);n.setAttribute(`skinWeight`,r.copyVector4sArray(t.skinWeights))}return t.boundingSphere!==null&&(n.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(n.boundingBox=t.boundingBox.clone()),n},toIndexedBufferGeometry:function(){let t=new e.BufferGeometry,n=new Float32Array(this.vertices.length*3);if(t.setAttribute(`position`,new e.BufferAttribute(n,3).copyVector3sArray(this.vertices)),this.normals.length>0){let n=new Float32Array(this.normals.length),r=new e.BufferAttribute(n,3).copyArray(this.normals);t.setAttribute(`normal`,r)}if(this.uvs.length>0&&this.uvs[0].length>0){let n=new Float32Array(this.uvs[0].length*2);t.setAttribute(`uv`,new e.BufferAttribute(n,2).copyArray(this.uvs[0]))}if(this.uvs.length>1&&this.uvs[1].length>0){let n=new Float32Array(this.uvs[1].length*2);t.setAttribute(`uv2`,new e.BufferAttribute(n,2).copyArray(this.uvs[1]))}if(this.colors.length>0){let n=[];for(let t=0;t<this.colors.length;t++)n.push(new e.Color(this.colors[t]));let r=new Float32Array(n.length*3);t.setAttribute(`color`,new e.BufferAttribute(r,3).copyColorsArray(n))}else{let n=new Float32Array(this.vertices.length*3);for(let e=0;e<this.vertices.length*3;e++)n[e]=1;t.setAttribute(`color`,new e.BufferAttribute(n,3))}if(this.faces.length>0){let e=[],n=[];for(let t=0;t<this.faces.length;t++){n.push(this.faces[t].a,this.faces[t].b,this.faces[t].c);let r=this.faces[t].vertexColors;if(r.length===3)e.push(r[0],r[1],r[2]);else{let n=this.faces[t].color;e.push(n,n,n)}}t.setIndex(n),t.groups=this.computeGroups()}if(this.morphTargets.length>0){let n=[],r=[];for(let t=0,i=this.morphTargets.length;t<i;t++){let i=this.morphTargets[t],a=new e.Float32BufferAttribute(i.vertices.length*3,3);if(a.name=i.name,n.push(a.copyVector3sArray(i.vertices)),i.normals){let t=new e.Float32BufferAttribute(i.normals.length*3,3);t.name=i.name,r.push(t.copyVector3sArray(i.normals))}}t.morphAttributes.position=n,t.morphAttributes.normal=r}if(this.skinIndices.length>0){let n=new e.Float32BufferAttribute(this.skinIndices.length*4,4);t.setAttribute(`skinIndex`,n.copyVector4sArray(this.skinIndices))}if(this.skinWeights.length>0){let n=new e.Float32BufferAttribute(this.skinWeights.length*4,4);t.setAttribute(`skinWeight`,n.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(t.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(t.boundingBox=this.boundingBox.clone()),t},computeTangents:function(){console.error(`THREE.Geometry: .computeTangents() has been removed.`)},computeLineDistances:function(){console.error(`THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.`)},applyMatrix:function(e){return console.warn(`THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)},dispose:function(){this.dispatchEvent({type:`dispose`})}}),v.createBufferGeometryFromObject=function(t){let n=new e.BufferGeometry,r=t.geometry;if(t.isPoints||t.isLine){let t=new e.Float32BufferAttribute(r.vertices.length*3,3),i=new e.Float32BufferAttribute(r.colors.length*3,3);if(n.setAttribute(`position`,t.copyVector3sArray(r.vertices)),n.setAttribute(`color`,i.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let t=new e.Float32BufferAttribute(r.lineDistances.length,1);n.setAttribute(`lineDistance`,t.copyArray(r.lineDistances))}r.boundingSphere!==null&&(n.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(n.boundingBox=r.boundingBox.clone())}else t.isMesh&&(n=r.toBufferGeometry());return n};var y=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],n,r,i,a=e.faces;for(r=0;r<a.length;r++){let e=a[r];e.materialIndex!==i&&(i=e.materialIndex,n!==void 0&&(n.count=r*3-n.start,t.push(n)),n={start:r*3,materialIndex:i})}n!==void 0&&(n.count=r*3-n.start,t.push(n)),this.groups=t}fromGeometry(t){let n=t.faces,r=t.vertices,i=t.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=t.morphTargets,c=s.length,l;if(c>0){l=[];for(let e=0;e<c;e++)l[e]={name:s[e].name,data:[]};this.morphTargets.position=l}let u=t.morphNormals,d=u.length,f;if(d>0){f=[];for(let e=0;e<d;e++)f[e]={name:u[e].name,data:[]};this.morphTargets.normal=f}let p=t.skinIndices,m=t.skinWeights,h=p.length===r.length,g=m.length===r.length;r.length>0&&n.length===0&&console.error(`THREE.DirectGeometry: Faceless geometries are not supported.`);for(let t=0;t<n.length;t++){let _=n[t];this.vertices.push(r[_.a],r[_.b],r[_.c]);let v=_.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{let e=_.normal;this.normals.push(e,e,e)}let y=_.vertexColors;if(y.length===3)this.colors.push(y[0],y[1],y[2]);else{let e=_.color;this.colors.push(e,e,e)}if(a===!0){let n=i[0][t];n===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv `,t),this.uvs.push(new e.Vector2,new e.Vector2,new e.Vector2)):this.uvs.push(n[0],n[1],n[2])}if(o===!0){let n=i[1][t];n===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 `,t),this.uvs2.push(new e.Vector2,new e.Vector2,new e.Vector2)):this.uvs2.push(n[0],n[1],n[2])}for(let e=0;e<c;e++){let t=s[e].vertices;l[e].data.push(t[_.a],t[_.b],t[_.c])}for(let e=0;e<d;e++){let n=u[e].vertexNormals[t];f[e].data.push(n.a,n.b,n.c)}h&&this.skinIndices.push(p[_.a],p[_.b],p[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),this}},b=class{constructor(t,n,r,i,a,o=0){this.a=t,this.b=n,this.c=r,this.normal=i&&i.isVector3?i:new e.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=a&&a.isColor?a:new e.Color,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},x=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`,S=t.default.default||t.default;function C(e,t){let n=(e,t)=>{try{let n=new URL(e,t).href;if(e&&e.split(`?`).length<2){let e=t.split(`?`);e.length===2&&(n=n+`?`+e[1])}return n}catch{console.error(`There is an issue creating the url link with: ${e}.`)}};if(Array.isArray(e)){let r=[];return e.forEach(e=>{r.push(n(e,t))}),r}return n(e,t)}function w(e,t,n,r,i){let a=e.morphTargetInfluences,o;e.geometry&&(o=e.geometry.morphAttributes);let s=!1;if(a&&o&&o.position){r.set(0,0,0),i.set(0,0,0);for(let e=0;e<a.length;e++)a[e]>0&&(s=!0,n.setFromArray(o.position[e].array),r.add(n.min.multiplyScalar(a[e])),i.add(n.max.multiplyScalar(a[e])));s&&t.set(r,i)}s||t.setFromBufferAttribute(e.geometry.attributes.position),e.updateWorldMatrix(!0,!0),t.applyMatrix4(e.matrixWorld)}function T(e,t,n,r){fetch(e).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>{n(e,t)}).catch(t=>{console.error(`Fetch string payload retrieval failed for: ${requestURL}`,t),r(e)})}function E(e,t,n){let r=e.length,i=0,a=[];function o(e,n){a[n]=e,i++,i==r&&t(a)}for(let t=0;t<r;t++)T(e[t],t,o,n)}var D=(t,n)=>{let r=Math.floor(n/3),i=n%3,a=0;i==0?a=t[r].r:i==1?a=t[r].g:i==2&&(a=t[r].b);let o=new e.Color(a);return[o.r,o.g,o.b]},O=function(e,t){if(t&&e&&e.morphAttributes&&e.morphAttributes.color){let n=e.morphAttributes.color,r=t.morphTargetInfluences,i=r.length;e.deleteAttribute(`morphColor0`),e.deleteAttribute(`morphColor1`);let a=0,o=[];for(let e=0;1>a||e<i;e++)r[e]>0&&(a++,o.push([e,r[e]]));o.length==2?(e.setAttribute(`morphColor0`,n[o[0][0]]),e.setAttribute(`morphColor1`,n[o[1][0]])):o.length==1&&(e.setAttribute(`morphColor0`,n[o[0][0]]),e.setAttribute(`morphColor1`,n[o[0][0]]))}},k=(t,n)=>{let r;return t instanceof v?(n.localTimeEnabled&&!t.morphNormalsReady&&(t.morphNormals==null||t.morphNormals.length==0)&&t.computeMorphNormals(),r=t.toIndexedBufferGeometry(),n.localMorphColour&&A(t,r)):t instanceof e.BufferGeometry&&(r=t.clone()),r.colorsNeedUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),t._video&&(r._video=t._video),r},A=(t,n)=>{if(t&&t.morphColors&&t.morphColors.length>0){let r=[],i=t.morphColors;for(let t=0,n=i.length;t<n;t++){let n=i[t],a=[];for(let e=0;e<n.colors.length*3;e++){let t=D(n.colors,e);a.push(t[0],t[1],t[2])}let o=new e.Float32BufferAttribute(a,3);o.name=n.name,r.push(o)}n.morphAttributes.color=r}};function j(t){let n,r,i,a=-1,o=0;for(let e=0;e<t.length;++e){let s=t[e];if(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(r===void 0&&(r=s.itemSize),r!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(a===-1&&(a=s.gpuType),a!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;o+=s.count*r}let s=new n(o),c=new e.BufferAttribute(s,r,i),l=0;for(let e=0;e<t.length;++e){let n=t[e];if(n.isInterleavedBufferAttribute){let e=l/r;for(let t=0,i=n.count;t<i;t++)for(let i=0;i<r;i++){let r=n.getComponent(t,i);c.setComponent(t+e,i,r)}}else s.set(n.array,l);l+=n.count*r}return a!==void 0&&(c.gpuType=a),c}var M=(t,n=!1)=>{let r=t[0].index!==null,i=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),o={},s={},c=t[0].morphTargetsRelative,l=new e.BufferGeometry,u=0;for(let e=0;e<t.length;++e){let d=t[e],f=0;if(r!==(d.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let t in d.attributes){if(!i.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure "`+t+`" attribute exists among all geometries, or in none of them.`),null;o[t]===void 0&&(o[t]=[]),o[t].push(d.attributes[t]),f++}if(f!==i.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. Make sure all geometries have the same number of attributes.`),null;if(c!==d.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let t in d.morphAttributes){if(!a.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphAttributes must be consistent throughout all geometries.`),null;s[t]===void 0&&(s[t]=[]),s[t].push(d.morphAttributes[t])}if(n){let t;if(r)t=d.index.count;else if(d.attributes.position!==void 0)t=d.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. The geometry must have either an index or a position attribute`),null;l.addGroup(u,t,e),u+=t}}if(r){let e=0,n=[];for(let r=0;r<t.length;++r){let i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}l.setIndex(n)}for(let e in o){let t=j(o[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;l.setAttribute(e,t)}for(let e in s){let t=s[e][0].length;if(t===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<s[e].length;++r)t.push(s[e][r][n]);let r=j(t);if(!r)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;l.morphAttributes[e].push(r)}}return l};function N(t,n){if(n&&t>=n.length){let r=new e.BufferGeometry,i=new Float32Array(t*3),a=0;return n.forEach(e=>{i[a++]=e[0],i[a++]=e[1],i[a++]=e[2]}),r.setAttribute(`position`,new e.BufferAttribute(i,3)),r.setDrawRange(0,n.length),r}}function P(){let t=new Image;t.src=x;let n=new e.Texture;return n.image=t,n.needsUpdate=!0,n}function F(e,t,n,r,i,a){let o=new S(e,t,n,r,i,a);return o.fontFace=r,o.fontSize=i,o.fontWeight=a,o.material.map.generateMipmaps=!1,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=1e4,o}function ee(e,t,n){if(n){let r=e||``,i=t||``,a=n.lastIndexOf(`/`);if(a>-1){let e,t;if(e=n.substring(0,a),t=n.substring(a+1),(e===`*`||e===`**`||e.toLowerCase()===r.toLowerCase())&&(t===`*`||t===`**`||t.toLowerCase()===i.toLowerCase()))return!0}else if(r.toLowerCase()===n.toLowerCase()||i.toLowerCase()===n.toLowerCase())return!0}return!1}function te(t,n,r){let i=t.getAttribute(`position`),a=t.getAttribute(`normal`);if(!i)return;let o=i.itemSize,s=n*o,c=o,l=!1,u=(n,i)=>{let a=!1,l=Array.from(n.array);if(l.length>=s+c){l.splice(s,c),r&&l.concat(Array(c).fill(0)),a=!0;let n=new Float32Array(l);t.setAttribute(i,new e.BufferAttribute(n,o)),t.getAttribute(i).needsUpdate=!0}return a};return l=u(i,`position`),a&&u(a,`normal`),t.index!==null&&console.warn(`Removing vertices from indexed geometry requires index buffer recalculation.`),l}var ne=function(){return function(e){e.vertexShader=e.vertexShader.replace(`#include <color_pars_vertex>`,[`varying vec3 vColor;`,`attribute vec3 morphColor0;`,`attribute vec3 morphColor1;`].join(`
3168
+ `),o={specular:{value:new Z().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(e){for(let t in o)e.uniforms[t]=o[t];e.fragmentShader=e.fragmentShader.replace(`uniform float roughness;`,`uniform vec3 specular;`).replace(`uniform float metalness;`,`uniform float glossiness;`).replace(`#include <roughnessmap_pars_fragment>`,t).replace(`#include <metalnessmap_pars_fragment>`,n).replace(`#include <roughnessmap_fragment>`,r).replace(`#include <metalnessmap_fragment>`,i).replace(`#include <lights_physical_fragment>`,a)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP=``:delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP=``,this.defines.USE_UV=``):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(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}},gP=class{constructor(){this.name=tP.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.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(){return hP}extendParams(e,t,n){let r=t.extensions[this.name];e.color=new Z(1,1,1),e.opacity=1;let i=[];if(Array.isArray(r.diffuseFactor)){let t=r.diffuseFactor;e.color.fromArray(t),e.opacity=t[3]}if(r.diffuseTexture!==void 0&&i.push(n.assignTexture(e,`map`,r.diffuseTexture)),e.emissive=new Z(0,0,0),e.glossiness=r.glossinessFactor===void 0?1:r.glossinessFactor,e.specular=new Z(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),r.specularGlossinessTexture!==void 0){let t=r.specularGlossinessTexture;i.push(n.assignTexture(e,`glossinessMap`,t)),i.push(n.assignTexture(e,`specularMap`,t))}return Promise.all(i)}createMaterial(e){let t=new hP(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}},_P=class{constructor(){this.name=tP.KHR_MESH_QUANTIZATION}},vP=class extends dA{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}},vP.prototype.beforeStart_=vP.prototype.copySampleValue_,vP.prototype.afterEnd_=vP.prototype.copySampleValue_,vP.prototype.interpolate_=function(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=_*t+v*n+h*r+g*c}return i},yP={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},bP={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},xP={9728:LS,9729:HS,9984:RS,9985:US,9986:BS,9987:GS},SP={33071:FS,33648:IS,10497:PS},CP={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},wP={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv2`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},TP={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},EP={CUBICSPLINE:void 0,LINEAR:lw,STEP:cw},DP={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},OP=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new BN,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},this.textureLoader=typeof createImageBitmap<`u`&&/Firefox/.test(navigator.userAgent)===!1?new mj(this.options.manager):new FA(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new kA(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};UN(i,a,r),WN(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone();return r.name+=`_instance_`+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this.loadNode(t);break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this.loadAnimation(t);break;case`camera`:r=this.loadCamera(t);break;default:throw Error(`Unknown type: `+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[tP.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(VN(t.uri,r.path),e,void 0,function(){i(Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0)return Promise.resolve(null);let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=CP[r.type],o=bP[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,p;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new aO(f,u/s),t.cache.add(n,c)),p=new sO(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),p=new wE(f,a,d);if(r.sparse!==void 0){let t=CP.SCALAR,n=bP[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(p=new wE(p.array.slice(),p.itemSize,p.normalized));for(let e=0,t=l.length;e<t;e++){let t=l[e];if(p.setX(t,u[e*a]),a>=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e],i=t.images[r.source],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=this.options,o=i.textures[e],s=(t.uri||t.bufferView)+`:`+o.sampler;if(this.textureCache[s])return this.textureCache[s];let c=self.URL||self.webkitURL,l=t.uri||``,u=!1,d=!0,f=l.search(/\.jpe?g($|\?)/i)>0||l.search(/^data\:image\/jpeg/)===0;if((t.mimeType===`image/jpeg`||f)&&(d=!1),t.bufferView!==void 0)l=r.getDependency(`bufferView`,t.bufferView).then(function(e){if(t.mimeType===`image/png`){let t=new DataView(e,25,1).getUint8(0,!1);d=t===6||t===4||t===3}u=!0;let n=new Blob([e],{type:t.mimeType});return l=c.createObjectURL(n),l});else if(t.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let p=Promise.resolve(l).then(function(e){return new Promise(function(t,r){let i=t;n.isImageBitmapLoader===!0&&(i=function(e){let n=new $w(e);n.needsUpdate=!0,t(n)}),n.load(VN(e,a.path),i,void 0,r)})}).then(function(t){u===!0&&c.revokeObjectURL(l),t.flipY=!1,o.name&&(t.name=o.name),d||(t.format=oC);let n=(i.samplers||{})[o.sampler]||{};return t.magFilter=xP[n.magFilter]||1006,t.minFilter=xP[n.minFilter]||1008,t.wrapS=SP[n.wrapS]||1e3,t.wrapT=SP[n.wrapT]||1e3,r.associations.set(t,{type:`textures`,index:e}),t}).catch(function(){return console.error(`THREE.GLTFLoader: Couldn't load texture`,l),null});return this.textureCache[s]=p,p}assignTexture(e,t,n){let r=this;return this.getDependency(`texture`,n.index).then(function(i){if(n.texCoord!==void 0&&n.texCoord!=0&&(t!==`aoMap`||n.texCoord!=1)&&console.warn(`THREE.GLTFLoader: Custom UV set `+n.texCoord+` for texture `+t+` not yet supported.`),r.extensions[tP.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[tP.KHR_TEXTURE_TRANSFORM];if(e){let t=r.associations.get(i);i=r.extensions[tP.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),r.associations.set(i,t)}}e[t]=i})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent!==void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0,o=Object.keys(t.morphAttributes).length>0,s=o&&t.morphAttributes.normal!==void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new $O,_E.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new HO,_E.prototype.copy.call(t,n),t.color.copy(n.color),this.cache.add(e,t)),n=t}if(r||i||a||o){let e=`ClonedMaterial:`+n.uuid+`:`;n.isGLTFSpecularGlossinessMaterial&&(e+=`specular-glossiness:`),r&&(e+=`vertex-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`),o&&(e+=`morph-targets:`),s&&(e+=`morph-normals:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),o&&(t.morphTargets=!0),s&&(t.morphNormals=!0),r&&(t.vertexTangents=!0,t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}n.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute(`uv2`,t.attributes.uv),e.material=n}getMaterialType(){return tA}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[tP.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){let e=r[tP.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else if(s[tP.KHR_MATERIALS_UNLIT]){let e=r[tP.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new Z(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.fromArray(e),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||DP.OPAQUE;return l===DP.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===DP.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==xE&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new J(1,-1),i.normalTexture.scale!==void 0&&o.normalScale.set(i.normalTexture.scale,-i.normalTexture.scale)),i.occlusionTexture!==void 0&&a!==xE&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==xE&&(o.emissive=new Z().fromArray(i.emissiveFactor)),i.emissiveTexture!==void 0&&a!==xE&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture)),Promise.all(c).then(function(){let n;return n=a===hP?r[tP.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new a(o),i.name&&(n.name=i.name),n.map&&(n.map.encoding=_w),n.emissiveMap&&(n.emissiveMap.encoding=_w),WN(n,i),t.associations.set(n,{type:`materials`,index:e}),i.extensions&&UN(r,n,i),n})}createUniqueName(e){let t=Zj.sanitizeNodeName(e||``),n=t;for(let e=1;this.nodeNamesUsed[n];++e)n=t+`_`+e;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[tP.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return QN(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=qN(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[tP.KHR_DRACO_MESH_COMPRESSION]?i(o):QN(new HE,o,t),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?HN(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,f=o[n];if(u.mode===yP.TRIANGLES||u.mode===yP.TRIANGLE_STRIP||u.mode===yP.TRIANGLE_FAN||u.mode===void 0)d=i.isSkinnedMesh===!0?new jO(l,f):new oD(l,f),d.isSkinnedMesh===!0&&!d.geometry.attributes.skinWeight.normalized&&d.normalizeSkinWeights(),u.mode===yP.TRIANGLE_STRIP?d.geometry=$N(d.geometry,1):u.mode===yP.TRIANGLE_FAN&&(d.geometry=$N(d.geometry,2));else if(u.mode===yP.LINES)d=new ZO(l,f);else if(u.mode===yP.LINE_STRIP)d=new JO(l,f);else if(u.mode===yP.LINE_LOOP)d=new QO(l,f);else if(u.mode===yP.POINTS)d=new ik(l,f);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&KN(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),WN(d,i),u.extensions&&UN(r,d,u),t.assignFinalMaterial(d),c.push(d)}if(c.length===1)return c[0];let l=new ZD;for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r){console.warn(`THREE.GLTFLoader: Missing camera parameters.`);return}return n.type===`perspective`?t=new pD(Jw.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new QA(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),WN(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n={joints:t.joints};return t.inverseBindMatrices===void 0?Promise.resolve(n):this.getDependency(`accessor`,t.inverseBindMatrices).then(function(e){return n.inverseBindMatrices=e,n})}loadAnimation(e){let t=this.json.animations[e],n=[],r=[],i=[],a=[],o=[];for(let e=0,s=t.channels.length;e<s;e++){let s=t.channels[e],c=t.samplers[s.sampler],l=s.target,u=l.node===void 0?l.id:l.node,d=t.parameters===void 0?c.input:t.parameters[c.input],f=t.parameters===void 0?c.output:t.parameters[c.output];n.push(this.getDependency(`node`,u)),r.push(this.getDependency(`accessor`,d)),i.push(this.getDependency(`accessor`,f)),a.push(c),o.push(l)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(a),Promise.all(o)]).then(function(n){let r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=[];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=i[e],l=a[e],u=o[e],d=s[e];if(t===void 0)continue;t.updateMatrix(),t.matrixAutoUpdate=!0;let f;switch(TP[d.path]){case TP.weights:f=vA;break;case TP.rotation:f=bA;break;case TP.position:case TP.scale:default:f=SA}let p=t.name?t.name:t.uuid,m=u.interpolation===void 0?lw:EP[u.interpolation],h=[];TP[d.path]===TP.weights?t.traverse(function(e){e.isMesh===!0&&e.morphTargetInfluences&&h.push(e.name?e.name:e.uuid)}):h.push(p);let g=l.array;if(l.normalized){let e=YN(g.constructor),t=new Float32Array(g.length);for(let n=0,r=g.length;n<r;n++)t[n]=g[n]*e;g=t}for(let e=0,t=h.length;e<t;e++){let t=new f(h[e]+`.`+TP[d.path],n.array,g,m);u.interpolation===`CUBICSPLINE`&&(t.createInterpolant=function(e){return new vP(this.times,this.values,this.getValueSize()/3,e)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(t)}}let l=t.name?t.name:`animation_`+e;return new CA(l,void 0,c)})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this.extensions,r=this,i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``;return function(){let t=[],n=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return n&&t.push(n),i.camera!==void 0&&t.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){t.push(e)}),Promise.all(t)}().then(function(t){let o;if(o=i.isBone===!0?new MO:t.length>1?new ZD:t.length===1?t[0]:new iE,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),WN(o,i),i.extensions&&UN(n,o,i),i.matrix!==void 0){let e=new X;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);return r.associations.set(o,{type:`nodes`,index:e}),o})}loadScene(e){let t=this.json,n=this.extensions,r=this.json.scenes[e],i=this,a=new ZD;r.name&&(a.name=i.createUniqueName(r.name)),WN(a,r),r.extensions&&UN(n,a,r);let o=r.nodes||[],s=[];for(let e=0,n=o.length;e<n;e++)s.push(XN(o[e],a,t,i));return Promise.all(s).then(function(){return a})}}})),AP=p((e=>{e.deflate=Me,e.deflateSync=Ne,e.inflate=Ie,e.inflateSync=Le,e.gzip=Be,e.compress=Be,e.gzipSync=Ve,e.compressSync=Ve,e.gunzip=We,e.gunzipSync=Ge,e.zlib=qe,e.zlibSync=Je,e.unzlib=Ze,e.unzlibSync=Qe,e.gzip=Be,e.compress=Be,e.decompress=et,e.decompressSync=tt,e.strToU8=st,e.strFromU8=ct,e.zip=_t,e.zipSync=vt,e.unzip=xt,e.unzipSync=St;var t={},n={};n.default=(function(e,n,r,i,a){var o=new Worker(t[n]||(t[n]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return o.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],a(r,null)}else a(null,t)},o.postMessage(r,i),o});var r=Uint8Array,i=Uint16Array,a=Int32Array,o=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(e,t){for(var n=new i(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new a(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)o[s]=s-n[r]<<5|r;return{b:n,r:o}},u=l(o,2),d=u.b,f=u.r;d[28]=258,f[258]=28;for(var p=l(s,0),m=p.b,h=p.r,g=new i(32768),_=0;_<32768;++_){var v=(_&43690)>>1|(_&21845)<<1;v=(v&52428)>>2|(v&13107)<<2,v=(v&61680)>>4|(v&3855)<<4,g[_]=((v&65280)>>8|(v&255)<<8)>>1}for(var y=(function(e,t,n){for(var r=e.length,a=0,o=new i(t);a<r;++a)e[a]&&++o[e[a]-1];var s=new i(t);for(a=1;a<t;++a)s[a]=s[a-1]+o[a-1]<<1;var c;if(n){c=new i(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=s[e[a]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)c[g[f]>>l]=u}else for(c=new i(r),a=0;a<r;++a)e[a]&&(c[a]=g[s[e[a]-1]++]>>15-e[a]);return c}),b=new r(288),_=0;_<144;++_)b[_]=8;for(var _=144;_<256;++_)b[_]=9;for(var _=256;_<280;++_)b[_]=7;for(var _=280;_<288;++_)b[_]=8;for(var x=new r(32),_=0;_<32;++_)x[_]=5;var S=y(b,9,0),C=y(b,9,1),w=y(x,5,0),T=y(x,5,1),E=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},D=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},O=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},k=function(e){return(e+7)/8|0},A=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new r(e.subarray(t,n))};e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var j=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],M=function(e,t,n){var r=Error(t||j[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,M),!n)throw r;return r},N=function(e,t,n,i){var a=e.length,l=i?i.length:0;if(!a||t.f&&!t.l)return n||new r(0);var u=!n,f=u||t.i!=2,p=t.i;u&&(n=new r(a*3));var h=function(e){var t=n.length;if(e>t){var i=new r(Math.max(t*2,e));i.set(n),n=i}},g=t.f||0,_=t.p||0,v=t.b||0,b=t.l,x=t.d,S=t.m,w=t.n,j=a*8;do{if(!b){g=D(e,_,1);var N=D(e,_+1,3);if(_+=3,!N){var P=k(_)+4,F=e[P-4]|e[P-3]<<8,ee=P+F;if(ee>a){p&&M(0);break}f&&h(v+F),n.set(e.subarray(P,ee),v),t.b=v+=F,t.p=_=ee*8,t.f=g;continue}if(N==1)b=C,x=T,S=9,w=5;else if(N==2){var te=D(e,_,31)+257,ne=D(e,_+10,15)+4,I=te+D(e,_+5,31)+1;_+=14;for(var L=new r(I),re=new r(19),R=0;R<ne;++R)re[c[R]]=D(e,_+R*3,7);_+=ne*3;for(var z=E(re),ie=(1<<z)-1,B=y(re,z,1),R=0;R<I;){var V=B[D(e,_,ie)];_+=V&15;var P=V>>4;if(P<16)L[R++]=P;else{var ae=0,oe=0;for(P==16?(oe=3+D(e,_,3),_+=2,ae=L[R-1]):P==17?(oe=3+D(e,_,7),_+=3):P==18&&(oe=11+D(e,_,127),_+=7);oe--;)L[R++]=ae}}var H=L.subarray(0,te),se=L.subarray(te);S=E(H),w=E(se),b=y(H,S,1),x=y(se,w,1)}else M(1);if(_>j){p&&M(0);break}}f&&h(v+131072);for(var ce=(1<<S)-1,le=(1<<w)-1,ue=_;;ue=_){var ae=b[O(e,_)&ce],U=ae>>4;if(_+=ae&15,_>j){p&&M(0);break}if(ae||M(2),U<256)n[v++]=U;else if(U==256){ue=_,b=null;break}else{var de=U-254;if(U>264){var R=U-257,fe=o[R];de=D(e,_,(1<<fe)-1)+d[R],_+=fe}var W=x[O(e,_)&le],pe=W>>4;W||M(3),_+=W&15;var se=m[pe];if(pe>3){var fe=s[pe];se+=O(e,_)&(1<<fe)-1,_+=fe}if(_>j){p&&M(0);break}f&&h(v+131072);var me=v+de;if(v<se){var he=l-se,ge=Math.min(se,me);for(he+v<0&&M(3);v<ge;++v)n[v]=i[he+v]}for(;v<me;++v)n[v]=n[v-se]}}t.l=b,t.p=ue,t.b=v,t.f=g,b&&(g=1,t.m=S,t.d=x,t.n=w)}while(!g);return v!=n.length&&u?A(n,0,v):n.subarray(0,v)},P=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},F=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ee=function(e,t){for(var n=[],a=0;a<e.length;++a)e[a]&&n.push({s:a,f:e[a]});var o=n.length,s=n.slice();if(!o)return{t:z,l:0};if(o==1){var c=new r(n[0].s+1);return c[n[0].s]=1,{t:c,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],d=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=o-1;)l=n[n[d].f<n[p].f?d++:p++],u=n[d!=f&&n[d].f<n[p].f?d++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};for(var m=s[0].s,a=1;a<o;++a)s[a].s>m&&(m=s[a].s);var h=new i(m+1),g=te(n[f-1],h,0);if(g>t){var a=0,_=0,v=g-t,y=1<<v;for(s.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});a<o;++a){var b=s[a].s;if(h[b]>t)_+=y-(1<<g-h[b]),h[b]=t;else break}for(_>>=v;_>0;){var x=s[a].s;h[x]<t?_-=1<<t-h[x]++-1:++a}for(;a>=0&&_;--a){var S=s[a].s;h[S]==t&&(--h[S],++_)}g=t}return{t:new r(h),l:g}},te=function(e,t,n){return e.s==-1?Math.max(te(e.l,t,n+1),te(e.r,t,n+1)):t[e.s]=n},ne=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new i(++t),r=0,a=e[0],o=1,s=function(e){n[r++]=e},c=1;c<=t;++c)if(e[c]==a&&c!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(a),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(a);o=1,a=e[c]}return{c:n.subarray(0,r),n:t}},I=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},L=function(e,t,n){var r=n.length,i=k(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},re=function(e,t,n,r,a,l,u,d,f,p,m){P(t,m++,n),++a[256];for(var h=ee(a,15),g=h.t,_=h.l,v=ee(l,15),C=v.t,T=v.l,E=ne(g),D=E.c,O=E.n,k=ne(C),A=k.c,j=k.n,M=new i(19),N=0;N<D.length;++N)++M[D[N]&31];for(var N=0;N<A.length;++N)++M[A[N]&31];for(var te=ee(M,7),re=te.t,R=te.l,z=19;z>4&&!re[c[z-1]];--z);var ie=p+5<<3,B=I(a,b)+I(l,x)+u,V=I(a,g)+I(l,C)+u+14+3*z+I(M,re)+2*M[16]+3*M[17]+7*M[18];if(f>=0&&ie<=B&&ie<=V)return L(t,m,e.subarray(f,f+p));var ae,oe,H,se;if(P(t,m,1+(V<B)),m+=2,V<B){ae=y(g,_,0),oe=g,H=y(C,T,0),se=C;var ce=y(re,R,0);P(t,m,O-257),P(t,m+5,j-1),P(t,m+10,z-4),m+=14;for(var N=0;N<z;++N)P(t,m+3*N,re[c[N]]);m+=3*z;for(var le=[D,A],ue=0;ue<2;++ue)for(var U=le[ue],N=0;N<U.length;++N){var de=U[N]&31;P(t,m,ce[de]),m+=re[de],de>15&&(P(t,m,U[N]>>5&127),m+=U[N]>>12)}}else ae=S,oe=b,H=w,se=x;for(var N=0;N<d;++N){var fe=r[N];if(fe>255){var de=fe>>18&31;F(t,m,ae[de+257]),m+=oe[de+257],de>7&&(P(t,m,fe>>23&31),m+=o[de]);var W=fe&31;F(t,m,H[W]),m+=se[W],W>3&&(F(t,m,fe>>5&8191),m+=s[W])}else F(t,m,ae[fe]),m+=oe[fe]}return F(t,m,ae[256]),m+oe[256]},R=new a([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),z=new r(0),ie=function(e,t,n,c,l,u){var d=u.z||e.length,p=new r(c+d+5*(1+Math.ceil(d/7e3))+l),m=p.subarray(c,p.length-l),g=u.l,_=(u.r||0)&7;if(t){_&&(m[0]=u.r>>3);for(var v=R[t-1],y=v>>13,b=v&8191,x=(1<<n)-1,S=u.p||new i(32768),C=u.h||new i(x+1),w=Math.ceil(n/3),T=2*w,E=function(t){return(e[t]^e[t+1]<<w^e[t+2]<<T)&x},D=new a(25e3),O=new i(288),j=new i(32),M=0,N=0,P=u.i||0,F=0,ee=u.w||0,te=0;P+2<d;++P){var ne=E(P),I=P&32767,z=C[ne];if(S[I]=z,C[ne]=I,ee<=P){var ie=d-P;if((M>7e3||F>24576)&&(ie>423||!g)){_=re(e,m,0,D,O,j,N,F,te,P-te,_),F=M=N=0,te=P;for(var B=0;B<286;++B)O[B]=0;for(var B=0;B<30;++B)j[B]=0}var V=2,ae=0,oe=b,H=I-z&32767;if(ie>2&&ne==E(P-H))for(var se=Math.min(y,ie)-1,ce=Math.min(32767,P),le=Math.min(258,ie);H<=ce&&--oe&&I!=z;){if(e[P+V]==e[P+V-H]){for(var ue=0;ue<le&&e[P+ue]==e[P+ue-H];++ue);if(ue>V){if(V=ue,ae=H,ue>se)break;for(var U=Math.min(H,ue-2),de=0,B=0;B<U;++B){var fe=P-H+B&32767,W=fe-S[fe]&32767;W>de&&(de=W,z=fe)}}}I=z,z=S[I],H+=I-z&32767}if(ae){D[F++]=268435456|f[V]<<18|h[ae];var pe=f[V]&31,me=h[ae]&31;N+=o[pe]+s[me],++O[257+pe],++j[me],ee=P+V,++M}else D[F++]=e[P],++O[e[P]]}}for(P=Math.max(P,ee);P<d;++P)D[F++]=e[P],++O[e[P]];_=re(e,m,g,D,O,j,N,F,te,P-te,_),g||(u.r=_&7|m[_/8|0]<<3,_-=7,u.h=C,u.p=S,u.i=P,u.w=ee)}else{for(var P=u.w||0;P<d+g;P+=65535){var he=P+65535;he>=d&&(m[_/8|0]=g,he=d),_=L(m,_+1,e.subarray(P,he))}u.i=d}return A(p,0,c+k(_)+l)},B=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),V=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=B[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},ae=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},oe=function(e,t,n,i,a){if(!a&&(a={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new r(o.length+e.length);s.set(o),s.set(e,o.length),e=s,a.w=o.length}return ie(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,a)},H=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},se=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype){if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString()}else t+=l}else n[c]=s}return t},ce=[],le=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},ue=function(e,t,r,i){if(!ce[r]){for(var a=``,o={},s=e.length-1,c=0;c<s;++c)a=se(e[c],a,o);ce[r]={c:se(e[s],a,o),e:o}}var l=H({},ce[r].e);return(0,n.default)(ce[r].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,r,l,le(l),i)},U=function(){return[r,i,a,o,s,c,d,m,C,T,g,j,y,E,D,O,k,A,M,N,Le,he,ge]},de=function(){return[r,i,a,o,s,c,f,h,S,b,w,x,g,R,z,y,P,F,ee,te,ne,I,L,re,k,A,ie,oe,Ne,he]},fe=function(){return[Ce,Ee,Se,V,B]},W=function(){return[we,Te]},pe=function(){return[De,Se,ae]},me=function(){return[Oe]},he=function(e){return postMessage(e,[e.buffer])},ge=function(e){return e&&{out:e.size&&new r(e.size),dictionary:e.dictionary}},G=function(e,t,n,r,i,a){var o=ue(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},_e=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){t.data[0]?(e.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):e.flush(t.data[1])}},ve=function(e,t,n,r,i,a,o){var s,c=ue(e,r,i,function(e,n){e?(c.terminate(),t.ondata.call(t,e)):Array.isArray(n)?n.length==1?(t.queuedSize-=n[0],t.ondrain&&t.ondrain(n[0])):(n[1]&&c.terminate(),t.ondata.call(t,e,n[0],n[1])):o(n)});c.postMessage(n),t.queuedSize=0,t.push=function(e,n){t.ondata||M(5),s&&t.ondata(M(4,0,1),null,!!n),t.queuedSize+=e.length,c.postMessage([e,s=n],e.buffer instanceof ArrayBuffer?[e.buffer]:[])},t.terminate=function(){c.terminate()},a&&(t.flush=function(e){c.postMessage([0,e])})},ye=function(e,t){return e[t]|e[t+1]<<8},be=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},xe=function(e,t){return be(e,t)+be(e,t+4)*4294967296},Se=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Ce=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Se(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},we=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&M(6,`invalid gzip data`);var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Te=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ee=function(e){return 10+(e.filename?e.filename.length+1:0)},De=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=ae();i.p(t.dictionary),Se(e,2,i.d())}},Oe=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&M(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&M(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function ke(e,t){return typeof e==`function`&&(t=e,e={}),this.ondata=t,e}var Ae=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new r(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(oe(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||M(5),this.s.l&&M(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var i=new r(n&-32768);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;this.b.set(e.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(a),32768),this.s.z=e.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2),t&&(this.s=this.o={},this.b=z)},e.prototype.flush=function(e){if(this.ondata||M(5),this.s.l&&M(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var t=new r(6);t[0]=this.s.r>>3;var n=L(t,this.s.r,z);this.s.r=0,this.ondata(t.subarray(0,n>>3),!1)}},e}();e.Deflate=Ae;var je=function(){function e(e,t){ve([de,function(){return[_e,Ae]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Ae(e.data))},6,1)}return e}();e.AsyncDeflate=je;function Me(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[de],function(e){return he(Ne(e.data[0],e.data[1]))},0,n)}function Ne(e,t){return oe(e,t||{},0,0)}var Pe=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new r(32768),this.p=new r(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||M(5),this.d&&M(4),!this.p.length)this.p=e;else if(e.length){var t=new r(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=N(this.p,this.s,this.o);this.ondata(A(n,t,this.s.b),this.d),this.o=A(n,this.s.b-32768),this.s.b=this.o.length,this.p=A(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}();e.Inflate=Pe;var Fe=function(){function e(e,t){ve([U,function(){return[_e,Pe]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Pe(e.data))},7,0)}return e}();e.AsyncInflate=Fe;function Ie(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[U],function(e){return he(Le(e.data[0],ge(e.data[1])))},1,n)}function Le(e,t){return N(e,{i:2},t&&t.out,t&&t.dictionary)}var Re=function(){function e(e,t){this.c=V(),this.l=0,this.v=1,Ae.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,Ae.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=oe(e,this.o,this.v&&Ee(this.o),t&&8,this.s);this.v&&=(Ce(n,this.o),0),t&&(Se(n,n.length-8,this.c.d()),Se(n,n.length-4,this.l)),this.ondata(n,t)},e.prototype.flush=function(e){Ae.prototype.flush.call(this,e)},e}();e.Gzip=Re,e.Compress=Re;var ze=function(){function e(e,t){ve([de,fe,function(){return[_e,Ae,Re]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Re(e.data))},8,1)}return e}();e.AsyncGzip=ze,e.AsyncCompress=ze;function Be(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[de,fe,function(){return[Ve]}],function(e){return he(Ve(e.data[0],e.data[1]))},2,n)}function Ve(e,t){t||={};var n=V(),r=e.length;n.p(e);var i=oe(e,t,Ee(t),8),a=i.length;return Ce(i,t),Se(i,a-8,n.d()),Se(i,a-4,r),i}var He=function(){function e(e,t){this.v=1,this.r=0,Pe.call(this,e,t)}return e.prototype.push=function(e,t){if(Pe.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),i=n.length>3?we(n):4;if(i>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(i),this.v=0}Pe.prototype.c.call(this,0),this.s.f&&!this.s.l?(this.v=k(this.s.p)+9,this.s={i:0},this.o=new r(0),this.push(new r(0),t)):t&&Pe.prototype.c.call(this,t)},e}();e.Gunzip=He;var Ue=function(){function e(e,t){var n=this;ve([U,W,function(){return[_e,Pe,He]}],this,ke.call(this,e,t),function(e){var t=new He(e.data);t.onmember=function(e){return postMessage(e)},onmessage=_e(t)},9,0,function(e){return n.onmember&&n.onmember(e)})}return e}();e.AsyncGunzip=Ue;function We(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[U,W,function(){return[Ge]}],function(e){return he(Ge(e.data[0],e.data[1]))},3,n)}function Ge(e,t){var n=we(e);return n+8>e.length&&M(6,`invalid gzip data`),N(e.subarray(n,-8),{i:2},t&&t.out||new r(Te(e)),t&&t.dictionary)}var Ke=function(){function e(e,t){this.c=ae(),this.v=1,Ae.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),Ae.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=oe(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&=(De(n,this.o),0),t&&Se(n,n.length-4,this.c.d()),this.ondata(n,t)},e.prototype.flush=function(e){Ae.prototype.flush.call(this,e)},e}();e.Zlib=Ke,e.AsyncZlib=function(){function e(e,t){ve([de,pe,function(){return[_e,Ae,Ke]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Ke(e.data))},10,1)}return e}();function qe(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[de,pe,function(){return[Je]}],function(e){return he(Je(e.data[0],e.data[1]))},4,n)}function Je(e,t){t||={};var n=ae();n.p(e);var r=oe(e,t,t.dictionary?6:2,4);return De(r,t),Se(r,r.length-4,n.d()),r}var Ye=function(){function e(e,t){Pe.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Pe.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(Oe(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&M(6,`invalid zlib data`),this.p=this.p.subarray(0,-4)),Pe.prototype.c.call(this,t)},e}();e.Unzlib=Ye;var Xe=function(){function e(e,t){ve([U,me,function(){return[_e,Pe,Ye]}],this,ke.call(this,e,t),function(e){onmessage=_e(new Ye(e.data))},11,0)}return e}();e.AsyncUnzlib=Xe;function Ze(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),G(e,t,[U,me,function(){return[Qe]}],function(e){return he(Qe(e.data[0],ge(e.data[1])))},5,n)}function Qe(e,t){return N(e.subarray(Oe(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var $e=function(){function e(e,t){this.o=ke.call(this,e,t)||{},this.G=He,this.I=Pe,this.Z=Ye}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n){e.ondata(t,n)}},e.prototype.push=function(e,t){if(this.ondata||M(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();e.Decompress=$e,e.AsyncDecompress=function(){function e(e,t){$e.call(this,e,t),this.queuedSize=0,this.G=Ue,this.I=Fe,this.Z=Xe}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,n,r){e.ondata(t,n,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},e.prototype.push=function(e,t){this.queuedSize+=e.length,$e.prototype.push.call(this,e,t)},e}();function et(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&M(7),e[0]==31&&e[1]==139&&e[2]==8?We(e,t,n):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Ie(e,t,n):Ze(e,t,n)}function tt(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Ge(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Le(e,t):Qe(e,t)}var nt=function(e,t,n,i){for(var a in e){var o=e[a],s=t+a,c=i;Array.isArray(o)&&(c=H(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[s]=[o,c]:(n[s+=`/`]=[new r(0),c],nt(o,s,n,i))}},rt=typeof TextEncoder<`u`&&new TextEncoder,it=typeof TextDecoder<`u`&&new TextDecoder,at=0;try{it.decode(z,{stream:!0}),at=1}catch{}var ot=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:A(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};e.DecodeUTF8=function(){function e(e){this.ondata=e,at?this.t=new TextDecoder:this.p=z}return e.prototype.push=function(e,t){if(this.ondata||M(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&M(8),this.t=null);return}this.p||M(4);var n=new r(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var i=ot(n),a=i.s,o=i.r;t?(o.length&&M(8),this.p=null):this.p=o,this.ondata(a,t)},e}(),e.EncodeUTF8=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){this.ondata||M(5),this.d&&M(4),this.ondata(st(e),this.d=t||!1)},e}();function st(e,t){if(t){for(var n=new r(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(rt)return rt.encode(e);for(var a=e.length,o=new r(e.length+(e.length>>1)),s=0,c=function(e){o[s++]=e},i=0;i<a;++i){if(s+5>o.length){var l=new r(s+8+(a-i<<1));l.set(o),o=l}var u=e.charCodeAt(i);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,c(240|u>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|u&63)):(c(224|u>>12),c(128|u>>6&63),c(128|u&63))}return A(o,0,s)}function ct(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(it)return it.decode(e);var i=ot(e),a=i.s,n=i.r;return n.length&&M(8),a}var lt=function(e){return e==1?3:e<6?2:+(e==9)},ut=function(e,t){return t+30+ye(e,t+26)+ye(e,t+28)},dt=function(e,t,n){var r=ye(e,t+28),i=ye(e,t+30),a=ct(e.subarray(t+46,t+46+r),!(ye(e,t+8)&2048)),o=t+46+r,s=ft(e,o,i,n,be(e,t+20),be(e,t+24),be(e,t+42)),c=s[0],l=s[1],u=s[2];return[ye(e,t+10),c,l,a,o+i+ye(e,t+32),u]},ft=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+ye(e,t+2))if(ye(e,t)==1)return[s?xe(e,t+4+8*c):i,c?xe(e,t+4):a,l?xe(e,t+4+8*(c+s)):o,1];r<2&&M(13)}return[i,a,o,0]},pt=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&M(9),t+=r+4}return t},mt=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=pt(l);Se(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&M(10),Se(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Se(e,t,n.crc),Se(e,t+4,a<0?-a-2:a),Se(e,t+8,n.size)),Se(e,t+12,c),Se(e,t+14,d),t+=16,o!=null&&(Se(e,t,u),Se(e,t+6,n.attrs),Se(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Se(e,t,+m),Se(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},ht=function(e,t,n,r,i){Se(e,t,101010256),Se(e,t+8,n),Se(e,t+10,n),Se(e,t+12,r),Se(e,t+16,i)},gt=function(){function e(e){this.filename=e,this.c=V(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||M(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();e.ZipPassThrough=gt,e.ZipDeflate=function(){function e(e,t){var n=this;t||={},gt.call(this,e),this.d=new Ae(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=lt(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){gt.prototype.push.call(this,e,t)},e}(),e.AsyncZipDeflate=function(){function e(e,t){var n=this;t||={},gt.call(this,e),this.d=new je(t,function(e,t,r){n.ondata(e,t,r)}),this.compression=8,this.flag=lt(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){gt.prototype.push.call(this,e,t)},e}(),e.Zip=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||M(5),this.d&2)this.ondata(M(4+(this.d&1)*8,0,1),null,!1);else{var n=st(e.filename),i=n.length,a=e.comment,o=a&&st(a),s=i!=e.filename.length||o&&a.length!=o.length,c=i+pt(e.extra)+30;i>65535&&this.ondata(M(11,0,1),null,!1);var l=new r(c);mt(l,0,e,n,s,-1);var u=[l],d=function(){for(var e=0,n=u;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}u=[]},f=this.d;this.d=0;var p=this.u.length,m=H(e,{f:n,u:s,o,t:function(){e.terminate&&e.terminate()},r:function(){if(d(),f){var e=t.u[p+1];e?e.r():t.d=1}f=1}}),h=0;e.ondata=function(n,i,a){if(n)t.ondata(n,i,a),t.terminate();else if(h+=i.length,u.push(i),a){var o=new r(16);Se(o,0,134695760),Se(o,4,e.crc),Se(o,8,h),Se(o,12,e.size),u.push(o),m.c=h,m.b=c+h+16,m.crc=e.crc,m.size=e.size,f&&m.r(),f=1}else f&&d()},this.u.push(m)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata(M(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,i=0,a=this.u;i<a.length;i++){var o=a[i];n+=46+o.f.length+pt(o.extra)+(o.o?o.o.length:0)}for(var s=new r(n+22),c=0,l=this.u;c<l.length;c++){var o=l[c];mt(s,e,o,o.f,o.u,-o.c-2,t,o.o),e+=46+o.f.length+pt(o.extra)+(o.o?o.o.length:0),t+=o.b}ht(s,e,this.u.length,n,t),this.ondata(null,s,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}();function _t(e,t,n){n||(n=t,t={}),typeof n!=`function`&&M(7);var i={};nt(e,``,i,t);var a=Object.keys(i),o=a.length,s=0,c=0,l=o,u=Array(o),d=[],f=function(){for(var e=0;e<d.length;++e)d[e]()},p=function(e,t){bt(function(){n(e,t)})};bt(function(){p=n});var m=function(){var e=new r(c+22),t=s,n=c-s;c=0;for(var i=0;i<l;++i){var a=u[i];try{var o=a.c.length;mt(e,c,a,a.f,a.u,o);var d=30+a.f.length+pt(a.extra),f=c+d;e.set(a.c,f),mt(e,s,a,a.f,a.u,o,c,a.m),s+=16+d+(a.m?a.m.length:0),c=f+o}catch(e){return p(e,null)}}ht(e,s,u.length,n,t),p(null,e)};o||m();for(var h=function(e){var t=a[e],n=i[t],r=n[0],l=n[1],h=V(),g=r.length;h.p(r);var _=st(t),v=_.length,y=l.comment,b=y&&st(y),x=b&&b.length,S=pt(l.extra),C=l.level==0?0:8,w=function(n,r){if(n)f(),p(n,null);else{var i=r.length;u[e]=H(l,{size:g,crc:h.d(),c:r,f:_,m:b,u:v!=t.length||b&&y.length!=x,compression:C}),s+=30+v+S+i,c+=76+2*(v+S)+(x||0)+i,--o||m()}};if(v>65535&&w(M(11,0,1),null),!C)w(null,r);else if(g<16e4)try{w(null,Ne(r,l))}catch(e){w(e,null)}else d.push(Me(r,l,w))},g=0;g<l;++g)h(g);return f}function vt(e,t){t||={};var n={},i=[];nt(e,``,n,t);var a=0,o=0;for(var s in n){var c=n[s],l=c[0],u=c[1],d=u.level==0?0:8,f=st(s),p=f.length,m=u.comment,h=m&&st(m),g=h&&h.length,_=pt(u.extra);p>65535&&M(11);var v=d?Ne(l,u):l,y=v.length,b=V();b.p(l),i.push(H(u,{size:l.length,crc:b.d(),c:v,f,m:h,u:p!=s.length||h&&m.length!=g,o:a,compression:d})),a+=30+p+_+y,o+=76+2*(p+_)+(g||0)+y}for(var x=new r(o+22),S=a,C=o-a,w=0;w<i.length;++w){var f=i[w];mt(x,f.o,f,f.f,f.u,f.c.length);var T=30+f.f.length+pt(f.extra);x.set(f.c,f.o+T),mt(x,a,f,f.f,f.u,f.c.length,f.o,f.m),a+=16+T+(f.m?f.m.length:0)}return ht(x,a,i.length,C,S),x}var yt=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();e.UnzipPassThrough=yt,e.UnzipInflate=function(){function e(){var e=this;this.i=new Pe(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),e.AsyncUnzipInflate=function(){function e(e,t){var n=this;t<32e4?this.i=new Pe(function(e,t){n.ondata(null,e,t)}):(this.i=new Fe(function(e,t,r){n.ondata(e,t,r)}),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=A(e,0)),this.i.push(e,t)},e.compression=8,e}(),e.Unzip=function(){function e(e){this.onfile=e,this.k=[],this.o={0:yt},this.p=z}return e.prototype.push=function(e,t){var n=this;if(this.onfile||M(5),this.p||M(4),this.c>0){var i=Math.min(this.c,e.length),a=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(a,!this.c):this.k[0].push(a),e=e.subarray(i),e.length)return this.push(e,t)}else{var o=0,s=0,c=void 0,l=void 0;this.p.length?e.length?(l=new r(this.p.length+e.length),l.set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,d=this.c,f=d&&this.d,p=function(){var e=be(l,s);if(e==67324752){o=1,c=s,m.d=null,m.c=0;var t=ye(l,s+6),r=ye(l,s+8),i=t&2048,a=t&8,f=ye(l,s+26),p=ye(l,s+28);if(u>s+30+f+p){var h=[];m.k.unshift(h),o=2;var g=be(l,s+18),_=be(l,s+22),v=ct(l.subarray(s+30,s+=30+f),!i),y=ft(l,s,p,2,g,_,0),b=y[0],x=y[1],S=y[3];a&&(b=-1-S),s+=p,m.c=b;var C,w={name:v,compression:r,start:function(){if(w.ondata||M(5),!b)w.ondata(null,z,!0);else{var e=n.o[r];e||w.ondata(M(14,`unknown compression type `+r,1),null,!1),C=b<0?new e(v):new e(v,b,x),C.ondata=function(e,t,n){w.ondata(e,t,n)};for(var t=0,i=h;t<i.length;t++){var a=i[t];C.push(a,!1)}n.k[0]==h&&n.c?n.d=C:C.push(z,!0)}},terminate:function(){C&&C.terminate&&C.terminate()}};b>=0&&(w.size=b,w.originalSize=x),m.onfile(w)}return`break`}if(d){if(e==134695760)return c=s+=12+(d==-2&&8),o=3,m.c=0,`break`;if(e==33639248)return c=s-=4,o=3,m.c=0,`break`}},m=this;s<u-4&&p()!==`break`;++s);if(this.p=z,d<0){var h=o?l.subarray(0,c-12-(d==-2&&8)-(be(l,c-16)==134695760&&4)):l.subarray(0,s);f?f.push(h,!!o):this.k[+(o==2)].push(h)}if(o&2)return this.push(l.subarray(s),t);this.p=l.subarray(s)}t&&(this.c&&M(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}();var bt=typeof queueMicrotask==`function`?queueMicrotask:typeof setTimeout==`function`?setTimeout:function(e){e()};function xt(e,t,n){n||(n=t,t={}),typeof n!=`function`&&M(7);var i=[],a=function(){for(var e=0;e<i.length;++e)i[e]()},o={},s=function(e,t){bt(function(){n(e,t)})};bt(function(){s=n});for(var c=e.length-22;be(e,c)!=101010256;--c)if(!c||e.length-c>65558)return s(M(13,0,1),null),a;var l=ye(e,c+8);if(l){var u=l,d=be(e,c+16),f=be(e,c-20)==117853008;if(f){var p=be(e,c-12);f=be(e,p)==101075792,f&&(u=l=be(e,p+32),d=be(e,p+48))}for(var m=t&&t.filter,h=function(t){var n=dt(e,d,f),c=n[0],u=n[1],p=n[2],h=n[3],g=n[4],_=n[5],v=ut(e,_);d=g;var y=function(e,t){e?(a(),s(e,null)):(t&&(o[h]=t),--l||s(null,o))};if(!m||m({name:h,size:u,originalSize:p,compression:c})){if(!c)y(null,A(e,v,v+u));else if(c==8){var b=e.subarray(v,v+u);if(p<524288||u>.8*p)try{y(null,Le(b,{out:new r(p)}))}catch(e){y(e,null)}else i.push(Ie(b,{size:p},y))}else y(M(14,`unknown compression type `+c,1),null)}else y(null,null)},g=0;g<u;++g)h(g)}else s(null,{});return a}function St(e,t){for(var n={},i=e.length-22;be(e,i)!=101010256;--i)(!i||e.length-i>65558)&&M(13);var a=ye(e,i+8);if(!a)return{};var o=be(e,i+16),s=be(e,i-20)==117853008;if(s){var c=be(e,i-12);s=be(e,c)==101075792,s&&(a=be(e,c+32),o=be(e,c+48))}for(var l=t&&t.filter,u=0;u<a;++u){var d=dt(e,o,s),f=d[0],p=d[1],m=d[2],h=d[3],g=d[4],_=d[5],v=ut(e,_);o=g,(!l||l({name:h,size:p,originalSize:m,compression:f}))&&(f?f==8?n[h]=Le(e.subarray(v,v+p),{out:new r(m)}):M(14,`unknown compression type `+f):n[h]=A(e,v,v+p))}return n}})),jP=g(p(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t<`u`?t.exports=r((dN(),_(pv)),(FN(),_(fN)),RN(),(kP(),_(zN)),AP()):typeof define==`function`&&define.amd?define([`three`,`three-spritetext`,`css-element-queries`,`three/examples/jsm/loaders/GLTFLoader`,`fflate`],r):(n=typeof globalThis<`u`?globalThis:n||self,n.Zinc=r(n.THREE,n.SpriteText,n.cssElememtQueries,n.GLTFLoader,n.fflate))})(e,function(e,t,n,r,i){var a=Object.create,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=c(t),a=0,l=i.length,d;a<l;a++)d=i[a],!u.call(e,d)&&d!==n&&o(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=s(t,d))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:a(l(e)),d(t||!e||!e.__esModule||!u.call(e,`default`)?o(n,`default`,{value:e,enumerable:!0}):n,e));e=f(e,1),t=f(t,1);var p={name:`zincjs`,version:`2.2.1`,description:`ZincJS (Web-based-Zinc-Visualisation)`,type:`module`,main:`build/zinc.js`,directories:{doc:`docs`},files:[`package.json`,`LICENSE`,`README.md`,`src/*`,`build/zinc.js`,`build/zinc.js.map`,`vite.config.js`],scripts:{"build-bundle":`vite build`,"test-watch":`vitest`,test:`vitest run --reporter=junit --outputFile=test-results.xml`,"test-standard":`vitest run`,changelog:`auto-changelog -p --output CHANGELOG.md --template keepachangelog`,jsdoc:`jsdoc -c jsdoc_conf.json`,version:`npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs`,"release:beta":`npm version prerelease --preid=beta; npm publish --tag beta`,"release:major":`npm version major; npm publish`,"release:minor":`npm version minor; npm publish`,"release:patch":`npm version patch; npm publish`},repository:{type:`git`,url:`git+https://github.com/alan-wu/ZincJS.git`},keywords:[`library`,`webgl`,`3d`,`zincjs`],author:`Alan Wu <alan.wu@auckland.ac.nz>`,license:`MIT`,bugs:{url:`https://github.com/alan-wu/ZincJS/issues`},homepage:`http://alan-wu.github.io/ZincJS/`,engines:{node:`>=20`},devDependencies:{"@vitest/coverage-v8":`^4.1.11`,"auto-changelog":`^2.4.0`,chai:`^4.1.0`,gl:`^8.1.6`,"happy-dom":`^20.10.6`,jsdoc:`^4.0.2`,msw:`^2.14.6`,vite:`^8.2.1`,"vite-plugin-node-polyfills":`^0.28.0`,vitest:`^4.1.11`},dependencies:{"css-element-queries":`^1.2.2`,lodash:`^4.17.19`,"nifti-reader-js":`0.8.0`,three:`^0.130.1`,"three-spritetext":`1.6.2`}},m=new e.Matrix4,h=new e.Object3D,g=new e.Vector3,_=new e.Vector3;function v(){this.uuid=e.MathUtils.generateUUID(),this.name=``,this.type=`Geometry`,this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1,this.morphNormalsReady=!1}v.prototype=Object.assign(Object.create(e.EventDispatcher.prototype),{constructor:v,isGeometry:!0,applyMatrix4:function(t){let n=new e.Matrix3().getNormalMatrix(t);for(let e=0,n=this.vertices.length;e<n;e++)this.vertices[e].applyMatrix4(t);for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.normal.applyMatrix3(n).normalize();for(let e=0,r=t.vertexNormals.length;e<r;e++)t.vertexNormals[e].applyMatrix3(n).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return m.makeRotationX(e),this.applyMatrix4(m),this},rotateY:function(e){return m.makeRotationY(e),this.applyMatrix4(m),this},rotateZ:function(e){return m.makeRotationZ(e),this.applyMatrix4(m),this},translate:function(e,t,n){return m.makeTranslation(e,t,n),this.applyMatrix4(m),this},scale:function(e,t,n){return m.makeScale(e,t,n),this.applyMatrix4(m),this},lookAt:function(e){return h.lookAt(e),h.updateMatrix(),this.applyMatrix4(h.matrix),this},fromBufferGeometry:function(t){let n=this,r=t.index===null?void 0:t.index,i=t.attributes;if(i.position===void 0)return console.error(`THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.`),this;let a=i.position,o=i.normal,s=i.color,c=i.uv,l=i.uv2;l!==void 0&&(this.faceVertexUvs[1]=[]);for(let t=0;t<a.count;t++)n.vertices.push(new e.Vector3().fromBufferAttribute(a,t)),s!==void 0&&n.colors.push(new e.Color().fromBufferAttribute(s,t));function u(t,r,i,a){let u=s===void 0?[]:[n.colors[t].clone(),n.colors[r].clone(),n.colors[i].clone()],d=new b(t,r,i,o===void 0?[]:[new e.Vector3().fromBufferAttribute(o,t),new e.Vector3().fromBufferAttribute(o,r),new e.Vector3().fromBufferAttribute(o,i)],u,a);n.faces.push(d),c!==void 0&&n.faceVertexUvs[0].push([new e.Vector2().fromBufferAttribute(c,t),new e.Vector2().fromBufferAttribute(c,r),new e.Vector2().fromBufferAttribute(c,i)]),l!==void 0&&n.faceVertexUvs[1].push([new e.Vector2().fromBufferAttribute(l,t),new e.Vector2().fromBufferAttribute(l,r),new e.Vector2().fromBufferAttribute(l,i)])}let d=t.groups;if(d.length>0)for(let e=0;e<d.length;e++){let t=d[e],n=t.start,i=t.count;for(let e=n,a=n+i;e<a;e+=3)r===void 0?u(e,e+1,e+2,t.materialIndex):u(r.getX(e),r.getX(e+1),r.getX(e+2),t.materialIndex)}else if(r!==void 0)for(let e=0;e<r.count;e+=3)u(r.getX(e),r.getX(e+1),r.getX(e+2));else for(let e=0;e<a.count;e+=3)u(e,e+1,e+2);return this.computeFaceNormals(),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(g).negate(),this.translate(g.x,g.y,g.z),this},normalize:function(){this.computeBoundingSphere();let t=this.boundingSphere.center,n=this.boundingSphere.radius,r=n===0?1:1/n,i=new e.Matrix4;return i.set(r,0,0,-r*t.x,0,r,0,-r*t.y,0,0,r,-r*t.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){let t=new e.Vector3,n=new e.Vector3;for(let e=0,r=this.faces.length;e<r;e++){let r=this.faces[e],i=this.vertices[r.a],a=this.vertices[r.b],o=this.vertices[r.c];t.subVectors(o,a),n.subVectors(i,a),t.cross(n),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t=!0){let n=Array(this.vertices.length);for(let t=0,r=this.vertices.length;t<r;t++)n[t]=new e.Vector3;if(t){let t=new e.Vector3,r=new e.Vector3;for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];t.subVectors(s,o),r.subVectors(a,o),t.cross(r),n[i.a].add(t),n[i.b].add(t),n[i.c].add(t)}}else{this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];n[t.a].add(t.normal),n[t.b].add(t.normal),n[t.c].add(t.normal)}}for(let e=0,t=this.vertices.length;e<t;e++)n[e].normalize();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],r=t.vertexNormals;r.length===3?(r[0].copy(n[t.a]),r[1].copy(n[t.b]),r[2].copy(n[t.c])):(r[0]=n[t.a].clone(),r[1]=n[t.b].clone(),r[2]=n[t.c].clone())}return this.faces.length>0&&(this.normalsNeedUpdate=!0),n},computeFlatVertexNormals:function(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],n=t.vertexNormals;n.length===3?(n[0].copy(t.normal),n[1].copy(t.normal),n[2].copy(t.normal)):(n[0]=t.normal.clone(),n[1]=t.normal.clone(),n[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||=[];for(let e=0,n=t.vertexNormals.length;e<n;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}let t=new v;t.faces=this.faces;for(let n=0,r=this.morphTargets.length;n<r;n++){if(!this.morphNormals[n]){this.morphNormals[n]={},this.morphNormals[n].faceNormals=[],this.morphNormals[n].vertexNormals=[];let t=this.morphNormals[n].faceNormals,r=this.morphNormals[n].vertexNormals;for(let n=0,i=this.faces.length;n<i;n++){let n=new e.Vector3,i={a:new e.Vector3,b:new e.Vector3,c:new e.Vector3};t.push(n),r.push(i)}}let r=this.morphNormals[n];t.vertices=this.morphTargets[n].vertices,t.computeFaceNormals();let i=t.computeVertexNormals();if(i&&i.length>0){this.morphTargets[n].normals=Array(this.vertices.length);for(let e=0;e<i.length;e++)this.morphTargets[n].normals[e]=i[e].clone()}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],n=r.faceNormals[e],i=r.vertexNormals[e];n.copy(t.normal),i.a.copy(t.vertexNormals[0]),i.b.copy(t.vertexNormals[1]),i.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}this.morphNormalsReady=!0},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new e.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new e.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(e,t){let n=this.morphTargets.length,r=this.morphTargets,i=e.morphTargets,a=this.morphColors.length,o=this.morphColors,s=e.morphColors;if(n>0&&n==i.length)for(let e=0,n=r.length;e<n;e++){let n=r[e],a=i[e];for(let e=0,r=a.vertices.length;e<r;e++){let r=a.vertices[e].clone();t!==void 0&&r.applyMatrix4(t),n.vertices.push(r)}if(n.normals&&a.normals)for(let e=0;e<a.normals.length;e+=3)_.set(a.normals2[e],a.normals2[e+1],a.normals2[e+2]),t!==void 0&&_.applyMatrix4(t),n.normals.push(_.x,_.y,_.z)}if(a>0&&a==s.length)for(let e=0,t=o.length;e<t;e++){let t=o[e],n=s[e];for(let e=0,r=n.colors;e<r;e++)t.colors.push(n.colors[e].clone())}},merge:function(t,n,r=0){if(!(t&&t.isGeometry)){console.error(`THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.`,t);return}let i,a=this.vertices.length,o=this.vertices,s=t.vertices,c=t.normals,l=this.faces,u=t.faces,d=this.colors,f=t.colors;n!==void 0&&(i=new e.Matrix3().getNormalMatrix(n));for(let e=0,t=s.length;e<t;e++){let t=s[e].clone();n!==void 0&&t.applyMatrix4(n),o.push(t)}for(let e=0;e<c.length;e+=3)_.set(c[e],c[e+1],c[e+2]),n!==void 0&&_.applyMatrix4(n),this.normals.push(_.x,_.y,_.z);for(let e=0,t=f.length;e<t;e++)typeof f[e]==`number`?d.push(f[e]):d.push(f[e].clone());for(let e=0,t=u.length;e<t;e++){let t=u[e],n,o,s=t.vertexNormals,c=t.vertexColors,d=new b(t.a+a,t.b+a,t.c+a);d.normal.copy(t.normal),i!==void 0&&d.normal.applyMatrix3(i).normalize();for(let e=0,t=s.length;e<t;e++)n=s[e].clone(),i!==void 0&&n.applyMatrix3(i).normalize(),d.vertexNormals.push(n);d.color.copy(t.color);for(let e=0,t=c.length;e<t;e++)o=c[e],d.vertexColors.push(o.clone());d.materialIndex=t.materialIndex+r,l.push(d)}for(let e=0,n=t.faceVertexUvs.length;e<n;e++){let n=t.faceVertexUvs[e];this.faceVertexUvs[e]===void 0&&(this.faceVertexUvs[e]=[]);for(let t=0,r=n.length;t<r;t++){let r=n[t],i=[];for(let e=0,t=r.length;e<t;e++)i.push(r[e].clone());this.faceVertexUvs[e].push(i)}}this.mergeMorph(t,n)},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error(`THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.`,e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(e=4){let t={},n=[],r=[],i=10**e;for(let e=0,a=this.vertices.length;e<a;e++){let a=this.vertices[e],o=Math.round(a.x*i)+`_`+Math.round(a.y*i)+`_`+Math.round(a.z*i);t[o]===void 0?(t[o]=e,n.push(this.vertices[e]),r[e]=n.length-1):r[e]=r[t[o]]}let a=[];for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.a=r[t.a],t.b=r[t.b],t.c=r[t.c];let n=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(n[t]===n[(t+1)%3]){a.push(e);break}}for(let e=a.length-1;e>=0;e--){let t=a[e];this.faces.splice(t,1);for(let e=0,n=this.faceVertexUvs.length;e<n;e++)this.faceVertexUvs[e].splice(t,1)}let o=this.vertices.length-n.length;return this.vertices=n,o},setFromPoints:function(t){this.vertices=[];for(let n=0,r=t.length;n<r;n++){let r=t[n];this.vertices.push(new e.Vector3(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){let e=this.faces,t=e.length;for(let n=0;n<t;n++)e[n]._id=n;function n(e,t){return e.materialIndex-t.materialIndex}e.sort(n);let r=this.faceVertexUvs[0],i=this.faceVertexUvs[1],a,o;r&&r.length===t&&(a=[]),i&&i.length===t&&(o=[]);for(let n=0;n<t;n++){let t=e[n]._id;a&&a.push(r[t]),o&&o.push(i[t])}a&&(this.faceVertexUvs[0]=a),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){let e={metadata:{version:4.5,type:`Geometry`,generator:`Geometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}let t=[];for(let e=0;e<this.vertices.length;e++){let n=this.vertices[e];t.push(n.x,n.y,n.z)}let n=[],r=[],i={},a=[],o={},s=[],c={};for(let e=0;e<this.faces.length;e++){let t=this.faces[e],r=this.faceVertexUvs[0][e]!==void 0,i=t.normal.length()>0,a=t.vertexNormals.length>0,o=t.color.r!==1||t.color.g!==1||t.color.b!==1,s=t.vertexColors.length>0,c=0;if(c=l(c,0,0),c=l(c,1,!0),c=l(c,2,!1),c=l(c,3,r),c=l(c,4,i),c=l(c,5,a),c=l(c,6,o),c=l(c,7,s),n.push(c),n.push(t.a,t.b,t.c),n.push(t.materialIndex),r){let t=this.faceVertexUvs[0][e];n.push(f(t[0]),f(t[1]),f(t[2]))}if(i&&n.push(u(t.normal)),a){let e=t.vertexNormals;n.push(u(e[0]),u(e[1]),u(e[2]))}if(o&&n.push(d(t.color)),s){let e=t.vertexColors;n.push(d(e[0]),d(e[1]),d(e[2]))}}function l(e,t,n){return n?e|1<<t:e&~(1<<t)}function u(e){let t=e.x.toString()+e.y.toString()+e.z.toString();return i[t]===void 0?(i[t]=r.length/3,r.push(e.x,e.y,e.z),i[t]):i[t]}function d(e){let t=e.r.toString()+e.g.toString()+e.b.toString();return o[t]===void 0?(o[t]=a.length,a.push(e.getHex()),o[t]):o[t]}function f(e){let t=e.x.toString()+e.y.toString();return c[t]===void 0?(c[t]=s.length/2,s.push(e.x,e.y),c[t]):c[t]}return e.data={},e.data.vertices=t,e.data.normals=r,a.length>0&&(e.data.colors=a),s.length>0&&(e.data.uvs=[s]),e.data.faces=n,e},clone:function(){return new v().copy(this)},copy:function(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let e=0,n=t.length;e<n;e++)this.vertices.push(t[e].clone());let n=e.colors;for(let e=0,t=n.length;e<t;e++)this.colors.push(n[e].clone());let r=e.faces;for(let e=0,t=r.length;e<t;e++)this.faces.push(r[e].clone());for(let t=0,n=e.faceVertexUvs.length;t<n;t++){let n=e.faceVertexUvs[t];this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]);for(let e=0,r=n.length;e<r;e++){let r=n[e],i=[];for(let e=0,t=r.length;e<t;e++){let t=r[e];i.push(t.clone())}this.faceVertexUvs[t].push(i)}}let i=e.morphTargets;for(let e=0,t=i.length;e<t;e++){let t={};if(t.name=i[e].name,i[e].vertices!==void 0){t.vertices=[];for(let n=0,r=i[e].vertices.length;n<r;n++)t.vertices.push(i[e].vertices[n].clone())}if(i[e].normals!==void 0){t.normals=[];for(let n=0,r=i[e].normals.length;n<r;n++)t.normals.push(i[e].normals[n].clone())}this.morphTargets.push(t)}let a=e.morphNormals;for(let e=0,t=a.length;e<t;e++){let t={};if(a[e].vertexNormals!==void 0){t.vertexNormals=[];for(let n=0,r=a[e].vertexNormals.length;n<r;n++){let r=a[e].vertexNormals[n],i={};i.a=r.a.clone(),i.b=r.b.clone(),i.c=r.c.clone(),t.vertexNormals.push(i)}}if(a[e].faceNormals!==void 0){t.faceNormals=[];for(let n=0,r=a[e].faceNormals.length;n<r;n++)t.faceNormals.push(a[e].faceNormals[n].clone())}this.morphNormals.push(t)}let o=e.skinWeights;for(let e=0,t=o.length;e<t;e++)this.skinWeights.push(o[e].clone());let s=e.skinIndices;for(let e=0,t=s.length;e<t;e++)this.skinIndices.push(s[e].clone());let c=e.lineDistances;for(let e=0,t=c.length;e<t;e++)this.lineDistances.push(c[e]);let l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());let u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},computeGroups(){let e=[],t,n,r,i=this.faces;for(n=0;n<i.length;n++){let a=i[n];a.materialIndex!==r&&(r=a.materialIndex,t!==void 0&&(t.count=n*3-t.start,e.push(t)),t={start:n*3,materialIndex:r})}return t!==void 0&&(t.count=n*3-t.start,e.push(t)),e},toBufferGeometry:function(){let t=new y().fromGeometry(this),n=new e.BufferGeometry,r=new Float32Array(t.vertices.length*3);if(n.setAttribute(`position`,new e.BufferAttribute(r,3).copyVector3sArray(t.vertices)),t.normals.length>0){let r=new Float32Array(t.normals.length*3);n.setAttribute(`normal`,new e.BufferAttribute(r,3).copyVector3sArray(t.normals))}if(t.colors.length>0){let r=new Float32Array(t.colors.length*3);n.setAttribute(`color`,new e.BufferAttribute(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){let r=new Float32Array(t.uvs.length*2);n.setAttribute(`uv`,new e.BufferAttribute(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){let r=new Float32Array(t.uvs2.length*2);n.setAttribute(`uv2`,new e.BufferAttribute(r,2).copyVector2sArray(t.uvs2))}n.groups=t.groups;for(let r in t.morphTargets){let i=[],a=t.morphTargets[r];for(let t=0,n=a.length;t<n;t++){let n=a[t],r=new e.Float32BufferAttribute(n.data.length*3,3);r.name=n.name,i.push(r.copyVector3sArray(n.data))}n.morphAttributes[r]=i}if(t.skinIndices.length>0){let r=new e.Float32BufferAttribute(t.skinIndices.length*4,4);n.setAttribute(`skinIndex`,r.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){let r=new e.Float32BufferAttribute(t.skinWeights.length*4,4);n.setAttribute(`skinWeight`,r.copyVector4sArray(t.skinWeights))}return t.boundingSphere!==null&&(n.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(n.boundingBox=t.boundingBox.clone()),n},toIndexedBufferGeometry:function(){let t=new e.BufferGeometry,n=new Float32Array(this.vertices.length*3);if(t.setAttribute(`position`,new e.BufferAttribute(n,3).copyVector3sArray(this.vertices)),this.normals.length>0){let n=new Float32Array(this.normals.length),r=new e.BufferAttribute(n,3).copyArray(this.normals);t.setAttribute(`normal`,r)}if(this.uvs.length>0&&this.uvs[0].length>0){let n=new Float32Array(this.uvs[0].length*2);t.setAttribute(`uv`,new e.BufferAttribute(n,2).copyArray(this.uvs[0]))}if(this.uvs.length>1&&this.uvs[1].length>0){let n=new Float32Array(this.uvs[1].length*2);t.setAttribute(`uv2`,new e.BufferAttribute(n,2).copyArray(this.uvs[1]))}if(this.colors.length>0){let n=[];for(let t=0;t<this.colors.length;t++)n.push(new e.Color(this.colors[t]));let r=new Float32Array(n.length*3);t.setAttribute(`color`,new e.BufferAttribute(r,3).copyColorsArray(n))}else{let n=new Float32Array(this.vertices.length*3);for(let e=0;e<this.vertices.length*3;e++)n[e]=1;t.setAttribute(`color`,new e.BufferAttribute(n,3))}if(this.faces.length>0){let e=[],n=[];for(let t=0;t<this.faces.length;t++){n.push(this.faces[t].a,this.faces[t].b,this.faces[t].c);let r=this.faces[t].vertexColors;if(r.length===3)e.push(r[0],r[1],r[2]);else{let n=this.faces[t].color;e.push(n,n,n)}}t.setIndex(n),t.groups=this.computeGroups()}if(this.morphTargets.length>0){let n=[],r=[];for(let t=0,i=this.morphTargets.length;t<i;t++){let i=this.morphTargets[t],a=new e.Float32BufferAttribute(i.vertices.length*3,3);if(a.name=i.name,n.push(a.copyVector3sArray(i.vertices)),i.normals){let t=new e.Float32BufferAttribute(i.normals.length*3,3);t.name=i.name,r.push(t.copyVector3sArray(i.normals))}}t.morphAttributes.position=n,t.morphAttributes.normal=r}if(this.skinIndices.length>0){let n=new e.Float32BufferAttribute(this.skinIndices.length*4,4);t.setAttribute(`skinIndex`,n.copyVector4sArray(this.skinIndices))}if(this.skinWeights.length>0){let n=new e.Float32BufferAttribute(this.skinWeights.length*4,4);t.setAttribute(`skinWeight`,n.copyVector4sArray(this.skinWeights))}return this.boundingSphere!==null&&(t.boundingSphere=this.boundingSphere.clone()),this.boundingBox!==null&&(t.boundingBox=this.boundingBox.clone()),t},computeTangents:function(){console.error(`THREE.Geometry: .computeTangents() has been removed.`)},computeLineDistances:function(){console.error(`THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.`)},applyMatrix:function(e){return console.warn(`THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)},dispose:function(){this.dispatchEvent({type:`dispose`})}}),v.createBufferGeometryFromObject=function(t){let n=new e.BufferGeometry,r=t.geometry;if(t.isPoints||t.isLine){let t=new e.Float32BufferAttribute(r.vertices.length*3,3),i=new e.Float32BufferAttribute(r.colors.length*3,3);if(n.setAttribute(`position`,t.copyVector3sArray(r.vertices)),n.setAttribute(`color`,i.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let t=new e.Float32BufferAttribute(r.lineDistances.length,1);n.setAttribute(`lineDistance`,t.copyArray(r.lineDistances))}r.boundingSphere!==null&&(n.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(n.boundingBox=r.boundingBox.clone())}else t.isMesh&&(n=r.toBufferGeometry());return n};var y=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],n,r,i,a=e.faces;for(r=0;r<a.length;r++){let e=a[r];e.materialIndex!==i&&(i=e.materialIndex,n!==void 0&&(n.count=r*3-n.start,t.push(n)),n={start:r*3,materialIndex:i})}n!==void 0&&(n.count=r*3-n.start,t.push(n)),this.groups=t}fromGeometry(t){let n=t.faces,r=t.vertices,i=t.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=t.morphTargets,c=s.length,l;if(c>0){l=[];for(let e=0;e<c;e++)l[e]={name:s[e].name,data:[]};this.morphTargets.position=l}let u=t.morphNormals,d=u.length,f;if(d>0){f=[];for(let e=0;e<d;e++)f[e]={name:u[e].name,data:[]};this.morphTargets.normal=f}let p=t.skinIndices,m=t.skinWeights,h=p.length===r.length,g=m.length===r.length;r.length>0&&n.length===0&&console.error(`THREE.DirectGeometry: Faceless geometries are not supported.`);for(let t=0;t<n.length;t++){let _=n[t];this.vertices.push(r[_.a],r[_.b],r[_.c]);let v=_.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{let e=_.normal;this.normals.push(e,e,e)}let y=_.vertexColors;if(y.length===3)this.colors.push(y[0],y[1],y[2]);else{let e=_.color;this.colors.push(e,e,e)}if(a===!0){let n=i[0][t];n===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv `,t),this.uvs.push(new e.Vector2,new e.Vector2,new e.Vector2)):this.uvs.push(n[0],n[1],n[2])}if(o===!0){let n=i[1][t];n===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 `,t),this.uvs2.push(new e.Vector2,new e.Vector2,new e.Vector2)):this.uvs2.push(n[0],n[1],n[2])}for(let e=0;e<c;e++){let t=s[e].vertices;l[e].data.push(t[_.a],t[_.b],t[_.c])}for(let e=0;e<d;e++){let n=u[e].vertexNormals[t];f[e].data.push(n.a,n.b,n.c)}h&&this.skinIndices.push(p[_.a],p[_.b],p[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),this}},b=class{constructor(t,n,r,i,a,o=0){this.a=t,this.b=n,this.c=r,this.normal=i&&i.isVector3?i:new e.Vector3,this.vertexNormals=Array.isArray(i)?i:[],this.color=a&&a.isColor?a:new e.Color,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},x=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`,S=t.default.default||t.default;function C(e,t){let n=(e,t)=>{try{let n=new URL(e,t).href;if(e&&e.split(`?`).length<2){let e=t.split(`?`);e.length===2&&(n=n+`?`+e[1])}return n}catch{console.error(`There is an issue creating the url link with: ${e}.`)}};if(Array.isArray(e)){let r=[];return e.forEach(e=>{r.push(n(e,t))}),r}return n(e,t)}function w(e,t,n,r,i){let a=e.morphTargetInfluences,o;e.geometry&&(o=e.geometry.morphAttributes);let s=!1;if(a&&o&&o.position){r.set(0,0,0),i.set(0,0,0);for(let e=0;e<a.length;e++)a[e]>0&&(s=!0,n.setFromArray(o.position[e].array),r.add(n.min.multiplyScalar(a[e])),i.add(n.max.multiplyScalar(a[e])));s&&t.set(r,i)}s||t.setFromBufferAttribute(e.geometry.attributes.position),e.updateWorldMatrix(!0,!0),t.applyMatrix4(e.matrixWorld)}function T(e,t,n,r){fetch(e).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>{n(e,t)}).catch(t=>{console.error(`Fetch string payload retrieval failed for: ${requestURL}`,t),r(e)})}function E(e,t,n){let r=e.length,i=0,a=[];function o(e,n){a[n]=e,i++,i==r&&t(a)}for(let t=0;t<r;t++)T(e[t],t,o,n)}var D=(t,n)=>{let r=Math.floor(n/3),i=n%3,a=0;i==0?a=t[r].r:i==1?a=t[r].g:i==2&&(a=t[r].b);let o=new e.Color(a);return[o.r,o.g,o.b]},O=function(e,t){if(t&&e&&e.morphAttributes&&e.morphAttributes.color){let n=e.morphAttributes.color,r=t.morphTargetInfluences,i=r.length;e.deleteAttribute(`morphColor0`),e.deleteAttribute(`morphColor1`);let a=0,o=[];for(let e=0;1>a||e<i;e++)r[e]>0&&(a++,o.push([e,r[e]]));o.length==2?(e.setAttribute(`morphColor0`,n[o[0][0]]),e.setAttribute(`morphColor1`,n[o[1][0]])):o.length==1&&(e.setAttribute(`morphColor0`,n[o[0][0]]),e.setAttribute(`morphColor1`,n[o[0][0]]))}},k=(t,n)=>{let r;return t instanceof v?(n.localTimeEnabled&&!t.morphNormalsReady&&(t.morphNormals==null||t.morphNormals.length==0)&&t.computeMorphNormals(),r=t.toIndexedBufferGeometry(),n.localMorphColour&&A(t,r)):t instanceof e.BufferGeometry&&(r=t.clone()),r.colorsNeedUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),t._video&&(r._video=t._video),r},A=(t,n)=>{if(t&&t.morphColors&&t.morphColors.length>0){let r=[],i=t.morphColors;for(let t=0,n=i.length;t<n;t++){let n=i[t],a=[];for(let e=0;e<n.colors.length*3;e++){let t=D(n.colors,e);a.push(t[0],t[1],t[2])}let o=new e.Float32BufferAttribute(a,3);o.name=n.name,r.push(o)}n.morphAttributes.color=r}};function j(t){let n,r,i,a=-1,o=0;for(let e=0;e<t.length;++e){let s=t[e];if(n===void 0&&(n=s.array.constructor),n!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(r===void 0&&(r=s.itemSize),r!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(a===-1&&(a=s.gpuType),a!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;o+=s.count*r}let s=new n(o),c=new e.BufferAttribute(s,r,i),l=0;for(let e=0;e<t.length;++e){let n=t[e];if(n.isInterleavedBufferAttribute){let e=l/r;for(let t=0,i=n.count;t<i;t++)for(let i=0;i<r;i++){let r=n.getComponent(t,i);c.setComponent(t+e,i,r)}}else s.set(n.array,l);l+=n.count*r}return a!==void 0&&(c.gpuType=a),c}var M=(t,n=!1)=>{let r=t[0].index!==null,i=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),o={},s={},c=t[0].morphTargetsRelative,l=new e.BufferGeometry,u=0;for(let e=0;e<t.length;++e){let d=t[e],f=0;if(r!==(d.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let t in d.attributes){if(!i.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. All geometries must have compatible attributes; make sure "`+t+`" attribute exists among all geometries, or in none of them.`),null;o[t]===void 0&&(o[t]=[]),o[t].push(d.attributes[t]),f++}if(f!==i.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. Make sure all geometries have the same number of attributes.`),null;if(c!==d.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let t in d.morphAttributes){if(!a.has(t))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. .morphAttributes must be consistent throughout all geometries.`),null;s[t]===void 0&&(s[t]=[]),s[t].push(d.morphAttributes[t])}if(n){let t;if(r)t=d.index.count;else if(d.attributes.position!==void 0)t=d.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+e+`. The geometry must have either an index or a position attribute`),null;l.addGroup(u,t,e),u+=t}}if(r){let e=0,n=[];for(let r=0;r<t.length;++r){let i=t[r].index;for(let t=0;t<i.count;++t)n.push(i.getX(t)+e);e+=t[r].attributes.position.count}l.setIndex(n)}for(let e in o){let t=j(o[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;l.setAttribute(e,t)}for(let e in s){let t=s[e][0].length;if(t===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<s[e].length;++r)t.push(s[e][r][n]);let r=j(t);if(!r)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;l.morphAttributes[e].push(r)}}return l};function N(t,n){if(n&&t>=n.length){let r=new e.BufferGeometry,i=new Float32Array(t*3),a=0;return n.forEach(e=>{i[a++]=e[0],i[a++]=e[1],i[a++]=e[2]}),r.setAttribute(`position`,new e.BufferAttribute(i,3)),r.setDrawRange(0,n.length),r}}function P(){let t=new Image;t.src=x;let n=new e.Texture;return n.image=t,n.needsUpdate=!0,n}function F(e,t,n,r,i,a){let o=new S(e,t,n,r,i,a);return o.fontFace=r,o.fontSize=i,o.fontWeight=a,o.material.map.generateMipmaps=!1,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=1e4,o}function ee(e,t,n){if(n){let r=e||``,i=t||``,a=n.lastIndexOf(`/`);if(a>-1){let e,t;if(e=n.substring(0,a),t=n.substring(a+1),(e===`*`||e===`**`||e.toLowerCase()===r.toLowerCase())&&(t===`*`||t===`**`||t.toLowerCase()===i.toLowerCase()))return!0}else if(r.toLowerCase()===n.toLowerCase()||i.toLowerCase()===n.toLowerCase())return!0}return!1}function te(t,n,r){let i=t.getAttribute(`position`),a=t.getAttribute(`normal`);if(!i)return;let o=i.itemSize,s=n*o,c=o,l=!1,u=(n,i)=>{let a=!1,l=Array.from(n.array);if(l.length>=s+c){l.splice(s,c),r&&l.concat(Array(c).fill(0)),a=!0;let n=new Float32Array(l);t.setAttribute(i,new e.BufferAttribute(n,o)),t.getAttribute(i).needsUpdate=!0}return a};return l=u(i,`position`),a&&u(a,`normal`),t.index!==null&&console.warn(`Removing vertices from indexed geometry requires index buffer recalculation.`),l}var ne=function(){return function(e){e.vertexShader=e.vertexShader.replace(`#include <color_pars_vertex>`,[`varying vec3 vColor;`,`attribute vec3 morphColor0;`,`attribute vec3 morphColor1;`].join(`
3169
3169
  `)),e.vertexShader=e.vertexShader.replace(`#include <color_vertex>`,[`vColor.xyz = color.xyz;`,`#ifdef USE_MORPHTARGETS`,`vColor = morphColor0 * morphTargetInfluences[ 0 ];`,`vColor += morphColor1 * morphTargetInfluences[ 1 ];`,`#endif`].join(`
3170
- `))}},I=new e.Vector3,L=new e.Vector3,re=new e.Matrix4,R=new e.Ray,z=new e.Sphere,ie=new e.Vector3,B=new e.Vector3,V=new e.Vector3,ae=new e.Vector3,oe=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.LineBasicMaterial){super(),this.type=`Line`,this.geometry=t,this.material=n,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[0];for(let e=1,t=n.count;e<t;e++)I.fromBufferAttribute(n,e-1),L.fromBufferAttribute(n,e),r[e]=r[e-1],r[e]+=I.distanceTo(L);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}raycast(t,n){let r=this.geometry,i=this.matrixWorld,a=t.params.Line.threshold,o=r.drawRange,s=r.morphAttributes.position;if(r.boundingSphere===null&&r.computeBoundingSphere(),z.copy(r.boundingSphere),z.applyMatrix4(i),z.radius+=a,t.ray.intersectsSphere(z)===!1)return;re.copy(i).invert(),R.copy(t.ray).applyMatrix4(re);let c=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=c*c,u=new e.Vector3,d=new e.Vector3,f=new e.Vector3,p=new e.Vector3,m=this.isLineSegments?2:1;if(r.isBufferGeometry){let e=r.index,i=r.attributes.position;if(e!==null){let r=Math.max(0,o.start),a=Math.min(e.count,o.start+o.count);for(let o=r,c=a-1;o<c;o+=m){let r=e.getX(o),a=e.getX(o+1);if(H(u,d,this,i,s,r,a),R.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let c=t.ray.origin.distanceTo(p);c<t.near||c>t.far||n.push({distance:c,point:f.clone().applyMatrix4(this.matrixWorld),index:o,face:null,faceIndex:null,object:this})}}else{let e=Math.max(0,o.start),r=Math.min(i.count,o.start+o.count);for(let a=e,o=r-1;a<o;a+=m){if(H(u,d,this,i,s,a,a+1),R.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let e=t.ray.origin.distanceTo(p);e<t.near||e>t.far||n.push({distance:e,point:f.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error(`THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};function H(e,t,n,r,i,a,o){e.fromBufferAttribute(r,a),t.fromBufferAttribute(r,o);var s=n.morphTargetInfluences;if(n.material.morphTargets&&i&&s){ie.set(0,0,0),B.set(0,0,0);for(var c=0,l=i.length;c<l;c++){var u=s[c],d=i[c];u!==0&&(V.fromBufferAttribute(d,a),ae.fromBufferAttribute(d,o),ie.addScaledVector(V.sub(e),u),B.addScaledVector(ae.sub(t),u))}e.add(ie),t.add(B)}}oe.prototype.isLine=!0;var se=new e.Vector3,ce=new e.Vector3,le=class extends oe{constructor(e,t){super(e,t),this.type=`LineSegments`}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[];for(let e=0,t=n.count;e<t;e+=2)se.fromBufferAttribute(n,e),ce.fromBufferAttribute(n,e+1),r[e]=e===0?0:r[e-1],r[e+1]=r[e]+se.distanceTo(ce);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}};le.prototype.isLineSegments=!0;var ue=function(t){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=t,this.addLevel=(e,t)=>{if(e){let n=Math.abs(t),r;for(r=0;r<this.levels.length&&!(n<this.levels[r].distance);r++);let i={distance:n,morph:e,loaded:!0,loading:!1,url:``};this.levels.splice(r,0,i),e.renderOrder=this._renderOrder}},this.levelLoaded=(e,t)=>{if(e){let n=Math.abs(t);for(let t=0;t<this.levels.length;t++)if(n===this.levels[t].distance){this._parent.group.add(e),this.levels[t].morph=e,this.levels[t].loaded=!0,this.levels[t].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(e,t,n,r,i)=>{this._loader=e;let a=this.calculateDistance(t),o={distance:a,morph:void 0,loaded:!1,loading:!1,url:n,index:r},s;for(s=0;s<this.levels.length&&!(a<this.levels[s].distance);s++);this.levels.splice(s,0,o),i&&this.loadLevel(s)},this.loadLevel=e=>{let t=this.levels[e];return!t.morph&&!t.loaded&&!t.loading&&(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),t.morph===void 0},this.calculateDistance=function(e){this._parent.getBoundingBox();let t=this._parent.radius,n=0;return e===`far`?n=t*4.5:e===`medium`?n=t*2.5:e===`close`&&(n=0),n},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{let t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=e.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new e.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=e.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=e.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{let e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(t){return n=>{let r=this._material,i=k(n,{localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour}),a;this._parent.isGeometry?a=new e.Mesh(i,r):this._parent.isLines&&(a=new le(i,r)),a.userData=this._parent,a.renderOrder=this._renderOrder,n.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=t=>{if(this._material&&(this._material.vertexColors==e.VertexColors||this._material.vertexColors==1)){if(t){let e=this.getCurrentMorph();O(e.geometry,e)}else this.levels.forEach(e=>{e.morph&&e.morph.geometry&&O(e.morph.geometry,e.morph)})}},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),n()},this.setFrustumCulled=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=e.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)})},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach(t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)})},this.setVertexColors=e=>{this._material.vertexColors=e,n(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{let n=this.levels;if(n.length>1){let r=e.cameraObject.position.distanceTo(t),i=-1,a=-1,o,s;for(o=0,s=n.length;o<s&&r>=n[o].distance;o++)n[o].morph?(i>-1&&n[i].morph&&(n[i].morph.visible=!1),i=o,n[o].morph.visible=!0,a=-1):a=o;for(a>-1&&this.loadLevel(a);o<s;o++)n[o].morph&&(i>-1?n[o].morph.visible=!1:(n[o].morph.visible=!0,i=o));this._currentLevel!=i&&(this._currentLevel=i,this.checkTransparentMesh())}},this.toggleMarker=(e,t)=>{this.levels.forEach(n=>{n.morph&&(t?n.morph.add(e):n.morph.remove(e))})};let n=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)})}},U=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e`,de=new Image(128,128);de.src=U;var fe=new e.Texture;fe.image=de,fe.needsUpdate=!0;var W=[.02,.03,1],pe=new e.SpriteMaterial({map:fe,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),me=function(t){Object.getPrototypeOf(this)!==G.prototype&&Object.setPrototypeOf(me.prototype,G.prototype),G.call(this),this.texture=fe;let n,r,i,a,o,s=!0;this.morph=new e.Group,this.group=this.morph,this.parent=t,this.isMarker=!0;let c=!1;this.ndc=new e.Vector3;let l,u,d=()=>{n=new e.Sprite(pe),n.center.set(.5,0),this.morph.add(n),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,n.scale.set(W[0],W[1],W[2]),n.userData=this};this.updateVisual=(e,t)=>{let n=1,r=0;e!==t&&(r=1-(this.ndc.z-e)/(t-e),n=.6+r*.4),this.setSpriteSize(n)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,n)=>{this.morph.position.set(e,t,n)},this.setSpriteSize=e=>{n.scale.set(.015,.02,1),n.scale.multiplyScalar(e)},this.setUserSprite=()=>{a&&(this.morph.add(a),s&&=(this.morph.remove(n),u&&this.morph.remove(u),!1))},this.setImageForUserSprite=(t,n)=>{a&&=(this.morph.remove(a),void 0),r&&r.dispose(),i&&i.dispose(),r=new e.Texture,r.image=t,r.needsUpdate=!0,i=new e.SpriteMaterial({map:r,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),n||=[.05,.05,1],a=new e.Sprite(i),a.center.set(.5,0),a.scale.set(n[0],n[1],n[2]),a.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{s||(s=!0,this.morph.add(n),a&&this.morph.remove(a),u&&this.morph.add(u))},this.loadUserSprite=(e,t)=>{if(e){if(e!==o){o=e;let n=new Image(128,128);n.crossOrigin=`anonymous`,n.onload=()=>{this.setImageForUserSprite(n,t)},n.src=e}else this.setUserSprite()}},this.dispose=()=>{this.morph&&this.morph.clear(),n&&=(n.clear(),void 0),u&&=(u.material.map.dispose(),u.material.dispose(),void 0)},this.isEnabled=()=>c,this.setNumber=e=>{(!e||l!=e)&&(u&&=(this.morph.remove(u),u.material.map.dispose(),u.material.dispose(),void 0)),!u&&e&&(u=F(e,.012,`black`,`Asap`,120,700),this.morph.add(u)),l=e},this.getNumber=()=>l||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{c=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{c=!1,this.morph.visible=!1,this.visible=!1},d()},he=0,ge=function(){return`pr`+he++},G=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new e.Group,this._lod=new ue(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new e.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode=`inherited`,this.uuid=ge(),this._v1=new e.Vector3,this._v2=new e.Vector3,this._b1=new e.Box3,this.center=new e.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};G.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},G.prototype.getDuration=function(){return this.duration},G.prototype.setRegion=function(e){this.region=e},G.prototype.getRegion=function(){return this.region},G.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},G.prototype.getGroup=function(){return this.group},G.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);let t=this._lod.calculateDistance(`far`);this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},G.prototype.checkTransparentMesh=function(){},G.prototype.setMesh=function(t,n,r){this.animationGroup=new e.AnimationObjectGroup(t),this.mixer=new e.AnimationMixer(this.animationGroup);let i=t.geometry;if(this.geometry=t.geometry,this.clipAction=void 0,i&&i.morphAttributes){let t=i.morphAttributes.position;t||=i.morphAttributes.color?i.morphAttributes.color:i.morphAttributes.normal,t&&(this.animationClip=e.AnimationClip.CreateClipsFromMorphTargetSequences(t,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=e.LoopRepeat,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=n,this.morphColour=r,t.userData=this,t.matrixAutoUpdate=!1,this.setMorph(t),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(i.setAttribute(`morphTarget0`,i.getAttribute(`position`)),i.setAttribute(`morphTarget1`,i.getAttribute(`position`))),this.boundingBoxUpdateRequired=!0},G.prototype.setIsPickable=function(e){this.isPickable!==e&&(this.isPickable=e,this.region&&(this.region.pickableUpdateRequired=!0))},G.prototype.setAnatomicalId=function(e){this.anatomicalId=e},G.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},G.prototype.getCurrentTime=function(){if(this.clipAction){let e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},G.prototype.setMorphTime=function(e){let t=!1;if(this.clipAction){let n=e/this.duration*this.clipAction._clip.duration;n!=this.clipAction.time&&(this.clipAction.time=n,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{let n=e;n=e>this.duration?this.duration:0>e?0:e,n!=this.inbuildTime&&(this.inbuildTime=n,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},G.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},G.prototype.getVisibility=function(){return this.visible},G.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},G.prototype.setAlpha=function(e){let t=this._lod._material,n=!1;e<1&&(n=!0),t.opacity=e,t.transparent=n,this.checkTransparentMesh()},G.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},G.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},G.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},G.prototype.setColour=function(e){this._lod.setColour(e)},G.prototype.setGreyScale=function(t){if(t){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new e.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},G.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},G.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},G.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},G.prototype.setMaterial=function(e){this._lod.setMaterial(e)},G.prototype.getClosestVertexIndex=function(){let e=-1,t=this.getMorph();if(t&&t.geometry){let n=t.geometry.attributes.position;if(n){this._b1.setFromBufferAttribute(n),this._b1.getCenter(this._v1);let t=-1,r=0;for(let i=0;i<n.count;i++)this._v2.fromArray(n.array,i*3),r=this._v2.distanceTo(this._v1),t==-1?t=r:t>r&&(t=r,e=i)}}return e},G.prototype.getClosestVertex=function(t){let n=new e.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());let r=this.getMorph();if(r&&r.geometry&&this.closestVertexIndex>=0){let e=r.morphTargetInfluences,i=r.geometry.morphAttributes;if(e&&i&&i.position){let a=!1;for(let t=0;t<e.length;t++)e[t]>0&&(a=!0,this._v1.fromArray(i.position[t].array,this.closestVertexIndex*3),n.add(this._v1.multiplyScalar(e[t])));if(a)return t?n.applyMatrix4(r.matrixWorld):n}else return n.fromArray(r.geometry.attributes.position.array,this.closestVertexIndex*3),t?n.applyMatrix4(r.matrixWorld):n}return this.getBoundingBox(),n.copy(this.center),n},G.prototype.getBoundingBox=function(){if(this.visible){let e=this._lod.getCurrentMorph();if(e&&e.visible)return this.boundingBoxUpdateRequired&&=(w(e,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),!1),this.cachedBoundingBox}},G.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},G.prototype.markerIsRequired=function(e){return!!(this.visible&&(this.markerMode===`on`||e&&e.displayMarkers&&this.markerMode===`inherited`))},G.prototype.updateMarker=function(e,t){if(e==0&&this.markerIsRequired(t)){let e=t.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new me(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let e=this.getClosestVertex(!1);e&&(this.marker.setPosition(e.x,e.y,e.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(t.markersList&&!(this.marker.uuid in t.markersList)&&(e=!0,t.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),t&&t.camera&&(e||t.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(t.camera.cameraObject),t.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),t.markersList&&this.marker.uuid in t.markersList&&(t.markerCluster.markerUpdateRequired=!0,delete t.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},G.prototype.processMarkerVisual=function(e,t){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(e,t)},G.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},G.prototype.setRenderOrder=function(e){this._lod.setRenderOrder(e)},G.prototype.getClosestVertexDOMElementCoords=function(e){if(e&&e.camera){let t=!0,n=this.getClosestVertex(!0);return n.project(e.camera),n.z=Math.min(Math.max(n.z,0),1),(n.x>1||n.x<-1||n.y>1||n.y<-1)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(n.x,n.y,n),{position:n,inView:t}}},G.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode=e===`on`||e===`off`?e:`inherited`,this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},G.prototype.render=function(e,t,n,r){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(n,this.center),t==1){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t}this.visible&&e!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,r)},G.prototype.addLOD=function(e,t,n,r,i){this._lod.addLevelFromURL(e,t,n,r,i)},G.prototype.addVertices=function(e){let t=this.getMorph(),n;if(!t)n=N(500,e),this.drawRange=e.length;else if(this.drawRange>-1){let r=t.geometry.getAttribute(`position`);e.forEach(e=>{r.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange}),r.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),n=t.geoemtry,this.boundingBoxUpdateRequired=!0}return n},G.prototype.deleteVertices=function(e){let t=this.getMorph();return t?.geometry&&this.drawRange>=e&&te(t.geometry,e,!0)?(--this.drawRange,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},G.prototype.setPosition=function(e,t,n){let r=this.getGroup();r&&(r.position.set(e,t,n),r.matrixWorldNeedsUpdate=!0,r.updateMatrix(),r.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},G.prototype.loadAdditionalSources=function(e,t){e.load(filename,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},G.prototype.setScaleAll=function(e){let t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)};var _e=(t,n,r)=>{let i=k(t,r),a=!1;1>r.opacity&&(a=!0);let o;if(i._video===void 0){let t=r.localTimeEnabled||r.localMorphColour;n?(o=n,o.morphTargets=t,o.morphNormals=r.localTimeEnabled):o=i instanceof e.BufferGeometry&&i.attributes.color===void 0?new e.MeshPhongMaterial({color:r.colour,morphTargets:t,morphNormals:r.localTimeEnabled,transparent:a,opacity:r.opacity,side:e.DoubleSide}):new e.MeshPhongMaterial({color:r.colour,morphTargets:t,morphNormals:r.localTimeEnabled,vertexColors:e.VertexColors,transparent:a,opacity:r.opacity,side:e.DoubleSide}),r.localMorphColour&&i.morphAttributes.color&&(o.onBeforeCompile=ne())}else{let t=i._video.createCanvasVideoTexture();o=new e.MeshBasicMaterial({morphTargets:r.localTimeEnabled,color:new e.Color(1,1,1),transparent:a,opacity:r.opacity,map:t,side:e.DoubleSide}),(void 0).videoHandler=i._video}return new e.Mesh(i,o)},ve=function(){G.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,n)=>{if(this.morph&&this.morph.geometry&&e!=null)return;let r=_e(e,t,n);this.setMesh(r,n.localTimeEnabled,n.localMorphColour)},this.calculateUVs=()=>{this.geometry.computeBoundingBox();let t=this.geometry.boundingBox.max,n=this.geometry.boundingBox.min,r=new e.Vector2(0-n.x,0-n.y),i=new e.Vector2(t.x-n.x,t.y-n.y);this.geometry.faceVertexUvs[0]=[];for(let t=0;t<this.geometry.faces.length;t++){let n=this.geometry.vertices[this.geometry.faces[t].a],a=this.geometry.vertices[this.geometry.faces[t].b],o=this.geometry.vertices[this.geometry.faces[t].c];geometry.faceVertexUvs[0].push([new e.Vector2((n.x+r.x)/i.x,(n.y+r.y)/i.y),new e.Vector2((a.x+r.x)/i.x,(a.y+r.y)/i.y),new e.Vector2((o.x+r.x)/i.x,(o.y+r.y)/i.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=e=>{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){let n=this.getMorph(),r=n.geometry.getAttribute(`position`);if(!n||0>t)return;{let i=t*3;e.forEach(e=>{r.array[i++]=e[0],r.array[i++]=e[1],r.array[i++]=e[2]}),r.needsUpdate=!0,n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}}};ve.prototype=Object.create(G.prototype);var ye=t.default.default||t.default,be=function(e,t){let n=e,r,i=500;r=t?new ye(n,.012,t.getStyle()):new ye(n,.012),r.fontFace=`Asap`,r.fontWeight=i,r.material.map.generateMipmaps=!1,r.material.sizeAttenuation=!1,r.center.x=-.05,r.center.y=0;let a=[r.scale.x,r.scale.y];this.getPosition=()=>r?[r.position.x,r.position.y,r.position.z]:[0,0,0],this.setPosition=(e,t,n)=>{r&&r.position.set(e,t,n)},this.setColour=e=>{e&&(r.color=e.getStyle())},this.setScale=e=>{r&&e>0&&r.scale.set(e,e,1)},this.setDepthTest=e=>{e&&e!==r.material.depthTest&&(r.material.depthTest=e)},this.setSize=e=>{e>0&&(r.scale.x=a[0]*e,r.scale.y=a[1]*e)},this.setFontWeight=e=>{e&&e!==i&&(r.fontWeight=e,i=e)},this.setText=e=>{e&&e!==r.text&&(r.text=e,n=e)},this.setVisibility=e=>{r.visible=e},this.dispose=()=>{},this.getSprite=()=>r,this.getString=()=>n},xe=function(t,n,r,i){G.call(this);let a;n&&(a=n.clone(),a.vertexColors=e.FaceColors);let o=i;this.id=r;let s,c;this.isGlyph=!0;let l=[0,0,0];this.fromMesh=e=>e&&e.isMesh?(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,t&&a&&this.fromMesh(new e.Mesh(t,a)),this.getGlyphset=function(){return o},this.setLabel=e=>{e&&(typeof e==`string`||e instanceof String)&&(c=e,this.morph&&(this.morph.name=e))},this.showLabel=e=>{if(s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0),c&&(typeof c==`string`||c instanceof String)){s=new be(c,e),s.setPosition(l[0],l[1],l[2]);let t=s.getSprite();t.material.alphaTest=.5,t.material.transparent=!0,t.material.depthWrite=!1,this.group.add(s.getSprite())}},this.hideLabel=()=>{s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0)},this.getLabel=()=>c,this.getMesh=()=>this.morph,this.setTransformation=(e,t,n,r)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=n[0],this.morph.matrix.elements[5]=n[1],this.morph.matrix.elements[6]=n[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=r[0],this.morph.matrix.elements[9]=r[1],this.morph.matrix.elements[10]=r[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),l=[...e],s&&s.setPosition(e[0],e[1],e[2])},this.setColour=e=>{s&&s.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};xe.prototype=Object.create(G.prototype);function Se(){}Se.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(Se.prototype,{crossOrigin:`anonymous`,onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(function(){var t={NoBlending:e.NoBlending,NormalBlending:e.NormalBlending,AdditiveBlending:e.AdditiveBlending,SubtractiveBlending:e.SubtractiveBlending,MultiplyBlending:e.MultiplyBlending,CustomBlending:e.CustomBlending},n=new e.Color,r=new e.TextureLoader,i=new e.MaterialLoader;return function(a,o,s){var c={};function l(t,n,i,a,l){var u=o+t,d=Se.Handlers.get(u),f;d===null?(r.setCrossOrigin(s),f=r.load(u)):f=d.load(u),n!==void 0&&(f.repeat.fromArray(n),n[0]!==1&&(f.wrapS=e.RepeatWrapping),n[1]!==1&&(f.wrapT=e.RepeatWrapping)),i!==void 0&&f.offset.fromArray(i),a!==void 0&&(a[0]===`repeat`&&(f.wrapS=e.RepeatWrapping),a[0]===`mirror`&&(f.wrapS=e.MirroredRepeatWrapping),a[1]===`repeat`&&(f.wrapT=e.RepeatWrapping),a[1]===`mirror`&&(f.wrapT=e.MirroredRepeatWrapping)),l!==void 0&&(f.anisotropy=l);var p=e.MathUtils.generateUUID();return c[p]=f,p}var u={uuid:e.MathUtils.generateUUID(),type:`MeshLambertMaterial`};for(var d in a){var f=a[d];switch(d){case`DbgColor`:case`DbgIndex`:case`opticalDensity`:case`illumination`:break;case`DbgName`:u.name=f;break;case`blending`:u.blending=t[f];break;case`colorAmbient`:case`mapAmbient`:console.warn(`THREE.Loader.createMaterial:`,d,`is no longer supported.`);break;case`colorDiffuse`:u.color=n.fromArray(f).getHex();break;case`colorSpecular`:u.specular=n.fromArray(f).getHex();break;case`colorEmissive`:u.emissive=n.fromArray(f).getHex();break;case`specularCoef`:u.shininess=f;break;case`shading`:f.toLowerCase()===`basic`&&(u.type=`MeshBasicMaterial`),f.toLowerCase()===`phong`&&(u.type=`MeshPhongMaterial`),f.toLowerCase()===`standard`&&(u.type=`MeshStandardMaterial`);break;case`mapDiffuse`:u.map=l(f,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);break;case`mapDiffuseRepeat`:case`mapDiffuseOffset`:case`mapDiffuseWrap`:case`mapDiffuseAnisotropy`:break;case`mapEmissive`:u.emissiveMap=l(f,a.mapEmissiveRepeat,a.mapEmissiveOffset,a.mapEmissiveWrap,a.mapEmissiveAnisotropy);break;case`mapEmissiveRepeat`:case`mapEmissiveOffset`:case`mapEmissiveWrap`:case`mapEmissiveAnisotropy`:break;case`mapLight`:u.lightMap=l(f,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);break;case`mapLightRepeat`:case`mapLightOffset`:case`mapLightWrap`:case`mapLightAnisotropy`:break;case`mapAO`:u.aoMap=l(f,a.mapAORepeat,a.mapAOOffset,a.mapAOWrap,a.mapAOAnisotropy);break;case`mapAORepeat`:case`mapAOOffset`:case`mapAOWrap`:case`mapAOAnisotropy`:break;case`mapBump`:u.bumpMap=l(f,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);break;case`mapBumpScale`:u.bumpScale=f;break;case`mapBumpRepeat`:case`mapBumpOffset`:case`mapBumpWrap`:case`mapBumpAnisotropy`:break;case`mapNormal`:u.normalMap=l(f,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);break;case`mapNormalFactor`:u.normalScale=f;break;case`mapNormalRepeat`:case`mapNormalOffset`:case`mapNormalWrap`:case`mapNormalAnisotropy`:break;case`mapSpecular`:u.specularMap=l(f,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);break;case`mapSpecularRepeat`:case`mapSpecularOffset`:case`mapSpecularWrap`:case`mapSpecularAnisotropy`:break;case`mapMetalness`:u.metalnessMap=l(f,a.mapMetalnessRepeat,a.mapMetalnessOffset,a.mapMetalnessWrap,a.mapMetalnessAnisotropy);break;case`mapMetalnessRepeat`:case`mapMetalnessOffset`:case`mapMetalnessWrap`:case`mapMetalnessAnisotropy`:break;case`mapRoughness`:u.roughnessMap=l(f,a.mapRoughnessRepeat,a.mapRoughnessOffset,a.mapRoughnessWrap,a.mapRoughnessAnisotropy);break;case`mapRoughnessRepeat`:case`mapRoughnessOffset`:case`mapRoughnessWrap`:case`mapRoughnessAnisotropy`:break;case`mapAlpha`:u.alphaMap=l(f,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);break;case`mapAlphaRepeat`:case`mapAlphaOffset`:case`mapAlphaWrap`:case`mapAlphaAnisotropy`:break;case`flipSided`:u.side=e.BackSide;break;case`doubleSided`:u.side=e.DoubleSide;break;case`transparency`:console.warn(`THREE.Loader.createMaterial: transparency has been renamed to opacity`),u.opacity=f;break;case`depthTest`:case`depthWrite`:case`colorWrite`:case`opacity`:case`reflectivity`:case`transparent`:case`visible`:case`wireframe`:u[d]=f;break;case`vertexColors`:f===!0&&(u.vertexColors=e.VertexColors),f===`face`&&(u.vertexColors=e.FaceColors);break;default:console.error(`THREE.Loader.createMaterial: Unsupported`,d,f)}}return u.type===`MeshBasicMaterial`&&delete u.emissive,u.type!==`MeshPhongMaterial`&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(c),i.parse(u)}})()});var Ce=function(t){var n=this;this.video=void 0,this.videoTexture=void 0;var r=t,i=function(){document&&(n.video=document.createElement(`video`),n.video.crossOrigin=`anonymous`,n.video.src=r,n.video.load(),n.video.loop=!0)};this.setMorphTime=function(e,t){var r=e/t*n.video.duration;n.video.currentTime=r},this.getVideoDuration=function(){return n.video.duration},this.createCanvasVideoTexture=function(){return n.videoTexture=new e.VideoTexture(n.video),n.videoTexture.minFilter=e.LinearFilter,n.videoTexture.magFilter=e.LinearFilter,n.videoTexture.format=e.RGBFormat,n.video.currentTime=0,n.videoTexture},this.getCurrentTime=function(e){return n.video?e*(n.video.currentTime/n.video.duration):0},this.isReadyToPlay=function(){return!!(n.video&&n.video.readyState>=3)},i()},we=e.AnimationClip,Te=e.Color,Ee=e.DefaultLoadingManager,De=e.FileLoader,Oe=e.LoaderUtils,ke=e.Vector2,Ae=e.Vector3,je=e.Vector4;function Me(e){typeof e==`boolean`&&(console.warn(`THREE.JSONLoader: showStatus parameter has been removed from constructor.`),e=void 0),this.manager=e===void 0?Ee:e,this.withCredentials=!1,this.paramsString=``}Object.assign(Me.prototype,{load:function(e,t,n,r){var i=this,a=this.texturePath&&typeof this.texturePath==`string`?this.texturePath:Oe.extractUrlBase(e),o=new De(this.manager);e.split(`?`),this.paramsString=e.length===2?paramsStrings[1]:``,o.setWithCredentials(this.withCredentials),o.load(e,function(n){var o=void 0;try{o=JSON.parse(n)}catch{if(console.error(`The loader has encountered an error while parsing the content of a resource.`),r){r({responseURL:e});return}}var s=o.metadata;if(s!==void 0){var c=s.type;if(c!==void 0&&c.toLowerCase()===`object`){console.error(`THREE.JSONLoader: `+e+` should be loaded with THREE.ObjectLoader instead.`);return}}if(i&&i.parse)try{var l=i.parse(o,a);t(l.geometry,l.materials)}catch(t){if(console.error(`The loader has encountered aon loading the geometry`),console.error(t),r){r({responseURL:e});return}}},n,r)},setTexturePath:function(e){this.texturePath=e},parse:(function(){function t(e,t){function n(e,t){return e&1<<t}var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,x,S,C,w,T,E,D,O,k,A,j=e.faces,M=e.vertices,N=e.normals,P=e.colors,F=e.scale,ee=0;if(e.uvs!==void 0){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&ee++;for(r=0;r<ee;r++)t.faceVertexUvs[r]=[]}for(o=0,s=M.length;o<s;)x=new Ae,x.x=M[o++]*F,x.y=M[o++]*F,x.z=M[o++]*F,t.vertices.push(x);if(o=0,s=j.length,e.uvs)for(r=0;r<e.uvs.length;r++){t.uvs[r]=[];for(let n=0;n<e.uvs[r].length;n++)t.uvs[r][n]=e.uvs[r][n]}if(N)for(r=0;r<N.length;r++)t.normals[r]=N[r];if(P)for(r=0;r<P.length;r++)t.colors[r]=P[r];for(;o<s;)if(f=j[o++],p=n(f,0),m=n(f,1),h=n(f,3),g=n(f,4),_=n(f,5),v=n(f,6),y=n(f,7),p){if(C=new b,C.a=j[o],C.b=j[o+1],C.c=j[o+3],w=new b,w.a=j[o+1],w.b=j[o+2],w.c=j[o+3],o+=4,m&&(d=j[o++],C.materialIndex=d,w.materialIndex=d),a=t.faces.length,h)for(r=0;r<ee;r++)for(D=e.uvs[r],t.faceVertexUvs[r][a]=[],t.faceVertexUvs[r][a+1]=[],i=0;i<4;i++)u=j[o++],k=D[u*2],A=D[u*2+1],O=new ke(k,A),i!==2&&t.faceVertexUvs[r][a].push(O),i!==0&&t.faceVertexUvs[r][a+1].push(O);if(g&&(l=j[o++]*3,C.normal.set(N[l++],N[l++],N[l]),w.normal.copy(C.normal)),_)for(r=0;r<4;r++)l=j[o++]*3,E=new Ae(N[l++],N[l++],N[l]),r!==2&&C.vertexNormals.push(E),r!==0&&w.vertexNormals.push(E);if(v&&(c=j[o++],T=P[c],C.color.setHex(T),w.color.setHex(T)),y)for(r=0;r<4;r++)c=j[o++],T=P[c],r!==2&&C.vertexColors.push(new Te(T)),r!==0&&w.vertexColors.push(new Te(T));t.faces.push(C),t.faces.push(w)}else{if(S=new b,S.a=j[o++],S.b=j[o++],S.c=j[o++],S.b||(S.b=S.a),S.c||(S.c=S.b),m&&(d=j[o++],S.materialIndex=d),a=t.faces.length,h)for(r=0;r<ee;r++)for(D=e.uvs[r],t.faceVertexUvs[r][a]=[],i=0;i<3;i++)u=j[o++],k=D[u*2],A=D[u*2+1],O=new ke(k,A),t.faceVertexUvs[r][a].push(O);if(g&&(l=j[o++]*3,S.normal.set(N[l++],N[l++],N[l])),_)for(r=0;r<3;r++)l=j[o++]*3,E=new Ae(N[l++],N[l++],N[l]),S.vertexNormals.push(E);if(v&&(c=j[o++],S.color.setHex(P[c])),y)for(r=0;r<3;r++)c=j[o++],S.vertexColors.push(new Te(P[c]));t.faces.push(S)}}function n(e,t){var n=e.influencesPerVertex===void 0?2:e.influencesPerVertex;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;r<i;r+=n){var a=e.skinWeights[r],o=n>1?e.skinWeights[r+1]:0,s=n>2?e.skinWeights[r+2]:0,c=n>3?e.skinWeights[r+3]:0;t.skinWeights.push(new je(a,o,s,c))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;r<i;r+=n){var l=e.skinIndices[r],u=n>1?e.skinIndices[r+1]:0,d=n>2?e.skinIndices[r+2]:0,f=n>3?e.skinIndices[r+3]:0;t.skinIndices.push(new je(l,u,d,f))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn(`When skinning, number of vertices (`+t.vertices.length+`), skinIndices (`+t.skinIndices.length+`), and skinWeights (`+t.skinWeights.length+`) should match.`)}function r(t,n){var r=t.scale;if(t.morphTargets!==void 0)for(var i=0,a=t.morphTargets.length;i<a;i++){n.morphTargets[i]={},n.morphTargets[i].name=t.morphTargets[i].name,n.morphTargets[i].vertices=[];for(var o=n.morphTargets[i].vertices,s=t.morphTargets[i].vertices,c=0,l=s.length;c<l;c+=3){var u=new Ae;u.x=s[c]*r,u.y=s[c+1]*r,u.z=s[c+2]*r,o.push(u)}}if(t.morphNormals!==void 0){for(var i=0,a=t.morphNormals.length;i<a;i++)if(n.morphTargets[i]){n.morphTargets[i].normals=[];for(var d=n.morphTargets[i].normals,f=t.morphNormals[i].normals,c=0,l=f.length;c<l;c+=3){var p=new Ae;p.x=f[c],p.y=f[c+1],p.z=f[c+2],d.push(p)}n.morphNormalsReady=!0}}if(t.morphColors!==void 0){var i,a,m,h,g,_,v;for(i=0,a=t.morphColors.length;i<a;i++)for(n.morphColors[i]={},n.morphColors[i].name=t.morphColors[i].name,n.morphColors[i].colors=[],g=n.morphColors[i].colors,_=t.morphColors[i].colors,m=0,h=_.length;m<h;m+=3)v=new e.Color(16755200),v.setRGB(_[m],_[m+1],_[m+2]),g.push(v)}}function i(e,t){var n=[],r=[];e.animation!==void 0&&r.push(e.animation),e.animations!==void 0&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var i=0;i<r.length;i++){var a=we.parseAnimation(r[i],t.bones);a&&n.push(a)}if(t.morphTargets){var o=we.CreateClipsFromMorphTargetSequences(t.morphTargets,10);n=n.concat(o)}n.length>0&&(t.animations=n)}return function(a,o){a.data!==void 0&&(a=a.data),a.scale===void 0?a.scale=1:a.scale=1/a.scale;var s=new v;if(s.morphColors=[],t(a,s),n(a,s),r(a,s),i(a,s),s.computeFaceNormals(),s.computeBoundingSphere(),a.materials===void 0||a.materials.length===0)return{geometry:s};var c=Se.prototype.initMaterials(a.materials,o,`Anonymous`);if(a.materials[0].video){var l=o+a.materials[0].video;this.paramsString&&(l+=`?${this.paramsString}`),s._video=new Ce(l)}return c&&c.length>0&&(a.materials[0].singleSided?c[0].side=e.FrontSide:a.materials[0].flipSided?c[0].side=e.BackSide:c[0].side=e.DoubleSide,a.materials[0].specularCoef&&(c[0].shininess=Math.floor(a.materials[0].specularCoef/3))),{geometry:s,materials:c}}})()});var Ne=function(){G.call(this);let t=[],n,r,i,a,o,s,c,l=0,u=0,d=[0,0,0],f=[0,0,0],p=!1,m=[0,0,0],h=`NONE`;this.ready=!1;let g=!1,_=!1;this.isGlyphset=!0;let v=new e.Matrix4,y=new e.Color,b=new e.Color,x=new e.Box3,S=new e.Box3,C=new e.Box3,w=[],T=[],E=[],D=[],O=[],k=[],A=[],j=[];this.globalScale=1;for(let t=0;t<8;t++)w[t]=new e.Vector3;this.load=(t,p,v,y,b)=>{n=t.axis1,r=t.axis2,i=t.axis3,a=t.positions,o=t.scale,s=t.colors,c=t.label,g=t.metadata.MorphColours,_=t.metadata.MorphVertices,l=t.metadata.number_of_time_steps,h=t.metadata.repeat_mode,u=t.metadata.number_of_vertices,h==`AXES_2D`||h==`MIRROR`?u*=2:h==`AXES_3D`&&(u*=3),d=t.metadata.base_size,f=t.metadata.offset,m=t.metadata.scale_factors;let x=new Me;this.geometry=new e.BufferGeometry;let S=new e.InstancedMesh(this.geometry,void 0,u);if(this.setMorph(S),y){var C=x.parse(p);te(v,b)(C.geometry,C.materials),C.geometry.dispose()}else x.crossOrigin=`Anonymous`,x.load(p,te(v,b))};let M=(e,t,n,r,i,a)=>{if(h==`NONE`||h==`MIRROR`){let c=[0,0,0],l=[0,0,0],u=[0,0,0],p=[0,0,0],g=[0,0,0],_=[0,0,0],v=[0,0,0],y=[0,0,0],b=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;c[o]=(s*d[o]+i[o]*m[o])*this.globalScale}for(var o=0;o<3;o++)l[o]=t[o]*c[0],u[o]=n[o]*c[1],p[o]=r[o]*c[2],g[o]=e[o]+f[0]*l[o]+f[1]*u[o]+f[2]*p[o],h==`MIRROR`&&(_[o]=-l[o],v[o]=-u[o],y[o]=-p[o],b[o]=g[o],i[0]<0&&(g[o]-=l[o],b[o]-=_[o]));0>p[0]*(l[1]*u[2]-l[2]*u[1])+p[1]*(l[2]*u[0]-l[0]*u[2])+p[2]*(l[0]*u[1]-l[1]*u[0])&&(p[0]=-p[0],p[1]=-p[1],p[2]=-p[2]),a[0]=[g,l,u,p],h==`MIRROR`&&(0>y[0]*(_[1]*v[2]-_[2]*v[1])+y[1]*(_[2]*v[0]-_[0]*v[2])+y[2]*(_[0]*v[1]-_[1]*v[0])&&(y[0]=-y[0],y[1]=-y[1],y[2]=-y[2]),a[1]=[b,_,v,y])}else if(h==`AXES_2D`||h==`AXES_3D`){let l=[0,0,0],u=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;l[o]=(s*d[0]+i[o]*m[0])*this.globalScale}for(var o=0;o<3;o++)u[o]=e[o]+f[0]*l[0]*t[o]+f[1]*l[1]*n[o]+f[2]*l[2]*r[o];let p=glyph_repeat_mode==`AXES_2D`?2:3;for(let e=0;e<p;e++){let o,s,l=i[e],f=[0,0,0],p=[0,0,0],g=[0,0,0];e==0?(o=t,s=n):e==1?(o=n,s=glyph_repeat_mode==`AXES_2D`?t:r):(o=r,s=t);let _=(d[0]+l*m[0])*this.globalScale;f[0]=o[0]*_,f[1]=o[1]*_,f[2]=o[2]*_,g[0]=f[1]*s[2]-s[1]*f[2],g[1]=f[2]*s[0]-s[2]*f[0],g[2]=f[0]*s[1]-f[1]*s[0];let v=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]);if(0<v){let t=(d[2]+l*m[2])*this.globalScale/v;h==`AXES_2D`&&e>0&&(t*=-1),g[0]*=t,g[1]*=t,g[2]*=t}if(p[0]=g[1]*f[2]-f[1]*g[2],p[1]=g[2]*f[0]-f[2]*g[0],p[2]=g[0]*f[1]-g[1]*f[0],v=Math.sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]),0<v){var c=(d[1]+l*m[1])*this.globalScale/v;p[0]*=c,p[1]*=c,p[2]*=c}a[e]=[u,f,p,g]}}return a},N=(e,n,r,i,a)=>{let o=1;h==`AXES_2D`||h==`MIRROR`?o=2:h==`AXES_3D`&&(o=3);let s=e.length/3,c=0;j.length=o;for(let l=0;l<s;l++){let s=l*3,u=[e[s],e[s+1],e[s+2]],d=[n[s],n[s+1],n[s+2]],f=[r[s],r[s+1],r[s+2]],p=[i[s],i[s+1],i[s+2]],m=[a[s],a[s+1],a[s+2]],h=M(u,d,f,p,m,j);if(h.length==o)for(let e=0;e<o;e++){v.elements[0]=h[e][1][0],v.elements[1]=h[e][1][1],v.elements[2]=h[e][1][2],v.elements[3]=0,v.elements[4]=h[e][2][0],v.elements[5]=h[e][2][1],v.elements[6]=h[e][2][2],v.elements[7]=0,v.elements[8]=h[e][3][0],v.elements[9]=h[e][3][1],v.elements[10]=h[e][3][2],v.elements[11]=0,v.elements[12]=h[e][0][0],v.elements[13]=h[e][0][1],v.elements[14]=h[e][0][2],v.elements[15]=1,this.morph.setMatrixAt(c,v);let n=t[c];n&&n.setTransformation(h[e][0],h[e][1],h[e][2],h[e][3]),c++}}this.morph.instanceMatrix.needsUpdate=!0},P=e=>{let n=1;h==`AXES_2D`||h==`MIRROR`?n=2:h==`AXES_3D`&&(n=3);let r=e.length,i=0;for(let a=0;a<r;a++){let r=e[a];for(let e=0;e<n;e++){y.setHex(r),this.morph.setColorAt(i,y);let e=t[i];e&&e.setColour(y),i++}}this.morph.instanceColor.needsUpdate=!0},F=()=>{let e=T,t=E,c=D,u=O,d=k,f=A,p=this.inbuildTime/this.duration*(l-1),m=Math.floor(p),h=1-(p-m),v=Math.ceil(p);if(_){let s=a[m.toString()],l=a[v.toString()],f=n[m.toString()],p=n[v.toString()],g=r[m.toString()],_=r[v.toString()],y=i[m.toString()],b=i[v.toString()],x=o[m.toString()],S=o[v.toString()];T.length=s.length,E.length=s.length,D.length=s.length,O.length=s.length,k.length=s.length;for(let n=0;n<s.length;n++)e[n]=h*s[n]+(1-h)*l[n],t[n]=h*f[n]+(1-h)*p[n],c[n]=h*g[n]+(1-h)*_[n],u[n]=h*y[n]+(1-h)*b[n],d[n]=h*x[n]+(1-h)*S[n]}else e=a[0],t=n[0],c=r[0],u=i[0],d=o[0];if(N(e,t,c,u,d),this.boundingBoxUpdateRequired=!0,s!=null){if(g){let e=s[m.toString()],t=s[v.toString()];f.length=e.length;for(let n=0;n<e.length;n++)y.setHex(e[n]),b.setHex(t[n]),y.setRGB(y.r*h+b.r*(1-h),y.g*h+b.g*(1-h),y.b*h+b.b*(1-h)),f[n]=y.getHex()}else f=s[0];P(f)}};this.getLabel=e=>{if(c&&c.length>e)return c[e]},this.isLabelDisplayed=()=>p,this.canShowLabel=()=>t?.length&&(c?.length||this.groupName),this.showLabel=()=>{if(t?.length){p=!0;for(let e=0;e<t.length;e++)t[e].showLabel(this.morph.material?this.morph.material.color:void 0)}},this.hideLabel=()=>{for(let e=0;e<t.length;e++)t[e].hideLabel();p=!1};let ee=e=>{for(let e=0;e<u;e++){let n=new xe(void 0,void 0,e,this),r=c?c[e]:void 0;r||=this.groupName,r&&n.setLabel(r),l>0&&n.setFrustumCulled(!1),t[e]=n,this.morph.add(n.getGroup())}c&&e&&this.showLabel(),N(a[0],n[0],r[0],i[0],o[0]),s!=null&&P(s[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=e=>{e.isGlyph&&t.push(e),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(e,n)=>{if(e.isMesh){let r=new xe(void 0,void 0,n,this);return r.fromMesh(e),t.push(r),this.morph.add(r.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,r}},this.forEachGlyph=e=>{for(let n=0;n<t.length;n++)e(t[n])};var te=(e,t)=>(n,r)=>{let i=n.toBufferGeometry();this.geometry.copy(i),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),i.dispose(),r&&r[0]&&(this.morph.material=r[0]),ee(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),n.dispose(),e!=null&&typeof e==`function`&&e(this)};this.getClosestVertexIndex=function(){let e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let t=a[0],n=t.length/3,r=-1,i=0;for(let a=0;a<n;a++){let n=a*3;this._v2.set(t[n],t[n+1],t[n+2]),i=this._v1.distanceTo(this._v2),(r==-1||r>i)&&(r=i,e=a)}}return e},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let t=new e.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,v),t.setFromMatrixPosition(v),t}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){x.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let e=0;e<u;e++)this.morph.getMatrixAt(e,v),S.copy(x).applyMatrix4(v),e==0?C.copy(S):C.union(S);if(C)this.cachedBoundingBox.copy(C),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(g||_)&&(F(),_&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||l>0)&&(g||_)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(e){this.globalScale=e,F()},this.dispose=()=>{for(let e=t.length-1;e>=0;e--)t[e].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,n)=>{if(t==1){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,(g||_)&&F()}this.updateMarker(t,n)}};Ne.prototype=Object.create(G.prototype);var Pe=new e.Matrix4,Fe=new e.Ray,Ie=new e.Sphere,Le=new e.Vector3,Re=new e.Vector3,ze=new e.Vector3,Be=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.PointsMaterial){super(),this.type=`Points`,this.geometry=t,this.material=n,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ie.copy(n.boundingSphere),Ie.applyMatrix4(r),Ie.radius+=i,e.ray.intersectsSphere(Ie)===!1)return;Pe.copy(r).invert(),Fe.copy(e.ray).applyMatrix4(Pe);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,s=o*o;if(n.isBufferGeometry){let i=n.index,o=n.attributes.position,c=n.morphAttributes.position;if(i!==null){let n=Math.max(0,a.start),l=Math.min(i.count,a.start+a.count);for(let a=n,u=l;a<u;a++){let n=i.getX(a);He(this,o,c,n),Ve(Le,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(o.count,a.start+a.count);for(let a=n,l=i;a<l;a++)He(this,o,c,a),Ve(Le,a,s,r,e,t,this)}}else console.error(`THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};Be.prototype.isPoints=!0;function Ve(t,n,r,i,a,o,s){let c=Fe.distanceSqToPoint(t);if(c<r){let r=new e.Vector3;Fe.closestPointToPoint(t,r),r.applyMatrix4(i);let l=a.ray.origin.distanceTo(r);if(l<a.near||l>a.far)return;o.push({distance:l,distanceToRay:Math.sqrt(c),point:r,index:n,face:null,object:s})}}function He(e,t,n,r){Le.fromBufferAttribute(t,r);let i=e.morphTargetInfluences;if(e.material.morphTargets&&n&&i){Re.set(0,0,0);for(var a=0,o=n.length;a<o;a++){let e=i[a],t=n[a];e!==0&&(ze.fromBufferAttribute(t,r),Re.addScaledVector(ze.sub(Le),e))}Le.add(Re)}}var Ue=function(){G.call(this),this.isPointset=!0;let t=[],n=1,r=!1,i=500,a=!0;this.createMesh=(e,t,n)=>{if(e&&t){let r=k(e,n);t.map=P();let i=new Be(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}};let o=(o,s,c,l)=>{if(c){let u=new be(c,new e.Color(l));u.setPosition(s[0],s[1],s[2]);let d=u.getSprite();d.material.sizeAttenuation=!1,d.material.alphaTest=.5,d.material.transparent=!0,d.material.depthWrite=!1,d.material.depthTest=r,u.setFontWeight(i),u.setSize(n),u.setVisibility(a),this.group.add(d),t[o]=u}},s=e=>{let n=t[e];if(n){let r=n.getSprite();this.group.remove(r),n.dispose(),t.splice(e,1)}};this.addPoints=(n,r,i)=>{if(n&&n.length>0){let a=this.drawRange;a===-1&&(a=0);let s=this.addVertices(n);if(!this.getMorph()){let t=new e.PointsMaterial({alphaTest:.5,size:10,color:i,sizeAttenuation:!1});s.colorsNeedUpdate=!0,this.createMesh(s,t,{localTimeEnabled:!1,localMorphColour:!1})}let c=a+n.length,l=0;if(Array.isArray(r)&&r.length===n.length||typeof r==`string`)for(t.length;a+l<c;){let e=typeof r==`string`?r:r[l];o(a+l,n[l],e,this._lod._material.color),l++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setColour=e=>{this._lod.setColour(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setLabelDepthTest=e=>{r=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setDepthTest(e)},this.setLabelFontWeight=e=>{i=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setFontWeight(e)},this.setLabelSize=e=>{n=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setSize(n)},this.displayLabels=e=>{a=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setVisibility(a)},this.setSize=e=>{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(e){if(e>=0&&this.drawRange>e){let t=this.getMorph().geometry.getAttribute(`position`);return[t.getX(e),t.getY(e),t.getZ(e)]}},this.editVertices=function(e,n){if(e&&e.length){let r=this.getMorph(),i=n+e.length-1;if(!r||0>n||i>=this.drawRange)return;{let i=r.geometry.getAttribute(`position`),a=n;e.forEach(e=>{let n=t[a];n&&n.setPosition(e[0],e[1],e[2]),i.setXYZ(a++,e[0],e[1],e[2])}),i.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(e){return Ue.prototype.deleteVertices.call(this,e)&&s(e),this.drawRange},this.setName=function(e){let n=this.groupName;Ue.prototype.setName.call(this,e),t.forEach(t=>{t.getString()===n&&t?.setText(e)})},this.render=(e,t,n,r)=>{this.morph&&n&&(this.morph.sizePerPixel=n.pixelHeight),Ue.prototype.render.call(this,e,t,n,r)}};Ue.prototype=Object.create(G.prototype);var We=function(){G.call(this),this.isLines=!0,this.createLineSegment=(e,t,n)=>{if(e&&t){let r=k(e,n);n.localMorphColour&&r.morphAttributes.color&&(t.onBeforeCompile=ne());let i=new le(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(t,n)=>{if(t&&t.length>0){let r=this.addVertices(t);if(!this.getMorph()){let t=new e.LineBasicMaterial({color:n});r.colorsNeedUpdate=!0,this.createLineSegment(r,t,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};We.prototype=Object.create(G.prototype);var Ge=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Ge.prototype.loadImage=function(e,t){return new Promise((n,r)=>{e.onload=()=>n(e),e.onerror=r,e.src=t})},Ge.prototype.imageToUint8Array=async function(e,t,n,r){await e.loadImage(t,n),r.width=t.width,r.height=t.height;let i=r.getContext(`2d`);return i.drawImage(t,0,0),{array:new Uint8Array(i.getImageData(0,0,r.width,r.height).data.buffer),width:r.width,height:r.height}},Ge.prototype.loadFromImages=async function(e){},Ge.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Ge.prototype.getMaterial=function(){if(this.impl)return new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide})};var Ke=function(){Ge.call(this),this.isTextureArray=!0,this.loadFromImages=async t=>{let n=1,r=1,i=0;if(t&&t.length){this.isLoading=!0;let a=new Image;a.crossOrigin=`Anonymous`;let o=document.createElement(`canvas`),s=0,c=Array(t.length);for(let e=0;e<t.length;e++){let l=await this.imageToUint8Array(this,a,t[e],o);l&&l.array&&(n=l.width,r=l.height,c[i]=l.array,s+=c[i].length,i++)}let l=new Uint8Array(s);s=0,c.forEach(e=>{l.set(e,s),s+=e.length}),this.impl=new e.DataTexture2DArray(l,n,r,i),this.size={width:n,height:r,depth:i},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=t=>{if(this.impl){let n;if(t){if(t.vs&&t.fs){let r=!0;`transparent`in t&&(r=t.transparent);let i=e.FrontSide;t.side&&(i=t.side),n=new e.ShaderMaterial({transparent:r,uniforms:t.uniforms,vertexShader:t.vs,fragmentShader:t.fs,side:i}),t.glslVersion&&(n.glslVersion=t.glslVersion)}}else n=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide});if(n)return n.needsUpdate=!0,n}}};Ke.prototype=Object.create(Ge.prototype);var qe=e.GLSL3,Je=`
3170
+ `))}},I=new e.Vector3,L=new e.Vector3,re=new e.Matrix4,R=new e.Ray,z=new e.Sphere,ie=new e.Vector3,B=new e.Vector3,V=new e.Vector3,ae=new e.Vector3,oe=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.LineBasicMaterial){super(),this.type=`Line`,this.geometry=t,this.material=n,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[0];for(let e=1,t=n.count;e<t;e++)I.fromBufferAttribute(n,e-1),L.fromBufferAttribute(n,e),r[e]=r[e-1],r[e]+=I.distanceTo(L);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}raycast(t,n){let r=this.geometry,i=this.matrixWorld,a=t.params.Line.threshold,o=r.drawRange,s=r.morphAttributes.position;if(r.boundingSphere===null&&r.computeBoundingSphere(),z.copy(r.boundingSphere),z.applyMatrix4(i),z.radius+=a,t.ray.intersectsSphere(z)===!1)return;re.copy(i).invert(),R.copy(t.ray).applyMatrix4(re);let c=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=c*c,u=new e.Vector3,d=new e.Vector3,f=new e.Vector3,p=new e.Vector3,m=this.isLineSegments?2:1;if(r.isBufferGeometry){let e=r.index,i=r.attributes.position;if(e!==null){let r=Math.max(0,o.start),a=Math.min(e.count,o.start+o.count);for(let o=r,c=a-1;o<c;o+=m){let r=e.getX(o),a=e.getX(o+1);if(H(u,d,this,i,s,r,a),R.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let c=t.ray.origin.distanceTo(p);c<t.near||c>t.far||n.push({distance:c,point:f.clone().applyMatrix4(this.matrixWorld),index:o,face:null,faceIndex:null,object:this})}}else{let e=Math.max(0,o.start),r=Math.min(i.count,o.start+o.count);for(let a=e,o=r-1;a<o;a+=m){if(H(u,d,this,i,s,a,a+1),R.distanceSqToSegment(u,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);let e=t.ray.origin.distanceTo(p);e<t.near||e>t.far||n.push({distance:e,point:f.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error(`THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};function H(e,t,n,r,i,a,o){e.fromBufferAttribute(r,a),t.fromBufferAttribute(r,o);var s=n.morphTargetInfluences;if(n.material.morphTargets&&i&&s){ie.set(0,0,0),B.set(0,0,0);for(var c=0,l=i.length;c<l;c++){var u=s[c],d=i[c];u!==0&&(V.fromBufferAttribute(d,a),ae.fromBufferAttribute(d,o),ie.addScaledVector(V.sub(e),u),B.addScaledVector(ae.sub(t),u))}e.add(ie),t.add(B)}}oe.prototype.isLine=!0;var se=new e.Vector3,ce=new e.Vector3,le=class extends oe{constructor(e,t){super(e,t),this.type=`LineSegments`}computeLineDistances(){let t=this.geometry;if(t.isBufferGeometry){if(t.index===null){let n=t.attributes.position,r=[];for(let e=0,t=n.count;e<t;e+=2)se.fromBufferAttribute(n,e),ce.fromBufferAttribute(n,e+1),r[e]=e===0?0:r[e-1],r[e+1]=r[e]+se.distanceTo(ce);t.setAttribute(`lineDistance`,new e.Float32BufferAttribute(r,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`)}else t.isGeometry&&console.error(`THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`);return this}};le.prototype.isLineSegments=!0;var ue=function(t){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=t,this.addLevel=(e,t)=>{if(e){let n=Math.abs(t),r;for(r=0;r<this.levels.length&&!(n<this.levels[r].distance);r++);let i={distance:n,morph:e,loaded:!0,loading:!1,url:``};this.levels.splice(r,0,i),e.renderOrder=this._renderOrder}},this.levelLoaded=(e,t)=>{if(e){let n=Math.abs(t);for(let t=0;t<this.levels.length;t++)if(n===this.levels[t].distance){this._parent.group.add(e),this.levels[t].morph=e,this.levels[t].loaded=!0,this.levels[t].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(e,t,n,r,i)=>{this._loader=e;let a=this.calculateDistance(t),o={distance:a,morph:void 0,loaded:!1,loading:!1,url:n,index:r},s;for(s=0;s<this.levels.length&&!(a<this.levels[s].distance);s++);this.levels.splice(s,0,o),i&&this.loadLevel(s)},this.loadLevel=e=>{let t=this.levels[e];return!t.morph&&!t.loaded&&!t.loading&&(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),t.morph===void 0},this.calculateDistance=function(e){this._parent.getBoundingBox();let t=this._parent.radius,n=0;return e===`far`?n=t*4.5:e===`medium`?n=t*2.5:e===`close`&&(n=0),n},this.containsLevels=()=>!!(this.levels&&this.levels.length>1),this.checkTransparentMesh=()=>{let t=this.levels[this._currentLevel];this._material&&(this._material.transparent?(this._secondaryMaterial||(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=e.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,t.secondaryMesh||(t.secondaryMesh=new e.Mesh(t.morph.geometry,this._secondaryMaterial),t.secondaryMesh.renderOrder=t.morph.renderOrder+1,t.secondaryMesh.userData=t.morph.userData,t.secondaryMesh.name=t.morph.name),this._material.side=e.BackSide,this._material.needsUpdate=!0,t.secondaryMesh.parent||(t.morph.add(t.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(t.secondaryMesh))):(t.secondaryMesh&&(t.morph.remove(t.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(t.secondaryMesh),this._parent.animationGroup.remove(t.secondaryMesh))),this._material.side=e.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()}),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{let e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(t){return n=>{let r=this._material,i=k(n,{localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour}),a;this._parent.isGeometry?a=new e.Mesh(i,r):this._parent.isLines&&(a=new le(i,r)),a.userData=this._parent,a.renderOrder=this._renderOrder,n.dispose(),this.levelLoaded(a,t)}},this.updateMorphColorAttribute=t=>{if(this._material&&(this._material.vertexColors==e.VertexColors||this._material.vertexColors==1)){if(t){let e=this.getCurrentMorph();O(e.geometry,e)}else this.levels.forEach(e=>{e.morph&&e.morph.geometry&&O(e.morph.geometry,e.morph)})}},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),n()},this.setFrustumCulled=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)})},this.setMaterial=t=>{t&&(!this._material||this._material.id!==t.id)&&(this._material=t,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=t.clone(),this._secondaryMaterial.side=e.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach(e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)}))},this.setName=e=>{this.levels.forEach(t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)})},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach(t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)})},this.setVertexColors=e=>{this._material.vertexColors=e,n(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{let n=this.levels;if(n.length>1){let r=e.cameraObject.position.distanceTo(t),i=-1,a=-1,o,s;for(o=0,s=n.length;o<s&&r>=n[o].distance;o++)n[o].morph?(i>-1&&n[i].morph&&(n[i].morph.visible=!1),i=o,n[o].morph.visible=!0,a=-1):a=o;for(a>-1&&this.loadLevel(a);o<s;o++)n[o].morph&&(i>-1?n[o].morph.visible=!1:(n[o].morph.visible=!0,i=o));this._currentLevel!=i&&(this._currentLevel=i,this.checkTransparentMesh())}},this.toggleMarker=(e,t)=>{this.levels.forEach(n=>{n.morph&&(t?n.morph.add(e):n.morph.remove(e))})};let n=()=>{this.levels.forEach(e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)})}},U=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'%20?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20version='1.1'%20width='365'%20height='560'%20viewBox='0%200%20365%20560'%20xml:space='preserve'%3e%3cdesc%3eCreated%20with%20Fabric.js%205.2.4%3c/desc%3e%3cdefs%3e%3c/defs%3e%3crect%20x='0'%20y='0'%20width='100%25'%20height='100%25'%20fill='transparent'%3e%3c/rect%3e%3cg%20transform='matrix(0%200%200%200%200%200)'%20id='808ed283-2524-440f-88ae-3bdb47bb5749'%20%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%20182.5%20280)'%20id='db30413d-5bff-4b98-ab59-464497ee199e'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-182.5'%20y='-280'%20rx='0'%20ry='0'%20width='365'%20height='560'%20/%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0%200%200%200%200%2097.5)'%20%3e%3cg%20style=''%20%3e%3c/g%3e%3c/g%3e%3cg%20transform='matrix(0.99%200%200%200.99%20182.5%20280)'%20%3e%3cg%20style=''%20vector-effect='non-scaling-stroke'%20%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3crect%20style='stroke:%20none;%20stroke-width:%201;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;%20visibility:%20hidden;'%20vector-effect='non-scaling-stroke'%20x='-540'%20y='-540'%20rx='0'%20ry='0'%20width='1080'%20height='1080'%20/%3e%3c/g%3e%3cg%20transform='matrix(1%200%200%201%200%200)'%20%3e%3cpath%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(0,89,116);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20transform='%20translate(-182.9,%20-279.85)'%20d='M%20182.9%20551.7%20C%20182.9%20551.8000000000001%20183.1%20552%20183.1%20552%20C%20183.1%20552%20358.3%20283%20358.3%20194.6%20C%20358.3%2064.5%20269.5%207.900000000000006%20182.9%207.699999999999989%20C%2096.3%207.9%207.5%2064.5%207.5%20194.6%20C%207.5%20283%20182.8%20552%20182.8%20552%20C%20182.8%20552%20182.9%20551.7%20182.9%20551.7%20z%20M%20122.2%20187.2%20C%20122.2%20153.6%20149.4%20126.39999999999999%20183%20126.39999999999999%20C%20216.6%20126.39999999999999%20243.8%20153.6%20243.8%20187.2%20C%20243.8%20220.79999999999998%20216.5%20248%20182.9%20248%20C%20149.4%20248%20122.2%20220.8%20122.2%20187.2%20z'%20stroke-linecap='round'%20/%3e%3c/g%3e%3cg%20transform='matrix(3.82%200%200%203.82%200%20-100.77)'%20%3e%3ccircle%20style='stroke:%20rgb(0,0,0);%20stroke-width:%200;%20stroke-dasharray:%20none;%20stroke-linecap:%20butt;%20stroke-dashoffset:%200;%20stroke-linejoin:%20miter;%20stroke-miterlimit:%204;%20fill:%20rgb(255,255,255);%20fill-rule:%20nonzero;%20opacity:%201;'%20vector-effect='non-scaling-stroke'%20cx='0'%20cy='0'%20r='35'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e`,de=new Image(128,128);de.src=U;var fe=new e.Texture;fe.image=de,fe.needsUpdate=!0;var W=[.02,.03,1],pe=new e.SpriteMaterial({map:fe,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),me=function(t){Object.getPrototypeOf(this)!==G.prototype&&Object.setPrototypeOf(me.prototype,G.prototype),G.call(this),this.texture=fe;let n,r,i,a,o,s=!0;this.morph=new e.Group,this.group=this.morph,this.parent=t,this.isMarker=!0;let c=!1;this.ndc=new e.Vector3;let l,u,d=()=>{n=new e.Sprite(pe),n.center.set(.5,0),this.morph.add(n),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,n.scale.set(W[0],W[1],W[2]),n.userData=this};this.updateVisual=(e,t)=>{let n=1,r=0;e!==t&&(r=1-(this.ndc.z-e)/(t-e),n=.6+r*.4),this.setSpriteSize(n)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,n)=>{this.morph.position.set(e,t,n)},this.setSpriteSize=e=>{n.scale.set(.015,.02,1),n.scale.multiplyScalar(e)},this.setUserSprite=()=>{a&&(this.morph.add(a),s&&=(this.morph.remove(n),u&&this.morph.remove(u),!1))},this.setImageForUserSprite=(t,n)=>{a&&=(this.morph.remove(a),void 0),r&&r.dispose(),i&&i.dispose(),r=new e.Texture,r.image=t,r.needsUpdate=!0,i=new e.SpriteMaterial({map:r,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),n||=[.05,.05,1],a=new e.Sprite(i),a.center.set(.5,0),a.scale.set(n[0],n[1],n[2]),a.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{s||(s=!0,this.morph.add(n),a&&this.morph.remove(a),u&&this.morph.add(u))},this.loadUserSprite=(e,t)=>{if(e){if(e!==o){o=e;let n=new Image(128,128);n.crossOrigin=`anonymous`,n.onload=()=>{this.setImageForUserSprite(n,t)},n.src=e}else this.setUserSprite()}},this.dispose=()=>{this.morph&&this.morph.clear(),n&&=(n.clear(),void 0),u&&=(u.material.map.dispose(),u.material.dispose(),void 0)},this.isEnabled=()=>c,this.setNumber=e=>{(!e||l!=e)&&(u&&=(this.morph.remove(u),u.material.map.dispose(),u.material.dispose(),void 0)),!u&&e&&(u=F(e,.012,`black`,`Asap`,120,700),this.morph.add(u)),l=e},this.getNumber=()=>l||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{c=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{c=!1,this.morph.visible=!1,this.visible=!1},d()},he=0,ge=function(){return`pr`+he++},G=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new e.Group,this._lod=new ue(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new e.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode=`inherited`,this.uuid=ge(),this._v1=new e.Vector3,this._v2=new e.Vector3,this._b1=new e.Box3,this.center=new e.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1,this.isPickable=!0};G.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},G.prototype.getDuration=function(){return this.duration},G.prototype.setRegion=function(e){this.region=e},G.prototype.getRegion=function(){return this.region},G.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},G.prototype.getGroup=function(){return this.group},G.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);let t=this._lod.calculateDistance(`far`);this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},G.prototype.checkTransparentMesh=function(){},G.prototype.setMesh=function(t,n,r){this.animationGroup=new e.AnimationObjectGroup(t),this.mixer=new e.AnimationMixer(this.animationGroup);let i=t.geometry;if(this.geometry=t.geometry,this.clipAction=void 0,i&&i.morphAttributes){let t=i.morphAttributes.position;t||=i.morphAttributes.color?i.morphAttributes.color:i.morphAttributes.normal,t&&(this.animationClip=e.AnimationClip.CreateClipsFromMorphTargetSequences(t,10,!0),this.animationClip&&this.animationClip[0]!=null&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=e.LoopRepeat,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=n,this.morphColour=r,t.userData=this,t.matrixAutoUpdate=!1,this.setMorph(t),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(i.setAttribute(`morphTarget0`,i.getAttribute(`position`)),i.setAttribute(`morphTarget1`,i.getAttribute(`position`))),this.boundingBoxUpdateRequired=!0},G.prototype.setIsPickable=function(e){this.isPickable!==e&&(this.isPickable=e,this.region&&(this.region.pickableUpdateRequired=!0))},G.prototype.setAnatomicalId=function(e){this.anatomicalId=e},G.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},G.prototype.getCurrentTime=function(){if(this.clipAction){let e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},G.prototype.setMorphTime=function(e){let t=!1;if(this.clipAction){let n=e/this.duration*this.clipAction._clip.duration;n!=this.clipAction.time&&(this.clipAction.time=n,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{let n=e;n=e>this.duration?this.duration:0>e?0:e,n!=this.inbuildTime&&(this.inbuildTime=n,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},G.prototype.isTimeVarying=function(){return!!(this.timeEnabled||this.morphColour)},G.prototype.getVisibility=function(){return this.visible},G.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},G.prototype.setAlpha=function(e){let t=this._lod._material,n=!1;e<1&&(n=!0),t.opacity=e,t.transparent=n,this.checkTransparentMesh()},G.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},G.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},G.prototype.getColour=function(){if(this._lod._material)return this._lod._material.color},G.prototype.setColour=function(e){this._lod.setColour(e)},G.prototype.setGreyScale=function(t){if(t){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour(new e.Color().setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},G.prototype.getColourHex=function(){if(!this.morphColour&&this._lod._material&&this._lod._material.color)return this._lod._material.color.getHexString()},G.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},G.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},G.prototype.setMaterial=function(e){this._lod.setMaterial(e)},G.prototype.getClosestVertexIndex=function(){let e=-1,t=this.getMorph();if(t&&t.geometry){let n=t.geometry.attributes.position;if(n){this._b1.setFromBufferAttribute(n),this._b1.getCenter(this._v1);let t=-1,r=0;for(let i=0;i<n.count;i++)this._v2.fromArray(n.array,i*3),r=this._v2.distanceTo(this._v1),t==-1?t=r:t>r&&(t=r,e=i)}}return e},G.prototype.getClosestVertex=function(t){let n=new e.Vector3;this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex());let r=this.getMorph();if(r&&r.geometry&&this.closestVertexIndex>=0){let e=r.morphTargetInfluences,i=r.geometry.morphAttributes;if(e&&i&&i.position){let a=!1;for(let t=0;t<e.length;t++)e[t]>0&&(a=!0,this._v1.fromArray(i.position[t].array,this.closestVertexIndex*3),n.add(this._v1.multiplyScalar(e[t])));if(a)return t?n.applyMatrix4(r.matrixWorld):n}else return n.fromArray(r.geometry.attributes.position.array,this.closestVertexIndex*3),t?n.applyMatrix4(r.matrixWorld):n}return this.getBoundingBox(),n.copy(this.center),n},G.prototype.getBoundingBox=function(){if(this.visible){let e=this._lod.getCurrentMorph();if(e&&e.visible)return this.boundingBoxUpdateRequired&&=(w(e,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),!1),this.cachedBoundingBox}},G.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},G.prototype.markerIsRequired=function(e){return!!(this.visible&&(this.markerMode===`on`||e&&e.displayMarkers&&this.markerMode===`inherited`))},G.prototype.updateMarker=function(e,t){if(e==0&&this.markerIsRequired(t)){let e=t.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new me(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){let e=this.getClosestVertex(!1);e&&(this.marker.setPosition(e.x,e.y,e.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(t.markersList&&!(this.marker.uuid in t.markersList)&&(e=!0,t.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),t&&t.camera&&(e||t.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(t.camera.cameraObject),t.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),t.markersList&&this.marker.uuid in t.markersList&&(t.markerCluster.markerUpdateRequired=!0,delete t.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},G.prototype.processMarkerVisual=function(e,t){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(e,t)},G.prototype.initiateMorphColor=function(){this.morphColour==1&&this._lod.updateMorphColorAttribute(!1)},G.prototype.setRenderOrder=function(e){this._lod.setRenderOrder(e)},G.prototype.getClosestVertexDOMElementCoords=function(e){if(e&&e.camera){let t=!0,n=this.getClosestVertex(!0);return n.project(e.camera),n.z=Math.min(Math.max(n.z,0),1),(n.x>1||n.x<-1||n.y>1||n.y<-1)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(n.x,n.y,n),{position:n,inView:t}}},G.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode=e===`on`||e===`off`?e:`inherited`,this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},G.prototype.render=function(e,t,n,r){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(n,this.center),t==1){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t}this.visible&&e!=0&&(this.boundingBoxUpdateRequired=!0,this.morphColour==1&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,r)},G.prototype.addLOD=function(e,t,n,r,i){this._lod.addLevelFromURL(e,t,n,r,i)},G.prototype.addVertices=function(e){let t=this.getMorph(),n;if(!t)n=N(500,e),this.drawRange=e.length;else if(this.drawRange>-1){let r=t.geometry.getAttribute(`position`);e.forEach(e=>{r.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange}),r.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),n=t.geoemtry,this.boundingBoxUpdateRequired=!0}return n},G.prototype.deleteVertices=function(e){let t=this.getMorph();return t?.geometry&&this.drawRange>=e&&te(t.geometry,e,!0)?(--this.drawRange,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0,!0):!1},G.prototype.setPosition=function(e,t,n){let r=this.getGroup();r&&(r.position.set(e,t,n),r.matrixWorldNeedsUpdate=!0,r.updateMatrix(),r.updateWorldMatrix(!0,!0),this.boundingBoxUpdateRequired=!0)},G.prototype.loadAdditionalSources=function(e,t){e.load(filename,meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},G.prototype.setScaleAll=function(e){let t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)};var _e=(t,n,r)=>{let i=k(t,r),a=!1;1>r.opacity&&(a=!0);let o;if(i._video===void 0){let t=r.localTimeEnabled||r.localMorphColour;n?(o=n,o.morphTargets=t,o.morphNormals=r.localTimeEnabled):o=i instanceof e.BufferGeometry&&i.attributes.color===void 0?new e.MeshPhongMaterial({color:r.colour,morphTargets:t,morphNormals:r.localTimeEnabled,transparent:a,opacity:r.opacity,side:e.DoubleSide}):new e.MeshPhongMaterial({color:r.colour,morphTargets:t,morphNormals:r.localTimeEnabled,vertexColors:e.VertexColors,transparent:a,opacity:r.opacity,side:e.DoubleSide}),r.localMorphColour&&i.morphAttributes.color&&(o.onBeforeCompile=ne())}else{let t=i._video.createCanvasVideoTexture();o=new e.MeshBasicMaterial({morphTargets:r.localTimeEnabled,color:new e.Color(1,1,1),transparent:a,opacity:r.opacity,map:t,side:e.DoubleSide}),(void 0).videoHandler=i._video}return new e.Mesh(i,o)},ve=function(){G.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,n)=>{if(this.morph&&this.morph.geometry&&e!=null)return;let r=_e(e,t,n);this.setMesh(r,n.localTimeEnabled,n.localMorphColour)},this.calculateUVs=()=>{this.geometry.computeBoundingBox();let t=this.geometry.boundingBox.max,n=this.geometry.boundingBox.min,r=new e.Vector2(0-n.x,0-n.y),i=new e.Vector2(t.x-n.x,t.y-n.y);this.geometry.faceVertexUvs[0]=[];for(let t=0;t<this.geometry.faces.length;t++){let n=this.geometry.vertices[this.geometry.faces[t].a],a=this.geometry.vertices[this.geometry.faces[t].b],o=this.geometry.vertices[this.geometry.faces[t].c];geometry.faceVertexUvs[0].push([new e.Vector2((n.x+r.x)/i.x,(n.y+r.y)/i.y),new e.Vector2((a.x+r.x)/i.x,(a.y+r.y)/i.y),new e.Vector2((o.x+r.x)/i.x,(o.y+r.y)/i.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=e=>{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){let n=this.getMorph(),r=n.geometry.getAttribute(`position`);if(!n||0>t)return;{let i=t*3;e.forEach(e=>{r.array[i++]=e[0],r.array[i++]=e[1],r.array[i++]=e[2]}),r.needsUpdate=!0,n.geometry.computeBoundingBox(),n.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}}};ve.prototype=Object.create(G.prototype);var ye=t.default.default||t.default,be=function(e,t){let n=e,r,i=500;r=t?new ye(n,.012,t.getStyle()):new ye(n,.012),r.fontFace=`Asap`,r.fontWeight=i,r.material.map.generateMipmaps=!1,r.material.sizeAttenuation=!1,r.center.x=-.05,r.center.y=0;let a=[r.scale.x,r.scale.y];this.getPosition=()=>r?[r.position.x,r.position.y,r.position.z]:[0,0,0],this.setPosition=(e,t,n)=>{r&&r.position.set(e,t,n)},this.setColour=e=>{e&&(r.color=e.getStyle())},this.setScale=e=>{r&&e>0&&r.scale.set(e,e,1)},this.setDepthTest=e=>{e&&e!==r.material.depthTest&&(r.material.depthTest=e)},this.setSize=e=>{e>0&&(r.scale.x=a[0]*e,r.scale.y=a[1]*e)},this.setFontWeight=e=>{e&&e!==i&&(r.fontWeight=e,i=e)},this.setText=e=>{e&&e!==r.text&&(r.text=e,n=e)},this.setVisibility=e=>{r.visible=e},this.dispose=()=>{},this.getSprite=()=>r,this.getString=()=>n},xe=function(t,n,r,i){G.call(this);let a;n&&(a=n.clone(),a.vertexColors=e.FaceColors);let o=i;this.id=r;let s,c;this.isGlyph=!0;let l=[0,0,0];this.fromMesh=e=>e&&e.isMesh?(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),!0):!1,t&&a&&this.fromMesh(new e.Mesh(t,a)),this.getGlyphset=function(){return o},this.setLabel=e=>{e&&(typeof e==`string`||e instanceof String)&&(c=e,this.morph&&(this.morph.name=e))},this.showLabel=e=>{if(s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0),c&&(typeof c==`string`||c instanceof String)){s=new be(c,e),s.setPosition(l[0],l[1],l[2]);let t=s.getSprite();t.material.alphaTest=.5,t.material.transparent=!0,t.material.depthWrite=!1,this.group.add(s.getSprite())}},this.hideLabel=()=>{s&&=(l=s.getPosition(),this.group.remove(s.getSprite()),s.dispose(),void 0)},this.getLabel=()=>c,this.getMesh=()=>this.morph,this.setTransformation=(e,t,n,r)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=n[0],this.morph.matrix.elements[5]=n[1],this.morph.matrix.elements[6]=n[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=r[0],this.morph.matrix.elements[9]=r[1],this.morph.matrix.elements[10]=r[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),l=[...e],s&&s.setPosition(e[0],e[1],e[2])},this.setColour=e=>{s&&s.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};xe.prototype=Object.create(G.prototype);function Se(){}Se.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(Se.prototype,{crossOrigin:`anonymous`,onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(function(){var t={NoBlending:e.NoBlending,NormalBlending:e.NormalBlending,AdditiveBlending:e.AdditiveBlending,SubtractiveBlending:e.SubtractiveBlending,MultiplyBlending:e.MultiplyBlending,CustomBlending:e.CustomBlending},n=new e.Color,r=new e.TextureLoader,i=new e.MaterialLoader;return function(a,o,s){var c={};function l(t,n,i,a,l){var u=o+t,d=Se.Handlers.get(u),f;d===null?(r.setCrossOrigin(s),f=r.load(u)):f=d.load(u),n!==void 0&&(f.repeat.fromArray(n),n[0]!==1&&(f.wrapS=e.RepeatWrapping),n[1]!==1&&(f.wrapT=e.RepeatWrapping)),i!==void 0&&f.offset.fromArray(i),a!==void 0&&(a[0]===`repeat`&&(f.wrapS=e.RepeatWrapping),a[0]===`mirror`&&(f.wrapS=e.MirroredRepeatWrapping),a[1]===`repeat`&&(f.wrapT=e.RepeatWrapping),a[1]===`mirror`&&(f.wrapT=e.MirroredRepeatWrapping)),l!==void 0&&(f.anisotropy=l);var p=e.MathUtils.generateUUID();return c[p]=f,p}var u={uuid:e.MathUtils.generateUUID(),type:`MeshLambertMaterial`};for(var d in a){var f=a[d];switch(d){case`DbgColor`:case`DbgIndex`:case`opticalDensity`:case`illumination`:break;case`DbgName`:u.name=f;break;case`blending`:u.blending=t[f];break;case`colorAmbient`:case`mapAmbient`:console.warn(`THREE.Loader.createMaterial:`,d,`is no longer supported.`);break;case`colorDiffuse`:u.color=n.fromArray(f).getHex();break;case`colorSpecular`:u.specular=n.fromArray(f).getHex();break;case`colorEmissive`:u.emissive=n.fromArray(f).getHex();break;case`specularCoef`:u.shininess=f;break;case`shading`:f.toLowerCase()===`basic`&&(u.type=`MeshBasicMaterial`),f.toLowerCase()===`phong`&&(u.type=`MeshPhongMaterial`),f.toLowerCase()===`standard`&&(u.type=`MeshStandardMaterial`);break;case`mapDiffuse`:u.map=l(f,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);break;case`mapDiffuseRepeat`:case`mapDiffuseOffset`:case`mapDiffuseWrap`:case`mapDiffuseAnisotropy`:break;case`mapEmissive`:u.emissiveMap=l(f,a.mapEmissiveRepeat,a.mapEmissiveOffset,a.mapEmissiveWrap,a.mapEmissiveAnisotropy);break;case`mapEmissiveRepeat`:case`mapEmissiveOffset`:case`mapEmissiveWrap`:case`mapEmissiveAnisotropy`:break;case`mapLight`:u.lightMap=l(f,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);break;case`mapLightRepeat`:case`mapLightOffset`:case`mapLightWrap`:case`mapLightAnisotropy`:break;case`mapAO`:u.aoMap=l(f,a.mapAORepeat,a.mapAOOffset,a.mapAOWrap,a.mapAOAnisotropy);break;case`mapAORepeat`:case`mapAOOffset`:case`mapAOWrap`:case`mapAOAnisotropy`:break;case`mapBump`:u.bumpMap=l(f,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);break;case`mapBumpScale`:u.bumpScale=f;break;case`mapBumpRepeat`:case`mapBumpOffset`:case`mapBumpWrap`:case`mapBumpAnisotropy`:break;case`mapNormal`:u.normalMap=l(f,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);break;case`mapNormalFactor`:u.normalScale=f;break;case`mapNormalRepeat`:case`mapNormalOffset`:case`mapNormalWrap`:case`mapNormalAnisotropy`:break;case`mapSpecular`:u.specularMap=l(f,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);break;case`mapSpecularRepeat`:case`mapSpecularOffset`:case`mapSpecularWrap`:case`mapSpecularAnisotropy`:break;case`mapMetalness`:u.metalnessMap=l(f,a.mapMetalnessRepeat,a.mapMetalnessOffset,a.mapMetalnessWrap,a.mapMetalnessAnisotropy);break;case`mapMetalnessRepeat`:case`mapMetalnessOffset`:case`mapMetalnessWrap`:case`mapMetalnessAnisotropy`:break;case`mapRoughness`:u.roughnessMap=l(f,a.mapRoughnessRepeat,a.mapRoughnessOffset,a.mapRoughnessWrap,a.mapRoughnessAnisotropy);break;case`mapRoughnessRepeat`:case`mapRoughnessOffset`:case`mapRoughnessWrap`:case`mapRoughnessAnisotropy`:break;case`mapAlpha`:u.alphaMap=l(f,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);break;case`mapAlphaRepeat`:case`mapAlphaOffset`:case`mapAlphaWrap`:case`mapAlphaAnisotropy`:break;case`flipSided`:u.side=e.BackSide;break;case`doubleSided`:u.side=e.DoubleSide;break;case`transparency`:console.warn(`THREE.Loader.createMaterial: transparency has been renamed to opacity`),u.opacity=f;break;case`depthTest`:case`depthWrite`:case`colorWrite`:case`opacity`:case`reflectivity`:case`transparent`:case`visible`:case`wireframe`:u[d]=f;break;case`vertexColors`:f===!0&&(u.vertexColors=e.VertexColors),f===`face`&&(u.vertexColors=e.FaceColors);break;default:console.error(`THREE.Loader.createMaterial: Unsupported`,d,f)}}return u.type===`MeshBasicMaterial`&&delete u.emissive,u.type!==`MeshPhongMaterial`&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(c),i.parse(u)}})()});var Ce=function(t){var n=this;this.video=void 0,this.videoTexture=void 0;var r=t,i=function(){document&&(n.video=document.createElement(`video`),n.video.crossOrigin=`anonymous`,n.video.src=r,n.video.load(),n.video.loop=!0)};this.setMorphTime=function(e,t){var r=e/t*n.video.duration;n.video.currentTime=r},this.getVideoDuration=function(){return n.video.duration},this.createCanvasVideoTexture=function(){return n.videoTexture=new e.VideoTexture(n.video),n.videoTexture.minFilter=e.LinearFilter,n.videoTexture.magFilter=e.LinearFilter,n.videoTexture.format=e.RGBFormat,n.video.currentTime=0,n.videoTexture},this.getCurrentTime=function(e){return n.video?e*(n.video.currentTime/n.video.duration):0},this.isReadyToPlay=function(){return!!(n.video&&n.video.readyState>=3)},i()},we=e.AnimationClip,Te=e.Color,Ee=e.DefaultLoadingManager,De=e.FileLoader,Oe=e.LoaderUtils,ke=e.Vector2,Ae=e.Vector3,je=e.Vector4;function Me(e){typeof e==`boolean`&&(console.warn(`THREE.JSONLoader: showStatus parameter has been removed from constructor.`),e=void 0),this.manager=e===void 0?Ee:e,this.withCredentials=!1,this.paramsString=``}Object.assign(Me.prototype,{load:function(e,t,n,r){var i=this,a=this.texturePath&&typeof this.texturePath==`string`?this.texturePath:Oe.extractUrlBase(e),o=new De(this.manager);e.split(`?`),this.paramsString=e.length===2?paramsStrings[1]:``,o.setWithCredentials(this.withCredentials),o.load(e,function(n){var o=void 0;try{o=JSON.parse(n)}catch{if(console.error(`The loader has encountered an error while parsing the content of a resource.`),r){r({responseURL:e});return}}var s=o.metadata;if(s!==void 0){var c=s.type;if(c!==void 0&&c.toLowerCase()===`object`){console.error(`THREE.JSONLoader: `+e+` should be loaded with THREE.ObjectLoader instead.`);return}}if(i&&i.parse)try{var l=i.parse(o,a);t(l.geometry,l.materials)}catch(t){if(console.error(`The loader has encountered aon loading the geometry`),console.error(t),r){r({responseURL:e});return}}},n,r)},setTexturePath:function(e){this.texturePath=e},parse:(function(){function t(e,t){function n(e,t){return e&1<<t}var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,x,S,C,w,T,E,D,O,k,A,j=e.faces,M=e.vertices,N=e.normals,P=e.colors,F=e.scale,ee=0;if(e.uvs!==void 0){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&ee++;for(r=0;r<ee;r++)t.faceVertexUvs[r]=[]}for(o=0,s=M.length;o<s;)x=new Ae,x.x=M[o++]*F,x.y=M[o++]*F,x.z=M[o++]*F,t.vertices.push(x);if(o=0,s=j.length,e.uvs)for(r=0;r<e.uvs.length;r++){t.uvs[r]=[];for(let n=0;n<e.uvs[r].length;n++)t.uvs[r][n]=e.uvs[r][n]}if(N)for(r=0;r<N.length;r++)t.normals[r]=N[r];if(P)for(r=0;r<P.length;r++)t.colors[r]=P[r];for(;o<s;)if(f=j[o++],p=n(f,0),m=n(f,1),h=n(f,3),g=n(f,4),_=n(f,5),v=n(f,6),y=n(f,7),p){if(C=new b,C.a=j[o],C.b=j[o+1],C.c=j[o+3],w=new b,w.a=j[o+1],w.b=j[o+2],w.c=j[o+3],o+=4,m&&(d=j[o++],C.materialIndex=d,w.materialIndex=d),a=t.faces.length,h)for(r=0;r<ee;r++)for(D=e.uvs[r],t.faceVertexUvs[r][a]=[],t.faceVertexUvs[r][a+1]=[],i=0;i<4;i++)u=j[o++],k=D[u*2],A=D[u*2+1],O=new ke(k,A),i!==2&&t.faceVertexUvs[r][a].push(O),i!==0&&t.faceVertexUvs[r][a+1].push(O);if(g&&(l=j[o++]*3,C.normal.set(N[l++],N[l++],N[l]),w.normal.copy(C.normal)),_)for(r=0;r<4;r++)l=j[o++]*3,E=new Ae(N[l++],N[l++],N[l]),r!==2&&C.vertexNormals.push(E),r!==0&&w.vertexNormals.push(E);if(v&&(c=j[o++],T=P[c],C.color.setHex(T),w.color.setHex(T)),y)for(r=0;r<4;r++)c=j[o++],T=P[c],r!==2&&C.vertexColors.push(new Te(T)),r!==0&&w.vertexColors.push(new Te(T));t.faces.push(C),t.faces.push(w)}else{if(S=new b,S.a=j[o++],S.b=j[o++],S.c=j[o++],S.b||(S.b=S.a),S.c||(S.c=S.b),m&&(d=j[o++],S.materialIndex=d),a=t.faces.length,h)for(r=0;r<ee;r++)for(D=e.uvs[r],t.faceVertexUvs[r][a]=[],i=0;i<3;i++)u=j[o++],k=D[u*2],A=D[u*2+1],O=new ke(k,A),t.faceVertexUvs[r][a].push(O);if(g&&(l=j[o++]*3,S.normal.set(N[l++],N[l++],N[l])),_)for(r=0;r<3;r++)l=j[o++]*3,E=new Ae(N[l++],N[l++],N[l]),S.vertexNormals.push(E);if(v&&(c=j[o++],S.color.setHex(P[c])),y)for(r=0;r<3;r++)c=j[o++],S.vertexColors.push(new Te(P[c]));t.faces.push(S)}}function n(e,t){var n=e.influencesPerVertex===void 0?2:e.influencesPerVertex;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;r<i;r+=n){var a=e.skinWeights[r],o=n>1?e.skinWeights[r+1]:0,s=n>2?e.skinWeights[r+2]:0,c=n>3?e.skinWeights[r+3]:0;t.skinWeights.push(new je(a,o,s,c))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;r<i;r+=n){var l=e.skinIndices[r],u=n>1?e.skinIndices[r+1]:0,d=n>2?e.skinIndices[r+2]:0,f=n>3?e.skinIndices[r+3]:0;t.skinIndices.push(new je(l,u,d,f))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn(`When skinning, number of vertices (`+t.vertices.length+`), skinIndices (`+t.skinIndices.length+`), and skinWeights (`+t.skinWeights.length+`) should match.`)}function r(t,n){var r=t.scale;if(t.morphTargets!==void 0)for(var i=0,a=t.morphTargets.length;i<a;i++){n.morphTargets[i]={},n.morphTargets[i].name=t.morphTargets[i].name,n.morphTargets[i].vertices=[];for(var o=n.morphTargets[i].vertices,s=t.morphTargets[i].vertices,c=0,l=s.length;c<l;c+=3){var u=new Ae;u.x=s[c]*r,u.y=s[c+1]*r,u.z=s[c+2]*r,o.push(u)}}if(t.morphNormals!==void 0){for(var i=0,a=t.morphNormals.length;i<a;i++)if(n.morphTargets[i]){n.morphTargets[i].normals=[];for(var d=n.morphTargets[i].normals,f=t.morphNormals[i].normals,c=0,l=f.length;c<l;c+=3){var p=new Ae;p.x=f[c],p.y=f[c+1],p.z=f[c+2],d.push(p)}n.morphNormalsReady=!0}}if(t.morphColors!==void 0){var i,a,m,h,g,_,v;for(i=0,a=t.morphColors.length;i<a;i++)for(n.morphColors[i]={},n.morphColors[i].name=t.morphColors[i].name,n.morphColors[i].colors=[],g=n.morphColors[i].colors,_=t.morphColors[i].colors,m=0,h=_.length;m<h;m+=3)v=new e.Color(16755200),v.setRGB(_[m],_[m+1],_[m+2]),g.push(v)}}function i(e,t){var n=[],r=[];e.animation!==void 0&&r.push(e.animation),e.animations!==void 0&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var i=0;i<r.length;i++){var a=we.parseAnimation(r[i],t.bones);a&&n.push(a)}if(t.morphTargets){var o=we.CreateClipsFromMorphTargetSequences(t.morphTargets,10);n=n.concat(o)}n.length>0&&(t.animations=n)}return function(a,o){a.data!==void 0&&(a=a.data),a.scale===void 0?a.scale=1:a.scale=1/a.scale;var s=new v;if(s.morphColors=[],t(a,s),n(a,s),r(a,s),i(a,s),s.computeFaceNormals(),s.computeBoundingSphere(),a.materials===void 0||a.materials.length===0)return{geometry:s};var c=Se.prototype.initMaterials(a.materials,o,`Anonymous`);if(a.materials[0].video){var l=o+a.materials[0].video;this.paramsString&&(l+=`?${this.paramsString}`),s._video=new Ce(l)}return c&&c.length>0&&(a.materials[0].singleSided?c[0].side=e.FrontSide:a.materials[0].flipSided?c[0].side=e.BackSide:c[0].side=e.DoubleSide,a.materials[0].specularCoef&&(c[0].shininess=Math.floor(a.materials[0].specularCoef/3))),{geometry:s,materials:c}}})()});var Ne=function(){G.call(this);let t=[],n,r,i,a,o,s,c,l=0,u=0,d=[0,0,0],f=[0,0,0],p=!1,m=[0,0,0],h=`NONE`;this.ready=!1;let g=!1,_=!1;this.isGlyphset=!0;let v=new e.Matrix4,y=new e.Color,b=new e.Color,x=new e.Box3,S=new e.Box3,C=new e.Box3,w=[],T=[],E=[],D=[],O=[],k=[],A=[],j=[];this.globalScale=1;for(let t=0;t<8;t++)w[t]=new e.Vector3;this.load=(t,p,v,y,b)=>{n=t.axis1,r=t.axis2,i=t.axis3,a=t.positions,o=t.scale,s=t.colors,c=t.label,g=t.metadata.MorphColours,_=t.metadata.MorphVertices,l=t.metadata.number_of_time_steps,h=t.metadata.repeat_mode,u=t.metadata.number_of_vertices,h==`AXES_2D`||h==`MIRROR`?u*=2:h==`AXES_3D`&&(u*=3),d=t.metadata.base_size,f=t.metadata.offset,m=t.metadata.scale_factors;let x=new Me;this.geometry=new e.BufferGeometry;let S=new e.InstancedMesh(this.geometry,void 0,u);if(this.setMorph(S),y){var C=x.parse(p);te(v,b)(C.geometry,C.materials),C.geometry.dispose()}else x.crossOrigin=`Anonymous`,x.load(p,te(v,b))};let M=(e,t,n,r,i,a)=>{if(h==`NONE`||h==`MIRROR`){let c=[0,0,0],l=[0,0,0],u=[0,0,0],p=[0,0,0],g=[0,0,0],_=[0,0,0],v=[0,0,0],y=[0,0,0],b=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;c[o]=(s*d[o]+i[o]*m[o])*this.globalScale}for(var o=0;o<3;o++)l[o]=t[o]*c[0],u[o]=n[o]*c[1],p[o]=r[o]*c[2],g[o]=e[o]+f[0]*l[o]+f[1]*u[o]+f[2]*p[o],h==`MIRROR`&&(_[o]=-l[o],v[o]=-u[o],y[o]=-p[o],b[o]=g[o],i[0]<0&&(g[o]-=l[o],b[o]-=_[o]));0>p[0]*(l[1]*u[2]-l[2]*u[1])+p[1]*(l[2]*u[0]-l[0]*u[2])+p[2]*(l[0]*u[1]-l[1]*u[0])&&(p[0]=-p[0],p[1]=-p[1],p[2]=-p[2]),a[0]=[g,l,u,p],h==`MIRROR`&&(0>y[0]*(_[1]*v[2]-_[2]*v[1])+y[1]*(_[2]*v[0]-_[0]*v[2])+y[2]*(_[0]*v[1]-_[1]*v[0])&&(y[0]=-y[0],y[1]=-y[1],y[2]=-y[2]),a[1]=[b,_,v,y])}else if(h==`AXES_2D`||h==`AXES_3D`){let l=[0,0,0],u=[0,0,0];for(var o=0;o<3;o++){var s=i[o]<0?-1:1;l[o]=(s*d[0]+i[o]*m[0])*this.globalScale}for(var o=0;o<3;o++)u[o]=e[o]+f[0]*l[0]*t[o]+f[1]*l[1]*n[o]+f[2]*l[2]*r[o];let p=glyph_repeat_mode==`AXES_2D`?2:3;for(let e=0;e<p;e++){let o,s,l=i[e],f=[0,0,0],p=[0,0,0],g=[0,0,0];e==0?(o=t,s=n):e==1?(o=n,s=glyph_repeat_mode==`AXES_2D`?t:r):(o=r,s=t);let _=(d[0]+l*m[0])*this.globalScale;f[0]=o[0]*_,f[1]=o[1]*_,f[2]=o[2]*_,g[0]=f[1]*s[2]-s[1]*f[2],g[1]=f[2]*s[0]-s[2]*f[0],g[2]=f[0]*s[1]-f[1]*s[0];let v=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]);if(0<v){let t=(d[2]+l*m[2])*this.globalScale/v;h==`AXES_2D`&&e>0&&(t*=-1),g[0]*=t,g[1]*=t,g[2]*=t}if(p[0]=g[1]*f[2]-f[1]*g[2],p[1]=g[2]*f[0]-f[2]*g[0],p[2]=g[0]*f[1]-g[1]*f[0],v=Math.sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]),0<v){var c=(d[1]+l*m[1])*this.globalScale/v;p[0]*=c,p[1]*=c,p[2]*=c}a[e]=[u,f,p,g]}}return a},N=(e,n,r,i,a)=>{let o=1;h==`AXES_2D`||h==`MIRROR`?o=2:h==`AXES_3D`&&(o=3);let s=e.length/3,c=0;j.length=o;for(let l=0;l<s;l++){let s=l*3,u=[e[s],e[s+1],e[s+2]],d=[n[s],n[s+1],n[s+2]],f=[r[s],r[s+1],r[s+2]],p=[i[s],i[s+1],i[s+2]],m=[a[s],a[s+1],a[s+2]],h=M(u,d,f,p,m,j);if(h.length==o)for(let e=0;e<o;e++){v.elements[0]=h[e][1][0],v.elements[1]=h[e][1][1],v.elements[2]=h[e][1][2],v.elements[3]=0,v.elements[4]=h[e][2][0],v.elements[5]=h[e][2][1],v.elements[6]=h[e][2][2],v.elements[7]=0,v.elements[8]=h[e][3][0],v.elements[9]=h[e][3][1],v.elements[10]=h[e][3][2],v.elements[11]=0,v.elements[12]=h[e][0][0],v.elements[13]=h[e][0][1],v.elements[14]=h[e][0][2],v.elements[15]=1,this.morph.setMatrixAt(c,v);let n=t[c];n&&n.setTransformation(h[e][0],h[e][1],h[e][2],h[e][3]),c++}}this.morph.instanceMatrix.needsUpdate=!0},P=e=>{let n=1;h==`AXES_2D`||h==`MIRROR`?n=2:h==`AXES_3D`&&(n=3);let r=e.length,i=0;for(let a=0;a<r;a++){let r=e[a];for(let e=0;e<n;e++){y.setHex(r),this.morph.setColorAt(i,y);let e=t[i];e&&e.setColour(y),i++}}this.morph.instanceColor.needsUpdate=!0},F=()=>{let e=T,t=E,c=D,u=O,d=k,f=A,p=this.inbuildTime/this.duration*(l-1),m=Math.floor(p),h=1-(p-m),v=Math.ceil(p);if(_){let s=a[m.toString()],l=a[v.toString()],f=n[m.toString()],p=n[v.toString()],g=r[m.toString()],_=r[v.toString()],y=i[m.toString()],b=i[v.toString()],x=o[m.toString()],S=o[v.toString()];T.length=s.length,E.length=s.length,D.length=s.length,O.length=s.length,k.length=s.length;for(let n=0;n<s.length;n++)e[n]=h*s[n]+(1-h)*l[n],t[n]=h*f[n]+(1-h)*p[n],c[n]=h*g[n]+(1-h)*_[n],u[n]=h*y[n]+(1-h)*b[n],d[n]=h*x[n]+(1-h)*S[n]}else e=a[0],t=n[0],c=r[0],u=i[0],d=o[0];if(N(e,t,c,u,d),this.boundingBoxUpdateRequired=!0,s!=null){if(g){let e=s[m.toString()],t=s[v.toString()];f.length=e.length;for(let n=0;n<e.length;n++)y.setHex(e[n]),b.setHex(t[n]),y.setRGB(y.r*h+b.r*(1-h),y.g*h+b.g*(1-h),y.b*h+b.b*(1-h)),f[n]=y.getHex()}else f=s[0];P(f)}};this.getLabel=e=>{if(c&&c.length>e)return c[e]},this.isLabelDisplayed=()=>p,this.canShowLabel=()=>t?.length&&(c?.length||this.groupName),this.showLabel=()=>{if(t?.length){p=!0;for(let e=0;e<t.length;e++)t[e].showLabel(this.morph.material?this.morph.material.color:void 0)}},this.hideLabel=()=>{for(let e=0;e<t.length;e++)t[e].hideLabel();p=!1};let ee=e=>{for(let e=0;e<u;e++){let n=new xe(void 0,void 0,e,this),r=c?c[e]:void 0;r||=this.groupName,r&&n.setLabel(r),l>0&&n.setFrustumCulled(!1),t[e]=n,this.morph.add(n.getGroup())}c&&c.length>0&&e&&this.showLabel(),N(a[0],n[0],r[0],i[0],o[0]),s!=null&&P(s[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=e=>{e.isGlyph&&t.push(e),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(e,n)=>{if(e.isMesh){let r=new xe(void 0,void 0,n,this);return r.fromMesh(e),t.push(r),this.morph.add(r.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,r}},this.forEachGlyph=e=>{for(let n=0;n<t.length;n++)e(t[n])};var te=(e,t)=>(n,r)=>{let i=n.toBufferGeometry();this.geometry.copy(i),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),i.dispose(),r&&r[0]&&(this.morph.material=r[0]),ee(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),n.dispose(),e!=null&&typeof e==`function`&&e(this)};this.getClosestVertexIndex=function(){let e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);let t=a[0],n=t.length/3,r=-1,i=0;for(let a=0;a<n;a++){let n=a*3;this._v2.set(t[n],t[n+1],t[n+2]),i=this._v1.distanceTo(this._v2),(r==-1||r>i)&&(r=i,e=a)}}return e},this.getClosestVertex=function(){if(this.closestVertexIndex==-1&&(this.closestVertexIndex=this.getClosestVertexIndex()),this.closestVertexIndex>=0&&this.morph){let t=new e.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,v),t.setFromMatrixPosition(v),t}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){x.setFromBufferAttribute(this.morph.geometry.attributes.position);for(let e=0;e<u;e++)this.morph.getMatrixAt(e,v),S.copy(x).applyMatrix4(v),e==0?C.copy(S):C.union(S);if(C)this.cachedBoundingBox.copy(C),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1;else return}return this.cachedBoundingBox}},this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(g||_)&&(F(),_&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!!((this.ready===!1||l>0)&&(g||_)),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(e){this.globalScale=e,F()},this.dispose=()=>{for(let e=t.length-1;e>=0;e--)t[e].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,n)=>{if(t==1){let t=this.inbuildTime+e;t>this.duration&&(t-=this.duration),this.inbuildTime=t,(g||_)&&F()}this.updateMarker(t,n)}};Ne.prototype=Object.create(G.prototype);var Pe=new e.Matrix4,Fe=new e.Ray,Ie=new e.Sphere,Le=new e.Vector3,Re=new e.Vector3,ze=new e.Vector3,Be=class extends e.Object3D{constructor(t=new e.BufferGeometry,n=new e.PointsMaterial){super(),this.type=`Points`,this.geometry=t,this.material=n,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ie.copy(n.boundingSphere),Ie.applyMatrix4(r),Ie.radius+=i,e.ray.intersectsSphere(Ie)===!1)return;Pe.copy(r).invert(),Fe.copy(e.ray).applyMatrix4(Pe);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,s=o*o;if(n.isBufferGeometry){let i=n.index,o=n.attributes.position,c=n.morphAttributes.position;if(i!==null){let n=Math.max(0,a.start),l=Math.min(i.count,a.start+a.count);for(let a=n,u=l;a<u;a++){let n=i.getX(a);He(this,o,c,n),Ve(Le,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(o.count,a.start+a.count);for(let a=n,l=i;a<l;a++)He(this,o,c,a),Ve(Le,a,s,r,e,t,this)}}else console.error(`THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let e=t[n[0]];if(e!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t<n;t++){let n=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error(`THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}}};Be.prototype.isPoints=!0;function Ve(t,n,r,i,a,o,s){let c=Fe.distanceSqToPoint(t);if(c<r){let r=new e.Vector3;Fe.closestPointToPoint(t,r),r.applyMatrix4(i);let l=a.ray.origin.distanceTo(r);if(l<a.near||l>a.far)return;o.push({distance:l,distanceToRay:Math.sqrt(c),point:r,index:n,face:null,object:s})}}function He(e,t,n,r){Le.fromBufferAttribute(t,r);let i=e.morphTargetInfluences;if(e.material.morphTargets&&n&&i){Re.set(0,0,0);for(var a=0,o=n.length;a<o;a++){let e=i[a],t=n[a];e!==0&&(ze.fromBufferAttribute(t,r),Re.addScaledVector(ze.sub(Le),e))}Le.add(Re)}}var Ue=function(){G.call(this),this.isPointset=!0;let t=[],n=1,r=!1,i=500,a=!0;this.createMesh=(e,t,n)=>{if(e&&t){let r=k(e,n);t.map=P();let i=new Be(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}};let o=(o,s,c,l)=>{if(c){let u=new be(c,new e.Color(l));u.setPosition(s[0],s[1],s[2]);let d=u.getSprite();d.material.sizeAttenuation=!1,d.material.alphaTest=.5,d.material.transparent=!0,d.material.depthWrite=!1,d.material.depthTest=r,u.setFontWeight(i),u.setSize(n),u.setVisibility(a),this.group.add(d),t[o]=u}},s=e=>{let n=t[e];if(n){let r=n.getSprite();this.group.remove(r),n.dispose(),t.splice(e,1)}};this.addPoints=(n,r,i)=>{if(n&&n.length>0){let a=this.drawRange;a===-1&&(a=0);let s=this.addVertices(n);if(!this.getMorph()){let t=new e.PointsMaterial({alphaTest:.5,size:10,color:i,sizeAttenuation:!1});s.colorsNeedUpdate=!0,this.createMesh(s,t,{localTimeEnabled:!1,localMorphColour:!1})}let c=a+n.length,l=0;if(Array.isArray(r)&&r.length===n.length||typeof r==`string`)for(t.length;a+l<c;){let e=typeof r==`string`?r:r[l];o(a+l,n[l],e,this._lod._material.color),l++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setColour=e=>{this._lod.setColour(e);for(let e=0;e<t.length;e++)t[e]&&t[e].setColour(this._lod._material.color)},this.setLabelDepthTest=e=>{r=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setDepthTest(e)},this.setLabelFontWeight=e=>{i=e;for(let n=0;n<t.length;n++)t[n]&&t[n].setFontWeight(e)},this.setLabelSize=e=>{n=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setSize(n)},this.displayLabels=e=>{a=e;for(let e=0;e<t.length;e++)t[e]&&t[e].setVisibility(a)},this.setSize=e=>{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(e){if(e>=0&&this.drawRange>e){let t=this.getMorph().geometry.getAttribute(`position`);return[t.getX(e),t.getY(e),t.getZ(e)]}},this.editVertices=function(e,n){if(e&&e.length){let r=this.getMorph(),i=n+e.length-1;if(!r||0>n||i>=this.drawRange)return;{let i=r.geometry.getAttribute(`position`),a=n;e.forEach(e=>{let n=t[a];n&&n.setPosition(e[0],e[1],e[2]),i.setXYZ(a++,e[0],e[1],e[2])}),i.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}},this.deleteVertices=function(e){return Ue.prototype.deleteVertices.call(this,e)&&s(e),this.drawRange},this.setName=function(e){let n=this.groupName;Ue.prototype.setName.call(this,e),t.forEach(t=>{t.getString()===n&&t?.setText(e)})},this.render=(e,t,n,r)=>{this.morph&&n&&(this.morph.sizePerPixel=n.pixelHeight),Ue.prototype.render.call(this,e,t,n,r)}};Ue.prototype=Object.create(G.prototype);var We=function(){G.call(this),this.isLines=!0,this.createLineSegment=(e,t,n)=>{if(e&&t){let r=k(e,n);n.localMorphColour&&r.morphAttributes.color&&(t.onBeforeCompile=ne());let i=new le(r,t);this.setMesh(i,n.localTimeEnabled,n.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(t,n)=>{if(t&&t.length>0){let r=this.addVertices(t);if(!this.getMorph()){let t=new e.LineBasicMaterial({color:n});r.colorsNeedUpdate=!0,this.createLineSegment(r,t,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};We.prototype=Object.create(G.prototype);var Ge=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};Ge.prototype.loadImage=function(e,t){return new Promise((n,r)=>{e.onload=()=>n(e),e.onerror=r,e.src=t})},Ge.prototype.imageToUint8Array=async function(e,t,n,r){await e.loadImage(t,n),r.width=t.width,r.height=t.height;let i=r.getContext(`2d`);return i.drawImage(t,0,0),{array:new Uint8Array(i.getImageData(0,0,r.width,r.height).data.buffer),width:r.width,height:r.height}},Ge.prototype.loadFromImages=async function(e){},Ge.prototype.isReady=function(){return!!(this.impl&&!this.isLoading)},Ge.prototype.getMaterial=function(){if(this.impl)return new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide})};var Ke=function(){Ge.call(this),this.isTextureArray=!0,this.loadFromImages=async t=>{let n=1,r=1,i=0;if(t&&t.length){this.isLoading=!0;let a=new Image;a.crossOrigin=`Anonymous`;let o=document.createElement(`canvas`),s=0,c=Array(t.length);for(let e=0;e<t.length;e++){let l=await this.imageToUint8Array(this,a,t[e],o);l&&l.array&&(n=l.width,r=l.height,c[i]=l.array,s+=c[i].length,i++)}let l=new Uint8Array(s);s=0,c.forEach(e=>{l.set(e,s),s+=e.length}),this.impl=new e.DataTexture2DArray(l,n,r,i),this.size={width:n,height:r,depth:i},this.isLoading=!1,this.impl.needsUpdate=!0}},this.getMaterial=t=>{if(this.impl){let n;if(t){if(t.vs&&t.fs){let r=!0;`transparent`in t&&(r=t.transparent);let i=e.FrontSide;t.side&&(i=t.side),n=new e.ShaderMaterial({transparent:r,uniforms:t.uniforms,vertexShader:t.vs,fragmentShader:t.fs,side:i}),t.glslVersion&&(n.glslVersion=t.glslVersion)}}else n=new e.MeshBasicMaterial({color:new e.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:e.DoubleSide});if(n)return n.needsUpdate=!0,n}}};Ke.prototype=Object.create(Ge.prototype);var qe=e.GLSL3,Je=`
3171
3171
  precision highp float;
3172
3172
  precision highp int;
3173
3173
  precision highp sampler2DArray;
@@ -3455,7 +3455,7 @@ void main() {
3455
3455
  `)!==-1&&(t=t.replace(/\r\n/g,`
3456
3456
  `)),t.indexOf(`\\
3457
3457
  `)!==-1&&(t=t.replace(/\\\n/g,``));let r=t.split(`
3458
- `),i=``,a=``,o=0,s=[],c=typeof``.trimLeft==`function`;for(let e=0,t=r.length;e<t;e++)if(i=r[e],i=c?i.trimLeft():i.trim(),o=i.length,o!==0&&(a=i.charAt(0),a!==`#`)){if(a===`v`){let e=i.split(/\s+/);switch(e[0]){case`v`:n.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?n.colors.push(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])):n.colors.push(void 0,void 0,void 0);break;case`vn`:n.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:n.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if(a===`f`){let e=i.substr(1).trim().split(/\s+/),t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.length>0){let e=r.split(`/`);t.push(e)}}let r=t[0];for(let e=1,i=t.length-1;e<i;e++){let i=t[e],a=t[e+1];n.addFace(r[0],i[0],a[0],r[1],i[1],a[1],r[2],i[2],a[2])}}else if(a===`l`){let e=i.substring(1).trim().split(` `),t=[],r=[];if(i.indexOf(`/`)===-1)t=e;else for(let n=0,i=e.length;n<i;n++){let i=e[n].split(`/`);i[0]!==``&&t.push(i[0]),i[1]!==``&&r.push(i[1])}n.addLineGeometry(t,r)}else if(a===`p`){let e=i.substr(1).trim().split(` `);n.addPointGeometry(e)}else if((s=sn.exec(i))!==null){let e=(` `+s[0].substr(1).trim()).substr(1);n.startObject(e)}else if(ln.test(i))n.object.startMaterial(i.substring(7).trim(),n.materialLibraries);else if(cn.test(i))n.materialLibraries.push(i.substring(7).trim());else if(un.test(i))console.warn(`THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.`);else if(a===`s`){if(s=i.split(` `),s.length>1){let e=s[1].trim().toLowerCase();n.object.smooth=e!==`0`&&e!==`off`}else n.object.smooth=!0;let e=n.object.currentMaterial();e&&(e.smooth=n.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}n.finalize();let l=new e.Group;if(l.materialLibraries=[].concat(n.materialLibraries),n.objects.length!==1||n.objects[0].geometry.vertices.length!==0)for(let t=0,r=n.objects.length;t<r;t++){let r=n.objects[t],i=r.geometry,a=r.materials,o=i.type===`Line`,s=i.type===`Points`,c=!1;if(i.vertices.length===0)continue;let u=new e.BufferGeometry;u.setAttribute(`position`,new e.Float32BufferAttribute(i.vertices,3)),i.normals.length>0&&u.setAttribute(`normal`,new e.Float32BufferAttribute(i.normals,3)),i.colors.length>0&&(c=!0,u.setAttribute(`color`,new e.Float32BufferAttribute(i.colors,3))),i.hasUVIndices===!0&&u.setAttribute(`uv`,new e.Float32BufferAttribute(i.uvs,2));let d=[];for(let t=0,r=a.length;t<r;t++){let r=a[t],i=r.name+`_`+r.smooth+`_`+c,l=n.materials[i];if(this.materials!==null){if(l=this.materials.create(r.name),o&&l&&!(l instanceof e.LineBasicMaterial)){let t=new e.LineBasicMaterial;e.Material.prototype.copy.call(t,l),t.color.copy(l.color),l=t}else if(s&&l&&!(l instanceof e.PointsMaterial)){let t=new e.PointsMaterial({size:10,sizeAttenuation:!1});e.Material.prototype.copy.call(t,l),t.color.copy(l.color),t.map=l.map,l=t}}l===void 0&&(l=o?new e.LineBasicMaterial:s?new e.PointsMaterial({size:1,sizeAttenuation:!1}):new e.MeshPhongMaterial,l.name=r.name,l.flatShading=!r.smooth,l.vertexColors=c,n.materials[i]=l),d.push(l)}let f;if(d.length>1){for(let e=0,t=a.length;e<t;e++){let t=a[e];u.addGroup(t.groupStart,t.groupCount,e)}f=o?new e.LineSegments(u,d):s?new e.Points(u,d):new e.Mesh(u,d)}else f=o?new e.LineSegments(u,d[0]):s?new e.Points(u,d[0]):new e.Mesh(u,d[0]);f.name=r.name,l.add(f)}else if(n.vertices.length>0){let t=new e.PointsMaterial({size:1,sizeAttenuation:!1}),r=new e.BufferGeometry;r.setAttribute(`position`,new e.Float32BufferAttribute(n.vertices,3)),n.colors.length>0&&n.colors[0]!==void 0&&(r.setAttribute(`color`,new e.Float32BufferAttribute(n.colors,3)),t.vertexColors=!0);let i=new e.Points(r,t);l.add(i)}return l}},vn=e.FileLoader,yn=e=>{let t=(e,t)=>{e.metadata.number_of_vertices+=t.metadata.number_of_vertices,`labels`in e&&e.labels.push(...e.labels),[`axis1`,`axis2`,`axis3`,`colors`,`positions`,`scale`].forEach(n=>{n in e&&Object.keys(e[n]).forEach(r=>{let i=t[n][r].length;for(let a=0;a<i;a++)e[n][r].push(t[n][r][a])})})};if(e&&e.length>0)for(;e.length>1;){let n=e.splice(1,1);t(e[0],n[0])}},bn=e=>{let t=(e,t)=>{e.merge(t)};if(e&&e.length>0){for(;e.length>1;){let n=e.splice(1,1);t(e[0],n[0])}return e[0]}},xn=function(e,t,n){let r=new vn,i=new Me;r.crossOrigin=t;let a=e,o=n,s,c=!1,l=!1,u,d=[],f=e=>{let t=s[e.index];if(t){if(`GlyphGeometriesURL`in t)e.onLoad(t);else{let n=i.parse(t);e.onLoad(n.geometry,n.materials)}}else p(e,{responseURL:a})},p=e=>{e.onError&&(u||={responseURL:a},e.onError(u))};this.downloadCompleted=e=>{try{s=JSON.parse(e[0]),c=!1,l=!0,Array.isArray(s)?d.forEach(e=>f(e)):d.forEach(e=>p(e))}catch{d.forEach(e=>p(e))}};let m=()=>e=>{u=e,l=!0,c=!1,d.forEach(e=>{p(e)})},h=()=>e=>{d.forEach(t=>{t.onProgress&&t.onProgress(e)})};this.load=(e,t,n,i)=>{let g={index:e,onLoad:t,onProgress:n,onError:i};l?s?f(g):p(u):c?d.push(g):(d.push(g),c=!0,r.load(a,o,h,m))}},Sn=function(e,t,n){let r=[],i=e,a=t,o=0,s=n.isGlyphsets;this.itemDownloaded=(e,t)=>{if(r[e]=t,o++,o==i&&r.length>0){if(s){let e=r.map(e=>JSON.parse(e[0]));yn(e),a(e[0])}else{let t=r[0][1],n=bn(r.map(e=>e[0]));for(let t=1;t<i;t++)r[e][0].dispose(),r[e][1].forEach(e=>e.dispose());a(n,t)}}}},Cn=function(){let e=0;this.crossOrigin=`Anonymous`;let t=new Me,n=new vn;n.crossOrigin=`Anonymous`;let r=[],i={},a=(e,t,n,r,i)=>{let a=e.length,o=new Sn(a,t,i),c=0;e.forEach(e=>{let a=i?{...i}:{};a.msHandler=o,a.order=c,c++,s(e,t,n,r,a)})},o=(t,n,a,o,s)=>{let l=s?{...s}:{},u=i[t];if(!u){if(20>e){let n=new c(void 0,this,l);++e,u=new xn(t,this.crossOrigin,n),i[t]=u}else r.push({url:t,onLoad:n,onProgress:a,onError:o,options:s})}u&&(l.isHandler=u,u.load(s.index,n,a,o))},s=(i,a,s,l,u)=>{if(u&&u.index!==void 0)o(i,a,s,l,u);else if(20>e){++e;let r=new c(a,this,u),o=new c(l,this,u);u.isGlyphsets?n.load(i,r,s,o):(t.crossOrigin=this.crossOrigin,t.load(i,r,s,o))}else r.push({url:i,onLoad:a,onProgress:s,onError:l,options:u})};this.load=(e,t,n,r,i)=>{Array.isArray(e)?a(e,t,n,r,i):s(e,t,n,r,i)},this.loadFromWaitingList=()=>{for(;20>e;){let e=r.shift();if(e)this.load(e.url,e.onLoad,e.onProgress,e.onError,e.options);else return}},this.itemRemainingCheck=()=>{if(r.length===0&&e===0)for(let e in i)i.hasOwnProperty(e)&&delete i[e]};let c=function(t,n,r){return(...i)=>{--e,r?.msHandler?r.msHandler.itemDownloaded(r.order,i):r?.isHandler?r.isHandler.downloadCompleted(i):t&&t(...i),n.loadFromWaitingList(),n.itemRemainingCheck()}};this.parse=e=>loader.parse(e)},wn=class extends e.Loader{constructor(e){super(e)}load(t,n,r,i){let a=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}parse(t){function n(e){let t=new DataView(e);if(84+t.getUint32(80,!0)*50===t.byteLength)return!0;let n=[115,111,108,105,100];for(let e=0;e<5;e++)if(r(n,t,e))return!1;return!0}function r(e,t,n){for(let r=0,i=e.length;r<i;r++)if(e[r]!==t.getUint8(n+r,!1))return!1;return!0}function i(t){let n=new DataView(t),r=n.getUint32(80,!0),i,a,o,s=!1,c,l,u,d,f;for(let e=0;e<70;e++)n.getUint32(e,!1)==1129270351&&n.getUint8(e+4)==82&&n.getUint8(e+5)==61&&(s=!0,c=new Float32Array(r*3*3),l=n.getUint8(e+6)/255,u=n.getUint8(e+7)/255,d=n.getUint8(e+8)/255,f=n.getUint8(e+9)/255);let p=new e.BufferGeometry,m=new Float32Array(r*3*3),h=new Float32Array(r*3*3);for(let e=0;e<r;e++){let t=84+e*50,r=n.getFloat32(t,!0),f=n.getFloat32(t+4,!0),p=n.getFloat32(t+8,!0);if(s){let e=n.getUint16(t+48,!0);e&32768?(i=l,a=u,o=d):(i=(e&31)/31,a=(e>>5&31)/31,o=(e>>10&31)/31)}for(let l=1;l<=3;l++){let u=t+l*12,d=e*3*3+(l-1)*3;m[d]=n.getFloat32(u,!0),m[d+1]=n.getFloat32(u+4,!0),m[d+2]=n.getFloat32(u+8,!0),h[d]=r,h[d+1]=f,h[d+2]=p,s&&(c[d]=i,c[d+1]=a,c[d+2]=o)}}return p.setAttribute(`position`,new e.BufferAttribute(m,3)),p.setAttribute(`normal`,new e.BufferAttribute(h,3)),s&&(p.setAttribute(`color`,new e.BufferAttribute(c,3)),p.hasColors=!0,p.alpha=f),p}function a(t){let n=new e.BufferGeometry,r=/solid([\s\S]*?)endsolid/g,i=/facet([\s\S]*?)endfacet/g,a=0,o=`[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,s=RegExp(`vertex`+o+o+o,`g`),c=RegExp(`normal`+o+o+o,`g`),l=[],u=[],d=new e.Vector3,f,p=0,m=0,h=0;for(;(f=r.exec(t))!==null;){m=h;let e=f[0];for(;(f=i.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=c.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=s.exec(n))!==null;)l.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),u.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let t=m,r=h-m;n.addGroup(t,r,p),p++}return n.setAttribute(`position`,new e.Float32BufferAttribute(l,3)),n.setAttribute(`normal`,new e.Float32BufferAttribute(u,3)),n}function o(t){return typeof t==`string`?t:e.LoaderUtils.decodeText(new Uint8Array(t))}function s(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t.buffer||t}return e}let c=s(t);return n(c)?i(c):a(o(t))}},Tn=function(){G.call(this),this.isTubeLines=!0;let t={},n={radius:1,radialSegments:8,smooth:!1};this.createLineSegment=(n,i,a)=>{if(n&&i){t={geometryIn:n,materialIn:i,options:a};let o=r(n.vertices),s=new e.MeshStandardMaterial({color:i.color}),c=new e.Mesh(o,s);this.setMesh(c,a.localTimeEnabled,a.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.setAlpha=function(e){let t=this.getMorph();t.material.opacity=e,t.material.transparent=e<1,t.material.depthWrite=e>.5},this.setWireframe=e=>{let t=this.getMorph();t.material.wireframe=e},this.setTubeLines=(e,i)=>{if(e&&i){let{geometryIn:a}=t,o=this.getMorph();o.geometry.dispose(),n=Object.assign(n,{radius:e,radialSegments:i}),o.geometry=r(a.vertices)}};let r=t=>{let{radius:r,radialSegments:i,smooth:a}=n,o;if(a){let n=new e.CatmullRomCurve3(t);o=new e.TubeGeometry(n,t.length,r,i,!1)}else{let n=[];for(let a=0;a+1<t.length;a+=2){let o=new e.LineCurve3(t[a],t[a+1]),s=new e.TubeGeometry(o,1,r,i,!1);n.push(s)}o=M(n,!0),n.forEach(e=>e.dispose())}return o}};Tn.prototype=Object.create(G.prototype);var En=function(t){let n=t;this.toBeDownloaded=0,this.progressMap={};let r=!1,i=!1,a=new Cn;this.getDownloadProgress=()=>{let e=0,t=0,n=!1;for(let r in this.progressMap){let i=this.progressMap[r];e+=i[1],t+=i[0],i[1]==0&&(n=!0)}return n&&(e=0),[e,t,i]},this.onProgress=e=>t=>{this.progressMap[e]=[t.loaded,t.total]},this.onError=e=>t=>{--this.toBeDownloaded,i=!0,console.error(`There is an issue with external resource ${t?.responseURL?`: `+t?.responseURL:``}.`),e&&e({type:`Error`,xhr:t})};let o=(e,t)=>{let i=t.Default;if(t.Inline)n.setupMultipleViews(i,t.Entries);else{let a=[];for(let[n,r]of Object.entries(t.Entries))if(e){let t=C(r,e);a.push(new Promise((e,r)=>{fetch(t).then(e=>e.json()).then(t=>e({key:n,data:t})).catch(e=>r(e))}))}Promise.all(a).then(e=>{let t={};e.forEach(e=>{t[e.key]=e.data}),n.setupMultipleViews(i,t);let a=n.getZincCameraControls();a&&a.setCurrentViewport(i),r=!0})}};this.loadViewURL=(e,t)=>{this.toBeDownloaded+=1;let i=e;fetch(i).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(e=>{n.setupMultipleViews(`default`,{default:e}),n.resetView(),r=!0,--this.toBeDownloaded,t!==void 0&&typeof t==`function`&&t()}).catch(e=>{console.error(`Fetch failed for URL: ${i}`,e),this.onError(t)({responseURL:i})})},this.loadModelsURL=(e,t,n,r,i,o,s)=>{let c=t.length;this.toBeDownloaded+=c;for(let l=0;l<c;l++){let c=t[l],u=rr.defaultMaterialColor,d=rr.defaultOpacity;n!=null&&n[l]!=null&&(u=!!n[l]),r!=null&&r[l]!=null&&(d=r[l]);let f=0;i!=null&&i[l]!=null&&(f=!!i[l]);let p=0;o!=null&&o[l]!=null&&(p=!!o[l]),a.load(c,m(e,u,d,f,p,void 0,void 0,void 0,void 0,s),this.onProgress(c),this.onError(s))}},this.loadFromViewURL=(e,t,r)=>{let i=t+`_view.json`;fetch(i).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(i=>{n.loadView(i);let a=[],o=t+`_`;for(let e=0;e<i.numberOfResources;e++){let t=o+(e+1)+`.json`;a.push(t)}this.loadModelsURL(e,a,i.colour,i.opacity,i.timeEnabled,i.morphColour,r)}).catch(e=>{console.error(`Failed to load view data from: ${i}`,e)})};let s=(t,r,i,o,s,c,l,u,d)=>(f,p)=>{let m=u?new Tn:new We,h;p&&p[0]&&(h=new e.LineBasicMaterial({color:p[0].color.clone()}),1>p[0].opacity&&(h.transparent=!0),h.opacity=p[0].opacity,h.morphTargets=r,h.vertexColors=p[0].vertexColors);let g={};if(g.localTimeEnabled=r,g.localMorphColour=i,m&&(m.createLineSegment(f,h,g),m.setName(o),m.setAnatomicalId(s),m.setRenderOrder(c),t.addZincObject(m),m.setDuration(n.getDuration()),l&&l.levels))for(let[e,t]of Object.entries(l.levels))m.addLOD(a,e,t.URL,t.Index,l.preload);--this.toBeDownloaded,f.dispose(),d!=null&&typeof d==`function`&&d(m)};this.loadLinesURL=(e,t,n,r,i,o,c)=>{let l=0;this.toBeDownloaded+=1;let u=c?.isInline?c.isInline:!1,d=c?.anatomicalId?c.anatomicalId:void 0,f=c&&`renderOrder`in c?c.renderOrder:void 0;n!=null&&(l=!!n);let p=0;r!=null&&(p=!!r);let m=c.tubeLines&&!l&&!p;if(u){let n=a.parse(t);s(e,l,p,i,d,f,c.lod,m,o)(n.geometry,n.materials)}else a.load(t,s(e,l,p,i,d,f,c.lod,m,o),this.onProgress(t),this.onError(o),c.loaderOptions)};let c=(e,t,r,i,a)=>o=>{let s=o;(typeof s==`string`||s instanceof String)&&(s=JSON.parse(o));let c=a&&a.isInline?a.isInline:void 0,l=a&&a.anatomicalId?a.anatomicalId:void 0,u=!a?.displayLabels||a.displayLabels,d=a&&`renderOrder`in a?a.renderOrder:void 0,f=new Ne;f.setDuration(n.getDuration()),f.groupName=r,++this.toBeDownloaded,f.load(s,t,()=>{--this.toBeDownloaded,i!=null&&typeof i==`function`&&i(f)},c,u),f.setAnatomicalId(l),f.setRenderOrder(d),e.addZincObject(f)};this.loadGlyphsetURL=(e,t,n,r,i,o)=>{o&&o.isInline&&o.isInline?c(e,n,r,i,o)(t):a.load(t,c(e,n,r,i,o),this.onProgress(t),this.onError(i),o.loaderOptions)};let l=(t,r,i,a,o,s,c)=>(l,u)=>{let d=new Ue,f=new e.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});u&&u[0]&&(1>u[0].opacity&&(f.transparent=!0),f.opacity=u[0].opacity,f.color=u[0].color,f.morphTargets=r,f.vertexColors=u[0].vertexColors);let p={};p.localTimeEnabled=r,p.localMorphColour=i,d&&(d.createMesh(l,f,p),d.setName(a),d.setAnatomicalId(o),t.addZincObject(d),d.setDuration(n.getDuration()),d.setRenderOrder(s)),l.dispose(),--this.toBeDownloaded,c!=null&&typeof c==`function`&&c(d)};this.loadSTL=(e,t,n,r)=>{this.toBeDownloaded+=1;let i=rr.defaultMaterialColor,a=rr.defaultOpacity,o=new wn;o.crossOrigin=`Anonymous`,o.load(t,m(e,i,a,!1,!1,n,void 0,void 0,void 0,r))},this.loadOBJ=(e,t,n,r)=>{this.toBeDownloaded+=1;let i=rr.defaultMaterialColor,a=rr.defaultOpacity,o=new _n;o.crossOrigin=`Anonymous`,o.load(t,m(e,i,a,!1,!1,n,void 0,void 0,void 0,r))};let u=(e,t,n,r,i,o,s)=>{this.toBeDownloaded+=1;let c=rr.defaultMaterialColor,l=rr.defaultOpacity,u=0,d=s&&s.isInline?s.isInline:!1,f=s&&s.fileFormat?s.fileFormat:void 0,p=s&&s.anatomicalId?s.anatomicalId:void 0,h=s&&`renderOrder`in s?s.renderOrder:void 0;n!=null&&(u=!!n);let g=0;r!=null&&(g=!!r);let _=a;if(f!==void 0){if(f==`STL`)_=new wn;else if(f==`OBJ`){_=new _n,_.crossOrigin=`Anonymous`,_.load(t,objloader(e,c,l,u,g,i,p,o),this.onProgress(t),this.onError,s.loaderOptions);return}}if(d){let n=a.parse(t);m(e,c,l,u,g,i,p,h,s,o)(n.geometry,n.materials)}else _.crossOrigin=`Anonymous`,a.load(t,m(e,c,l,u,g,i,p,h,s,o),this.onProgress(t),this.onError(o),s.loaderOptions)},d=function(e,t,i){let a=0;return o=>{if(a+=1,o&&t!=null&&typeof t==`function`&&t(o),a==e&&(r===!1&&n.viewAll(),i!=null&&typeof i==`function`)){i();let e=n.getZincCameraControls();e&&e.calculateMaxAllowedDistance(n)}}};this.loadPointsetURL=(e,t,n,r,i,o,s)=>{let c=0;this.toBeDownloaded+=1,n!=null&&(c=!!n);let u=0;r!=null&&(u=!!r);let d=s&&s.isInline?s.isInline:!1,f=s&&s.anatomicalId?s.anatomicalId:void 0,p=s&&`renderOrder`in s?s.renderOrder:void 0;if(d){let n=a.parse(t);l(e,c,u,i,f,p,o)(n.geometry,n.materials)}else a.load(t,l(e,c,u,i,f,p,o),this.onProgress(t),this.onError(o),s.loaderOptions)};let f=(e,t,n,r,i,a)=>{let o=a&&a.isInline?a.isInline:void 0,s=a&&a.anatomicalId?a.anatomicalId:void 0,c=a&&`renderOrder`in a?a.renderOrder:void 0,l;if(n){if(t&&n.images&&n.images.source){let e=n.images.source;for(let r=0;r<e.length;r++){let i=C(e[r],t);n.images.source[r]=i}}n.type===`slides`&&(l=new Qe),l&&(l.groupName=r,++this.toBeDownloaded,l.load(n,()=>{e.addZincObject(l),--this.toBeDownloaded,i!=null&&typeof i==`function`&&i(l)},o),l.setAnatomicalId(s),l.setRenderOrder(c))}};this.loadTextureURL=(e,t,n,r,i)=>{if(i&&i.isInline&&i.isInline)f(e,void 0,t,n,r,i);else{let a=t;fetch(a).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=e.url||new URL(a).href;return e.json().then(e=>({textureData:e,referenceURL:t}))}).then(({textureData:t,referenceURL:a})=>{f(e,a,t,n,r,i)}).catch(e=>{console.error(`Fetch failed for texture URL: ${a}`,e)})}};let p=(e,t,r,i,a,o,s,c,l,u,d)=>{let f={};f.colour=r,f.opacity=i,f.localTimeEnabled=a,f.localMorphColour=o;let p=new ve;if(p.createMesh(t,c,f),p.getMorph())return p.setName(l),p.setRenderOrder(u),p.setAnatomicalId(d),e&&e.addZincObject(p),p.setDuration(n.getDuration()),s!=null&&typeof s==`function`&&s(p),p.videoHandler&&n.setVideoHandler(p.videoHandler),p},m=(e,t,n,r,i,o,s,c,l,u)=>(d,f)=>{let m;f&&f[0]&&(m=f[0]);let h=p(e,d,t,n,r,i,void 0,m,o,c,s);if(l.lod&&l.lod.levels)for(let[e,t]of Object.entries(l.lod.levels))h.addLOD(a,e,t.URL,t.Index,l.lod.preload);--this.toBeDownloaded,d.dispose(),u!=null&&typeof u==`function`&&u(h)},h=e=>{let[,t,n,r,i,a,o,s]=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);return{years:t,months:n,weeks:r,days:i,hours:a,mins:o,secs:s}};this.loadSettings=e=>{if(e){if(e.Duration){let t=h(e.Duration);n.setDurationFromObject(t)}if(e.OriginalDuration){let t=h(e.OriginalDuration);n.setOriginalDurationFromObject(t)}if(e.TimeStamps)for(let t in e.TimeStamps){let r=h(e.TimeStamps[t]);n.addMetadataTimeStamp(t,r)}}};let g=(e,t,n,r,i)=>{if(n){let a,o=!1;n.URL?(a=n.URL,t&&(a=C(a,t))):n.Inline&&(a=n.Inline.URL,o=!0);let s={};if(n.LOD&&n.LOD.Levels){s.preload=!!n.LOD.Preload,s.levels={};for(let[e,r]of Object.entries(n.LOD.Levels))s.levels[e]={},s.levels[e].URL=C(r.URL,t),s.levels[e].Index=r.Index}let c=n.GroupName;(c===void 0||c===``)&&(c=`_Unnamed`);let l={loaderOptions:{index:n.Index},isInline:o,fileFormat:n.FileFormat,anatomicalId:n.AnatomicalId,compression:n.compression,tubeLines:n.tubeLines,lod:s,renderOrder:r};switch(n.Type){case`Surfaces`:u(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Glyph`:let r;o?r=n.Inline.GlyphGeometriesURL:(r=n.GlyphGeometriesURL,r=C(n.GlyphGeometriesURL,t)),l.displayLabels=!n.displayLabels||n.displayLabels,l.loaderOptions.isGlyphsets=!0,this.loadGlyphsetURL(e,a,r,c,i,l);break;case`Points`:this.loadPointsetURL(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Lines`:this.loadLinesURL(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Texture`:this.loadTextureURL(e,a,c,i,l)}}},_=(e,t,i)=>{if(t){let a,o=!1;switch(t.URL?(a=t.URL,e&&(a=C(t.URL,e))):t.Inline&&(a=t.Inline.URL,o=!0),t.Type){case`View`:o?(n.setupMultipleViews(`default`,{default:a}),r=!0,i!=null&&typeof i==`function`&&i()):this.loadViewURL(a,i);break;case`Settings`:this.loadSettings(t)}}};this.loadGLTF=(e,t,r,i,a)=>{new on().load(n,e,t,r,i,a)};let v=(e,t,n,r)=>{if(n.Primitives&&n.Primitives.forEach(n=>{let i=1;n.Order&&(i=n.Order),g(e,t,n,i,r)}),n.Transformation&&e.setTransformation(n.Transformation),n.Children)for(let[i,a]of Object.entries(n.Children)){let n=e.findOrCreateChildFromPath(i);n&&v(n,t,a,r)}},y=(e,t)=>{let n=e,r=t?.enabled?.include,i=t?.enabled?.exclude,a=t?.tubeLines;return(r?.length||i?.length)&&(r&&(n=e.filter(e=>{if(e.Type===`View`)return!0;for(let t=0;t<r.length;t++)if(ee(e.RegionPath,e.GroupName,r[t]))return!0;return!1})),i&&(n=n.filter(e=>{if(e.Type===`View`)return!0;for(let t=0;t<i.length;t++)if(ee(e.RegionPath,e.GroupName,i[t]))return!1;return!0}))),a&&n.forEach(e=>{e.Type===`Lines`&&(e.tubeLines=!0)}),n},b=(e,t)=>Array.isArray(e)?y(e,t):e,x=(e,t)=>{if(Array.isArray(e)){let n=0;for(let r=0;r<e.length;r++)e[r].Type&&(t&&e[r].Type===`View`||e[r].Type===`Surfaces`||e[r].Type===`Glyph`||e[r].Type===`Points`||e[r].Type===`Lines`||e[r].Type===`Texture`)&&n++;return n}return 0},S=e=>{let t=e.Primitives?x(e.Primitives,!1):0;return e.Children&&Object.values(e.Children).forEach(e=>{t+=S(e)}),t},w=e=>{if(Array.isArray(e))return x(e,!0);if(typeof e==`object`&&e&&e.Version===`2.0`)return S(e.Regions)},T=(e,t,n,r,i)=>{let a=e;n.RegionPath&&n.RegionPath!==``&&(a=e.findOrCreateChildFromPath(n.RegionPath)),g(a,t,n,r*2,i)},E=(e,t,n,r,i,a)=>{let o=b(t,a),s=w(o),c=new d(s,r,i);for(let e=0;e<t.length;e++)_(n,o[e],c);for(let r=0;r<t.length;r++)T(e,n,o[r],r,c)},D=(e,t,n,r,i)=>{let a=w(t),s=new d(a,r,i);t.Settings&&this.loadSettings(t.Settings),t.Views&&o(n,t.Views,n),t.Regions&&v(e,n,t.Regions,s)};this.loadMetadataURL=(e,t,i,a,o)=>{let s=t;fetch(s).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=e.url||new URL(s).href;return e.json().then(e=>({metadata:e,referenceURL:t}))}).then(({metadata:t,referenceURL:s})=>{n.resetMetadata(),n.resetDuration(),r=!1,Array.isArray(t)?E(e,t,s,i,a,o):typeof t==`object`&&t&&t.Version===`2.0`&&D(e,t,s,i,a)}).catch(e=>{console.error(`Fetch failed for URL: ${s}`,e)})}},Dn=0,On=function(){return`sc`+Dn++},kn=function(){return{Duration:`6 secs`,OriginalDuration:`-`,TimeStamps:{}}},An=6e3,jn=function(t,n){let r=t,i,a,o=new En(this),s,c={},l=0,u={},d=0,f=new e.Scene,p=new e.Scene,m=new It(void 0,this);f.add(m.getGroup());let h=new e.Group;f.add(h),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;let g=6e3,_;this.sceneName=void 0;let v=!1,y;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:`top-right`,updateRequired:!0};let b={x:0,y:0},x=kn(),S=new e.Vector2,C=[];this.forcePickableObjectsUpdate=!1,this.uuid=On();let w=new mt(this);w.disable(),f.add(w.group);let T={main:[],mini:[]},E=new e.Vector3(0,0,0),D=()=>r?r.clientWidth===void 0?r.width:r.clientWidth:0,O=()=>r?r.clientHeight===void 0?r.height:r.clientHeight:0;this.getDownloadProgress=()=>o.getDownloadProgress(),this.onWindowResize=()=>{let e=O();this.camera.aspect=D()/e,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,_.onResize(),_.calculateHeightPerPixelAtZeroDepth(e)},this.resetView=()=>{this.onWindowResize(),_.resetView()},this.changeZoomByScrollRateUnit=e=>{_.changeZoomByScrollRateUnit(e)},this.camera=new e.PerspectiveCamera(40,D()/O(),0,10),this.ambient=new e.AmbientLight(16777215,.2),f.add(this.ambient),this.directionalLight=new e.DirectionalLight(16777215,.8),f.add(this.directionalLight),_=new et(this.camera,n.domElement,n,this),_.setDirectionalLight(this.directionalLight),_.resetView(),s=new ht(this),this.loadView=e=>{let t=new $e;return t.setFromObject(e),_.setCurrentCameraSettings(t),!0},this.setupMultipleViews=(e,t)=>{for(let[e,n]of Object.entries(t)){let t=new $e;t.setFromObject(n),_.addViewport(e,t)}_.setDefaultViewport(e)},this.getBoundingBox=()=>m.getBoundingBox(!0),this.viewAllWithBoundingBox=e=>{if(e){let t=_.getViewportFromBoundingBox(e,1);_.setCurrentCameraSettings(t),_.calculateHeightPerPixelAtZeroDepth(O()),w.markerUpdateRequired=!0}},this.viewAll=()=>{let e=this.getBoundingBox();this.viewAllWithBoundingBox(e),w.markerUpdateRequired=!0},this.forEachGeometry=e=>{m.forEachGeometry(e,!0)},this.forEachGlyphset=e=>{m.forEachGlyphset(e,!0)},this.forEachPointset=e=>{m.forEachPointset(e,!0)},this.forEachLine=e=>{m.forEachLine(e,!0)},this.findGeometriesWithGroupName=e=>m.findGeometriesWithGroupName(e,!0),this.findPointsetsWithGroupName=e=>m.findPointsetsWithGroupName(e,!0),this.findGlyphsetsWithGroupName=e=>m.findGlyphsetsWithGroupName(e,!0),this.findLinesWithGroupName=e=>m.findLinesWithGroupName(e,!0),this.findObjectsWithGroupName=e=>m.findObjectsWithGroupName(e,!0),this.findObjectsWithAnatomicalId=e=>m.findObjectsWithAnatomicalId(e,!0),this.getBoundingBoxOfZincObjects=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n].getBoundingBox();r&&(t?t.union(r):t=r)}return t},this.vectorToScreenXY=e=>{e.project(this.camera);let t=D(),n=O(),r=t/2,i=n/2;return e.x=e.x*r+r,e.y=-(e.y*i)+i,e},this.getObjectsScreenXY=t=>{if(t&&t.length>0){let n=this.getBoundingBoxOfZincObjects(t),r=new e.Vector3;return n.getCenter(r),this.vectorToScreenXY(r)}},this.getNamedObjectsScreenXY=e=>{let t=this.findObjectsWithGroupName(e);return this.getObjectsScreenXY(t)},this.addZincObject=e=>{e&&(m.addZincObject(e),_&&_.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(e,t,n,r)=>{o.loadGlyphsetURL(m,e,t,n,r)},this.loadPointsetURL=(e,t,n,r,i)=>{o.loadPointsetURL(m,e,t,n,r,i)},this.loadLinesURL=(e,t,n,r,i)=>{o.loadLinesURL(m,e,t,n,r,i)},this.loadSTL=(e,t,n)=>{o.loadSTL(m,e,t,n)},this.loadOBJ=(e,t,n)=>{o.loadOBJ(m,e,t,n)},this.loadMetadataURL=(e,t,n,r)=>{o.loadMetadataURL(m,e,t,n,r)},this.loadModelsURL=(e,t,n,r,i,a)=>{o.loadModelsURL(m.urls,t,n,r,i,a)},this.loadViewURL=e=>{o.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{o.loadFromViewURL(e,t)},this.loadGLTF=(e,t,n,r)=>{o.loadGLTF(m,e,t,n,r)},this.updateDirectionalLight=()=>{_.updateDirectionalLight()},this.addObject=e=>{f.add(e)},this.removeObject=e=>{f.remove(e)},this.getCurrentTime=()=>{if(a!=null)return a.getCurrentTime(g);let e=m.getCurrentTime();return e===-1?0:e},this.setMorphsTime=e=>{a?.setMorphTime(e,g),m.setMorphTime(e,!0)},this.isTimeVarying=()=>a&&a.video&&!a.video.error?!0:m.isTimeVarying(),this.renderGeometries=(e,t,n)=>{let r={};if(r.camera=_,r.displayMarkers=this.displayMarkers,r.markerCluster=w,r.markersList=w.markers,r.ndcToBeUpdated=!1,n&&(r.markerCluster.markerUpdateRequired=!0),a){if(a.isReadyToPlay()){n?a.video.play():a.video.pause();let e=a.video.currentTime/a.getVideoDuration()*g;o.toBeDownloaded==0?(_.setTime(e),r.ndcToBeUpdated=_.update(0),r.ndcToBeUpdated&&_.calculateHeightPerPixelAtZeroDepth(O()),m.setMorphTime(e,!0),m.renderGeometries(0,0,n,_,r,!0)):_.update(0)}else myPlayRate=0}else o.toBeDownloaded==0?(r.ndcToBeUpdated=_.update(t),r.ndcToBeUpdated&&_.calculateHeightPerPixelAtZeroDepth(O()),m.renderGeometries(e,t,n,_,r,!0)):_.update(0)},this.getThreeJSScene=()=>f,this.setVideoHandler=e=>{a||=e},this.setAdditionalScenesGroup=e=>{f.add(e)};let k=(e,t,n,r,i,a,o)=>{let s=0,c=0;return c=e.includes(`top`)?o-i-n:e.includes(`bottom`)?n:Math.floor((o-i)/2),s=e.includes(`left`)?t:e.includes(`right`)?a-t-r:Math.floor((a-r)/2),{x:s,y:c}},A=e=>{(this.displayMinimap||this.displayMiniAxes)&&(e.setScissorTest(!0),e.getSize(S),this.minimapScissor.updateRequired&&(b=k(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,S.x,S.y),this.minimapScissor.updateRequired=!1),e.setScissor(b.x,b.y,this.minimapScissor.width,this.minimapScissor.height),e.setViewport(b.x,b.y,this.minimapScissor.width,this.minimapScissor.height),s.updateCamera(),this.displayMiniAxes?e.render(p,s.camera):(f.add(s.mask),e.render(f,s.camera),f.remove(s.mask)),e.setScissorTest(!1),e.setViewport(0,0,S.x,S.y))};this.render=e=>{this.autoClearFlag&&e.clear(),v&&y?y.render(f,this.camera):(e.render(f,this.camera),A(e))},this.setInteractiveControlEnable=e=>{e==1?_.enable():_.disable()},this.getZincCameraControls=()=>_,this.getThreeJSScene=()=>f,this.setDuration=e=>{m.setDuration(e),g=e,_.setPathDuration(e),o.duration=e},this.getDuration=()=>g,this.setStereoEffectEnable=e=>{e==1&&(y||=new ot(n)),n.setSize(D(),O()),this.camera.updateProjectionMatrix(),v=e},this.objectIsInScene=e=>m.objectIsInRegion(e,!0),this.alignBoundingBoxToCameraView=(t,n)=>{if(t){t.getCenter(E);let r=this.getZincCameraControls().getCurrentViewport(),i=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new e.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),o=new e.Vector3,s=new e.Vector3;o.subVectors(i,a).normalize(),s.subVectors(i,E).normalize();let c=new e.Vector3;c.crossVectors(o,s);let l=o.angleTo(s);n>0?(this.getZincCameraControls().rotateCameraTransition(c,l,n),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(c,l),w.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(e,t,n)=>{if(e){let r=this.getZincCameraControls().getCurrentViewport(),i=this.getZincCameraControls().getViewportFromBoundingBox(e,t);n>0&&(this.getZincCameraControls().cameraTransition(r,i,n),this.getZincCameraControls().enableCameraTransition()),w.markerUpdateRequired=!0}},this.alignObjectToCameraView=(e,t)=>{if(this.objectIsInScene(e)){let n=e.getBoundingBox();this.alignBoundingBoxToCameraView(n,t)}},this.setCameraTargetToObject=t=>{if(this.objectIsInScene(t)){let n=t.getBoundingBox(),r=this.getZincCameraControls().getCurrentViewport();n.getCenter(E);let i=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new e.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),o=new e.Vector3,s=new e.Vector3;o.subVectors(a,i),s.addVectors(E,o),r.eyePosition[0]=s.x,r.eyePosition[1]=s.y,r.eyePosition[2]=s.z,r.targetPosition[0]=E.x,r.targetPosition[1]=E.y,r.targetPosition[2]=E.z,this.getZincCameraControls().setCurrentCameraSettings(r),w.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>v,this.removeZincObject=e=>{m.removeZincObject(e),_&&_.calculateMaxAllowedDistance(this),w.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{C.length=0,w.isEnabled&&C.push(w.group),m.getPickableThreeJSObjects(C,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||m.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),C),this.getNormalisedMinimapCoordinates=(t,n)=>{if(this.displayMinimap){let r=new e.Vector2;t.getSize(r);let i=r.y-n.clientY;if(b.x+this.minimapScissor.width>n.clientX&&n.clientX>b.x&&b.y+this.minimapScissor.height>i&&i>b.y)return{x:(n.clientX-b.x)/this.minimapScissor.width*2-1,y:(i-b.y)/this.minimapScissor.height*2-1}}},this.getMinimapDiffFromNormalised=(e,t)=>{if(s)return s.getDiffFromNormalised(e,t)},this.isWebGL2=()=>n.isWebGL2(),this.clearAll=()=>{w.clear(),m.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),o.toBeDwonloaded=0,_&&_.calculateMaxAllowedDistance(this),w.markerUpdateRequired=!0},this.addMetadataTimeStamp=(e,t)=>{x.TimeStamps[e]=M(t)},this.getMetadataTag=e=>x[e],this.getMetadata=()=>x,this.setMetadataTag=(e,t)=>{x[e]=t},this.removeMetadataTag=e=>{delete x[e]},this.resetMetadata=()=>{x=kn()},this.resetDuration=()=>{this.setDuration(An)};let j=e=>[...e.years?[`${e.years}years`]:[],...e.months?[`${e.months}months`]:[],...e.weeks?[`${e.weeks}weeks`]:[],...e.days?[`${e.days}days`]:[],...e.hours?[`${e.hours}hours`]:[],...e.mins?[`${e.mins}mins`]:[],...e.secs?[`${e.secs}secs`]:[]].join(` `),M=e=>e.years?e.years*31536e6:0+e.months?e.months*2592e6:0+e.weeks?e.weeks*6048e5:0+e.days?e.days*864e5:0+e.hours?e.hours*36e5:0+e.mins?e.mins*6e4:0+e.secs?e.secs*1e3:0;this.setDurationFromObject=e=>{let t=j(e),n=M(e);this.setMetadataTag(`Duration`,t),this.setDuration(n)},this.setOriginalDurationFromObject=e=>{let t=j(e);this.setMetadataTag(`OriginalDuration`,t)},this.exportGLTF=e=>new an(this).exportGLTF(e),this.getRootRegion=()=>m,this.createLines=(e,t,n,r)=>{let i=m.findChildFromPath(e);return i===void 0&&(i=m.createChildFromPath(e)),i.createLines(t,n,r)},this.createPoints=(e,t,n,r,i)=>{let a=m.findChildFromPath(e);return a===void 0&&(a=m.createChildFromPath(e)),a.createPoints(t,n,r,i)},this.addZincObjectAddedCallbacks=e=>(l+=1,c[l]=e,l),this.addZincObjectRemovedCallbacks=e=>(d+=1,u[d]=e,d),this.removeZincObjectAddedCallbacks=e=>{e in l&&delete c[e]},this.removeZincObjectRemovedCallbacks=e=>{e in d&&delete u[e]},this.clearZincObjectAddedCallbacks=()=>{c={},l=0},this.clearZincObjectRemovedCallbacks=()=>{u={},d=0},this.triggerObjectAddedCallback=e=>{for(let t in c)c.hasOwnProperty(t)&&c[t](e)},this.triggerObjectRemovedCallback=e=>{for(let t in u)u.hasOwnProperty(t)&&u[t](e)},this.addTemporaryPoints=(t,n)=>{let r=N(t.length,t),i=new e.PointsMaterial({alphaTest:.5,size:15,color:n,sizeAttenuation:!1});i.map=P();let a=new Be(r,i);return h.add(a),a},this.addTemporaryLines=(t,n)=>{let r=new le(N(t.length,t),new e.LineBasicMaterial({color:n}));return h.add(r),r},this.enableFrustumDisplay=()=>{this.camera&&!i&&(i=new e.CameraHelper(this.camera),f.add(i))},this.disableFrustumDisplay=()=>{i&&=(f.remove(i),i.dispose(),void 0)},this.removeTemporaryPrimitive=e=>{h.remove(e),e.geometry.dispose(),e.material.dispose()},this.clearTemporaryPrimitives=()=>{let e=0;return h.children.forEach(t=>{t.geometry.dispose(),t.material.dispose(),e++}),h.clear(),e},this.addBoundingBoxPrimitive=(t,n,r,i,a,o=void 0)=>{let s=m.findChildFromPath(t);s===void 0&&(s=m.createChildFromPath(t));let c=o||this.getBoundingBox();E.set(0,0,0);let l=E.subVectors(c.max,c.min),u=new e.BoxGeometry(l.x,l.y,l.z),d=s.createGeometryFromThreeJSGeometry(n,u,r,i,a,1e4);return l.addVectors(c.min,c.max).multiplyScalar(.5),d.setPosition(l.x,l.y,l.z),d},this.addSlicesPrimitive=(t,n,r,i,a,o=void 0)=>{if(n&&n.length>=3&&r&&r.length>=3){let s=m.findChildFromPath(t);s===void 0&&(s=m.createChildFromPath(t));let c=o||this.getBoundingBox();E.set(0,0,0);let l=E.subVectors(c.max,c.min),u=[`x`,`y`,`z`],d=[],f=0;return u.forEach(t=>{let o;switch(t){case`x`:o=new e.PlaneGeometry(l.z,l.y),o.rotateY(Math.PI/2);break;case`y`:o=new e.PlaneGeometry(l.x,l.z),o.rotateX(Math.PI/2);break;case`z`:o=new e.PlaneGeometry(l.x,l.y)}let c=s.createGeometryFromThreeJSGeometry(n[f],o,r[f],i,a,10001);d.push(c),f++}),l.addVectors(c.min,c.max).multiplyScalar(.5),d.forEach(e=>{e.setPosition(l.x,l.y,l.z)}),d}},this.enableMarkerCluster=e=>{e?(w.markerUpdateRequired=!0,w.enable()):(w.markerUpdateRequired=!1,w.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,T.main&&(this.enableAxisDisplay(!1,!1),T.main.forEach(e=>{e.dispose&&e.dispose()})),T.mini&&(this.enableAxisDisplay(!1,!0),T.mini.forEach(e=>{e.dispose&&e.dispose()})),T={main:[],mini:[]}},this.createAxisDisplay=(t=!1)=>{this.destroyAxisDisplay();let n=[{name:`x`,dir:new e.Vector3(1,0,0),colour:`red`,hex:16733525},{name:`y`,dir:new e.Vector3(0,1,0),colour:`green`,hex:5635925},{name:`z`,dir:new e.Vector3(0,0,1),colour:`blue`,hex:5592575}],r=this.getBoundingBox(),i=r.min.distanceTo(r.max),a=new e.Vector3(0,0,0);t&&a.copy(r.min),n.forEach(t=>{let n=new e.ArrowHelper(t.dir,a,i,t.hex);T.main.push(n);let o=new e.ArrowHelper(t.dir,r.getCenter(E),i/2,t.hex);T.mini.push(o);let s=F(t.name,.036,t.colour,`Asap`,120,700),c=t.dir.clone().multiplyScalar(i).add(a);s.position.set(c.x,c.y,c.z),T.main.push(s)})},this.enableAxisDisplay=(e,t=!1)=>{t&&T?.mini?.length?(this.displayMiniAxes=e,T.mini.forEach(t=>{e?p.add(t):p.remove(t)})):!t&&T.main&&T.main.forEach(t=>{e?f.add(t):f.remove(t)})}},Mn=function(t){let r=t,i,a,o=new e.Clock(!1);this.playAnimation=!0;let s=1e3,c={},l=0,u={},d=0,f={},p=0,m={},h=0,g,_,v,y,b=[],x=[],S=new e.Group,C,w,T=!1,E=!1;this.getDrawingWidth=()=>r?r.clientWidth:C?C.clientWidth===void 0?Math.round(C.width):Math.round(C.clientWidth):0,this.getDrawingHeight=()=>r?r.clientHeight:C?C.clientHeight===void 0?Math.round(C.height):Math.round(C.clientHeight):0,this.onWindowResize=()=>{a.onWindowResize();let t=this.getDrawingWidth(),n=this.getDrawingHeight();if(i!=null){let a;r?(a=r.getBoundingClientRect(),i.setSize(t,n)):C&&(C.getBoundingClientRect===void 0?i.setSize(t,n,!1):(a=C.getBoundingClientRect(),C.width=t,C.height=n,i.setSize(t,n,!1))),a&&(a.left,a.top);let o=new e.Vector2;i.getSize(o),o.x,o.y}},this.initialiseVisualisation=t=>{if(!E){if(t||={},t.antialias===void 0){let e=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(e=!0)}catch{e=!1}e?t.antialias=!1:t.antialias=!0}t.canvas&&(r=void 0,C=t.canvas),i=new e.WebGLRenderer(t),r!==void 0&&r.appendChild(i.domElement),i.setClearColor(16777215,1),C&&C.style&&(C.style.height=`100%`,C.style.width=`100%`);let n=i.domElement;n.addEventListener(`webglcontextlost`,D,!1),n.addEventListener(`webglcontextrestored`,O,!1),i.autoClear=!1;let a=this.createScene(`default`);this.setCurrentScene(a),E=!0}};let D=e=>{e.preventDefault();for(let e of Object.keys(c))f.hasOwnProperty(e)&&f[e].call()},O=e=>{e.preventDefault();for(let e of Object.keys(c))m.hasOwnProperty(e)&&m[e].call()};this.getCurrentScene=()=>a,this.setCurrentScene=e=>{if(e){this.removeActiveScene(e);let t=a;a=e,t&&t.setInteractiveControlEnable(!1),a.setInteractiveControlEnable(!0),a.setAdditionalScenesGroup(S),this.onWindowResize()}},this.getSceneByName=e=>b[e],this.createScene=e=>{if(b[e]==null){let t;return t=C?new jn(C,i):new jn(r,i),b[e]=t,t.sceneName=e,t}},this.resetView=()=>{a.resetView()},this.viewAll=()=>{if(a){let e=a.getBoundingBox();if(e){for(let t=0;t<x.length;t++){let n=x[t].getBoundingBox();n&&e.union(n)}a.viewAllWithBoundingBox(e)}}},this.loadModelsURL=(e,t,n,r,i,o)=>{a.loadModelsURL(e,t,n,r,i,o)},this.loadViewURL=e=>{a.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{a.loadFromViewURL(e,t)},this.updateDirectionalLight=()=>{a.updateDirectionalLight()};let k=()=>{T?(g=requestAnimationFrame(k),this.render()):(cancelAnimationFrame(g),g=void 0)};this.stopAnimate=()=>{T&&=(o.stop(),!1)},this.animate=()=>{T||(o.start(),T=!0,k())},this.addContextLostCallbackFunction=e=>(p+=1,f[p]=e,p),this.removeContextLostCallbackFunction=e=>{e in f&&delete f[e]},this.addContextRestoredCallbackFunction=e=>(h+=1,m[h]=e,h),this.removeContextRestoredCallbackFunction=e=>{e in h&&delete h[e]},this.addPreRenderCallbackFunction=e=>(l+=1,c[l]=e,l),this.removePreRenderCallbackFunction=e=>{e in c&&delete c[e]},this.addPostRenderCallbackFunction=e=>(d+=1,u[d]=e,d),this.removePostRenderCallbackFunction=e=>{e in u&&delete u[e]},this.getPlayRate=()=>s,this.setPlayRate=e=>{s=e},this.getCurrentTime=()=>a.getCurrentTime(),this.setMorphsTime=e=>{a.setMorphsTime(e)},this.getZincGeometryByID=e=>a.getZincGeometryByID(e),this.addToScene=e=>{a.addObject(e)},this.addToOrthoScene=t=>{if(v??=new e.Scene,_==null){let t=this.getDrawingWidth(),n=this.getDrawingHeight();_=new e.OrthographicCamera(-t/2,t/2,n/2,-n/2,1,10),_.position.z=10}v.add(t)};let A=t=>n=>{n.needsUpdate=!0;let r=new e.SpriteMaterial({map:n}),i=r.map.image.width,a=r.map.image.height;t.material=r,t.scale.set(i,a,1);let o=this.getDrawingWidth(),s=this.getDrawingHeight();t.position.set((o-i)/2,(-s+a)/2,1),this.addToOrthoScene(t)};this.addLogo=()=>{y=new e.Sprite,e.ImageUtils.loadTexture(`images/abi_big_logo_transparent_small.png`,void 0,A(y))},this.render=()=>{w||(r?r.clientWidth>0&&r.clientHeight>0&&(w=new n.ResizeSensor(r,this.onWindowResize)):C&&C.width>0&&C.height>0&&(w=new n.ResizeSensor(C,this.onWindowResize)));let e=o.getDelta();a.renderGeometries(s,e,this.playAnimation);for(let t=0;t<x.length;t++)x[t].renderGeometries(s,e,this.playAnimation);_!=null&&v!=null&&(i.clearDepth(),i.render(v,_));for(let e of Object.keys(c))c.hasOwnProperty(e)&&c[e].call();a.render(i);for(let e of Object.keys(u))u.hasOwnProperty(e)&&u[e].call()},this.forceContextLoss=()=>{i.forceContextLoss()},this.forceContextRestore=()=>{i.forceContextRestore()},this.getThreeJSRenderer=()=>i,this.isSceneActive=e=>{if(a===e)return!0;for(let t=0;t<x.length;t++)if(x[t]===e)return!0;return!1},this.addActiveScene=e=>{this.isSceneActive(e)||(x.push(e),S.add(e.getThreeJSScene()))},this.removeActiveScene=e=>{for(let t=0;t<x.length;t++)if(x[t]===e){x.splice(t,1),S.remove(e.getThreeJSScene());return}},this.clearAllActiveScene=()=>{for(let e=0;e<x.length;e++)S.remove(x[e].getThreeJSScene());x.splice(0,x.length)},this.dispose=()=>{T&&cancelAnimationFrame(g);for(let e in b)b.hasOwnProperty(e)&&b[e].clearAll();b=[],x=[],S=new e.Group,this.stopAnimate(),c={},l=0,u={},u=0,f={},p=0,m={},h=0,_=void 0,v=void 0,y=void 0;let t=this.createScene(`default`);this.setCurrentScene(t),w=void 0,i?.dispose()},this.transitionScene=(e,t)=>{if(a){let n=a.getZincCameraControls(),r=e.getBoundingBox();if(r){let e=r.min.distanceTo(r.max)/2,i=(r.min.x+r.max.x)/2,a=(r.min.y+r.max.y)/2,o=(r.min.z+r.max.z)/2,s=n.getViewportFromCentreAndRadius(i,a,o,e,40,e*4),c=n.getCurrentViewport();n.cameraTransition(c,s,t),n.enableCameraTransition()}}},this.isWebGL2=()=>i?i.capabilities.isWebGL2:!1},Nn=class{esize;ecode;edata;littleEndian;constructor(e,t,n,r){if(e%16!=0)throw Error(`This does not appear to be a NIFTI extension`);this.esize=e,this.ecode=t,this.edata=n,this.littleEndian=r}toArrayBuffer(){let e=new Uint8Array(this.esize),t=new Uint8Array(this.edata);e.set(t,8);let n=new DataView(e.buffer);return n.setInt32(0,this.esize,this.littleEndian),n.setInt32(4,this.ecode,this.littleEndian),e.buffer}},K=class e{static crcTable=null;static GUNZIP_MAGIC_COOKIE1=31;static GUNZIP_MAGIC_COOKIE2=139;static getStringAt(e,t,n){var r=``,i,a;for(i=t;i<n;i+=1)a=e.getUint8(i),a!==0&&(r+=String.fromCharCode(a));return r}static getByteAt=function(e,t){return e.getUint8(t)};static getShortAt=function(e,t,n){return e.getInt16(t,n)};static getIntAt(e,t,n){return e.getInt32(t,n)}static getFloatAt(e,t,n){return e.getFloat32(t,n)}static getDoubleAt(e,t,n){return e.getFloat64(t,n)}static getInt64At(e,t,n){let r=e.getUint32(t,n),i=e.getInt32(t+4,n),a;return a=n?i*2**32+r:r*2**32+i,i<0&&(a+=-1*2**32*2**32),a}static getUint64At(e,t,n){let r=e.getUint32(t+(n?0:4),n),i=e.getUint32(t+(n?4:0),n);return n?i*2**32+r:r*2**32+i}static getExtensionsAt(t,n,r,i){let a=[],o=n;for(;o<i;){let n=r,s=e.getIntAt(t,o,r);if(!s)break;if(s+o>i&&(n=!n,s=e.getIntAt(t,o,n),s+o>i))throw Error(`This does not appear to be a valid NIFTI extension`);if(s%16!=0)throw Error(`This does not appear to be a NIFTI extension`);let c=e.getIntAt(t,o+4,n),l=t.buffer.slice(o+8,o+s),u=new Nn(s,c,l,n);a.push(u),o+=s}return a}static toArrayBuffer(e){var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r;for(r=0;r<e.length;r+=1)n[r]=e[r];return t}static isString(e){return typeof e==`string`||e instanceof String}static formatNumber(t,n=void 0){let r;return r=e.isString(t)?Number(t):t,r=n?r.toPrecision(5):r.toPrecision(7),parseFloat(r)}static makeCRCTable(){let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}static crc32(t){e.crcTable||=e.makeCRCTable();let n=e.crcTable,r=-1;for(var i=0;i<t.byteLength;i++)r=r>>>8^n[(r^t.getUint8(i))&255];return(r^-1)>>>0}},Pn=class e{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description=``;aux_file=``;intent_name=``;qform_code=0;sform_code=0;quatern_a=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];qfac=1;quatern_R;magic=`0`;isHDR=!1;extensionFlag=[0,0,0,0];extensionSize=0;extensionCode=0;extensions=[];static TYPE_NONE=0;static TYPE_BINARY=1;static TYPE_UINT8=2;static TYPE_INT16=4;static TYPE_INT32=8;static TYPE_FLOAT32=16;static TYPE_COMPLEX64=32;static TYPE_FLOAT64=64;static TYPE_RGB24=128;static TYPE_INT8=256;static TYPE_UINT16=512;static TYPE_UINT32=768;static TYPE_INT64=1024;static TYPE_UINT64=1280;static TYPE_FLOAT128=1536;static TYPE_COMPLEX128=1792;static TYPE_COMPLEX256=2048;static XFORM_UNKNOWN=0;static XFORM_SCANNER_ANAT=1;static XFORM_ALIGNED_ANAT=2;static XFORM_TALAIRACH=3;static XFORM_MNI_152=4;static SPATIAL_UNITS_MASK=7;static TEMPORAL_UNITS_MASK=56;static UNITS_UNKNOWN=0;static UNITS_METER=1;static UNITS_MM=2;static UNITS_MICRON=3;static UNITS_SEC=8;static UNITS_MSEC=16;static UNITS_USEC=24;static UNITS_HZ=32;static UNITS_PPM=40;static UNITS_RADS=48;static MAGIC_COOKIE=348;static STANDARD_HEADER_SIZE=348;static MAGIC_NUMBER_LOCATION=344;static MAGIC_NUMBER=[110,43,49];static MAGIC_NUMBER2=[110,105,49];static EXTENSION_HEADER_SIZE=8;readHeader(t){var n=new DataView(t),r=K.getIntAt(n,0,this.littleEndian),i,a,o,s;if(r!==e.MAGIC_COOKIE&&(this.littleEndian=!0,r=K.getIntAt(n,0,this.littleEndian)),r!==e.MAGIC_COOKIE)throw Error(`This does not appear to be a NIFTI file!`);for(this.dim_info=K.getByteAt(n,39),i=0;i<8;i+=1)s=40+i*2,this.dims[i]=K.getShortAt(n,s,this.littleEndian);for(this.intent_p1=K.getFloatAt(n,56,this.littleEndian),this.intent_p2=K.getFloatAt(n,60,this.littleEndian),this.intent_p3=K.getFloatAt(n,64,this.littleEndian),this.intent_code=K.getShortAt(n,68,this.littleEndian),this.datatypeCode=K.getShortAt(n,70,this.littleEndian),this.numBitsPerVoxel=K.getShortAt(n,72,this.littleEndian),this.slice_start=K.getShortAt(n,74,this.littleEndian),i=0;i<8;i+=1)s=76+i*4,this.pixDims[i]=K.getFloatAt(n,s,this.littleEndian);if(this.vox_offset=K.getFloatAt(n,108,this.littleEndian),this.scl_slope=K.getFloatAt(n,112,this.littleEndian),this.scl_inter=K.getFloatAt(n,116,this.littleEndian),this.slice_end=K.getShortAt(n,120,this.littleEndian),this.slice_code=K.getByteAt(n,122),this.xyzt_units=K.getByteAt(n,123),this.cal_max=K.getFloatAt(n,124,this.littleEndian),this.cal_min=K.getFloatAt(n,128,this.littleEndian),this.slice_duration=K.getFloatAt(n,132,this.littleEndian),this.toffset=K.getFloatAt(n,136,this.littleEndian),this.description=K.getStringAt(n,148,228),this.aux_file=K.getStringAt(n,228,252),this.qform_code=K.getShortAt(n,252,this.littleEndian),this.sform_code=K.getShortAt(n,254,this.littleEndian),this.quatern_b=K.getFloatAt(n,256,this.littleEndian),this.quatern_c=K.getFloatAt(n,260,this.littleEndian),this.quatern_d=K.getFloatAt(n,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(this.quatern_b**2+this.quatern_c**2+this.quatern_d**2)),this.qoffset_x=K.getFloatAt(n,268,this.littleEndian),this.qoffset_y=K.getFloatAt(n,272,this.littleEndian),this.qoffset_z=K.getFloatAt(n,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code<this.qform_code){let e=this.quatern_a,t=this.quatern_b,n=this.quatern_c,r=this.quatern_d;for(this.qfac=this.pixDims[0]===0?1:this.pixDims[0],this.quatern_R=[[e*e+t*t-n*n-r*r,2*t*n-2*e*r,2*t*r+2*e*n],[2*t*n+2*e*r,e*e+n*n-t*t-r*r,2*n*r-2*e*t],[2*t*r-2*e*n,2*n*r+2*e*t,e*e+r*r-n*n-t*t]],a=0;a<3;a+=1)for(o=0;o<3;o+=1)this.affine[a][o]=this.quatern_R[a][o]*this.pixDims[o+1],o===2&&(this.affine[a][o]*=this.qfac);this.affine[0][3]=this.qoffset_x,this.affine[1][3]=this.qoffset_y,this.affine[2][3]=this.qoffset_z}else if(this.sform_code>0)for(a=0;a<3;a+=1)for(o=0;o<4;o+=1)s=280+(a*4+o)*4,this.affine[a][o]=K.getFloatAt(n,s,this.littleEndian);if(this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=K.getStringAt(n,328,344),this.magic=K.getStringAt(n,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,e.MAGIC_NUMBER2),n.byteLength>e.MAGIC_COOKIE){this.extensionFlag[0]=K.getByteAt(n,348),this.extensionFlag[1]=K.getByteAt(n,349),this.extensionFlag[2]=K.getByteAt(n,350),this.extensionFlag[3]=K.getByteAt(n,351);let e=!0;!this.isHDR&&this.vox_offset<=352&&(e=!1),n.byteLength<=368&&(e=!1),e&&this.extensionFlag[0]&&(this.extensions=K.getExtensionsAt(n,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode)}}toFormattedString(){var t=K.formatNumber,n=``;return n+=`Dim Info = `+this.dim_info+`
3458
+ `),i=``,a=``,o=0,s=[],c=typeof``.trimLeft==`function`;for(let e=0,t=r.length;e<t;e++)if(i=r[e],i=c?i.trimLeft():i.trim(),o=i.length,o!==0&&(a=i.charAt(0),a!==`#`)){if(a===`v`){let e=i.split(/\s+/);switch(e[0]){case`v`:n.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?n.colors.push(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6])):n.colors.push(void 0,void 0,void 0);break;case`vn`:n.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:n.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if(a===`f`){let e=i.substr(1).trim().split(/\s+/),t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.length>0){let e=r.split(`/`);t.push(e)}}let r=t[0];for(let e=1,i=t.length-1;e<i;e++){let i=t[e],a=t[e+1];n.addFace(r[0],i[0],a[0],r[1],i[1],a[1],r[2],i[2],a[2])}}else if(a===`l`){let e=i.substring(1).trim().split(` `),t=[],r=[];if(i.indexOf(`/`)===-1)t=e;else for(let n=0,i=e.length;n<i;n++){let i=e[n].split(`/`);i[0]!==``&&t.push(i[0]),i[1]!==``&&r.push(i[1])}n.addLineGeometry(t,r)}else if(a===`p`){let e=i.substr(1).trim().split(` `);n.addPointGeometry(e)}else if((s=sn.exec(i))!==null){let e=(` `+s[0].substr(1).trim()).substr(1);n.startObject(e)}else if(ln.test(i))n.object.startMaterial(i.substring(7).trim(),n.materialLibraries);else if(cn.test(i))n.materialLibraries.push(i.substring(7).trim());else if(un.test(i))console.warn(`THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.`);else if(a===`s`){if(s=i.split(` `),s.length>1){let e=s[1].trim().toLowerCase();n.object.smooth=e!==`0`&&e!==`off`}else n.object.smooth=!0;let e=n.object.currentMaterial();e&&(e.smooth=n.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}n.finalize();let l=new e.Group;if(l.materialLibraries=[].concat(n.materialLibraries),n.objects.length!==1||n.objects[0].geometry.vertices.length!==0)for(let t=0,r=n.objects.length;t<r;t++){let r=n.objects[t],i=r.geometry,a=r.materials,o=i.type===`Line`,s=i.type===`Points`,c=!1;if(i.vertices.length===0)continue;let u=new e.BufferGeometry;u.setAttribute(`position`,new e.Float32BufferAttribute(i.vertices,3)),i.normals.length>0&&u.setAttribute(`normal`,new e.Float32BufferAttribute(i.normals,3)),i.colors.length>0&&(c=!0,u.setAttribute(`color`,new e.Float32BufferAttribute(i.colors,3))),i.hasUVIndices===!0&&u.setAttribute(`uv`,new e.Float32BufferAttribute(i.uvs,2));let d=[];for(let t=0,r=a.length;t<r;t++){let r=a[t],i=r.name+`_`+r.smooth+`_`+c,l=n.materials[i];if(this.materials!==null){if(l=this.materials.create(r.name),o&&l&&!(l instanceof e.LineBasicMaterial)){let t=new e.LineBasicMaterial;e.Material.prototype.copy.call(t,l),t.color.copy(l.color),l=t}else if(s&&l&&!(l instanceof e.PointsMaterial)){let t=new e.PointsMaterial({size:10,sizeAttenuation:!1});e.Material.prototype.copy.call(t,l),t.color.copy(l.color),t.map=l.map,l=t}}l===void 0&&(l=o?new e.LineBasicMaterial:s?new e.PointsMaterial({size:1,sizeAttenuation:!1}):new e.MeshPhongMaterial,l.name=r.name,l.flatShading=!r.smooth,l.vertexColors=c,n.materials[i]=l),d.push(l)}let f;if(d.length>1){for(let e=0,t=a.length;e<t;e++){let t=a[e];u.addGroup(t.groupStart,t.groupCount,e)}f=o?new e.LineSegments(u,d):s?new e.Points(u,d):new e.Mesh(u,d)}else f=o?new e.LineSegments(u,d[0]):s?new e.Points(u,d[0]):new e.Mesh(u,d[0]);f.name=r.name,l.add(f)}else if(n.vertices.length>0){let t=new e.PointsMaterial({size:1,sizeAttenuation:!1}),r=new e.BufferGeometry;r.setAttribute(`position`,new e.Float32BufferAttribute(n.vertices,3)),n.colors.length>0&&n.colors[0]!==void 0&&(r.setAttribute(`color`,new e.Float32BufferAttribute(n.colors,3)),t.vertexColors=!0);let i=new e.Points(r,t);l.add(i)}return l}},vn=e.FileLoader,yn=e=>{let t=(e,t)=>{e.metadata.number_of_vertices+=t.metadata.number_of_vertices,`labels`in e&&e.labels.push(...e.labels),[`axis1`,`axis2`,`axis3`,`colors`,`positions`,`scale`].forEach(n=>{n in e&&Object.keys(e[n]).forEach(r=>{let i=t[n][r].length;for(let a=0;a<i;a++)e[n][r].push(t[n][r][a])})})};if(e&&e.length>0)for(;e.length>1;){let n=e.splice(1,1);t(e[0],n[0])}},bn=e=>{let t=(e,t)=>{e.merge(t)};if(e&&e.length>0){for(;e.length>1;){let n=e.splice(1,1);t(e[0],n[0])}return e[0]}},xn=function(e,t,n){let r=new vn,i=new Me;r.crossOrigin=t;let a=e,o=n,s,c=!1,l=!1,u,d=[],f=e=>{let t=s[e.index];if(t){if(`GlyphGeometriesURL`in t)e.onLoad(t);else{let n=i.parse(t);e.onLoad(n.geometry,n.materials)}}else p(e,{responseURL:a})},p=e=>{e.onError&&(u||={responseURL:a},e.onError(u))};this.downloadCompleted=e=>{try{s=JSON.parse(e[0]),c=!1,l=!0,Array.isArray(s)?d.forEach(e=>f(e)):d.forEach(e=>p(e))}catch{d.forEach(e=>p(e))}};let m=()=>e=>{u=e,l=!0,c=!1,d.forEach(e=>{p(e)})},h=()=>e=>{d.forEach(t=>{t.onProgress&&t.onProgress(e)})};this.load=(e,t,n,i)=>{let g={index:e,onLoad:t,onProgress:n,onError:i};l?s?f(g):p(u):c?d.push(g):(d.push(g),c=!0,r.load(a,o,h,m))}},Sn=function(e,t,n){let r=[],i=e,a=t,o=0,s=n.isGlyphsets;this.itemDownloaded=(e,t)=>{if(r[e]=t,o++,o==i&&r.length>0){if(s){let e=r.map(e=>JSON.parse(e[0]));yn(e),a(e[0])}else{let t=r[0][1],n=bn(r.map(e=>e[0]));for(let t=1;t<i;t++)r[e][0].dispose(),r[e][1].forEach(e=>e.dispose());a(n,t)}}}},Cn=function(){let e=0;this.crossOrigin=`Anonymous`;let t=new Me,n=new vn;n.crossOrigin=`Anonymous`;let r=[],i={},a=(e,t,n,r,i)=>{let a=e.length,o=new Sn(a,t,i),c=0;e.forEach(e=>{let a=i?{...i}:{};a.msHandler=o,a.order=c,c++,s(e,t,n,r,a)})},o=(t,n,a,o,s)=>{let l=s?{...s}:{},u=i[t];if(!u){if(20>e){let n=new c(void 0,this,l);++e,u=new xn(t,this.crossOrigin,n),i[t]=u}else r.push({url:t,onLoad:n,onProgress:a,onError:o,options:s})}u&&(l.isHandler=u,u.load(s.index,n,a,o))},s=(i,a,s,l,u)=>{if(u&&u.index!==void 0)o(i,a,s,l,u);else if(20>e){++e;let r=new c(a,this,u),o=new c(l,this,u);u.isGlyphsets?n.load(i,r,s,o):(t.crossOrigin=this.crossOrigin,t.load(i,r,s,o))}else r.push({url:i,onLoad:a,onProgress:s,onError:l,options:u})};this.load=(e,t,n,r,i)=>{Array.isArray(e)?a(e,t,n,r,i):s(e,t,n,r,i)},this.loadFromWaitingList=()=>{for(;20>e;){let e=r.shift();if(e)this.load(e.url,e.onLoad,e.onProgress,e.onError,e.options);else return}},this.itemRemainingCheck=()=>{if(r.length===0&&e===0)for(let e in i)i.hasOwnProperty(e)&&delete i[e]};let c=function(t,n,r){return(...i)=>{--e,r?.msHandler?r.msHandler.itemDownloaded(r.order,i):r?.isHandler?r.isHandler.downloadCompleted(i):t&&t(...i),n.loadFromWaitingList(),n.itemRemainingCheck()}};this.parse=e=>loader.parse(e)},wn=class extends e.Loader{constructor(e){super(e)}load(t,n,r,i){let a=this,o=new e.FileLoader(this.manager);o.setPath(this.path),o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}parse(t){function n(e){let t=new DataView(e);if(84+t.getUint32(80,!0)*50===t.byteLength)return!0;let n=[115,111,108,105,100];for(let e=0;e<5;e++)if(r(n,t,e))return!1;return!0}function r(e,t,n){for(let r=0,i=e.length;r<i;r++)if(e[r]!==t.getUint8(n+r,!1))return!1;return!0}function i(t){let n=new DataView(t),r=n.getUint32(80,!0),i,a,o,s=!1,c,l,u,d,f;for(let e=0;e<70;e++)n.getUint32(e,!1)==1129270351&&n.getUint8(e+4)==82&&n.getUint8(e+5)==61&&(s=!0,c=new Float32Array(r*3*3),l=n.getUint8(e+6)/255,u=n.getUint8(e+7)/255,d=n.getUint8(e+8)/255,f=n.getUint8(e+9)/255);let p=new e.BufferGeometry,m=new Float32Array(r*3*3),h=new Float32Array(r*3*3);for(let e=0;e<r;e++){let t=84+e*50,r=n.getFloat32(t,!0),f=n.getFloat32(t+4,!0),p=n.getFloat32(t+8,!0);if(s){let e=n.getUint16(t+48,!0);e&32768?(i=l,a=u,o=d):(i=(e&31)/31,a=(e>>5&31)/31,o=(e>>10&31)/31)}for(let l=1;l<=3;l++){let u=t+l*12,d=e*3*3+(l-1)*3;m[d]=n.getFloat32(u,!0),m[d+1]=n.getFloat32(u+4,!0),m[d+2]=n.getFloat32(u+8,!0),h[d]=r,h[d+1]=f,h[d+2]=p,s&&(c[d]=i,c[d+1]=a,c[d+2]=o)}}return p.setAttribute(`position`,new e.BufferAttribute(m,3)),p.setAttribute(`normal`,new e.BufferAttribute(h,3)),s&&(p.setAttribute(`color`,new e.BufferAttribute(c,3)),p.hasColors=!0,p.alpha=f),p}function a(t){let n=new e.BufferGeometry,r=/solid([\s\S]*?)endsolid/g,i=/facet([\s\S]*?)endfacet/g,a=0,o=`[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,s=RegExp(`vertex`+o+o+o,`g`),c=RegExp(`normal`+o+o+o,`g`),l=[],u=[],d=new e.Vector3,f,p=0,m=0,h=0;for(;(f=r.exec(t))!==null;){m=h;let e=f[0];for(;(f=i.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=c.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=s.exec(n))!==null;)l.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),u.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let t=m,r=h-m;n.addGroup(t,r,p),p++}return n.setAttribute(`position`,new e.Float32BufferAttribute(l,3)),n.setAttribute(`normal`,new e.Float32BufferAttribute(u,3)),n}function o(t){return typeof t==`string`?t:e.LoaderUtils.decodeText(new Uint8Array(t))}function s(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t.buffer||t}return e}let c=s(t);return n(c)?i(c):a(o(t))}},Tn=function(){G.call(this),this.isTubeLines=!0;let t={},n={radius:1,radialSegments:8,smooth:!1};this.createLineSegment=(n,i,a)=>{if(n&&i){t={geometryIn:n,materialIn:i,options:a};let o=r(n.vertices),s=new e.MeshStandardMaterial({color:i.color}),c=new e.Mesh(o,s);this.setMesh(c,a.localTimeEnabled,a.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.setAlpha=function(e){let t=this.getMorph();t.material.opacity=e,t.material.transparent=e<1,t.material.depthWrite=e>.5},this.setWireframe=e=>{let t=this.getMorph();t.material.wireframe=e},this.setTubeLines=(e,i)=>{if(e&&i){let{geometryIn:a}=t,o=this.getMorph();o.geometry.dispose(),n=Object.assign(n,{radius:e,radialSegments:i}),o.geometry=r(a.vertices)}};let r=t=>{let{radius:r,radialSegments:i,smooth:a}=n,o;if(a){let n=new e.CatmullRomCurve3(t);o=new e.TubeGeometry(n,t.length,r,i,!1)}else{let n=[];for(let a=0;a+1<t.length;a+=2){let o=new e.LineCurve3(t[a],t[a+1]),s=new e.TubeGeometry(o,1,r,i,!1);n.push(s)}o=M(n,!0),n.forEach(e=>e.dispose())}return o}};Tn.prototype=Object.create(G.prototype);var En=function(t){let n=t;this.toBeDownloaded=0,this.progressMap={};let r=!1,i=!1,a=new Cn;this.getDownloadProgress=()=>{let e=0,t=0,n=!1;for(let r in this.progressMap){let i=this.progressMap[r];e+=i[1],t+=i[0],i[1]==0&&(n=!0)}return n&&(e=0),[e,t,i]},this.onProgress=e=>t=>{this.progressMap[e]=[t.loaded,t.total]},this.onError=e=>t=>{--this.toBeDownloaded,i=!0,console.error(`There is an issue with external resource ${t?.responseURL?`: `+t?.responseURL:``}.`),e&&e({type:`Error`,xhr:t})};let o=(e,t)=>{let i=t.Default;if(t.Inline)n.setupMultipleViews(i,t.Entries);else{let a=[];for(let[n,r]of Object.entries(t.Entries))if(e){let t=C(r,e);a.push(new Promise((e,r)=>{fetch(t).then(e=>e.json()).then(t=>e({key:n,data:t})).catch(e=>r(e))}))}Promise.all(a).then(e=>{let t={};e.forEach(e=>{t[e.key]=e.data}),n.setupMultipleViews(i,t);let a=n.getZincCameraControls();a&&a.setCurrentViewport(i),r=!0})}};this.loadViewURL=(e,t)=>{this.toBeDownloaded+=1;let i=e;fetch(i).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(e=>{n.setupMultipleViews(`default`,{default:e}),n.resetView(),r=!0,--this.toBeDownloaded,t!==void 0&&typeof t==`function`&&t()}).catch(e=>{console.error(`Fetch failed for URL: ${i}`,e),this.onError(t)({responseURL:i})})},this.loadModelsURL=(e,t,n,r,i,o,s)=>{let c=t.length;this.toBeDownloaded+=c;for(let l=0;l<c;l++){let c=t[l],u=rr.defaultMaterialColor,d=rr.defaultOpacity;n!=null&&n[l]!=null&&(u=!!n[l]),r!=null&&r[l]!=null&&(d=r[l]);let f=0;i!=null&&i[l]!=null&&(f=!!i[l]);let p=0;o!=null&&o[l]!=null&&(p=!!o[l]),a.load(c,m(e,u,d,f,p,void 0,void 0,void 0,void 0,s),this.onProgress(c),this.onError(s))}},this.loadFromViewURL=(e,t,r)=>{let i=t+`_view.json`;fetch(i).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);return e.json()}).then(i=>{n.loadView(i);let a=[],o=t+`_`;for(let e=0;e<i.numberOfResources;e++){let t=o+(e+1)+`.json`;a.push(t)}this.loadModelsURL(e,a,i.colour,i.opacity,i.timeEnabled,i.morphColour,r)}).catch(e=>{console.error(`Failed to load view data from: ${i}`,e)})};let s=(t,r,i,o,s,c,l,u,d)=>(f,p)=>{let m=u?new Tn:new We,h;p&&p[0]&&(h=new e.LineBasicMaterial({color:p[0].color.clone()}),1>p[0].opacity&&(h.transparent=!0),h.opacity=p[0].opacity,h.morphTargets=r,h.vertexColors=p[0].vertexColors);let g={};if(g.localTimeEnabled=r,g.localMorphColour=i,m&&(m.createLineSegment(f,h,g),m.setName(o),m.setAnatomicalId(s),m.setRenderOrder(c),t.addZincObject(m),m.setDuration(n.getDuration()),l&&l.levels))for(let[e,t]of Object.entries(l.levels))m.addLOD(a,e,t.URL,t.Index,l.preload);--this.toBeDownloaded,f.dispose(),d!=null&&typeof d==`function`&&d(m)};this.loadLinesURL=(e,t,n,r,i,o,c)=>{let l=0;this.toBeDownloaded+=1;let u=c?.isInline?c.isInline:!1,d=c?.anatomicalId?c.anatomicalId:void 0,f=c&&`renderOrder`in c?c.renderOrder:void 0;n!=null&&(l=!!n);let p=0;r!=null&&(p=!!r);let m=c.tubeLines&&!l&&!p;if(u){let n=a.parse(t);s(e,l,p,i,d,f,c.lod,m,o)(n.geometry,n.materials)}else a.load(t,s(e,l,p,i,d,f,c.lod,m,o),this.onProgress(t),this.onError(o),c.loaderOptions)};let c=(e,t,r,i,a)=>o=>{let s=o;(typeof s==`string`||s instanceof String)&&(s=JSON.parse(o));let c=a&&a.isInline?a.isInline:void 0,l=a&&a.anatomicalId?a.anatomicalId:void 0,u=a?.displayLabels;u===void 0&&(u=!0);let d=a&&`renderOrder`in a?a.renderOrder:void 0,f=new Ne;f.setDuration(n.getDuration()),f.groupName=r,++this.toBeDownloaded,f.load(s,t,()=>{--this.toBeDownloaded,i!=null&&typeof i==`function`&&i(f)},c,u),f.setAnatomicalId(l),f.setRenderOrder(d),e.addZincObject(f)};this.loadGlyphsetURL=(e,t,n,r,i,o)=>{o&&o.isInline&&o.isInline?c(e,n,r,i,o)(t):a.load(t,c(e,n,r,i,o),this.onProgress(t),this.onError(i),o.loaderOptions)};let l=(t,r,i,a,o,s,c)=>(l,u)=>{let d=new Ue,f=new e.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});u&&u[0]&&(1>u[0].opacity&&(f.transparent=!0),f.opacity=u[0].opacity,f.color=u[0].color,f.morphTargets=r,f.vertexColors=u[0].vertexColors);let p={};p.localTimeEnabled=r,p.localMorphColour=i,d&&(d.createMesh(l,f,p),d.setName(a),d.setAnatomicalId(o),t.addZincObject(d),d.setDuration(n.getDuration()),d.setRenderOrder(s)),l.dispose(),--this.toBeDownloaded,c!=null&&typeof c==`function`&&c(d)};this.loadSTL=(e,t,n,r)=>{this.toBeDownloaded+=1;let i=rr.defaultMaterialColor,a=rr.defaultOpacity,o=new wn;o.crossOrigin=`Anonymous`,o.load(t,m(e,i,a,!1,!1,n,void 0,void 0,void 0,r))},this.loadOBJ=(e,t,n,r)=>{this.toBeDownloaded+=1;let i=rr.defaultMaterialColor,a=rr.defaultOpacity,o=new _n;o.crossOrigin=`Anonymous`,o.load(t,m(e,i,a,!1,!1,n,void 0,void 0,void 0,r))};let u=(e,t,n,r,i,o,s)=>{this.toBeDownloaded+=1;let c=rr.defaultMaterialColor,l=rr.defaultOpacity,u=0,d=s&&s.isInline?s.isInline:!1,f=s&&s.fileFormat?s.fileFormat:void 0,p=s&&s.anatomicalId?s.anatomicalId:void 0,h=s&&`renderOrder`in s?s.renderOrder:void 0;n!=null&&(u=!!n);let g=0;r!=null&&(g=!!r);let _=a;if(f!==void 0){if(f==`STL`)_=new wn;else if(f==`OBJ`){_=new _n,_.crossOrigin=`Anonymous`,_.load(t,objloader(e,c,l,u,g,i,p,o),this.onProgress(t),this.onError,s.loaderOptions);return}}if(d){let n=a.parse(t);m(e,c,l,u,g,i,p,h,s,o)(n.geometry,n.materials)}else _.crossOrigin=`Anonymous`,a.load(t,m(e,c,l,u,g,i,p,h,s,o),this.onProgress(t),this.onError(o),s.loaderOptions)},d=function(e,t,i){let a=0;return o=>{if(a+=1,o&&t!=null&&typeof t==`function`&&t(o),a==e&&(r===!1&&n.viewAll(),i!=null&&typeof i==`function`)){i();let e=n.getZincCameraControls();e&&e.calculateMaxAllowedDistance(n)}}};this.loadPointsetURL=(e,t,n,r,i,o,s)=>{let c=0;this.toBeDownloaded+=1,n!=null&&(c=!!n);let u=0;r!=null&&(u=!!r);let d=s&&s.isInline?s.isInline:!1,f=s&&s.anatomicalId?s.anatomicalId:void 0,p=s&&`renderOrder`in s?s.renderOrder:void 0;if(d){let n=a.parse(t);l(e,c,u,i,f,p,o)(n.geometry,n.materials)}else a.load(t,l(e,c,u,i,f,p,o),this.onProgress(t),this.onError(o),s.loaderOptions)};let f=(e,t,n,r,i,a)=>{let o=a&&a.isInline?a.isInline:void 0,s=a&&a.anatomicalId?a.anatomicalId:void 0,c=a&&`renderOrder`in a?a.renderOrder:void 0,l;if(n){if(t&&n.images&&n.images.source){let e=n.images.source;for(let r=0;r<e.length;r++){let i=C(e[r],t);n.images.source[r]=i}}n.type===`slides`&&(l=new Qe),l&&(l.groupName=r,++this.toBeDownloaded,l.load(n,()=>{e.addZincObject(l),--this.toBeDownloaded,i!=null&&typeof i==`function`&&i(l)},o),l.setAnatomicalId(s),l.setRenderOrder(c))}};this.loadTextureURL=(e,t,n,r,i)=>{if(i&&i.isInline&&i.isInline)f(e,void 0,t,n,r,i);else{let a=t;fetch(a).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=e.url||new URL(a).href;return e.json().then(e=>({textureData:e,referenceURL:t}))}).then(({textureData:t,referenceURL:a})=>{f(e,a,t,n,r,i)}).catch(e=>{console.error(`Fetch failed for texture URL: ${a}`,e)})}};let p=(e,t,r,i,a,o,s,c,l,u,d)=>{let f={};f.colour=r,f.opacity=i,f.localTimeEnabled=a,f.localMorphColour=o;let p=new ve;if(p.createMesh(t,c,f),p.getMorph())return p.setName(l),p.setRenderOrder(u),p.setAnatomicalId(d),e&&e.addZincObject(p),p.setDuration(n.getDuration()),s!=null&&typeof s==`function`&&s(p),p.videoHandler&&n.setVideoHandler(p.videoHandler),p},m=(e,t,n,r,i,o,s,c,l,u)=>(d,f)=>{let m;f&&f[0]&&(m=f[0]);let h=p(e,d,t,n,r,i,void 0,m,o,c,s);if(l.lod&&l.lod.levels)for(let[e,t]of Object.entries(l.lod.levels))h.addLOD(a,e,t.URL,t.Index,l.lod.preload);--this.toBeDownloaded,d.dispose(),u!=null&&typeof u==`function`&&u(h)},h=e=>{let[,t,n,r,i,a,o,s]=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);return{years:t,months:n,weeks:r,days:i,hours:a,mins:o,secs:s}};this.loadSettings=e=>{if(e){if(e.Duration){let t=h(e.Duration);n.setDurationFromObject(t)}if(e.OriginalDuration){let t=h(e.OriginalDuration);n.setOriginalDurationFromObject(t)}if(e.TimeStamps)for(let t in e.TimeStamps){let r=h(e.TimeStamps[t]);n.addMetadataTimeStamp(t,r)}}};let g=(e,t,n,r,i)=>{if(n){let a,o=!1;n.URL?(a=n.URL,t&&(a=C(a,t))):n.Inline&&(a=n.Inline.URL,o=!0);let s={};if(n.LOD&&n.LOD.Levels){s.preload=!!n.LOD.Preload,s.levels={};for(let[e,r]of Object.entries(n.LOD.Levels))s.levels[e]={},s.levels[e].URL=C(r.URL,t),s.levels[e].Index=r.Index}let c=n.GroupName;(c===void 0||c===``)&&(c=`_Unnamed`);let l={loaderOptions:{index:n.Index},isInline:o,fileFormat:n.FileFormat,anatomicalId:n.AnatomicalId,compression:n.compression,tubeLines:n.tubeLines,lod:s,renderOrder:r};switch(n.Type){case`Surfaces`:u(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Glyph`:let r;o?r=n.Inline.GlyphGeometriesURL:(r=n.GlyphGeometriesURL,r=C(n.GlyphGeometriesURL,t)),l.displayLabels=n.DisplayLabels,l.displayLabels===void 0&&(l.displayLabels=!0),l.loaderOptions.isGlyphsets=!0,this.loadGlyphsetURL(e,a,r,c,i,l);break;case`Points`:this.loadPointsetURL(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Lines`:this.loadLinesURL(e,a,n.MorphVertices,n.MorphColours,c,i,l);break;case`Texture`:this.loadTextureURL(e,a,c,i,l)}}},_=(e,t,i)=>{if(t){let a,o=!1;switch(t.URL?(a=t.URL,e&&(a=C(t.URL,e))):t.Inline&&(a=t.Inline.URL,o=!0),t.Type){case`View`:o?(n.setupMultipleViews(`default`,{default:a}),r=!0,i!=null&&typeof i==`function`&&i()):this.loadViewURL(a,i);break;case`Settings`:this.loadSettings(t)}}};this.loadGLTF=(e,t,r,i,a)=>{new on().load(n,e,t,r,i,a)};let v=(e,t,n,r)=>{if(n.Primitives&&n.Primitives.forEach(n=>{let i=1;n.Order&&(i=n.Order),g(e,t,n,i,r)}),n.Transformation&&e.setTransformation(n.Transformation),n.Children)for(let[i,a]of Object.entries(n.Children)){let n=e.findOrCreateChildFromPath(i);n&&v(n,t,a,r)}},y=(e,t)=>{let n=e,r=t?.enabled?.include,i=t?.enabled?.exclude,a=t?.tubeLines;return(r?.length||i?.length)&&(r&&(n=e.filter(e=>{if(e.Type===`View`)return!0;for(let t=0;t<r.length;t++)if(ee(e.RegionPath,e.GroupName,r[t]))return!0;return!1})),i&&(n=n.filter(e=>{if(e.Type===`View`)return!0;for(let t=0;t<i.length;t++)if(ee(e.RegionPath,e.GroupName,i[t]))return!1;return!0}))),a&&n.forEach(e=>{e.Type===`Lines`&&(e.tubeLines=!0)}),n},b=(e,t)=>Array.isArray(e)?y(e,t):e,x=(e,t)=>{if(Array.isArray(e)){let n=0;for(let r=0;r<e.length;r++)e[r].Type&&(t&&e[r].Type===`View`||e[r].Type===`Surfaces`||e[r].Type===`Glyph`||e[r].Type===`Points`||e[r].Type===`Lines`||e[r].Type===`Texture`)&&n++;return n}return 0},S=e=>{let t=e.Primitives?x(e.Primitives,!1):0;return e.Children&&Object.values(e.Children).forEach(e=>{t+=S(e)}),t},w=e=>{if(Array.isArray(e))return x(e,!0);if(typeof e==`object`&&e&&e.Version===`2.0`)return S(e.Regions)},T=(e,t,n,r,i)=>{let a=e;n.RegionPath&&n.RegionPath!==``&&(a=e.findOrCreateChildFromPath(n.RegionPath)),g(a,t,n,r*2,i)},E=(e,t,n,r,i,a)=>{let o=b(t,a),s=w(o),c=new d(s,r,i);for(let e=0;e<t.length;e++)_(n,o[e],c);for(let r=0;r<t.length;r++)T(e,n,o[r],r,c)},D=(e,t,n,r,i)=>{let a=w(t),s=new d(a,r,i);t.Settings&&this.loadSettings(t.Settings),t.Views&&o(n,t.Views,n),t.Regions&&v(e,n,t.Regions,s)};this.loadMetadataURL=(e,t,i,a,o)=>{let s=t;fetch(s).then(e=>{if(!e.ok)throw Error(`HTTP error! status: ${e.status}`);let t=e.url||new URL(s).href;return e.json().then(e=>({metadata:e,referenceURL:t}))}).then(({metadata:t,referenceURL:s})=>{n.resetMetadata(),n.resetDuration(),r=!1,Array.isArray(t)?E(e,t,s,i,a,o):typeof t==`object`&&t&&t.Version===`2.0`&&D(e,t,s,i,a)}).catch(e=>{console.error(`Fetch failed for URL: ${s}`,e)})}},Dn=0,On=function(){return`sc`+Dn++},kn=function(){return{Duration:`6 secs`,OriginalDuration:`-`,TimeStamps:{}}},An=6e3,jn=function(t,n){let r=t,i,a,o=new En(this),s,c={},l=0,u={},d=0,f=new e.Scene,p=new e.Scene,m=new It(void 0,this);f.add(m.getGroup());let h=new e.Group;f.add(h),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;let g=6e3,_;this.sceneName=void 0;let v=!1,y;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:`top-right`,updateRequired:!0};let b={x:0,y:0},x=kn(),S=new e.Vector2,C=[];this.forcePickableObjectsUpdate=!1,this.uuid=On();let w=new mt(this);w.disable(),f.add(w.group);let T={main:[],mini:[]},E=new e.Vector3(0,0,0),D=()=>r?r.clientWidth===void 0?r.width:r.clientWidth:0,O=()=>r?r.clientHeight===void 0?r.height:r.clientHeight:0;this.getDownloadProgress=()=>o.getDownloadProgress(),this.onWindowResize=()=>{let e=O();this.camera.aspect=D()/e,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,_.onResize(),_.calculateHeightPerPixelAtZeroDepth(e)},this.resetView=()=>{this.onWindowResize(),_.resetView()},this.changeZoomByScrollRateUnit=e=>{_.changeZoomByScrollRateUnit(e)},this.camera=new e.PerspectiveCamera(40,D()/O(),0,10),this.ambient=new e.AmbientLight(16777215,.2),f.add(this.ambient),this.directionalLight=new e.DirectionalLight(16777215,.8),f.add(this.directionalLight),_=new et(this.camera,n.domElement,n,this),_.setDirectionalLight(this.directionalLight),_.resetView(),s=new ht(this),this.loadView=e=>{let t=new $e;return t.setFromObject(e),_.setCurrentCameraSettings(t),!0},this.setupMultipleViews=(e,t)=>{for(let[e,n]of Object.entries(t)){let t=new $e;t.setFromObject(n),_.addViewport(e,t)}_.setDefaultViewport(e)},this.getBoundingBox=()=>m.getBoundingBox(!0),this.viewAllWithBoundingBox=e=>{if(e){let t=_.getViewportFromBoundingBox(e,1);_.setCurrentCameraSettings(t),_.calculateHeightPerPixelAtZeroDepth(O()),w.markerUpdateRequired=!0}},this.viewAll=()=>{let e=this.getBoundingBox();this.viewAllWithBoundingBox(e),w.markerUpdateRequired=!0},this.forEachGeometry=e=>{m.forEachGeometry(e,!0)},this.forEachGlyphset=e=>{m.forEachGlyphset(e,!0)},this.forEachPointset=e=>{m.forEachPointset(e,!0)},this.forEachLine=e=>{m.forEachLine(e,!0)},this.findGeometriesWithGroupName=e=>m.findGeometriesWithGroupName(e,!0),this.findPointsetsWithGroupName=e=>m.findPointsetsWithGroupName(e,!0),this.findGlyphsetsWithGroupName=e=>m.findGlyphsetsWithGroupName(e,!0),this.findLinesWithGroupName=e=>m.findLinesWithGroupName(e,!0),this.findObjectsWithGroupName=e=>m.findObjectsWithGroupName(e,!0),this.findObjectsWithAnatomicalId=e=>m.findObjectsWithAnatomicalId(e,!0),this.getBoundingBoxOfZincObjects=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n].getBoundingBox();r&&(t?t.union(r):t=r)}return t},this.vectorToScreenXY=e=>{e.project(this.camera);let t=D(),n=O(),r=t/2,i=n/2;return e.x=e.x*r+r,e.y=-(e.y*i)+i,e},this.getObjectsScreenXY=t=>{if(t&&t.length>0){let n=this.getBoundingBoxOfZincObjects(t),r=new e.Vector3;return n.getCenter(r),this.vectorToScreenXY(r)}},this.getNamedObjectsScreenXY=e=>{let t=this.findObjectsWithGroupName(e);return this.getObjectsScreenXY(t)},this.addZincObject=e=>{e&&(m.addZincObject(e),_&&_.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(e,t,n,r)=>{o.loadGlyphsetURL(m,e,t,n,r)},this.loadPointsetURL=(e,t,n,r,i)=>{o.loadPointsetURL(m,e,t,n,r,i)},this.loadLinesURL=(e,t,n,r,i)=>{o.loadLinesURL(m,e,t,n,r,i)},this.loadSTL=(e,t,n)=>{o.loadSTL(m,e,t,n)},this.loadOBJ=(e,t,n)=>{o.loadOBJ(m,e,t,n)},this.loadMetadataURL=(e,t,n,r)=>{o.loadMetadataURL(m,e,t,n,r)},this.loadModelsURL=(e,t,n,r,i,a)=>{o.loadModelsURL(m.urls,t,n,r,i,a)},this.loadViewURL=e=>{o.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{o.loadFromViewURL(e,t)},this.loadGLTF=(e,t,n,r)=>{o.loadGLTF(m,e,t,n,r)},this.updateDirectionalLight=()=>{_.updateDirectionalLight()},this.addObject=e=>{f.add(e)},this.removeObject=e=>{f.remove(e)},this.getCurrentTime=()=>{if(a!=null)return a.getCurrentTime(g);let e=m.getCurrentTime();return e===-1?0:e},this.setMorphsTime=e=>{a?.setMorphTime(e,g),m.setMorphTime(e,!0)},this.isTimeVarying=()=>a&&a.video&&!a.video.error?!0:m.isTimeVarying(),this.renderGeometries=(e,t,n)=>{let r={};if(r.camera=_,r.displayMarkers=this.displayMarkers,r.markerCluster=w,r.markersList=w.markers,r.ndcToBeUpdated=!1,n&&(r.markerCluster.markerUpdateRequired=!0),a){if(a.isReadyToPlay()){n?a.video.play():a.video.pause();let e=a.video.currentTime/a.getVideoDuration()*g;o.toBeDownloaded==0?(_.setTime(e),r.ndcToBeUpdated=_.update(0),r.ndcToBeUpdated&&_.calculateHeightPerPixelAtZeroDepth(O()),m.setMorphTime(e,!0),m.renderGeometries(0,0,n,_,r,!0)):_.update(0)}else myPlayRate=0}else o.toBeDownloaded==0?(r.ndcToBeUpdated=_.update(t),r.ndcToBeUpdated&&_.calculateHeightPerPixelAtZeroDepth(O()),m.renderGeometries(e,t,n,_,r,!0)):_.update(0)},this.getThreeJSScene=()=>f,this.setVideoHandler=e=>{a||=e},this.setAdditionalScenesGroup=e=>{f.add(e)};let k=(e,t,n,r,i,a,o)=>{let s=0,c=0;return c=e.includes(`top`)?o-i-n:e.includes(`bottom`)?n:Math.floor((o-i)/2),s=e.includes(`left`)?t:e.includes(`right`)?a-t-r:Math.floor((a-r)/2),{x:s,y:c}},A=e=>{(this.displayMinimap||this.displayMiniAxes)&&(e.setScissorTest(!0),e.getSize(S),this.minimapScissor.updateRequired&&(b=k(this.minimapScissor.align,this.minimapScissor.x_offset,this.minimapScissor.y_offset,this.minimapScissor.width,this.minimapScissor.height,S.x,S.y),this.minimapScissor.updateRequired=!1),e.setScissor(b.x,b.y,this.minimapScissor.width,this.minimapScissor.height),e.setViewport(b.x,b.y,this.minimapScissor.width,this.minimapScissor.height),s.updateCamera(),this.displayMiniAxes?e.render(p,s.camera):(f.add(s.mask),e.render(f,s.camera),f.remove(s.mask)),e.setScissorTest(!1),e.setViewport(0,0,S.x,S.y))};this.render=e=>{this.autoClearFlag&&e.clear(),v&&y?y.render(f,this.camera):(e.render(f,this.camera),A(e))},this.setInteractiveControlEnable=e=>{e==1?_.enable():_.disable()},this.getZincCameraControls=()=>_,this.getThreeJSScene=()=>f,this.setDuration=e=>{m.setDuration(e),g=e,_.setPathDuration(e),o.duration=e},this.getDuration=()=>g,this.setStereoEffectEnable=e=>{e==1&&(y||=new ot(n)),n.setSize(D(),O()),this.camera.updateProjectionMatrix(),v=e},this.objectIsInScene=e=>m.objectIsInRegion(e,!0),this.alignBoundingBoxToCameraView=(t,n)=>{if(t){t.getCenter(E);let r=this.getZincCameraControls().getCurrentViewport(),i=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new e.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),o=new e.Vector3,s=new e.Vector3;o.subVectors(i,a).normalize(),s.subVectors(i,E).normalize();let c=new e.Vector3;c.crossVectors(o,s);let l=o.angleTo(s);n>0?(this.getZincCameraControls().rotateCameraTransition(c,l,n),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(c,l),w.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(e,t,n)=>{if(e){let r=this.getZincCameraControls().getCurrentViewport(),i=this.getZincCameraControls().getViewportFromBoundingBox(e,t);n>0&&(this.getZincCameraControls().cameraTransition(r,i,n),this.getZincCameraControls().enableCameraTransition()),w.markerUpdateRequired=!0}},this.alignObjectToCameraView=(e,t)=>{if(this.objectIsInScene(e)){let n=e.getBoundingBox();this.alignBoundingBoxToCameraView(n,t)}},this.setCameraTargetToObject=t=>{if(this.objectIsInScene(t)){let n=t.getBoundingBox(),r=this.getZincCameraControls().getCurrentViewport();n.getCenter(E);let i=new e.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new e.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),o=new e.Vector3,s=new e.Vector3;o.subVectors(a,i),s.addVectors(E,o),r.eyePosition[0]=s.x,r.eyePosition[1]=s.y,r.eyePosition[2]=s.z,r.targetPosition[0]=E.x,r.targetPosition[1]=E.y,r.targetPosition[2]=E.z,this.getZincCameraControls().setCurrentCameraSettings(r),w.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>v,this.removeZincObject=e=>{m.removeZincObject(e),_&&_.calculateMaxAllowedDistance(this),w.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{C.length=0,w.isEnabled&&C.push(w.group),m.getPickableThreeJSObjects(C,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||m.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),C),this.getNormalisedMinimapCoordinates=(t,n)=>{if(this.displayMinimap){let r=new e.Vector2;t.getSize(r);let i=r.y-n.clientY;if(b.x+this.minimapScissor.width>n.clientX&&n.clientX>b.x&&b.y+this.minimapScissor.height>i&&i>b.y)return{x:(n.clientX-b.x)/this.minimapScissor.width*2-1,y:(i-b.y)/this.minimapScissor.height*2-1}}},this.getMinimapDiffFromNormalised=(e,t)=>{if(s)return s.getDiffFromNormalised(e,t)},this.isWebGL2=()=>n.isWebGL2(),this.clearAll=()=>{w.clear(),m.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),o.toBeDwonloaded=0,_&&_.calculateMaxAllowedDistance(this),w.markerUpdateRequired=!0},this.addMetadataTimeStamp=(e,t)=>{x.TimeStamps[e]=M(t)},this.getMetadataTag=e=>x[e],this.getMetadata=()=>x,this.setMetadataTag=(e,t)=>{x[e]=t},this.removeMetadataTag=e=>{delete x[e]},this.resetMetadata=()=>{x=kn()},this.resetDuration=()=>{this.setDuration(An)};let j=e=>[...e.years?[`${e.years}years`]:[],...e.months?[`${e.months}months`]:[],...e.weeks?[`${e.weeks}weeks`]:[],...e.days?[`${e.days}days`]:[],...e.hours?[`${e.hours}hours`]:[],...e.mins?[`${e.mins}mins`]:[],...e.secs?[`${e.secs}secs`]:[]].join(` `),M=e=>e.years?e.years*31536e6:0+e.months?e.months*2592e6:0+e.weeks?e.weeks*6048e5:0+e.days?e.days*864e5:0+e.hours?e.hours*36e5:0+e.mins?e.mins*6e4:0+e.secs?e.secs*1e3:0;this.setDurationFromObject=e=>{let t=j(e),n=M(e);this.setMetadataTag(`Duration`,t),this.setDuration(n)},this.setOriginalDurationFromObject=e=>{let t=j(e);this.setMetadataTag(`OriginalDuration`,t)},this.exportGLTF=e=>new an(this).exportGLTF(e),this.getRootRegion=()=>m,this.createLines=(e,t,n,r)=>{let i=m.findChildFromPath(e);return i===void 0&&(i=m.createChildFromPath(e)),i.createLines(t,n,r)},this.createPoints=(e,t,n,r,i)=>{let a=m.findChildFromPath(e);return a===void 0&&(a=m.createChildFromPath(e)),a.createPoints(t,n,r,i)},this.addZincObjectAddedCallbacks=e=>(l+=1,c[l]=e,l),this.addZincObjectRemovedCallbacks=e=>(d+=1,u[d]=e,d),this.removeZincObjectAddedCallbacks=e=>{e in l&&delete c[e]},this.removeZincObjectRemovedCallbacks=e=>{e in d&&delete u[e]},this.clearZincObjectAddedCallbacks=()=>{c={},l=0},this.clearZincObjectRemovedCallbacks=()=>{u={},d=0},this.triggerObjectAddedCallback=e=>{for(let t in c)c.hasOwnProperty(t)&&c[t](e)},this.triggerObjectRemovedCallback=e=>{for(let t in u)u.hasOwnProperty(t)&&u[t](e)},this.addTemporaryPoints=(t,n)=>{let r=N(t.length,t),i=new e.PointsMaterial({alphaTest:.5,size:15,color:n,sizeAttenuation:!1});i.map=P();let a=new Be(r,i);return h.add(a),a},this.addTemporaryLines=(t,n)=>{let r=new le(N(t.length,t),new e.LineBasicMaterial({color:n}));return h.add(r),r},this.enableFrustumDisplay=()=>{this.camera&&!i&&(i=new e.CameraHelper(this.camera),f.add(i))},this.disableFrustumDisplay=()=>{i&&=(f.remove(i),i.dispose(),void 0)},this.removeTemporaryPrimitive=e=>{h.remove(e),e.geometry.dispose(),e.material.dispose()},this.clearTemporaryPrimitives=()=>{let e=0;return h.children.forEach(t=>{t.geometry.dispose(),t.material.dispose(),e++}),h.clear(),e},this.addBoundingBoxPrimitive=(t,n,r,i,a,o=void 0)=>{let s=m.findChildFromPath(t);s===void 0&&(s=m.createChildFromPath(t));let c=o||this.getBoundingBox();E.set(0,0,0);let l=E.subVectors(c.max,c.min),u=new e.BoxGeometry(l.x,l.y,l.z),d=s.createGeometryFromThreeJSGeometry(n,u,r,i,a,1e4);return l.addVectors(c.min,c.max).multiplyScalar(.5),d.setPosition(l.x,l.y,l.z),d},this.addSlicesPrimitive=(t,n,r,i,a,o=void 0)=>{if(n&&n.length>=3&&r&&r.length>=3){let s=m.findChildFromPath(t);s===void 0&&(s=m.createChildFromPath(t));let c=o||this.getBoundingBox();E.set(0,0,0);let l=E.subVectors(c.max,c.min),u=[`x`,`y`,`z`],d=[],f=0;return u.forEach(t=>{let o;switch(t){case`x`:o=new e.PlaneGeometry(l.z,l.y),o.rotateY(Math.PI/2);break;case`y`:o=new e.PlaneGeometry(l.x,l.z),o.rotateX(Math.PI/2);break;case`z`:o=new e.PlaneGeometry(l.x,l.y)}let c=s.createGeometryFromThreeJSGeometry(n[f],o,r[f],i,a,10001);d.push(c),f++}),l.addVectors(c.min,c.max).multiplyScalar(.5),d.forEach(e=>{e.setPosition(l.x,l.y,l.z)}),d}},this.enableMarkerCluster=e=>{e?(w.markerUpdateRequired=!0,w.enable()):(w.markerUpdateRequired=!1,w.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,T.main&&(this.enableAxisDisplay(!1,!1),T.main.forEach(e=>{e.dispose&&e.dispose()})),T.mini&&(this.enableAxisDisplay(!1,!0),T.mini.forEach(e=>{e.dispose&&e.dispose()})),T={main:[],mini:[]}},this.createAxisDisplay=(t=!1)=>{this.destroyAxisDisplay();let n=[{name:`x`,dir:new e.Vector3(1,0,0),colour:`red`,hex:16733525},{name:`y`,dir:new e.Vector3(0,1,0),colour:`green`,hex:5635925},{name:`z`,dir:new e.Vector3(0,0,1),colour:`blue`,hex:5592575}],r=this.getBoundingBox(),i=r.min.distanceTo(r.max),a=new e.Vector3(0,0,0);t&&a.copy(r.min),n.forEach(t=>{let n=new e.ArrowHelper(t.dir,a,i,t.hex);T.main.push(n);let o=new e.ArrowHelper(t.dir,r.getCenter(E),i/2,t.hex);T.mini.push(o);let s=F(t.name,.036,t.colour,`Asap`,120,700),c=t.dir.clone().multiplyScalar(i).add(a);s.position.set(c.x,c.y,c.z),T.main.push(s)})},this.enableAxisDisplay=(e,t=!1)=>{t&&T?.mini?.length?(this.displayMiniAxes=e,T.mini.forEach(t=>{e?p.add(t):p.remove(t)})):!t&&T.main&&T.main.forEach(t=>{e?f.add(t):f.remove(t)})}},Mn=function(t){let r=t,i,a,o=new e.Clock(!1);this.playAnimation=!0;let s=1e3,c={},l=0,u={},d=0,f={},p=0,m={},h=0,g,_,v,y,b=[],x=[],S=new e.Group,C,w,T=!1,E=!1;this.getDrawingWidth=()=>r?r.clientWidth:C?C.clientWidth===void 0?Math.round(C.width):Math.round(C.clientWidth):0,this.getDrawingHeight=()=>r?r.clientHeight:C?C.clientHeight===void 0?Math.round(C.height):Math.round(C.clientHeight):0,this.onWindowResize=()=>{a.onWindowResize();let t=this.getDrawingWidth(),n=this.getDrawingHeight();if(i!=null){let a;r?(a=r.getBoundingClientRect(),i.setSize(t,n)):C&&(C.getBoundingClientRect===void 0?i.setSize(t,n,!1):(a=C.getBoundingClientRect(),C.width=t,C.height=n,i.setSize(t,n,!1))),a&&(a.left,a.top);let o=new e.Vector2;i.getSize(o),o.x,o.y}},this.initialiseVisualisation=t=>{if(!E){if(t||={},t.antialias===void 0){let e=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(e=!0)}catch{e=!1}e?t.antialias=!1:t.antialias=!0}t.canvas&&(r=void 0,C=t.canvas),i=new e.WebGLRenderer(t),r!==void 0&&r.appendChild(i.domElement),i.setClearColor(16777215,1),C&&C.style&&(C.style.height=`100%`,C.style.width=`100%`);let n=i.domElement;n.addEventListener(`webglcontextlost`,D,!1),n.addEventListener(`webglcontextrestored`,O,!1),i.autoClear=!1;let a=this.createScene(`default`);this.setCurrentScene(a),E=!0}};let D=e=>{e.preventDefault();for(let e of Object.keys(c))f.hasOwnProperty(e)&&f[e].call()},O=e=>{e.preventDefault();for(let e of Object.keys(c))m.hasOwnProperty(e)&&m[e].call()};this.getCurrentScene=()=>a,this.setCurrentScene=e=>{if(e){this.removeActiveScene(e);let t=a;a=e,t&&t.setInteractiveControlEnable(!1),a.setInteractiveControlEnable(!0),a.setAdditionalScenesGroup(S),this.onWindowResize()}},this.getSceneByName=e=>b[e],this.createScene=e=>{if(b[e]==null){let t;return t=C?new jn(C,i):new jn(r,i),b[e]=t,t.sceneName=e,t}},this.resetView=()=>{a.resetView()},this.viewAll=()=>{if(a){let e=a.getBoundingBox();if(e){for(let t=0;t<x.length;t++){let n=x[t].getBoundingBox();n&&e.union(n)}a.viewAllWithBoundingBox(e)}}},this.loadModelsURL=(e,t,n,r,i,o)=>{a.loadModelsURL(e,t,n,r,i,o)},this.loadViewURL=e=>{a.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{a.loadFromViewURL(e,t)},this.updateDirectionalLight=()=>{a.updateDirectionalLight()};let k=()=>{T?(g=requestAnimationFrame(k),this.render()):(cancelAnimationFrame(g),g=void 0)};this.stopAnimate=()=>{T&&=(o.stop(),!1)},this.animate=()=>{T||(o.start(),T=!0,k())},this.addContextLostCallbackFunction=e=>(p+=1,f[p]=e,p),this.removeContextLostCallbackFunction=e=>{e in f&&delete f[e]},this.addContextRestoredCallbackFunction=e=>(h+=1,m[h]=e,h),this.removeContextRestoredCallbackFunction=e=>{e in h&&delete h[e]},this.addPreRenderCallbackFunction=e=>(l+=1,c[l]=e,l),this.removePreRenderCallbackFunction=e=>{e in c&&delete c[e]},this.addPostRenderCallbackFunction=e=>(d+=1,u[d]=e,d),this.removePostRenderCallbackFunction=e=>{e in u&&delete u[e]},this.getPlayRate=()=>s,this.setPlayRate=e=>{s=e},this.getCurrentTime=()=>a.getCurrentTime(),this.setMorphsTime=e=>{a.setMorphsTime(e)},this.getZincGeometryByID=e=>a.getZincGeometryByID(e),this.addToScene=e=>{a.addObject(e)},this.addToOrthoScene=t=>{if(v??=new e.Scene,_==null){let t=this.getDrawingWidth(),n=this.getDrawingHeight();_=new e.OrthographicCamera(-t/2,t/2,n/2,-n/2,1,10),_.position.z=10}v.add(t)};let A=t=>n=>{n.needsUpdate=!0;let r=new e.SpriteMaterial({map:n}),i=r.map.image.width,a=r.map.image.height;t.material=r,t.scale.set(i,a,1);let o=this.getDrawingWidth(),s=this.getDrawingHeight();t.position.set((o-i)/2,(-s+a)/2,1),this.addToOrthoScene(t)};this.addLogo=()=>{y=new e.Sprite,e.ImageUtils.loadTexture(`images/abi_big_logo_transparent_small.png`,void 0,A(y))},this.render=()=>{w||(r?r.clientWidth>0&&r.clientHeight>0&&(w=new n.ResizeSensor(r,this.onWindowResize)):C&&C.width>0&&C.height>0&&(w=new n.ResizeSensor(C,this.onWindowResize)));let e=o.getDelta();a.renderGeometries(s,e,this.playAnimation);for(let t=0;t<x.length;t++)x[t].renderGeometries(s,e,this.playAnimation);_!=null&&v!=null&&(i.clearDepth(),i.render(v,_));for(let e of Object.keys(c))c.hasOwnProperty(e)&&c[e].call();a.render(i);for(let e of Object.keys(u))u.hasOwnProperty(e)&&u[e].call()},this.forceContextLoss=()=>{i.forceContextLoss()},this.forceContextRestore=()=>{i.forceContextRestore()},this.getThreeJSRenderer=()=>i,this.isSceneActive=e=>{if(a===e)return!0;for(let t=0;t<x.length;t++)if(x[t]===e)return!0;return!1},this.addActiveScene=e=>{this.isSceneActive(e)||(x.push(e),S.add(e.getThreeJSScene()))},this.removeActiveScene=e=>{for(let t=0;t<x.length;t++)if(x[t]===e){x.splice(t,1),S.remove(e.getThreeJSScene());return}},this.clearAllActiveScene=()=>{for(let e=0;e<x.length;e++)S.remove(x[e].getThreeJSScene());x.splice(0,x.length)},this.dispose=()=>{T&&cancelAnimationFrame(g);for(let e in b)b.hasOwnProperty(e)&&b[e].clearAll();b=[],x=[],S=new e.Group,this.stopAnimate(),c={},l=0,u={},u=0,f={},p=0,m={},h=0,_=void 0,v=void 0,y=void 0;let t=this.createScene(`default`);this.setCurrentScene(t),w=void 0,i?.dispose()},this.transitionScene=(e,t)=>{if(a){let n=a.getZincCameraControls(),r=e.getBoundingBox();if(r){let e=r.min.distanceTo(r.max)/2,i=(r.min.x+r.max.x)/2,a=(r.min.y+r.max.y)/2,o=(r.min.z+r.max.z)/2,s=n.getViewportFromCentreAndRadius(i,a,o,e,40,e*4),c=n.getCurrentViewport();n.cameraTransition(c,s,t),n.enableCameraTransition()}}},this.isWebGL2=()=>i?i.capabilities.isWebGL2:!1},Nn=class{esize;ecode;edata;littleEndian;constructor(e,t,n,r){if(e%16!=0)throw Error(`This does not appear to be a NIFTI extension`);this.esize=e,this.ecode=t,this.edata=n,this.littleEndian=r}toArrayBuffer(){let e=new Uint8Array(this.esize),t=new Uint8Array(this.edata);e.set(t,8);let n=new DataView(e.buffer);return n.setInt32(0,this.esize,this.littleEndian),n.setInt32(4,this.ecode,this.littleEndian),e.buffer}},K=class e{static crcTable=null;static GUNZIP_MAGIC_COOKIE1=31;static GUNZIP_MAGIC_COOKIE2=139;static getStringAt(e,t,n){var r=``,i,a;for(i=t;i<n;i+=1)a=e.getUint8(i),a!==0&&(r+=String.fromCharCode(a));return r}static getByteAt=function(e,t){return e.getUint8(t)};static getShortAt=function(e,t,n){return e.getInt16(t,n)};static getIntAt(e,t,n){return e.getInt32(t,n)}static getFloatAt(e,t,n){return e.getFloat32(t,n)}static getDoubleAt(e,t,n){return e.getFloat64(t,n)}static getInt64At(e,t,n){let r=e.getUint32(t,n),i=e.getInt32(t+4,n),a;return a=n?i*2**32+r:r*2**32+i,i<0&&(a+=-1*2**32*2**32),a}static getUint64At(e,t,n){let r=e.getUint32(t+(n?0:4),n),i=e.getUint32(t+(n?4:0),n);return n?i*2**32+r:r*2**32+i}static getExtensionsAt(t,n,r,i){let a=[],o=n;for(;o<i;){let n=r,s=e.getIntAt(t,o,r);if(!s)break;if(s+o>i&&(n=!n,s=e.getIntAt(t,o,n),s+o>i))throw Error(`This does not appear to be a valid NIFTI extension`);if(s%16!=0)throw Error(`This does not appear to be a NIFTI extension`);let c=e.getIntAt(t,o+4,n),l=t.buffer.slice(o+8,o+s),u=new Nn(s,c,l,n);a.push(u),o+=s}return a}static toArrayBuffer(e){var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r;for(r=0;r<e.length;r+=1)n[r]=e[r];return t}static isString(e){return typeof e==`string`||e instanceof String}static formatNumber(t,n=void 0){let r;return r=e.isString(t)?Number(t):t,r=n?r.toPrecision(5):r.toPrecision(7),parseFloat(r)}static makeCRCTable(){let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}static crc32(t){e.crcTable||=e.makeCRCTable();let n=e.crcTable,r=-1;for(var i=0;i<t.byteLength;i++)r=r>>>8^n[(r^t.getUint8(i))&255];return(r^-1)>>>0}},Pn=class e{littleEndian=!1;dim_info=0;dims=[];intent_p1=0;intent_p2=0;intent_p3=0;intent_code=0;datatypeCode=0;numBitsPerVoxel=0;slice_start=0;slice_end=0;slice_code=0;pixDims=[];vox_offset=0;scl_slope=1;scl_inter=0;xyzt_units=0;cal_max=0;cal_min=0;slice_duration=0;toffset=0;description=``;aux_file=``;intent_name=``;qform_code=0;sform_code=0;quatern_a=0;quatern_b=0;quatern_c=0;quatern_d=0;qoffset_x=0;qoffset_y=0;qoffset_z=0;affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];qfac=1;quatern_R;magic=`0`;isHDR=!1;extensionFlag=[0,0,0,0];extensionSize=0;extensionCode=0;extensions=[];static TYPE_NONE=0;static TYPE_BINARY=1;static TYPE_UINT8=2;static TYPE_INT16=4;static TYPE_INT32=8;static TYPE_FLOAT32=16;static TYPE_COMPLEX64=32;static TYPE_FLOAT64=64;static TYPE_RGB24=128;static TYPE_INT8=256;static TYPE_UINT16=512;static TYPE_UINT32=768;static TYPE_INT64=1024;static TYPE_UINT64=1280;static TYPE_FLOAT128=1536;static TYPE_COMPLEX128=1792;static TYPE_COMPLEX256=2048;static XFORM_UNKNOWN=0;static XFORM_SCANNER_ANAT=1;static XFORM_ALIGNED_ANAT=2;static XFORM_TALAIRACH=3;static XFORM_MNI_152=4;static SPATIAL_UNITS_MASK=7;static TEMPORAL_UNITS_MASK=56;static UNITS_UNKNOWN=0;static UNITS_METER=1;static UNITS_MM=2;static UNITS_MICRON=3;static UNITS_SEC=8;static UNITS_MSEC=16;static UNITS_USEC=24;static UNITS_HZ=32;static UNITS_PPM=40;static UNITS_RADS=48;static MAGIC_COOKIE=348;static STANDARD_HEADER_SIZE=348;static MAGIC_NUMBER_LOCATION=344;static MAGIC_NUMBER=[110,43,49];static MAGIC_NUMBER2=[110,105,49];static EXTENSION_HEADER_SIZE=8;readHeader(t){var n=new DataView(t),r=K.getIntAt(n,0,this.littleEndian),i,a,o,s;if(r!==e.MAGIC_COOKIE&&(this.littleEndian=!0,r=K.getIntAt(n,0,this.littleEndian)),r!==e.MAGIC_COOKIE)throw Error(`This does not appear to be a NIFTI file!`);for(this.dim_info=K.getByteAt(n,39),i=0;i<8;i+=1)s=40+i*2,this.dims[i]=K.getShortAt(n,s,this.littleEndian);for(this.intent_p1=K.getFloatAt(n,56,this.littleEndian),this.intent_p2=K.getFloatAt(n,60,this.littleEndian),this.intent_p3=K.getFloatAt(n,64,this.littleEndian),this.intent_code=K.getShortAt(n,68,this.littleEndian),this.datatypeCode=K.getShortAt(n,70,this.littleEndian),this.numBitsPerVoxel=K.getShortAt(n,72,this.littleEndian),this.slice_start=K.getShortAt(n,74,this.littleEndian),i=0;i<8;i+=1)s=76+i*4,this.pixDims[i]=K.getFloatAt(n,s,this.littleEndian);if(this.vox_offset=K.getFloatAt(n,108,this.littleEndian),this.scl_slope=K.getFloatAt(n,112,this.littleEndian),this.scl_inter=K.getFloatAt(n,116,this.littleEndian),this.slice_end=K.getShortAt(n,120,this.littleEndian),this.slice_code=K.getByteAt(n,122),this.xyzt_units=K.getByteAt(n,123),this.cal_max=K.getFloatAt(n,124,this.littleEndian),this.cal_min=K.getFloatAt(n,128,this.littleEndian),this.slice_duration=K.getFloatAt(n,132,this.littleEndian),this.toffset=K.getFloatAt(n,136,this.littleEndian),this.description=K.getStringAt(n,148,228),this.aux_file=K.getStringAt(n,228,252),this.qform_code=K.getShortAt(n,252,this.littleEndian),this.sform_code=K.getShortAt(n,254,this.littleEndian),this.quatern_b=K.getFloatAt(n,256,this.littleEndian),this.quatern_c=K.getFloatAt(n,260,this.littleEndian),this.quatern_d=K.getFloatAt(n,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(this.quatern_b**2+this.quatern_c**2+this.quatern_d**2)),this.qoffset_x=K.getFloatAt(n,268,this.littleEndian),this.qoffset_y=K.getFloatAt(n,272,this.littleEndian),this.qoffset_z=K.getFloatAt(n,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code<this.qform_code){let e=this.quatern_a,t=this.quatern_b,n=this.quatern_c,r=this.quatern_d;for(this.qfac=this.pixDims[0]===0?1:this.pixDims[0],this.quatern_R=[[e*e+t*t-n*n-r*r,2*t*n-2*e*r,2*t*r+2*e*n],[2*t*n+2*e*r,e*e+n*n-t*t-r*r,2*n*r-2*e*t],[2*t*r-2*e*n,2*n*r+2*e*t,e*e+r*r-n*n-t*t]],a=0;a<3;a+=1)for(o=0;o<3;o+=1)this.affine[a][o]=this.quatern_R[a][o]*this.pixDims[o+1],o===2&&(this.affine[a][o]*=this.qfac);this.affine[0][3]=this.qoffset_x,this.affine[1][3]=this.qoffset_y,this.affine[2][3]=this.qoffset_z}else if(this.sform_code>0)for(a=0;a<3;a+=1)for(o=0;o<4;o+=1)s=280+(a*4+o)*4,this.affine[a][o]=K.getFloatAt(n,s,this.littleEndian);if(this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=K.getStringAt(n,328,344),this.magic=K.getStringAt(n,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,e.MAGIC_NUMBER2),n.byteLength>e.MAGIC_COOKIE){this.extensionFlag[0]=K.getByteAt(n,348),this.extensionFlag[1]=K.getByteAt(n,349),this.extensionFlag[2]=K.getByteAt(n,350),this.extensionFlag[3]=K.getByteAt(n,351);let e=!0;!this.isHDR&&this.vox_offset<=352&&(e=!1),n.byteLength<=368&&(e=!1),e&&this.extensionFlag[0]&&(this.extensions=K.getExtensionsAt(n,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode)}}toFormattedString(){var t=K.formatNumber,n=``;return n+=`Dim Info = `+this.dim_info+`
3459
3459
  `,n+=`Image Dimensions (1-8): `+this.dims[0]+`, `+this.dims[1]+`, `+this.dims[2]+`, `+this.dims[3]+`, `+this.dims[4]+`, `+this.dims[5]+`, `+this.dims[6]+`, `+this.dims[7]+`
3460
3460
  `,n+=`Intent Parameters (1-3): `+this.intent_p1+`, `+this.intent_p2+`, `+this.intent_p3+`
3461
3461
  `,n+=`Intent Code = `+this.intent_code+`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "license": "Apache-2.0",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -56,7 +56,7 @@
56
56
  "simple-dropzone": "^0.8.3",
57
57
  "vue": "^3.5.41",
58
58
  "vue-router": "^5.2.0",
59
- "zincjs": "^2.2.0"
59
+ "zincjs": "^2.2.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@eslint/js": "^10.0.1",