=i.length)return t;var r=[],o=u[e++];return t.forEach(function(t,i){r.push({key:t,values:n(i,e)})}),o?r.sort(function(n,t){return o(n.key,t.key)}):r}(o(n.map,t,0),0)},r.key=function(n){return i.push(n),r},r.sortKeys=function(n){return u[i.length-1]=n,r},r.sortValues=function(n){return t=n,r},r.rollup=function(n){return e=n,r},r},n.set=function(n){var t=new C;if(n)for(var e=0,r=n.length;e 360?n-=360:n<0&&(n+=360),n<60?r+(i-r)*n/60:n<180?i:n<240?r+(i-r)*(240-n)/60:r}(n))}return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:t<0?0:t>1?1:t,r=2*(e=e<0?0:e>1?1:e)-(i=e<=.5?e*(1+t):e+t-e*t),new ut(u(n+120),u(n),u(n-120))}function Vn(t,e,r){return this instanceof Vn?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof Vn?new Vn(t.h,t.c,t.l):tt(t instanceof Bn?t.l:(t=ht((t=n.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Vn(t,e,r)}Yn.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new In(this.h,this.s,this.l/n)},Yn.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new In(this.h,this.s,n*this.l)},Yn.rgb=function(){return Zn(this.h,this.s,this.l)},n.hcl=Vn;var Xn=Vn.prototype=new On;function $n(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new Bn(e,Math.cos(n*=Cn)*t,Math.sin(n)*t)}function Bn(n,t,e){return this instanceof Bn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof Bn?new Bn(n.l,n.a,n.b):n instanceof Vn?$n(n.h,n.c,n.l):ht((n=ut(n)).r,n.g,n.b):new Bn(n,t,e)}Xn.brighter=function(n){return new Vn(this.h,this.c,Math.min(100,this.l+Wn*(arguments.length?n:1)))},Xn.darker=function(n){return new Vn(this.h,this.c,Math.max(0,this.l-Wn*(arguments.length?n:1)))},Xn.rgb=function(){return $n(this.h,this.c,this.l).rgb()},n.lab=Bn;var Wn=18,Jn=.95047,Gn=1,Kn=1.08883,Qn=Bn.prototype=new On;function nt(n,t,e){var r=(n+16)/116,i=r+t/500,u=r-e/200;return new ut(it(3.2404542*(i=et(i)*Jn)-1.5371385*(r=et(r)*Gn)-.4985314*(u=et(u)*Kn)),it(-.969266*i+1.8760108*r+.041556*u),it(.0556434*i-.2040259*r+1.0572252*u))}function tt(n,t,e){return n>0?new Vn(Math.atan2(e,t)*zn,Math.sqrt(t*t+e*e),n):new Vn(NaN,NaN,n)}function et(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function rt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function it(n){return Math.round(255*(n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function ut(n,t,e){return this instanceof ut?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof ut?new ut(n.r,n.g,n.b):ft(""+n,ut,Zn):new ut(n,t,e)}function ot(n){return new ut(n>>16,n>>8&255,255&n)}function at(n){return ot(n)+""}Qn.brighter=function(n){return new Bn(Math.min(100,this.l+Wn*(arguments.length?n:1)),this.a,this.b)},Qn.darker=function(n){return new Bn(Math.max(0,this.l-Wn*(arguments.length?n:1)),this.a,this.b)},Qn.rgb=function(){return nt(this.l,this.a,this.b)},n.rgb=ut;var lt=ut.prototype=new On;function ct(n){return n<16?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function ft(n,t,e){var r,i,u,o=0,a=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(gt(i[0]),gt(i[1]),gt(i[2]))}return(u=vt.get(n))?t(u.r,u.g,u.b):(null==n||"#"!==n.charAt(0)||isNaN(u=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&u)>>4,o|=o>>4,a=240&u,a|=a>>4,l=15&u,l|=l<<4):7===n.length&&(o=(16711680&u)>>16,a=(65280&u)>>8,l=255&u)),t(o,a,l))}function st(n,t,e){var r,i,u=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-u,l=(o+u)/2;return a?(i=l<.5?a/(o+u):a/(2-o-u),r=n==o?(t-e)/a+(t =s[0]&&l<=s[1]&&((a=c[n.bisect(h,l,1,g)-1]).y+=v,a.push(u[o]));return c}return u.value=function(n){return arguments.length?(e=n,u):e},u.range=function(n){return arguments.length?(r=dt(n),u):r},u.bins=function(n){return arguments.length?(i="number"==typeof n?function(t){return Ou(t,n)}:dt(n),u):i},u.frequency=function(n){return arguments.length?(t=!!n,u):t},u},n.layout.pack=function(){var t,e=n.layout.hierarchy().sort(Yu),r=0,i=[1,1];function u(n,u){var o=e.call(this,n,u),a=o[0],l=i[0],c=i[1],f=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,Su(a,function(n){n.r=+f(n.value)}),Su(a,$u),r){var s=r*(t?1:Math.max(2*a.r/l,2*a.r/c))/2;Su(a,function(n){n.r+=s}),Su(a,$u),Su(a,function(n){n.r-=s})}return function n(t,e,r,i){var u=t.children;t.x=e+=i*t.x;t.y=r+=i*t.y;t.r*=i;if(u)for(var o=-1,a=u.length;++op.x&&(p=n),n.depth>g.depth&&(g=n)});var v=e(h,p)/2-h.x,d=r[0]/(p.x+e(p,h)/2+v),y=r[1]/(g.depth||1);wu(f,function(n){n.x=(n.x+v)*d,n.y=n.depth*y})}return c}function o(n){var t=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(t.length){!function(n){var t,e=0,r=0,i=n.children,u=i.length;for(;--u>=0;)(t=i[u]).z+=e,t.m+=e,e+=t.s+(r+=t.c)}(n);var u=(t[0].z+t[t.length-1].z)/2;i?(n.z=i.z+e(n._,i._),n.m=n.z-u):n.z=u}else i&&(n.z=i.z+e(n._,i._));n.parent.A=function(n,t,r){if(t){for(var i,u=n,o=n,a=t,l=u.parent.children[0],c=u.m,f=o.m,s=a.m,h=l.m;a=Qu(a),u=Ku(u),a&&u;)l=Ku(l),(o=Qu(o)).a=n,(i=a.z+s-u.z-c+e(a._,u._))>0&&(no(to(a,n,r),n,i),c+=i,f+=i),s+=a.m,c+=u.m,h+=l.m,f+=o.m;a&&!Qu(o)&&(o.t=a,o.m+=s-f),u&&!Ku(l)&&(l.t=u,l.m+=c-h,r=n)}return r}(n,i,n.parent.A||r[0])}function a(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function l(n){n.x*=r[0],n.y=n.depth*r[1]}return u.separation=function(n){return arguments.length?(e=n,u):e},u.size=function(n){return arguments.length?(i=null==(r=n)?l:null,u):i?null:r},u.nodeSize=function(n){return arguments.length?(i=null==(r=n)?null:l,u):i?r:null},_u(u,t)},n.layout.cluster=function(){var t=n.layout.hierarchy().sort(null).value(null),e=Gu,r=[1,1],i=!1;function u(u,o){var a,l=t.call(this,u,o),c=l[0],f=0;Su(c,function(t){var r=t.children;r&&r.length?(t.x=function(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}(r),t.y=function(t){return 1+n.max(t,function(n){return n.y})}(r)):(t.x=a?f+=e(t,a):0,t.y=0,a=t)});var s=function n(t){var e=t.children;return e&&e.length?n(e[0]):t}(c),h=function n(t){var e,r=t.children;return r&&(e=r.length)?n(r[e-1]):t}(c),p=s.x-e(s,h)/2,g=h.x+e(h,s)/2;return Su(c,i?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-p)/(g-p)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),l}return u.separation=function(n){return arguments.length?(e=n,u):e},u.size=function(n){return arguments.length?(i=null==(r=n),u):i?null:r},u.nodeSize=function(n){return arguments.length?(i=null!=(r=n),u):i?r:null},_u(u,t)},n.layout.treemap=function(){var t,e=n.layout.hierarchy(),r=Math.round,i=[1,1],u=null,o=eo,a=!1,l="squarify",c=.5*(1+Math.sqrt(5));function f(n,t){for(var e,r,i=-1,u=n.length;++i0;)a.push(e=c[i-1]),a.area+=e.area,"squarify"!==l||(r=p(a,v))<=h?(c.pop(),h=r):(a.area-=a.pop().area,g(a,v,u,!1),v=Math.min(u.dx,u.dy),a.length=a.area=0,h=1/0);a.length&&(g(a,v,u,!0),a.length=a.area=0),t.forEach(s)}}function h(n){var t=n.children;if(t&&t.length){var e,r=o(n),i=t.slice(),u=[];for(f(i,r.dx*r.dy/n.value),u.area=0;e=i.pop();)u.push(e),u.area+=e.area,null!=e.z&&(g(u,e.z?r.dx:r.dy,r,!i.length),u.length=u.area=0);t.forEach(h)}}function p(n,t){for(var e,r=n.area,i=0,u=1/0,o=-1,a=n.length;++oi&&(i=e));return t*=t,(r*=r)?Math.max(t*i*c/r,r/(t*u*c)):1/0}function g(n,t,e,i){var u,o=-1,a=n.length,l=e.x,c=e.y,f=t?r(n.area/t):0;if(t==e.dx){for((i||f>e.dy)&&(f=e.dy);++oe.dx)&&(f=e.dx);++o1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=n.random.normal.apply(n,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=n.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(n){return function(){for(var t=0,e=0;e =0){var u=o[c];if(void 0!==u){var l=$.FLOAT,d=u.array,f=u.normalized;d instanceof Float32Array?l=$.FLOAT:d instanceof Float64Array||(d instanceof Uint16Array?l=$.UNSIGNED_SHORT:d instanceof Int16Array?l=$.SHORT:d instanceof Uint32Array?l=$.UNSIGNED_INT:d instanceof Int32Array?l=$.INT:d instanceof Int8Array?l=$.BYTE:d instanceof Uint8Array&&(l=$.UNSIGNED_BYTE));var p=u.itemSize,m=Lt.getAttributeBuffer(u);if(u&&u.isInterleavedBufferAttribute){var g=u.data,v=g.stride,y=u.offset;g&&g.isInstancedInterleavedBuffer?(Ct.enableAttributeAndDivisor(h,g.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=g.meshPerAttribute*g.count)):Ct.enableAttribute(h),$.bindBuffer($.ARRAY_BUFFER,m),$.vertexAttribPointer(h,p,l,f,v*g.array.BYTES_PER_ELEMENT,(n*v+y)*g.array.BYTES_PER_ELEMENT)}else u&&u.isInstancedBufferAttribute?(Ct.enableAttributeAndDivisor(h,u.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=u.meshPerAttribute*u.count)):Ct.enableAttribute(h),$.bindBuffer($.ARRAY_BUFFER,m),$.vertexAttribPointer(h,p,l,f,0,n*p*u.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var b=s[c];if(void 0!==b)switch(b.length){case 2:$.vertexAttrib2fv(h,b);break;case 3:$.vertexAttrib3fv(h,b);break;case 4:$.vertexAttrib4fv(h,b);break;default:$.vertexAttrib1fv(h,b)}}}}Ct.disableUnusedAttributes()}}(r,s,n),null!==b&&$.bindBuffer($.ELEMENT_ARRAY_BUFFER,Lt.getAttributeBuffer(b)));var w=1/0;null!==b?w=b.count:void 0!==_&&(w=_.count);var S=n.drawRange.start,A=n.drawRange.count,M=null!==a?a.start:0,P=null!==a?a.count:1/0,C=Math.max(0,S,M),T=Math.min(0+w,S+A,M+P)-1,E=Math.max(0,T-C+1);if(o.isMesh)if(!0===r.wireframe)Ct.setLineWidth(r.wireframeLinewidth*e()),x.setMode($.LINES);else switch(o.drawMode){case wu:x.setMode($.TRIANGLES);break;case Su:x.setMode($.TRIANGLE_STRIP);break;case Au:x.setMode($.TRIANGLE_FAN)}else if(o.isLine){var I=r.linewidth;void 0===I&&(I=1),Ct.setLineWidth(I*e()),o.isLineSegments?x.setMode($.LINES):x.setMode($.LINE_STRIP)}else o.isPoints&&x.setMode($.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&x.renderInstances(n,C,E):x.render(C,E)},this.render=function(t,e,n,r){if(!1!==(e&&e.isCamera)){var o=t.fog;X="",W=-1,q=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),xt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),ut.setFromMatrix(xt),R.length=0,N=-1,F=-1,B.length=0,U.length=0,gt=this.localClippingEnabled,pt=ft.init(this.clippingPlanes,gt,e),f(t,e),D.length=N+1,k.length=F+1,!0===V.sortObjects&&(D.sort(h),k.sort(u)),pt&&ft.beginShadows(),function(t){for(var e=0,i=0,n=t.length;i 1&&(l=1),r(e,i,n,o,u,p),r(e,i,n,o,l,m),m.sub(p).normalize(),m.toArray(a,g)}}function s(e,i,n,r,o){for(var a=i.next(),s=i.next(),c=i.next(),h=i.size,u=h-1,l=r||0,d=0;d65535?Uint32Array:Uint16Array;this.meshIndex=new p(f),this.makeIndex(),Io.call(this,this.meshPosition,this.meshColor,this.meshIndex,this.meshNormal,this.meshPickingColor,c),this.setAttributes({position:t,normal:e,binormal:i,tangent:n,color:r,size:o,pickingColor:a})}function Da(t,e,i){na.call(this,t,e,i)}function Na(t,e){this.sview1=t,this.sview2=e,this.kdtree2=new Gr(e)}function ka(t,e,i){e=e||3.5,i=i||40;for(var n=new Yi("( ARG and ( .NE or .NH1 or .NH2 ) ) or ( ASP and .ND2 ) or ( GLN and .NE2 ) or ( HIS and ( .ND1 or .NE2 ) ) or ( LYS and .NZ ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TRP and .NE1 ) or ( TYR and .OH ) or ( PROTEIN and .N )"),r=new Yi("( ASN and .OD1 ) or ( ASP and ( OD1 or .OD2 ) ) or ( GLN and .OE1 ) or ( GLU and ( .OE1 or .OE2 ) ) or ( HIS and ( .ND1 or .NE2 ) ) or ( SER and .OG ) or ( THR and .OG1 ) or ( TYR and .OH ) or ( PROTEIN and .O )"),o=new Na(t.getView(n),t.getView(r)).within(e),a=o.bondStore,s=t.getAtomProxy(),c=t.getAtomProxy(),h=t.getAtomProxy(),u=t.getAtomProxy(),l=t.getResidueProxy(),d=t.getResidueProxy(),f=new A,p=new A,m=function(t,e,n,r){var o,a;t.atomname===n?(o=t,a=e):(o=e,a=t),l.index=o.residueIndex;var s=l.getAtomIndexByName(r);return f.subVectors(s,o),p.subVectors(s,a),Ki(f.angleTo(p))i&&o.bondSet.flip_unsafe(g)}else("OH"===s.atomname&&"TYR"===s.resname||"OH"===c.atomname&&"TYR"===c.resname)&&(m(s,c,"OH","CZ")||o.bondSet.flip_unsafe(g));return{atomSet:o.atomSet,bondSet:o.bondSet,bondStore:o.bondStore}}function Fa(t,e,i){e=e||3.5,i=i||40;for(var n=new Yi("( PROTEIN and .N )"),r=new Yi("( PROTEIN and .O )"),o=new Na(t.getView(n),t.getView(r)).within(e),a=o.bondStore,s=t.getAtomProxy(),c=t.getAtomProxy(),h=t.getAtomProxy(),u=t.getAtomProxy(),l=t.getResidueProxy(),d=t.getResidueProxy(),f=new A,p=new A,m=0,g=a.count;m -1&&w -1&&w -1&&a >>=x=b>>>24,p-=x,!(16&(x=b>>>16&255))){if(0==(64&x)){b=g[(65535&b)+(f&(1<1){y=p[0];var M=p[1],x=y[0]-M[0],b=y[1]-M[1];u=x*x+b*b}}function d(){var o,l,c,f,s=n.touches(e);oa.call(e);for(var h=0,p=s.length;h"===a?N+u+t:"^"===a?N.substring(0,k>>=1)+u+t+N.substring(k):u+(x?t:N+t))+r}}}(t),timeFormat:function(t){var e=t.dateTime,r=t.date,i=t.time,u=t.periods,o=t.days,a=t.shortDays,l=t.months,c=t.shortMonths;function f(n){var t=n.length;function e(e){for(var r,i,u,o=[],a=-1,l=0;++au&&(i=t.slice(u,i),a[o]?a[o]+=i:a[++o]=i),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:Hi(e,r)})),u=Yi.lastIndex;return u1&&i.push("H",r[0]);return i.join("")},"step-before":Fo,"step-after":Ho,basis:Yo,"basis-open":function(n){if(n.length<4)return Uo(n);var t,e=[],r=-1,i=n.length,u=[0],o=[0];for(;++r<3;)t=n[r],u.push(t[0]),o.push(t[1]);e.push(Zo($o,u)+","+Zo($o,o)),--r;for(;++r9&&(i=3*t/Math.sqrt(i),o[a]=i*e,o[a+1]=i*r));a=-1;for(;++a<=l;)i=(n[Math.min(l,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),u.push([i||0,o[a]*i||0]);return u}(n))}});function Uo(n){return n.length>1?n.join("L"):n+"Z"}function jo(n){return n.join("L")+"Z"}function Fo(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1?{floor:function(t){for(;a(t=n.floor(t));)t=Aa(t-1);return t},ceil:function(t){for(;a(t=n.ceil(t));)t=Aa(+t+1);return t}}:n))},i.ticks=function(n,t){var e=io(i.domain()),r=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return r&&(n=r[0],t=r[1]),n.range(e[0],Aa(+e[1]+1),t<1?1:t)},i.tickFormat=function(){return r},i.copy=function(){return Ea(t.copy(),e,r)},so(i,t)}function Aa(n){return new Date(n)}wa.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Na:ka,Na.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Na.toString=ka.toString,Tt.second=Ut(function(n){return new Rt(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),Tt.seconds=Tt.second.range,Tt.seconds.utc=Tt.second.utc.range,Tt.minute=Ut(function(n){return new Rt(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),Tt.minutes=Tt.minute.range,Tt.minutes.utc=Tt.minute.utc.range,Tt.hour=Ut(function(n){var t=n.getTimezoneOffset()/60;return new Rt(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),Tt.hours=Tt.hour.range,Tt.hours.utc=Tt.hour.utc.range,Tt.month=Ut(function(n){return(n=Tt.day(n)).setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),Tt.months=Tt.month.range,Tt.months.utc=Tt.month.utc.range;var Ca=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],za=[[Tt.second,1],[Tt.second,5],[Tt.second,15],[Tt.second,30],[Tt.minute,1],[Tt.minute,5],[Tt.minute,15],[Tt.minute,30],[Tt.hour,1],[Tt.hour,3],[Tt.hour,6],[Tt.hour,12],[Tt.day,1],[Tt.day,2],[Tt.week,1],[Tt.month,1],[Tt.month,3],[Tt.year,1]],La=wa.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",Xe]]),qa={range:function(t,e,r){return n.range(Math.ceil(t/r)*r,+e,r).map(Aa)},floor:z,ceil:z};za.year=Tt.year,Tt.scale=function(){return Ea(n.scale.linear(),za,La)};var Ta=za.map(function(n){return[n[0].utc,n[1]]}),Ra=Sa.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",Xe]]);function Da(n){return JSON.parse(n.responseText)}function Pa(n){var t=r.createRange();return t.selectNode(r.body),t.createContextualFragment(n.responseText)}Ta.year=Tt.year.utc,Tt.scale.utc=function(){return Ea(n.scale.linear(),Ta,Ra)},n.text=yt(function(n){return n.responseText}),n.json=function(n,t){return mt(n,"application/json",Da,t)},n.html=function(n,t){return mt(n,"text/html",Pa,t)},n.xml=yt(function(n){return n.responseXML}),"function"==typeof define&&define.amd?(this.d3=n,define(n)):"object"==typeof module&&module.exports?module.exports=n:this.d3=n}();
-},{}],3:[function(require,module,exports) {
-"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={seis:["#AA0000","#D00000","#F70000","#FF1D00","#FF4400","#FF6A00","#FF9000","#FFB700","#FFDD00","#FFFF00","#FFFF00","#FFFF00","#BDFF0C","#73FF1A","#3FFA36","#16F45A","#00D08B","#0087CD","#0048FA","#0024E3"].reverse(),sealand:["#8C66FF","#6A66FF","#6684FF","#66A7FF","#66CAFF","#66ECFF","#66FFF0","#66FFCE","#66FFAB","#66FF88","#66FF66","#88FF66","#ABFF66","#CEFF66","#FFEEA6","#FFD3A6","#FFB8A6","#FFAAB0","#FFB5CB","#FFC0E1"].reverse(),redgreen:["#005824","#1A693B","#347B53","#4F8D6B","#699F83","#83B09B","#9EC2B3","#B8D4CB","#D2E6E3","#EDF8FB","#FFFFFF","#F1EEF6","#E6D3E1","#DBB9CD","#D19EB9","#C684A4","#BB6990","#B14F7C","#A63467","#9B1A53","#91003F"],ocean:["#000000","#000209","#000413","#00061E","#000728","#000932","#002650","#00426E","#005E8C","#007AAA","#0096C8","#22A9C2","#45BCBB","#67CFB5","#8AE2AE","#ACF6A8","#BCF8B9","#CBF9CA","#DBFBDC","#EBFDED"].reverse(),cool:["#00FFFF","#0DF2FF","#19E6FF","#26D9FF","#33CCFF","#3FBFFF","#4CB3FF","#59A6FF","#6699FF","#738CFF","#7F7FFF","#8C73FF","#9966FF","#A659FF","#B24DFF","#BF3FFF","#CC33FF","#D926FF","#E619FF","#F20DFF"],copper:["#000000","#100906","#1F130D","#301E13","#40281A","#50321F","#603C26","#70462D","#805033","#905A3A","#A06440","#B06E46","#C0784D","#D08253","#E08C5A","#F09660","#FFA066","#FFAA6D","#FFB473","#FFBE7A"].reverse(),gray:["#000000","#0D0D0D","#191919","#262626","#333333","#3F3F3F","#4C4C4C","#595959","#666666","#737373","#7F7F7F","#8C8C8C","#999999","#A6A6A6","#B2B2B2","#BFBFBF","#CCCCCC","#D9D9D9","#E6E6E6","#F2F2F2"].reverse(),hot:["#000000","#220000","#440000","#660000","#880000","#AA0000","#CC0000","#EE0000","#FF1100","#FF3300","#FF5500","#FF7700","#FF9900","#FFBB00","#FFDD00","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC"].reverse(),jet:["#00007F","#0000B2","#0000E5","#0019FF","#004DFF","#007FFF","#00B2FF","#00E5FF","#FFFFF2","#FFFFD9","#FFFFBF","#FFFFA5","#FFFF8C","#FFE500","#FFB300","#FF7F00","#FF4C00","#FF1900","#E50000","#B20000"],no_green:["#1F60FF","#1F60FF","#1F9FFF","#1FBFFF","#00CFFF","#2AFFFF","#2AFFFF","#55FFFF","#7FFFFF","#AAFFFF","#FFFF54","#FFFF54","#FFF000","#FFBF00","#FFA800","#FF8A00","#FF8A00","#FF7000","#FF4D00","#FF0000"],polar:["#0000FF","#1919FF","#3333FF","#4C4CFF","#6666FF","#7F7FFF","#9999FF","#B2B2FF","#CCCCFF","#E6E6FF","#FFFFFF","#FFE5E5","#FFCCCC","#FFB2B2","#FF9999","#FF7F7F","#FF6666","#FF4C4C","#FF3333","#FF1A1A"],red2green:["#FF0000","#FF1919","#FF3333","#FF4C4C","#FF6666","#FF7F7F","#FF9999","#FFB2B2","#FFCCCC","#FFE6E6","#FFFFFF","#E5FFE5","#CCFFCC","#B2FFB2","#99FF99","#7FFF7F","#66FF66","#4CFF4C","#33FF33","#1AFF1A"].reverse(),relief:["#000000","#000413","#000728","#002650","#005E8C","#0096C8","#45BCBB","#8AE2AE","#BCF8B9","#DBFBDC","#467832","#887438","#B19D48","#DBC758","#FAE769","#FAEB7E","#FCED93","#FCF1A7","#FCF6C1","#FDFAE0"].reverse(),split:["#7F7FFF","#6666E6","#4D4DCC","#3333B3","#1A1A99","#00007F","#000066","#00004D","#000033","#00001A","#000000","#1A0000","#330000","#4D0000","#660000","#7F0000","#991A1A","#B33333","#CC4D4D","#E66666"],wysiwyg:["#3F003F","#3F003F","#3F00BF","#003FFF","#00A0FF","#3FBFFF","#3FBFFF","#40E0FF","#3FFFBF","#3FFF3F","#7FFF3F","#BFFF3F","#BFFF3F","#FFE040","#FFE040","#FF6040","#FF1F40","#FF60C0","#FFA0FF","#FFA0FF"].reverse()};
-},{}],1:[function(require,module,exports) {
-"use strict";var t=require("d3"),i=r(t),e=require("./colorsets"),s=a(e);function a(t){return t&&t.__esModule?t:{default:t}}function r(t){if(t&&t.__esModule)return t;var i={};if(null!=t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i.default=t,i}var n=window.bundleEntries.chartUtilities.Series,o=window.bundleEntries.chartUtilities.Datasets,h=window.bundleEntries.chartUtilities.Jobs,l=Backbone.View.extend({optionsDefault:{margin:{top:40,right:70,bottom:70,left:70},style:{"font-weight":"normal","font-family":"Verdana","font-size":12},legend:{width:15,size:.9,style:{"font-weight":"normal","font-family":"Verdana","font-size":11},limit:7},background_color:"#FFFFFF",debug_color:"#FFFFFF"},initialize:function(t){var e=this;this.chart=t.chart,this.canvas_id=t.canvas_id,this.group=t.groups[0],this.data=t.groups[0].values,this.options=_.defaults(this.optionsDefault,t),this.color_set=s.default[this.chart.settings.get("color_set","seism")],this.categories=n.makeUniqueCategories([this.group]),this.xScale=i.scale.linear().domain([0,this.categories.array.x.length]),this.yScale=i.scale.linear().domain([0,this.categories.array.y.length]),this.zMin=i.min(this.data,function(t){return t.z}),this.zMax=i.max(this.data,function(t){return t.z}),this.zScale=i.scale.quantize().domain([this.zMin,this.zMax]).range(this.color_set),this.xAxis=i.svg.axis().scale(this.xScale).orient("bottom"),this.yAxis=i.svg.axis().scale(this.yScale).orient("left"),this._makeTickFormat("x"),this._makeTickFormat("y"),this.tooltip=i.select(".charts-viewport-container").append("div").attr("class","charts-tooltip").style(this.options.style).style("opacity",0),$(window).on("resize",function(){e.redraw()}),this.redraw(),n.addZoom({xAxis:this.xAxis,yAxis:this.yAxis,redraw:function(){e.redraw()},svg:i.select("#"+this.canvas_id)})},redraw:function(){var t=$("#"+this.canvas_id);t.empty();var e=this.xScale.domain(),s=this.yScale.domain(),a=Math.ceil(e[0]),r=Math.floor(e[1]),n=Math.ceil(s[0]),o=Math.floor(s[1]);this.xAxis.tickValues(i.range(a,r,1)),this.yAxis.tickValues(i.range(n,o,1));var h=this.options.margin;this.height=parseInt(t.height())-h.top-h.bottom,this.width=parseInt(t.width())-h.left-h.right,this.xScale.range([0,this.width]),this.yScale.range([this.height,0]),this.rowCount=s[1]-s[0],this.colCount=e[1]-e[0],this.boxWidth=Math.max(1,Math.floor(this.width/this.colCount)),this.boxHeight=Math.max(1,Math.floor(this.height/this.rowCount)),this.svg=i.select("#"+this.canvas_id).append("g").attr("class","heatmap").attr("transform","translate("+h.left+","+h.top+")"),this._buildBoxes(),this._buildX(),this._buildY(),"true"==this.chart.settings.get("show_legend")&&this._buildLegend()},_buildBoxes:function(){var t=this,e=this.height,s=this.width,a=this.svg,r=this.boxWidth,n=this.boxHeight;a.append("rect").attr("width",s).attr("height",e).attr("fill",this.options.background_color),a.append("clipPath").attr("id","clip").append("rect").attr("x",0).attr("y",0).attr("width",s).attr("height",e);var o=a.append("g").attr("clip-path","url(#clip)").selectAll("box-group").data(this.data,function(t,i){return t.x+"\0"+t.y});o.enter().append("g").attr("class","box-group").append("rect").attr("class","heat-box"),o.selectAll("rect").attr("rx",1).attr("ry",1).attr("fill",function(i){return t.zScale(i.z)}).attr("width",r).attr("height",n).attr("transform",function(i){return"translate("+t.xScale(i.x)+","+t.yScale(i.y+1)+")"}),o.selectAll("rect").on("dblclick",function(e){var s=t.chart.settings.get("url_template").trim();if(s){i.event.stopPropagation();var a=t.categories.array.x[e.x],r=t.categories.array.y[e.y];window.open(s.replace("__LABEL__",a)),window.open(s.replace("__LABEL__",r))}}).on("mouseover",function(i){var e=this.getScreenCTM().translate(+this.getAttribute("cx"),+this.getAttribute("cy"));t.tooltip.style("opacity",.9),t.tooltip.html(t._templateTooltip(i)).style("left",window.pageXOffset+e.e+15+"px").style("top",window.pageYOffset+e.f-30+"px")}).on("mouseout",function(i){t.tooltip.style("opacity",0)}),this.tooltip.style("opacity",0),o.exit().remove()},_buildX:function(){var t=this.height,i=this.width,e=this.options.margin,s=this.svg,a=this.options.style["font-size"],r=this.boxWidth;this.gxAxis=s.append("g").attr("class","x axis").style("stroke-width",1).attr("transform","translate(0,"+t+")").call(this.xAxis);var n=Math.min(r,a);this.gxAxis.selectAll("text").style(this.options.style).style({"font-size":n+"px"}).attr("transform",function(t){return"rotate(-90)translate("+(-this.getBBox().height-15)+","+(r/2-n)+")"}),s.append("rect").attr("width",i).attr("height",a+3).attr("y",t+e.bottom-a-3).attr("fill",this.options.debug_color).attr("opacity",.7),this.gxAxisLabel=s.append("text").attr("class","x label").style(this.options.style).text(this.chart.settings.get("x_axis_label")).attr("transform",function(s){var r=t+e.bottom-a/3;return"translate("+(i-this.getBBox().width)/2+","+r+")"}),this.gxTickLabel=s.append("text").attr("class","title").style(this.options.style).style({"font-size":1.1*a}).text(this.group.key).attr("transform",function(t){var s=-e.top/2;return"translate("+(i-this.getBBox().width)/2+","+s+")"})},_buildY:function(){var t=this.height,i=this.options.margin,e=this.svg,s=this.options.style["font-size"],a=this.boxHeight;this.gyAxis=e.append("g").attr("class","y axis").style("stroke-width",1).call(this.yAxis);var r=Math.min(a,s);this.gyAxis.selectAll("text").style(this.options.style).style({"font-size":r+"px"}).attr("y",-a/2),e.append("rect").attr("width",s).attr("height",t).attr("x",-i.left).attr("fill",this.options.debug_color).attr("opacity",.7),this.gyAxisLabel=e.append("text").attr("class","y label").style(this.options.style).text(this.chart.settings.get("y_axis_label")).attr("transform",function(e){var a=-i.left+s-2;return"rotate(-90)translate("+-(t+this.getBBox().width)/2+","+a+")"})},_buildLegend:function(){var t=this,e=this.height,s=this.width,a=this.options.margin,r=this.options.legend.style["font-size"],n=this.options.legend.limit,o=this.options.legend.size,h=this.options.legend.width,l=this.zScale.range().length,c=Math.max(o*e/l,r),d=l*c/2,p=i.range(this.zMin,this.zMax,2*(this.zMax-this.zMin)/l).reverse();if(!(p.length<2)){var g=this.svg.selectAll(".legend").data(p).enter().append("g").attr("class","legend").attr("transform",function(t,i){return"translate("+(s+10)+","+((e-d)/2+i*c)+")"});g.append("rect").attr("width",h).attr("height",c).style("fill",function(i){return t.zScale(i)}),g.append("text").attr("x",h+4).attr("y",function(){return(c+this.getBBox().height)/2}).style(this.options.legend.style).text(function(t){return String(t).length>n?String(t).substr(0,n-2)+"..":String(t)}),this.svg.append("text").style(this.options.legend.style).style({"font-size":9,"font-weight":"bold"}).text("Legend").attr("transform",function(t,i){return"translate("+(s+(a.right-this.getBBox().width)/2)+","+((e-d)/2-10)+")"})}},_makeTickFormat:function(t){var i=this.chart.settings,e=this;n.makeTickFormat({categories:e.categories.array[t],type:i.get(t+"_axis_type|type"),precision:i.get(t+"_axis_type|precision"),formatter:function(i){i&&e[t+"Axis"].tickFormat(function(t){return i(t)})}})},_handleError:function(t){this.chart.state("failed",t)},_templateTooltip:function(t){var i=this.categories.array.x[t.x];return'
"}});_.extend(window.bundleEntries||{},{heatmap_default:function(t){t.render=function(i,e){return new l({chart:t.chart,canvas_id:i,groups:e}),!0},o.requestPanels(t)},heatmap_cluster:function(t){h.request(t.chart,h.requestCharts(t.chart,"heatmap"),function(i){var e=new Backbone.Collection;t.chart.groups.each(function(t,i){e.add({__data_columns:{x:{is_label:!0},y:{is_label:!0},z:{is_numeric:!0}},x:i++,y:i++,z:i++,key:t.get("key")})}),t.dataset_id=i.id,t.dataset_groups=e,t.render=function(i,e){return new l({chart:t.chart,canvas_id:i,groups:e}),!0},o.requestPanels(t)},function(){t.process.reject()})}});
-},{"d3":4,"./colorsets":3}]},{},[1])
-//# sourceMappingURL=/script.map
\ No newline at end of file
diff --git a/config/plugins/visualizations/ngl/config/ngl.xml b/config/plugins/visualizations/ngl/config/ngl.xml
index ef581714140..269a198c3a5 100644
--- a/config/plugins/visualizations/ngl/config/ngl.xml
+++ b/config/plugins/visualizations/ngl/config/ngl.xml
@@ -12,7 +12,7 @@
Row: '+this.categories.array.y[t.y]+' Column: '+i+' Value: '+t.z+" -1&&i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,b.width,b.height,0,b.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,v,b.width,b.height,0,v,y,b.data);else d?i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,f[p].width,f[p].height,0,v,y,f[p].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,v,v,y,f[p]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),h.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(t.TEXTURE0+a),i.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,r){i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)},this.setupRenderTarget=function(e){var r=n.get(e),o=n.get(e.texture);e.addEventListener("dispose",l),o.__webglTexture=t.createTexture(),x.textures++;var a=e&&e.isWebGLRenderTargetCube,s=c(e);if(a){r.__webglFramebuffer=[];for(var h=0;h<6;h++)r.__webglFramebuffer[h]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(a){for(i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),m(t.TEXTURE_CUBE_MAP,e.texture,s),h=0;h<6;h++)v(r.__webglFramebuffer[h],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+h);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),i.bindTexture(t.TEXTURE_CUBE_MAP,null)}else i.bindTexture(t.TEXTURE_2D,o.__webglTexture),m(t.TEXTURE_2D,e.texture,s),v(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),i.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&b(e)},this.updateRenderTargetMipmap=function(e){var r=e.texture;if(r.generateMipmaps&&c(e)&&r.minFilter!==Bh&&r.minFilter!==Vh){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=n.get(r).__webglTexture;i.bindTexture(o,a),t.generateMipmap(o),i.bindTexture(o,null)}}}function ct(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function ht(t,e,i){this.uuid=Du.generateUUID(),this.width=t,this.height=e,this.scissor=new ct(0,0,t,e),this.scissorTest=!1,this.viewport=new ct(0,0,t,e),void 0===(i=i||{}).minFilter&&(i.minFilter=Vh),this.texture=new _(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function ut(){Object.defineProperty(this,"id",{value:$u++}),this.uuid=Du.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Wc,this.side=zc,this.shading=Vc,this.vertexColors=jc,this.opacity=1,this.transparent=!1,this.blendSrc=ah,this.blendDst=sh,this.blendEquation=Kc,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=gh,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function lt(t){ut.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(t.attributes,this.setValues(t))}function dt(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}function ft(t){ut.call(this),this.type="MeshDepthMaterial",this.depthPacking=Ou,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function pt(t,e){this.min=void 0!==t?t:new A(1/0,1/0,1/0),this.max=void 0!==e?e:new A(-1/0,-1/0,-1/0)}function mt(t,e){this.center=void 0!==t?t:new A,this.radius=void 0!==e?e:0}function gt(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length}function vt(t,e){this.normal=void 0!==t?t:new A(1,0,0),this.constant=void 0!==e?e:0}function yt(t,e,i,n,r,o){this.planes=[void 0!==t?t:new vt,void 0!==e?e:new vt,void 0!==i?i:new vt,void 0!==n?n:new vt,void 0!==r?r:new vt,void 0!==o?o:new vt]}function bt(t,e,i,n){function r(e,i,n,r){var o=e.geometry,a=null,s=b,c=e.customDepthMaterial;if(n&&(s=_,c=e.customDistanceMaterial),c)a=c;else{var h=!1;i.morphTargets&&(o&&o.isBufferGeometry?h=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(h=o.morphTargets&&o.morphTargets.length>0));var u=e.isSkinnedMesh&&i.skinning,l=0;h&&(l|=g),u&&(l|=v),a=s[l]}if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var d=a.uuid,f=i.uuid,p=S[d];void 0===p&&(p={},S[d]=p);var m=p[f];void 0===m&&(m=a.clone(),p[f]=m),a=m}a.visible=i.visible,a.wireframe=i.wireframe;var y=i.side;return k.renderSingleSided&&y==Uc&&(y=zc),k.renderReverseSided&&(y===zc?y=Bc:y===Bc&&(y=zc)),a.side=y,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,n&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function o(t,e,i){if(!1!==t.visible){if(0!=(t.layers.mask&e.layers.mask)&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(!1===t.frustumCulled||!0===c.intersectsObject(t)))!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),m.push(t));for(var n=t.children,r=0,a=n.length;r/g,function(t,e){var i=ju[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Mt(i)})}function Pt(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,i,n){for(var r="",o=parseInt(e);o=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(d=0;d=0;a--){for(o=u-1;o>=0;o--)if(l[c=4*(a*u+o)]!==e||l[c+1]!==i||l[c+2]!==n||l[c+3]!==r){s=!0;break}if(s)break}var p=a;for(s=!1,o=u-1;o>=0;o--){for(a=h-1;a>=0;a--)if(l[c=4*(a*u+o)]!==e||l[c+1]!==i||l[c+2]!==n||l[c+3]!==r){s=!0;break}if(s)break}var m=o,g=document.createElement("canvas");return g.width=m-f,g.height=p-d,g.getContext("2d").drawImage(t,f,d,g.width,g.height,0,0,g.width,g.height),g}(t,0|(h?0:255*e.r),0|(h?0:255*e.g),0|(h?0:255*e.b),0|(h?0:255))}return t}function r(t,e,i){"function"==typeof o.onProgress&&o.onProgress(t,e,i)}var o=e||{},a=void 0!==o.trim&&o.trim,s=void 0!==o.factor?o.factor:1,c=void 0!==o.antialias&&o.antialias,h=void 0!==o.transparent&&o.transparent,u=t.renderer,l=t.camera,d=u.getClearAlpha(),f=u.getClearColor();return new Promise(function(e){var o=new Bn(u,l,t,{factor:s,antialias:c,onProgress:r,onFinish:function(a,s){n(o.canvas).toBlob(function(n){u.setClearAlpha(d),i(!0),t.requestRender(),r(s,s,!0),e(n)},"image/png")}});u.setClearAlpha(h?0:1),i(),o.renderAsync()})}function Xn(e){function i(){D||(D=new ne),(F=new ve).name="rotationGroup",D.add(F),(z=new ve).name="modelGroup",F.add(z),(B=new ve).name="pickingGroup",F.add(B),(U=new ve).name="backgroundGroup",F.add(U),($=new ve).name="helperGroup",F.add($),D.fog=new ie,N=new Ee(E.lightColor,E.lightIntensity),D.add(N),k=new Re(E.ambientLight,E.ambientIntensity),D.add(k)}function n(){var t=tt.geometry.attributes.position,e=t.array,i=et.min,n=et.max;e[0]=n.x,e[1]=n.y,e[2]=n.z,e[3]=i.x,e[4]=n.y,e[5]=n.z,e[6]=i.x,e[7]=i.y,e[8]=n.z,e[9]=n.x,e[10]=i.y,e[11]=n.z,e[12]=n.x,e[13]=n.y,e[14]=i.z,e[15]=i.x,e[16]=n.y,e[17]=i.z,e[18]=i.x,e[19]=i.y,e[20]=i.z,e[21]=n.x,e[22]=i.y,e[23]=i.z,t.needsUpdate=!0,et.isEmpty()||tt.geometry.computeBoundingSphere()}function r(t,e){function i(t){"Group"===t.type?t.children.forEach(function(t){t.userData.instance=e}):t.userData.instance=e}var n=t.getMesh();n.userData.buffer=t,e&&(n.applyMatrix(e.matrix),i(n)),t.group.add(n);var r=t.getWireframeMesh();if(r.userData.buffer=t,e&&(r.matrix.copy(n.matrix),r.position.copy(n.position),r.quaternion.copy(n.quaternion),r.scale.copy(n.scale),i(r)),t.wireframeGroup.add(r),t.pickable){var a=t.getPickingMesh();a.userData.buffer=t,e&&(a.matrix.copy(n.matrix),a.position.copy(n.position),a.quaternion.copy(n.quaternion),a.scale.copy(n.scale),i(a)),t.pickingGroup.add(a)}e?o(t.geometry,e.matrix):o(t.geometry)}function o(t,e){function i(t,e){var i;0!==t.attributes.position.count&&(t.boundingBox||t.computeBoundingBox(),e?(i=t.boundingBox.clone()).applyMatrix4(e):i=t.boundingBox,i.min.equals(i.max)&&i.expandByScalar(5),et.expandByPoint(i.min),et.expandByPoint(i.max))}function n(t){var e;void 0!==t.geometry&&(t.userData.instance&&(e=t.userData.instance.matrix),i(t.geometry,e))}t?Array.isArray(t)?t.forEach(function(t){i(t,e)}):i(t,e):(et.makeEmpty(),z.traverse(n),U.traverse(n)),et.size(it),nt=it.length(),K.maxDistance=10*nt}function a(t,e,i){var n=E;void 0!==t&&n.fogColor.set(t),void 0!==e&&(n.fogNear=e),void 0!==i&&(n.fogFar=i),u()}function s(t){var e=E;t&&e.backgroundColor.set(t),a(e.backgroundColor),V.setClearColor(e.backgroundColor,0),V.domElement.style.backgroundColor=e.backgroundColor.getStyle(),u()}function c(t,e){b=t||1,x=e||1,L.aspect=b/x,O.left=-b/2,O.right=b/2,O.top=x/2,O.bottom=-x/2,R.updateProjectionMatrix();var i=window.devicePixelRatio;V.setPixelRatio(i),V.setSize(b,x);var n=b*i,r=x*i;G.setSize(n,r),H.setSize(n,r),W.setSize(n,r),K.handleResize(),u()}function h(t){var e=ot.memory,i=ot.render;if(t)e.programs=0,e.geometries=0,e.textures=0,i.calls=0,i.vertices=0,i.faces=0,i.points=0;else{var n=V.info,r=n.memory,o=n.render;e.programs=r.programs,e.geometries=r.geometries,e.textures=r.textures,i.calls+=o.calls,i.vertices+=o.vertices,i.faces+=o.faces,i.points+=o.points}}function u(){w||(performance.now()-I.startTime>22&&(I.begin(),P=!1),w=!0,requestAnimationFrame(function(){g(),I.update()}))}function l(){var t=E;(C=rt.copy(R.position).sub(K.target).length())||(R.position.set(0,0,t.cameraZ),C=Math.abs(t.cameraZ)),T=Math.max(10,.5*nt),((T+=et.center(rt).length())===1/0||T===-1/0||isNaN(T))&&(T=50);var e=(50-t.clipNear)/50,i=-(50-t.clipFar)/50;R.near=C-T*e,R.far=C+T*i;var n=(50-t.fogNear)/50,r=-(50-t.fogFar)/50,o=D.fog;o.color.set(t.fogColor),o.near=C-T*n,o.far=C+T*r,"PerspectiveCamera"===R.type?(R.near=Math.max(.1,t.clipDist,R.near),R.far=Math.max(1,R.far),o.near=Math.max(.1,o.near),o.far=Math.max(1,o.far)):"OrthographicCamera"===R.type&&0===t.clipNear&&t.clipDist>0&&C+R.zoom>2*-t.clipDist&&(R.near+=R.zoom+t.clipDist)}function d(){l();var t=Zi(L.fov),e=(R.near+R.far)/2,i=2*Math.tan(t/2)*e;O.zoom=x/i}function f(){var t,e,i,n,r,o,a,s;R.updateMatrix(),R.updateMatrixWorld(!0),R.matrixWorldInverse.getInverse(R.matrixWorld),R.updateProjectionMatrix(),t=D,e=R,n=C,r=T,o=(i=V).getSize().height,a=i.getPixelRatio(),s="OrthographicCamera"===e.type,Jf.getInverse(e.projectionMatrix),tp.copy(e.projectionMatrix).transpose(),t.traverse(function(t){var e=t.material;if(e){var i=t.material.uniforms;if(i){if(e.clipNear){var c=(50-e.clipNear)/50,h=n-r*c;i.nearClip.value=h}i.canvasHeight&&(i.canvasHeight.value=o),i.pixelRatio&&(i.pixelRatio.value=a),i.projectionMatrixInverse&&i.projectionMatrixInverse.value.copy(Jf),i.projectionMatrixTranspose&&i.projectionMatrixTranspose.value.copy(tp),i.ortho&&(i.ortho.value=s)}}}),function(t,e){var i;t.traverseVisible(function(t){if(t instanceof ge&&t.sortParticles){var n=t.geometry.attributes,r=n.position.count;if(0!==r){var o,a,s,c,h,u,l;for(Kf.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),Qf.multiplyMatrices(e.projectionMatrix,Kf),t.userData.sortData?(o=t.userData.sortData,s=o.__zArray,a=o.__sortArray,c=o.__cmpFn):(s=new Float32Array(r),a=new Uint32Array(r),o={__zArray:s,__sortArray:a,__cmpFn:c=function(t,e){var i=s[t],n=s[e];return i>n?1:i=0})).sort(function(t,e){var i=t[0],n=e[0];if(i===n)return 0;var a=Lc(r,i),s=Lc(r,n);return o[a]500)return void Nf.warn("more than 500 atoms, skip residue for auto-bonding",t.qualifiedName());for(var l=t.getBonds(),d=l.atomIndices1,f=l.atomIndices2,p=l.bondOrders,m=d.length,g=0;g=g){I=d,E=!0;break}if(E)break}if(E)break}for(E=!1,m=h;m>=a;--m){for(p=c;p>=o;--p){for(d=s;d>=r;--d)if(t[l=e*i*m+e*p+d]>=g){N=m,E=!0;break}if(E)break}if(E)break}for(E=!1,p=c;p>=o;--p){for(m=N;m>=a;--m){for(d=s;d>=r;--d)if(t[l=e*i*m+e*p+d]>=g){D=p,E=!0;break}if(E)break}if(E)break}for(E=!1,d=s;d>=r;--d){for(p=D;p>=o;--p){for(m=N;m>=a;--m)if(t[l=e*i*m+e*p+d]>=g){R=d,E=!0;break}if(E)break}if(E)break}v?(r=Math.max(0,I-1),o=Math.max(0,L-1),a=Math.max(0,O-1),s=Math.min(e-1,R+1),c=Math.min(i-1,D+1),h=Math.min(n-1,N+1)):(r=Math.max(1,I-1),o=Math.max(1,L-1),a=Math.max(1,O-1),s=Math.min(e-2,R+1),c=Math.min(i-2,D+1),h=Math.min(n-2,N+1));var k=15;for(m=a;mIp||t===Dp&&P>Lp)return 1;r[u=C&l]=w<<24|S<<16|d-o|0}}return 0!==C&&(r[d+C]=y-A<<24|64<<16|0),s.bits=w,0}function gc(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function vc(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,function(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Jp,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(Lm),e.distcode=e.distdyn=new Int32Array(Om),e.sane=1,e.back=-1,Hp):qp}(t)):qp}function yc(t,e){var i,n;return t?(n=new function(){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},t.state=n,n.window=null,(i=function(t,e){var i,n;return t&&t.state?(n=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?qp:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,vc(t))):qp}(t,e))!==Hp&&(t.state=null),i):qp}function bc(t){if(Rm){var e;for(Ap=new Int32Array(512),Mp=new Int32Array(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(mc(Up,t.lens,0,288,Ap,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;mc($p,t.lens,0,32,Mp,0,t.work,{bits:5}),Rm=!1}t.lencode=Ap,t.lenbits=9,t.distcode=Mp,t.distbits=5}function xc(t,e,i,n){var r,o=t.state;return null===o.window&&(o.wsize=1<>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=um;break;case cm:for(;u<32;){if(0===s)break t;s--,h+=n[o++]<>>=7&u,u-=7&u,i.mode=Mm;break}for(;u<3;){if(0===s)break t;s--,h+=n[o++]<>>=1)){case 0:i.mode=dm;break;case 1:if(bc(i),i.mode=ym,e===Gp){h>>>=2,u-=2;break t}break;case 2:i.mode=mm;break;case 3:t.msg="invalid block type",i.mode=Tm}h>>>=2,u-=2;break;case dm:for(h>>>=7&u,u-=7&u;u<32;){if(0===s)break t;s--,h+=n[o++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=Tm;break}if(i.length=65535&h,h=0,u=0,i.mode=fm,e===Gp)break t;case fm:i.mode=pm;case pm:if(f=i.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break t;lc(r,n,o,f,a),s-=f,o+=f,c-=f,a+=f,i.length-=f;break}i.mode=um;break;case mm:for(;u<14;){if(0===s)break t;s--,h+=n[o++]<>>=5,u-=5,i.ndist=1+(31&h),h>>>=5,u-=5,i.ncode=4+(15&h),h>>>=4,u-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=Tm;break}i.have=0,i.mode=gm;case gm:for(;i.havee?1:0}return function(e,i,n){var r=0,o=e.length-1;for(n||(n=t);r<=o;){var a=r+o>>1,s=n(i,e[a]);if(s>0)r=a+1;else{if(!(s<0))return a;o=a-1}}return-r-1}}();void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i