/*! For license information please see 3Dmol-min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["3Dmol"]=t():e["3Dmol"]=t()}(this,(()=>(()=>{var __webpack_modules__={7396:function(){"use strict";!function(e){if(e.TextEncoder&&e.TextDecoder)return!1;function t(e="utf-8"){if("utf-8"!==e)throw new RangeError(`Failed to construct 'TextEncoder': The encoding label provided ('${e}') is invalid.`)}function r(e="utf-8",t={fatal:!1}){if("utf-8"!==e)throw new RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${e}') is invalid.`);if(t.fatal)throw new Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}Object.defineProperty(t.prototype,"encoding",{value:"utf-8"}),t.prototype.encode=function(e,t={stream:!1}){if(t.stream)throw new Error("Failed to encode: the 'stream' option is unsupported.");let r=0;const s=e.length;let n=0,a=Math.max(32,s+(s>>1)+7),o=new Uint8Array(a>>3<<3);for(;r=55296&&t<=56319){if(r=55296&&t<=56319)continue}if(n+4>o.length){a+=8,a*=1+r/e.length*2,a=a>>3<<3;const t=new Uint8Array(a);t.set(o),o=t}if(0!=(4294967168&t)){if(0==(4294965248&t))o[n++]=t>>6&31|192;else if(0==(4294901760&t))o[n++]=t>>12&15|224,o[n++]=t>>6&63|128;else{if(0!=(4292870144&t))continue;o[n++]=t>>18&7|240,o[n++]=t>>12&63|128,o[n++]=t>>6&63|128}o[n++]=63&t|128}else o[n++]=t}return o.slice(0,n)},Object.defineProperty(r.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(r.prototype,"fatal",{value:!1}),Object.defineProperty(r.prototype,"ignoreBOM",{value:!1}),r.prototype.decode=function(e,t={stream:!1}){if(t.stream)throw new Error("Failed to decode: the 'stream' option is unsupported.");const r=new Uint8Array(e);let s=0;const n=r.length,a=[];for(;s65535&&(t-=65536,a.push(t>>>10&1023|55296),t=56320|1023&t),a.push(t)}}return String.fromCharCode.apply(null,a)},e.TextEncoder=t,e.TextDecoder=r}("undefined"!=typeof window?window:"undefined"!=typeof self?self:this)},4406:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CAP:()=>s,GLDraw:()=>n});var s,n,a=r(9652);!function(e){e[e.NONE=0]="NONE",e[e.FLAT=1]="FLAT",e[e.ROUND=2]="ROUND"}(s||(s={})),function(e){function t(e,t,r){var s,n,a,o,l,h=Math.hypot(e,t);h<1e-4?(n=0,a=1):(n=-e/h,a=t/h),t=-n*e+a*t,(s=Math.hypot(t,r))<1e-4?(o=0,l=1):(o=r/s,l=t/s);var c=new Float32Array(9);return c[0]=a,c[1]=n,c[2]=0,c[3]=-n*l,c[4]=a*l,c[5]=o,c[6]=n*o,c[7]=-a*o,c[8]=l,c}var r=new class CylVertexCache{constructor(){this.cache={};let e,t=[],r=Math.pow(2,4),s=2,n=Math.pow(2,s),o=r/n;for(t[0]=new a.Vector3(-1,0,0),t[o]=new a.Vector3(0,0,1),t[2*o]=new a.Vector3(1,0,0),t[3*o]=new a.Vector3(0,0,-1),s=3;s<=4;s++){for(n=Math.pow(2,s-1),o=r/n,e=0;e{"use strict";r.r(t),r.d(t,{GLModel:()=>GLModel});var s=r(7693),n=r(3351),a=r(9652),o=r(2550),l=r(4406),h=r(6163),c=r(9005),u=r(1460),f=r(2640);r(7396);function p(e,t="utf8"){return new TextDecoder(t).decode(e)}const g=new TextEncoder;const v=(()=>{const e=new Uint8Array(4);return!((new Uint32Array(e.buffer)[0]=1)&e[0])})(),_={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class IOBuffer{constructor(e=8192,t={}){let r=!1;"number"==typeof e?e=new ArrayBuffer(e):(r=!0,this.lastWrittenByte=e.byteLength);const s=t.offset?t.offset>>>0:0,n=e.byteLength-s;let a=s;(ArrayBuffer.isView(e)||e instanceof IOBuffer)&&(e.byteLength!==e.buffer.byteLength&&(a=e.byteOffset+s),e=e.buffer),this.lastWrittenByte=r?n:0,this.buffer=e,this.length=n,this.byteLength=n,this.byteOffset=a,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,a,n),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const e=this._marks.pop();if(void 0===e)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){const t=2*(this.offset+e),r=new Uint8Array(t);r.set(new Uint8Array(this.buffer)),this.buffer=r.buffer,this.length=this.byteLength=t,this._data=new DataView(this.buffer)}return this}readBoolean(){return 0!==this.readUint8()}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,"uint8")}readArray(e,t){const r=_[t].BYTES_PER_ELEMENT*e,s=this.byteOffset+this.offset,n=this.buffer.slice(s,s+r);if(this.littleEndian===v&&"uint8"!==t&&"int8"!==t){const e=new Uint8Array(this.buffer.slice(s,s+r));e.reverse();const n=new _[t](e.buffer);return this.offset+=r,n.reverse(),n}const a=new _[t](n);return this.offset+=r,a}readInt16(){const e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){const e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){const e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){const e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){const e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){const e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){const e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){const e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let t="";for(let r=0;rthis.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}const y={BYTE:1,CHAR:2,SHORT:3,INT:4,FLOAT:5,DOUBLE:6};function b(e){switch(Number(e)){case y.BYTE:return"byte";case y.CHAR:return"char";case y.SHORT:return"short";case y.INT:return"int";case y.FLOAT:return"float";case y.DOUBLE:return"double";default:return"undefined"}}function w(e){switch(Number(e)){case y.BYTE:case y.CHAR:return 1;case y.SHORT:return 2;case y.INT:case y.FLOAT:return 4;case y.DOUBLE:return 8;default:return-1}}function x(e){switch(String(e)){case"byte":return y.BYTE;case"char":return y.CHAR;case"short":return y.SHORT;case"int":return y.INT;case"float":return y.FLOAT;case"double":return y.DOUBLE;default:return-1}}function A(e,t){if(1!==e){const r=new Array(e);for(let s=0;s6,`non valid type ${u}`);const f=e.readUint32();let p=e.readUint32();2===r&&(S(p>0,"offsets larger than 4GB not supported"),p=e.readUint32());let g=!1;void 0!==t&&h[0]===t&&(a+=f,g=!0),n[s]={name:o,dimensions:h,attributes:c,type:b(u),size:f,offset:p,record:g}}}return{variables:n,recordStep:a}}(e,s?.id,t);return Array.isArray(a)||(r.variables=a.variables,s.recordStep=a.recordStep),r.recordDimension=s,r}function D(e){const t=e.readUint32();let r;if(t===L)return S(e.readUint32()!==L,"wrong empty tag for list of attributes"),[];{S(t!==k,"wrong tag for list of attributes");const s=e.readUint32();r=new Array(s);for(let t=0;t6,`non valid type ${n}`);const a=e.readUint32(),o=C(e,n,a);M(e),r[t]={name:s,type:b(n),value:o}}}return r}function F(){const e=[];e.push("DIMENSIONS");for(const t of this.dimensions)e.push(` ${t.name.padEnd(30)} = size: ${t.size}`);e.push(""),e.push("GLOBAL ATTRIBUTES");for(const t of this.globalAttributes)e.push(` ${t.name.padEnd(30)} = ${t.value}`);const t=JSON.parse(JSON.stringify(this.variables));e.push(""),e.push("VARIABLES:");for(const r of t){r.value=this.getDataVariable(r);let t=JSON.stringify(r.value);t.length>50&&(t=t.substring(0,50)),isNaN(r.value.length)||(t+=` (length: ${r.value.length})`),e.push(` ${r.name.padEnd(30)} = ${t}`)}return e.join("\n")}class NetCDFReader{constructor(e){this.toString=F;const t=new IOBuffer(e);t.setBigEndian(),S("CDF"!==t.readChars(3),"should start with CDF");const r=t.readByte();S(r>2,"unknown version"),this.header=O(t,r),this.buffer=t}get version(){return 1===this.header.version?"classic format":"64-bit offset format"}get recordDimension(){return this.header.recordDimension}get dimensions(){return this.header.dimensions}get globalAttributes(){return this.header.globalAttributes}getAttribute(e){const t=this.globalAttributes.find((t=>t.name===e));return t?t.value:null}getDataVariableAsString(e){const t=this.getDataVariable(e);return t?t.join(""):null}get variables(){return this.header.variables}getDataVariable(e){let t;if(t="string"==typeof e?this.header.variables.find((t=>t.name===e)):e,void 0===t)throw new Error("Not a valid NetCDF v3.x file: variable not found");return this.buffer.seek(t.offset),t.record?function(e,t,r){const s=x(t.type),n=t.size?t.size/w(s):1,a=r.length,o=new Array(a),l=r.recordStep;if(!l)throw new Error("recordDimension.recordStep is undefined");for(let t=0;tt.name===e))}attributeExists(e){return void 0!==this.globalAttributes.find((t=>t.name===e))}}var R=r(7885),P=r(3920);function G(e){let t;if("string"==typeof e){t=(new TextEncoder).encode(e)}else t=new Uint8Array(e);return(0,R.inflate)(t,{to:"string"})}class GLModel{static sameObj(e,t){return e&&t?JSON.stringify(e)==JSON.stringify(t):e==t}constructor(e,t){this.atoms=[],this.frames=[],this.box=null,this.atomdfs=null,this.id=0,this.hidden=!1,this.molObj=null,this.renderedMolObj=null,this.lastColors=null,this.modelData={},this.modelDatas=null,this.idMatrix=new a.Matrix4,this.dontDuplicateAtoms=!0,this.defaultColor=o.elementColors.defaultColor,this.defaultStickRadius=.25,this.options=t||{},this.ElementColors=this.options.defaultcolors?this.options.defaultcolors:o.elementColors.defaultColors,this.defaultSphereRadius=this.options.defaultSphereRadius?this.options.defaultSphereRadius:1.5,this.defaultCartoonQuality=this.options.cartoonQuality?this.options.cartoonQuality:10,this.id=e}getRadiusFromStyle(e,t){var r=this.defaultSphereRadius;if(void 0!==t.radius)r=t.radius;else if(GLModel.vdwRadii[e.elem])r=GLModel.vdwRadii[e.elem];else if(e.elem.length>1){let t=e.elem;t=t[0].toUpperCase()+t[1].toLowerCase(),GLModel.vdwRadii[t]&&(r=GLModel.vdwRadii[t])}return void 0!==t.scale&&(r*=t.scale),r}drawAtomCross(e,t){if(e.style.cross){var r=e.style.cross;if(!r.hidden){var n=r.linewidth||GLModel.defaultlineWidth;t[n]||(t[n]=new s.Geometry);var o=t[n].updateGeoGroup(6),l=this.getRadiusFromStyle(e,r),h=[[l,0,0],[-l,0,0],[0,l,0],[0,-l,0],[0,0,l],[0,0,-l]],u=e.clickable||e.hoverable;u&&void 0===e.intersectionShape&&(e.intersectionShape={sphere:[],cylinder:[],line:[]});for(var f=(0,c.getColorFromStyle)(e,r),p=o.vertexArray,g=o.colorArray,v=0;v<6;v++){var _=3*o.vertices;if(o.vertices++,p[_]=e.x+h[v][0],p[_+1]=e.y+h[v][1],p[_+2]=e.z+h[v][2],g[_]=f.r,g[_+1]=f.g,g[_+2]=f.b,u){var y=new a.Vector3(h[v][0],h[v][1],h[v][2]);y.multiplyScalar(.1),y.set(y.x+e.x,y.y+e.y,y.z+e.z),e.intersectionShape.line.push(y)}}}}}getGoodCross(e,t,r,s){for(var n=null,o=-1,l=0,h=e.bonds.length;lo&&(n=f,(o=c)>.1))return n}return n}getSideBondV(e,t,r){var s,n,o,l,h=new a.Vector3(e.x,e.y,e.z),c=new a.Vector3(t.x,t.y,t.z).clone(),u=null;if(c.sub(h),1===e.bonds.length)1===t.bonds.length?(u=c.clone(),Math.abs(u.x)>1e-4?u.y+=1:u.x+=1):(s=(r+1)%t.bonds.length,n=t.bonds[s],(o=this.atoms[n]).index==e.index&&(s=(s+1)%t.bonds.length,n=t.bonds[s],o=this.atoms[n]),(l=new a.Vector3(o.x,o.y,o.z).clone()).sub(h),(u=l.clone()).cross(c));else if((u=this.getGoodCross(e,t,h,c)).lengthSq()<.01){var f=this.getGoodCross(t,e,h,c);null!=f&&(u=f)}return u.lengthSq()<.01&&(u=c.clone(),Math.abs(u.x)>1e-4?u.y+=1:u.x+=1),u.cross(c),u.normalize(),u}addLine(e,t,r,s,n,a){e[r]=s.x,e[r+1]=s.y,e[r+2]=s.z,t[r]=a.r,t[r+1]=a.g,t[r+2]=a.b,e[r+3]=n.x,e[r+4]=n.y,e[r+5]=n.z,t[r+3]=a.r,t[r+4]=a.g,t[r+5]=a.b}drawBondLines(e,t,r){if(e.style.line){var n=e.style.line;if(!n.hidden){var l,h,u,f,p=n.linewidth||GLModel.defaultlineWidth;r[p]||(r[p]=new s.Geometry);for(var g=r[p].updateGeoGroup(6*e.bonds.length),v=g.vertexArray,_=g.colorArray,y=0;y=b.index)){var w=new a.Vector3(e.x,e.y,e.z),x=new a.Vector3(b.x,b.y,b.z),A=w.clone().add(x).multiplyScalar(.5),C=!1,S=e.clickable||e.hoverable,M=b.clickable||b.hoverable;(S||M)&&(S&&(void 0===e.intersectionShape&&(e.intersectionShape={sphere:[],cylinder:[],line:[],triangle:[]}),e.intersectionShape.line.push(w),e.intersectionShape.line.push(A)),M&&(void 0===b.intersectionShape&&(b.intersectionShape={sphere:[],cylinder:[],line:[],triangle:[]}),b.intersectionShape.line.push(A),b.intersectionShape.line.push(x)));var z=(0,c.getColorFromStyle)(e,e.style.line),L=(0,c.getColorFromStyle)(b,b.style.line);if(e.bondStyles&&e.bondStyles[y]){var E=e.bondStyles[y];if(!E.iswire)continue;E.singleBond&&(C=!0),void 0!==E.color1&&(z=o.CC.color(E.color1)),void 0!==E.color2&&(L=o.CC.color(E.color2))}var T,k,I=3*g.vertices;if(e.bondOrder[y]>1&&e.bondOrder[y]<4&&!C){var O=this.getSideBondV(e,b,y),D=x.clone();D.sub(w),2==e.bondOrder[y]?(O.multiplyScalar(.1),(l=w.clone()).add(O),(h=w.clone()).sub(O),(u=l.clone()).add(D),(f=h.clone()).add(D),z==L?(g.vertices+=4,this.addLine(v,_,I,l,u,z),this.addLine(v,_,I+6,h,f,z)):(g.vertices+=8,D.multiplyScalar(.5),(T=l.clone()).add(D),(k=h.clone()).add(D),this.addLine(v,_,I,l,T,z),this.addLine(v,_,I+6,T,u,L),this.addLine(v,_,I+12,h,k,z),this.addLine(v,_,I+18,k,f,L))):3==e.bondOrder[y]&&(O.multiplyScalar(.1),(l=w.clone()).add(O),(h=w.clone()).sub(O),(u=l.clone()).add(D),(f=h.clone()).add(D),z==L?(g.vertices+=6,this.addLine(v,_,I,w,x,z),this.addLine(v,_,I+6,l,u,z),this.addLine(v,_,I+12,h,f,z)):(g.vertices+=12,D.multiplyScalar(.5),(T=l.clone()).add(D),(k=h.clone()).add(D),this.addLine(v,_,I,w,A,z),this.addLine(v,_,I+6,A,x,L),this.addLine(v,_,I+12,l,T,z),this.addLine(v,_,I+18,T,u,L),this.addLine(v,_,I+24,h,k,z),this.addLine(v,_,I+30,k,f,L)))}else z==L?(g.vertices+=2,this.addLine(v,_,I,w,x,z)):(g.vertices+=4,this.addLine(v,_,I,w,A,z),this.addLine(v,_,I+6,A,x,L))}}}}}drawAtomSphere(e,t){if(e.style.sphere){var r=e.style.sphere;if(!r.hidden){var s=(0,c.getColorFromStyle)(e,r),o=this.getRadiusFromStyle(e,r);if((!0===e.clickable||e.hoverable)&&void 0!==e.intersectionShape){var h=new a.Vector3(e.x,e.y,e.z);e.intersectionShape.sphere.push(new n.Sphere(h,o))}l.GLDraw.drawSphere(t,e,o,s)}}}drawAtomClickSphere(e){if(e.style.clicksphere){var t=e.style.clicksphere;if(!t.hidden){var r=this.getRadiusFromStyle(e,t);if((!0===e.clickable||e.hoverable)&&void 0!==e.intersectionShape){var s=new a.Vector3(e.x,e.y,e.z);e.intersectionShape.sphere.push(new n.Sphere(s,r))}}}}drawAtomInstanced(e,t){if(e.style.sphere){var r=e.style.sphere;if(!r.hidden){var s=this.getRadiusFromStyle(e,r),o=(0,c.getColorFromStyle)(e,r),l=t.updateGeoGroup(1),h=l.vertices,u=3*h,f=l.vertexArray,p=l.colorArray,g=l.radiusArray;if(f[u]=e.x,f[u+1]=e.y,f[u+2]=e.z,p[u]=o.r,p[u+1]=o.g,p[u+2]=o.b,g[h]=s,(!0===e.clickable||e.hoverable)&&void 0!==e.intersectionShape){var v=new a.Vector3(e.x,e.y,e.z);e.intersectionShape.sphere.push(new n.Sphere(v,s))}l.vertices+=1}}}drawSphereImposter(e,t,r,s){var n,a=e.updateGeoGroup(4),o=a.vertices,l=3*o,h=a.vertexArray,c=a.colorArray;for(n=0;n<4;n++)h[l+3*n]=t.x,h[l+3*n+1]=t.y,h[l+3*n+2]=t.z;var u=a.normalArray;for(n=0;n<4;n++)c[l+3*n]=s.r,c[l+3*n+1]=s.g,c[l+3*n+2]=s.b;u[l+0]=-r,u[l+1]=r,u[l+2]=0,u[l+3]=-r,u[l+4]=-r,u[l+5]=0,u[l+6]=r,u[l+7]=-r,u[l+8]=0,u[l+9]=r,u[l+10]=r,u[l+11]=0,a.vertices+=4;var f=a.faceArray,p=a.faceidx;f[p+0]=o,f[p+1]=o+1,f[p+2]=o+2,f[p+3]=o+2,f[p+4]=o+3,f[p+5]=o,a.faceidx+=6}drawAtomImposter(e,t){if(e.style.sphere){var r=e.style.sphere;if(!r.hidden){var s=this.getRadiusFromStyle(e,r),o=(0,c.getColorFromStyle)(e,r);if((!0===e.clickable||e.hoverable)&&void 0!==e.intersectionShape){var l=new a.Vector3(e.x,e.y,e.z);e.intersectionShape.sphere.push(new n.Sphere(l,s))}this.drawSphereImposter(t,e,s,o)}}}calculateDashes(e,t,r,s,n){var o=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)+Math.pow(e.z-t.z,2));r=Math.max(r,0),n=Math.max(n,0)+2*r,(s=Math.max(s,.001))+n>o&&(s=o,n=0);var l,h=Math.floor((o-s)/(s+n))+1;n=(o-h*s)/h;for(var c=new a.Vector3(e.x,e.y,e.z),u=new a.Vector3((t.x-e.x)/(o/n),(t.y-e.y)/(o/n),(t.z-e.z)/(o/n)),f=new a.Vector3((t.x-e.x)/(o/s),(t.y-e.y)/(o/s),(t.z-e.z)/(o/s)),p=[],g=0;g{var t=r.imposter?GLModel.drawStickImposter:l.GLDraw.drawCylinder;return!F&&e>=1?t:(e,r,s,n,a,o=0,l=0,h=.1,c=.25)=>{this.calculateDashes(r,s,n,h,c).forEach((r=>{t(e,r.from,r.to,n,a,o,l)}))}};for(g=0;g3){if(e.bondOrder[g]<1&&(O*=e.bondOrder[g]),!U.capDrawn&&U.bonds.length<4&&(P=2),G!=j?(S=(new a.Vector3).addVectors(H,W).multiplyScalar(.5),N(r,H,S,O,G,R,0,k,I),N(r,S,W,O,j,0,P,k,I)):N(r,H,W,O,G,R,P,k,I),f=e.clickable||e.hoverable,p=U.clickable||U.hoverable,f||p){if(S||(S=(new a.Vector3).addVectors(H,W).multiplyScalar(.5)),f){var q=new n.Cylinder(H,S,O),Y=new n.Sphere(H,O);e.intersectionShape.cylinder.push(q),e.intersectionShape.sphere.push(Y)}if(p){var Z=new n.Cylinder(W,S,O),X=new n.Sphere(W,O);U.intersectionShape.cylinder.push(Z),U.intersectionShape.sphere.push(X)}}}else if(e.bondOrder[g]>1){var K=0,$=0;O!=L&&(K=2,$=2);var Q,J,ee,te,ie,re=W.clone(),se=null;re.sub(H),se=this.getSideBondV(e,U,g),2==e.bondOrder[g]?(Q=O*E,se.multiplyScalar(1.5*Q),(J=H.clone()).add(se),(ee=H.clone()).sub(se),(te=J.clone()).add(re),(ie=ee.clone()).add(re),G!=j?(S=(new a.Vector3).addVectors(J,te).multiplyScalar(.5),M=(new a.Vector3).addVectors(ee,ie).multiplyScalar(.5),N(r,J,S,Q,G,K,0),N(r,S,te,Q,j,0,$),N(r,ee,M,Q,G,K,0),N(r,M,ie,Q,j,0,$)):(N(r,J,te,Q,G,K,$),N(r,ee,ie,Q,G,K,$)),f=e.clickable||e.hoverable,p=U.clickable||U.hoverable,(f||p)&&(S||(S=(new a.Vector3).addVectors(J,te).multiplyScalar(.5)),M||(M=(new a.Vector3).addVectors(ee,ie).multiplyScalar(.5)),f&&(y=new n.Cylinder(J,S,Q),b=new n.Cylinder(ee,M,Q),e.intersectionShape.cylinder.push(y),e.intersectionShape.cylinder.push(b)),p&&(x=new n.Cylinder(te,S,Q),A=new n.Cylinder(ie,M,Q),U.intersectionShape.cylinder.push(x),U.intersectionShape.cylinder.push(A)))):3==e.bondOrder[g]&&(Q=O*T,se.cross(re),se.normalize(),se.multiplyScalar(3*Q),(J=H.clone()).add(se),(ee=H.clone()).sub(se),(te=J.clone()).add(re),(ie=ee.clone()).add(re),G!=j?(S=(new a.Vector3).addVectors(J,te).multiplyScalar(.5),M=(new a.Vector3).addVectors(ee,ie).multiplyScalar(.5),z=(new a.Vector3).addVectors(H,W).multiplyScalar(.5),N(r,J,S,Q,G,K,0),N(r,S,te,Q,j,0,$),N(r,H,z,Q,G,R,0),N(r,z,W,Q,j,0,P),N(r,ee,M,Q,G,K,0),N(r,M,ie,Q,j,0,$)):(N(r,J,te,Q,G,K,$),N(r,H,W,Q,G,R,P),N(r,ee,ie,Q,G,K,$)),f=e.clickable||e.hoverable,p=U.clickable||U.hoverable,(f||p)&&(S||(S=(new a.Vector3).addVectors(J,te).multiplyScalar(.5)),M||(M=(new a.Vector3).addVectors(ee,ie).multiplyScalar(.5)),z||(z=(new a.Vector3).addVectors(H,W).multiplyScalar(.5)),f&&(y=new n.Cylinder(J.clone(),S.clone(),Q),b=new n.Cylinder(ee.clone(),M.clone(),Q),w=new n.Cylinder(H.clone(),z.clone(),Q),e.intersectionShape.cylinder.push(y),e.intersectionShape.cylinder.push(b),e.intersectionShape.cylinder.push(w)),p&&(x=new n.Cylinder(te.clone(),S.clone(),Q),A=new n.Cylinder(ie.clone(),M.clone(),Q),C=new n.Cylinder(W.clone(),z.clone(),Q),U.intersectionShape.cylinder.push(x),U.intersectionShape.cylinder.push(A),U.intersectionShape.cylinder.push(C))))}}}var ne=!1,ae=0,oe=!1;for(g=0;g0&&(ne=!0):0==ae&&(e.bonds.length>0||u.showNonBonded)&&(ne=!0),ne&&(O=L,r.imposter?this.drawSphereImposter(r.sphereGeometry,e,O,G):l.GLDraw.drawSphere(r,e,O,G))}}}createMolObj(e,t){t=t||{};var r,n,a,c,u=new s.Object3D,f=[],p={},g={},v=this.drawAtomSphere,_=null,y=null;t.supportsImposters?(v=this.drawAtomImposter,(_=new s.Geometry(!0)).imposter=!0,(y=new s.Geometry(!0,!0)).imposter=!0,y.sphereGeometry=new s.Geometry(!0),y.sphereGeometry.imposter=!0,y.drawnCaps={}):t.supportsAIA?(v=this.drawAtomInstanced,(_=new s.Geometry(!1,!0,!0)).instanced=!0,y=new s.Geometry(!0)):(_=new s.Geometry(!0),y=new s.Geometry(!0));var b,w={},x=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];for(r=0,a=e.length;rx[1]&&(x[1]=A.resi)),f.push(A))}}if(f.length>0&&(0,h.drawCartoon)(u,f,x,this.defaultCartoonQuality),_&&_.vertices>0){_.initTypedArrays();var C=null,S=null;_.imposter?C=new s.SphereImposterMaterial({ambient:0,vertexColors:!0,reflectivity:0}):_.instanced?(S=new s.Geometry(!0),l.GLDraw.drawSphere(S,{x:0,y:0,z:0},1,new o.Color(.5,.5,.5)),S.initTypedArrays(),C=new s.InstancedMaterial({sphereMaterial:new s.MeshLambertMaterial({ambient:0,vertexColors:!0,reflectivity:0}),sphere:S})):C=new s.MeshLambertMaterial({ambient:0,vertexColors:!0,reflectivity:0}),w.sphere<1&&w.sphere>=0&&(C.transparent=!0,C.opacity=w.sphere),S=new s.Mesh(_,C),u.add(S)}if(y.vertices>0){var M=null,z=null,L=y.sphereGeometry;L&&void 0!==L.vertices&&0!=L.vertices||(L=null),y.initTypedArrays(),L&&L.initTypedArrays();var E={ambient:0,vertexColors:!0,reflectivity:0};y.imposter?(M=new s.StickImposterMaterial(E),z=new s.SphereImposterMaterial(E)):(M=new s.MeshLambertMaterial(E),z=new s.MeshLambertMaterial(E),M.wireframe&&(y.setUpWireframe(),L&&L.setUpWireframe())),w.stick<1&&w.stick>=0&&(M.transparent=!0,M.opacity=w.stick,z.transparent=!0,z.opacity=w.stick);var T=new s.Mesh(y,M);if(u.add(T),L){var k=new s.Mesh(L,z);u.add(k)}}for(r in p)if(p.hasOwnProperty(r)){b=r;var I=new s.LineBasicMaterial({linewidth:b,vertexColors:!0});w.line<1&&w.line>=0&&(I.transparent=!0,I.opacity=w.line),p[r].initTypedArrays();var O=new s.Line(p[r],I,s.LineStyle.LinePieces);u.add(O)}for(r in g)if(g.hasOwnProperty(r)){b=r;var D=new s.LineBasicMaterial({linewidth:b,vertexColors:!0});w.cross<1&&w.cross>=0&&(D.transparent=!0,D.opacity=w.cross),g[r].initTypedArrays();var F=new s.Line(g[r],D,s.LineStyle.LinePieces);u.add(F)}if(this.dontDuplicateAtoms&&this.modelData.symmetries&&this.modelData.symmetries.length>0){var R,P=new s.Object3D;for(R=0;Rr?t-s:t}adjustCoordinatesToBox(){if(this.box&&this.atomdfs)for(var e=this.box[0],t=this.box[1],r=this.box[2],s=.9*e,n=.9*t,a=.9*r,o=0;o=r)&&(e=r-1),null!=s.frames.url){var o=s.frames.url;(0,c.getbin)(o+"/traj/frame/"+e+"/"+s.frames.path,void 0,"POST",void 0).then((function(e){for(var t=new Float32Array(e,44),r=0,a=0;a=s&&e<=n)return!0}}return!1}static deepCopyAndCache(e,t){if("object"!=typeof e||null==e)return e;if(e.__cache_created)return e;const r={};for(const s in e){const n=e[s];if(Array.isArray(n)){r[s]=[];for(let e=0;e=s[0][0]&&o<=s[1][0]&&l>=s[0][1]&&l<=s[1][1]&&h>=s[0][2]&&h<=s[1][2]&&(o>=r[0][0]&&o<=r[1][0]&&l>=r[0][1]&&l<=r[1][1]&&h>=r[0][2]&&h<=r[1][2]||a.push(this.atoms[e]))}return a}static getFloat(e){return"number"==typeof e?e:parseFloat(e)}selectedAtoms(e,t){var r=[];e=GLModel.deepCopyAndCache(e||{},this),t||(t=this.atoms);for(var s=t.length,n=0;n0&&r.push(s[e])}}if(e.hasOwnProperty("within")&&e.within.hasOwnProperty("sel")&&e.within.hasOwnProperty("distance")){var l=this.selectedAtoms(e.within.sel,this.atoms),h={};const t=GLModel.getFloat(e.within.distance),s=t*t;for(let e=0;e0&&(h[t]=1)}var c=[];if(e.within.invert)for(let e=0;e0;)if(t=p.pop(),g=t.chain,v=t.resi,void 0===f[t.index]){f[t.index]=!0;for(var _=0;_0&&(this.molObj=null)}else console.log("Callback is not a function")}setHoverable(e,t,r,s){if(t=!!t,r=(0,c.makeFunction)(r),s=(0,c.makeFunction)(s),null!==r)if(null!==s){var n=this.selectedAtoms(e,this.atoms),a=n.length;for(let e=0;e0&&(this.molObj=null)}else console.log("Unhover_callback is not a function");else console.log("Hover_callback is not a function")}enableContextMenu(e,t){var r;t=!!t;var s=this.selectedAtoms(e,this.atoms),n=s.length;for(r=0;r0&&(this.molObj=null)}setColorByElement(e,t){if(null===this.molObj||!GLModel.sameObj(t,this.lastColors)){this.lastColors=t;var r=this.selectedAtoms(e,r);r.length>0&&(this.molObj=null);for(var s=0;s0&&(this.molObj=null),"string"==typeof r&&void 0!==u.Gradient.builtinGradients[r]&&(r=new u.Gradient.builtinGradients[r]),s||(s=r.range()),s||(s=(0,c.getPropertyRange)(o,t)),n=0;n0&&(this.molObj=null);for(let e=0;e=n)continue;let o={b:r,e:n},l=a.bondOrder[e];1!=l&&(o.o=l),t.b.push(o)}}return t}globj(e,t){(null===this.molObj||t.regen)&&(this.molObj=this.createMolObj(this.atoms,t),this.renderedMolObj&&(e.remove(this.renderedMolObj),this.renderedMolObj=null),this.renderedMolObj=this.molObj.clone(),this.hidden&&(this.renderedMolObj.setVisible(!1),this.molObj.setVisible(!1)),e.add(this.renderedMolObj))}exportVRML(){return this.createMolObj(this.atoms,{supportsImposters:!1,supportsAIA:!1}).vrml()}removegl(e){this.renderedMolObj&&(void 0!==this.renderedMolObj.geometry&&this.renderedMolObj.geometry.dispose(),void 0!==this.renderedMolObj.material&&this.renderedMolObj.material.dispose(),e.remove(this.renderedMolObj),this.renderedMolObj=null),this.molObj=null}hide(){this.hidden=!0,this.renderedMolObj&&this.renderedMolObj.setVisible(!1),this.molObj&&this.molObj.setVisible(!1)}show(){this.hidden=!1,this.renderedMolObj&&this.renderedMolObj.setVisible(!0),this.molObj&&this.molObj.setVisible(!0)}addPropertyLabels(e,t,r,s){for(var n=this.selectedAtoms(t,n),a=(0,c.deepCopy)(s),o=0;oMOLECULE/gm)?"mol2":e.match(/^data_/gm)&&e.match(/^loop_/gm)?"cif":e.match(/^HETATM/gm)||e.match(/^ATOM/gm)?"pdb":e.match(/ITEM: TIMESTEP/gm)?"lammpstrj":e.match(/^.*\n.*\n.\s*(\d+)\s+(\d+)/gm)?"sdf":e.match(/^%VERSION\s+VERSION_STAMP/gm)?"prmtop":"xyz",console.log("Best guess: "+t))),(0,f.Parsers[t])(e,r)}}GLModel.defaultAtomStyle={line:{}},GLModel.defaultlineWidth=1,GLModel.vdwRadii={H:1.2,He:1.4,Li:1.82,Be:1.53,B:1.92,C:1.7,N:1.55,O:1.52,F:1.47,Ne:1.54,Na:2.27,Mg:1.73,Al:1.84,Si:2.1,P:1.8,S:1.8,Cl:1.75,Ar:1.88,K:2.75,Ca:2.31,Ni:1.63,Cu:1.4,Zn:1.39,Ga:1.87,Ge:2.11,As:1.85,Se:1.9,Br:1.85,Kr:2.02,Rb:3.03,Sr:2.49,Pd:1.63,Ag:1.72,Cd:1.58,In:1.93,Sn:2.17,Sb:2.06,Te:2.06,I:1.98,Xe:2.16,Cs:3.43,Ba:2.68,Pt:1.75,Au:1.66,Hg:1.55,Tl:1.96,Pb:2.02,Bi:2.07,Po:1.97,At:2.02,Rn:2.2,Fr:3.48,Ra:2.83,U:1.86},GLModel.ignoredKeys=new Set(["props","invert","model","frame","byres","expand","within","and","or","not"])},8783:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GLShape:()=>GLShape,splitMesh:()=>p});var s=r(7693),n=r(3351),a=r(9652),o=r(2550),l=r(9192),h=r(7323),c=r(4406),u=r(6163),f=r(9005);class GLShape{static finalizeGeo(e){var t=e.updateGeoGroup(0);t.vertices>0&&t.truncateArrayBuffers(!0,!0)}static updateColor(e,t){var r,s,n;t=t||o.CC.color(t),e.colorsNeedUpdate=!0,t.constructor!==Array&&(r=t.r,s=t.g,n=t.b);for(let a in e.geometryGroups){let o=e.geometryGroups[a],l=o.colorArray;for(let e=0,a=o.vertices;e0?u/e:(e+u)/e}p.multiplyScalar(c);var g=new a.Vector3(s.x,s.y,s.z).add(p),v=p.clone().negate();let _=new a.Vector3(s.x,s.y,s.z);e.intersectionShape.cylinder.push(new n.Cylinder(_,g.clone(),l)),e.intersectionShape.sphere.push(new n.Sphere(_,l));var y=[];y[0]=p.clone(),Math.abs(y[0].x)>1e-4?y[0].y+=1:y[0].x+=1,y[0].cross(p),y[0].normalize(),y[4]=y[0].clone(),y[4].crossVectors(y[0],p),y[4].normalize(),y[8]=y[0].clone().negate(),y[12]=y[4].clone().negate(),y[2]=y[0].clone().add(y[4]).normalize(),y[6]=y[4].clone().add(y[8]).normalize(),y[10]=y[8].clone().add(y[12]).normalize(),y[14]=y[12].clone().add(y[0]).normalize(),y[1]=y[0].clone().add(y[2]).normalize(),y[3]=y[2].clone().add(y[4]).normalize(),y[5]=y[4].clone().add(y[6]).normalize(),y[7]=y[6].clone().add(y[8]).normalize(),y[9]=y[8].clone().add(y[10]).normalize(),y[11]=y[10].clone().add(y[12]).normalize(),y[13]=y[12].clone().add(y[14]).normalize(),y[15]=y[14].clone().add(y[0]).normalize();var b,w,x,A,C,S,M,z,L,E,T,k,I,O,D,F,R,P,G,B,N,U,V=f.vertices,j=f.vertexArray,H=f.faceArray,W=f.normalArray,q=f.lineArray;for(w=0,x=y.length;w0){var K=j[b-3],$=j[b-2],Q=j[b-1],J=new a.Vector3(K,$,Q),ee=new a.Vector3(o.x,o.y,o.z),te=g.clone(),ie=new a.Vector3(X.x,X.y,X.z);e.intersectionShape.triangle.push(new n.Triangle(ie,ee,J)),e.intersectionShape.triangle.push(new n.Triangle(J.clone(),te,ie.clone()))}}f.vertices+=48,j[b=3*f.vertices]=s.x,j[b+1]=s.y,j[b+2]=s.z,j[b+3]=g.x,j[b+4]=g.y,j[b+5]=g.z,j[b+6]=o.x,j[b+7]=o.y,j[b+8]=o.z,f.vertices+=3;var re=f.vertices-3,se=f.vertices-2,ne=f.vertices-1,ae=3*re,oe=3*se,le=3*ne;for(w=0,x=y.length-1;wl&&(l=u),f>h&&(h=f),p>c&&(c=p)}e.center.set((l+n)/2,(h+a)/2,(c+o)/2),e.radius=e.center.distanceTo({x:l,y:h,z:c}),e.box={min:{x:n,y:a,z:o},max:{x:l,y:h,z:c}}}static addCustomGeo(e,t,r,s,o){var l,h,c,u,f,p,g,v,_,y=t.addGeoGroup(),b=r.vertexArr,w=r.normalArr,x=r.faceArr;y.vertices=b.length,y.faceidx=x.length;var A=y.vertexArray,C=y.colorArray;for(s.constructor!==Array&&(v=s.r,_=s.g,u=s.b),p=0,g=y.vertices;pc?(f.fromCap=0,f.toCap=2):(f.fromCap=2,f.toCap=2),this.addCylinder(f)}}addLine(e){var t,r;t=e.start?new a.Vector3(e.start.x||0,e.start.y||0,e.start.z||0):new a.Vector3(0,0,0),e.end?void 0===(r=new a.Vector3(e.end.x,e.end.y||0,e.end.z||0)).x&&(r.x=3):r=new a.Vector3(3,0,0);var s=this.geo.updateGeoGroup(2),n=s.vertices,o=3*n,l=s.vertexArray;l[o]=t.x,l[o+1]=t.y,l[o+2]=t.z,l[o+3]=r.x,l[o+4]=r.y,l[o+5]=r.z,s.vertices+=2;var h=s.lineArray,c=s.lineidx;h[c]=n,h[c+1]=n+1,s.lineidx+=2;var u=new a.Vector3;this.components.push({centroid:u.addVectors(t,r).multiplyScalar(.5)}),s=this.geo.updateGeoGroup(0),GLShape.updateBoundingFromPoints(this.boundingSphere,this.components,s.vertexArray,s.vertices)}addArrow(e){if(e.start?e.start=new a.Vector3(e.start.x||0,e.start.y||0,e.start.z||0):e.start=new a.Vector3(0,0,0),e.dir instanceof a.Vector3&&"number"==typeof e.length){var t=e.dir.clone().multiplyScalar(e.length).add(e.start);e.end=t}else e.end?(e.end=new a.Vector3(e.end.x,e.end.y||0,e.end.z||0),void 0===e.end.x&&(e.end.x=3)):e.end=new a.Vector3(3,0,0);e.radius=e.radius||.1,e.radiusRatio=e.radiusRatio||1.618034,e.mid=0=0?_[n]-h:h-_[n])>0&&(y[n]|=GLShape.ISDONE)}var b=[],w=[];l.MarchingCube.march(y,b,w,{fulltable:!0,voxel:c,unitCube:e.unit,origin:e.origin,matrix:e.matrix,nX:f,nY:p,nZ:g}),!c&&u>0&&l.MarchingCube.laplacianSmooth(u,b,w);var x=[],A=[],C=[];if(t.selectedRegion&&void 0===t.coords&&(t.coords=t.selectedRegion),void 0===t.coords&&void 0!==t.selection&&(s?t.coords=s.selectedAtoms(t.selection):console.log("addIsosurface needs viewer is selection provided.")),void 0!==t.coords){var S=t.coords[0].x,M=t.coords[0].y,z=t.coords[0].z,L=t.coords[0].x,E=t.coords[0].y,T=t.coords[0].z;for(let e=0;eS?S=t.coords[e].x:t.coords[e].xM?M=t.coords[e].y:t.coords[e].yz?z=t.coords[e].z:t.coords[e].zL&&b[e].xE&&b[e].yT&&b[e].z=64e3&&(t.push({vertexArr:[],normalArr:[],faceArr:[]}),e.colorArr&&(t.colorArr=[]),n++)}return t}GLShape.ISDONE=2,GLShape.drawCustom=function(e,t,r){var s=r,n=s.vertexArr,a=s.faceArr;0!==n.length&&0!==a.length||console.warn("Error adding custom shape component: No vertices and/or face indices supplied!");var l=r.color;void 0===l&&(l=e.color),l=o.CC.color(l);for(var h=p(s),c=0,u=h.length;c{"use strict";r.r(t),r.d(t,{GLViewer:()=>GLViewer,createStereoViewer:()=>b,createViewer:()=>_,createViewerGrid:()=>y});var s=r(7693),n=r(9652),a=r(2550),o=r(9005),l=r(1460),h=r(8223),c=r(7825),u=r(8783),f=r(7323),p=r(9192),g=r(1496),v=r(2109);class GLViewer{getWidth(){let e=this.container,t=e.offsetWidth;if(0==t&&"none"===e.style.display){let r=e.style.position,s=e.style.visibility;e.style.display="block",e.style.visibility="hidden",e.style.position="absolute",t=e.offsetWidth,e.style.display="none",e.style.visibility=s,e.style.position=r}return t}getHeight(){let e=this.container,t=e.offsetHeight;if(0==t&&"none"===e.style.display){let r=e.style.position,s=e.style.visibility;e.style.display="block",e.style.visibility="hidden",e.style.position="absolute",t=e.offsetHeight,e.style.display="none",e.style.visibility=s,e.style.position=r}return t}setupRenderer(){this.renderer=new s.Renderer({antialias:this.config.antialias,preserveDrawingBuffer:!0,premultipliedAlpha:!1,id:this.config.id,row:this.config.row,col:this.config.col,rows:this.config.rows,cols:this.config.cols,canvas:this.config.canvas,containerWidth:this.WIDTH,containerHeight:this.HEIGHT}),this.renderer.domElement.style.width="100%",this.renderer.domElement.style.height="100%",this.renderer.domElement.style.padding="0",this.renderer.domElement.style.position="absolute",this.renderer.domElement.style.top="0px",this.renderer.domElement.style.left="0px",this.renderer.domElement.style.zIndex="0"}initializeScene(){this.scene=new s.Scene,this.scene.fog=new s.Fog(this.bgColor,100,200),this.modelGroup=new s.Object3D,this.rotationGroup=new s.Object3D,this.rotationGroup.useQuaternion=!0,this.rotationGroup.quaternion=new n.Quaternion(0,0,0,1),this.rotationGroup.add(this.modelGroup),this.scene.add(this.rotationGroup);var e=new s.Light(16777215);e.position=new n.Vector3(.2,.2,1).normalize(),e.intensity=1,this.scene.add(e)}initContainer(e){this.container=e,this.WIDTH=this.getWidth(),this.HEIGHT=this.getHeight(),this.ASPECT=this.renderer.getAspect(this.WIDTH,this.HEIGHT),this.renderer.setSize(this.WIDTH,this.HEIGHT),this.container.append(this.renderer.domElement),this.glDOM=this.renderer.domElement,this.nomouse||(this.glDOM.addEventListener("mousedown",this._handleMouseDown.bind(this),{passive:!1}),this.glDOM.addEventListener("touchstart",this._handleMouseDown.bind(this),{passive:!1}),this.glDOM.addEventListener("wheel",this._handleMouseScroll.bind(this),{passive:!1}),this.glDOM.addEventListener("mousemove",this._handleMouseMove.bind(this),{passive:!1}),this.glDOM.addEventListener("touchmove",this._handleMouseMove.bind(this),{passive:!1}),this.glDOM.addEventListener("contextmenu",this._handleContextMenu.bind(this),{passive:!1}))}decAnim(){this.animated--,this.animated<0&&(this.animated=0)}incAnim(){this.animated++}nextSurfID(){var e=0;for(let r in this.surfaces)if(this.surfaces.hasOwnProperty(r)){var t=parseInt(r);isNaN(t)||t>e&&(e=t)}return e+1}setSlabAndFog(){let e=this.camera.position.z-this.rotationGroup.position.z;e<1&&(e=1),this.camera.near=e+this.slabNear,this.camera.near<1&&(this.camera.near=1),this.camera.far=e+this.slabFar,this.camera.near+1>this.camera.far&&(this.camera.far=this.camera.near+1),this.camera.fov=this.fov,this.camera.right=e*Math.tan(Math.PI/180*this.fov),this.camera.left=-this.camera.right,this.camera.top=this.camera.right/this.ASPECT,this.camera.bottom=-this.camera.top,this.camera.updateProjectionMatrix(),this.scene.fog.near=this.camera.near+this.fogStart*(this.camera.far-this.camera.near),this.scene.fog.far=this.camera.far,this.config.disableFog&&(this.scene.fog.near=this.scene.fog.far)}show(e){if(this.renderer.setViewport(),this.scene&&(this.setSlabAndFog(),this.renderer.render(this.scene,this.camera),this.viewChangeCallback&&this.viewChangeCallback(this._viewer.getView()),!e&&this.linkedViewers.length>0))for(var t=this._viewer.getView(),r=0;r0){let t=this.CAMERA_Z-this.config.lowerZoomLimit;e>t&&(e=t)}if(this.config.upperZoomLimit&&this.config.upperZoomLimit>0){let t=this.CAMERA_Z-this.config.upperZoomLimit;ethis.CAMERA_Z-1&&(e=this.CAMERA_Z-1),e}static slerp(e,t,r){if(1==r)return t.clone();if(0==r)return e.clone();let s=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w;if(s>.9995){let s=new n.Quaternion(e.x+r*(t.x-e.x),e.y+r*(t.y-e.y),e.z+r*(t.z-e.z),e.w+r*(t.w-e.w));return s.normalize(),s}s<0&&(t=t.clone().multiplyScalar(-1),s=-s),s>1?s=1:s<-1&&(s=-1);var a=Math.acos(s)*r,o=t.clone();o.sub(e.clone().multiplyScalar(s)),o.normalize();var l=Math.cos(a),h=Math.sin(a),c=new n.Quaternion(e.x*l+o.x*h,e.y*l+o.y*h,e.z*l+o.z*h,e.w*l+o.w*h);return c.normalize(),c}constructor(e,t={}){this.nomouse=!1,this.glDOM=null,this.models=[],this.surfaces={},this.shapes=[],this.labels=[],this.clickables=[],this.hoverables=[],this.contextMenuEnabledAtoms=[],this.current_hover=null,this.hoverDuration=500,this.viewer_frame=0,this.viewChangeCallback=null,this.stateChangeCallback=null,this.NEAR=1,this.FAR=800,this.CAMERA_Z=150,this.fov=20,this.linkedViewers=[],this.renderer=null,this.control_all=!1,this.scene=null,this.rotationGroup=null,this.modelGroup=null,this.fogStart=.4,this.slabNear=-50,this.slabFar=50,this.cq=new n.Quaternion(0,0,0,1),this.dq=new n.Quaternion(0,0,0,1),this.animated=0,this.animationTimers=new Set,this.isDragging=!1,this.mouseStartX=0,this.mouseStartY=0,this.touchDistanceStart=0,this.touchHold=!1,this.currentModelPos=0,this.cz=0,this.cslabNear=0,this.cslabFar=0,this.userContextMenuHandler=null,this.config=t,this.callback=this.config.callback,this.defaultcolors=this.config.defaultcolors,this.defaultcolors||(this.defaultcolors=a.elementColors.defaultColors),this.nomouse=this.config.nomouse,this.bgColor=0,this.config.backgroundColor=this.config.backgroundColor||"#ffffff",void 0!==this.config.backgroundColor&&(this.bgColor=a.CC.color(this.config.backgroundColor).getHex()),this.config.backgroundAlpha=null==this.config.backgroundAlpha?1:this.config.backgroundAlpha,this.camerax=0,void 0!==this.config.camerax&&(this.camerax=parseFloat(this.config.camerax)),this._viewer=this,this.container=e,null!=this.config.hoverDuration&&(this.hoverDuration=this.config.hoverDuration),void 0===this.config.antialias&&(this.config.antialias=!0),void 0===this.config.cartoonQuality&&(this.config.cartoonQuality=10),this.WIDTH=this.getWidth(),this.HEIGHT=this.getHeight(),this.setupRenderer(),this.row=null==this.config.row?0:this.config.row,this.col=null==this.config.col?0:this.config.col,this.cols=this.config.cols,this.rows=this.config.rows,this.viewers=this.config.viewers,this.control_all=this.config.control_all,this.ASPECT=this.renderer.getAspect(this.WIDTH,this.HEIGHT),this.camera=new s.Camera(this.fov,this.ASPECT,this.NEAR,this.FAR,this.config.orthographic),this.camera.position=new n.Vector3(this.camerax,0,this.CAMERA_Z),this.lookingAt=new n.Vector3,this.camera.lookAt(this.lookingAt),this.raycaster=new s.Raycaster(new n.Vector3(0,0,0),new n.Vector3(0,0,0)),this.projector=new s.Projector,this.initializeScene(),this.renderer.setClearColorHex(this.bgColor,this.config.backgroundAlpha),this.scene.fog.color=a.CC.color(this.bgColor),document.body.addEventListener("mouseup",this._handleMouseUp.bind(this)),document.body.addEventListener("touchend",this._handleMouseUp.bind(this)),this.initContainer(this.container),this.config.style&&this.setViewStyle(this.config),window.addEventListener("resize",this.resize.bind(this)),void 0!==window.ResizeObserver&&(this.divwatcher=new window.ResizeObserver(this.resize.bind(this)),this.divwatcher.observe(this.container));try{"function"==typeof this.callback&&this.callback(this)}catch(e){console.log("error with glviewer callback: "+e)}}targetedObjects(e,t,r){var s={x:e,y:t,z:-1};return Array.isArray(r)||(r=this.selectedAtoms(r)),0==r.length?[]:(this.raycaster.setFromCamera(s,this.camera),this.raycaster.intersectObjects(this.modelGroup,r))}modelToScreen(e){let t=!1;Array.isArray(e)||(e=[e],t=!0);let r=this.renderer.getXRatio(),s=this.renderer.getYRatio(),a=this.col,o=this.row,l=a*(this.WIDTH/r),h=(s-o-1)*(this.HEIGHT/s),c=[],u=this.canvasOffset();return e.forEach((e=>{let t=new n.Vector3(e.x,e.y,e.z);t.applyMatrix4(this.modelGroup.matrixWorld),this.projector.projectVector(t,this.camera);let a=this.WIDTH/r*(t.x+1)/2+u.left+l,o=-this.HEIGHT/s*(t.y-1)/2+u.top+h;c.push({x:a,y:o})})),t&&(c=c[0]),c}screenOffsetToModel(e,t,r){var s=e/this.WIDTH,a=t/this.HEIGHT,o=void 0===r?this.rotationGroup.position.z:r,l=this.rotationGroup.quaternion,h=new n.Vector3(0,0,o);return this.projector.projectVector(h,this.camera),h.x+=2*s,h.y-=2*a,this.projector.unprojectVector(h,this.camera),h.z=0,h.applyQuaternion(l),h}screenToModelDistance(e,t){let r=this.canvasOffset(),s=new n.Vector3(t.x,t.y,t.z);s.applyMatrix4(this.modelGroup.matrixWorld);let a=s.clone();this.projector.projectVector(s,this.camera);let o=new n.Vector3(2*(e.x-r.left)/this.WIDTH-1,2*(e.y-r.top)/-this.HEIGHT+1,s.z);return this.projector.unprojectVector(o,this.camera),o.distanceTo(a)}setViewChangeCallback(e){"function"!=typeof e&&null!=e||(this.viewChangeCallback=e)}setStateChangeCallback(e){"function"!=typeof e&&null!=e||(this.stateChangeCallback=e)}getConfig(){return this.config}setConfig(e){this.config=e}getInternalState(){var e={models:[],surfaces:[],shapes:[],labels:[]};for(let t=0;t{t.getCanvas().toBlob((function(t){t.arrayBuffer().then(e)}),"image/png")}))),s+=1,s==e&&(t.viewChangeCallback=n,Promise.all(a).then((e=>{let s=[];for(let t=0;t0&&(this.hoverTimeout=setTimeout((function(){o.handleHoverSelection(a.x,a.y,e)}),this.hoverDuration)),this.isDragging)){var h=(t-this.mouseStartX)/this.WIDTH,c=(r-this.mouseStartY)/this.HEIGHT;if(0!=this.touchDistanceStart&&e.targetTouches&&2==e.targetTouches.length)l=2,c=2*(this.calcTouchDistance(e)-this.touchDistanceStart)/(this.WIDTH+this.HEIGHT);else e.targetTouches&&3==e.targetTouches.length&&(l=1);h*=s,c*=n;var u,f=Math.hypot(h,c);if(3==l||3==this.mouseButton&&e.ctrlKey)this.slabNear=this.cslabNear+100*h,this.slabFar=this.cslabFar-100*c;else if(2==l||3==this.mouseButton||e.shiftKey)(u=.85*(this.CAMERA_Z-this.rotationGroup.position.z))<80&&(u=80),this.rotationGroup.position.z=this.cz+c*u,this.rotationGroup.position.z=this.adjustZoomToLimits(this.rotationGroup.position.z);else if(1==l||2==this.mouseButton||e.ctrlKey){var p=this.screenOffsetToModel(s*(t-this.mouseStartX),n*(r-this.mouseStartY));this.modelGroup.position.addVectors(this.currentModelPos,p)}else if((0===l||1==this.mouseButton)&&0!==f){var g=Math.sin(f*Math.PI)/f;this.dq.x=Math.cos(f*Math.PI),this.dq.y=0,this.dq.z=g*h,this.dq.w=-g*c,this.rotationGroup.quaternion.set(1,0,0,0),this.rotationGroup.quaternion.multiply(this.dq),this.rotationGroup.quaternion.multiply(this.cq)}this.show()}}_handleContextMenu(e){e.preventDefault();var t=this.getX(e),r=this.getY(e);if(t==this.mouseStartX&&r==this.mouseStartY){var s=this.mouseStartX,n=this.mouseStartY,a=this.canvasOffset();let e=this.mouseXY(s,n),t=e.x,r=e.y,l=this.targetedObjects(t,r,this.contextMenuEnabledAtoms);var o=null;l.length&&(o=l[0].clickable);a=this.canvasOffset(),s=this.mouseStartX-a.left,n=this.mouseStartY-a.top;this.userContextMenuHandler&&this.userContextMenuHandler(o,s,n,l)}}setContainer(e){let t=(0,o.getElement)(e)||this.container;return this.initContainer(t),this}setBackgroundColor(e,t){(void 0===t||t<0||t>1)&&(t=1);var r=a.CC.color(e);return this.scene.fog.color=r,this.bgColor=r.getHex(),this.renderer.setClearColorHex(r.getHex(),t),this.show(),this}setProjection(e){this.camera.ortho="orthographic"===e,this.setSlabAndFog()}setViewStyle(e){if("outline"===e.style){var t={};e.color&&(t.color=a.CC.color(e.color)),e.width&&(t.width=e.width),this.renderer.enableOutline(t)}else this.renderer.disableOutline();return this}updateSize(){this.renderer.setSize(this.WIDTH,this.HEIGHT),this.ASPECT=this.renderer.getAspect(this.WIDTH,this.HEIGHT),this.renderer.setSize(this.WIDTH,this.HEIGHT),this.camera.aspect=this.ASPECT,this.camera.updateProjectionMatrix()}setWidth(e){return this.WIDTH=e||this.WIDTH,this.updateSize(),this}setHeight(e){return this.HEIGHT=e||this.HEIGHT,this.updateSize(),this}resize(){this.WIDTH=this.getWidth(),this.HEIGHT=this.getHeight();let e=!1;if(this.renderer.isLost()&&this.WIDTH>0&&this.HEIGHT>0){let t=!1,r=this.container.querySelector("canvas");r&&r!=this.renderer.getCanvas()?this.config.canvas=r:(r.remove(),this.config&&null!=this.config.canvas&&(delete this.config.canvas,t=!0)),this.setupRenderer(),this.initContainer(this.container),this.renderer.setClearColorHex(this.bgColor,this.config.backgroundAlpha),e=!0,t&&(this.config.canvas=this.renderer.getCanvas())}if(0==this.WIDTH||0==this.HEIGHT?this.animated&&this._viewer.pauseAnimate():this.animated&&this._viewer.resumeAnimate(),this.updateSize(),e){let e=this.renderer.supportedExtensions();if(e.regen=!0,this.viewers)for(let t=0,r=this.viewers.length;t=0&&(this.modelGroup.remove(this.labels[r].sprite),(this.viewer_frame<0||this.labels[r].frame==this.viewer_frame)&&this.modelGroup.add(this.labels[r].sprite));for(r in this.surfaces)if(this.surfaces.hasOwnProperty(r)){var o=this.surfaces[r];for(n=0;n1||1==o[n].symmetries.length&&!o[n].symmetries[n].isIdentity()){var c,u=new s.Object3D;for(c=0;c0?this.animateMotion(t,r,this.modelGroup.position,this.adjustZoomToLimits(n),this.rotationGroup.quaternion,this.lookingAt):(this.rotationGroup.position.z=this.adjustZoomToLimits(n),this.show()),this}translate(e,t,r=0,s=!1){var a=e/this.WIDTH,o=t/this.HEIGHT,l=new n.Vector3(0,0,-this.CAMERA_Z);this.projector.projectVector(l,this.camera),l.x-=a,l.y-=o,this.projector.unprojectVector(l,this.camera),l.z=0;var h=this.lookingAt.clone().add(l);return r>0?this.animateMotion(r,s,this.modelGroup.position,this.rotationGroup.position.z,this.rotationGroup.quaternion,h):(this.lookingAt=h,this.camera.lookAt(this.lookingAt),this.show()),this}translateScene(e,t,r=0,s=!1){var n=this.screenOffsetToModel(e,t),a=this.modelGroup.position.clone().add(n);return r>0?this.animateMotion(r,s,this.modelGroup.position,this.rotationGroup.position.z,this.rotationGroup.quaternion,this.lookingAt):(this.modelGroup.position=a,this.show()),this}fitSlab(e){e=e||{};var t=this.getAtomsFromSel(e),r=(0,o.getExtent)(t),s=r[1][0]-r[0][0],n=r[1][1]-r[0][1],a=r[1][2]-r[0][2],l=Math.hypot(s,n,a);return l<5&&(l=5),this.slabNear=-l/1.9,this.slabFar=l/2,this}center(e={},t=0,r=!1){var s,a,l=this.getAtomsFromSel(e),h=(0,o.getExtent)(l);(0,o.isEmptyObject)(e)?(this.shapes.forEach((e=>{if(e&&e.boundingSphere&&e.boundingSphere.center){var t=e.boundingSphere.center,r=e.boundingSphere.radius;r>0?(l.push(new n.Vector3(t.x+r,t.y,t.z)),l.push(new n.Vector3(t.x-r,t.y,t.z)),l.push(new n.Vector3(t.x,t.y+r,t.z)),l.push(new n.Vector3(t.x,t.y-r,t.z)),l.push(new n.Vector3(t.x,t.y,t.z+r)),l.push(new n.Vector3(t.x,t.y,t.z-r))):l.push(t)}})),h=(0,o.getExtent)(l),s=l,a=h):(s=this.getAtomsFromSel({}),a=(0,o.getExtent)(s));var c=new n.Vector3(h[2][0],h[2][1],h[2][2]),u=a[1][0]-a[0][0],f=a[1][1]-a[0][1],p=a[1][2]-a[0][2],g=Math.hypot(u,f,p);g<5&&(g=5),this.slabNear=-g/1.9,this.slabFar=g/2,u=h[1][0]-h[0][0],f=h[1][1]-h[0][1],p=h[1][2]-h[0][2],(g=Math.hypot(u,f,p))<5&&(g=5);for(var v=25,_=0;_v&&(v=y)}g=2*Math.sqrt(v);var b=c.clone().multiplyScalar(-1);return t>0?this.animateMotion(t,r,b,this.rotationGroup.position.z,this.rotationGroup.quaternion,this.lookingAt):(this.modelGroup.position=b,this.show()),this}zoomTo(e={},t=0,r=!1){let s=this.getAtomsFromSel(e),a=(0,o.getExtent)(s),l=a;if((0,o.isEmptyObject)(e)){let e=s&&s.length;if(this.shapes.forEach((e=>{if(e&&e.boundingSphere)if(e.boundingSphere.box){let t=e.boundingSphere.box;s.push(new n.Vector3(t.min.x,t.min.y,t.min.z)),s.push(new n.Vector3(t.max.x,t.max.y,t.max.z))}else if(e.boundingSphere.center){var t=e.boundingSphere.center,r=e.boundingSphere.radius;r>0?(s.push(new n.Vector3(t.x+r,t.y,t.z)),s.push(new n.Vector3(t.x-r,t.y,t.z)),s.push(new n.Vector3(t.x,t.y+r,t.z)),s.push(new n.Vector3(t.x,t.y-r,t.z)),s.push(new n.Vector3(t.x,t.y,t.z+r)),s.push(new n.Vector3(t.x,t.y,t.z-r))):s.push(t)}})),l=(0,o.getExtent)(s),!e)for(let e=0;e<3;e++)a[2][e]=(l[0][e]+l[1][e])/2}else{let e=this.getAtomsFromSel({});l=(0,o.getExtent)(e)}var h=new n.Vector3(a[2][0],a[2][1],a[2][2]),c=l[1][0]-l[0][0],u=l[1][1]-l[0][1],f=l[1][2]-l[0][2],p=Math.hypot(c,u,f);p<5&&(p=5),this.slabNear=-p/1.9,this.slabFar=p/2,0===Object.keys(e).length&&(this.slabNear=Math.min(2*-p,-50),this.slabFar=Math.max(2*p,50));var g=this.config.minimumZoomToDistance||5;c=a[1][0]-a[0][0],u=a[1][1]-a[0][1],f=a[1][2]-a[0][2],(p=Math.hypot(c,u,f))v&&(v=y)}p=2*Math.sqrt(v);var b=h.clone().multiplyScalar(-1),w=-(.5*p/Math.tan(Math.PI/180*this.camera.fov/2)-this.CAMERA_Z);return w=this.adjustZoomToLimits(w),t>0?this.animateMotion(t,r,b,w,this.rotationGroup.quaternion,this.lookingAt):(this.modelGroup.position=b,this.rotationGroup.position.z=w,this.show()),this}setSlab(e,t){this.slabNear=e,this.slabFar=t}getSlab(){return{near:this.slabNear,far:this.slabFar}}addLabel(e,t={},r,s=!1){if(r){var n=(0,o.getExtent)(this.getAtomsFromSel(r));t.position={x:n[2][0],y:n[2][1],z:n[2][2]}}var a=new c.Label(e,t);return a.setContext(),this.modelGroup.add(a.sprite),this.labels.push(a),s||this.show(),a}addResLabels(e,t,r=!1){let s=this.labels.length;return this.applyToModels("addResLabels",e,this,t,r),this.show(),this.labels.slice(s)}addPropertyLabels(e,t,r){return this.applyToModels("addPropertyLabels",e,t,this,r),this.show(),this}removeLabel(e){for(var t=0;t0&&void 0===this.shapes[this.shapes.length-1];)this.shapes.pop();return this}removeAllShapes(){for(var e=0;e-1e-4&&a.x<1.0001&&a.y>-1e-4&&a.y<1.0001&&a.z>-1e-4&&a.z<1.0001)}}for(let a=0;aa){e.start=r,e.end=s,t.addLine(e);break}f.addVectors(r,c),e.start=r,e.end=f,t.addLine(e),r=f.clone(),p+=o,f.addVectors(r,u),r=f.clone(),p+=l}return t.finalize(),t}addCustom(e){e=e||{};var t=new u.GLShape(e);return t.shapePosition=this.shapes.length,t.addCustom(e),this.shapes.push(t),t.finalize(),t}addVolumetricData(e,t,r={}){var s=new f.VolumeData(e,t);return r.hasOwnProperty("transferfn")?this.addVolumetricRender(s,r):this.addIsosurface(s,r)}addIsosurface(e,t={},r){var s=new u.GLShape(t);return s.shapePosition=this.shapes.length,s.addIsosurface(e,t,r,this),this.shapes.push(s),s}addVolumetricRender(e,t){t=t||{};var r=new g.GLVolumetricRender(e,t,this);return r.shapePosition=this.shapes.length,this.shapes.push(r),r}hasVolumetricRender(){return this.renderer.supportsVolumetric()}enableFog(e){e?this.scene.fog=new s.Fog(this.bgColor,100,200):(this.config.disableFog=!0,this.show())}setFrame(e){this.viewer_frame=e;let t=this;return new Promise((function(r){var s=t.models.map((function(r){return r.setFrame(e,t)}));Promise.all(s).then((function(){r()}))}))}getFrame(){return this.viewer_frame}getNumFrames(){var e=0;for(let t=0;te&&(e=this.models[t].getNumFrames());for(let t=0;t=e&&(e=this.shapes[t].frame+1);for(let t=0;t=e&&(e=this.labels[t].frame+1);return e}animate(e){this.incAnim();var t=100,r="forward",s=0;(e=e||{}).interval&&(t=e.interval),e.loop&&(r=e.loop),e.reps&&(s=e.reps);var n=this.getNumFrames(),a=this,l=0;e.startFrame&&(l=e.startFrame%n);var h=1;e.step&&(s/=h=e.step);var c,u,f=0,p=n*s,g=new Date,v=function(e){g=new Date,"forward"==e?a.setFrame(l).then((function(){l=(l+h)%n,c()})):"backward"==e?a.setFrame(n-1-l).then((function(){l=(l+h)%n,c()})):a.setFrame(l).then((function(){h*=(l+=h)%(n-1)==0?-1:1,c()}))};return c=function(){if(a.render(),a.getCanvas().isConnected)if(++f!=p&&a.isAnimated()){var e=t-((new Date).getTime()-g.getTime());e=e>0?e:0,a.animationTimers.delete(u),u=new o.PausableTimer(v,e,r),a.animationTimers.add(u)}else u.cancel(),a.animationTimers.delete(u),a.decAnim();else a.stopAnimate()},u=new o.PausableTimer(v,0,r),this.animationTimers.add(u),this}stopAnimate(){return this.animated=0,this.animationTimers.forEach((function(e){e.cancel()})),this.animationTimers=new Set,this}pauseAnimate(){return this.animationTimers.forEach((function(e){e.pause()})),this}resumeAnimate(){return this.animationTimers.forEach((function(e){e.resume()})),this}isAnimated(){return this.animated>0}getModelOpt(e){return e&&!e.defaultcolors?(e.defaultcolors=this.defaultcolors,e.cartoonQuality=e.cartoonQuality||this.config.cartoonQuality):void 0===e&&(e={defaultcolors:this.defaultcolors,cartoonQuality:this.config.cartoonQuality}),e}addModel(e,t="",r){r=this.getModelOpt(r);var s=new h.GLModel(this.models.length,r);return s.addMolData(e,t,r),this.models.push(s),s}addModels(e,t,r){(r=this.getModelOpt(r)).multimodel=!0,r.frames=!0;for(var s=h.GLModel.parseMolData(e,t,r),n=0;n0&&void 0===this.models[this.models.length-1];)this.models.pop();return this}}removeAllModels(){for(var e=0;et[1][0]||s.yt[1][1]||s.zt[1][2]||r.push(s))}return r}static volume(e){return(e[1][0]-e[0][0])*(e[1][1]-e[0][1])*(e[1][2]-e[0][2])}carveUpExtent(e,t,r){let s=[],n={};for(let e=0,r=t.length;es&&r>n?0:s>r&&s>n?1:2;var a=o(e),h=o(e),c=(e[1][t]-e[0][t])/2+e[0][t];a[1][t]=c,h[0][t]=c;var u=l(a),f=l(h);return u.concat(f)},h=l(e);for(let e=0,n=h.length;e0)for(let e=0,t=f.length;e1||1==C.length&&!C[0].isIdentity()){A=!0;break}}var S=function(e,r,s){var n;b=h?GLViewer.shallowCopy(v.getAtomsFromSel(h)):s;var a=(0,o.getExtent)(s,!0);if(t.map&&t.map.prop){var c=t.map.prop;let e=(0,l.getGradient)(t.map.scheme||t.map.gradient||new l.Gradient.RWB),r=e.range();r||(r=(0,o.getPropertyRange)(s,c)),t.colorscheme={prop:c,gradient:e}}for(let e=0,s=r.length;e0){var x=(0,o.getExtent)(b,!0);w.sort((function(e,t){var r=function(e,t){var r=e.extent,s=r[1][0]-r[0][0],n=r[1][1]-r[0][1],a=r[1][2]-r[0][2],o=s-t[2][0];o*=o;var l=n-t[2][1];l*=l;var h=a-t[2][2];return o+l+(h*=h)};return r(e,x)-r(t,x)}))}var A=[];for(let e=0,t=r.length;e0&&(M.push({geo:new s.Geometry(!0),mat:g,done:!1,finished:!1,symmetries:this.models[x].getSymmetries()}),T.push(S(M[M.length-1],L[x],E[x])));z=Promise.all(T)}else M.push({geo:new s.Geometry(!0),mat:g,done:!1,finished:!1,symmetries:[new n.Matrix4]}),z=S(M[M.length-1],y,w);return this.surfaces[f]=M,z.surfid=f,c&&"function"==typeof c?(z.then((function(e){c(e)})),f):z}setSurfaceMaterialStyle(e,t){if((0,o.adjustVolumeStyle)(t),this.surfaces[e]){var r=this.surfaces[e];r.style=t;for(var n=0;n0?this.camera.position.x=r*Math.tan(Math.PI/180*t):this.camera.position.x=-r*Math.tan(Math.PI/180*t),this.camera.lookAt(new n.Vector3(0,0,this.rotationGroup.position.z)),this.camera.position.x}setDefaultCartoonQuality(e){this.config.cartoonQuality=e}}function _(e,t){if(e=(0,o.getElement)(e)){t=t||{};try{return new GLViewer(e,t)}catch(e){throw"error creating viewer: "+e}}}function y(e,t={},r={}){if(e=(0,o.getElement)(e)){var s=[],n=document.createElement("canvas");r.rows=t.rows,r.cols=t.cols,r.control_all=null!=t.control_all&&t.control_all,e.appendChild(n);try{for(var a=0;a{"use strict";r.r(t),r.d(t,{CustomLinear:()=>CustomLinear,Gradient:()=>Gradient,GradientType:()=>GradientType,ROYGB:()=>ROYGB,RWB:()=>RWB,Sinebow:()=>Sinebow,builtinGradients:()=>o,getGradient:()=>a,normalizeValue:()=>n});var s=r(2550);class GradientType{}function n(e,t,r){return t>=e?(rt&&(r=t),{lo:e,hi:t,val:r}):(r>e&&(r=e),r=2?(this.max=e[1],this.min=e[0]):e&&t&&!Array.isArray(e)&&(this.min=e,this.max=t)}range(){return void 0!==this.min&&void 0!==this.max?[this.min,this.max]:null}valueToHex(e,t){var r,s;if(e=this.mult*e,t?(r=t[0],s=t[1]):(r=this.min,s=this.max),void 0===e)return 16777215;var a=n(r,s,e);r=a.lo;var o,l=((s=a.hi)+r)/2;return(e=a.val)<(l=t&&void 0!==t[2]?t[2]:void 0!==this.mid?this.mid:(r+s)/2)?16711680+256*(o=Math.floor(255*Math.sqrt((e-r)/(l-r))))+o:e>l?65536*(o=Math.floor(255*Math.sqrt(1-(e-l)/(s-l))))+256*o+255:16777215}}class ROYGB extends GradientType{constructor(e,t){super(),this.gradient="ROYGB",this.mult=1,this.min=e,this.max=t,void 0===t&&Array.isArray(e)&&e.length>=2?(this.max=e[1],this.min=e[0]):e&&t&&!Array.isArray(e)&&(this.min=e,this.max=t)}valueToHex(e,t){var r,s;if(e=this.mult*e,t?(r=t[0],s=t[1]):(r=this.min,s=this.max),void 0===e)return 16777215;var a=n(r,s,e),o=((r=a.lo)+(s=a.hi))/2,l=(r+o)/2,h=(o+s)/2;return(e=a.val)=2&&(this.max=e[1],this.min=e[0]),t=2?(this.max=e[1],this.min=e[0],n=t):(this.min=e,this.max=t,n=r),n)for(let e of n)this.colors.push(s.CC.color(e));else this.colors.push(s.CC.color(0))}range(){return void 0!==this.min&&void 0!==this.max?[this.min,this.max]:null}valueToHex(e,t){var r,a;if(t?(r=t[0],a=t[1]):(r=this.min,a=this.max),void 0===e)return 16777215;var o=n(r,a,e);r=o.lo,a=o.hi,e=o.val;let l=this.colors.length,h=(a-r)/l,c=Math.min(Math.floor((e-r)/h),l-1),u=Math.min(c+1,l-1),f=(e-r-c*h)/h,p=this.colors[c],g=this.colors[u];return new s.Color(p.r+f*(g.r-p.r),p.g+f*(g.g-p.g),p.b+f*(g.b-p.b)).getHex()}}const o={rwb:RWB,RWB,roygb:ROYGB,ROYGB,sinebow:Sinebow,linear:CustomLinear};class Gradient extends GradientType{valueToHex(e,t){return 0}range(){return null}}Gradient.RWB=RWB,Gradient.ROYGB=ROYGB,Gradient.Sinebow=Sinebow,Gradient.CustomLinear=CustomLinear,Gradient.builtinGradients=o,Gradient.normalizeValue=n,Gradient.getGradient=a},7825:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Label:()=>Label,LabelCount:()=>o});var s=r(7693),n=r(1460),a=r(2550);let o=0;function l(e,t,r){var s=r;return void 0!==e&&(e instanceof a.Color?s=e.scaled():void 0!==(s=a.CC.color(e)).scaled&&(s=s.scaled())),void 0!==t&&(s.a=parseFloat(t)),s}class Label{constructor(e,t){this.id=o++,this.stylespec=t||{},this.canvas=document.createElement("canvas"),this.canvas.width=134,this.canvas.height=35,this.context=this.canvas.getContext("2d"),this.sprite=new s.Sprite,this.text=e,this.frame=this.stylespec.frame}getStyle(){return this.stylespec}setContext(){var e=this.stylespec,t=void 0!==e.useScreen&&e.useScreen,r=e.showBackground;"0"!==r&&"false"!==r||(r=!1),void 0===r&&(r=!0);var a=e.font?e.font:"sans-serif",o=parseInt(e.fontSize)?parseInt(e.fontSize):18,h=l(e.fontColor,e.fontOpacity,{r:255,g:255,b:255,a:1}),c=e.padding?e.padding:4,u=e.borderThickness?e.borderThickness:0,f=l(e.backgroundColor,e.backgroundOpacity,{r:0,g:0,b:0,a:1}),p=l(e.borderColor,e.borderOpacity,f),g=e.position?e.position:{x:-10,y:1,z:1},v=void 0===e.inFront||e.inFront;"false"!==v&&"0"!==v||(v=!1);var _=e.alignment||s.SpriteAlignment.topLeft;"string"==typeof _&&_ in s.SpriteAlignment&&(_=s.SpriteAlignment[_]);var y="";e.bold&&(y="bold "),this.context.font=y+o+"px "+a;var b=this.context.measureText(this.text).width;r||(u=0);var w=b+2.5*u+2*c,x=1.25*o+2*u+2*c;if(e.backgroundImage){var A=e.backgroundImage,C=e.backgroundWidth?e.backgroundWidth:A.width,S=e.backgroundHeight?e.backgroundHeight:A.height;C>w&&(w=C),S>x&&(x=S)}if(this.canvas.width=w,this.canvas.height=x,this.context.clearRect(0,0,this.canvas.width,this.canvas.height),y="",e.bold&&(y="bold "),this.context.font=y+o+"px "+a,this.context.fillStyle="rgba("+f.r+","+f.g+","+f.b+","+f.a+")",this.context.strokeStyle="rgba("+p.r+","+p.g+","+p.b+","+p.a+")",e.backgroundGradient){let t=this.context.createLinearGradient(0,x/2,w,x/2),r=n.Gradient.getGradient(e.backgroundGradient),s=r.range(),a=-1,o=1;s&&(a=s[0],o=s[1]);let h=o-a;for(let e=0;e<1.01;e+=.1){let s=l(r.valueToHex(a+h*e)),n="rgba("+s.r+","+s.g+","+s.b+","+s.a+")";t.addColorStop(e,n)}this.context.fillStyle=t}this.context.lineWidth=u,r&&function(e,t,r,s,n,a,o){e.beginPath(),e.moveTo(t+a,r),e.lineTo(t+s-a,r),e.quadraticCurveTo(t+s,r,t+s,r+a),e.lineTo(t+s,r+n-a),e.quadraticCurveTo(t+s,r+n,t+s-a,r+n),e.lineTo(t+a,r+n),e.quadraticCurveTo(t,r+n,t,r+n-a),e.lineTo(t,r+a),e.quadraticCurveTo(t,r,t+a,r),e.closePath(),e.fill(),o&&e.stroke()}(this.context,u,u,w-2*u,x-2*u,6,u>0),e.backgroundImage&&this.context.drawImage(A,0,0,w,x),this.context.fillStyle="rgba("+h.r+","+h.g+","+h.b+","+h.a+")",this.context.fillText(this.text,u+c,o+u+c,b);var M=new s.Texture(this.canvas);M.needsUpdate=!0,this.sprite.material=new s.SpriteMaterial({map:M,useScreenCoordinates:t,alignment:_,depthTest:!v,screenOffset:e.screenOffset||null}),this.sprite.scale.set(1,1,1),this.sprite.position.set(g.x,g.y,g.z)}dispose(){void 0!==this.sprite.material.map&&this.sprite.material.map.dispose(),void 0!==this.sprite.material&&this.sprite.material.dispose()}}},9192:(e,t,r)=>{"use strict";r.r(t),r.d(t,{MarchingCube:()=>MarchingCube,MarchingCubeInitializer:()=>MarchingCubeInitializer,PointGrid:()=>PointGrid,ProteinSurface:()=>ProteinSurface,SurfaceType:()=>s,setSyncSurface:()=>o,syncSurface:()=>a});var s,n=r(9652);!function(e){e[e.VDW=1]="VDW",e[e.MS=2]="MS",e[e.SAS=3]="SAS",e[e.SES=4]="SES"}(s||(s={}));var a=!1;function o(e){a=e}(window.navigator.userAgent.indexOf("MSIE ")>=0||window.navigator.userAgent.indexOf("Trident/")>=0)&&(a=!0);class MarchingCubeInitializer{constructor(){this.ISDONE=2,this.edgeTable=new Uint32Array([0,0,0,0,0,0,0,2816,0,0,0,1792,0,3328,3584,3840,0,0,0,138,0,21,0,134,0,0,0,652,0,2067,3865,3600,0,0,0,42,0,0,0,294,0,0,21,28,0,3875,1049,3360,0,168,162,170,0,645,2475,2210,0,687,293,172,4010,3747,3497,3232,0,0,0,0,0,69,0,900,0,0,0,1792,138,131,1608,1920,0,81,0,2074,84,85,84,86,0,81,0,3676,330,1105,1881,1616,0,0,0,42,0,69,0,502,0,0,21,3580,138,2035,1273,1520,2816,104,2337,106,840,581,367,102,2816,3695,3429,3180,1898,1635,1385,1120,0,0,0,0,0,0,0,3910,0,0,69,588,42,2083,41,2880,0,0,0,1722,0,2293,4095,3830,0,255,757,764,2538,2291,3065,2800,0,0,81,338,0,3925,1119,3414,84,855,85,340,2130,2899,89,2384,1792,712,194,1162,4036,3781,3535,3270,708,719,197,204,3018,2755,2505,2240,0,0,0,0,168,420,168,1958,162,162,676,2988,170,163,680,928,3328,3096,3328,3642,52,53,1855,1590,2340,2111,2869,2620,298,51,825,560,3584,3584,3090,3482,1668,1941,1183,1430,146,2975,2069,2460,154,915,153,400,3840,3592,3329,3082,1796,1541,1295,1030,2818,2575,2309,2060,778,515,265,0]),this.triTable=[[],[],[],[],[],[],[],[11,9,8],[],[],[],[8,10,9],[],[10,8,11],[9,11,10],[8,10,9,8,11,10],[],[],[],[1,7,3],[],[4,2,0],[],[2,1,7],[],[],[],[2,7,3,2,9,7],[],[1,4,11,1,0,4],[3,8,0,11,9,4,11,10,9],[4,11,9,11,10,9],[],[],[],[5,3,1],[],[],[],[2,5,8,2,1,5],[],[],[2,4,0],[3,2,4],[],[0,9,1,8,10,5,8,11,10],[3,4,0,3,10,4],[5,8,10,8,11,10],[],[3,5,7],[7,1,5],[1,7,3,1,5,7],[],[9,2,0,9,7,2],[0,3,8,1,7,11,1,5,7],[11,1,7,1,5,7],[],[9,1,0,5,3,2,5,7,3],[8,2,5,8,0,2],[2,5,3,5,7,3],[3,9,1,3,8,9,7,11,10,7,10,5],[9,1,0,10,7,11,10,5,7],[3,8,0,7,10,5,7,11,10],[11,5,7,11,10,5],[],[],[],[],[],[0,6,2],[],[7,2,9,7,9,8],[],[],[],[8,10,9],[7,1,3],[7,1,0],[6,9,3,6,10,9],[7,10,8,10,9,8],[],[6,0,4],[],[11,1,4,11,3,1],[2,4,6],[2,0,4,2,4,6],[2,4,6],[1,4,2,4,6,2],[],[6,0,4],[],[2,11,3,6,9,4,6,10,9],[8,6,1,8,1,3],[10,0,6,0,4,6],[8,0,3,9,6,10,9,4,6],[10,4,6,10,9,4],[],[],[],[5,3,1],[],[0,6,2],[],[7,4,8,5,2,1,5,6,2],[],[],[2,4,0],[7,4,8,2,11,3,10,5,6],[7,1,3],[5,6,10,0,9,1,8,7,4],[5,6,10,7,0,3,7,4,0],[10,5,6,4,8,7],[9,11,8],[3,5,6],[0,5,11,0,11,8],[6,3,5,3,1,5],[3,9,6,3,8,9],[9,6,0,6,2,0],[0,3,8,2,5,6,2,1,5],[1,6,2,1,5,6],[9,11,8],[1,0,9,6,10,5,11,3,2],[6,10,5,2,8,0,2,11,8],[3,2,11,10,5,6],[10,5,6,9,3,8,9,1,3],[0,9,1,5,6,10],[8,0,3,10,5,6],[10,5,6],[],[],[],[],[],[],[],[1,10,2,9,11,6,9,8,11],[],[],[6,0,2],[3,6,9,3,2,6],[3,5,1],[0,5,1,0,11,5],[0,3,5],[6,9,11,9,8,11],[],[],[],[4,5,9,7,1,10,7,3,1],[],[11,6,7,2,4,5,2,0,4],[11,6,7,8,0,3,1,10,2,9,4,5],[6,7,11,1,10,2,9,4,5],[],[4,1,0,4,5,1,6,7,3,6,3,2],[9,4,5,0,6,7,0,2,6],[4,5,9,6,3,2,6,7,3],[6,7,11,5,3,8,5,1,3],[6,7,11,4,1,0,4,5,1],[4,5,9,3,8,0,11,6,7],[9,4,5,7,11,6],[],[],[0,6,4],[8,6,4,8,1,6],[],[0,10,2,0,9,10,4,8,11,4,11,6],[10,2,1,6,0,3,6,4,0],[10,2,1,11,4,8,11,6,4],[4,2,6],[1,0,9,2,4,8,2,6,4],[2,4,0,2,6,4],[8,2,4,2,6,4],[11,4,1,11,6,4],[0,9,1,4,11,6,4,8,11],[3,6,0,6,4,0],[8,6,4,8,11,6],[10,8,9],[6,3,9,6,7,3],[6,7,1],[10,7,1,7,3,1],[7,11,6,8,10,2,8,9,10],[11,6,7,10,0,9,10,2,0],[2,1,10,7,11,6,8,0,3],[1,10,2,6,7,11],[7,2,6,7,9,2],[1,0,9,3,6,7,3,2,6],[7,0,6,0,2,6],[2,7,3,2,6,7],[7,11,6,3,9,1,3,8,9],[9,1,0,11,6,7],[0,3,8,11,6,7],[11,6,7],[],[],[],[],[5,3,7],[8,5,2,8,7,5],[5,3,7],[1,10,2,5,8,7,5,9,8],[1,7,5],[1,7,5],[9,2,7,9,7,5],[11,3,2,8,5,9,8,7,5],[1,3,7,1,7,5],[0,7,1,7,5,1],[9,3,5,3,7,5],[9,7,5,9,8,7],[8,10,11],[3,4,10,3,10,11],[8,10,11],[5,9,4,1,11,3,1,10,11],[2,4,5],[5,2,4,2,0,4],[0,3,8,5,9,4,10,2,1],[2,1,10,9,4,5],[2,8,5,2,11,8],[3,2,11,1,4,5,1,0,4],[9,4,5,8,2,11,8,0,2],[11,3,2,9,4,5],[8,5,3,5,1,3],[5,0,4,5,1,0],[3,8,0,4,5,9],[9,4,5],[11,9,10],[11,9,10],[1,11,4,1,10,11],[8,7,4,11,1,10,11,3,1],[2,7,9,2,9,10],[4,8,7,0,10,2,0,9,10],[2,1,10,0,7,4,0,3,7],[10,2,1,8,7,4],[1,7,4],[3,2,11,4,8,7,9,1,0],[11,4,2,4,0,2],[2,11,3,7,4,8],[4,1,7,1,3,7],[1,0,9,8,7,4],[3,4,0,3,7,4],[8,7,4],[8,9,10,8,10,11],[3,9,11,9,10,11],[0,10,8,10,11,8],[10,3,1,10,11,3],[2,8,10,8,9,10],[9,2,0,9,10,2],[8,0,3,1,10,2],[10,2,1],[1,11,9,11,8,9],[11,3,2,0,9,1],[11,0,2,11,8,0],[11,3,2],[8,1,3,8,9,1],[9,1,0],[8,0,3],[]],this.edgeTable2=[0,265,515,778,2060,2309,2575,2822,1030,1295,1541,1804,3082,3331,3593,3840,400,153,915,666,2460,2197,2975,2710,1430,1183,1941,1692,3482,3219,3993,3728,560,825,51,314,2620,2869,2111,2358,1590,1855,1077,1340,3642,3891,3129,3376,928,681,419,170,2988,2725,2479,2214,1958,1711,1445,1196,4010,3747,3497,3232,2240,2505,2755,3018,204,453,719,966,3270,3535,3781,4044,1226,1475,1737,1984,2384,2137,2899,2650,348,85,863,598,3414,3167,3925,3676,1370,1107,1881,1616,2800,3065,2291,2554,764,1013,255,502,3830,4095,3317,3580,1786,2035,1273,1520,2912,2665,2403,2154,876,613,367,102,3942,3695,3429,3180,1898,1635,1385,1120,1120,1385,1635,1898,3180,3429,3695,3942,102,367,613,876,2154,2403,2665,2912,1520,1273,2035,1786,3580,3317,4095,3830,502,255,1013,764,2554,2291,3065,2800,1616,1881,1107,1370,3676,3925,3167,3414,598,863,85,348,2650,2899,2137,2384,1984,1737,1475,1226,4044,3781,3535,3270,966,719,453,204,3018,2755,2505,2240,3232,3497,3747,4010,1196,1445,1711,1958,2214,2479,2725,2988,170,419,681,928,3376,3129,3891,3642,1340,1077,1855,1590,2358,2111,2869,2620,314,51,825,560,3728,3993,3219,3482,1692,1941,1183,1430,2710,2975,2197,2460,666,915,153,400,3840,3593,3331,3082,1804,1541,1295,1030,2822,2575,2309,2060,778,515,265,0],this.triTable2=[[],[8,3,0],[9,0,1],[8,3,1,8,1,9],[11,2,3],[11,2,0,11,0,8],[11,2,3,0,1,9],[2,1,11,1,9,11,11,9,8],[10,1,2],[8,3,0,1,2,10],[9,0,2,9,2,10],[3,2,8,2,10,8,8,10,9],[10,1,3,10,3,11],[1,0,10,0,8,10,10,8,11],[0,3,9,3,11,9,9,11,10],[8,10,9,8,11,10],[8,4,7],[3,0,4,3,4,7],[1,9,0,8,4,7],[9,4,1,4,7,1,1,7,3],[2,3,11,7,8,4],[7,11,4,11,2,4,4,2,0],[3,11,2,4,7,8,9,0,1],[2,7,11,2,1,7,1,4,7,1,9,4],[10,1,2,8,4,7],[2,10,1,0,4,7,0,7,3],[4,7,8,0,2,10,0,10,9],[2,7,3,2,9,7,7,9,4,2,10,9],[8,4,7,11,10,1,11,1,3],[11,4,7,1,4,11,1,11,10,1,0,4],[3,8,0,7,11,4,11,9,4,11,10,9],[7,11,4,4,11,9,11,10,9],[9,5,4],[3,0,8,4,9,5],[5,4,0,5,0,1],[4,8,5,8,3,5,5,3,1],[11,2,3,9,5,4],[9,5,4,8,11,2,8,2,0],[3,11,2,1,5,4,1,4,0],[8,5,4,2,5,8,2,8,11,2,1,5],[2,10,1,9,5,4],[0,8,3,5,4,9,10,1,2],[10,5,2,5,4,2,2,4,0],[3,4,8,3,2,4,2,5,4,2,10,5],[5,4,9,1,3,11,1,11,10],[0,9,1,4,8,5,8,10,5,8,11,10],[3,4,0,3,10,4,4,10,5,3,11,10],[4,8,5,5,8,10,8,11,10],[9,5,7,9,7,8],[0,9,3,9,5,3,3,5,7],[8,0,7,0,1,7,7,1,5],[1,7,3,1,5,7],[11,2,3,8,9,5,8,5,7],[9,2,0,9,7,2,2,7,11,9,5,7],[0,3,8,2,1,11,1,7,11,1,5,7],[2,1,11,11,1,7,1,5,7],[1,2,10,5,7,8,5,8,9],[9,1,0,10,5,2,5,3,2,5,7,3],[5,2,10,8,2,5,8,5,7,8,0,2],[10,5,2,2,5,3,5,7,3],[3,9,1,3,8,9,7,11,10,7,10,5],[9,1,0,10,7,11,10,5,7],[3,8,0,7,10,5,7,11,10],[11,5,7,11,10,5],[11,7,6],[0,8,3,11,7,6],[9,0,1,11,7,6],[7,6,11,3,1,9,3,9,8],[2,3,7,2,7,6],[8,7,0,7,6,0,0,6,2],[1,9,0,3,7,6,3,6,2],[7,6,2,7,2,9,2,1,9,7,9,8],[1,2,10,6,11,7],[2,10,1,7,6,11,8,3,0],[11,7,6,10,9,0,10,0,2],[7,6,11,3,2,8,8,2,10,8,10,9],[6,10,7,10,1,7,7,1,3],[6,10,1,6,1,7,7,1,0,7,0,8],[9,0,3,6,9,3,6,10,9,6,3,7],[6,10,7,7,10,8,10,9,8],[8,4,6,8,6,11],[11,3,6,3,0,6,6,0,4],[0,1,9,4,6,11,4,11,8],[1,9,4,11,1,4,11,3,1,11,4,6],[3,8,2,8,4,2,2,4,6],[2,0,4,2,4,6],[1,9,0,3,8,2,2,8,4,2,4,6],[9,4,1,1,4,2,4,6,2],[10,1,2,11,8,4,11,4,6],[10,1,2,11,3,6,6,3,0,6,0,4],[0,2,10,0,10,9,4,11,8,4,6,11],[2,11,3,6,9,4,6,10,9],[8,4,6,8,6,1,6,10,1,8,1,3],[1,0,10,10,0,6,0,4,6],[8,0,3,9,6,10,9,4,6],[10,4,6,10,9,4],[9,5,4,7,6,11],[4,9,5,3,0,8,11,7,6],[6,11,7,4,0,1,4,1,5],[6,11,7,4,8,5,5,8,3,5,3,1],[4,9,5,6,2,3,6,3,7],[9,5,4,8,7,0,0,7,6,0,6,2],[4,0,1,4,1,5,6,3,7,6,2,3],[7,4,8,5,2,1,5,6,2],[6,11,7,1,2,10,9,5,4],[11,7,6,8,3,0,1,2,10,9,5,4],[11,7,6,10,5,2,2,5,4,2,4,0],[7,4,8,2,11,3,10,5,6],[4,9,5,6,10,7,7,10,1,7,1,3],[5,6,10,0,9,1,8,7,4],[5,6,10,7,0,3,7,4,0],[10,5,6,4,8,7],[5,6,9,6,11,9,9,11,8],[0,9,5,0,5,3,3,5,6,3,6,11],[0,1,5,0,5,11,5,6,11,0,11,8],[11,3,6,6,3,5,3,1,5],[9,5,6,3,9,6,3,8,9,3,6,2],[5,6,9,9,6,0,6,2,0],[0,3,8,2,5,6,2,1,5],[1,6,2,1,5,6],[1,2,10,5,6,9,9,6,11,9,11,8],[1,0,9,6,10,5,11,3,2],[6,10,5,2,8,0,2,11,8],[3,2,11,10,5,6],[10,5,6,9,3,8,9,1,3],[0,9,1,5,6,10],[8,0,3,10,5,6],[10,5,6],[10,6,5],[8,3,0,10,6,5],[0,1,9,5,10,6],[10,6,5,9,8,3,9,3,1],[3,11,2,10,6,5],[6,5,10,2,0,8,2,8,11],[1,9,0,6,5,10,11,2,3],[1,10,2,5,9,6,9,11,6,9,8,11],[1,2,6,1,6,5],[0,8,3,2,6,5,2,5,1],[5,9,6,9,0,6,6,0,2],[9,6,5,3,6,9,3,9,8,3,2,6],[11,6,3,6,5,3,3,5,1],[0,5,1,0,11,5,5,11,6,0,8,11],[0,5,9,0,3,5,3,6,5,3,11,6],[5,9,6,6,9,11,9,8,11],[10,6,5,4,7,8],[5,10,6,7,3,0,7,0,4],[5,10,6,0,1,9,8,4,7],[4,5,9,6,7,10,7,1,10,7,3,1],[7,8,4,2,3,11,10,6,5],[11,6,7,10,2,5,2,4,5,2,0,4],[11,6,7,8,0,3,1,10,2,9,4,5],[6,7,11,1,10,2,9,4,5],[7,8,4,5,1,2,5,2,6],[4,1,0,4,5,1,6,7,3,6,3,2],[9,4,5,8,0,7,0,6,7,0,2,6],[4,5,9,6,3,2,6,7,3],[6,7,11,4,5,8,5,3,8,5,1,3],[6,7,11,4,1,0,4,5,1],[4,5,9,3,8,0,11,6,7],[9,4,5,7,11,6],[10,6,4,10,4,9],[8,3,0,9,10,6,9,6,4],[1,10,0,10,6,0,0,6,4],[8,6,4,8,1,6,6,1,10,8,3,1],[2,3,11,6,4,9,6,9,10],[0,10,2,0,9,10,4,8,11,4,11,6],[10,2,1,11,6,3,6,0,3,6,4,0],[10,2,1,11,4,8,11,6,4],[9,1,4,1,2,4,4,2,6],[1,0,9,3,2,8,2,4,8,2,6,4],[2,4,0,2,6,4],[3,2,8,8,2,4,2,6,4],[1,4,9,11,4,1,11,1,3,11,6,4],[0,9,1,4,11,6,4,8,11],[11,6,3,3,6,0,6,4,0],[8,6,4,8,11,6],[6,7,10,7,8,10,10,8,9],[9,3,0,6,3,9,6,9,10,6,7,3],[6,1,10,6,7,1,7,0,1,7,8,0],[6,7,10,10,7,1,7,3,1],[7,11,6,3,8,2,8,10,2,8,9,10],[11,6,7,10,0,9,10,2,0],[2,1,10,7,11,6,8,0,3],[1,10,2,6,7,11],[7,2,6,7,9,2,2,9,1,7,8,9],[1,0,9,3,6,7,3,2,6],[8,0,7,7,0,6,0,2,6],[2,7,3,2,6,7],[7,11,6,3,9,1,3,8,9],[9,1,0,11,6,7],[0,3,8,11,6,7],[11,6,7],[11,7,5,11,5,10],[3,0,8,7,5,10,7,10,11],[9,0,1,10,11,7,10,7,5],[3,1,9,3,9,8,7,10,11,7,5,10],[10,2,5,2,3,5,5,3,7],[5,10,2,8,5,2,8,7,5,8,2,0],[9,0,1,10,2,5,5,2,3,5,3,7],[1,10,2,5,8,7,5,9,8],[2,11,1,11,7,1,1,7,5],[0,8,3,2,11,1,1,11,7,1,7,5],[9,0,2,9,2,7,2,11,7,9,7,5],[11,3,2,8,5,9,8,7,5],[1,3,7,1,7,5],[8,7,0,0,7,1,7,5,1],[0,3,9,9,3,5,3,7,5],[9,7,5,9,8,7],[4,5,8,5,10,8,8,10,11],[3,0,4,3,4,10,4,5,10,3,10,11],[0,1,9,4,5,8,8,5,10,8,10,11],[5,9,4,1,11,3,1,10,11],[3,8,4,3,4,2,2,4,5,2,5,10],[10,2,5,5,2,4,2,0,4],[0,3,8,5,9,4,10,2,1],[2,1,10,9,4,5],[8,4,5,2,8,5,2,11,8,2,5,1],[3,2,11,1,4,5,1,0,4],[9,4,5,8,2,11,8,0,2],[11,3,2,9,4,5],[4,5,8,8,5,3,5,1,3],[5,0,4,5,1,0],[3,8,0,4,5,9],[9,4,5],[7,4,11,4,9,11,11,9,10],[3,0,8,7,4,11,11,4,9,11,9,10],[11,7,4,1,11,4,1,10,11,1,4,0],[8,7,4,11,1,10,11,3,1],[2,3,7,2,7,9,7,4,9,2,9,10],[4,8,7,0,10,2,0,9,10],[2,1,10,0,7,4,0,3,7],[10,2,1,8,7,4],[2,11,7,2,7,1,1,7,4,1,4,9],[3,2,11,4,8,7,9,1,0],[7,4,11,11,4,2,4,0,2],[2,11,3,7,4,8],[9,1,4,4,1,7,1,3,7],[1,0,9,8,7,4],[3,4,0,3,7,4],[8,7,4],[8,9,10,8,10,11],[0,9,3,3,9,11,9,10,11],[1,10,0,0,10,8,10,11,8],[10,3,1,10,11,3],[3,8,2,2,8,10,8,9,10],[9,2,0,9,10,2],[8,0,3,1,10,2],[10,2,1],[2,11,1,1,11,9,11,8,9],[11,3,2,0,9,1],[11,0,2,11,8,0],[11,3,2],[8,1,3,8,9,1],[9,1,0],[8,0,3],[]]}march(e,t,r,s){let a=!!s.fulltable,o=s.hasOwnProperty("origin")&&s.origin.hasOwnProperty("x")?s.origin:{x:0,y:0,z:0},l=!!s.voxel,h=s.matrix,c=s.nX||0,u=s.nY||0,f=s.nZ||0,p=s.scale||1,g=null;g=s.unitCube?s.unitCube:{x:p,y:p,z:p};let v,_,y=new Int32Array(c*u*f);for(v=0,_=y.length;v<_;++v)y[v]=-1;let b=function(e,r,s,a,c,p){let v={x:0,y:0,z:0},_=c;if(!!!(a&1<>2))+s+((2&t)>>1))*f+n+(1&t)]&this.ISDONE)<=3&&(t.push(t[s]),s=t.length-1,t.push(t[n]),n=t.length-1,t.push(t[a]),a=t.length-1),r.push(s),r.push(n),r.push(a)}}}laplacianSmooth(e,t,r){let s,n,a,o,l,h=new Array(t.length);for(s=0,n=t.length;s1e6&&(this.scaleFactor=this.defaultScaleFactor/2);let s=1/this.scaleFactor*5.5;this.pminx=e[0][0],this.pmaxx=e[1][0],this.pminy=e[0][1],this.pmaxy=e[1][1],this.pminz=e[0][2],this.pmaxz=e[1][2],t?(this.pminx-=this.probeRadius+s,this.pminy-=this.probeRadius+s,this.pminz-=this.probeRadius+s,this.pmaxx+=this.probeRadius+s,this.pmaxy+=this.probeRadius+s,this.pmaxz+=this.probeRadius+s):(this.pminx-=s,this.pminy-=s,this.pminz-=s,this.pmaxx+=s,this.pmaxy+=s,this.pmaxz+=s),this.pminx=Math.floor(this.pminx*this.scaleFactor)/this.scaleFactor,this.pminy=Math.floor(this.pminy*this.scaleFactor)/this.scaleFactor,this.pminz=Math.floor(this.pminz*this.scaleFactor)/this.scaleFactor,this.pmaxx=Math.ceil(this.pmaxx*this.scaleFactor)/this.scaleFactor,this.pmaxy=Math.ceil(this.pmaxy*this.scaleFactor)/this.scaleFactor,this.pmaxz=Math.ceil(this.pmaxz*this.scaleFactor)/this.scaleFactor,this.ptranx=-this.pminx,this.ptrany=-this.pminy,this.ptranz=-this.pminz,this.pLength=Math.ceil(this.scaleFactor*(this.pmaxx-this.pminx))+1,this.pWidth=Math.ceil(this.scaleFactor*(this.pmaxy-this.pminy))+1,this.pHeight=Math.ceil(this.scaleFactor*(this.pmaxz-this.pminz))+1,this.boundingatom(t),this.cutRadius=this.probeRadius*this.scaleFactor,this.vpBits=new Uint8Array(this.pLength*this.pWidth*this.pHeight),this.vpDistance=new Float64Array(this.pLength*this.pWidth*this.pHeight),this.vpAtomID=new Int32Array(this.pLength*this.pWidth*this.pHeight)}boundingatom(e){let t={};for(const r in this.vdwRadii){let s=this.vdwRadii[r];t[r]=e?(s+this.probeRadius)*this.scaleFactor+.5:s*this.scaleFactor+.5;let n=t[r]*t[r];this.widxz[r]=Math.floor(t[r])+1,this.depty[r]=new Int32Array(this.widxz[r]*this.widxz[r]);let a=0;for(let e=0;en)this.depty[r][a]=-1;else{let e=Math.sqrt(n-s);this.depty[r][a]=Math.floor(e)}a++}}}fillvoxels(e,t){for(let e=0,t=this.vpBits.length;e=this.pLength||c>=this.pWidth||u>=this.pHeight)continue;let p=o*l+c*this.pHeight+u;if(this.vpBits[p]&this.INOUT){let o=t[this.vpAtomID[p]];if(o.serial!=e.serial){let t=r+g-Math.floor(.5+this.scaleFactor*(o.x+this.ptranx)),l=s+a-Math.floor(.5+this.scaleFactor*(o.y+this.ptrany)),h=n+v-Math.floor(.5+this.scaleFactor*(o.z+this.ptranz));g*g+a*a+v*v=this.pLength||c>=this.pWidth||u>=this.pHeight)continue;let p=o*l+c*this.pHeight+u;if(this.vpBits[p]&this.ISDONE){let o=t[this.vpAtomID[p]];if(o.serial!=e.serial){let t=s+g-Math.floor(.5+this.scaleFactor*(o.x+this.ptranx)),l=n+r-Math.floor(.5+this.scaleFactor*(o.y+this.ptrany)),h=a+v-Math.floor(.5+this.scaleFactor*(o.z+this.ptranz));g*g+r*r+v*v-1&&o-1&&h-1&&l=l)||(this.vpBits[e]|=this.ISBOUND))}fastoneshell(e,t){let r,s,n,a,o,l,h,c,u,f=[];if(0===e.length)return f;let p={ix:-1,iy:-1,iz:-1},g=this.pWidth*this.pHeight;for(let v=0,_=e.length;v<_;v++){r=e[v].ix,s=e[v].iy,n=e[v].iz,c=t.get(r,s,n);for(let e=0;e<6;e++)p.ix=r+this.nb[e][0],p.iy=s+this.nb[e][1],p.iz=n+this.nb[e][2],p.ix-1&&p.iy-1&&p.iz-1&&(u=p.ix*g+this.pHeight*p.iy+p.iz,this.vpBits[u]&this.INOUT&&!(this.vpBits[u]&this.ISDONE)?(t.set(p.ix,p.iy,n+this.nb[e][2],c),a=p.ix-c.ix,o=p.iy-c.iy,l=p.iz-c.iz,h=a*a+o*o+l*l,this.vpDistance[u]=h,this.vpBits[u]|=this.ISDONE,this.vpBits[u]|=this.ISBOUND,f.push({ix:p.ix,iy:p.iy,iz:p.iz})):this.vpBits[u]&this.INOUT&&this.vpBits[u]&this.ISDONE&&(a=p.ix-c.ix,o=p.iy-c.iy,l=p.iz-c.iz,h=a*a+o*o+l*l,h-1&&p.iy-1&&p.iz-1&&(u=p.ix*g+this.pHeight*p.iy+p.iz,this.vpBits[u]&this.INOUT&&!(this.vpBits[u]&this.ISDONE)?(t.set(p.ix,p.iy,n+this.nb[e][2],c),a=p.ix-c.ix,o=p.iy-c.iy,l=p.iz-c.iz,h=a*a+o*o+l*l,this.vpDistance[u]=h,this.vpBits[u]|=this.ISDONE,this.vpBits[u]|=this.ISBOUND,f.push({ix:p.ix,iy:p.iy,iz:p.iz})):this.vpBits[u]&this.INOUT&&this.vpBits[u]&this.ISDONE&&(a=p.ix-c.ix,o=p.iy-c.iy,l=p.iz-c.iz,h=a*a+o*o+l*l,h-1&&p.iy-1&&p.iz-1&&(u=p.ix*g+this.pHeight*p.iy+p.iz,this.vpBits[u]&this.INOUT&&!(this.vpBits[u]&this.ISDONE)?(t.set(p.ix,p.iy,n+this.nb[e][2],c),a=p.ix-c.ix,o=p.iy-c.iy,l=p.iz-c.iz,h=a*a+o*o+l*l,this.vpDistance[u]=h,this.vpBits[u]|=this.ISDONE,this.vpBits[u]|=this.ISBOUND,f.push({ix:p.ix,iy:p.iy,iz:p.iz})):this.vpBits[u]&this.INOUT&&this.vpBits[u]&this.ISDONE&&(a=p.ix-c.ix,o=p.iy-c.iy,l=p.iz-c.iz,h=a*a+o*o+l*l,h{"use strict";r.r(t),r.d(t,{VolumeData:()=>VolumeData});var s=r(9005),n=r(9652),a=r(5591),o=r(972),l=r(7885);class VolumeData{constructor(e,t,r){if(this.unit={x:1,y:1,z:1},this.origin={x:0,y:0,z:0},this.size={x:0,y:0,z:0},this.data=new Float32Array([]),this.matrix=null,this.inversematrix=null,this.isbinary=new Set(["ccp4","CCP4"]),this.getCoordinates=function(e){var t=e/(this.size.y*this.size.z),r=e%(this.size.y*this.size.z),s=e%this.size.z;return t*=this.unit.x,r*=this.unit.y,s*=this.unit.z,{x:t+=this.origin.x,y:r+=this.origin.y,z:s+=this.origin.z}},this.vasp=function(e){var t=e.replace(/^\s+/,"").split(/[\n\r]/),r=(0,a.VASP)(e)[0].length;if(0==r)return console.log("No good formating of CHG or CHGCAR file, not atomic information provided in the file."),void(this.data=[]);var s,o=1.889725992,l=parseFloat(t[1]);s=t[2].replace(/^\s+/,"").split(/\s+/);var h=new n.Vector3(parseFloat(s[0]),parseFloat(s[1]),parseFloat(s[2])).multiplyScalar(l*o);s=t[3].replace(/^\s+/,"").split(/\s+/);var c=new n.Vector3(parseFloat(s[0]),parseFloat(s[1]),parseFloat(s[2])).multiplyScalar(l*o);s=t[4].replace(/^\s+/,"").split(/\s+/);var u=new n.Vector3(parseFloat(s[0]),parseFloat(s[1]),parseFloat(s[2])).multiplyScalar(l*o),f=h.x*(c.y*u.z-u.y*c.z)-c.x*(h.y*u.z-u.y*h.z)+u.x*(h.y*c.z-c.y*h.z),p=1/(f=Math.abs(f)/Math.pow(o,3));t.splice(0,8+r+1);var g=t[0].replace(/^\s+/,"").replace(/\s+/g," ").split(" "),v=Math.abs(parseFloat(g[0])),_=Math.abs(parseFloat(g[1])),y=Math.abs(parseFloat(g[2])),b=this.origin=new n.Vector3(0,0,0);this.size={x:v,y:_,z:y},this.unit=new n.Vector3(h.x,c.y,u.z),h=h.multiplyScalar(1/(o*v)),c=c.multiplyScalar(1/(o*_)),u=u.multiplyScalar(1/(o*y)),0==h.y&&0==h.z&&0==c.x&&0==c.z&&0==u.x&&0==u.y||(this.matrix=new n.Matrix4(h.x,c.x,u.x,0,h.y,c.y,u.y,0,h.z,c.z,u.z,0,0,0,0,1),this.matrix=this.matrix.multiplyMatrices(this.matrix,(new n.Matrix4).makeTranslation(b.x,b.y,b.z)),this.origin=new n.Vector3(0,0,0),this.unit=new n.Vector3(1,1,1)),t.splice(0,1);var w=t.join(" "),x=(w=w.replace(/^\s+/,"")).split(/[\s\r]+/);x.splice(v*_*y+1);for(var A=Float32Array.from(x,parseFloat),C=0;C=this.size.x||t<0||t>=this.size.y||r<0||r>=this.size.z?-1:e*this.size.y*this.size.z+t*this.size.z+r}getVal(e,t,r){let s=this.getIndex(e,t,r);return s<0?0:this.data[s]}cube(e){var t=e.split(/\r?\n/);if(!(t.length<6)){var r=(0,o.CUBE)(e,{}).modelData[0].cryst,s=t[2].replace(/^\s+/,"").replace(/\s+/g," ").split(" "),n=parseFloat(s[0]),a=Math.abs(n);this.origin=r.origin,this.size=r.size,this.unit=r.unit,this.matrix=r.matrix4;var l=6;n<0&&l++;var h=t.splice(a+l).join(" "),c=(h=h.replace(/^\s+/,"")).split(/[\s\r]+/);this.data=Float32Array.from(c,parseFloat)}}ccp4(e){var t={};e=new Int8Array(e);var r=new Int32Array(e.buffer,0,56),s=new Float32Array(e.buffer,0,56),a=new DataView(e.buffer);if(t.MAP=String.fromCharCode(a.getUint8(208),a.getUint8(209),a.getUint8(210),a.getUint8(211)),t.MACHST=[a.getUint8(212),a.getUint8(213)],17===t.MACHST[0]&&17===t.MACHST[1])for(var o=e.byteLength,l=0;l{"use strict";r.r(t),r.d(t,{GLVolumetricRender:()=>GLVolumetricRender});var s=r(3351),n=r(9652),a=r(7693),o=r(2550),l=r(8783);class GLVolumetricRender{static interpolateArray(e,t){function r(e,t,r){return e+(t-e)*r}var s=[],n=(e.length-1)/(t-1);s[0]=e[0];for(var a=1;a=0||e.getIndex(u,f,p)>=0)for(let t=l;t=0&&!r[l]){(t-o.x)*(t-o.x)+(s-o.y)*(s-o.y)+(a-o.z)*(a-o.z){"use strict";var s;r.r(t),r.d(t,{BackSide:()=>a,Camera:()=>Camera,ClampToEdgeWrapping:()=>u,Coloring:()=>s,Cylinder:()=>E.Cylinder,DoubleSide:()=>o,EventDispatcher:()=>EventDispatcher,FloatType:()=>_,Fog:()=>Fog,FrontSide:()=>n,Geometry:()=>Geometry,GeometryGroup:()=>GeometryGroup,GeometryIDCount:()=>M,ImposterMaterial:()=>ImposterMaterial,InstancedMaterial:()=>InstancedMaterial,Light:()=>Light,Line:()=>Line,LineBasicMaterial:()=>LineBasicMaterial,LineStyle:()=>j,LinearFilter:()=>f,LinearMipMapLinearFilter:()=>g,Material:()=>Material,MaterialIdCount:()=>C,Matrix3:()=>h.Matrix3,Matrix4:()=>h.Matrix4,Mesh:()=>Mesh,MeshDoubleLambertMaterial:()=>MeshDoubleLambertMaterial,MeshLambertMaterial:()=>MeshLambertMaterial,MeshOutlineMaterial:()=>MeshOutlineMaterial,NearestFilter:()=>p,Object3D:()=>Object3D,Object3DIDCount:()=>z,Projector:()=>Projector,Quaternion:()=>h.Quaternion,R32Format:()=>w,RFormat:()=>b,RGBAFormat:()=>y,Ray:()=>h.Ray,Raycaster:()=>Raycaster,Renderer:()=>Renderer,Scene:()=>Scene,ShaderLib:()=>pe,ShaderUtils:()=>ge,Shading:()=>l,Sphere:()=>E.Sphere,SphereImposterMaterial:()=>SphereImposterMaterial,SphereImposterOutlineMaterial:()=>SphereImposterOutlineMaterial,Sprite:()=>Sprite,SpriteAlignment:()=>c,SpriteMaterial:()=>SpriteMaterial,SpritePlugin:()=>SpritePlugin,StickImposterMaterial:()=>StickImposterMaterial,StickImposterOutlineMaterial:()=>StickImposterOutlineMaterial,Texture:()=>Texture,TextureIdCount:()=>V,TextureOperations:()=>x,Triangle:()=>E.Triangle,UVMapping:()=>UVMapping,UnsignedByteType:()=>v,Vector2:()=>h.Vector2,Vector3:()=>h.Vector3,VolumetricMaterial:()=>VolumetricMaterial,basic:()=>W,clamp:()=>h.clamp,clone:()=>me,conversionMatrix3:()=>h.conversionMatrix3,degToRad:()=>h.degToRad,instanced:()=>Y,intersectObject:()=>U,lambert:()=>X,lambertdouble:()=>$,outline:()=>J,screen:()=>ee,screenaa:()=>te,sphereimposter:()=>re,sphereimposteroutline:()=>ne,sprite:()=>ae,stickimposter:()=>he,stickimposteroutline:()=>de,volumetric:()=>fe}),function(e){e[e.NoColors=0]="NoColors",e[e.FaceColors=1]="FaceColors",e[e.VertexColors=2]="VertexColors"}(s||(s={}));const n=0,a=1,o=2;var l;!function(e){e[e.NoShading=0]="NoShading",e[e.FlatShading=1]="FlatShading",e[e.SmoothShading=2]="SmoothShading"}(l||(l={}));var h=r(9652);const c={topLeft:new h.Vector2(1,-1),topCenter:new h.Vector2(0,-1),topRight:new h.Vector2(-1,-1),centerLeft:new h.Vector2(1,0),center:new h.Vector2(0,0),centerRight:new h.Vector2(-1,0),bottomLeft:new h.Vector2(1,1),bottomCenter:new h.Vector2(0,1),bottomRight:new h.Vector2(-1,1)},u=1001,f=1006,p=1007,g=1008,v=1009,_=1010,y=1021,b=1022,w=1023;var x;!function(e){e[e.MultiplyOperation=0]="MultiplyOperation",e[e.MixOperation=1]="MixOperation",e[e.AddOperation=2]="AddOperation"}(x||(x={}));class EventDispatcher{constructor(){this.listeners={}}dispatchEvent(e){var t=this.listeners[e.type];if(void 0!==t){e.target=this;for(var r=0,s=t.length;r0?this.lineArray=(null==o?void 0:o.subarray(0,this.lineidx))||null:this.lineArray=new Uint16Array(0)):(this.normalArray=new Float32Array(0),this.faceArray=new Uint16Array(0),this.lineArray=new Uint16Array(0)),l&&(this.radiusArray=l.subarray(0,this.vertices)),t&&(this.normalArray&&(this.normalArray=new Float32Array(this.normalArray)),this.faceArray&&(this.faceArray=new Uint16Array(this.faceArray)),this.lineArray&&(this.lineArray=new Uint16Array(this.lineArray)),this.vertexArray&&(this.vertexArray=new Float32Array(this.vertexArray)),this.colorArray&&(this.colorArray=new Float32Array(this.colorArray)),this.radiusArray&&(this.radiusArray=new Float32Array(this.radiusArray))),this.__inittedArrays=!0}}class Geometry extends EventDispatcher{constructor(e=!1,t=!1,r=!1){super(),this.name="",this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.buffersNeedUpdate=!1,this.imposter=!1,this.instanced=!1,this.geometryGroups=[],this.groups=0,this.id=M++,this.mesh=e,this.radii=t,this.offset=r}updateGeoGroup(e=0){var t,r=this.groups>0?this.geometryGroups[this.groups-1]:null;return(!r||r.vertices+e>((null===(t=null==r?void 0:r.vertexArray)||void 0===t?void 0:t.length)||0)/3)&&(r=this.addGeoGroup()),r}vrml(e,t){for(var r="",s=this.geometryGroups.length,n=0;ne.distance-t.distance,k=new h.Matrix4;class Raycaster{constructor(e,t,r,s){this.precision=1e-4,this.linePrecision=.2,this.ray=new h.Ray(e,t),this.ray.direction.lengthSq()>0&&this.ray.direction.normalize(),this.near=s||0,this.far=r||1/0}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.ortho?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,e.z),t.projectionMatrixInverse.getInverse(t.projectionMatrix),k.multiplyMatrices(t.matrixWorld,t.projectionMatrixInverse),this.ray.direction.applyProjection(k),this.ray.direction.sub(this.ray.origin).normalize())}intersectObjects(e,t){for(var r=[],s=0,n=t.length;sMath.min(Math.max(e,-1),1);var O=new E.Sphere,D=new E.Cylinder,F=new E.Triangle,R=new h.Vector3,P=new h.Vector3,G=new h.Vector3,B=new h.Vector3,N=new h.Vector3;function U(e,t,r,s){if(N.getPositionFromMatrix(e.matrixWorld),void 0===t.intersectionShape)return s;var n,a,o,l,h,c,u,f,p,g,v,_,y,b,w=t.intersectionShape,x=r.linePrecision,A=(x*=e.matrixWorld.getMaxScaleOnAxis())*x;if(void 0!==t.boundingSphere&&t.boundingSphere instanceof E.Sphere&&(O.copy(t.boundingSphere),O.applyMatrix4(e.matrixWorld),!r.ray.isIntersectionSphere(O)))return s;for(n=0,a=w.triangle.length;n=0)continue;if(R.subVectors(F.a,r.ray.origin),(u=o.dot(R)/l)<0)continue;P.copy(r.ray.direction).multiplyScalar(u).add(r.ray.origin),P.sub(F.a),G.copy(F.b).sub(F.a),B.copy(F.c).sub(F.a);var C=G.dot(B),S=G.lengthSq(),M=B.lengthSq();if((_=(S*P.dot(B)-C*P.dot(G))/(S*M-C*C))<0||_>1)continue;if((v=(P.dot(G)-_*C)/S)<0||v>1||v+_>1)continue;s.push({clickable:t,distance:u})}for(n=0,a=w.cylinder.length;nD.lengthSq()||_<0)continue;s.push({clickable:t,distance:u})}}for(n=0,a=w.line.length;n lumaMax))\n color = vec4(rgbA, 1.0);\n else\n color = vec4(rgbB, 1.0);\n return color;\n}\n//DEFINEFRAGCOLOR\nvoid main (void) {\n gl_FragColor = applyFXAA(vTexCoords, colormap);\n}\n ".replace("#define GLSLIFY 1",""),vertexShader:"attribute vec2 vertexPosition;\nvarying highp vec2 vTexCoords;\nconst vec2 scale = vec2(0.5, 0.5);\n\nvoid main() {\n vTexCoords = vertexPosition * scale + scale; // scale vertex attribute to [0,1] range\n gl_Position = vec4(vertexPosition, 0.0, 1.0);\n}\n ".replace("#define GLSLIFY 1",""),uniforms:{}},ie={opacity:{type:"f",value:1},fogColor:{type:"c",value:new A.Color(1,1,1)},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},directionalLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]}},re={vertexShader:"uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 directionalLightColor[ 1 ];\nuniform vec3 directionalLightDirection[ 1 ];\n\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\n\nvarying vec2 mapping;\nvarying vec3 vColor;\nvarying float rval;\nvarying vec3 vLight;\nvarying vec3 center;\n\nvoid main() {\n\n vColor = color;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n center = mvPosition.xyz;\n vec4 projPosition = projectionMatrix * mvPosition;\n vec4 adjust = projectionMatrix* vec4(normal,0.0); adjust.z = 0.0; adjust.w = 0.0;\n vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 );\n vLight = normalize( lDirection.xyz );\n mapping = normal.xy;\n rval = abs(normal.x);\n gl_Position = projPosition+adjust;\n\n}\n".replace("#define GLSLIFY 1",""),fragmentShader:"\nuniform mat4 viewMatrix;\nuniform float opacity;\nuniform mat4 projectionMatrix;\n\nuniform vec3 fogColor;\nuniform float fogNear;\nuniform float fogFar;\nuniform float uDepth;\nuniform vec3 directionalLightColor[ 1 ];\n\nvarying vec3 vColor;\nvarying vec2 mapping;\nvarying float rval;\nvarying vec3 vLight;\nvarying vec3 center;\n\n//DEFINEFRAGCOLOR\n\nvoid main() {\n float lensqr = dot(mapping,mapping);\n float rsqr = rval*rval;\n if(lensqr > rsqr)\n discard;\n float z = sqrt(rsqr-lensqr);\n vec3 cameraPos = center+ vec3(mapping.x,mapping.y,z);\n vec4 clipPos = projectionMatrix * vec4(cameraPos, 1.0);\n float ndcDepth = clipPos.z / clipPos.w;\n gl_FragDepthEXT = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;\n vec3 norm = normalize(vec3(mapping.x,mapping.y,z));\n float dotProduct = dot( norm, vLight );\n vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n vec3 vLight = directionalLightColor[ 0 ] * directionalLightWeighting;\n gl_FragColor = vec4(vLight*vColor, opacity*opacity );\n float fogFactor = smoothstep( fogNear, fogFar, gl_FragDepthEXT/gl_FragCoord.w );\n gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n\n\n}\n\n".replace("#define GLSLIFY 1",""),uniforms:ie},se={opacity:{type:"f",value:1},outlineColor:{type:"c",value:new A.Color(0,0,0)},fogColor:{type:"c",value:new A.Color(1,1,1)},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},outlineWidth:{type:"f",value:.1},outlinePushback:{type:"f",value:1}},ne={fragmentShader:"\n\nuniform float opacity;\nuniform vec3 outlineColor;\nuniform vec3 fogColor;\nuniform float fogNear;\nuniform float fogFar;\nuniform mat4 projectionMatrix;\nvarying vec2 mapping;\nvarying float rval;\nvarying vec3 center;\n\nuniform float outlinePushback;\n\n//DEFINEFRAGCOLOR\n\nvoid main() {\n float lensqr = dot(mapping,mapping);\n float rsqr = rval*rval;\n if(lensqr > rsqr)\n discard;\n float z = sqrt(rsqr-lensqr);\n vec3 cameraPos = center+ vec3(mapping.x,mapping.y,z-outlinePushback);\n vec4 clipPos = projectionMatrix * vec4(cameraPos, 1.0);\n float ndcDepth = clipPos.z / clipPos.w;\n gl_FragDepthEXT = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;\n gl_FragColor = vec4(outlineColor, 1 );\n}\n\n\n".replace("#define GLSLIFY 1",""),vertexShader:"\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float outlineWidth;\nuniform float outlinePushback;\n\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\n\nvarying vec2 mapping;\nvarying float rval;\nvarying vec3 center;\n\nvoid main() {\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n center = mvPosition.xyz;\n vec4 projPosition = projectionMatrix * mvPosition;\n vec2 norm = normal.xy + vec2(sign(normal.x)*outlineWidth,sign(normal.y)*outlineWidth);\n vec4 adjust = projectionMatrix* vec4(norm,normal.z,0.0); adjust.z = 0.0; adjust.w = 0.0;\n mapping = norm.xy;\n rval = abs(norm.x);\n gl_Position = projPosition+adjust;\n}\n\n".replace("#define GLSLIFY 1",""),uniforms:se},ae={fragmentShader:"\n\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\n\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\n\nvarying vec2 vUV;\n//DEFINEFRAGCOLOR\n\nvoid main() {\n\n vec4 texture = texture2D(map, vUV);\n\n if (texture.a < alphaTest) discard;\n\n gl_FragColor = vec4(color * texture.xyz, texture.a * opacity);\n\n if (fogType > 0) {\n\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n float fogFactor = 0.0;\n\n if (fogType == 1) {\n fogFactor = smoothstep(fogNear, fogFar, depth);\n }\n\n else {\n const float LOG2 = 1.442695;\n float fogFactor = exp2(- fogDensity * fogDensity * depth * depth * LOG2);\n fogFactor = 1.0 - clamp(fogFactor, 0.0, 1.0);\n }\n\n gl_FragColor = mix(gl_FragColor, vec4(fogColor, gl_FragColor.w), fogFactor);\n\n }\n}\n\n".replace("#define GLSLIFY 1",""),vertexShader:"\n\nuniform int useScreenCoordinates;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\n\nattribute vec2 position;\nattribute vec2 uv;\n\nvarying vec2 vUV;\n\nvoid main() {\n\n vUV = uvOffset + uv * uvScale;\n\n vec2 alignedPosition = position + alignment;\n\n vec2 rotatedPosition;\n rotatedPosition.x = ( cos(rotation) * alignedPosition.x - sin(rotation) * alignedPosition.y ) * scale.x;\n rotatedPosition.y = ( sin(rotation) * alignedPosition.x + cos(rotation) * alignedPosition.y ) * scale.y;\n\n vec4 finalPosition;\n\n if(useScreenCoordinates != 0) {\n finalPosition = vec4(screenPosition.xy + rotatedPosition, screenPosition.z, 1.0);\n }\n\n else {\n finalPosition = projectionMatrix * modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0); finalPosition /= finalPosition.w;\n finalPosition.xy += rotatedPosition; \n }\n\n gl_Position = finalPosition;\n\n}\n\n".replace("#define GLSLIFY 1",""),uniforms:{}},oe={opacity:{type:"f",value:1},fogColor:{type:"c",value:new A.Color(1,1,1)},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},directionalLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]}},le="uniform float opacity;\nuniform mat4 projectionMatrix;\n\nuniform vec3 fogColor;\nuniform float fogNear;\nuniform float fogFar;\n\nvarying vec3 vLight;\nvarying vec3 vColor;\nvarying vec3 cposition;\nvarying vec3 p1;\nvarying vec3 p2;\nvarying float r;\n\n//DEFINEFRAGCOLOR\n\n//cylinder-ray intersection testing taken from http://mrl.nyu.edu/~dzorin/cg05/lecture12.pdf\n//also useful: http://stackoverflow.com/questions/9595300/cylinder-impostor-in-glsl\n//with a bit more care (caps) this could be a general cylinder imposter (see also outline)\nvoid main() {\n vec3 color = abs(vColor);\n vec3 pos = cposition;\n vec3 p = pos; //ray point\n vec3 v = vec3(0.0,0.0,-1.0); //ray normal - orthographic\n if(projectionMatrix[3][3] == 0.0) v = normalize(pos); //ray normal - perspective\n vec3 pa = p1; //cyl start\n vec3 va = normalize(p2-p1); //cyl norm\n vec3 tmp1 = v-(dot(v,va)*va);\n vec3 deltap = p-pa;\n float A = dot(tmp1,tmp1);\n if(A == 0.0) discard;\n vec3 tmp2 = deltap-(dot(deltap,va)*va);\n float B = 2.0*dot(tmp1, tmp2);\n float C = dot(tmp2,tmp2)-r*r;\n//quadratic equation!\n float det = (B*B) - (4.0*A*C);\n if(det < 0.0) discard;\n float sqrtDet = sqrt(det);\n float posT = (-B+sqrtDet)/(2.0*A);\n float negT = (-B-sqrtDet)/(2.0*A);\n float intersectionT = min(posT,negT);\n vec3 qi = p+v*intersectionT;\n float dotp1 = dot(va,qi-p1);\n float dotp2 = dot(va,qi-p2);\n vec3 norm;\n if( dotp1 < 0.0 || dotp2 > 0.0) { //(p-c)^2 + 2(p-c)vt +v^2+t^2 - r^2 = 0\n vec3 cp;\n if( dotp1 < 0.0) { \n// if(vColor.x < 0.0 ) discard; //color sign bit indicates if we should cap or not\n cp = p1;\n } else {\n// if(vColor.y < 0.0 ) discard;\n cp = p2;\n }\n vec3 diff = p-cp;\n A = dot(v,v);\n B = dot(diff,v)*2.0;\n C = dot(diff,diff)-r*r;\n det = (B*B) - (4.0*C);\n if(det < 0.0) discard;\n sqrtDet = sqrt(det);\n posT = (-B+sqrtDet)/(2.0);\n negT = (-B-sqrtDet)/(2.0);\n float t = min(posT,negT);\n qi = p+v*t; \n norm = normalize(qi-cp); \n } else {\n norm = normalize(qi-(dotp1*va + p1));\n }\n vec4 clipPos = projectionMatrix * vec4(qi, 1.0);\n float ndcDepth = clipPos.z / clipPos.w;\n float depth = ((gl_DepthRange.diff * ndcDepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;\n gl_FragDepthEXT = depth;",he={fragmentShader:[le," float dotProduct = dot( norm, vLight );\n vec3 light = vec3( max( dotProduct, 0.0 ) );\n gl_FragColor = vec4(light*color, opacity*opacity );\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}"].join("\n").replace("#define GLSLIFY 1",""),vertexShader:"\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 directionalLightColor[ 1 ];\nuniform vec3 directionalLightDirection[ 1 ];\n\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute float radius;\n\nvarying vec3 vColor;\nvarying vec3 vLight;\nvarying vec3 cposition;\nvarying vec3 p1;\nvarying vec3 p2;\nvarying float r;\n\nvoid main() {\n\n vColor = color; vColor.z = abs(vColor.z); //z indicates which vertex and so would vary\n r = abs(radius);\n vec4 to = modelViewMatrix*vec4(normal, 1.0); //normal is other point of cylinder\n vec4 pt = modelViewMatrix*vec4(position, 1.0);\n vec4 mvPosition = pt;\n p1 = pt.xyz; p2 = to.xyz;\n vec3 norm = to.xyz-pt.xyz;\n float mult = 1.1; //slop to account for perspective of sphere\n if(length(p1) > length(p2)) { //billboard at level of closest point\n mvPosition = to;\n }\n vec3 n = normalize(mvPosition.xyz);\n//intersect with the plane defined by the camera looking at the billboard point\n if(color.z >= 0.0) { //p1\n if(projectionMatrix[3][3] == 0.0) { //perspective\n vec3 pnorm = normalize(p1);\n float t = dot(mvPosition.xyz-p1,n)/dot(pnorm,n);\n mvPosition.xyz = p1+t*pnorm; \n } else { //orthographic\n mvPosition.xyz = p1;\n }\n } else {\n if(projectionMatrix[3][3] == 0.0) { //perspective\n vec3 pnorm = normalize(p2);\n float t = dot(mvPosition.xyz-p2,n)/dot(pnorm,n);\n mvPosition.xyz = p2+t*pnorm;\n } else { //orthographic\n mvPosition.xyz = p2;\n } \n mult *= -1.0;\n }\n vec3 cr = normalize(cross(mvPosition.xyz,norm))*radius;\n vec3 doublecr = normalize(cross(mvPosition.xyz,cr))*radius;\n mvPosition.xyz += mult*(cr + doublecr).xyz;\n cposition = mvPosition.xyz;\n gl_Position = projectionMatrix * mvPosition;\n vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ 0 ], 0.0 );\n vLight = normalize( lDirection.xyz )*directionalLightColor[0]; //not really sure this is right, but color is always white so..\n}\n\n".replace("#define GLSLIFY 1",""),uniforms:oe},ce={opacity:{type:"f",value:1},fogColor:{type:"c",value:new A.Color(1,1,1)},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},outlineColor:{type:"c",value:new A.Color(0,0,0)},outlineWidth:{type:"f",value:.1},outlinePushback:{type:"f",value:1}},de={fragmentShader:(le+"gl_FragColor = vec4(color,1.0);}").replace("#define GLSLIFY 1",""),vertexShader:"\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 directionalLightColor[ 1 ];\nuniform vec3 directionalLightDirection[ 1 ];\nuniform vec3 outlineColor;\nuniform float outlineWidth;\nuniform float outlinePushback;\n\n\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute float radius;\n\nvarying vec3 vColor;\nvarying vec3 vLight;\nvarying vec3 cposition;\nvarying vec3 p1;\nvarying vec3 p2;\nvarying float r;\n\nvoid main() {\n\n vColor = outlineColor;\n float rad = radius+sign(radius)*outlineWidth;\n r = abs(rad);\n vec4 to = modelViewMatrix*vec4(normal, 1.0); //normal is other point of cylinder\n vec4 pt = modelViewMatrix*vec4(position, 1.0);\n//pushback\n to.xyz += normalize(to.xyz)*outlinePushback;\n pt.xyz += normalize(pt.xyz)*outlinePushback;\n\n vec4 mvPosition = pt;\n p1 = pt.xyz; p2 = to.xyz;\n vec3 norm = to.xyz-pt.xyz;\n float mult = 1.1; //slop to account for perspective of sphere\n if(length(p1) > length(p2)) { //billboard at level of closest point\n mvPosition = to;\n }\n vec3 n = normalize(mvPosition.xyz);\n//intersect with the plane defined by the camera looking at the billboard point\n if(color.z >= 0.0) { //p1\n vec3 pnorm = normalize(p1);\n float t = dot(mvPosition.xyz-p1,n)/dot(pnorm,n);\n mvPosition.xyz = p1+t*pnorm;\n } else {\n vec3 pnorm = normalize(p2);\n float t = dot(mvPosition.xyz-p2,n)/dot(pnorm,n);\n mvPosition.xyz = p2+t*pnorm;\n mult *= -1.0;\n }\n vec3 cr = normalize(cross(mvPosition.xyz,norm))*rad;\n vec3 doublecr = normalize(cross(mvPosition.xyz,cr))*rad;\n mvPosition.xy += mult*(cr + doublecr).xy;\n cposition = mvPosition.xyz;\n gl_Position = projectionMatrix * mvPosition;\n vLight = vec3(1.0,1.0,1.0);\n}\n\n".replace("#define GLSLIFY 1",""),uniforms:ce},ue={opacity:{type:"f",value:1},fogColor:{type:"c",value:new A.Color(1,1,1)},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},data:{type:"i",value:3},colormap:{type:"i",value:4},depthmap:{type:"i",value:5},step:{type:"f",value:1},maxdepth:{type:"f",value:100},subsamples:{type:"f",value:5},textmat:{type:"mat4",value:[]},projinv:{type:"mat4",value:[]},transfermin:{type:"f",value:-.2},transfermax:{type:"f",value:.2}},fe={fragmentShader:"\nuniform highp sampler3D data;\nuniform highp sampler2D colormap;\nuniform highp sampler2D depthmap;\n\n\nuniform mat4 textmat;\nuniform mat4 projinv;\nuniform mat4 projectionMatrix;\n\nuniform float step;\nuniform float subsamples;\nuniform float maxdepth;\nuniform float transfermin;\nuniform float transfermax;\nin vec4 mvPosition;\nout vec4 color;\nvoid main(void) {\n\n vec4 pos = mvPosition;\n bool seengood = false;\n float i = 0.0;\n color = vec4(1,1,1,0);\n float increment = 1.0/subsamples;\n float maxsteps = (maxdepth*subsamples/step);\n//there's probably a better way to do this..\n//calculate farthest possible point in model coordinates\n vec4 maxpos = vec4(pos.x,pos.y,pos.z-maxdepth,1.0);\n// convert to projection\n maxpos = projectionMatrix*maxpos;\n vec4 startp = projectionMatrix*pos;\n// homogonize\n maxpos /= maxpos.w;\n startp /= startp.w;\n//take x,y from start and z from max\n maxpos = vec4(startp.x,startp.y,maxpos.z,1.0);\n//convert back to model space\n maxpos = projinv*maxpos;\n maxpos /= maxpos.w;\n float incr = step/subsamples;\n//get depth from depthmap\n//startp is apparently [-1,1]\n vec2 tpos = startp.xy/2.0+0.5;\n float depth = texture(depthmap, tpos).r;\n//compute vector between start and end\n vec4 direction = maxpos-pos;\n for( i = 0.0; i <= maxsteps; i++) {\n vec4 pt = (pos+(i/maxsteps)*direction);\n vec4 ppt = projectionMatrix*pt;\n float ptdepth = ppt.z/ppt.w;\n ptdepth = ((gl_DepthRange.diff * ptdepth) + gl_DepthRange.near + gl_DepthRange.far) / 2.0;\n if(ptdepth > depth) break;\n pt = textmat*pt;\n// pt /= pt.w;\n if(pt.x >= -0.01 && pt.y >= -0.01 && pt.z >= -0.01 && pt.x <= 1.01 && pt.y <= 1.01 && pt.z <= 1.01) {\n seengood = true;\n } else if(seengood) {\n break;\n }\n if( pt.x < -0.01 || pt.x > 1.01 || pt.y < -0.01 || pt.y > 1.01 || pt.z < -0.01 || pt.z > 1.01 ){\n color.a = 0.0;\n continue;\n }\n else {\n float val = texture(data, pt.zyx).r;\n if(isinf(val)) continue; //masked out\n float cval = (val-transfermin)/(transfermax-transfermin); //scale to texture 0-1 range\n vec4 val_color = texture(colormap, vec2(cval,0.5));\n color.rgb = color.rgb*color.a + (1.0-color.a)*val_color.a*val_color.rgb;\n color.a += (1.0 - color.a) * val_color.a; \n if(color.a > 0.0) color.rgb /= color.a;\n// color = vec4(pt.x, pt.y, pt.z, 1.0);\n }\n// color = vec4(pt.x, pt.y, pt.z, 0.0)\n }\n}\n\n ".replace("#define GLSLIFY 1",""),vertexShader:"uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\n\nin vec3 position;\nout vec4 mvPosition;\nvoid main() {\n\n mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix*mvPosition;\n}\n".replace("#define GLSLIFY 1",""),uniforms:ue},pe={basic:W,instanced:Y,lambert:X,lambertdouble:$,outline:J,screen:ee,screenaa:te,sphereimposter:re,sphereimposteroutline:ne,sprite:ae,stickimposter:he,stickimposteroutline:de,volumetric:fe};function me(e){let t={};for(const s in e){t[s]={},t[s].type=e[s].type;var r=e[s].value;r instanceof A.Color?t[s].value=r.clone():"number"==typeof r?t[s].value=r:r instanceof Array?t[s].value=[]:console.error("Error copying shader uniforms from ShaderLib: unknown type for uniform")}return t}const ge={clone:me,stickimposterFragmentShader:le};class Camera extends Object3D{constructor(e=50,t=1,r=.1,s=2e3,n=!1){super(),this.projectionMatrix=new h.Matrix4,this.projectionMatrixInverse=new h.Matrix4,this.matrixWorldInverse=new h.Matrix4,this.fov=e,this.aspect=t,this.near=r,this.far=s;var a=this.position.z;this.right=a*Math.tan(Math.PI/180*e),this.left=-this.right,this.top=this.right/this.aspect,this.bottom=-this.top,this.ortho=!!n,this.updateProjectionMatrix()}lookAt(e){this.matrix.lookAt(this.position,e,this.up),this.rotationAutoUpdate&&(!1===this.useQuaternion&&this.rotation instanceof h.Vector3?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):console.error("Unimplemented math operation."))}updateProjectionMatrix(){this.ortho?this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far):this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)}}class Fog{constructor(e,t=1,r=1e3){this.name="",this.color=new A.Color(e),this.near=t,this.far=r}clone(){return new Fog(this.color.getHex(),this.near,this.far)}}class SpritePlugin{constructor(){this.sprite={vertices:null,faces:null,vertexBuffer:null,elementBuffer:null,program:null,attributes:{},uniforms:null}}init(e){this.gl=e.context,this.renderer=e,this.precision=e.getPrecision(),this.sprite.vertices=new Float32Array(16),this.sprite.faces=new Uint16Array(6);var t=0;this.sprite.vertices[t++]=-1,this.sprite.vertices[t++]=-1,this.sprite.vertices[t++]=0,this.sprite.vertices[t++]=0,this.sprite.vertices[t++]=1,this.sprite.vertices[t++]=-1,this.sprite.vertices[t++]=1,this.sprite.vertices[t++]=0,this.sprite.vertices[t++]=1,this.sprite.vertices[t++]=1,this.sprite.vertices[t++]=1,this.sprite.vertices[t++]=1,this.sprite.vertices[t++]=-1,this.sprite.vertices[t++]=1,this.sprite.vertices[t++]=0,this.sprite.vertices[t++]=1,t=0,this.sprite.faces[t++]=0,this.sprite.faces[t++]=1,this.sprite.faces[t++]=2,this.sprite.faces[t++]=0,this.sprite.faces[t++]=2,this.sprite.faces[t++]=3,this.sprite.vertexBuffer=this.gl.createBuffer(),this.sprite.elementBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.sprite.vertexBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.sprite.vertices,this.gl.STATIC_DRAW),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.sprite.elementBuffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.sprite.faces,this.gl.STATIC_DRAW),this.sprite.program=this.createProgram(pe.sprite,this.precision||1),this.sprite.attributes={};const r={};this.sprite.attributes.position=this.gl.getAttribLocation(this.sprite.program,"position"),this.sprite.attributes.uv=this.gl.getAttribLocation(this.sprite.program,"uv"),r.uvOffset=this.gl.getUniformLocation(this.sprite.program,"uvOffset"),r.uvScale=this.gl.getUniformLocation(this.sprite.program,"uvScale"),r.rotation=this.gl.getUniformLocation(this.sprite.program,"rotation"),r.scale=this.gl.getUniformLocation(this.sprite.program,"scale"),r.alignment=this.gl.getUniformLocation(this.sprite.program,"alignment"),r.color=this.gl.getUniformLocation(this.sprite.program,"color"),r.map=this.gl.getUniformLocation(this.sprite.program,"map"),r.opacity=this.gl.getUniformLocation(this.sprite.program,"opacity"),r.useScreenCoordinates=this.gl.getUniformLocation(this.sprite.program,"useScreenCoordinates"),r.screenPosition=this.gl.getUniformLocation(this.sprite.program,"screenPosition"),r.modelViewMatrix=this.gl.getUniformLocation(this.sprite.program,"modelViewMatrix"),r.projectionMatrix=this.gl.getUniformLocation(this.sprite.program,"projectionMatrix"),r.fogType=this.gl.getUniformLocation(this.sprite.program,"fogType"),r.fogDensity=this.gl.getUniformLocation(this.sprite.program,"fogDensity"),r.fogNear=this.gl.getUniformLocation(this.sprite.program,"fogNear"),r.fogFar=this.gl.getUniformLocation(this.sprite.program,"fogFar"),r.fogColor=this.gl.getUniformLocation(this.sprite.program,"fogColor"),r.alphaTest=this.gl.getUniformLocation(this.sprite.program,"alphaTest"),this.sprite.uniforms=r}render(e,t,r,s,n){var a,o,l,h,c,u,f,p,g,v;if(!this.gl)throw new Error("WebGLRenderer not initialized");let _=[];null===(a=null==e?void 0:e.__webglSprites)||void 0===a||a.forEach((e=>{(n&&0==e.material.depthTest||!n&&e.material.depthTest)&&_.push(e)}));let y=_.length;if(!y)return;const b=this.sprite.attributes,w=this.sprite.uniforms;if(!w)throw new Error("Uniforms not defined");var x=.5*r,A=.5*s;this.gl.useProgram(this.sprite.program),this.gl.enableVertexAttribArray(b.position),this.gl.enableVertexAttribArray(b.uv),this.gl.disable(this.gl.CULL_FACE),this.gl.enable(this.gl.BLEND),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.sprite.vertexBuffer),this.gl.vertexAttribPointer(b.position,2,this.gl.FLOAT,!1,16,0),this.gl.vertexAttribPointer(b.uv,2,this.gl.FLOAT,!1,16,8),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.sprite.elementBuffer),this.gl.uniformMatrix4fv(w.projectionMatrix,!1,t.projectionMatrix.elements),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.uniform1i(w.map,0);var C,S=0,M=0,z=e.fog;let L,E,T,k;z?(this.gl.uniform3f(w.fogColor,z.color.r,z.color.g,z.color.b),this.gl.uniform1f(w.fogNear,z.near),this.gl.uniform1f(w.fogFar,z.far),this.gl.uniform1i(w.fogType,1),S=1,M=1):(this.gl.uniform1i(w.fogType,0),S=0,M=0);let I=[];for(C=0;C=0&&(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,n.__webglVertexBuffer),this.enableAttribute(l.position),this._gl.vertexAttribPointer(l.position,3,this._gl.FLOAT,!1,0,0)),l.color>=0&&(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,n.__webglColorBuffer),this.enableAttribute(l.color),this._gl.vertexAttribPointer(l.color,3,this._gl.FLOAT,!1,0,0)),l.normal>=0&&(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,n.__webglNormalBuffer),this.enableAttribute(l.normal),this._gl.vertexAttribPointer(l.normal,3,this._gl.FLOAT,!1,0,0)),l.offset>=0&&(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,n.__webglOffsetBuffer),this.enableAttribute(l.offset),this._gl.vertexAttribPointer(l.offset,3,this._gl.FLOAT,!1,0,0)),l.radius>=0&&(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,n.__webglRadiusBuffer),this.enableAttribute(l.radius),this._gl.vertexAttribPointer(l.radius,1,this._gl.FLOAT,!1,0,0))),a instanceof Mesh){if("instanced"===s.shaderID){var g=s.sphere.geometryGroups[0];u&&(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,n.__webglVertexBuffer),this._gl.bufferData(this._gl.ARRAY_BUFFER,g.vertexArray,this._gl.STATIC_DRAW),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,n.__webglNormalBuffer),this._gl.bufferData(this._gl.ARRAY_BUFFER,g.normalArray,this._gl.STATIC_DRAW),this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,g.faceArray,this._gl.STATIC_DRAW)),h=g.faceidx,this._extInstanced.vertexAttribDivisorANGLE(l.offset,1),this._extInstanced.vertexAttribDivisorANGLE(l.radius,1),this._extInstanced.vertexAttribDivisorANGLE(l.color,1),this._extInstanced.drawElementsInstancedANGLE(this._gl.TRIANGLES,h,this._gl.UNSIGNED_SHORT,0,n.radiusArray.length),this._extInstanced.vertexAttribDivisorANGLE(l.offset,0),this._extInstanced.vertexAttribDivisorANGLE(l.radius,0),this._extInstanced.vertexAttribDivisorANGLE(l.color,0)}else s.wireframe?(c=n.lineidx,this.setLineWidth(s.wireframeLinewidth),u&&this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),this._gl.drawElements(this._gl.LINES,c,this._gl.UNSIGNED_SHORT,0)):(h=n.faceidx,u&&this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),this._gl.drawElements(this._gl.TRIANGLES,h,this._gl.UNSIGNED_SHORT,0));this.info.render.calls++,this.info.render.vertices+=h,this.info.render.faces+=h/3}else a instanceof Line&&(c=n.vertices,this.setLineWidth(s.linewidth),this._gl.drawArrays(this._gl.LINES,0,c),this.info.render.calls++)}}render(e,t,r){if(t instanceof Camera!=!1){if(!this.isLost()){var s,n,a,o,l,h=e.__lights,c=e.fog;this._currentMaterialId=-1,this._lightsNeedUpdate=!0,this.autoUpdateScene&&e.updateMatrixWorld(),void 0===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),this._projScreenMatrix.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this.autoUpdateObjects&&this.initWebGLObjects(e),this.info.render.calls=0,this.info.render.vertices=0,this.info.render.faces=0,this.info.render.points=0,this._currentWidth=this._viewportWidth,this._currentHeight=this._viewportHeight,this.setViewport(),this.setFrameBuffer(),(this.autoClear||r)&&(this._gl.clearColor(this._clearColor.r,this._clearColor.g,this._clearColor.b,this._clearAlpha),this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil));var u=!1;for(s=0,n=(l=e.__webglObjects).length;s=0;--r)e[r].object===t&&e.splice(r,1)}removeInstancesDirect(e,t){for(var r=e.length-1;r>=0;--r)e[r]===t&&e.splice(r,1)}unrollBufferMaterial(e){var t=e.object.material;if(t.volumetric)e.opaque=null,e.transparent=null,e.volumetric=t;else if(t.transparent){if(e.opaque=null,e.volumetric=null,e.transparent=t,!t.wireframe){var r=t.clone();r.opacity=0,e.blank=r}}else e.opaque=t,e.transparent=null,e.volumetric=null}setBuffers(e,t){var r=e.vertexArray,s=e.colorArray;if(void 0!==e.__webglOffsetBuffer?(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,e.__webglOffsetBuffer),this._gl.bufferData(this._gl.ARRAY_BUFFER,r,t)):(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,e.__webglVertexBuffer),this._gl.bufferData(this._gl.ARRAY_BUFFER,r,t)),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,e.__webglColorBuffer),this._gl.bufferData(this._gl.ARRAY_BUFFER,s,t),e.normalArray&&void 0!==e.__webglNormalBuffer){var n=e.normalArray;this._gl.bindBuffer(this._gl.ARRAY_BUFFER,e.__webglNormalBuffer),this._gl.bufferData(this._gl.ARRAY_BUFFER,n,t)}if(e.radiusArray&&void 0!==e.__webglRadiusBuffer&&(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,e.__webglRadiusBuffer),this._gl.bufferData(this._gl.ARRAY_BUFFER,e.radiusArray,t)),e.faceArray&&void 0!==e.__webglFaceBuffer){var a=e.faceArray;this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,a,t)}if(e.lineArray&&void 0!==e.__webglLineBuffer){var o=e.lineArray;this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,o,t)}}createMeshBuffers(e){e.radiusArray&&(e.__webglRadiusBuffer=this._gl.createBuffer()),e.useOffset&&(e.__webglOffsetBuffer=this._gl.createBuffer()),e.__webglVertexBuffer=this._gl.createBuffer(),e.__webglNormalBuffer=this._gl.createBuffer(),e.__webglColorBuffer=this._gl.createBuffer(),e.__webglFaceBuffer=this._gl.createBuffer(),e.__webglLineBuffer=this._gl.createBuffer(),this.info.memory.geometries++}createLineBuffers(e){e.__webglVertexBuffer=this._gl.createBuffer(),e.__webglColorBuffer=this._gl.createBuffer(),this.info.memory.geometries++}addBuffer(e,t,r){e.push({buffer:t,object:r,opaque:null,transparent:null})}setupMatrices(e,t){e._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld),e._normalMatrix.getInverse(e._modelViewMatrix),e._normalMatrix.transpose()}filterFallback(e){return this._gl.LINEAR}setTextureParameters(e,t){e==this._gl.TEXTURE_2D?(this._gl.texParameteri(e,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(e,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(e,this._gl.TEXTURE_MAG_FILTER,this.filterFallback(t.magFilter)),this._gl.texParameteri(e,this._gl.TEXTURE_MIN_FILTER,this.filterFallback(t.minFilter))):(this._gl.texParameteri(e,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(e,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(e,this._gl.TEXTURE_WRAP_R,this._gl.CLAMP_TO_EDGE),this._extColorBufferFloat&&this._extFloatLinear?(this._gl.texParameteri(e,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR),this._gl.texParameteri(e,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR)):(this._gl.texParameteri(e,this._gl.TEXTURE_MAG_FILTER,this._gl.NEAREST),this._gl.texParameteri(e,this._gl.TEXTURE_MIN_FILTER,this._gl.NEAREST)))}paramToGL(e){return e===v?this._gl.UNSIGNED_BYTE:e===y?this._gl.RGBA:e===p?this._gl.NEAREST:0}setupLights(e,t){var r,s,n,a,o,l=this._lights,h=l.directional.colors,c=l.directional.positions,u=0,f=0;for(r=0,s=t.length;r{"use strict";r.r(t),r.d(t,{Matrix3:()=>Matrix3,Matrix4:()=>Matrix4,Quaternion:()=>Quaternion,Ray:()=>Ray,Vector2:()=>Vector2,Vector3:()=>Vector3,clamp:()=>s,conversionMatrix3:()=>f,degToRad:()=>a});class Quaternion{constructor(e,t,r,s){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==s?s:1}set(e,t,r,s){return this.x=e,this.y=t,this.z=r,this.w=s,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}conjugate(){return this.x*=-1,this.y*=-1,this.z*=-1,this}inverse(){return this.conjugate().normalize()}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthxyz(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){let e=this.length();return 0===e?(this.x=0,this.y=0,this.z=0,this.w=1):(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}multiply(e){return this.multiplyQuaternions(this,e)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}multiplyQuaternions(e,t){const r=e.x,s=e.y,n=e.z,a=e.w,o=t.x,l=t.y,h=t.z,c=t.w;return this.x=r*c+a*o+s*h-n*l,this.y=s*c+a*l+n*o-r*h,this.z=n*c+a*h+r*l-s*o,this.w=a*c-r*o-s*l-n*h,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}clone(){return new Quaternion(this.x,this.y,this.z,this.w)}setFromEuler(e){const t=Math.cos(e.x/2),r=Math.cos(e.y/2),s=Math.cos(e.z/2),n=Math.sin(e.x/2),a=Math.sin(e.y/2),o=Math.sin(e.z/2);return this.x=n*r*s+t*a*o,this.y=t*a*s-n*r*o,this.z=t*r*o+n*a*s,this.w=t*r*s-n*a*o,this}}class Vector2{constructor(e,t){this.x=e||0,this.y=t||0}set(e,t){return this.x=e,this.y=t,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new Vector2(this.x,this.y)}}function s(e,t,r){return Math.min(Math.max(e,t),r)}const n=Math.PI/180;function a(e){return e*n}var o,l,h,c,u;class Matrix4{constructor(e=1,t=0,r=0,s=0,n=0,a=1,o=0,l=0,h=0,c=0,u=1,f=0,p=0,g=0,v=0,_=1){void 0!==e&&"number"!=typeof e?this.elements=new Float32Array(e):(this.elements=new Float32Array(16),this.elements[0]=e,this.elements[4]=t,this.elements[8]=r,this.elements[12]=s,this.elements[1]=n,this.elements[5]=a,this.elements[9]=o,this.elements[13]=l,this.elements[2]=h,this.elements[6]=c,this.elements[10]=u,this.elements[14]=f,this.elements[3]=p,this.elements[7]=g,this.elements[11]=v,this.elements[15]=_)}makeScale(e,t,r){throw new Error("Method not implemented.")}set(e,t,r,s,n,a,o,l,h,c,u,f,p,g,v,_){const y=this.elements;return y[0]=e,y[4]=t,y[8]=r,y[12]=s,y[1]=n,y[5]=a,y[9]=o,y[13]=l,y[2]=h,y[6]=c,y[10]=u,y[14]=f,y[3]=p,y[7]=g,y[11]=v,y[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}copy(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]),this}matrix3FromTopLeft(){const e=this.elements;return new Matrix3(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10])}setRotationFromEuler(e,t){const r=this.elements,{x:s,y:n,z:a}=e,o=Math.cos(s),l=Math.sin(s),h=Math.cos(n),c=Math.sin(n),u=Math.cos(a),f=Math.sin(a);if(void 0===t||"XYZ"===t){const e=o*u,t=o*f,s=l*u,n=l*f;r[0]=h*u,r[4]=-h*f,r[8]=c,r[1]=t+s*c,r[5]=e-n*c,r[9]=-l*h,r[2]=n-e*c,r[6]=s+t*c,r[10]=o*h}else console.error(`Error with matrix4 setRotationFromEuler. Order: ${t}`);return this}setRotationFromQuaternion(e){const t=this.elements,{x:r,y:s,z:n,w:a}=e,o=r+r,l=s+s,h=n+n,c=r*o,u=r*l,f=r*h,p=s*l,g=s*h,v=n*h,_=a*o,y=a*l,b=a*h;return t[0]=1-(p+v),t[4]=u-b,t[8]=f+y,t[1]=u+b,t[5]=1-(c+v),t[9]=g-_,t[2]=f-y,t[6]=g+_,t[10]=1-(c+p),this}multiplyMatrices(e,t){const r=e.elements,s=t.elements,n=this.elements,a=r[0],o=r[4],l=r[8],h=r[12],c=r[1],u=r[5],f=r[9],p=r[13],g=r[2],v=r[6],_=r[10],y=r[14],b=r[3],w=r[7],x=r[11],A=r[15],C=s[0],S=s[4],M=s[8],z=s[12],L=s[1],E=s[5],T=s[9],k=s[13],I=s[2],O=s[6],D=s[10],F=s[14],R=s[3],P=s[7],G=s[11],B=s[15];return n[0]=a*C+o*L+l*I+h*R,n[4]=a*S+o*E+l*O+h*P,n[8]=a*M+o*T+l*D+h*G,n[12]=a*z+o*k+l*F+h*B,n[1]=c*C+u*L+f*I+p*R,n[5]=c*S+u*E+f*O+p*P,n[9]=c*M+u*T+f*D+p*G,n[13]=c*z+u*k+f*F+p*B,n[2]=g*C+v*L+_*I+y*R,n[6]=g*S+v*E+_*O+y*P,n[10]=g*M+v*T+_*D+y*G,n[14]=g*z+v*k+_*F+y*B,n[3]=b*C+w*L+x*I+A*R,n[7]=b*S+w*E+x*O+A*P,n[11]=b*M+w*T+x*D+A*G,n[15]=b*z+w*k+x*F+A*B,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}snap(e){e||(e=4);const t=Math.pow(10,4),r=this.elements;for(let e=0;e<16;e++){const s=Math.round(r[e]);s===Math.round(r[e]*t)/t&&(r[e]=s)}return this}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e){const t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this}translate(e){const t=this.elements;return t[12]+=e.x,t[13]+=e.y,t[14]+=e.z,this}getInverse(e,t){const r=this.elements,s=e.elements,n=s[0],a=s[4],o=s[8],l=s[12],h=s[1],c=s[5],u=s[9],f=s[13],p=s[2],g=s[6],v=s[10],_=s[14],y=s[3],b=s[7],w=s[11],x=s[15];r[0]=u*_*b-f*v*b+f*g*w-c*_*w-u*g*x+c*v*x,r[4]=l*v*b-o*_*b-l*g*w+a*_*w+o*g*x-a*v*x,r[8]=o*f*b-l*u*b+l*c*w-a*f*w-o*c*x+a*u*x,r[12]=l*u*g-o*f*g-l*c*v+a*f*v+o*c*_-a*u*_,r[1]=f*v*y-u*_*y-f*p*w+h*_*w+u*p*x-h*v*x,r[5]=o*_*y-l*v*y+l*p*w-n*_*w-o*p*x+n*v*x,r[9]=l*u*y-o*f*y-l*h*w+n*f*w+o*h*x-n*u*x,r[13]=o*f*p-l*u*p+l*h*v-n*f*v-o*h*_+n*u*_,r[2]=c*_*y-f*g*y+f*p*b-h*_*b-c*p*x+h*g*x,r[6]=l*g*y-a*_*y-l*p*b+n*_*b+a*p*x-n*g*x,r[10]=a*f*y-l*c*y+l*h*b-n*f*b-a*h*x+n*c*x,r[14]=l*c*p-a*f*p-l*h*g+n*f*g+a*h*_-n*c*_,r[3]=u*g*y-c*v*y-u*p*b+h*v*b+c*p*w-h*g*w,r[7]=a*v*y-o*g*y+o*p*b-n*v*b-a*p*w+n*g*w,r[11]=o*c*y-a*u*y-o*h*b+n*u*b+a*h*w-n*c*w,r[15]=a*u*p-o*c*p+o*h*g-n*u*g-a*h*v+n*c*v;const A=n*r[0]+h*r[4]+p*r[8]+y*r[12];if(0===A){const e="Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(e);return console.warn(e),this.identity(),this}return this.multiplyScalar(1/A),this}isReflected(){const e=this.elements,t=e[0],r=e[4],s=e[8],n=e[1],a=e[5],o=e[9],l=e[2],h=e[6],c=e[10];return t*a*c+n*h*s+l*r*o-l*a*s-n*r*c-t*h*o<0}scale(e){const t=this.elements,{x:r}=e,{y:s}=e,{z:n}=e;return t[0]*=r,t[4]*=s,t[8]*=n,t[1]*=r,t[5]*=s,t[9]*=n,t[2]*=r,t[6]*=s,t[10]*=n,t[3]*=r,t[7]*=s,t[11]*=n,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(r,s)))}makeFrustum(e,t,r,s,n,a){const o=this.elements,l=2*n/(t-e),h=2*n/(s-r),c=(t+e)/(t-e),u=(s+r)/(s-r),f=-(a+n)/(a-n),p=-2*a*n/(a-n);return o[0]=l,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=h,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=f,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makePerspective(e,t,r,s){const n=r*Math.tan(a(.5*e)),o=-n,l=o*t,h=n*t;return this.makeFrustum(l,h,o,n,r,s)}makeOrthographic(e,t,r,s,n,a){const o=this.elements,l=1/(t-e),h=1/(r-s),c=1/(a-n),u=(t+e)*l,f=(r+s)*h,p=(a+n)*c;return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-f,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}isEqual(e){const t=e.elements,r=this.elements;return r[0]===t[0]&&r[4]===t[4]&&r[8]===t[8]&&r[12]===t[12]&&r[1]===t[1]&&r[5]===t[5]&&r[9]===t[9]&&r[13]===t[13]&&r[2]===t[2]&&r[6]===t[6]&&r[10]===t[10]&&r[14]===t[14]&&r[3]===t[3]&&r[7]===t[7]&&r[11]===t[11]&&r[15]===t[15]}clone(){const e=this.elements;return new Matrix4(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])}isIdentity(){const e=this.elements;return 1===e[0]&&0===e[4]&&0===e[8]&&0===e[12]&&0===e[1]&&1===e[5]&&0===e[9]&&0===e[13]&&0===e[2]&&0===e[6]&&1===e[10]&&0===e[14]&&0===e[3]&&0===e[7]&&0===e[11]&&1===e[15]}isNearlyIdentity(e){return this.clone().snap(e).isIdentity()}getScale(e){const t=this.elements;return e=e||new Vector3,h.set(t[0],t[1],t[2]),c.set(t[4],t[5],t[6]),u.set(t[8],t[9],t[10]),e.x=h.length(),e.y=c.length(),e.z=u.length(),e}lookAt(e,t,r){const s=this.elements;return u.subVectors(e,t).normalize(),0===u.length()&&(u.z=1),h.crossVectors(r,u).normalize(),0===h.length()&&(u.x+=1e-4,h.crossVectors(r,u).normalize()),c.crossVectors(u,h),s[0]=h.x,s[4]=c.x,s[8]=u.x,s[1]=h.y,s[5]=c.y,s[9]=u.y,s[2]=h.z,s[6]=c.z,s[10]=u.z,this}compose(e,t,r){const s=this.elements;return o.identity(),o.setRotationFromQuaternion(t),l.makeScale(r.x,r.y,r.z),this.multiplyMatrices(o,l),s[12]=e.x,s[13]=e.y,s[14]=e.z,this}}o=new Matrix4,l=new Matrix4;class Vector3{constructor(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0,this.atomid=void 0}set(e,t,r){return this.x=e,this.y=t,this.z=r,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}divideScalar(e){return 0!==e?(this.x/=e,this.y/=e,this.z/=e):(this.x=0,this.y=0,this.z=0),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,s=this.z-e.z;return t*t+r*r+s*s}applyMatrix3(e){const{x:t}=this,{y:r}=this,{z:s}=this,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*s,this.y=n[1]*t+n[4]*r+n[7]*s,this.z=n[2]*t+n[5]*r+n[8]*s,this}applyMatrix4(e){const{x:t}=this,{y:r}=this,{z:s}=this,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*s+n[12],this.y=n[1]*t+n[5]*r+n[9]*s+n[13],this.z=n[2]*t+n[6]*r+n[10]*s+n[14],this}applyProjection(e){const{x:t}=this,{y:r}=this,{z:s}=this,n=e.elements,a=n[3]*t+n[7]*r+n[11]*s+n[15];return this.x=(n[0]*t+n[4]*r+n[8]*s+n[12])/a,this.y=(n[1]*t+n[5]*r+n[9]*s+n[13])/a,this.z=(n[2]*t+n[6]*r+n[10]*s+n[14])/a,this}applyQuaternion(e){const{x:t}=this,{y:r}=this,{z:s}=this,n=e.x,a=e.y,o=e.z,l=e.w,h={};h.x=2*(r*o-s*a),h.y=2*(s*n-t*o),h.z=2*(t*a-r*n);const c={};return c.x=h.y*o-h.z*a,c.y=h.z*n-h.x*o,c.z=h.x*a-h.y*n,this.x=t+l*h.x+c.x,this.y=r+l*h.y+c.y,this.z=s+l*h.z+c.z,this}negate(){return this.multiplyScalar(-1)}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){return this.divideScalar(this.length())}cross(e){const{x:t}=this,{y:r}=this,{z:s}=this;return this.x=r*e.z-s*e.y,this.y=s*e.x-t*e.z,this.z=t*e.y-r*e.x,this}crossVectors(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this}equals(e){return this.x==e.x&&this.y==e.y&&this.z==e.z}getPositionFromMatrix(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this}setEulerFromRotationMatrix(e,t){const r=e.elements,n=r[0],a=r[4],o=r[8],l=r[5],h=r[9],c=r[6],u=r[10];return void 0===t||"XYZ"===t?(this.y=Math.asin(s(o,-1,1)),Math.abs(o)<.99999?(this.x=Math.atan2(-h,u),this.z=Math.atan2(-a,n)):(this.x=Math.atan2(c,l),this.z=0)):console.error(`Error with vector's setEulerFromRotationMatrix: Unknown order: ${t}`),this}rotateAboutVector(e,t){e.normalize();const r=Math.cos(t),s=Math.sin(t),n=this.clone().multiplyScalar(r),a=e.clone().cross(this).multiplyScalar(s),o=e.clone().multiplyScalar(e.clone().dot(this)).multiplyScalar(1-r),l=n.add(a).add(o);return this.x=l.x,this.y=l.y,this.z=l.z,this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}transformDirection(e){const{x:t}=this,{y:r}=this,{z:s}=this,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*s,this.y=n[1]*t+n[5]*r+n[9]*s,this.z=n[2]*t+n[6]*r+n[10]*s,this.normalize()}clone(){return new Vector3(this.x,this.y,this.z)}unproject(e){const t=o;return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}h=new Vector3,c=new Vector3,u=new Vector3;class Matrix3{constructor(e=1,t=0,r=0,s=0,n=1,a=0,o=0,l=0,h=1){this.elements=new Float32Array(9),this.set(e,t,r,s,n,a,o,l,h)}set(e,t,r,s,n,a,o,l,h){const c=this.elements;return c[0]=e,c[3]=t,c[6]=r,c[1]=s,c[4]=n,c[7]=a,c[2]=o,c[5]=l,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=e.elements;this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8])}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}getInverse3(e){const t=e.elements,r=this.elements;r[0]=t[4]*t[8]-t[5]*t[7],r[3]=t[6]*t[5]-t[3]*t[8],r[6]=t[3]*t[7]-t[6]*t[4],r[1]=t[7]*t[2]-t[1]*t[8],r[4]=t[0]*t[8]-t[6]*t[2],r[7]=t[1]*t[6]-t[0]*t[7],r[2]=t[1]*t[5]-t[2]*t[4],r[5]=t[2]*t[3]-t[0]*t[5],r[8]=t[0]*t[4]-t[1]*t[3];const s=t[0]*r[0]+t[3]*r[1]+t[6]*r[2];return this.multiplyScalar(1/s),this}getInverse(e,t){const r=e.elements,s=this.elements;s[0]=r[10]*r[5]-r[6]*r[9],s[1]=-r[10]*r[1]+r[2]*r[9],s[2]=r[6]*r[1]-r[2]*r[5],s[3]=-r[10]*r[4]+r[6]*r[8],s[4]=r[10]*r[0]-r[2]*r[8],s[5]=-r[6]*r[0]+r[2]*r[4],s[6]=r[9]*r[4]-r[5]*r[8],s[7]=-r[9]*r[0]+r[1]*r[8],s[8]=r[5]*r[0]-r[1]*r[4];const n=r[0]*s[0]+r[1]*s[3]+r[2]*s[6];if(0===n){const e="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(e);return console.warn(e),this.identity(),this}return this.multiplyScalar(1/n),this}getDeterminant(){const e=this.elements;return e[0]*e[4]*e[8]+e[1]*e[5]*e[6]+e[2]*e[3]*e[7]-e[2]*e[4]*e[6]-e[1]*e[3]*e[8]-e[0]*e[5]*e[7]}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}clone(){const e=this.elements;return new Matrix3(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])}getMatrix4(){const e=this.elements;return new Matrix4(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0)}}class Ray{constructor(e,t){this.origin=void 0!==e?e:new Vector3,this.direction=void 0!==t?t:new Vector3}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return(t||new Vector3).copy(this.direction).multiplyScalar(e).add(this.origin)}recast(e){const t=h;return this.origin.copy(this.at(e,t)),this}closestPointToPoint(e,t){const r=t||new Vector3;r.subVectors(e,this.origin);const s=r.dot(this.direction);return r.copy(this.direction).multiplyScalar(s).add(this.origin)}distanceToPoint(e){const t=h,r=t.subVectors(e,this.origin).dot(this.direction);return t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceTo(e)}isIntersectionCylinder(){}isIntersectionSphere(e){return this.distanceToPoint(e.center)<=e.radius}isIntersectionPlane(e){return 0!==e.normal.dot(this.direction)||0===e.distanceToPoint(this.origin)}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:void 0;return-(this.origin.dot(e.normal)+e.constant)/t}intersectPlane(e,t){const r=this.distanceToPlane(e);if(void 0!==r)return this.at(r,t)}applyMatrix4(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this}clone(){return(new Ray).copy(this)}}function f(e,t,r,s,n,a){s=s*Math.PI/180,n=n*Math.PI/180,a=a*Math.PI/180;const o=e=>e*e,l=Math.cos(s),h=Math.cos(n),c=Math.cos(a),u=Math.sin(a);return new Matrix3(e,t*c,r*h,0,t*u,r*(l-h*c)/u,0,0,r*Math.sqrt(1-o(l)-o(h)-o(c)+2*l*h*c)/u)}},3351:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Cylinder:()=>Cylinder,Sphere:()=>Sphere,Triangle:()=>Triangle});var s=r(9652);class Sphere{constructor(e={x:0,y:0,z:0},t=0){this.center=new s.Vector3(e.x,e.y,e.z),this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new Sphere).copy(this)}}let n=new s.Vector3;class Cylinder{constructor(e=new s.Vector3,t=new s.Vector3,r=0){this.c1=e,this.c2=t,this.radius=r,this.direction=(new s.Vector3).subVectors(this.c2,this.c1).normalize()}copy(e){return this.c1.copy(e.c1),this.c2.copy(e.c2),this.direction.copy(e.direction),this.radius=e.radius,this}lengthSq(){return n.subVectors(this.c2,this.c1).lengthSq()}applyMatrix4(e){return this.direction.add(this.c1).applyMatrix4(e),this.c1.applyMatrix4(e),this.c2.applyMatrix4(e),this.direction.sub(this.c1).normalize(),this.radius=this.radius*e.getMaxScaleOnAxis(),this}}const a=new s.Vector3;class Triangle{constructor(e=new s.Vector3,t=new s.Vector3,r=new s.Vector3){this.a=e,this.b=t,this.c=r}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}applyMatrix4(e){return this.a.applyMatrix4(e),this.b.applyMatrix4(e),this.c.applyMatrix4(e),this}getNormal(){var e=this.a.clone();return e.sub(this.b),a.subVectors(this.c,this.b),e.cross(a),e.normalize(),e}}},9158:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{autoinit:()=>autoinit,autoload:()=>autoload,processing_autoinit:()=>processing_autoinit,viewers:()=>viewers});var _GLViewer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(9230),_ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(9192),_utilities__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9005),_colors__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2550),autoinit=!1,processing_autoinit=!1,viewers={};function autoload(viewer,callback){var i,dataname,type;if(null!=document.querySelector(".viewer_3Dmoljs")&&(autoinit=!0),autoinit){processing_autoinit=!0,viewer=null!=viewer?viewer:null;var nviewers=0;document.querySelectorAll(".viewer_3Dmoljs").forEach((viewerdiv=>{var datauri=[],datatypes=[],uri="";"static"==viewerdiv.style.position&&(viewerdiv.style.position="relative");var UI=null;if(type=null,viewerdiv.dataset.pdb)datauri.push("https://files.rcsb.org/view/"+viewerdiv.dataset.pdb+".pdb"),datatypes.push("pdb");else if(viewerdiv.dataset.cid)datatypes.push("sdf"),datauri.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/"+viewerdiv.dataset.cid+"/SDF?record_type=3d");else if(viewerdiv.dataset.href||viewerdiv.dataset.url){uri=viewerdiv.dataset.href?viewerdiv.dataset.href:viewerdiv.dataset.url,datauri.push(uri),type=uri.substring(uri.lastIndexOf(".")+1),datatypes.push(type);var molName=uri.substring(uri.lastIndexOf("/")+1,uri.lastIndexOf("."));"/"==molName&&(molName=uri.substring(uri.lastIndexOf("/")+1)),viewerdiv.dataset[datatypes[datatypes.length-1]]=molName}var divdata=viewerdiv.dataset;for(i in divdata)"pdb"===i.substring(0,3)&&"pdb"!==i?(datauri.push("https://files.rcsb.org/view/"+divdata[i]+".pdb"),datatypes.push("pdb")):"href"===i.substring(0,4)&&"href"!==i?(uri=divdata[i],datauri.push(uri),datatypes.push(uri.substring(uri.lastIndexOf(".")+1))):"cid"===i.substring(0,3)&&"cid"!==i&&(datauri.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/"+divdata[i]+"/SDF?record_type=3d"),datatypes.push("sdf"));var options={};viewerdiv.dataset.options&&(options=(0,_utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.options));var bgcolor=_colors__WEBPACK_IMPORTED_MODULE_3__.CC.color(viewerdiv.dataset.backgroundcolor),bgalpha=viewerdiv.dataset.backgroundalpha;bgalpha=null==bgalpha?1:parseFloat(bgalpha);var style={line:{}};viewerdiv.dataset.style&&(style=(0,_utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.style));var select={};viewerdiv.dataset.select&&(select=(0,_utilities__WEBPACK_IMPORTED_MODULE_2__.specStringToObject)(viewerdiv.dataset.select));var selectstylelist=[],surfaces=[],labels=[],zoomto={},spin=null,d=viewerdiv.dataset,stylere=/style(.+)/,surfre=/surface(.*)/,reslabre=/labelres(.*)/,keys=[];for(dataname in d)Object.prototype.hasOwnProperty.call(d,dataname)&&keys.push(dataname);for(keys.sort(),i=0;i{UI.loadSurface("VDW",t,r,e)})):e.addSurface(_ProteinSurface4__WEBPACK_IMPORTED_MODULE_1__.SurfaceType.VDW,r,t,t)}for(i=0;i{"complete"===document.readyState&&autoload()}},2550:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CC:()=>CC,Color:()=>Color,builtinColorSchemes:()=>c,chains:()=>h,elementColors:()=>o,htmlColors:()=>s,residues:()=>l,ssColors:()=>n});class Color{constructor(e,t,r){return this.r=0,this.g=0,this.b=0,arguments.length>1&&"number"==typeof e?(this.r=e||0,this.g=t||0,this.b=r||0,this):this.set(e||0)}set(e){return e instanceof Color?e.clone():("number"==typeof e?this.setHex(e):"object"==typeof e&&(this.r=(null==e?void 0:e.r)||0,this.g=(null==e?void 0:e.g)||0,this.b=(null==e?void 0:e.b)||0),this)}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}getHex(){return Math.round(255*this.r)<<16|Math.round(255*this.g)<<8|Math.round(255*this.b)}clone(){return new Color(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}scaled(){var e={};return e.r=Math.round(255*this.r),e.g=Math.round(255*this.g),e.b=Math.round(255*this.b),e.a=1,e}}class CC{static color(e){if(!e)return CC.cache[0];if(e instanceof Color)return e;if("number"==typeof e&&void 0!==CC.cache[e])return CC.cache[e];if(e&&Array.isArray(e))return e.map(CC.color);let t=CC.getHex(e),r=new Color(t);return CC.cache[t]=r,r}static getHex(e){var t;if(Array.isArray(e))return e.map(CC.getHex);if("string"==typeof e){let r=e;if(!isNaN(parseInt(r)))return parseInt(r);if(r=r.trim(),4==r.length&&"#"==r[0]&&(r="#"+r[1]+r[1]+r[2]+r[2]+r[3]+r[3]),7==r.length&&"#"==r[0])return parseInt(r.substring(1),16);let s=CC.rgbRegEx.exec(r);if(s){""!=s[1]&&console.log("WARNING: Opacity value in rgba ignored. Specify separately as opacity attribute.");let e=0;for(let t=2;t<5;t++){e*=256;let r=s[t].endsWith("%")?255*parseFloat(s[t])/100:parseFloat(s[t]);e+=Math.round(r)}return e}return(null===(t=null===window||void 0===window?void 0:window.$3Dmol)||void 0===t?void 0:t.htmlColors[e.toLowerCase()])||0}return e}}CC.rgbRegEx=/rgb(a?)\(\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)\s*,\s*([^ ,\)\t]+)/i,CC.cache={0:new Color(0)};const s={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgrey:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,grey:8421504,green:32768,greenyellow:11403055,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgrey:13882323,lightgreen:9498256,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},n={pyMol:{h:16711680,s:16776960,c:65280},Jmol:{h:16711808,s:16762880,c:16777215}},a={H:16777215,He:16761035,HE:16761035,Li:11674146,LI:11674146,B:65280,C:13158600,N:9408511,O:15728640,F:14329120,Na:255,NA:255,Mg:2263842,MG:2263842,Al:8421520,AL:8421520,Si:14329120,SI:14329120,P:16753920,S:16762930,Cl:65280,CL:65280,Ca:8421520,CA:8421520,Ti:8421520,TI:8421520,Cr:8421520,CR:8421520,Mn:8421520,MN:8421520,Fe:16753920,FE:16753920,Ni:10824234,NI:10824234,Cu:10824234,CU:10824234,Zn:10824234,ZN:10824234,Br:10824234,BR:10824234,Ag:8421520,AG:8421520,I:10494192,Ba:16753920,BA:16753920,Au:14329120,AU:14329120},o={defaultColor:16716947,Jmol:{H:16777215,He:14286847,HE:14286847,Li:13402367,LI:13402367,Be:12779264,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,Ne:11789301,NE:11789301,Na:11230450,NA:11230450,Mg:9109248,MG:9109248,Al:12560038,AL:12560038,Si:1578e4,SI:1578e4,P:16744448,S:16777008,Cl:2093087,CL:2093087,Ar:8442339,AR:8442339,K:9388244,Ca:4062976,CA:4062976,Sc:15132390,SC:15132390,Ti:12567239,TI:12567239,V:10921643,Cr:9083335,CR:9083335,Mn:10255047,MN:10255047,Fe:14706227,FE:14706227,Co:15765664,CO:15765664,Ni:5296208,NI:5296208,Cu:13140019,CU:13140019,Zn:8224944,ZN:8224944,Ga:12750735,GA:12750735,Ge:6721423,GE:6721423,As:12419299,AS:12419299,Se:16752896,SE:16752896,Br:10889513,BR:10889513,Kr:6076625,KR:6076625,Rb:7351984,RB:7351984,Sr:65280,SR:65280,Y:9764863,Zr:9756896,ZR:9756896,Nb:7586505,NB:7586505,Mo:5551541,MO:5551541,Tc:3907230,TC:3907230,Ru:2396047,RU:2396047,Rh:687500,RH:687500,Pd:27013,PD:27013,Ag:12632256,AG:12632256,Cd:16767375,CD:16767375,In:10909043,IN:10909043,Sn:6717568,SN:6717568,Sb:10380213,SB:10380213,Te:13924864,TE:13924864,I:9699476,Xe:4366e3,XE:4366e3,Cs:5707663,CS:5707663,Ba:51456,BA:51456,La:7394559,LA:7394559,Ce:16777159,CE:16777159,Pr:14286791,PR:14286791,Nd:13107143,ND:13107143,Pm:10747847,PM:10747847,Sm:9437127,SM:9437127,Eu:6422471,EU:6422471,Gd:4587463,GD:4587463,Tb:3211207,TB:3211207,Dy:2097095,DY:2097095,Ho:65436,HO:65436,Er:58997,ER:58997,Tm:54354,TM:54354,Yb:48952,YB:48952,Lu:43812,LU:43812,Hf:5096191,HF:5096191,Ta:5089023,TA:5089023,W:2200790,Re:2522539,RE:2522539,Os:2516630,OS:2516630,Ir:1528967,IR:1528967,Pt:13684960,PT:13684960,Au:16765219,AU:16765219,Hg:12105936,HG:12105936,Tl:10900557,TL:10900557,Pb:5724513,PB:5724513,Bi:10375093,BI:10375093,Po:11230208,PO:11230208,At:7688005,AT:7688005,Rn:4358806,RN:4358806,Fr:4325478,FR:4325478,Ra:32e3,RA:32e3,Ac:7384058,AC:7384058,Th:47871,TH:47871,Pa:41471,PA:41471,U:36863,Np:33023,NP:33023,Pu:27647,PU:27647,Am:5528818,AM:5528818,Cm:7888099,CM:7888099,Bk:9064419,BK:9064419,Cf:10565332,CF:10565332,Es:11739092,ES:11739092,Fm:11739066,FM:11739066,Md:11734438,MD:11734438,No:12389767,NO:12389767,Lr:13041766,LR:13041766,Rf:13369433,RF:13369433,Db:13697103,DB:13697103,Sg:14221381,SG:14221381,Bh:14680120,BH:14680120,Hs:15073326,HS:15073326,Mt:15400998,MT:15400998},rasmol:a,defaultColors:Object.assign({},a),greenCarbon:Object.assign(Object.assign({},a),{C:65280}),cyanCarbon:Object.assign(Object.assign({},a),{C:65535}),magentaCarbon:Object.assign(Object.assign({},a),{C:16711935}),yellowCarbon:Object.assign(Object.assign({},a),{C:16776960}),whiteCarbon:Object.assign(Object.assign({},a),{C:16777215}),orangeCarbon:Object.assign(Object.assign({},a),{C:16753920}),purpleCarbon:Object.assign(Object.assign({},a),{C:8388736}),blueCarbon:Object.assign(Object.assign({},a),{C:255})},l={amino:{ALA:13158600,ARG:1334015,ASN:56540,ASP:15075850,CYS:15132160,GLN:56540,GLU:15075850,GLY:15461355,HIS:8553170,ILE:1016335,LEU:1016335,LYS:1334015,MET:15132160,PHE:3289770,PRO:14456450,SER:16422400,THR:16422400,TRP:11819700,TYR:3289770,VAL:1016335,ASX:16738740,GLX:16738740},shapely:{ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:16777215,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,ASX:16711935,GLX:16711935},nucleic:{A:10526975,G:16740464,I:8454143,C:16747595,T:10551200,U:16744576}},h={atom:{A:12636415,B:11599792,C:16761032,D:16777088,E:16761087,F:11596016,G:16765040,H:15761536,I:16113331,J:49151,K:13458524,L:6737322,M:10145074,N:15631086,O:52945,P:65407,Q:3978097,R:139,S:12433259,T:25600,U:8388608,V:8421376,W:8388736,X:32896,Y:12092939,Z:11674146},hetatm:{A:9478351,B:8441752,C:13602992,D:13619056,E:13603023,F:8437952,G:13607008,H:12603504,I:12955267,J:42959,K:11881548,L:5682578,M:9090346,N:12481214,O:46753,P:53103,Q:3447649,R:187,S:10854235,T:37888,U:11534336,V:11579392,W:11534512,X:45232,Y:15250963,Z:12726834}},c={ssPyMol:{prop:"ss",map:n.pyMol},ssJmol:{prop:"ss",map:n.Jmol},Jmol:{prop:"elem",map:o.Jmol},amino:{prop:"resn",map:l.amino},shapely:{prop:"resn",map:l.shapely},nucleic:{prop:"resn",map:l.nucleic},chain:{prop:"chain",map:h.atom},rasmol:{prop:"elem",map:o.rasmol},default:{prop:"elem",map:o.defaultColors},greenCarbon:{prop:"elem",map:o.greenCarbon},chainHetatm:{prop:"chain",map:h.hetatm},cyanCarbon:{prop:"elem",map:o.cyanCarbon},magentaCarbon:{prop:"elem",map:o.magentaCarbon},purpleCarbon:{prop:"elem",map:o.purpleCarbon},whiteCarbon:{prop:"elem",map:o.whiteCarbon},orangeCarbon:{prop:"elem",map:o.orangeCarbon},yellowCarbon:{prop:"elem",map:o.yellowCarbon},blueCarbon:{prop:"elem",map:o.blueCarbon}}},6163:(e,t,r)=>{"use strict";r.r(t),r.d(t,{drawCartoon:()=>E,subdivide_spline:()=>u});var s=r(9652),n=r(3351),a=r(7693),o=r(1460),l=r(2550),h=r(4406),c=r(9005);function u(e,t){var r,n,a,o,l,h,c,u,f,p=[],g=e;for((g=[]).push(e[0]),r=1,n=e.length-1;r0){var y=[n,n+1,n-1,n-2],b=f.faceidx;v[b]=y[0],v[b+1]=y[1],v[b+2]=y[3],v[b+3]=y[1],v[b+4]=y[2],v[b+5]=y[3],f.faceidx+=6}f.vertices+=2}}function b(e,t,r,s,a,o,h){h&&"default"!==h||(h="rectangle"),"edged"===h?function(e,t,r,s,a,o){if(!(t.length<2)){var h,c;if(h=t[0],c=t[t.length-1],h=u(h,s),c=u(c,s),!a)return y(e,h,c,r);var f,p,g,v,_,b,w,x,A,C,S,M,z,L,E,T,k,I,O,D,F,R,P=[],G=[[0,2,-6,-8],[-4,-2,6,4],[7,-1,-5,3],[-3,5,1,-7]];for(z=0,L=h.length;z0){var N=void 0!==M&&void 0!==S&&M.serial!==S.serial;for(E=0;E<4;E++){var U=[b+G[E][0],b+G[E][1],b+G[E][2],b+G[E][3]];if(R[x=O.faceidx]=U[0],R[x+1]=U[1],R[x+2]=U[3],R[x+3]=U[1],R[x+4]=U[2],R[x+5]=U[3],O.faceidx+=6,S.clickable||M.clickable||S.hoverable||M.hoverable){var V=P[U[3]].clone(),j=P[U[0]].clone(),H=P[U[2]].clone(),W=P[U[1]].clone();if(V.atom=P[U[3]].atom||null,H.atom=P[U[2]].atom||null,j.atom=P[U[0]].atom||null,W.atom=P[U[1]].atom||null,N){var q=V.clone().add(j).multiplyScalar(.5),Y=H.clone().add(W).multiplyScalar(.5),Z=V.clone().add(W).multiplyScalar(.5);E%2==0?((M.clickable||M.hoverable)&&(T=new n.Triangle(q,Z,V),k=new n.Triangle(Y,H,Z),I=new n.Triangle(Z,H,V),M.intersectionShape.triangle.push(T),M.intersectionShape.triangle.push(k),M.intersectionShape.triangle.push(I)),(S.clickable||S.hoverable)&&(T=new n.Triangle(j,W,Z),k=new n.Triangle(W,Y,Z),I=new n.Triangle(j,Z,q),S.intersectionShape.triangle.push(T),S.intersectionShape.triangle.push(k),S.intersectionShape.triangle.push(I))):((S.clickable||S.hoverable)&&(T=new n.Triangle(q,Z,V),k=new n.Triangle(Y,H,Z),I=new n.Triangle(Z,H,V),S.intersectionShape.triangle.push(T),S.intersectionShape.triangle.push(k),S.intersectionShape.triangle.push(I)),(M.clickable||M.hoverable)&&(T=new n.Triangle(j,W,Z),k=new n.Triangle(W,Y,Z),I=new n.Triangle(j,Z,q),M.intersectionShape.triangle.push(T),M.intersectionShape.triangle.push(k),M.intersectionShape.triangle.push(I)))}else(S.clickable||S.hoverable)&&(T=new n.Triangle(j,W,V),k=new n.Triangle(W,H,V),S.intersectionShape.triangle.push(T),S.intersectionShape.triangle.push(k))}}}O.vertices+=8,M=S}var X=P.length-8;for(D=(O=e.updateGeoGroup(8)).vertexArray,F=O.colorArray,R=O.faceArray,w=3*(b=O.vertices),x=O.faceidx,z=0;z<4;z++){P.push(P[2*z]),P.push(P[X+2*z]);var K=P[2*z],$=P[X+2*z];D[w+6*z]=K.x,D[w+1+6*z]=K.y,D[w+2+6*z]=K.z,D[w+3+6*z]=$.x,D[w+4+6*z]=$.y,D[w+5+6*z]=$.z,F[w+6*z]=A.r,F[w+1+6*z]=A.g,F[w+2+6*z]=A.b,F[w+3+6*z]=A.r,F[w+4+6*z]=A.g,F[w+5+6*z]=A.b}X+=8,T=[b,b+2,b+6,b+4],k=[b+1,b+5,b+7,b+3],R[x]=T[0],R[x+1]=T[1],R[x+2]=T[3],R[x+3]=T[1],R[x+4]=T[2],R[x+5]=T[3],R[x+6]=k[0],R[x+7]=k[1],R[x+8]=k[3],R[x+9]=k[1],R[x+10]=k[2],R[x+11]=k[3],O.faceidx+=12,O.vertices+=8}}(e,t,r,s,a):"rectangle"!==h&&"oval"!==h&&"parabola"!==h||function(e,t,r,s,a,o,h){var c,f,p,g,v,_,b,w,x,A;if((p=t.length)<2||t[0].length<2)return;for(c=0;c0&&(c-=1,o=!0),I=Math.round(c*(r.length-1)/g),k=l.CC.color(r[I]),x=b,A=w,b=[],w=[],v=[],void 0!==t[0][c].atom&&(T=t[0][c].atom,"oval"===h?_=C:"rectangle"===h?_=S:"parabola"===h&&(_=M)),_||(_=S),f=0;f0&&!o){for(f=0;f<2*p;f++)R=[z+P[f][0],z+P[f][1],z+P[f][2],z+P[f][3]],F[E=G.faceidx]=R[0],F[E+1]=R[1],F[E+2]=R[3],F[E+3]=R[1],F[E+4]=R[2],F[E+5]=R[3],G.faceidx+=6;if(T.clickable||T.hoverable){var U=[];for(f in U.push(new n.Triangle(x[0],b[0],b[p-1])),U.push(new n.Triangle(x[0],b[p-1],x[p-1])),U.push(new n.Triangle(x[p-1],b[p-1],w[p-1])),U.push(new n.Triangle(x[p-1],w[p-1],A[p-1])),U.push(new n.Triangle(w[0],A[0],A[p-1])),U.push(new n.Triangle(w[p-1],w[0],A[p-1])),U.push(new n.Triangle(b[0],x[0],A[0])),U.push(new n.Triangle(w[0],b[0],A[0])),U)T.intersectionShape.triangle.push(U[f])}}G.vertices+=2*p}for(O=G.vertexArray,D=G.colorArray,F=G.faceArray,L=3*(z=G.vertices),E=G.faceidx,c=0;c=0&&r<1&&(o.transparent=!0,o.opacity=r),o.outline=s;var l=new a.Mesh(t,o);e.add(l)}}function C(e,t,r,n,a,o,l,h,c){var u,_,y,b,w,x;if(n&&a&&l){var A=a.sub(n);A.normalize();var C=h[c];for(_=c+1;_0&&b(q,Z,Y,p,O,0,Z.style);var r=[],s=null;if(t){for(D=0;D0&&b(q,Z,Y,p,O,0,Z.style),Z=[],D=0;D{"use strict";r.r(t),r.d(t,{CAP:()=>y.CAP,CC:()=>n.CC,Color:()=>n.Color,CustomLinear:()=>s.CustomLinear,Cylinder:()=>u.Cylinder,GLDraw:()=>y.GLDraw,GLModel:()=>w.GLModel,GLShape:()=>_.GLShape,GLViewer:()=>x.GLViewer,GLVolumetricRender:()=>v.GLVolumetricRender,Gradient:()=>s.Gradient,GradientType:()=>s.GradientType,Label:()=>a.Label,LabelCount:()=>a.LabelCount,MarchingCube:()=>p.MarchingCube,MarchingCubeInitializer:()=>p.MarchingCubeInitializer,Matrix3:()=>c.Matrix3,Matrix4:()=>c.Matrix4,Parsers:()=>h.Parsers,PausableTimer:()=>f.PausableTimer,PointGrid:()=>p.PointGrid,ProteinSurface:()=>p.ProteinSurface,Quaternion:()=>c.Quaternion,ROYGB:()=>s.ROYGB,RWB:()=>s.RWB,Ray:()=>c.Ray,Sinebow:()=>s.Sinebow,Sphere:()=>u.Sphere,SurfaceType:()=>p.SurfaceType,Triangle:()=>u.Triangle,Vector2:()=>c.Vector2,Vector3:()=>c.Vector3,VolumeData:()=>g.VolumeData,adjustVolumeStyle:()=>f.adjustVolumeStyle,applyPartialCharges:()=>l,autoinit:()=>A.autoinit,autoload:()=>A.autoload,base64ToArray:()=>f.base64ToArray,bondLength:()=>h.bondLength,builtinColorSchemes:()=>n.builtinColorSchemes,builtinGradients:()=>s.builtinGradients,chains:()=>n.chains,clamp:()=>c.clamp,conversionMatrix3:()=>c.conversionMatrix3,createStereoViewer:()=>x.createStereoViewer,createViewer:()=>x.createViewer,createViewerGrid:()=>x.createViewerGrid,deepCopy:()=>f.deepCopy,degToRad:()=>c.degToRad,download:()=>f.download,drawCartoon:()=>b.drawCartoon,elementColors:()=>n.elementColors,extend:()=>f.extend,get:()=>f.get,getAtomProperty:()=>f.getAtomProperty,getColorFromStyle:()=>f.getColorFromStyle,getElement:()=>f.getElement,getExtent:()=>f.getExtent,getGradient:()=>s.getGradient,getPropertyRange:()=>f.getPropertyRange,getbin:()=>f.getbin,htmlColors:()=>n.htmlColors,isEmptyObject:()=>f.isEmptyObject,isNumeric:()=>f.isNumeric,makeFunction:()=>f.makeFunction,mergeGeos:()=>f.mergeGeos,normalizeValue:()=>s.normalizeValue,partialCharges:()=>o,processing_autoinit:()=>A.processing_autoinit,residues:()=>n.residues,setBondLength:()=>h.setBondLength,setSyncSurface:()=>p.setSyncSurface,specStringToObject:()=>f.specStringToObject,splitMesh:()=>_.splitMesh,ssColors:()=>n.ssColors,subdivide_spline:()=>b.subdivide_spline,syncSurface:()=>p.syncSurface,viewers:()=>A.viewers});var s=r(1460),n=r(2550),a=r(7825);const o={"ALA:N":-.15,"ALA:CA":.1,"ALA:CB":0,"ALA:C":.6,"ALA:O":-.55,"ARG:N":-.15,"ARG:CA":.1,"ARG:CB":0,"ARG:CG":0,"ARG:CD":.1,"ARG:NE":-.1,"ARG:CZ":.5,"ARG:NH1":.25,"ARG:NH2":.25,"ARG:C":.6,"ARG:O":-.55,"ASN:N":-.15,"ASN:CA":.1,"ASN:CB":0,"ASN:CG":.55,"ASN:OD1":-.55,"ASN:ND2":0,"ASN:C":.6,"ASN:O":-.55,"ASP:N":-.15,"ASP:CA":.1,"ASP:CB":0,"ASP:CG":.14,"ASP:OD1":-.57,"ASP:OD2":-.57,"ASP:C":.6,"ASP:O":-.55,"CYS:N":-.15,"CYS:CA":.1,"CYS:CB":.19,"CYS:SG":-.19,"CYS:C":.6,"CYS:O":-.55,"GLN:N":-.15,"GLN:CA":.1,"GLN:CB":0,"GLN:CG":0,"GLN:CD":.55,"GLN:OE1":-.55,"GLN:NE2":0,"GLN:C":.6,"GLN:O":-.55,"GLU:N":-.15,"GLU:CA":.1,"GLU:CB":0,"GLU:CG":0,"GLU:CD":.14,"GLU:OE1":-.57,"GLU:OE2":-.57,"GLU:C":.6,"GLU:O":-.55,"GLY:N":-.15,"GLY:CA":.1,"GLY:C":.6,"GLY:O":-.55,"HIS:N":-.15,"HIS:CA":.1,"HIS:CB":0,"HIS:CG":.1,"HIS:ND1":-.1,"HIS:CD2":.1,"HIS:NE2":-.4,"HIS:CE1":.3,"HIS:C":.6,"HIS:O":-.55,"ILE:N":-.15,"ILE:CA":.1,"ILE:CB":0,"ILE:CG2":0,"ILE:CG1":0,"ILE:CD":0,"ILE:C":.6,"ILE:O":-.55,"LEU:N":-.15,"LEU:CA":.1,"LEU:CB":0,"LEU:CG":0,"LEU:CD1":0,"LEU:CD2":0,"LEU:C":.6,"LEU:O":-.55,"LYS:N":-.15,"LYS:CA":.1,"LYS:CB":0,"LYS:CG":0,"LYS:CD":0,"LYS:CE":.25,"LYS:NZ":.75,"LYS:C":.6,"LYS:O":-.55,"MET:N":-.15,"MET:CA":.1,"MET:CB":0,"MET:CG":.06,"MET:SD":-.12,"MET:CE":.06,"MET:C":.6,"MET:O":-.55,"PHE:N":-.15,"PHE:CA":.1,"PHE:CB":0,"PHE:CG":0,"PHE:CD1":0,"PHE:CD2":0,"PHE:CE1":0,"PHE:CE2":0,"PHE:CZ":0,"PHE:C":.6,"PHE:O":-.55,"PRO:N":-.25,"PRO:CD":.1,"PRO:CA":.1,"PRO:CB":0,"PRO:CG":0,"PRO:C":.6,"PRO:O":-.55,"SER:N":-.15,"SER:CA":.1,"SER:CB":.25,"SER:OG":-.25,"SER:C":.6,"SER:O":-.55,"THR:N":-.15,"THR:CA":.1,"THR:CB":.25,"THR:OG1":-.25,"THR:CG2":0,"THR:C":.6,"THR:O":-.55,"TRP:N":-.15,"TRP:CA":.1,"TRP:CB":0,"TRP:CG":-.03,"TRP:CD2":.1,"TRP:CE2":-.04,"TRP:CE3":-.03,"TRP:CD1":.06,"TRP:NE1":-.06,"TRP:CZ2":0,"TRP:CZ3":0,"TRP:CH2":0,"TRP:C":.6,"TRP:O":-.55,"TYR:N":-.15,"TYR:CA":.1,"TYR:CB":0,"TYR:CG":0,"TYR:CD1":0,"TYR:CE1":0,"TYR:CD2":0,"TYR:CE2":0,"TYR:CZ":.25,"TYR:OH":-.25,"TYR:C":.6,"TYR:O":-.55,"VAL:N":-.15,"VAL:CA":.1,"VAL:CB":0,"VAL:CG1":0,"VAL:CG2":0,"VAL:C":.6,"VAL:O":-.55};function l(e,t){if((!t||void 0===e.partialCharge)&&e.resn&&e.atom){var r=e.resn+":"+e.atom;e.properties.partialCharge=o[r]}}var h=r(2640),c=r(9652),u=r(3351),f=r(9005),p=r(9192),g=r(7323),v=r(1496),_=r(8783),y=r(4406),b=r(6163),w=r(8223),x=r(9230),A=r(9158);window&&(window.$3Dmol=t)},972:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CUBE:()=>o});var s=r(7693),n=r(3920);const a={1:"H",2:"He",3:"Li",4:"Be",5:"B",6:"C",7:"N",8:"O",9:"F",10:"Ne",11:"Na",12:"Mg",13:"Al",14:"Si",15:"P",16:"S",17:"Cl",18:"Ar",19:"K",20:"Ca",21:"Sc",22:"Ti",23:"V",24:"Cr",25:"Mn",26:"Fe",27:"Co",28:"Ni",29:"Cu",30:"Zn",31:"Ga",32:"Ge",33:"As",34:"Se",35:"Br",36:"Kr",37:"Rb",38:"Sr",39:"Y",40:"Zr",41:"Nb",42:"Mo",43:"Tc",44:"Ru",45:"Rh",46:"Pd",47:"Ag",48:"Cd",49:"In",50:"Sn",51:"Sb",52:"Te",53:"I",54:"Xe",55:"Cs",56:"Ba",71:"Lu",72:"Hf",73:"Ta",74:"W",75:"Re",76:"Os",77:"Ir",78:"Pt",79:"Au",80:"Hg",81:"Tl",82:"Pb",83:"Bi",84:"Po",85:"At",86:"Rn",87:"Fr",88:"Ra",104:"Rf",105:"Db",106:"Sg",107:"Bh",108:"Hs",109:"Mt",110:"Ds",111:"Rg",112:"Cn",113:"Nh",114:"Fl",115:"Mc",116:"Lv",117:"Ts",118:"Og",57:"La",58:"Ce",59:"Pr",60:"Nd",61:"Pm",62:"Sm",63:"Eu",64:"Gd",65:"Tb",66:"Dy",67:"Ho",68:"Er",69:"Tm",70:"Yb",89:"Ac",90:"Th",91:"Pa",92:"U",93:"Np",94:"Pu",95:"Am",96:"Cm",97:"Bk",98:"Cf",99:"Es",100:"Fm",101:"Md",102:"No"};function o(e,t){t=t||{};var r=[[]],o=e.split(/\r?\n/),l=void 0===t.assignBonds||t.assignBonds;if(o.length<6)return r;var h=o[2].replace(/^\s+/,"").replace(/\s+/g," ").split(" "),c=Math.abs(parseFloat(h[0]));let u={};var f=u.origin=new s.Vector3(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));h=o[3].replace(/^\s+/,"").replace(/\s+/g," ").split(" ");var p=(h=o[3].replace(/^\s+/,"").replace(/\s+/g," ").split(" "))[0]>0?.529177:1;f.multiplyScalar(p);var g=Math.abs(h[0]),v=new s.Vector3(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])).multiplyScalar(p);h=o[4].replace(/^\s+/,"").replace(/\s+/g," ").split(" ");var _=Math.abs(h[0]),y=new s.Vector3(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])).multiplyScalar(p);h=o[5].replace(/^\s+/,"").replace(/\s+/g," ").split(" ");var b=Math.abs(h[0]),w=new s.Vector3(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])).multiplyScalar(p);if(u.size={x:g,y:_,z:b},u.unit=new s.Vector3(v.x,y.y,w.z),0!=v.y||0!=v.z||0!=y.x||0!=y.z||0!=w.x||0!=w.y){u.matrix4=new s.Matrix4(v.x,y.x,w.x,0,v.y,y.y,w.y,0,v.z,y.z,w.z,0,0,0,0,1);let e=(new s.Matrix4).makeTranslation(f.x,f.y,f.z);u.matrix4=u.matrix4.multiplyMatrices(e,u.matrix4),u.matrix=u.matrix4.matrix3FromTopLeft(),u.origin=new s.Vector3(0,0,0),u.unit=new s.Vector3(1,1,1)}r.modelData=[{cryst:u}],o=o.splice(6,c);for(var x=r[r.length-1].length,A=x+o.length,C=x;C{"use strict";r.r(t),r.d(t,{VASP:()=>n});var s=r(7693);function n(e){var t=[[]],r={},n=e.replace(/^\s+/,"").split(/\r?\n/);if(n.length<3)return t;if(!n[1].match(/\d+/))return console.log("Warning: second line of the vasp structure file must be a number"),t;if(r.length=parseFloat(n[1]),r.length<0)return console.log("Warning: Vasp implementation for negative lattice lengths is not yet available"),t;r.xVec=new Float32Array(n[2].replace(/^\s+/,"").split(/\s+/)),r.yVec=new Float32Array(n[3].replace(/^\s+/,"").split(/\s+/)),r.zVec=new Float32Array(n[4].replace(/^\s+/,"").split(/\s+/));var a=new s.Matrix3(r.xVec[0],r.xVec[1],r.xVec[2],r.yVec[0],r.yVec[1],r.yVec[2],r.zVec[0],r.zVec[1],r.zVec[2]);a.multiplyScalar(r.length),t.modelData=[{symmetries:[],cryst:{matrix:a}}];var o=n[5].replace(/\s+/,"").replace(/\s+$/,"").split(/\s+/),l=new Int16Array(n[6].replace(/^\s+/,"").split(/\s+/)),h=n[7].replace(/\s+/,"");if(h.match(/C/))h="cartesian";else{if(!h.match(/D/))return console.log("Warning: Unknown vasp mode in POSCAR file: mode must be either C(artesian) or D(irect)"),t;h="direct"}if(o.length!=l.length)return console.log("Warning: declaration of atomary species wrong:"),console.log(o),console.log(l),t;n.splice(0,8);for(var c=0,u=0,f=o.length;u{"use strict";r.r(t),r.d(t,{Parsers:()=>F,bondLength:()=>w.bondLength,setBondLength:()=>w.setBondLength});var s=r(5591),n=r(972),a=r(7693),o=r(3920);function l(e,t){for(var r=[[]],s=void 0===(t=t||{}).assignBonds||t.assignBonds,n=e.split(/\r?\n|\r/);n.length>0&&!(n.length<3);){var l=parseInt(n[0]);if(isNaN(l)||l<=0)break;if(n.length1){var c=new Float32Array(h[1].split(/\s+/)),u=new a.Matrix3(c[0],c[3],c[6],c[1],c[4],c[7],c[2],c[5],c[8]);r.modelData=[{cryst:{matrix:u}}]}for(var f=2,p=r[r.length-1].length,g=p+l,v=p;v=7&&(y.dx=parseFloat(_[4]),y.dy=parseFloat(_[5]),y.dz=parseFloat(_[6]))}if(!t.multimodel)break;r.push([]),n.splice(0,f)}if(s)for(let e=0;e3&&s[3].length>38&&(r=s[3].substring(34,39)),"V2000"===r?function(e,t){var r=[[]],s=!1;for(void 0!==t.keepH&&(s=!t.keepH);e.length>0&&!(e.length<4);){var n=parseInt(e[3].substring(0,3));if(isNaN(n)||n<=0)break;var a=parseInt(e[3].substring(3,6)),o=4;if(e.length<4+n+a)break;var l,h,c=[],u=r[r.length-1].length,f=u+n;for(l=u;l0&&!(e.length<8)&&e[4].startsWith("M V30 BEGIN CTAB")&&e[5].startsWith("M V30 COUNTS")&&!(e[5].length<14);){var n=e[5].substring(13).match(/\S+/g);if(n.length<2)break;var a=parseInt(n[0]);if(isNaN(a)||a<=0)break;var o=parseInt(n[1]),l=7;if(e.length<8+a+o)break;var h,c=[],u=r[r.length-1].length,f=u+a;for(h=u;h4){var g={},v=p[1].replace(/ /g,"");g.atom=g.elem=v[0].toUpperCase()+v.substring(1).toLowerCase(),"H"===g.elem&&s||(g.serial=h,c[h]=r[r.length-1].length,g.x=parseFloat(p[2]),g.y=parseFloat(p[3]),g.z=parseFloat(p[4]),g.hetflag=!0,g.bonds=[],g.bondOrder=[],g.properties={},g.index=r[r.length-1].length,r[r.length-1].push(g))}}if("M V30 END ATOM"!==e[l])break;if(l++,0===o||"M V30 BEGIN BOND"!==e[l])break;for(l++,h=0;h3){var y=c[parseInt(_[2])-1+u],b=c[parseInt(_[3])-1+u],w=parseFloat(_[1]);void 0!==y&&void 0!==b&&(r[r.length-1][y].bonds.push(b),r[r.length-1][y].bondOrder.push(w),r[r.length-1][b].bonds.push(y),r[r.length-1][b].bondOrder.push(w))}}if(!t.multimodel)break;for(t.onemol||r.push([]);"$$$$"!==e[l]&&lr)break;if(e.atom==a.atom)continue;const l=Math.abs(e.y-a.y);if(l>r)continue;const h=Math.abs(e.x-a.x);if(h>r)continue;const c=h*h+l*l+t*t;c>s||e.chain==a.chain&&Math.abs(e.resi-a.resi)<4||(c1.001;)r[e]-=1,s[e]-=1}const n=new a.Vector3(s[0],s[1],s[2]);return n.applyMatrix3(c),n};if(r.normalizeAssembly&&s)for(let r=0;r.001&&(h=r),e[r].translate(n)}if(n){if(e.length>1)for(let r=0;r=0){const r=new a.Vector3;for(let s=0;s1)break;(0,p.areConnected)(s,e,t)&&(-1===s.bonds.indexOf(e.index)&&(s.bonds.push(e.index),s.bondOrder.push(1),e.bonds.push(s.index),e.bondOrder.push(1)),s.resi!==e.resi&&(n=!0))}}}function _(e,t={}){var r=[],s=!t.doAssembly,n=r.modelData=[],o=void 0===t.assignBonds||t.assignBonds;function l(e,t){for(var r=[],s=0,n=0;n-1){let e=g.split("");e[_]="_",g=(g=e.join("")).substring(0,_)+"_"+g.substring(_+1)}}c.push(g)}}for(var y,b,w,x,A=0;AMOLECULE/),a=e.search(/@ATOM/);if(-1==n||-1==a)return r;for(var o=e.substring(n).split(/\r?\n|\r/);o.length>0;){var l=[],h=o[2].replace(/^\s+/,"").replace(/\s+/g," ").split(" "),c=parseInt(h[0]),u=0;h.length>1&&(u=parseInt(h[1]));var f,p=4;for(f=3;fATOM"==o[f]){p=f+1;break}var g=r[r.length-1].length,v=g+c;for(f=g;fBOND"==o[p++]){C=!0;break}if(C&&u)for(f=0;f0&&"H"===r[0]&&"Hg"!==r&&"He"!==r&&"Hf"!==r&&"Hs"!==r&&"Ho"!==r&&(r="H"),r.length>1&&(r=r[0].toUpperCase()+r.substring(1).toLowerCase(),void 0===w.bondTable[r]?r=r[0]:t&&("Ca"===r||"Cd"===r)&&(r="C")),r}function A(e,t,r){const s=[],n=void 0===t.assignBonds||t.assignBonds,o=!t.keepH,l=!!t.noSecondaryStructure,h=!t.noComputeSecondaryStructure,c=!t.doAssembly,p=t.altLoc?t.altLoc:"A",g={symmetries:[],cryst:void 0};let _,y=[];const b=[];let A;const C={};for(let t=0;t=4?1:r}}else C[o]=1,0!=t.bonds.length&&t.bonds[t.bonds.length-1]===a||(t.bonds.push(a),t.bondOrder.push(1))}}else if("HELIX "===n){l=A.substring(19,20),h=parseInt(A.substring(21,25)),u=parseInt(A.substring(33,37)),l in r||(r[l]={}),r[l][h]="h1";for(let e=h+1;e1&&("1"==e[1]?t.ssbegin=!0:"2"==e[1]&&(t.ssend=!0))}}return[s,g,y]}function C(e,t){t=t||{};var r=[],s={};r.modelData=[];for(var n=e.split(/\r?\n|\r/);n.length>0;){var a=A(n,t,s),o=a[0],l=a[1];if(n=a[2],0!=o.length){if(t.multimodel&&t.onemol&&r.length>0)for(var h=r[0].length,c=0;c1&&t[1].toUpperCase()!=t[1]&&(b=t.substring(0,2)),h="H"==n[0],a[e]=r[r.length-1].length,r[r.length-1].push({resn:s,x:f,y:p,z:g,elem:b,hetflag:h,chain:o,resi:l,serial:e,atom:t,bonds:[],ss:"c",bondOrder:[],properties:{charge:_,partialCharge:_,radius:y},pdbline:n})}else if("CONECT"==l){var w=parseInt(n.substring(6,11)),x=r[r.length-1][a[w]];for(let e=0;e<4;e++){var A=parseInt(n.substring([11,16,21,26][e],[11,16,21,26][e]+5)),C=r[r.length-1][a[A]];void 0!==x&&void 0!==C&&(x.bonds.push(a[A]),x.bondOrder.push(1))}}}for(let e=0;e0){var B=b.bioAssemblyList[h].transformList;for(c=0,y=B.length;c{e.chainIndexList.forEach((t=>{j[t]="polymer"==e.type}))}));var H=0;for(_=0;_=k.length||E(k[se]!=re))&&(ie=!0)}var ne=b.groupIdList[C],ae=Q.groupName;let e=Q.chemCompType;var oe=S;let t=T.has(e)||!j[A];for(g=0;g=S){H=e;break}let n=Y[t],a=Y[r],o=q[n],l=q[a];o&&l&&(o.bonds.push(a),o.bondOrder.push(s),l.bonds.push(n),l.bondOrder.push(s))}t.multimodel&&(t.onemol||w.push([]))}if(!l)for(let e=0;e0&&n[0].includes("VERSION")))return[];var a=n.filter((function(e){return e.includes("POINTERS")||e.includes("ATOM_NAME")||e.includes("CHARGE")||e.includes("RADII")||e.includes("BONDS_INC_HYDROGEN")||e.includes("BONDS_WITHOUT_HYDROGEN")})),o=u("POINTERS");if(-1==o)return[];var l=f(o),h=parseInt(n[o+1].slice(0,l[1]));if(isNaN(h)||h<=0)return[];if(-1==(o=u("ATOM_NAME")))return[];var c=(l=f(o))[0];for(let e=0;e0){for(;!n[t].includes("FORMAT");)t++;return t}return-1}function f(e){var t=n[e].match(/\((\d*)\S*/),r=n[e].match(/[a-zA-Z](\d*)\)\s*/);return null==r&&(r=n[e].match(/[a-zA-Z](\d*)\.\d*\)\s*/)),[t[1],r[1]]}return[r]}function O(e,t){for(var r=[],s=e.split(/\r?\n|\r/);s.length>0&&!(s.length<3);){var n=parseInt(s[1]);if(isNaN(n)||n<=0)break;if(s.length44&&(f.dx=10*parseFloat(u.slice(44,52)),f.dy=10*parseFloat(u.slice(52,60)),f.dz=10*parseFloat(u.slice(60,68))),a[c]=f}if(s.length<=o+3){var p=s[o++].trim().split(/\s+/);if(3==p.length){for(var g=0;g<3;g++)p[g]=10*parseFloat(p[g]);r.box=p}}s.splice(0,++o)}for(let e=0;e{"use strict";r.r(t),r.d(t,{areConnected:()=>a});var s=r(2929);const n=new Set(["Na","K","Ca","Mg","Mn","Sr"]);function a(e,t,r){if(r&&r.unboundCations&&(n.has(e.elem)||n.has(t.elem)))return!1;let a=(0,s.bondLength)(e.elem)+(0,s.bondLength)(t.elem);a+=.25,a*=a;let o=e.x-t.x;if(o*=o,o>a)return!1;let l=e.y-t.y;if(l*=l,l>a)return!1;let h=e.z-t.z;if(h*=h,h>a)return!1;const c=o+l+h;return!(isNaN(c)||c<.5||c>a||e.altLoc!==t.altLoc&&" "!==e.altLoc&&" "!==t.altLoc)}},3920:(e,t,r)=>{"use strict";r.r(t),r.d(t,{assignBonds:()=>o});var s=r(8995);const n=[{x:0,y:0,z:1},{x:0,y:1,z:-1},{x:0,y:1,z:0},{x:0,y:1,z:1},{x:1,y:-1,z:-1},{x:1,y:-1,z:0},{x:1,y:-1,z:1},{x:1,y:0,z:-1},{x:1,y:0,z:0},{x:1,y:0,z:1},{x:1,y:1,z:-1},{x:1,y:1,z:0},{x:1,y:1,z:1}],a=4.95;function o(e,t){for(let t=0,r=e.length;t{"use strict";r.r(t),r.d(t,{bondLength:()=>n,bondTable:()=>s,setBondLength:()=>a});let s={H:.37,He:.32,Li:1.34,Be:.9,B:.82,C:.77,N:.75,O:.73,F:.71,Ne:.69,Na:1.54,Mg:1.3,Al:1.18,Si:1.11,P:1.06,S:1.02,Cl:.99,Ar:.97,K:1.96,Ca:1.74,Sc:1.44,Ti:1.56,V:1.25,Mn:1.39,Fe:1.25,Co:1.26,Ni:1.21,Cu:1.38,Zn:1.31,Ga:1.26,Ge:1.22,Se:1.16,Br:1.14,Kr:1.1,Rb:2.11,Sr:1.92,Y:1.62,Zr:1.48,Nb:1.37,Mo:1.45,Tc:1.56,Ru:1.26,Rh:1.35,Pd:1.31,Ag:1.53,Cd:1.48,In:1.44,Sn:1.41,Sb:1.38,Te:1.35,I:1.33,Xe:1.3,Cs:2.25,Ba:1.98,Lu:1.6,Hf:1.5,Ta:1.38,W:1.46,Re:1.59,Os:1.44,Ir:1.37,Pt:1.28,Au:1.44,Hg:1.49,Tl:1.48,Pb:1.47,Bi:1.46,Rn:1.45};function n(e){return s[e]||1.6}function a(e,t){t<0&&(t=0),s[e]=t}},9005:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{PausableTimer:()=>PausableTimer,adjustVolumeStyle:()=>adjustVolumeStyle,base64ToArray:()=>base64ToArray,deepCopy:()=>deepCopy,download:()=>download,extend:()=>extend,get:()=>get,getAtomProperty:()=>getAtomProperty,getColorFromStyle:()=>getColorFromStyle,getElement:()=>getElement,getExtent:()=>getExtent,getPropertyRange:()=>getPropertyRange,getbin:()=>getbin,isEmptyObject:()=>isEmptyObject,isNumeric:()=>isNumeric,makeFunction:()=>makeFunction,mergeGeos:()=>mergeGeos,specStringToObject:()=>specStringToObject});var _Gradient__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1460),_VolumeData__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(7323),_colors__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(2550);function extend(e,t){for(var r in t)t.hasOwnProperty(r)&&void 0!==t[r]&&(e[r]=t[r]);return e}function deepCopy(e){let t,r,s;if(null==e)return{};if("object"!=typeof e||null===e)return e;for(s in t=Array.isArray(e)?[]:{},e)r=e[s],t[s]=deepCopy(r);return t}function isNumeric(e){var t=typeof e;return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))}function isEmptyObject(e){var t;for(t in e)return!1;return!0}function makeFunction(callback){return callback&&"string"==typeof callback&&(callback=eval("("+callback+")")),callback&&"function"!=typeof callback?null:callback}function adjustVolumeStyle(e){e&&(!e.volformat||e.voldata instanceof _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData||(e.voldata=new _VolumeData__WEBPACK_IMPORTED_MODULE_1__.VolumeData(e.voldata,e.volformat)),e.volscheme&&(e.volscheme=_Gradient__WEBPACK_IMPORTED_MODULE_0__.Gradient.getGradient(e.volscheme)))}function getExtent(e,t){var r,s,n,a,o,l,h,c,u,f,p=!t;if(r=s=n=9999,a=o=l=-9999,h=c=u=f=0,0===e.length)return[[0,0,0],[0,0,0],[0,0,0]];for(var g=0;gv.x?a:v.x,o=o>v.y?o:v.y,l=l>v.z?l:v.z,v.symmetries&&p))for(var _=0;_v.symmetries[_].x?a:v.symmetries[_].x,o=o>v.symmetries[_].y?o:v.symmetries[_].y,l=l>v.symmetries[_].z?l:v.symmetries[_].z}return[[r,s,n],[a,o,l],[h/f,c/f,u/f]]}function getPropertyRange(e,t){for(var r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=0,a=e.length;ns&&(s=o))}return isFinite(r)||isFinite(s)?isFinite(r)?isFinite(s)||(s=r):r=s:r=s=0,[r,s]}class PausableTimer{constructor(e,t,r){this.total_time_run=0,this.fn=e,this.arg=r,this.countdown=t,this.start_time=(new Date).getTime(),this.ident=setTimeout(e,t,r)}cancel(){clearTimeout(this.ident)}pause(){clearTimeout(this.ident),this.total_time_run=(new Date).getTime()-this.start_time}resume(){this.ident=setTimeout(this.fn,Math.max(0,this.countdown-this.total_time_run),this.arg)}}function base64ToArray(e){for(var t=window.atob(e),r=t.length,s=new Uint8Array(r),n=0;n=0?parseFloat(e):parseInt(e):"true"===e||"false"!==e&&e},r={};if("all"===(e=e.replace(/%7E/g,"~")))return r;for(var s=e.split(";"),n=0;ne.text()));return t?r.then(t):r}function getbin(e,t,r,s){var n;return n="POST"==r?fetch(e,{method:"POST",body:s}).then((e=>checkStatus(e))).then((e=>e.arrayBuffer())):fetch(e).then((e=>checkStatus(e))).then((e=>e.arrayBuffer())),t?n.then(t):n}function download(e,t,r,s){var n="",a="",o="",l="",h=null,c=t.addModel();if(e.indexOf(":")<0&&(e=4==e.length?"pdb:"+e:isNaN(e)?"url:"+e:"cid:"+e),"mmtf:"===e.substring(0,5))a=r&&r.pdbUri?r.pdbUri:"https://mmtf.rcsb.org/v1.0/full/",e=e.substring(5).toUpperCase(),l=a+e,r&&void 0===r.noComputeSecondaryStructure&&(r.noComputeSecondaryStructure=!0),h=new Promise((function(e){getbin(l).then((function(s){c.addMolData(s,"mmtf",r),t.zoomTo(),t.render(),e(c)}),(function(){console.log("fetch of "+l+" failed.")}))}));else{if("pdb:"===e.substring(0,4)){if(n="mmtf",r&&r.format&&(n=r.format),r&&void 0===r.noComputeSecondaryStructure&&(r.noComputeSecondaryStructure=!0),!(e=e.substring(4).toUpperCase()).match(/^[1-9][A-Za-z0-9]{3}$/))return void alert("Wrong PDB ID");"mmtf"==n?(o=r&&r.mmtfUri?r.mmtfUri:"https://mmtf.rcsb.org/v1.0/full/",l=o+e.toUpperCase()):(a=r&&r.pdbUri?r.pdbUri:"https://files.rcsb.org/view/",l=a+e+"."+n)}else if("cid:"==e.substring(0,4)){if(n="sdf",!(e=e.substring(4)).match(/^[0-9]+$/))return void alert("Wrong Compound ID");l="https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/"+e+"/SDF?record_type=3d"}else"url:"==e.substring(0,4)&&(l=e.substring(4),n=l);var u=function(e){c.addMolData(e,n,r),t.zoomTo(),t.render()};h=new Promise((function(t){"mmtf"==n?getbin(l).then((function(e){u(e),t(c)})).catch((function(){a=r&&r.pdbUri?r.pdbUri:"https://files.rcsb.org/view/",l=a+e+".pdb",n="pdb",console.log("falling back to pdb format"),get(l).then((function(e){u(e),t(c)})).catch((function(e){u(""),t(c),console.log("fetch of "+l+" failed: "+e.statusText)}))})):get(l).then((function(e){u(e),t(c)})).catch((function(e){u(""),t(c),console.log("fetch of "+l+" failed: "+e.statusText)}))}))}return s?(h.then((function(e){s(e)})),c):h}function getColorFromStyle(e,t){let r=t.colorscheme;if(void 0!==_colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[r])r=_colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[r];else if("string"==typeof r&&r.endsWith("Carbon")){let e=r.substring(0,r.lastIndexOf("Carbon")).toLowerCase();if(void 0!==_colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[e]){let t=Object.assign({},_colors__WEBPACK_IMPORTED_MODULE_2__.elementColors.defaultColors);t.C=_colors__WEBPACK_IMPORTED_MODULE_2__.htmlColors[e],_colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[r]={prop:"elem",map:t},r=_colors__WEBPACK_IMPORTED_MODULE_2__.builtinColorSchemes[r]}}let s=e.color;if(void 0!==t.color&&"spectrum"!=t.color&&(s=t.color),void 0!==r){let a,o;if(void 0!==_colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[r])r=_colors__WEBPACK_IMPORTED_MODULE_2__.elementColors[r],void 0!==r[e[r.prop]]&&(s=r.map[e[r.prop]]);else if(void 0!==r[e[r.prop]])s=r.map[e[r.prop]];else if(void 0!==r.prop&&void 0!==r.gradient){a=r.prop;var n=r.gradient;n instanceof _Gradient__WEBPACK_IMPORTED_MODULE_0__.GradientType||(n=(0,_Gradient__WEBPACK_IMPORTED_MODULE_0__.getGradient)(r));let t=n.range()||[-1,1];o=getAtomProperty(e,a),null!=o&&(s=n.valueToHex(o,t))}else void 0!==r.prop&&void 0!==r.map?(a=r.prop,o=getAtomProperty(e,a),void 0!==r.map[o]&&(s=r.map[o])):void 0!==t.colorscheme[e.elem]?s=t.colorscheme[e.elem]:console.log("Could not interpret colorscheme "+r)}else void 0!==t.colorfunc&&(s=t.colorfunc(e));return _colors__WEBPACK_IMPORTED_MODULE_2__.CC.color(s)}function getElement(e){let t=e;return"string"==typeof e?t=document.querySelector("#"+e):"object"==typeof e&&e.get&&(t=e.get(0)),t}},2109:(e,t,r)=>{var s;s={},e.exports=s,function(e,t){e.toRGBA8=function(t){var r=t.width,s=t.height;if(null==t.tabs.acTL)return[e.toRGBA8.decodeImage(t.data,r,s,t).buffer];var n=[];null==t.frames[0].data&&(t.frames[0].data=t.data);for(var a,o=new Uint8Array(r*s*4),l=0;l>3)]>>7-((7&v)<<0)&1);h[E]=A[T],h[E+1]=A[T+1],h[E+2]=A[T+2],h[E+3]=k>2)]>>6-((3&v)<<1)&3),h[E]=A[T],h[E+1]=A[T+1],h[E+2]=A[T+2],h[E+3]=k>1)]>>4-((1&v)<<2)&15),h[E]=A[T],h[E+1]=A[T+1],h[E+2]=A[T+2],h[E+3]=k>3]>>7-(7&v)&1))==255*y?0:255;c[v]=D<<24|I<<16|I<<8|I}if(2==f)for(v=0;v>2]>>6-((3&v)<<1)&3))==85*y?0:255,c[v]=D<<24|I<<16|I<<8|I;if(4==f)for(v=0;v>1]>>4-((1&v)<<2)&15))==17*y?0:255,c[v]=D<<24|I<<16|I<<8|I;if(8==f)for(v=0;v>3,l=Math.ceil(s*a/8),h=new Uint8Array(n*l),c=0,u=[0,0,4,0,2,0,1],f=[0,4,0,2,0,1,0],p=[8,8,8,4,4,2,2],g=[8,8,4,4,2,2,1],v=0;v<7;){for(var _=p[v],y=g[v],b=0,w=0,x=u[v];x>3])>>7-(7&L)&1,h[M*l+(z>>3)]|=E<<7-((3&z)<<0)),2==a&&(E=(E=t[L>>3])>>6-(7&L)&3,h[M*l+(z>>2)]|=E<<6-((3&z)<<1)),4==a&&(E=(E=t[L>>3])>>4-(7&L)&15,h[M*l+(z>>1)]|=E<<4-((1&z)<<2)),a>=8)for(var T=M*l+z*o,k=0;k>3)+k];L+=a,z+=y}S++,M+=_}b*w!=0&&(c+=w*(1+C)),v+=1}return h},e.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},e.decode._filterZero=function(t,r,s,n,a){var o=e.decode._getBPP(r),l=Math.ceil(n*o/8),h=e.decode._paeth;o=Math.ceil(o/8);for(var c=0;c>1)&255;if(4==p)for(g=o;g>1)&255;for(g=o;g>1)&255}if(4==p){for(g=0;g>8&255,e[t+1]=255&r},readUint:function(e,t){return 16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3])},writeUint:function(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},readASCII:function(e,t,r){for(var s="",n=0;n=0&&l>=0?(f=g*t+v<<2,p=(l+g)*n+o+v<<2):(f=(-l+g)*t-o+v<<2,p=g*n+v<<2),0==h)s[p]=e[f],s[p+1]=e[f+1],s[p+2]=e[f+2],s[p+3]=e[f+3];else if(1==h){var _=e[f+3]*(1/255),y=e[f]*_,b=e[f+1]*_,w=e[f+2]*_,x=s[p+3]*(1/255),A=s[p]*x,C=s[p+1]*x,S=s[p+2]*x,M=1-_,z=_+x*M,L=0==z?0:1/z;s[p+3]=255*z,s[p+0]=(y+A*M)*L,s[p+1]=(b+C*M)*L,s[p+2]=(w+S*M)*L}else if(2==h)_=e[f+3],y=e[f],b=e[f+1],w=e[f+2],x=s[p+3],A=s[p],C=s[p+1],S=s[p+2],_==x&&y==A&&b==C&&w==S?(s[p]=0,s[p+1]=0,s[p+2]=0,s[p+3]=0):(s[p]=y,s[p+1]=b,s[p+2]=w,s[p+3]=_);else if(3==h){if(_=e[f+3],y=e[f],b=e[f+1],w=e[f+2],x=s[p+3],A=s[p],C=s[p+1],S=s[p+2],_==x&&y==A&&b==C&&w==S)continue;if(_<220&&x>20)return!1}return!0},e.encode=function(t,r,s,n,a,o){null==n&&(n=0),null==o&&(o=!1);for(var l=new Uint8Array(t[0].byteLength*t.length+100),h=[137,80,78,71,13,10,26,10],c=0;c<8;c++)l[c]=h[c];var u=8,f=e._bin,p=e.crc.crc,g=f.writeUint,v=f.writeUshort,_=f.writeASCII,y=e.encode.compressPNG(t,r,s,n,o);g(l,u,13),_(l,u+=4,"IHDR"),g(l,u+=4,r),g(l,u+=4,s),l[u+=4]=y.depth,l[++u]=y.ctype,l[++u]=0,l[++u]=0,l[++u]=0,g(l,++u,p(l,u-17,17)),g(l,u+=4,1),_(l,u+=4,"sRGB"),l[u+=4]=1,g(l,++u,p(l,u-5,5)),u+=4;var b=t.length>1;if(b&&(g(l,u,8),_(l,u+=4,"acTL"),g(l,u+=4,t.length),g(l,u+=4,0),g(l,u+=4,p(l,u-12,12)),u+=4),3==y.ctype){for(g(l,u,3*(E=y.plte.length)),_(l,u+=4,"PLTE"),u+=4,c=0;c>8&255,S=x>>16&255;l[u+w+0]=A,l[u+w+1]=C,l[u+w+2]=S}if(g(l,u+=3*E,p(l,u-3*E-4,3*E+4)),u+=4,y.gotAlpha){for(g(l,u,E),_(l,u+=4,"tRNS"),u+=4,c=0;c>24&255;g(l,u+=E,p(l,u-E-4,E+4)),u+=4}}for(var M=0,z=0;z=300))break}}var C=!!_&&a,S=b.length;S<=256&&0==o&&(h=S<=2?1:S<=4?2:S<=16?4:8,a&&(h=8),_=!0);var M=[];for(f=0;fV&&(V=W),Hj&&(j=H));var q=-1==V?1:(V-N+1)*(j-U+1);q>1)]|=y[L[X+W]]<<4-4*(1&W);else if(2==h)for(W=0;W>2)]|=y[L[X+W]]<<6-2*(3&W);else if(1==h)for(W=0;W>3)]|=y[L[X+W]]<<7-1*(7&W)}z=Y,l=3,c=1}else if(0==_&&1==t.length){Y=new Uint8Array(k*I*3);var K=k*I;for(v=0;v5e5)||2!=h&&3!=h&&4!=h){for(var c=0;c>1)+256&255;if(4==o)for(u=a;u>1)&255;for(u=a;u>1)&255}if(4==o){for(u=0;u>>1:r>>>=1;e[t]=r}return e}(),update:function(t,r,s,n){for(var a=0;a>>8;return t},crc:function(t,r,s){return 4294967295^e.crc.update(4294967295,t,r,s)}},e.quantize=function(t,r,s){for(var n=[],a=0,o=0;o_&&(_=v[o].est.L,y=o);if(_<.001)break;var b=v[y],w=e.quantize.splitPixels(l,h,b.i0,b.i1,b.est.e,b.est.eMq255),x={i0:b.i0,i1:w,bst:null,est:null,tdst:0,left:null,right:null};x.bst=e.quantize.stats(l,x.i0,x.i1),x.est=e.quantize.estats(x.bst);var A={i0:w,i1:b.i1,bst:null,est:null,tdst:0,left:null,right:null};for(A.bst={R:[],m:[],N:b.bst.N-x.bst.N},o=0;o<16;o++)A.bst.R[o]=b.bst.R[o]-x.bst.R[o];for(o=0;o<4;o++)A.bst.m[o]=b.bst.m[o]-x.bst.m[o];A.est=e.quantize.estats(A.bst),b.left=x,b.right=A,v[y]=x,v.push(A)}v.sort((function(e,t){return t.bst.N-e.bst.N}));for(var C=0;C>2]=O.est.rgba}n[C]=z.buffer}return{bufs:n,plte:v}},e.quantize.getNearest=function(t,r,s,n,a){if(null==t.left)return t.tdst=e.quantize.dist(t.est.q,r,s,n,a),t;var o=e.quantize.planeDst(t.est,r,s,n,a),l=t.left,h=t.right;o>0&&(l=t.right,h=t.left);var c=e.quantize.getNearest(l,r,s,n,a);if(c.tdst<=o*o)return c;var u=e.quantize.getNearest(h,r,s,n,a);return u.tdsto;)n-=4;if(s>=n)break;var h=r[s>>2];r[s>>2]=r[n>>2],r[n>>2]=h,s+=4,n-=4}for(;l(t,s,a)>o;)s-=4;return s+4},e.quantize.vecDot=function(e,t,r){return e[t]*r[0]+e[t+1]*r[1]+e[t+2]*r[2]+e[t+3]*r[3]},e.quantize.stats=function(e,t,r){for(var s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=[0,0,0,0],a=r-t>>2,o=t;o>>0}},e.M4={multVec:function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]]},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},sml:function(e,t){return[e*t[0],e*t[1],e*t[2],e*t[3]]}},e.encode.alphaMul=function(e,t){for(var r=new Uint8Array(e.length),s=e.length>>2,n=0;n{"use strict";var s={};(0,r(6296).assign)(s,r(7434),r(6988),r(5642)),e.exports=s},7434:(e,t,r)=>{"use strict";var s=r(9892),n=r(6296),a=r(3963),o=r(5795),l=r(6866),h=Object.prototype.toString,c=0,u=-1,f=0,p=8;function g(e){if(!(this instanceof g))return new g(e);this.options=n.assign({level:u,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var r=s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==c)throw new Error(o[r]);if(t.header&&s.deflateSetHeader(this.strm,t.header),t.dictionary){var v;if(v="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===h.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=s.deflateSetDictionary(this.strm,v))!==c)throw new Error(o[r]);this._dict_set=!0}}function v(e,t){var r=new g(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}g.prototype.push=function(e,t){var r,o,l=this.strm,u=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?l.input=a.string2buf(e):"[object ArrayBuffer]"===h.call(e)?l.input=new Uint8Array(e):l.input=e,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new n.Buf8(u),l.next_out=0,l.avail_out=u),1!==(r=s.deflate(l,o))&&r!==c)return this.onEnd(r),this.ended=!0,!1;0!==l.avail_out&&(0!==l.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(a.buf2binstring(n.shrinkBuf(l.output,l.next_out))):this.onData(n.shrinkBuf(l.output,l.next_out)))}while((l.avail_in>0||0===l.avail_out)&&1!==r);return 4===o?(r=s.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===c):2!==o||(this.onEnd(c),l.avail_out=0,!0)},g.prototype.onData=function(e){this.chunks.push(e)},g.prototype.onEnd=function(e){e===c&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=g,t.deflate=v,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,v(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,v(e,t)}},6988:(e,t,r)=>{"use strict";var s=r(5356),n=r(6296),a=r(3963),o=r(5642),l=r(5795),h=r(6866),c=r(8772),u=Object.prototype.toString;function f(e){if(!(this instanceof f))return new f(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var r=s.inflateInit2(this.strm,t.windowBits);if(r!==o.Z_OK)throw new Error(l[r]);if(this.header=new c,s.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=a.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=s.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(l[r])}function p(e,t){var r=new f(t);if(r.push(e,!0),r.err)throw r.msg||l[r.err];return r.result}f.prototype.push=function(e,t){var r,l,h,c,f,p=this.strm,g=this.options.chunkSize,v=this.options.dictionary,_=!1;if(this.ended)return!1;l=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?p.input=a.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?p.input=new Uint8Array(e):p.input=e,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new n.Buf8(g),p.next_out=0,p.avail_out=g),(r=s.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&v&&(r=s.inflateSetDictionary(this.strm,v)),r===o.Z_BUF_ERROR&&!0===_&&(r=o.Z_OK,_=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&r!==o.Z_STREAM_END&&(0!==p.avail_in||l!==o.Z_FINISH&&l!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(h=a.utf8border(p.output,p.next_out),c=p.next_out-h,f=a.buf2string(p.output,h),p.next_out=c,p.avail_out=g-c,c&&n.arraySet(p.output,p.output,h,c,0),this.onData(f)):this.onData(n.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(_=!0)}while((p.avail_in>0||0===p.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(l=o.Z_FINISH),l===o.Z_FINISH?(r=s.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):l!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),p.avail_out=0,!0)},f.prototype.onData=function(e){this.chunks.push(e)},f.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=f,t.inflate=p,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,p(e,t)},t.ungzip=p},6296:(e,t)=>{"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)s(r,n)&&(e[n]=r[n])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,s,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+s),n);else for(var a=0;a{"use strict";var s=r(6296),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){a=!1}for(var o=new s.Buf8(256),l=0;l<256;l++)o[l]=l>=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;function h(e,t){if(t<65534&&(e.subarray&&a||!e.subarray&&n))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var r="",o=0;o>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},t.buf2binstring=function(e){return h(e,e.length)},t.binstring2buf=function(e){for(var t=new s.Buf8(e.length),r=0,n=t.length;r4)c[s++]=65533,r+=a-1;else{for(n&=2===a?31:3===a?15:7;a>1&&r1?c[s++]=65533:n<65536?c[s++]=n:(n-=65536,c[s++]=55296|n>>10&1023,c[s++]=56320|1023&n)}return h(c,s)},t.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t}},7853:e=>{"use strict";e.exports=function(e,t,r,s){for(var n=65535&e|0,a=e>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(n=n+t[s++]|0)|0}while(--o);n%=65521,a%=65521}return n|a<<16|0}},5642:e=>{"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},5684:e=>{"use strict";var t=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();e.exports=function(e,r,s,n){var a=t,o=n+s;e^=-1;for(var l=n;l>>8^a[255&(e^r[l])];return-1^e}},9892:(e,t,r)=>{"use strict";var s,n=r(6296),a=r(5313),o=r(7853),l=r(5684),h=r(5795),c=0,u=4,f=0,p=-2,g=-1,v=4,_=2,y=8,b=9,w=286,x=30,A=19,C=2*w+1,S=15,M=3,z=258,L=z+M+1,E=42,T=103,k=113,I=666,O=1,D=2,F=3,R=4;function P(e,t){return e.msg=h[t],t}function G(e){return(e<<1)-(e>4?9:0)}function B(e){for(var t=e.length;--t>=0;)e[t]=0}function N(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function U(e,t){a._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,N(e.strm)}function V(e,t){e.pending_buf[e.pending++]=t}function j(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function H(e,t){var r,s,n=e.max_chain_length,a=e.strstart,o=e.prev_length,l=e.nice_match,h=e.strstart>e.w_size-L?e.strstart-(e.w_size-L):0,c=e.window,u=e.w_mask,f=e.prev,p=e.strstart+z,g=c[a+o-1],v=c[a+o];e.prev_length>=e.good_match&&(n>>=2),l>e.lookahead&&(l=e.lookahead);do{if(c[(r=t)+o]===v&&c[r+o-1]===g&&c[r]===c[a]&&c[++r]===c[a+1]){a+=2,r++;do{}while(c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&ao){if(e.match_start=t,o=s,s>=l)break;g=c[a+o-1],v=c[a+o]}}}while((t=f[t&u])>h&&0!=--n);return o<=e.lookahead?o:e.lookahead}function W(e){var t,r,s,a,h,c,u,f,p,g,v=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=v+(v-L)){n.arraySet(e.window,e.window,v,v,0),e.match_start-=v,e.strstart-=v,e.block_start-=v,t=r=e.hash_size;do{s=e.head[--t],e.head[t]=s>=v?s-v:0}while(--r);t=r=v;do{s=e.prev[--t],e.prev[t]=s>=v?s-v:0}while(--r);a+=v}if(0===e.strm.avail_in)break;if(c=e.strm,u=e.window,f=e.strstart+e.lookahead,p=a,g=void 0,(g=c.avail_in)>p&&(g=p),r=0===g?0:(c.avail_in-=g,n.arraySet(u,c.input,c.next_in,g,f),1===c.state.wrap?c.adler=o(c.adler,u,g,f):2===c.state.wrap&&(c.adler=l(c.adler,u,g,f)),c.next_in+=g,c.total_in+=g,g),e.lookahead+=r,e.lookahead+e.insert>=M)for(h=e.strstart-e.insert,e.ins_h=e.window[h],e.ins_h=(e.ins_h<=M&&(e.ins_h=(e.ins_h<=M)if(s=a._tr_tally(e,e.strstart-e.match_start,e.match_length-M),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=M){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=M&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=M-1)),e.prev_length>=M&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-M,s=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-M),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<15&&(l=2,s-=16),a<1||a>b||r!==y||s<8||s>15||t<0||t>9||o<0||o>v)return P(e,p);8===s&&(s=9);var h=new X;return e.state=h,h.strm=e,h.wrap=l,h.gzhead=null,h.w_bits=s,h.w_size=1<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(W(e),0===e.lookahead&&t===c)return O;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var s=e.block_start+r;if((0===e.strstart||e.strstart>=s)&&(e.lookahead=e.strstart-s,e.strstart=s,U(e,!1),0===e.strm.avail_out))return O;if(e.strstart-e.block_start>=e.w_size-L&&(U(e,!1),0===e.strm.avail_out))return O}return e.insert=0,t===u?(U(e,!0),0===e.strm.avail_out?F:R):(e.strstart>e.block_start&&(U(e,!1),e.strm.avail_out),O)})),new Z(4,4,8,4,q),new Z(4,5,16,8,q),new Z(4,6,32,32,q),new Z(4,4,16,16,Y),new Z(8,16,32,32,Y),new Z(8,16,128,128,Y),new Z(8,32,128,256,Y),new Z(32,128,258,1024,Y),new Z(32,258,258,4096,Y)],t.deflateInit=function(e,t){return Q(e,t,y,15,8,0)},t.deflateInit2=Q,t.deflateReset=$,t.deflateResetKeep=K,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?p:(e.state.gzhead=t,f):p},t.deflate=function(e,t){var r,n,o,h;if(!e||!e.state||t>5||t<0)return e?P(e,p):p;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===I&&t!==u)return P(e,0===e.avail_out?-5:p);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===E)if(2===n.wrap)e.adler=0,V(n,31),V(n,139),V(n,8),n.gzhead?(V(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),V(n,255&n.gzhead.time),V(n,n.gzhead.time>>8&255),V(n,n.gzhead.time>>16&255),V(n,n.gzhead.time>>24&255),V(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),V(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(V(n,255&n.gzhead.extra.length),V(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=l(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(V(n,0),V(n,0),V(n,0),V(n,0),V(n,0),V(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),V(n,3),n.status=k);else{var g=y+(n.w_bits-8<<4)<<8;g|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(g|=32),g+=31-g%31,n.status=k,j(n,g),0!==n.strstart&&(j(n,e.adler>>>16),j(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=l(e.adler,n.pending_buf,n.pending-o,o)),N(e),o=n.pending,n.pending!==n.pending_buf_size));)V(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=l(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=l(e.adler,n.pending_buf,n.pending-o,o)),N(e),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindexo&&(e.adler=l(e.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=l(e.adler,n.pending_buf,n.pending-o,o)),N(e),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindexo&&(e.adler=l(e.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.status=T)}else n.status=T;if(n.status===T&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&N(e),n.pending+2<=n.pending_buf_size&&(V(n,255&e.adler),V(n,e.adler>>8&255),e.adler=0,n.status=k)):n.status=k),0!==n.pending){if(N(e),0===e.avail_out)return n.last_flush=-1,f}else if(0===e.avail_in&&G(t)<=G(r)&&t!==u)return P(e,-5);if(n.status===I&&0!==e.avail_in)return P(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==c&&n.status!==I){var v=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(W(e),0===e.lookahead)){if(t===c)return O;break}if(e.match_length=0,r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(U(e,!1),0===e.strm.avail_out))return O}return e.insert=0,t===u?(U(e,!0),0===e.strm.avail_out?F:R):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?O:D}(n,t):3===n.strategy?function(e,t){for(var r,s,n,o,l=e.window;;){if(e.lookahead<=z){if(W(e),e.lookahead<=z&&t===c)return O;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=M&&e.strstart>0&&(s=l[n=e.strstart-1])===l[++n]&&s===l[++n]&&s===l[++n]){o=e.strstart+z;do{}while(s===l[++n]&&s===l[++n]&&s===l[++n]&&s===l[++n]&&s===l[++n]&&s===l[++n]&&s===l[++n]&&s===l[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=M?(r=a._tr_tally(e,1,e.match_length-M),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(U(e,!1),0===e.strm.avail_out))return O}return e.insert=0,t===u?(U(e,!0),0===e.strm.avail_out?F:R):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?O:D}(n,t):s[n.level].func(n,t);if(v!==F&&v!==R||(n.status=I),v===O||v===F)return 0===e.avail_out&&(n.last_flush=-1),f;if(v===D&&(1===t?a._tr_align(n):5!==t&&(a._tr_stored_block(n,0,0,!1),3===t&&(B(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),N(e),0===e.avail_out))return n.last_flush=-1,f}return t!==u?f:n.wrap<=0?1:(2===n.wrap?(V(n,255&e.adler),V(n,e.adler>>8&255),V(n,e.adler>>16&255),V(n,e.adler>>24&255),V(n,255&e.total_in),V(n,e.total_in>>8&255),V(n,e.total_in>>16&255),V(n,e.total_in>>24&255)):(j(n,e.adler>>>16),j(n,65535&e.adler)),N(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?f:1)},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==E&&69!==t&&73!==t&&91!==t&&t!==T&&t!==k&&t!==I?P(e,p):(e.state=null,t===k?P(e,-3):f):p},t.deflateSetDictionary=function(e,t){var r,s,a,l,h,c,u,g,v=t.length;if(!e||!e.state)return p;if(2===(l=(r=e.state).wrap)||1===l&&r.status!==E||r.lookahead)return p;for(1===l&&(e.adler=o(e.adler,t,v,0)),r.wrap=0,v>=r.w_size&&(0===l&&(B(r.head),r.strstart=0,r.block_start=0,r.insert=0),g=new n.Buf8(r.w_size),n.arraySet(g,t,v-r.w_size,r.w_size,0),t=g,v=r.w_size),h=e.avail_in,c=e.next_in,u=e.input,e.avail_in=v,e.next_in=0,e.input=t,W(r);r.lookahead>=M;){s=r.strstart,a=r.lookahead-(M-1);do{r.ins_h=(r.ins_h<{"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},7933:e=>{"use strict";e.exports=function(e,t){var r,s,n,a,o,l,h,c,u,f,p,g,v,_,y,b,w,x,A,C,S,M,z,L,E;r=e.state,s=e.next_in,L=e.input,n=s+(e.avail_in-5),a=e.next_out,E=e.output,o=a-(t-e.avail_out),l=a+(e.avail_out-257),h=r.dmax,c=r.wsize,u=r.whave,f=r.wnext,p=r.window,g=r.hold,v=r.bits,_=r.lencode,y=r.distcode,b=(1<>>=A=x>>>24,v-=A,0===(A=x>>>16&255))E[a++]=65535&x;else{if(!(16&A)){if(0==(64&A)){x=_[(65535&x)+(g&(1<>>=A,v-=A),v<15&&(g+=L[s++]<>>=A=x>>>24,v-=A,!(16&(A=x>>>16&255))){if(0==(64&A)){x=y[(65535&x)+(g&(1<h){e.msg="invalid distance too far back",r.mode=30;break e}if(g>>>=A,v-=A,S>(A=a-o)){if((A=S-A)>u&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(M=0,z=p,0===f){if(M+=c-A,A2;)E[a++]=z[M++],E[a++]=z[M++],E[a++]=z[M++],C-=3;C&&(E[a++]=z[M++],C>1&&(E[a++]=z[M++]))}else{M=a-S;do{E[a++]=E[M++],E[a++]=E[M++],E[a++]=E[M++],C-=3}while(C>2);C&&(E[a++]=E[M++],C>1&&(E[a++]=E[M++]))}break}}break}}while(s>3,g&=(1<<(v-=C<<3))-1,e.next_in=s,e.next_out=a,e.avail_in=s{"use strict";var s=r(6296),n=r(7853),a=r(5684),o=r(7933),l=r(6215),h=1,c=2,u=0,f=-2,p=1,g=12,v=30,_=852,y=592;function b(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function w(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function x(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=p,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(_),t.distcode=t.distdyn=new s.Buf32(y),t.sane=1,t.back=-1,u):f}function A(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,x(e)):f}function C(e,t){var r,s;return e&&e.state?(s=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?f:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=r,s.wbits=t,A(e))):f}function S(e,t){var r,s;return e?(s=new w,e.state=s,s.window=null,(r=C(e,t))!==u&&(e.state=null),r):f}var M,z,L=!0;function E(e){if(L){var t;for(M=new s.Buf32(512),z=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(l(h,e.lens,0,288,M,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;l(c,e.lens,0,32,z,0,e.work,{bits:5}),L=!1}e.lencode=M,e.lenbits=9,e.distcode=z,e.distbits=5}function T(e,t,r,n){var a,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(s.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>n&&(a=n),s.arraySet(o.window,t,r-n,a,o.wnext),(n-=a)?(s.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,r.check=a(r.check,W,2,0),S=0,M=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&S)<<8)+(S>>8))%31){e.msg="incorrect header check",r.mode=v;break}if(8!=(15&S)){e.msg="unknown compression method",r.mode=v;break}if(M-=4,N=8+(15&(S>>>=4)),0===r.wbits)r.wbits=N;else if(N>r.wbits){e.msg="invalid window size",r.mode=v;break}r.dmax=1<>8&1),512&r.flags&&(W[0]=255&S,W[1]=S>>>8&255,r.check=a(r.check,W,2,0)),S=0,M=0,r.mode=3;case 3:for(;M<32;){if(0===A)break e;A--,S+=_[w++]<>>8&255,W[2]=S>>>16&255,W[3]=S>>>24&255,r.check=a(r.check,W,4,0)),S=0,M=0,r.mode=4;case 4:for(;M<16;){if(0===A)break e;A--,S+=_[w++]<>8),512&r.flags&&(W[0]=255&S,W[1]=S>>>8&255,r.check=a(r.check,W,2,0)),S=0,M=0,r.mode=5;case 5:if(1024&r.flags){for(;M<16;){if(0===A)break e;A--,S+=_[w++]<>>8&255,r.check=a(r.check,W,2,0)),S=0,M=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((k=r.length)>A&&(k=A),k&&(r.head&&(N=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),s.arraySet(r.head.extra,_,w,k,N)),512&r.flags&&(r.check=a(r.check,_,k,w)),A-=k,w+=k,r.length-=k),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===A)break e;k=0;do{N=_[w+k++],r.head&&N&&r.length<65536&&(r.head.name+=String.fromCharCode(N))}while(N&&k>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=g;break;case 10:for(;M<32;){if(0===A)break e;A--,S+=_[w++]<>>=7&M,M-=7&M,r.mode=27;break}for(;M<3;){if(0===A)break e;A--,S+=_[w++]<>>=1)){case 0:r.mode=14;break;case 1:if(E(r),r.mode=20,6===t){S>>>=2,M-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=v}S>>>=2,M-=2;break;case 14:for(S>>>=7&M,M-=7&M;M<32;){if(0===A)break e;A--,S+=_[w++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=v;break}if(r.length=65535&S,S=0,M=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(k=r.length){if(k>A&&(k=A),k>C&&(k=C),0===k)break e;s.arraySet(y,_,w,k,x),A-=k,w+=k,C-=k,x+=k,r.length-=k;break}r.mode=g;break;case 17:for(;M<14;){if(0===A)break e;A--,S+=_[w++]<>>=5,M-=5,r.ndist=1+(31&S),S>>>=5,M-=5,r.ncode=4+(15&S),S>>>=4,M-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=v;break}r.have=0,r.mode=18;case 18:for(;r.have>>=3,M-=3}for(;r.have<19;)r.lens[q[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,V={bits:r.lenbits},U=l(0,r.lens,0,19,r.lencode,0,r.work,V),r.lenbits=V.bits,U){e.msg="invalid code lengths set",r.mode=v;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,R=65535&H,!((D=H>>>24)<=M);){if(0===A)break e;A--,S+=_[w++]<>>=D,M-=D,r.lens[r.have++]=R;else{if(16===R){for(j=D+2;M>>=D,M-=D,0===r.have){e.msg="invalid bit length repeat",r.mode=v;break}N=r.lens[r.have-1],k=3+(3&S),S>>>=2,M-=2}else if(17===R){for(j=D+3;M>>=D)),S>>>=3,M-=3}else{for(j=D+7;M>>=D)),S>>>=7,M-=7}if(r.have+k>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=v;break}for(;k--;)r.lens[r.have++]=N}}if(r.mode===v)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=v;break}if(r.lenbits=9,V={bits:r.lenbits},U=l(h,r.lens,0,r.nlen,r.lencode,0,r.work,V),r.lenbits=V.bits,U){e.msg="invalid literal/lengths set",r.mode=v;break}if(r.distbits=6,r.distcode=r.distdyn,V={bits:r.distbits},U=l(c,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,V),r.distbits=V.bits,U){e.msg="invalid distances set",r.mode=v;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(A>=6&&C>=258){e.next_out=x,e.avail_out=C,e.next_in=w,e.avail_in=A,r.hold=S,r.bits=M,o(e,L),x=e.next_out,y=e.output,C=e.avail_out,w=e.next_in,_=e.input,A=e.avail_in,S=r.hold,M=r.bits,r.mode===g&&(r.back=-1);break}for(r.back=0;F=(H=r.lencode[S&(1<>>16&255,R=65535&H,!((D=H>>>24)<=M);){if(0===A)break e;A--,S+=_[w++]<>P)])>>>16&255,R=65535&H,!(P+(D=H>>>24)<=M);){if(0===A)break e;A--,S+=_[w++]<>>=P,M-=P,r.back+=P}if(S>>>=D,M-=D,r.back+=D,r.length=R,0===F){r.mode=26;break}if(32&F){r.back=-1,r.mode=g;break}if(64&F){e.msg="invalid literal/length code",r.mode=v;break}r.extra=15&F,r.mode=22;case 22:if(r.extra){for(j=r.extra;M>>=r.extra,M-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;F=(H=r.distcode[S&(1<>>16&255,R=65535&H,!((D=H>>>24)<=M);){if(0===A)break e;A--,S+=_[w++]<>P)])>>>16&255,R=65535&H,!(P+(D=H>>>24)<=M);){if(0===A)break e;A--,S+=_[w++]<>>=P,M-=P,r.back+=P}if(S>>>=D,M-=D,r.back+=D,64&F){e.msg="invalid distance code",r.mode=v;break}r.offset=R,r.extra=15&F,r.mode=24;case 24:if(r.extra){for(j=r.extra;M>>=r.extra,M-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=v;break}r.mode=25;case 25:if(0===C)break e;if(k=L-C,r.offset>k){if((k=r.offset-k)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=v;break}k>r.wnext?(k-=r.wnext,I=r.wsize-k):I=r.wnext-k,k>r.length&&(k=r.length),O=r.window}else O=y,I=x-r.offset,k=r.length;k>C&&(k=C),C-=k,r.length-=k;do{y[x++]=O[I++]}while(--k);0===r.length&&(r.mode=21);break;case 26:if(0===C)break e;y[x++]=r.length,C--,r.mode=21;break;case 27:if(r.wrap){for(;M<32;){if(0===A)break e;A--,S|=_[w++]<{"use strict";var s=r(6296),n=15,a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],h=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(e,t,r,c,u,f,p,g){var v,_,y,b,w,x,A,C,S,M=g.bits,z=0,L=0,E=0,T=0,k=0,I=0,O=0,D=0,F=0,R=0,P=null,G=0,B=new s.Buf16(16),N=new s.Buf16(16),U=null,V=0;for(z=0;z<=n;z++)B[z]=0;for(L=0;L=1&&0===B[T];T--);if(k>T&&(k=T),0===T)return u[f++]=20971520,u[f++]=20971520,g.bits=1,0;for(E=1;E0&&(0===e||1!==T))return-1;for(N[1]=0,z=1;z852||2===e&&F>592)return 1;for(;;){A=z-O,p[L]x?(C=U[V+p[L]],S=P[G+p[L]]):(C=96,S=0),v=1<>O)+(_-=v)]=A<<24|C<<16|S|0}while(0!==_);for(v=1<>=1;if(0!==v?(R&=v-1,R+=v):R=0,L++,0==--B[z]){if(z===T)break;z=t[r+p[L]]}if(z>k&&(R&b)!==y){for(0===O&&(O=k),w+=E,D=1<<(I=z-O);I+O852||2===e&&F>592)return 1;u[y=R&b]=k<<24|I<<16|w-f|0}}return 0!==R&&(u[w+R]=z-O<<24|64<<16|0),g.bits=k,0}},5795:e=>{"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},5313:(e,t,r)=>{"use strict";var s=r(6296),n=0,a=1;function o(e){for(var t=e.length;--t>=0;)e[t]=0}var l=0,h=29,c=256,u=c+1+h,f=30,p=19,g=2*u+1,v=15,_=16,y=7,b=256,w=16,x=17,A=18,C=[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],S=[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],M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],L=new Array(2*(u+2));o(L);var E=new Array(2*f);o(E);var T=new Array(512);o(T);var k=new Array(256);o(k);var I=new Array(h);o(I);var O,D,F,R=new Array(f);function P(e,t,r,s,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=s,this.max_length=n,this.has_stree=e&&e.length}function G(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function B(e){return e<256?T[e]:T[256+(e>>>7)]}function N(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function U(e,t,r){e.bi_valid>_-r?(e.bi_buf|=t<>_-e.bi_valid,e.bi_valid+=r-_):(e.bi_buf|=t<>>=1,r<<=1}while(--t>0);return r>>>1}function H(e,t,r){var s,n,a=new Array(v+1),o=0;for(s=1;s<=v;s++)a[s]=o=o+r[s-1]<<1;for(n=0;n<=t;n++){var l=e[2*n+1];0!==l&&(e[2*n]=j(a[l]++,l))}}function W(e){var t;for(t=0;t8?N(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,r,s){var n=2*t,a=2*r;return e[n]>1;r>=1;r--)Z(e,a,r);n=h;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Z(e,a,1),s=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=s,a[2*n]=a[2*r]+a[2*s],e.depth[n]=(e.depth[r]>=e.depth[s]?e.depth[r]:e.depth[s])+1,a[2*r+1]=a[2*s+1]=n,e.heap[1]=n++,Z(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,s,n,a,o,l,h=t.dyn_tree,c=t.max_code,u=t.stat_desc.static_tree,f=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,_=t.stat_desc.extra_base,y=t.stat_desc.max_length,b=0;for(a=0;a<=v;a++)e.bl_count[a]=0;for(h[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;ry&&(a=y,b++),h[2*s+1]=a,s>c||(e.bl_count[a]++,o=0,s>=_&&(o=p[s-_]),l=h[2*s],e.opt_len+=l*(a+o),f&&(e.static_len+=l*(u[2*s+1]+o)));if(0!==b){do{for(a=y-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[y]--,b-=2}while(b>0);for(a=y;0!==a;a--)for(s=e.bl_count[a];0!==s;)(n=e.heap[--r])>c||(h[2*n+1]!==a&&(e.opt_len+=(a-h[2*n+1])*h[2*n],h[2*n+1]=a),s--)}}(e,t),H(a,c,e.bl_count)}function $(e,t,r){var s,n,a=-1,o=t[1],l=0,h=7,c=4;for(0===o&&(h=138,c=3),t[2*(r+1)+1]=65535,s=0;s<=r;s++)n=o,o=t[2*(s+1)+1],++l>=7;s0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return a;for(t=32;t=3&&0===e.bl_tree[2*z[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=o&&(o=l)):o=l=r+5,r+4<=o&&-1!==t?ee(e,t,r,s):4===e.strategy||l===o?(U(e,2+(s?1:0),3),X(e,L,E)):(U(e,4+(s?1:0),3),function(e,t,r,s){var n;for(U(e,t-257,5),U(e,r-1,5),U(e,s-4,4),n=0;n>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(k[r]+c+1)]++,e.dyn_dtree[2*B(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){U(e,2,3),V(e,b,L),function(e){16===e.bi_valid?(N(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},6866:e=>{"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},7882:()=>{$3Dmol.workerString=function(){self.onmessage=function(e){var t=e.data,r=t.type;if(r<0)self.atomData=t.atoms,self.volume=t.volume,self.ps=new ProteinSurface;else{var s=self.ps;s.initparm(t.expandedExtent,1!=r,self.volume),s.fillvoxels(self.atomData,t.extendedAtoms),s.buildboundary(),4!==r&&2!==r||(s.fastdistancemap(),s.boundingatom(!1),s.fillvoxelswaals(self.atomData,t.extendedAtoms)),s.marchingcube(r);var n=s.getFacesAndVertices(t.atomsToShow);self.postMessage(n)}}}.toString().replace(/(^.*?\{|\}$)/g,""),$3Dmol.workerString+=";\nfunction _classCallCheck() {};",$3Dmol.workerString+=";\n"+$3Dmol.Vector3.toString(),$3Dmol.workerString+=";\n"+$3Dmol.MarchingCubeInitializer.toString()+";\n\n",$3Dmol.workerString+=";\n"+$3Dmol.PointGrid.toString()+";\n",$3Dmol.workerString+=";\nvar ProteinSurface = "+$3Dmol.ProteinSurface.toString()+";\n",$3Dmol.SurfaceWorker=window.URL?window.URL.createObjectURL(new Blob([$3Dmol.workerString],{type:"text/javascript"})):void 0},6279:e=>{"object"==typeof e.exports&&(e.exports=window.$3Dmol)},7420:function(e,t){!function(e){"use strict";function t(e,t,r){for(var s=(e.byteLength,0),n=r.length;n>s;s++){var a=r.charCodeAt(s);if(128>a)e.setUint8(t++,a>>>0&127|0);else if(2048>a)e.setUint8(t++,a>>>6&31|192),e.setUint8(t++,a>>>0&63|128);else if(65536>a)e.setUint8(t++,a>>>12&15|224),e.setUint8(t++,a>>>6&63|128),e.setUint8(t++,a>>>0&63|128);else{if(!(1114112>a))throw new Error("bad codepoint "+a);e.setUint8(t++,a>>>18&7|240),e.setUint8(t++,a>>>12&63|128),e.setUint8(t++,a>>>6&63|128),e.setUint8(t++,a>>>0&63|128)}}}function r(e){for(var t=0,r=0,s=e.length;s>r;r++){var n=e.charCodeAt(r);if(128>n)t+=1;else if(2048>n)t+=2;else if(65536>n)t+=3;else{if(!(1114112>n))throw new Error("bad codepoint "+n);t+=4}}return t}function s(e,n,a){var o=typeof e;if("string"===o){if(32>(l=r(e)))return n.setUint8(a,160|l),t(n,a+1,e),1+l;if(256>l)return n.setUint8(a,217),n.setUint8(a+1,l),t(n,a+2,e),2+l;if(65536>l)return n.setUint8(a,218),n.setUint16(a+1,l),t(n,a+3,e),3+l;if(4294967296>l)return n.setUint8(a,219),n.setUint32(a+1,l),t(n,a+5,e),5+l}if(e instanceof Uint8Array){var l=e.byteLength,h=new Uint8Array(n.buffer);if(256>l)return n.setUint8(a,196),n.setUint8(a+1,l),h.set(e,a+2),2+l;if(65536>l)return n.setUint8(a,197),n.setUint16(a+1,l),h.set(e,a+3),3+l;if(4294967296>l)return n.setUint8(a,198),n.setUint32(a+1,l),h.set(e,a+5),5+l}if("number"===o){if(!isFinite(e))throw new Error("Number not finite: "+e);if(Math.floor(e)!==e)return n.setUint8(a,203),n.setFloat64(a+1,e),9;if(e>=0){if(128>e)return n.setUint8(a,e),1;if(256>e)return n.setUint8(a,204),n.setUint8(a+1,e),2;if(65536>e)return n.setUint8(a,205),n.setUint16(a+1,e),3;if(4294967296>e)return n.setUint8(a,206),n.setUint32(a+1,e),5;throw new Error("Number too big 0x"+e.toString(16))}if(e>=-32)return n.setInt8(a,e),1;if(e>=-128)return n.setUint8(a,208),n.setInt8(a+1,e),2;if(e>=-32768)return n.setUint8(a,209),n.setInt16(a+1,e),3;if(e>=-2147483648)return n.setUint8(a,210),n.setInt32(a+1,e),5;throw new Error("Number too small -0x"+(-e).toString(16).substr(1))}if(null===e)return n.setUint8(a,192),1;if("boolean"===o)return n.setUint8(a,e?195:194),1;if("object"===o){var c=0,u=Array.isArray(e);if(u)l=e.length;else{var f=Object.keys(e);l=f.length}if(16>l?(n.setUint8(a,l|(u?144:128)),c=1):65536>l?(n.setUint8(a,u?220:222),n.setUint16(a+1,l),c=3):4294967296>l&&(n.setUint8(a,u?221:223),n.setUint32(a+1,l),c=5),u)for(var p=0;l>p;p++)c+=s(e[p],n,a+c);else for(p=0;l>p;p++){var g=f[p];c+=s(g,n,a+c),c+=s(e[g],n,a+c)}return c}throw new Error("Unknown type "+o)}function n(e){var t=typeof e;if("string"===t){if(32>(s=r(e)))return 1+s;if(256>s)return 2+s;if(65536>s)return 3+s;if(4294967296>s)return 5+s}if(e instanceof Uint8Array){if(256>(s=e.byteLength))return 2+s;if(65536>s)return 3+s;if(4294967296>s)return 5+s}if("number"===t){if(Math.floor(e)!==e)return 9;if(e>=0){if(128>e)return 1;if(256>e)return 2;if(65536>e)return 3;if(4294967296>e)return 5;throw new Error("Number too big 0x"+e.toString(16))}if(e>=-32)return 1;if(e>=-128)return 2;if(e>=-32768)return 3;if(e>=-2147483648)return 5;throw new Error("Number too small -0x"+e.toString(16).substr(1))}if("boolean"===t||null===e)return 1;if("object"===t){var s,a=0;if(Array.isArray(e)){s=e.length;for(var o=0;s>o;o++)a+=n(e[o])}else{var l=Object.keys(e);for(s=l.length,o=0;s>o;o++){var h=l[o];a+=n(h)+n(e[h])}}if(16>s)return 1+a;if(65536>s)return 3+a;if(4294967296>s)return 5+a;throw new Error("Array or object too long 0x"+s.toString(16))}throw new Error("Unknown type "+t)}function a(e){var t=new ArrayBuffer(n(e));return s(e,new DataView(t),0),new Uint8Array(t)}function o(e,t,r){return t?new e(t.buffer,t.byteOffset,t.byteLength/(r||1)):void 0}function l(e){return o(DataView,e)}function h(e){return o(Uint8Array,e)}function c(e){return o(Int8Array,e)}function u(e){return o(Int32Array,e,4)}function f(e){return o(Float32Array,e,4)}function p(e,t){var r=e.length/2;t||(t=new Int16Array(r));for(var s=0,n=0;r>s;++s,n+=2)t[s]=e[n]<<8^e[n+1]<<0;return t}function g(e,t){var r=e.length;t||(t=new Uint8Array(2*r));for(var s=l(t),n=0;r>n;++n)s.setInt16(2*n,e[n]);return h(t)}function v(e,t){var r=e.length/4;t||(t=new Int32Array(r));for(var s=0,n=0;r>s;++s,n+=4)t[s]=e[n]<<24^e[n+1]<<16^e[n+2]<<8^e[n+3]<<0;return t}function _(e,t){var r=e.length;t||(t=new Uint8Array(4*r));for(var s=l(t),n=0;r>n;++n)s.setInt32(4*n,e[n]);return h(t)}function y(e,t){var r=e.length;t||(t=new Float32Array(r/4));for(var s=l(t),n=l(e),a=0,o=0,h=r/4;h>a;++a,o+=4)s.setFloat32(o,n.getFloat32(o),!0);return t}function b(e,t,r){var s=e.length,n=1/t;r||(r=new Float32Array(s));for(var a=0;s>a;++a)r[a]=e[a]*n;return r}function w(e,t,r){var s=e.length;r||(r=new Int32Array(s));for(var n=0;s>n;++n)r[n]=Math.round(e[n]*t);return r}function x(e,t){var r,s;if(!t){var n=0;for(r=0,s=e.length;s>r;r+=2)n+=e[r+1];t=new e.constructor(n)}var a=0;for(r=0,s=e.length;s>r;r+=2)for(var o=e[r],l=e[r+1],h=0;l>h;++h)t[a]=o,++a;return t}function A(e){if(0===e.length)return new Int32Array;var t,r,s=2;for(t=1,r=e.length;r>t;++t)e[t-1]!==e[t]&&(s+=2);var n=new Int32Array(s),a=0,o=1;for(t=1,r=e.length;r>t;++t)e[t-1]!==e[t]?(n[a]=e[t-1],n[a+1]=o,o=1,a+=2):++o;return n[a]=e[e.length-1],n[a+1]=o,n}function C(e,t){var r=e.length;t||(t=new e.constructor(r)),r&&(t[0]=e[0]);for(var s=1;r>s;++s)t[s]=e[s]+t[s-1];return t}function S(e,t){var r=e.length;t||(t=new e.constructor(r)),t[0]=e[0];for(var s=1;r>s;++s)t[s]=e[s]-e[s-1];return t}function M(e,t){var r,s,n=e instanceof Int8Array?127:32767,a=-n-1,o=e.length;if(!t){var l=0;for(r=0;o>r;++r)e[r]a&&++l;t=new Int32Array(l)}for(r=0,s=0;o>r;){for(var h=0;e[r]===n||e[r]===a;)h+=e[r],++r;h+=e[r],++r,t[s]=h,++s}return t}function z(e,t){var r,s=t?127:32767,n=-s-1,a=e.length,o=0;for(r=0;a>r;++r)0===(c=e[r])?++o:c>0?(o+=Math.ceil(c/s),c%s==0&&(o+=1)):(o+=Math.ceil(c/n),c%n==0&&(o+=1));var l=t?new Int8Array(o):new Int16Array(o),h=0;for(r=0;a>r;++r){var c;if((c=e[r])>=0)for(;c>=s;)l[h]=s,++h,c-=s;else for(;n>=c;)l[h]=n,++h,c-=n;l[h]=c,++h}return l}function L(e,t){return C(x(e),t)}function E(e){return A(S(e))}function T(e,t,r){return b(x(e,u(r)),t,r)}function k(e,t){return A(w(e,t))}function I(e,t,r){return b(C(e,u(r)),t,r)}function O(e,t,r){return S(w(e,t),r)}function D(e,t,r){return b(M(e,u(r)),t,r)}function F(e,t,r){var s=M(e,u(r));return I(s,t,f(s))}function R(e,t,r){return z(O(e,t),r)}function P(e){var t=l(e),r=t.getInt32(0),s=t.getInt32(4),n=e.subarray(8,12);return[r,e=e.subarray(12),s,n]}function G(e,t,r,s){var n=new ArrayBuffer(12+s.byteLength),a=new Uint8Array(n),o=new DataView(n);return o.setInt32(0,e),o.setInt32(4,t),r&&a.set(r,8),a.set(s,12),a}function B(e){return G(2,e.length,void 0,h(e))}function N(e){return G(4,e.length,void 0,_(e))}function U(e,t){return G(5,e.length/t,_([t]),h(e))}function V(e){return G(6,e.length,void 0,_(A(e)))}function j(e){return G(8,e.length,void 0,_(E(e)))}function H(e,t){return G(9,e.length,_([t]),_(k(e,t)))}function W(e,t){return G(10,e.length,_([t]),g(R(e,t)))}function q(e){var t={};return re.forEach((function(r){void 0!==e[r]&&(t[r]=e[r])})),e.bondAtomList&&(t.bondAtomList=N(e.bondAtomList)),e.bondOrderList&&(t.bondOrderList=B(e.bondOrderList)),t.xCoordList=W(e.xCoordList,1e3),t.yCoordList=W(e.yCoordList,1e3),t.zCoordList=W(e.zCoordList,1e3),e.bFactorList&&(t.bFactorList=W(e.bFactorList,100)),e.atomIdList&&(t.atomIdList=j(e.atomIdList)),e.altLocList&&(t.altLocList=V(e.altLocList)),e.occupancyList&&(t.occupancyList=H(e.occupancyList,100)),t.groupIdList=j(e.groupIdList),t.groupTypeList=N(e.groupTypeList),e.secStructList&&(t.secStructList=B(e.secStructList)),e.insCodeList&&(t.insCodeList=V(e.insCodeList)),e.sequenceIndexList&&(t.sequenceIndexList=j(e.sequenceIndexList)),t.chainIdList=U(e.chainIdList,4),e.chainNameList&&(t.chainNameList=U(e.chainNameList,4)),t}function Y(e){function t(e){for(var t={},r=0;e>r;r++)t[a()]=a();return t}function r(t){var r=e.subarray(o,o+t);return o+=t,r}function s(t){var r=e.subarray(o,o+t);o+=t;var s=65535;if(t>s){for(var n=[],a=0;ar;r++)t[r]=a();return t}function a(){var a,h,c=e[o];if(0==(128&c))return o++,c;if(128==(240&c))return o++,t(h=15&c);if(144==(240&c))return o++,n(h=15&c);if(160==(224&c))return o++,s(h=31&c);if(224==(224&c))return a=l.getInt8(o),o++,a;switch(c){case 192:return o++,null;case 194:return o++,!1;case 195:return o++,!0;case 196:return h=l.getUint8(o+1),o+=2,r(h);case 197:return h=l.getUint16(o+1),o+=3,r(h);case 198:return h=l.getUint32(o+1),o+=5,r(h);case 202:return a=l.getFloat32(o+1),o+=5,a;case 203:return a=l.getFloat64(o+1),o+=9,a;case 204:return a=e[o+1],o+=2,a;case 205:return a=l.getUint16(o+1),o+=3,a;case 206:return a=l.getUint32(o+1),o+=5,a;case 208:return a=l.getInt8(o+1),o+=2,a;case 209:return a=l.getInt16(o+1),o+=3,a;case 210:return a=l.getInt32(o+1),o+=5,a;case 217:return h=l.getUint8(o+1),o+=2,s(h);case 218:return h=l.getUint16(o+1),o+=3,s(h);case 219:return h=l.getUint32(o+1),o+=5,s(h);case 220:return h=l.getUint16(o+1),o+=3,n(h);case 221:return h=l.getUint32(o+1),o+=5,n(h);case 222:return h=l.getUint16(o+1),o+=3,t(h);case 223:return h=l.getUint32(o+1),o+=5,t(h)}throw new Error("Unknown type 0x"+c.toString(16))}var o=0,l=new DataView(e.buffer);return a()}function Z(e,t,r,s){switch(e){case 1:return y(t);case 2:return c(t);case 3:return p(t);case 4:return v(t);case 5:return h(t);case 6:return x(v(t),new Uint8Array(r));case 7:return x(v(t));case 8:return L(v(t));case 9:return T(v(t),v(s)[0]);case 10:return F(p(t),v(s)[0]);case 11:return b(p(t),v(s)[0]);case 12:return D(p(t),v(s)[0]);case 13:return D(c(t),v(s)[0]);case 14:return M(p(t));case 15:return M(c(t))}}function X(e,t){var r=(t=t||{}).ignoreFields,s={};return ne.forEach((function(t){var n=!!r&&-1!==r.indexOf(t),a=e[t];n||void 0===a||(a instanceof Uint8Array?s[t]=Z.apply(null,P(a)):s[t]=a)})),s}function K(e){return String.fromCharCode.apply(null,e).replace(/\0/g,"")}function $(e,t,r){var s,n,a,o,l,h,c=(r=r||{}).firstModelOnly,u=t.onModel,f=t.onChain,p=t.onGroup,g=t.onAtom,v=t.onBond,_=0,y=0,b=0,w=0,x=0,A=-1,C=e.chainNameList,S=e.secStructList,M=e.insCodeList,z=e.sequenceIndexList,L=e.atomIdList,E=e.bFactorList,T=e.altLocList,k=e.occupancyList,I=e.bondAtomList,O=e.bondOrderList;for(s=0,n=e.chainsPerModel.length;n>s&&!(c&&_>0);++s){var D=e.chainsPerModel[_];for(u&&u({chainCount:D,modelIndex:_}),a=0;D>a;++a){var F=e.groupsPerChain[y];if(f){var R=K(e.chainIdList.subarray(4*y,4*y+4)),P=null;C&&(P=K(C.subarray(4*y,4*y+4))),f({groupCount:F,chainIndex:y,modelIndex:_,chainId:R,chainName:P})}for(o=0;F>o;++o){var G=e.groupList[e.groupTypeList[b]],B=G.atomNameList.length;if(p){var N=null;S&&(N=S[b]);var U=null;e.insCodeList&&(U=String.fromCharCode(M[b]));var V=null;z&&(V=z[b]),p({atomCount:B,groupIndex:b,chainIndex:y,modelIndex:_,groupId:e.groupIdList[b],groupType:e.groupTypeList[b],groupName:G.groupName,singleLetterCode:G.singleLetterCode,chemCompType:G.chemCompType,secStruct:N,insCode:U,sequenceIndex:V})}for(l=0;B>l;++l){if(g){var j=null;L&&(j=L[w]);var H=null;E&&(H=E[w]);var W=null;T&&(W=String.fromCharCode(T[w]));var q=null;k&&(q=k[w]),g({atomIndex:w,groupIndex:b,chainIndex:y,modelIndex:_,atomId:j,element:G.elementList[l],atomName:G.atomNameList[l],formalCharge:G.formalChargeList[l],xCoord:e.xCoordList[w],yCoord:e.yCoordList[w],zCoord:e.zCoordList[w],bFactor:H,altLoc:W,occupancy:q})}w+=1}if(v){var Y=G.bondAtomList;for(l=0,h=G.bondOrderList.length;h>l;++l)v({atomIndex1:w-B+Y[2*l],atomIndex2:w-B+Y[2*l+1],bondOrder:G.bondOrderList[l]})}b+=1}y+=1}if(x=A+1,A=w-1,v&&I)for(l=0,h=I.length;h>l;l+=2){var Z=I[l],X=I[l+1];(Z>=x&&A>=Z||X>=x&&A>=X)&&v({atomIndex1:Z,atomIndex2:X,bondOrder:O?O[l/2]:null})}_+=1}}function Q(e){return a(q(e))}function J(e,t){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),X(e instanceof Uint8Array?Y(e):e,t)}function ee(e,t,r,s){function n(){try{var e=J(a.response);r(e)}catch(e){s(e)}}var a=new XMLHttpRequest;a.addEventListener("load",n,!0),a.addEventListener("error",s,!0),a.responseType="arraybuffer",a.open("GET",t+e.toUpperCase()),a.send()}function te(e,t,r){ee(e,le,t,r)}function ie(e,t,r){ee(e,he,t,r)}var re=["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","ncsOperatorList","entityList","groupList","numBonds","numAtoms","numGroups","numChains","numModels","groupsPerChain","chainsPerModel"],se=["xCoordList","yCoordList","zCoordList","groupIdList","groupTypeList","chainIdList","bFactorList","atomIdList","altLocList","occupancyList","secStructList","insCodeList","sequenceIndexList","chainNameList","bondAtomList","bondOrderList"],ne=re.concat(se),ae="v1.0.1",oe="//mmtf.rcsb.org/v1.0/",le=oe+"full/",he=oe+"reduced/";e.encode=Q,e.decode=J,e.traverse=$,e.fetch=te,e.fetchReduced=ie,e.version=ae,e.fetchUrl=le,e.fetchReducedUrl=he,e.encodeMsgpack=a,e.encodeMmtf=q,e.decodeMsgpack=Y,e.decodeMmtf=X}(t)},7885:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Deflate:()=>yi,Inflate:()=>Ai,constants:()=>zi,default:()=>Li,deflate:()=>bi,deflateRaw:()=>wi,gzip:()=>xi,inflate:()=>Ci,inflateRaw:()=>Si,ungzip:()=>Mi});function s(e){let t=e.length;for(;--t>=0;)e[t]=0}const n=256,a=286,o=30,l=15,h=new Uint8Array([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]),c=new Uint8Array([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]),u=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),f=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p=new Array(576);s(p);const g=new Array(60);s(g);const v=new Array(512);s(v);const _=new Array(256);s(_);const y=new Array(29);s(y);const b=new Array(o);function w(e,t,r,s,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=s,this.max_length=n,this.has_stree=e&&e.length}let x,A,C;function S(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}s(b);const M=e=>e<256?v[e]:v[256+(e>>>7)],z=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},L=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<{L(e,r[2*t],r[2*t+1])},T=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},k=(e,t,r)=>{const s=new Array(16);let n,a,o=0;for(n=1;n<=l;n++)o=o+r[n-1]<<1,s[n]=o;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=T(s[t]++,t))}},I=e=>{let t;for(t=0;t{e.bi_valid>8?z(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},D=(e,t,r,s)=>{const n=2*t,a=2*r;return e[n]{const s=e.heap[r];let n=r<<1;for(;n<=e.heap_len&&(n{let s,a,o,l,u=0;if(0!==e.sym_next)do{s=255&e.pending_buf[e.sym_buf+u++],s+=(255&e.pending_buf[e.sym_buf+u++])<<8,a=e.pending_buf[e.sym_buf+u++],0===s?E(e,a,t):(o=_[a],E(e,o+n+1,t),l=h[o],0!==l&&(a-=y[o],L(e,a,l)),s--,o=M(s),E(e,o,r),l=c[o],0!==l&&(s-=b[o],L(e,s,l)))}while(u{const r=t.dyn_tree,s=t.stat_desc.static_tree,n=t.stat_desc.has_stree,a=t.stat_desc.elems;let o,h,c,u=-1;for(e.heap_len=0,e.heap_max=573,o=0;o>1;o>=1;o--)F(e,r,o);c=a;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],F(e,r,1),h=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=h,r[2*c]=r[2*o]+r[2*h],e.depth[c]=(e.depth[o]>=e.depth[h]?e.depth[o]:e.depth[h])+1,r[2*o+1]=r[2*h+1]=c,e.heap[1]=c++,F(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,s=t.max_code,n=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,f,p,g,v,_,y=0;for(g=0;g<=l;g++)e.bl_count[g]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)f=e.heap[u],g=r[2*r[2*f+1]+1]+1,g>c&&(g=c,y++),r[2*f+1]=g,f>s||(e.bl_count[g]++,v=0,f>=h&&(v=o[f-h]),_=r[2*f],e.opt_len+=_*(g+v),a&&(e.static_len+=_*(n[2*f+1]+v)));if(0!==y){do{for(g=c-1;0===e.bl_count[g];)g--;e.bl_count[g]--,e.bl_count[g+1]+=2,e.bl_count[c]--,y-=2}while(y>0);for(g=c;0!==g;g--)for(f=e.bl_count[g];0!==f;)p=e.heap[--u],p>s||(r[2*p+1]!==g&&(e.opt_len+=(g-r[2*p+1])*r[2*p],r[2*p+1]=g),f--)}})(e,t),k(r,u,e.bl_count)},G=(e,t,r)=>{let s,n,a=-1,o=t[1],l=0,h=7,c=4;for(0===o&&(h=138,c=3),t[2*(r+1)+1]=65535,s=0;s<=r;s++)n=o,o=t[2*(s+1)+1],++l{let s,n,a=-1,o=t[1],l=0,h=7,c=4;for(0===o&&(h=138,c=3),s=0;s<=r;s++)if(n=o,o=t[2*(s+1)+1],!(++l{L(e,0+(s?1:0),3),O(e),z(e,r),z(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var V=(e,t,r,s)=>{let a,o,l=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t{let t;for(G(e,e.dyn_ltree,e.l_desc.max_code),G(e,e.dyn_dtree,e.d_desc.max_code),P(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*f[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),a=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=a&&(a=o)):a=o=r+5,r+4<=a&&-1!==t?U(e,t,r,s):4===e.strategy||o===a?(L(e,2+(s?1:0),3),R(e,p,g)):(L(e,4+(s?1:0),3),((e,t,r,s)=>{let n;for(L(e,t-257,5),L(e,r-1,5),L(e,s-4,4),n=0;n{N||((()=>{let e,t,r,s,n;const f=new Array(16);for(r=0,s=0;s<28;s++)for(y[s]=r,e=0;e<1<>=7;s(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(_[r]+n+1)]++,e.dyn_dtree[2*M(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{L(e,2,3),E(e,256,p),(e=>{16===e.bi_valid?(z(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var H=(e,t,r,s)=>{let n=65535&e|0,a=e>>>16&65535|0,o=0;for(;0!==r;){o=r>2e3?2e3:r,r-=o;do{n=n+t[s++]|0,a=a+n|0}while(--o);n%=65521,a%=65521}return n|a<<16|0};const W=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var q=(e,t,r,s)=>{const n=W,a=s+r;e^=-1;for(let r=s;r>>8^n[255&(e^t[r])];return-1^e},Y={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Z={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:X,_tr_stored_block:K,_tr_flush_block:$,_tr_tally:Q,_tr_align:J}=j,{Z_NO_FLUSH:ee,Z_PARTIAL_FLUSH:te,Z_FULL_FLUSH:ie,Z_FINISH:re,Z_BLOCK:se,Z_OK:ne,Z_STREAM_END:ae,Z_STREAM_ERROR:oe,Z_DATA_ERROR:le,Z_BUF_ERROR:he,Z_DEFAULT_COMPRESSION:ce,Z_FILTERED:de,Z_HUFFMAN_ONLY:ue,Z_RLE:fe,Z_FIXED:pe,Z_DEFAULT_STRATEGY:me,Z_UNKNOWN:ge,Z_DEFLATED:ve}=Z,_e=258,ye=262,be=42,we=113,xe=666,Ae=(e,t)=>(e.msg=Y[t],t),Ce=e=>2*e-(e>4?9:0),Se=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Me=e=>{let t,r,s,n=e.w_size;t=e.hash_size,s=t;do{r=e.head[--s],e.head[s]=r>=n?r-n:0}while(--t);t=n,s=t;do{r=e.prev[--s],e.prev[s]=r>=n?r-n:0}while(--t)};let ze=(e,t,r)=>(t<{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},Ee=(e,t)=>{$(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Le(e.strm)},Te=(e,t)=>{e.pending_buf[e.pending++]=t},ke=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Ie=(e,t,r,s)=>{let n=e.avail_in;return n>s&&(n=s),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),r),1===e.state.wrap?e.adler=H(e.adler,t,n,r):2===e.state.wrap&&(e.adler=q(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)},Oe=(e,t)=>{let r,s,n=e.max_chain_length,a=e.strstart,o=e.prev_length,l=e.nice_match;const h=e.strstart>e.w_size-ye?e.strstart-(e.w_size-ye):0,c=e.window,u=e.w_mask,f=e.prev,p=e.strstart+_e;let g=c[a+o-1],v=c[a+o];e.prev_length>=e.good_match&&(n>>=2),l>e.lookahead&&(l=e.lookahead);do{if(r=t,c[r+o]===v&&c[r+o-1]===g&&c[r]===c[a]&&c[++r]===c[a+1]){a+=2,r++;do{}while(c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&c[++a]===c[++r]&&ao){if(e.match_start=t,o=s,s>=l)break;g=c[a+o-1],v=c[a+o]}}}while((t=f[t&u])>h&&0!=--n);return o<=e.lookahead?o:e.lookahead},De=e=>{const t=e.w_size;let r,s,n;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ye)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Me(e),s+=t),0===e.strm.avail_in)break;if(r=Ie(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=r,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=ze(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=ze(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead{let r,s,n,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,l=e.strm.avail_in;do{if(r=65535,n=e.bi_valid+42>>3,e.strm.avail_outs+e.strm.avail_in&&(r=s+e.strm.avail_in),r>n&&(r=n),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Le(e.strm),s&&(s>r&&(s=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+s),e.strm.next_out),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s,e.block_start+=s,r-=s),r&&(Ie(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===o);return l-=e.strm.avail_in,l&&(l>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=l&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-l,e.strm.next_in),e.strstart),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.block_start=e.strstart),e.high_watern&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(Ie(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,a=n>e.w_size?e.w_size:n,s=e.strstart-e.block_start,(s>=a||(s||t===re)&&t!==ee&&0===e.strm.avail_in&&s<=n)&&(r=s>n?n:s,o=t===re&&0===e.strm.avail_in&&r===s?1:0,K(e,e.block_start,r,o),e.block_start+=r,Le(e.strm)),o?3:1)},Re=(e,t)=>{let r,s;for(;;){if(e.lookahead=3&&(e.ins_h=ze(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-ye&&(e.match_length=Oe(e,r)),e.match_length>=3)if(s=Q(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=ze(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=ze(e,e.ins_h,e.window[e.strstart+1]);else s=Q(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(Ee(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===re?(Ee(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ee(e,!1),0===e.strm.avail_out)?1:2},Pe=(e,t)=>{let r,s,n;for(;;){if(e.lookahead=3&&(e.ins_h=ze(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,s=Q(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=ze(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,s&&(Ee(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(s=Q(e,0,e.window[e.strstart-1]),s&&Ee(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=Q(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===re?(Ee(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ee(e,!1),0===e.strm.avail_out)?1:2};function Ge(e,t,r,s,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=s,this.func=n}const Be=[new Ge(0,0,0,0,Fe),new Ge(4,4,8,4,Re),new Ge(4,5,16,8,Re),new Ge(4,6,32,32,Re),new Ge(4,4,16,16,Pe),new Ge(8,16,32,32,Pe),new Ge(8,16,128,128,Pe),new Ge(8,32,128,256,Pe),new Ge(32,128,258,1024,Pe),new Ge(32,258,258,4096,Pe)];function Ne(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ve,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Se(this.dyn_ltree),Se(this.dyn_dtree),Se(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Se(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ue=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==be&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==we&&t.status!==xe?1:0},Ve=e=>{if(Ue(e))return Ae(e,oe);e.total_in=e.total_out=0,e.data_type=ge;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?be:we,e.adler=2===t.wrap?0:1,t.last_flush=-2,X(t),ne},je=e=>{const t=Ve(e);var r;return t===ne&&((r=e.state).window_size=2*r.w_size,Se(r.head),r.max_lazy_match=Be[r.level].max_lazy,r.good_match=Be[r.level].good_length,r.nice_match=Be[r.level].nice_length,r.max_chain_length=Be[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},He=(e,t,r,s,n,a)=>{if(!e)return oe;let o=1;if(t===ce&&(t=6),s<0?(o=0,s=-s):s>15&&(o=2,s-=16),n<1||n>9||r!==ve||s<8||s>15||t<0||t>9||a<0||a>pe||8===s&&1!==o)return Ae(e,oe);8===s&&(s=9);const l=new Ne;return e.state=l,l.strm=e,l.status=be,l.wrap=o,l.gzhead=null,l.w_bits=s,l.w_size=1<He(e,t,ve,15,8,me),deflateInit2:He,deflateReset:je,deflateResetKeep:Ve,deflateSetHeader:(e,t)=>Ue(e)||2!==e.state.wrap?oe:(e.state.gzhead=t,ne),deflate:(e,t)=>{if(Ue(e)||t>se||t<0)return e?Ae(e,oe):oe;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===xe&&t!==re)return Ae(e,0===e.avail_out?he:oe);const s=r.last_flush;if(r.last_flush=t,0!==r.pending){if(Le(e),0===e.avail_out)return r.last_flush=-1,ne}else if(0===e.avail_in&&Ce(t)<=Ce(s)&&t!==re)return Ae(e,he);if(r.status===xe&&0!==e.avail_in)return Ae(e,he);if(r.status===be&&0===r.wrap&&(r.status=we),r.status===be){let t=ve+(r.w_bits-8<<4)<<8,s=-1;if(s=r.strategy>=ue||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=s<<6,0!==r.strstart&&(t|=32),t+=31-t%31,ke(r,t),0!==r.strstart&&(ke(r,e.adler>>>16),ke(r,65535&e.adler)),e.adler=1,r.status=we,Le(e),0!==r.pending)return r.last_flush=-1,ne}if(57===r.status)if(e.adler=0,Te(r,31),Te(r,139),Te(r,8),r.gzhead)Te(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Te(r,255&r.gzhead.time),Te(r,r.gzhead.time>>8&255),Te(r,r.gzhead.time>>16&255),Te(r,r.gzhead.time>>24&255),Te(r,9===r.level?2:r.strategy>=ue||r.level<2?4:0),Te(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Te(r,255&r.gzhead.extra.length),Te(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=q(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(Te(r,0),Te(r,0),Te(r,0),Te(r,0),Te(r,0),Te(r,9===r.level?2:r.strategy>=ue||r.level<2?4:0),Te(r,3),r.status=we,Le(e),0!==r.pending)return r.last_flush=-1,ne;if(69===r.status){if(r.gzhead.extra){let t=r.pending,s=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+s>r.pending_buf_size;){let n=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=q(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=n,Le(e),0!==r.pending)return r.last_flush=-1,ne;t=0,s-=n}let n=new Uint8Array(r.gzhead.extra);r.pending_buf.set(n.subarray(r.gzindex,r.gzindex+s),r.pending),r.pending+=s,r.gzhead.hcrc&&r.pending>t&&(e.adler=q(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,s=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>s&&(e.adler=q(e.adler,r.pending_buf,r.pending-s,s)),Le(e),0!==r.pending)return r.last_flush=-1,ne;s=0}t=r.gzindexs&&(e.adler=q(e.adler,r.pending_buf,r.pending-s,s)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,s=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>s&&(e.adler=q(e.adler,r.pending_buf,r.pending-s,s)),Le(e),0!==r.pending)return r.last_flush=-1,ne;s=0}t=r.gzindexs&&(e.adler=q(e.adler,r.pending_buf,r.pending-s,s))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Le(e),0!==r.pending))return r.last_flush=-1,ne;Te(r,255&e.adler),Te(r,e.adler>>8&255),e.adler=0}if(r.status=we,Le(e),0!==r.pending)return r.last_flush=-1,ne}if(0!==e.avail_in||0!==r.lookahead||t!==ee&&r.status!==xe){let s=0===r.level?Fe(r,t):r.strategy===ue?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(De(e),0===e.lookahead)){if(t===ee)return 1;break}if(e.match_length=0,r=Q(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Ee(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===re?(Ee(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ee(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===fe?((e,t)=>{let r,s,n,a;const o=e.window;for(;;){if(e.lookahead<=_e){if(De(e),e.lookahead<=_e&&t===ee)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,s=o[n],s===o[++n]&&s===o[++n]&&s===o[++n])){a=e.strstart+_e;do{}while(s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&s===o[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Q(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Q(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Ee(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===re?(Ee(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ee(e,!1),0===e.strm.avail_out)?1:2})(r,t):Be[r.level].func(r,t);if(3!==s&&4!==s||(r.status=xe),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),ne;if(2===s&&(t===te?J(r):t!==se&&(K(r,0,0,!1),t===ie&&(Se(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Le(e),0===e.avail_out))return r.last_flush=-1,ne}return t!==re?ne:r.wrap<=0?ae:(2===r.wrap?(Te(r,255&e.adler),Te(r,e.adler>>8&255),Te(r,e.adler>>16&255),Te(r,e.adler>>24&255),Te(r,255&e.total_in),Te(r,e.total_in>>8&255),Te(r,e.total_in>>16&255),Te(r,e.total_in>>24&255)):(ke(r,e.adler>>>16),ke(r,65535&e.adler)),Le(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?ne:ae)},deflateEnd:e=>{if(Ue(e))return oe;const t=e.state.status;return e.state=null,t===we?Ae(e,le):ne},deflateSetDictionary:(e,t)=>{let r=t.length;if(Ue(e))return oe;const s=e.state,n=s.wrap;if(2===n||1===n&&s.status!==be||s.lookahead)return oe;if(1===n&&(e.adler=H(e.adler,t,r,0)),s.wrap=0,r>=s.w_size){0===n&&(Se(s.head),s.strstart=0,s.block_start=0,s.insert=0);let e=new Uint8Array(s.w_size);e.set(t.subarray(r-s.w_size,r),0),t=e,r=s.w_size}const a=e.avail_in,o=e.next_in,l=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,De(s);s.lookahead>=3;){let e=s.strstart,t=s.lookahead-2;do{s.ins_h=ze(s,s.ins_h,s.window[e+3-1]),s.prev[e&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=e,e++}while(--t);s.strstart=e,s.lookahead=2,De(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,e.next_in=o,e.input=l,e.avail_in=a,s.wrap=n,ne},deflateInfo:"pako deflate (from Nodeca project)"};const qe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ye={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)qe(r,t)&&(e[t]=r[t])}}return e},flattenChunks:e=>{let t=0;for(let r=0,s=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Xe[254]=Xe[254]=1;var Ke={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,s,n,a,o=e.length,l=0;for(n=0;n>>6,t[a++]=128|63&r):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|63&r):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|63&r);return t},buf2string:(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s,n;const a=new Array(2*r);for(n=0,s=0;s4)a[n++]=65533,s+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&s1?a[n++]=65533:t<65536?a[n++]=t:(t-=65536,a[n++]=55296|t>>10&1023,a[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Ze)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let s=0;s{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Xe[e[r]]>t?r:t}};var $e=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Qe=Object.prototype.toString,{Z_NO_FLUSH:Je,Z_SYNC_FLUSH:et,Z_FULL_FLUSH:tt,Z_FINISH:it,Z_OK:rt,Z_STREAM_END:st,Z_DEFAULT_COMPRESSION:nt,Z_DEFAULT_STRATEGY:at,Z_DEFLATED:ot}=Z;function lt(e){this.options=Ye.assign({level:nt,method:ot,chunkSize:16384,windowBits:15,memLevel:8,strategy:at},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $e,this.strm.avail_out=0;let r=We.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==rt)throw new Error(Y[r]);if(t.header&&We.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Ke.string2buf(t.dictionary):"[object ArrayBuffer]"===Qe.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=We.deflateSetDictionary(this.strm,e),r!==rt)throw new Error(Y[r]);this._dict_set=!0}}function ht(e,t){const r=new lt(t);if(r.push(e,!0),r.err)throw r.msg||Y[r.err];return r.result}lt.prototype.push=function(e,t){const r=this.strm,s=this.options.chunkSize;let n,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?it:Je,"string"==typeof e?r.input=Ke.string2buf(e):"[object ArrayBuffer]"===Qe.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(s),r.next_out=0,r.avail_out=s),(a===et||a===tt)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(n=We.deflate(r,a),n===st)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=We.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===rt;if(0!==r.avail_out){if(a>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},lt.prototype.onData=function(e){this.chunks.push(e)},lt.prototype.onEnd=function(e){e===rt&&(this.result=Ye.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ct={Deflate:lt,deflate:ht,deflateRaw:function(e,t){return(t=t||{}).raw=!0,ht(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,ht(e,t)},constants:Z};const dt=16209;var ut=function(e,t){let r,s,n,a,o,l,h,c,u,f,p,g,v,_,y,b,w,x,A,C,S,M,z,L;const E=e.state;r=e.next_in,z=e.input,s=r+(e.avail_in-5),n=e.next_out,L=e.output,a=n-(t-e.avail_out),o=n+(e.avail_out-257),l=E.dmax,h=E.wsize,c=E.whave,u=E.wnext,f=E.window,p=E.hold,g=E.bits,v=E.lencode,_=E.distcode,y=(1<>>24,p>>>=x,g-=x,x=w>>>16&255,0===x)L[n++]=65535&w;else{if(!(16&x)){if(0==(64&x)){w=v[(65535&w)+(p&(1<>>=x,g-=x),g<15&&(p+=z[r++]<>>24,p>>>=x,g-=x,x=w>>>16&255,!(16&x)){if(0==(64&x)){w=_[(65535&w)+(p&(1<l){e.msg="invalid distance too far back",E.mode=dt;break e}if(p>>>=x,g-=x,x=n-a,C>x){if(x=C-x,x>c&&E.sane){e.msg="invalid distance too far back",E.mode=dt;break e}if(S=0,M=f,0===u){if(S+=h-x,x2;)L[n++]=M[S++],L[n++]=M[S++],L[n++]=M[S++],A-=3;A&&(L[n++]=M[S++],A>1&&(L[n++]=M[S++]))}else{S=n-C;do{L[n++]=L[S++],L[n++]=L[S++],L[n++]=L[S++],A-=3}while(A>2);A&&(L[n++]=L[S++],A>1&&(L[n++]=L[S++]))}break}}break}}while(r>3,r-=A,g-=A<<3,p&=(1<{const h=l.bits;let c,u,f,p,g,v,_=0,y=0,b=0,w=0,x=0,A=0,C=0,S=0,M=0,z=0,L=null;const E=new Uint16Array(16),T=new Uint16Array(16);let k,I,O,D=null;for(_=0;_<=ft;_++)E[_]=0;for(y=0;y=1&&0===E[w];w--);if(x>w&&(x=w),0===w)return n[a++]=20971520,n[a++]=20971520,l.bits=1,0;for(b=1;b0&&(0===e||1!==w))return-1;for(T[1]=0,_=1;_852||2===e&&M>592)return 1;for(;;){k=_-C,o[y]+1=v?(I=D[o[y]-v],O=L[o[y]-v]):(I=96,O=0),c=1<<_-C,u=1<>C)+u]=k<<24|I<<16|O|0}while(0!==u);for(c=1<<_-1;z&c;)c>>=1;if(0!==c?(z&=c-1,z+=c):z=0,y++,0==--E[_]){if(_===w)break;_=t[r+o[y]]}if(_>x&&(z&p)!==f){for(0===C&&(C=x),g+=b,A=_-C,S=1<852||2===e&&M>592)return 1;f=z&p,n[f]=x<<24|A<<16|g-a|0}}return 0!==z&&(n[g+z]=_-C<<24|64<<16|0),l.bits=x,0};const{Z_FINISH:yt,Z_BLOCK:bt,Z_TREES:wt,Z_OK:xt,Z_STREAM_END:At,Z_NEED_DICT:Ct,Z_STREAM_ERROR:St,Z_DATA_ERROR:Mt,Z_MEM_ERROR:zt,Z_BUF_ERROR:Lt,Z_DEFLATED:Et}=Z,Tt=16180,kt=16190,It=16191,Ot=16192,Dt=16194,Ft=16199,Rt=16200,Pt=16206,Gt=16209,Bt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Nt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ut=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},Vt=e=>{if(Ut(e))return St;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Tt,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,xt},jt=e=>{if(Ut(e))return St;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Vt(e)},Ht=(e,t)=>{let r;if(Ut(e))return St;const s=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?St:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=r,s.wbits=t,jt(e))},Wt=(e,t)=>{if(!e)return St;const r=new Nt;e.state=r,r.strm=e,r.window=null,r.mode=Tt;const s=Ht(e,t);return s!==xt&&(e.state=null),s};let qt,Yt,Zt=!0;const Xt=e=>{if(Zt){qt=new Int32Array(512),Yt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(_t(1,e.lens,0,288,qt,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;_t(2,e.lens,0,32,Yt,0,e.work,{bits:5}),Zt=!1}e.lencode=qt,e.lenbits=9,e.distcode=Yt,e.distbits=5},Kt=(e,t,r,s)=>{let n;const a=e.state;return null===a.window&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>s&&(n=s),a.window.set(t.subarray(r-s,r-s+n),a.wnext),(s-=n)?(a.window.set(t.subarray(r-s,r),0),a.wnext=s,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whaveWt(e,15),inflateInit2:Wt,inflate:(e,t)=>{let r,s,n,a,o,l,h,c,u,f,p,g,v,_,y,b,w,x,A,C,S,M,z=0;const L=new Uint8Array(4);let E,T;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ut(e)||!e.output||!e.input&&0!==e.avail_in)return St;r=e.state,r.mode===It&&(r.mode=Ot),o=e.next_out,n=e.output,h=e.avail_out,a=e.next_in,s=e.input,l=e.avail_in,c=r.hold,u=r.bits,f=l,p=h,M=xt;e:for(;;)switch(r.mode){case Tt:if(0===r.wrap){r.mode=Ot;break}for(;u<16;){if(0===l)break e;l--,c+=s[a++]<>>8&255,r.check=q(r.check,L,2,0),c=0,u=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=Gt;break}if((15&c)!==Et){e.msg="unknown compression method",r.mode=Gt;break}if(c>>>=4,u-=4,S=8+(15&c),0===r.wbits&&(r.wbits=S),S>15||S>r.wbits){e.msg="invalid window size",r.mode=Gt;break}r.dmax=1<>8&1),512&r.flags&&4&r.wrap&&(L[0]=255&c,L[1]=c>>>8&255,r.check=q(r.check,L,2,0)),c=0,u=0,r.mode=16182;case 16182:for(;u<32;){if(0===l)break e;l--,c+=s[a++]<>>8&255,L[2]=c>>>16&255,L[3]=c>>>24&255,r.check=q(r.check,L,4,0)),c=0,u=0,r.mode=16183;case 16183:for(;u<16;){if(0===l)break e;l--,c+=s[a++]<>8),512&r.flags&&4&r.wrap&&(L[0]=255&c,L[1]=c>>>8&255,r.check=q(r.check,L,2,0)),c=0,u=0,r.mode=16184;case 16184:if(1024&r.flags){for(;u<16;){if(0===l)break e;l--,c+=s[a++]<>>8&255,r.check=q(r.check,L,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(g=r.length,g>l&&(g=l),g&&(r.head&&(S=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(s.subarray(a,a+g),S)),512&r.flags&&4&r.wrap&&(r.check=q(r.check,s,g,a)),l-=g,a+=g,r.length-=g),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===l)break e;g=0;do{S=s[a+g++],r.head&&S&&r.length<65536&&(r.head.name+=String.fromCharCode(S))}while(S&&g>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=It;break;case 16189:for(;u<32;){if(0===l)break e;l--,c+=s[a++]<>>=7&u,u-=7&u,r.mode=Pt;break}for(;u<3;){if(0===l)break e;l--,c+=s[a++]<>>=1,u-=1,3&c){case 0:r.mode=16193;break;case 1:if(Xt(r),r.mode=Ft,t===wt){c>>>=2,u-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=Gt}c>>>=2,u-=2;break;case 16193:for(c>>>=7&u,u-=7&u;u<32;){if(0===l)break e;l--,c+=s[a++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=Gt;break}if(r.length=65535&c,c=0,u=0,r.mode=Dt,t===wt)break e;case Dt:r.mode=16195;case 16195:if(g=r.length,g){if(g>l&&(g=l),g>h&&(g=h),0===g)break e;n.set(s.subarray(a,a+g),o),l-=g,a+=g,h-=g,o+=g,r.length-=g;break}r.mode=It;break;case 16196:for(;u<14;){if(0===l)break e;l--,c+=s[a++]<>>=5,u-=5,r.ndist=1+(31&c),c>>>=5,u-=5,r.ncode=4+(15&c),c>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Gt;break}r.have=0,r.mode=16197;case 16197:for(;r.have>>=3,u-=3}for(;r.have<19;)r.lens[k[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,E={bits:r.lenbits},M=_t(0,r.lens,0,19,r.lencode,0,r.work,E),r.lenbits=E.bits,M){e.msg="invalid code lengths set",r.mode=Gt;break}r.have=0,r.mode=16198;case 16198:for(;r.have>>24,b=z>>>16&255,w=65535&z,!(y<=u);){if(0===l)break e;l--,c+=s[a++]<>>=y,u-=y,r.lens[r.have++]=w;else{if(16===w){for(T=y+2;u>>=y,u-=y,0===r.have){e.msg="invalid bit length repeat",r.mode=Gt;break}S=r.lens[r.have-1],g=3+(3&c),c>>>=2,u-=2}else if(17===w){for(T=y+3;u>>=y,u-=y,S=0,g=3+(7&c),c>>>=3,u-=3}else{for(T=y+7;u>>=y,u-=y,S=0,g=11+(127&c),c>>>=7,u-=7}if(r.have+g>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Gt;break}for(;g--;)r.lens[r.have++]=S}}if(r.mode===Gt)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=Gt;break}if(r.lenbits=9,E={bits:r.lenbits},M=_t(1,r.lens,0,r.nlen,r.lencode,0,r.work,E),r.lenbits=E.bits,M){e.msg="invalid literal/lengths set",r.mode=Gt;break}if(r.distbits=6,r.distcode=r.distdyn,E={bits:r.distbits},M=_t(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,E),r.distbits=E.bits,M){e.msg="invalid distances set",r.mode=Gt;break}if(r.mode=Ft,t===wt)break e;case Ft:r.mode=Rt;case Rt:if(l>=6&&h>=258){e.next_out=o,e.avail_out=h,e.next_in=a,e.avail_in=l,r.hold=c,r.bits=u,ut(e,p),o=e.next_out,n=e.output,h=e.avail_out,a=e.next_in,s=e.input,l=e.avail_in,c=r.hold,u=r.bits,r.mode===It&&(r.back=-1);break}for(r.back=0;z=r.lencode[c&(1<>>24,b=z>>>16&255,w=65535&z,!(y<=u);){if(0===l)break e;l--,c+=s[a++]<>x)],y=z>>>24,b=z>>>16&255,w=65535&z,!(x+y<=u);){if(0===l)break e;l--,c+=s[a++]<>>=x,u-=x,r.back+=x}if(c>>>=y,u-=y,r.back+=y,r.length=w,0===b){r.mode=16205;break}if(32&b){r.back=-1,r.mode=It;break}if(64&b){e.msg="invalid literal/length code",r.mode=Gt;break}r.extra=15&b,r.mode=16201;case 16201:if(r.extra){for(T=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;z=r.distcode[c&(1<>>24,b=z>>>16&255,w=65535&z,!(y<=u);){if(0===l)break e;l--,c+=s[a++]<>x)],y=z>>>24,b=z>>>16&255,w=65535&z,!(x+y<=u);){if(0===l)break e;l--,c+=s[a++]<>>=x,u-=x,r.back+=x}if(c>>>=y,u-=y,r.back+=y,64&b){e.msg="invalid distance code",r.mode=Gt;break}r.offset=w,r.extra=15&b,r.mode=16203;case 16203:if(r.extra){for(T=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Gt;break}r.mode=16204;case 16204:if(0===h)break e;if(g=p-h,r.offset>g){if(g=r.offset-g,g>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Gt;break}g>r.wnext?(g-=r.wnext,v=r.wsize-g):v=r.wnext-g,g>r.length&&(g=r.length),_=r.window}else _=n,v=o-r.offset,g=r.length;g>h&&(g=h),h-=g,r.length-=g;do{n[o++]=_[v++]}while(--g);0===r.length&&(r.mode=Rt);break;case 16205:if(0===h)break e;n[o++]=r.length,h--,r.mode=Rt;break;case Pt:if(r.wrap){for(;u<32;){if(0===l)break e;l--,c|=s[a++]<{if(Ut(e))return St;let t=e.state;return t.window&&(t.window=null),e.state=null,xt},inflateGetHeader:(e,t)=>{if(Ut(e))return St;const r=e.state;return 0==(2&r.wrap)?St:(r.head=t,t.done=!1,xt)},inflateSetDictionary:(e,t)=>{const r=t.length;let s,n,a;return Ut(e)?St:(s=e.state,0!==s.wrap&&s.mode!==kt?St:s.mode===kt&&(n=1,n=H(n,t,r,0),n!==s.check)?Mt:(a=Kt(e,t,r,r),a?(s.mode=16210,zt):(s.havedict=1,xt)))},inflateInfo:"pako inflate (from Nodeca project)"};var Qt=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Jt=Object.prototype.toString,{Z_NO_FLUSH:ei,Z_FINISH:ti,Z_OK:ii,Z_STREAM_END:ri,Z_NEED_DICT:si,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ai,Z_MEM_ERROR:oi}=Z;function li(e){this.options=Ye.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new $e,this.strm.avail_out=0;let r=$t.inflateInit2(this.strm,t.windowBits);if(r!==ii)throw new Error(Y[r]);if(this.header=new Qt,$t.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Ke.string2buf(t.dictionary):"[object ArrayBuffer]"===Jt.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=$t.inflateSetDictionary(this.strm,t.dictionary),r!==ii)))throw new Error(Y[r])}function hi(e,t){const r=new li(t);if(r.push(e),r.err)throw r.msg||Y[r.err];return r.result}li.prototype.push=function(e,t){const r=this.strm,s=this.options.chunkSize,n=this.options.dictionary;let a,o,l;if(this.ended)return!1;for(o=t===~~t?t:!0===t?ti:ei,"[object ArrayBuffer]"===Jt.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(s),r.next_out=0,r.avail_out=s),a=$t.inflate(r,o),a===si&&n&&(a=$t.inflateSetDictionary(r,n),a===ii?a=$t.inflate(r,o):a===ai&&(a=si));r.avail_in>0&&a===ri&&r.state.wrap>0&&0!==e[r.next_in];)$t.inflateReset(r),a=$t.inflate(r,o);switch(a){case ni:case ai:case si:case oi:return this.onEnd(a),this.ended=!0,!1}if(l=r.avail_out,r.next_out&&(0===r.avail_out||a===ri))if("string"===this.options.to){let e=Ke.utf8border(r.output,r.next_out),t=r.next_out-e,n=Ke.buf2string(r.output,e);r.next_out=t,r.avail_out=s-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(a!==ii||0!==l){if(a===ri)return a=$t.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},li.prototype.onData=function(e){this.chunks.push(e)},li.prototype.onEnd=function(e){e===ii&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ye.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ci={Inflate:li,inflate:hi,inflateRaw:function(e,t){return(t=t||{}).raw=!0,hi(e,t)},ungzip:hi,constants:Z};const{Deflate:di,deflate:ui,deflateRaw:fi,gzip:pi}=ct,{Inflate:mi,inflate:gi,inflateRaw:vi,ungzip:_i}=ci;var yi=di,bi=ui,wi=fi,xi=pi,Ai=mi,Ci=gi,Si=vi,Mi=_i,zi=Z,Li={Deflate:di,deflate:ui,deflateRaw:fi,gzip:pi,Inflate:mi,inflate:gi,inflateRaw:vi,ungzip:_i,constants:Z}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__(3637),__webpack_require__(7882);var __webpack_exports__=__webpack_require__(6279);return __webpack_exports__})()));