diff --git a/.travis.yml b/.travis.yml index e185ac07..6de4a9f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ branches: - travis-ci - dev - master + - camdev matrix: include: @@ -109,7 +110,7 @@ script: # 2. build Galaxy image writing interface # 3. run gold image tests - scripts/travis-ci-build.sh - - if [ -z ${GXY_REBUILDING_CACHE} ] && [ -f install/bin/gxywriter ]; then tests/image-gold-tests.sh; fi + - if [ -z ${GXY_REBUILDING_CACHE} ] && [ -f install/bin/gxywriter ] && [ "${TRAVIS_OS_NAME}" == "linux" ]; then tests/image-gold-tests.sh; fi - if [ -z ${GXY_REBUILDING_CACHE} ] && [ -d install/tests ]; then tests/unit-tests.sh; fi - echo $(date) > .galaxy/last_build diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index eb940854..6e87bfa0 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,19 @@ # Galaxy Release Notes +## version 0.4.0 - pending + +* *TODO* - reorganize `src` directory to: framework, data, filters, apps +* *TODO* - singularity recipe for multi-node distributed testing on TACC systems + +## version 0.3.1 - 20190930 + +* added examples for Schlieren renderer in `examples/schlieren` +* added examples for various data samplers in `examples/sampletrace` +* added second, energy-accumulation schlieren algorithm +* added 'data.state' argument to `sampletrace` to track data +* moved image resolution specification to Camera +* added Cinema database example of Water in the Universe data in `examples/WitU` +* added 'data range' to visualizations to select range of interest ## version 0.3.0 - 20190821 @@ -12,7 +26,7 @@ * Support for vector-valued volumes - added JSON format for volume description files that implements 'number of components' field * Initial implementation of RungeKutta operator to trace streamlines in vector volumes - - also 'TraceToPathLines' opewrtor to convert RungeKutta results to path lines for rendering + - also 'TraceToPathLines' operator to convert RungeKutta results to path lines for rendering * Added `schlieren` to provide multi-hued Schlieren and shadowgraph-style rendering - also implemented 'float-image' output (in FITS format) * Added `ospray` modules for class overrides to the underlying [OSPRay][1] rendering engine diff --git a/examples/WitU/cinema/compare/1.0/copyright.md b/examples/WitU/cinema/compare/1.0/copyright.md new file mode 100644 index 00000000..658793e6 --- /dev/null +++ b/examples/WitU/cinema/compare/1.0/copyright.md @@ -0,0 +1,20 @@ +Copyright (c) 2018-2019, Triad National Security, LLC. All rights reserved. + +This software was produced under U.S. Government contract 89233218CNA000001 for +Los Alamos National Laboratory (LANL), which is operated by Triad National +Security, LLC for the U.S. Department of Energy/National Nuclear Security +Administration. + +All rights in the program are reserved by Triad National Security, LLC, and the +U.S. Department of Energy/National Nuclear Security Administration. The +Government is granted for itself and others acting on its behalf a nonexclusive, +paid-up, irrevocable worldwide license in this material to reproduce, prepare +derivative works, distribute copies to the public, perform publicly and display +publicly, and to permit others to do so. + +This is open source software; you can redistribute it and/or modify it under the +terms of the "3-Clause BSD License". If software is modified to produce +derivative works, such modified software should be clearly marked, so as not to +confuse it with the version available from LANL. Full text of the "3-Clause BSD +License" can be found in the License file in the main development branch of the +repository. diff --git a/examples/WitU/cinema/compare/1.0/css/common.css b/examples/WitU/cinema/compare/1.0/css/common.css new file mode 100644 index 00000000..b12697a2 --- /dev/null +++ b/examples/WitU/cinema/compare/1.0/css/common.css @@ -0,0 +1,29 @@ +* { + font-family: helvetica !important; +} + +div.container { + width: 100%; + border: 1px solid gray; +} + +body { + background-color: #f9f9f9; +} + +header, footer { + padding-left: 1px; + padding-right: 1px; + padding-top: 10px; + padding-bottom: 10px; + color: white; + background-color: #373737; + clear: left; + text-align: center; +} + +#header h2 { + display: inline-block; + margin: initial; +} + diff --git a/examples/WitU/cinema/compare/1.0/css/compare.css b/examples/WitU/cinema/compare/1.0/css/compare.css new file mode 100644 index 00000000..8080383d --- /dev/null +++ b/examples/WitU/cinema/compare/1.0/css/compare.css @@ -0,0 +1,26 @@ +#resultsArea { + float: left; + left: 0px; + right: 0px; + width: 100%; + padding: 10px; + background-color: white; +} + +.imageArea { + float: left; + position: relative; + width: 75%; +} + +.sliderArea { + float: left; + position: relative; + width: 20%; +} + +.cinemaImage { + float: left; + position: relative; + padding: 2px; +} diff --git a/examples/WitU/cinema/compare/1.0/images/empty.png b/examples/WitU/cinema/compare/1.0/images/empty.png new file mode 100644 index 00000000..c0f72016 Binary files /dev/null and b/examples/WitU/cinema/compare/1.0/images/empty.png differ diff --git a/examples/WitU/cinema/compare/1.0/license.md b/examples/WitU/cinema/compare/1.0/license.md new file mode 100644 index 00000000..1041d7df --- /dev/null +++ b/examples/WitU/cinema/compare/1.0/license.md @@ -0,0 +1,28 @@ +Copyright (c) 2018-2019, Triad National Security, LLC. All rights reserved. + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of Los Alamos National Security, LLC, Los Alamos + National Laboratory, LANL, the U.S. Government, nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/examples/WitU/cinema/compare/1.0/version.md b/examples/WitU/cinema/compare/1.0/version.md new file mode 100644 index 00000000..d3827e75 --- /dev/null +++ b/examples/WitU/cinema/compare/1.0/version.md @@ -0,0 +1 @@ +1.0 diff --git a/examples/WitU/cinema/lib/d3.v4.min.js b/examples/WitU/cinema/lib/d3.v4.min.js new file mode 100644 index 00000000..8a0709b3 --- /dev/null +++ b/examples/WitU/cinema/lib/d3.v4.min.js @@ -0,0 +1,8 @@ +// https://d3js.org Version 4.9.1. Copyright 2017 Mike Bostock. +(function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})})(this,function(t){"use strict";function n(t){return function(n,e){return js(t(n),e)}}function e(t,n){return[t,n]}function r(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=sf?10:o>=ff?5:o>=lf?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=sf?10:o>=ff?5:o>=lf?2:1)}function i(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=sf?i*=10:o>=ff?i*=5:o>=lf&&(i*=2),n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}function g(t,n){for(var e,r=0,i=t.length;r=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function S(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;rn?1:t>=n?0:NaN}function U(t){return function(){this.removeAttribute(t)}}function D(t){return function(){this.removeAttributeNS(t.space,t.local)}}function O(t,n){return function(){this.setAttribute(t,n)}}function F(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function Y(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function B(t){return function(){this.style.removeProperty(t)}}function H(t,n,e){return function(){this.style.setProperty(t,n,e)}}function j(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function X(t,n){return t.style.getPropertyValue(n)||gl(t).getComputedStyle(t,null).getPropertyValue(n)}function $(t){return function(){delete this[t]}}function V(t,n){return function(){this[t]=n}}function W(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function Z(t){return t.trim().split(/^|\s+/)}function G(t){return t.classList||new J(t)}function J(t){this._node=t,this._names=Z(t.getAttribute("class")||"")}function Q(t,n){for(var e=G(t),r=-1,i=n.length;++r>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Xl.exec(t))?St(parseInt(n[1],16)):(n=$l.exec(t))?new zt(n[1],n[2],n[3],1):(n=Vl.exec(t))?new zt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Wl.exec(t))?Et(n[1],n[2],n[3],n[4]):(n=Zl.exec(t))?Et(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Gl.exec(t))?Pt(n[1],n[2]/100,n[3]/100,1):(n=Jl.exec(t))?Pt(n[1],n[2]/100,n[3]/100,n[4]):Ql.hasOwnProperty(t)?St(Ql[t]):"transparent"===t?new zt(NaN,NaN,NaN,0):null}function St(t){return new zt(t>>16&255,t>>8&255,255&t,1)}function Et(t,n,e,r){return r<=0&&(t=n=e=NaN),new zt(t,n,e,r)}function At(t){return t instanceof kt||(t=Nt(t)),t?(t=t.rgb(),new zt(t.r,t.g,t.b,t.opacity)):new zt}function Ct(t,n,e,r){return 1===arguments.length?At(t):new zt(t,n,e,null==r?1:r)}function zt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Pt(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new qt(t,n,e,r)}function Lt(t){if(t instanceof qt)return new qt(t.h,t.s,t.l,t.opacity);if(t instanceof kt||(t=Nt(t)),!t)return new qt;if(t instanceof qt)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,c=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(e0&&c<1?0:u,new qt(u,a,c,t.opacity)}function Rt(t,n,e,r){return 1===arguments.length?Lt(t):new qt(t,n,e,null==r?1:r)}function qt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ut(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function Dt(t){if(t instanceof Ft)return new Ft(t.l,t.a,t.b,t.opacity);if(t instanceof $t){var n=t.h*Kl;return new Ft(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof zt||(t=At(t));var e=Ht(t.r),r=Ht(t.g),i=Ht(t.b),o=It((.4124564*e+.3575761*r+.1804375*i)/nh),u=It((.2126729*e+.7151522*r+.072175*i)/eh);return new Ft(116*u-16,500*(o-u),200*(u-It((.0193339*e+.119192*r+.9503041*i)/rh)),t.opacity)}function Ot(t,n,e,r){return 1===arguments.length?Dt(t):new Ft(t,n,e,null==r?1:r)}function Ft(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function It(t){return t>ah?Math.pow(t,1/3):t/uh+ih}function Yt(t){return t>oh?t*t*t:uh*(t-ih)}function Bt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ht(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function jt(t){if(t instanceof $t)return new $t(t.h,t.c,t.l,t.opacity);t instanceof Ft||(t=Dt(t));var n=Math.atan2(t.b,t.a)*th;return new $t(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Xt(t,n,e,r){return 1===arguments.length?jt(t):new $t(t,n,e,null==r?1:r)}function $t(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Vt(t){if(t instanceof Zt)return new Zt(t.h,t.s,t.l,t.opacity);t instanceof zt||(t=At(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(vh*r+ph*n-dh*e)/(vh+ph-dh),o=r-i,u=(hh*(e-i)-fh*o)/lh,a=Math.sqrt(u*u+o*o)/(hh*i*(1-i)),c=a?Math.atan2(u,o)*th-120:NaN;return new Zt(c<0?c+360:c,a,i,t.opacity)}function Wt(t,n,e,r){return 1===arguments.length?Vt(t):new Zt(t,n,e,null==r?1:r)}function Zt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Gt(t,n,e,r,i){var o=t*t,u=o*t;return((1-3*t+3*o-u)*n+(4-6*o+3*u)*e+(1+3*t+3*o-3*u)*r+u*i)/6}function Jt(t,n){return function(e){return t+e*n}}function Qt(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function Kt(t,n){var e=n-t;return e?Jt(t,e>180||e<-180?e-360*Math.round(e/360):e):Th(isNaN(t)?n:t)}function tn(t){return 1==(t=+t)?nn:function(n,e){return e-n?Qt(n,e,t):Th(isNaN(n)?e:n)}}function nn(t,n){var e=n-t;return e?Jt(t,e):Th(isNaN(t)?n:t)}function en(t){return function(n){var e,r,i=n.length,o=new Array(i),u=new Array(i),a=new Array(i);for(e=0;e180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Ch(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}function a(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Ch(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}function c(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:Ch(t,e)},{i:a-2,x:Ch(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}return function(n,e){var r=[],i=[];return n=t(n),e=t(e),o(n.translateX,n.translateY,e.translateX,e.translateY,r,i),u(n.rotate,e.rotate,r,i),a(n.skewX,e.skewX,r,i),c(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,i),n=e=null,function(t){for(var n,e=-1,o=i.length;++e=0&&n._call.call(null,t),n=n._next;--Jh}function bn(){ep=(np=ip.now())+rp,Jh=Qh=0;try{xn()}finally{Jh=0,Mn(),ep=0}}function wn(){var t=ip.now(),n=t-np;n>tp&&(rp-=n,np=t)}function Mn(){for(var t,n,e=xh,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:xh=n);bh=t,Tn(r)}function Tn(t){if(!Jh){Qh&&(Qh=clearTimeout(Qh));var n=t-ep;n>24?(t<1/0&&(Qh=setTimeout(bn,n)),Kh&&(Kh=clearInterval(Kh))):(Kh||(np=ep,Kh=setInterval(wn,tp)),Jh=1,op(bn))}}function kn(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>fp)throw new Error("too late");return e}function Nn(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>hp)throw new Error("too late");return e}function Sn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function En(t,n,e){function r(t){e.state=lp,e.timer.restart(i,e.delay,e.time),e.delay<=t&&i(t-e.delay)}function i(r){var s,f,l,h;if(e.state!==lp)return u();for(s in c)if(h=c[s],h.name===e.name){if(h.state===pp)return up(i);h.state===dp?(h.state=_p,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete c[s]):+s=0&&(t=t.slice(0,n)),!t||"start"===t})}function $n(t,n,e){var r,i,o=Xn(n)?kn:Nn;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function Vn(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function Wn(t,n){var e,r,i;return function(){var o=X(this,t),u=(this.style.removeProperty(t),X(this,t));return o===u?null:o===e&&u===r?i:i=n(e=o,r=u)}}function Zn(t){return function(){this.style.removeProperty(t)}}function Gn(t,n,e){var r,i;return function(){var o=X(this,t);return o===e?null:o===r?i:i=n(r=o,e)}}function Jn(t,n,e){var r,i,o;return function(){var u=X(this,t),a=e(this);return null==a&&(this.style.removeProperty(t),a=X(this,t)),u===a?null:u===r&&a===i?o:o=n(r=u,i=a)}}function Qn(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}function Kn(t){return function(){this.textContent=t}}function te(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function ne(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ee(t){return yt().transition(t)}function re(){return++Fp}function ie(t){return+t}function oe(t){return t*t}function ue(t){return t*(2-t)}function ae(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function ce(t){return t*t*t}function se(t){return--t*t*t+1}function fe(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function le(t){return 1-Math.cos(t*Xp)}function he(t){return Math.sin(t*Xp)}function pe(t){return(1-Math.cos(jp*t))/2}function de(t){return Math.pow(2,10*t-10)}function ve(t){return 1-Math.pow(2,-10*t)}function _e(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function ye(t){return 1-Math.sqrt(1-t*t)}function ge(t){return Math.sqrt(1- --t*t)}function me(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}function xe(t){return 1-be(1-t)}function be(t){return(t=+t)<$p?nd*t*t:tMath.abs(t[1]-O[1])?M=!0:w=!0),O=t,b=!0,vd(),o()}function o(){var t;switch(m=O[0]-D[0],x=O[1]-D[1],N){case yd:case _d:S&&(m=Math.max(P-l,Math.min(R-v,m)),h=l+m,_=v+m),E&&(x=Math.max(L-p,Math.min(q-y,x)),d=p+x,g=y+x);break;case gd:S<0?(m=Math.max(P-l,Math.min(R-l,m)),h=l+m,_=v):S>0&&(m=Math.max(P-v,Math.min(R-v,m)),h=l,_=v+m),E<0?(x=Math.max(L-p,Math.min(q-p,x)),d=p+x,g=y):E>0&&(x=Math.max(L-y,Math.min(q-y,x)),d=p,g=y+x);break;case md:S&&(h=Math.max(P,Math.min(R,l-m*S)),_=Math.max(P,Math.min(R,v+m*S))),E&&(d=Math.max(L,Math.min(q,p-x*E)),g=Math.max(L,Math.min(q,y+x*E)))}_0&&(l=h-m),E<0?y=g-x:E>0&&(p=d-x),N=yd,Y.attr("cursor",Md.selection),o());break;default:return}vd()}function s(){switch(t.event.keyCode){case 16:U&&(w=M=U=!1,o());break;case 18:N===md&&(S<0?v=_:S>0&&(l=h),E<0?y=g:E>0&&(p=d),N=gd,o());break;case 32:N===yd&&(t.event.altKey?(S&&(v=_-m*S,l=h+m*S),E&&(y=g-x*E,p=d+x*E),N=md):(S<0?v=_:S>0&&(l=h),E<0?y=g:E>0&&(p=d),N=gd),Y.attr("cursor",Md[k]),o());break;default:return}vd()}if(t.event.touches){if(t.event.changedTouches.length=(o=(v+y)/2))?v=o:y=o,(f=e>=(u=(_+g)/2))?_=u:g=u,i=p,!(p=p[l=f<<1|s]))return i[l]=d,t;if(a=+t._x.call(null,p.data),c=+t._y.call(null,p.data),n===a&&e===c)return d.next=p,i?i[l]=d:t._root=d,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(s=n>=(o=(v+y)/2))?v=o:y=o,(f=e>=(u=(_+g)/2))?_=u:g=u}while((l=f<<1|s)==(h=(c>=u)<<1|a>=o));return i[h]=p,i[l]=d,t}function tr(t){var n,e,r,i,o=t.length,u=new Array(o),a=new Array(o),c=1/0,s=1/0,f=-1/0,l=-1/0;for(e=0;ef&&(f=r),il&&(l=i));for(f",i=n[3]||"-",o=n[4]||"",u=!!n[5],a=n[6]&&+n[6],c=!!n[7],s=n[8]&&+n[8].slice(1),f=n[9]||"";"n"===f?(c=!0,f="g"):Dv[f]||(f=""),(u||"0"===e&&"="===r)&&(u=!0,e="0",r="="),this.fill=e,this.align=r, +this.sign=i,this.symbol=o,this.zero=u,this.width=a,this.comma=c,this.precision=s,this.type=f}function vr(n){return Fv=Bv(n),t.format=Fv.format,t.formatPrefix=Fv.formatPrefix,Fv}function _r(){this.reset()}function yr(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}function gr(t){return t>1?0:t<-1?N_:Math.acos(t)}function mr(t){return t>1?S_:t<-1?-S_:Math.asin(t)}function xr(t){return(t=I_(t/2))*t}function br(){}function wr(t,n){t&&X_.hasOwnProperty(t.type)&&X_[t.type](t,n)}function Mr(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i=0?1:-1,i=r*e,o=q_(n),u=I_(n),a=Jv*u,c=Gv*o+a*q_(i),s=a*r*I_(i);V_.add(R_(s,c)),Zv=t,Gv=o,Jv=u}function Ar(t){return[R_(t[1],t[0]),mr(t[2])]}function Cr(t){var n=t[0],e=t[1],r=q_(e);return[r*q_(n),r*I_(n),I_(e)]}function zr(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Pr(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Lr(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Rr(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function qr(t){var n=B_(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function Ur(t,n){u_.push(a_=[Qv=t,t_=t]),nn_&&(n_=n)}function Dr(t,n){var e=Cr([t*z_,n*z_]);if(o_){var r=Pr(o_,e),i=[r[1],-r[0],0],o=Pr(i,r);qr(o),o=Ar(o);var u,a=t-e_,c=a>0?1:-1,s=o[0]*C_*c,f=P_(a)>180;f^(c*e_n_&&(n_=u):(s=(s+360)%360-180,f^(c*e_n_&&(n_=n))),f?tHr(Qv,t_)&&(t_=t):Hr(t,t_)>Hr(Qv,t_)&&(Qv=t):t_>=Qv?(tt_&&(t_=t)):t>e_?Hr(Qv,t)>Hr(Qv,t_)&&(t_=t):Hr(t,t_)>Hr(Qv,t_)&&(Qv=t)}else u_.push(a_=[Qv=t,t_=t]);nn_&&(n_=n),o_=e,e_=t}function Or(){Q_.point=Dr}function Fr(){a_[0]=Qv,a_[1]=t_,Q_.point=Ur,o_=null}function Ir(t,n){if(o_){var e=t-e_;J_.add(P_(e)>180?e+(e>0?360:-360):e)}else r_=t,i_=n;Z_.point(t,n),Dr(t,n)}function Yr(){Z_.lineStart()}function Br(){Ir(r_,i_),Z_.lineEnd(),P_(J_)>k_&&(Qv=-(t_=180)),a_[0]=Qv,a_[1]=t_,o_=null}function Hr(t,n){return(n-=t)<0?n+360:n}function jr(t,n){return t[0]-n[0]}function Xr(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nN_?t-A_:t<-N_?t+A_:t,n]}function ri(t,n,e){return(t%=A_)?n||e?ry(oi(t),ui(n,e)):oi(t):n||e?ui(n,e):ei}function ii(t){return function(n,e){return n+=t,[n>N_?n-A_:n<-N_?n+A_:n,e]}}function oi(t){var n=ii(t);return n.invert=ii(-t),n}function ui(t,n){function e(t,n){var e=q_(n),a=q_(t)*e,c=I_(t)*e,s=I_(n),f=s*r+a*i;return[R_(c*o-f*u,a*r-s*i),mr(f*o+c*u)]}var r=q_(t),i=I_(t),o=q_(n),u=I_(n);return e.invert=function(t,n){var e=q_(n),a=q_(t)*e,c=I_(t)*e,s=I_(n),f=s*o-c*u;return[R_(c*o+s*u,a*r+f*i),mr(f*r-a*i)]},e}function ai(t,n,e,r,i,o){if(e){var u=q_(n),a=I_(n),c=r*e;null==i?(i=n+r*A_,o=n-c/2):(i=ci(u,i),o=ci(u,o),(r>0?io)&&(i+=r*A_));for(var s,f=i;r>0?f>o:f0)do{s.point(0===f||3===f?t:e,f>1?r:n)}while((f=(f+a+4)%4)!==l);else s.point(o[0],o[1])}function u(r,i){return P_(r[0]-t)0?0:3:P_(r[0]-e)0?2:1:P_(r[1]-n)0?1:0:i>0?3:2}function a(t,n){return c(t.x,n.x)}function c(t,n){var e=u(t,1),r=u(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(u){function c(t,n){i(t,n)&&N.point(t,n)}function s(){for(var n=0,e=0,i=_.length;er&&(l-o)*(r-u)>(h-u)*(t-o)&&++n:h<=r&&(l-o)*(r-u)<(h-u)*(t-o)&&--n;return n}function f(){N=S,v=[],_=[],k=!0}function l(){var t=s(),n=k&&t,e=(v=bf(v)).length;(n||e)&&(u.polygonStart(),n&&(u.lineStart(),o(null,null,1,u),u.lineEnd()),e&&xy(v,a,t,o,u),u.polygonEnd()),N=u,v=_=y=null}function h(){E.point=d,_&&_.push(y=[]),T=!0,M=!1,b=w=NaN}function p(){v&&(d(g,m),x&&M&&S.rejoin(),v.push(S.result())),E.point=c,M&&N.lineEnd()}function d(o,u){var a=i(o,u);if(_&&y.push([o,u]),T)g=o,m=u,x=a,T=!1,a&&(N.lineStart(),N.point(o,u));else if(a&&M)N.point(o,u);else{var c=[b=Math.max(wy,Math.min(by,b)),w=Math.max(wy,Math.min(by,w))],s=[o=Math.max(wy,Math.min(by,o)),u=Math.max(wy,Math.min(by,u))];gy(c,s,t,n,e,r)?(M||(N.lineStart(),N.point(c[0],c[1])),N.point(s[0],s[1]),a||N.lineEnd(),k=!1):a&&(N.lineStart(),N.point(o,u),k=!1)}b=o,w=u,M=a}var v,_,y,g,m,x,b,w,M,T,k,N=u,S=yy(),E={point:c,lineStart:h,lineEnd:p,polygonStart:f,polygonEnd:l};return E}}function hi(){Sy.point=di,Sy.lineEnd=pi}function pi(){Sy.point=Sy.lineEnd=br}function di(t,n){t*=z_,n*=z_,iy=t,oy=I_(n),uy=q_(n),Sy.point=vi}function vi(t,n){t*=z_,n*=z_;var e=I_(n),r=q_(n),i=P_(t-iy),o=q_(i),u=I_(i),a=r*u,c=uy*e-oy*r*o,s=oy*e+uy*r*o;Ny.add(R_(B_(a*a+c*c),s)),iy=t,oy=e,uy=r}function _i(t,n){return!(!t||!Ly.hasOwnProperty(t.type))&&Ly[t.type](t,n)}function yi(t,n){return 0===zy(t,n)}function gi(t,n){var e=zy(t[0],t[1]);return zy(t[0],n)+zy(n,t[1])<=e+k_}function mi(t,n){return!!ky(t.map(xi),bi(n))}function xi(t){return t=t.map(bi),t.pop(),t}function bi(t){return[t[0]*z_,t[1]*z_]}function wi(t,n,e){var r=cf(t,n-k_,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function Mi(t,n,e){var r=cf(t,n-k_,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function Ti(){function t(){return{type:"MultiLineString",coordinates:n()}}function n(){return cf(U_(o/_)*_,i,_).map(h).concat(cf(U_(s/y)*y,c,y).map(p)).concat(cf(U_(r/d)*d,e,d).filter(function(t){return P_(t%_)>k_}).map(f)).concat(cf(U_(a/v)*v,u,v).filter(function(t){return P_(t%y)>k_}).map(l))}var e,r,i,o,u,a,c,s,f,l,h,p,d=10,v=d,_=90,y=360,g=2.5;return t.lines=function(){return n().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(p(c).slice(1),h(i).reverse().slice(1),p(s).reverse().slice(1))]}},t.extent=function(n){return arguments.length?t.extentMajor(n).extentMinor(n):t.extentMinor()},t.extentMajor=function(n){return arguments.length?(o=+n[0][0],i=+n[1][0],s=+n[0][1],c=+n[1][1],o>i&&(n=o,o=i,i=n),s>c&&(n=s,s=c,c=n),t.precision(g)):[[o,s],[i,c]]},t.extentMinor=function(n){return arguments.length?(r=+n[0][0],e=+n[1][0],a=+n[0][1],u=+n[1][1],r>e&&(n=r,r=e,e=n),a>u&&(n=a,a=u,u=n),t.precision(g)):[[r,a],[e,u]]},t.step=function(n){return arguments.length?t.stepMajor(n).stepMinor(n):t.stepMinor()},t.stepMajor=function(n){return arguments.length?(_=+n[0],y=+n[1],t):[_,y]},t.stepMinor=function(n){return arguments.length?(d=+n[0],v=+n[1],t):[d,v]},t.precision=function(n){return arguments.length?(g=+n,f=wi(a,u,90),l=Mi(r,e,g),h=wi(s,c,90),p=Mi(o,i,g),t):g},t.extentMajor([[-180,-90+k_],[180,90-k_]]).extentMinor([[-180,-80-k_],[180,80+k_]])}function ki(){return Ti()()}function Ni(){Fy.point=Si}function Si(t,n){Fy.point=Ei,ay=sy=t,cy=fy=n}function Ei(t,n){Oy.add(fy*t-sy*n),sy=t,fy=n}function Ai(){Ei(ay,cy)}function Ci(t,n){tBy&&(By=t),nHy&&(Hy=n)}function zi(t,n){Xy+=t,$y+=n,++Vy}function Pi(){tg.point=Li}function Li(t,n){tg.point=Ri,zi(py=t,dy=n)}function Ri(t,n){var e=t-py,r=n-dy,i=B_(e*e+r*r);Wy+=i*(py+t)/2,Zy+=i*(dy+n)/2,Gy+=i,zi(py=t,dy=n)}function qi(){tg.point=zi}function Ui(){tg.point=Oi}function Di(){Fi(ly,hy)}function Oi(t,n){tg.point=Fi,zi(ly=py=t,hy=dy=n)}function Fi(t,n){var e=t-py,r=n-dy,i=B_(e*e+r*r);Wy+=i*(py+t)/2,Zy+=i*(dy+n)/2,Gy+=i,i=dy*t-py*n,Jy+=i*(py+t),Qy+=i*(dy+n),Ky+=3*i,zi(py=t,dy=n)}function Ii(t){this._context=t}function Yi(t,n){ag.point=Bi,eg=ig=t,rg=og=n}function Bi(t,n){ig-=t,og-=n,ug.add(B_(ig*ig+og*og)),ig=t,og=n}function Hi(){this._string=[]}function ji(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Xi(t){return t.length>1}function $i(t,n){return((t=t.x)[0]<0?t[1]-S_-k_:S_-t[1])-((n=n.x)[0]<0?n[1]-S_-k_:S_-n[1])}function Vi(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,u){var a=o>0?N_:-N_,c=P_(o-e);P_(c-N_)0?S_:-S_),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),n=0):i!==a&&c>=N_&&(P_(e-i)k_?L_((I_(n)*(o=q_(r))*I_(e)-I_(r)*(i=q_(n))*I_(t))/(i*o*u)):(n+r)/2}function Zi(t,n,e,r){var i;if(null==t)i=e*S_,r.point(-N_,i),r.point(0,i),r.point(N_,i),r.point(N_,0),r.point(N_,-i),r.point(0,-i),r.point(-N_,-i),r.point(-N_,0),r.point(-N_,i);else if(P_(t[0]-n[0])>k_){var o=t[0]4*n&&v--){var x=u+h,b=a+p,w=c+d,M=B_(x*x+b*b+w*w),T=mr(w/=M),k=P_(P_(w)-1)n||P_((y*A+g*C)/m-.5)>.3||u*h+a*p+c*d2?t[2]%360*z_:0,i()):[b*C_,w*C_,M*C_]},n.precision=function(t){return arguments.length?(A=vg(r,E=t*t),o()):B_(E)},n.fitExtent=function(t,e){return Qi(n,t,e)},n.fitSize=function(t,e){return Ki(n,t,e)},function(){return u=t.apply(this,arguments),n.invert=u.invert&&e,i()}}function io(t){var n=0,e=N_/3,r=ro(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*z_,e=t[1]*z_):[n*C_,e*C_]},i}function oo(t){function n(t,n){return[t*e,I_(n)/e]}var e=q_(t);return n.invert=function(t,n){return[t/e,mr(n*e)]},n}function uo(t,n){function e(t,n){var e=B_(o-2*i*I_(n))/i;return[e*I_(t*=i),u-e*q_(t)]}var r=I_(t),i=(r+I_(n))/2;if(P_(i)0?n<-S_+k_&&(n=-S_+k_):n>S_-k_&&(n=S_-k_);var e=o/F_(ho(n),i);return[e*I_(i*t),o-e*q_(i*t)]}var r=q_(t),i=t===n?I_(t):O_(r/q_(n))/O_(ho(n)/ho(t)),o=r*F_(ho(t),i)/i;return i?(e.invert=function(t,n){var e=o-n,r=Y_(i)*B_(t*t+e*e);return[R_(t,P_(e))/i*Y_(e),2*L_(F_(o/r,1/i))-S_]},e):fo}function vo(t,n){return[t,n]}function _o(t,n){function e(t,n){var e=o-n,r=i*t;return[e*I_(r),o-e*q_(r)]}var r=q_(t),i=t===n?I_(t):(r-q_(n))/(n-t),o=r/i+t;return P_(i)=0;)n+=e[r].value;else n=1;t.value=n}function Co(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}function zo(t,n){var e,r,i,o,u,a=new Uo(t),c=+t.value&&(a.value=t.value),s=[a];for(null==n&&(n=Lo);e=s.pop();)if(c&&(e.value=+e.data.value),(i=n(e.data))&&(u=i.length))for(e.children=new Array(u),o=u-1;o>=0;--o)s.push(r=e.children[o]=new Uo(i[o])),r.parent=e,r.depth=e.depth+1;return a.eachBefore(qo)}function Po(){return zo(this).eachBefore(Ro)}function Lo(t){return t.children}function Ro(t){t.data=t.data.data}function qo(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function Uo(t){this.data=t,this.depth=this.height=0,this.parent=null}function Do(t){this._=t,this.next=null}function Oo(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r-n.r;return i*i+1e-6>e*e+r*r}function Fo(t,n){var e,r,i,o=null,u=t.head;switch(n.length){case 1:e=Io(n[0]);break;case 2:e=Yo(n[0],n[1]);break;case 3:e=Bo(n[0],n[1],n[2])}for(;u;)i=u._,r=u.next,e&&Oo(e,i)?o=u:(o?(t.tail=o,o.next=null):t.head=t.tail=null,n.push(i),e=Fo(t,n),n.pop(),t.head?(u.next=t.head,t.head=u):(u.next=null,t.head=t.tail=u),o=t.tail,o.next=r),u=r;return t.tail=o,e}function Io(t){return{x:t.x,y:t.y,r:t.r}}function Yo(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,u=n.y,a=n.r,c=o-e,s=u-r,f=a-i,l=Math.sqrt(c*c+s*s);return{x:(e+o+c/l*f)/2,y:(r+u+s/l*f)/2,r:(l+i+a)/2}}function Bo(t,n,e){var r=t.x,i=t.y,o=t.r,u=n.x,a=n.y,c=n.r,s=e.x,f=e.y,l=e.r,h=2*(r-u),p=2*(i-a),d=2*(c-o),v=r*r+i*i-o*o-u*u-a*a+c*c,_=2*(r-s),y=2*(i-f),g=2*(l-o),m=r*r+i*i-o*o-s*s-f*f+l*l,x=_*p-h*y,b=(p*m-y*v)/x-r,w=(y*d-p*g)/x,M=(_*v-h*m)/x-i,T=(h*g-_*d)/x,k=w*w+T*T-1,N=2*(b*w+M*T+o),S=b*b+M*M-o*o,E=(-N-Math.sqrt(N*N-4*k*S))/(2*k);return{x:b+w*E+r,y:M+T*E+i,r:E}}function Ho(t,n,e){var r=t.x,i=t.y,o=n.r+e.r,u=t.r+e.r,a=n.x-r,c=n.y-i,s=a*a+c*c;if(s){var f=.5+((u*=u)-(o*=o))/(2*s),l=Math.sqrt(Math.max(0,2*o*(u+s)-(u-=s)*u-o*o))/(2*s);e.x=r+f*a+l*c,e.y=i+f*c-l*a}else e.x=r+u,e.y=i}function jo(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return i*i-1e-6>e*e+r*r}function Xo(t,n,e){var r=t._,i=t.next._,o=r.r+i.r,u=(r.x*i.r+i.x*r.r)/o-n,a=(r.y*i.r+i.y*r.r)/o-e;return u*u+a*a}function $o(t){this._=t,this.next=null,this.previous=null}function Vo(t){if(!(i=t.length))return 0;var n,e,r,i;if(n=t[0],n.x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;Ho(e,n,r=t[2]);var o,u,a,c,s,f,l,h=n.r*n.r,p=e.r*e.r,d=r.r*r.r,v=h+p+d,_=h*n.x+p*e.x+d*r.x,y=h*n.y+p*e.y+d*r.y;n=new $o(n),e=new $o(e),r=new $o(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(a=3;a=0;)n=i[o],n.z+=e,n.m+=e,e+=n.s+(r+=n.c)}function cu(t,n,e){return t.a.parent===n.parent?t.a:e}function su(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function fu(t){for(var n,e,r,i,o,u=new su(t,0),a=[u];n=a.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)a.push(e=n.children[i]=new su(r[i],i)),e.parent=n;return(u.parent=new su(null,0)).children=[u],u}function lu(t,n,e,r,i,o){for(var u,a,c,s,f,l,h,p,d,v,_,y=[],g=n.children,m=0,x=0,b=g.length,w=n.value;mh&&(h=a),_=f*f*v,(p=Math.max(h/_,_/l))>d){f-=a;break}d=p}y.push(u={value:f,dice:c1&&pm(t[e[r-2]],t[e[r-1]],t[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function du(t){this._size=t,this._call=this._error=null,this._tasks=[],this._data=[],this._waiting=this._active=this._ended=this._start=0}function vu(t){if(!t._start)try{_u(t)}catch(n){if(t._tasks[t._ended+t._active-1])gu(t,n);else if(!t._data)throw n}}function _u(t){for(;t._start=t._waiting&&t._active=0;)if((e=t._tasks[r])&&(t._tasks[r]=null,e.abort))try{e.abort()}catch(n){}t._active=NaN,mu(t)}function mu(t){if(!t._active&&t._call){var n=t._data;t._data=void 0,t._call(t._error,n)}}function xu(t){if(null==t)t=1/0;else if(!((t=+t)>=1))throw new Error("invalid concurrency");return new du(t)}function bu(t){return function(n,e){t(null==n?e:null)}}function wu(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}function Mu(t,n){return function(e){return t(e.responseText,n)}}function Tu(t){function n(n){var o=n+"",u=e.get(o);if(!u){if(i!==Om)return i;e.set(o,u=r.push(n))}return t[(u-1)%t.length]}var e=He(),r=[],i=Om;return t=null==t?[]:Dm.call(t),n.domain=function(t){if(!arguments.length)return r.slice();r=[],e=He();for(var i,o,u=-1,a=t.length;++u=e?1:r(t)}}}function Cu(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}function zu(t,n,e,r){var i=t[0],o=t[1],u=n[0],a=n[1];return o2?Pu:zu,o=u=null,r}function r(n){return(o||(o=i(a,c,f?Au(t):t,s)))(+n)}var i,o,u,a=Ym,c=Ym,s=qh,f=!1;return r.invert=function(t){return(u||(u=i(c,a,Eu,f?Cu(n):n)))(+t)},r.domain=function(t){return arguments.length?(a=Um.call(t,Im),e()):a.slice()},r.range=function(t){return arguments.length?(c=Dm.call(t),e()):c.slice()},r.rangeRound=function(t){return c=Dm.call(t),s=Uh,e()},r.clamp=function(t){return arguments.length?(f=!!t,e()):f},r.interpolate=function(t){return arguments.length?(s=t,e()):s},e()}function qu(t){var n=t.domain;return t.ticks=function(t){var e=n();return hf(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){return Bm(n(),t,e)},t.nice=function(e){null==e&&(e=10);var i,o=n(),u=0,a=o.length-1,c=o[u],s=o[a];return s0?(c=Math.floor(c/i)*i,s=Math.ceil(s/i)*i,i=r(c,s,e)):i<0&&(c=Math.ceil(c*i)/i,s=Math.floor(s*i)/i,i=r(c,s,e)),i>0?(o[u]=Math.floor(c/i)*i,o[a]=Math.ceil(s/i)*i,n(o)):i<0&&(o[u]=Math.ceil(c*i)/i,o[a]=Math.floor(s*i)/i,n(o)),t},t}function Uu(){var t=Ru(Eu,Ch);return t.copy=function(){return Lu(t,Uu())},qu(t)}function Du(){function t(t){return+t}var n=[0,1];return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=Um.call(e,Im),t):n.slice()},t.copy=function(){return Du().domain(n)},qu(t)}function Ou(t,n){return(n=Math.log(n/t))?function(e){return Math.log(e/t)/n}:Fm(n)}function Fu(t,n){return t<0?function(e){return-Math.pow(-n,e)*Math.pow(-t,1-e)}:function(e){return Math.pow(n,e)*Math.pow(t,1-e)}}function Iu(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Yu(t){return 10===t?Iu:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}function Bu(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}function Hu(t){return function(n){return-t(-n)}}function ju(){function n(){return o=Bu(i),u=Yu(i),r()[0]<0&&(o=Hu(o),u=Hu(u)),e}var e=Ru(Ou,Fu).domain([1,10]),r=e.domain,i=10,o=Bu(10),u=Yu(10);return e.base=function(t){return arguments.length?(i=+t,n()):i},e.domain=function(t){return arguments.length?(r(t),n()):r()},e.ticks=function(t){var n,e=r(),a=e[0],c=e[e.length-1];(n=c0){for(;hc)break;v.push(l)}}else for(;h=1;--f)if(!((l=s*f)c)break;v.push(l)}}else v=hf(h,p,Math.min(p-h,d)).map(u);return n?v.reverse():v},e.tickFormat=function(n,r){if(null==r&&(r=10===i?".0e":","),"function"!=typeof r&&(r=t.format(r)),n===1/0)return r;null==n&&(n=10);var a=Math.max(1,i*n/e.ticks().length);return function(t){var n=t/u(Math.round(o(t)));return n*i0?i[n-1]:e[0],n=i?[o[i-1],r]:[o[n-1],o[n]]},t.copy=function(){return Zu().domain([e,r]).range(u)},qu(t)}function Gu(){function t(t){if(t<=t)return e[Vs(n,t,0,r)]}var n=[.5],e=[0,1],r=1;return t.domain=function(i){return arguments.length?(n=Dm.call(i),r=Math.min(n.length,e.length-1),t):n.slice()},t.range=function(i){return arguments.length?(e=Dm.call(i),r=Math.min(n.length,e.length-1),t):e.slice()},t.invertExtent=function(t){var r=e.indexOf(t);return[n[r-1],n[r]]},t.copy=function(){return Gu().domain(n).range(e)},t}function Ju(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n0))return u;do{u.push(new Date(+e))}while(n(e,o),t(e),e=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return jm.setTime(+n),Xm.setTime(+r),t(jm),t(Xm),Math.floor(e(jm,Xm))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}function Qu(t){return Ju(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Wm)/Zm})}function Ku(t){return Ju(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/Zm})}function ta(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function na(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ea(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function ra(t){function n(t,n){return function(e){var r,i,o,u=[],a=-1,c=0,s=t.length;for(e instanceof Date||(e=new Date(+e));++a=c)return-1;if(37===(i=n.charCodeAt(u++))){if(i=n.charAt(u++),!(o=B[i in Vx?n.charAt(u++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function i(t,n,e){var r=C.exec(n.slice(e));return r?(t.p=z[r[0].toLowerCase()],e+r[0].length):-1}function o(t,n,e){var r=R.exec(n.slice(e));return r?(t.w=q[r[0].toLowerCase()],e+r[0].length):-1}function u(t,n,e){var r=P.exec(n.slice(e));return r?(t.w=L[r[0].toLowerCase()],e+r[0].length):-1}function a(t,n,e){var r=O.exec(n.slice(e));return r?(t.m=F[r[0].toLowerCase()],e+r[0].length):-1}function c(t,n,e){var r=U.exec(n.slice(e));return r?(t.m=D[r[0].toLowerCase()],e+r[0].length):-1}function s(t,n,e){return r(t,w,n,e)}function f(t,n,e){return r(t,M,n,e)}function l(t,n,e){return r(t,T,n,e)}function h(t){return S[t.getDay()]}function p(t){return N[t.getDay()]}function d(t){return A[t.getMonth()]}function v(t){return E[t.getMonth()]}function _(t){return k[+(t.getHours()>=12)]}function y(t){return S[t.getUTCDay()]}function g(t){return N[t.getUTCDay()]}function m(t){return A[t.getUTCMonth()]}function x(t){return E[t.getUTCMonth()]}function b(t){return k[+(t.getUTCHours()>=12)]}var w=t.dateTime,M=t.date,T=t.time,k=t.periods,N=t.days,S=t.shortDays,E=t.months,A=t.shortMonths,C=ua(k),z=aa(k),P=ua(N),L=aa(N),R=ua(S),q=aa(S),U=ua(E),D=aa(E),O=ua(A),F=aa(A),I={a:h,A:p,b:d,B:v,c:null,d:wa,e:wa,H:Ma,I:Ta,j:ka,L:Na,m:Sa,M:Ea,p:_,S:Aa,U:Ca,w:za,W:Pa,x:null,X:null,y:La,Y:Ra,Z:qa,"%":Ga},Y={a:y,A:g,b:m,B:x,c:null,d:Ua,e:Ua,H:Da,I:Oa,j:Fa,L:Ia,m:Ya,M:Ba,p:b,S:Ha,U:ja,w:Xa,W:$a,x:null,X:null,y:Va,Y:Wa,Z:Za,"%":Ga},B={a:o,A:u,b:a,B:c,c:s,d:va,e:va,H:ya,I:ya,j:_a,L:xa,m:da,M:ga,p:i,S:ma,U:sa,w:ca,W:fa,x:f,X:l,y:ha,Y:la,Z:pa,"%":ba};return I.x=n(M,I),I.X=n(T,I),I.c=n(w,I),Y.x=n(M,Y),Y.X=n(T,Y),Y.c=n(w,Y),{format:function(t){var e=n(t+="",I);return e.toString=function(){return t},e},parse:function(t){var n=e(t+="",ta);return n.toString=function(){return t},n},utcFormat:function(t){var e=n(t+="",Y);return e.toString=function(){return t},e},utcParse:function(t){var n=e(t,na);return n.toString=function(){return t},n}}}function ia(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),e+r[0].length):-1}function pa(t,n,e){var r=/^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function da(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function va(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function _a(t,n,e){var r=Wx.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function ya(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ga(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ma(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function xa(t,n,e){var r=Wx.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function ba(t,n,e){var r=Zx.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function wa(t,n){return ia(t.getDate(),n,2)}function Ma(t,n){return ia(t.getHours(),n,2)}function Ta(t,n){return ia(t.getHours()%12||12,n,2)}function ka(t,n){return ia(1+ex.count(xx(t),t),n,3)}function Na(t,n){return ia(t.getMilliseconds(),n,3)}function Sa(t,n){return ia(t.getMonth()+1,n,2)}function Ea(t,n){return ia(t.getMinutes(),n,2)}function Aa(t,n){return ia(t.getSeconds(),n,2)}function Ca(t,n){return ia(ix.count(xx(t),t),n,2)}function za(t){return t.getDay()}function Pa(t,n){return ia(ox.count(xx(t),t),n,2)}function La(t,n){return ia(t.getFullYear()%100,n,2)}function Ra(t,n){return ia(t.getFullYear()%1e4,n,4)}function qa(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+ia(n/60|0,"0",2)+ia(n%60,"0",2)}function Ua(t,n){return ia(t.getUTCDate(),n,2)}function Da(t,n){return ia(t.getUTCHours(),n,2)}function Oa(t,n){return ia(t.getUTCHours()%12||12,n,2)}function Fa(t,n){return ia(1+Nx.count(jx(t),t),n,3)}function Ia(t,n){return ia(t.getUTCMilliseconds(),n,3)}function Ya(t,n){return ia(t.getUTCMonth()+1,n,2)}function Ba(t,n){return ia(t.getUTCMinutes(),n,2)}function Ha(t,n){return ia(t.getUTCSeconds(),n,2)}function ja(t,n){return ia(Ex.count(jx(t),t),n,2)}function Xa(t){return t.getUTCDay()}function $a(t,n){return ia(Ax.count(jx(t),t),n,2)}function Va(t,n){return ia(t.getUTCFullYear()%100,n,2)}function Wa(t,n){return ia(t.getUTCFullYear()%1e4,n,4)}function Za(){return"+0000"}function Ga(){return"%"}function Ja(n){return Xx=ra(n),t.timeFormat=Xx.format,t.timeParse=Xx.parse,t.utcFormat=Xx.utcFormat,t.utcParse=Xx.utcParse,Xx}function Qa(t){return t.toISOString()}function Ka(t){var n=new Date(t);return isNaN(n)?null:n}function tc(t){return new Date(t)}function nc(t){return t instanceof Date?+t:+new Date(+t)}function ec(t,n,e,r,o,u,a,c,s){function f(i){return(a(i)1?0:t<-1?zb:Math.acos(t)}function uc(t){return t>=1?Pb:t<=-1?-Pb:Math.asin(t)}function ac(t){return t.innerRadius}function cc(t){return t.outerRadius}function sc(t){return t.startAngle}function fc(t){return t.endAngle}function lc(t){return t&&t.padAngle}function hc(t,n,e,r,i,o,u,a){var c=e-t,s=r-n,f=u-i,l=a-o,h=(f*(n-o)-l*(t-i))/(l*c-f*s);return[t+h*c,n+h*s]}function pc(t,n,e,r,i,o,u){var a=t-e,c=n-r,s=(u?o:-o)/Ab(a*a+c*c),f=s*c,l=-s*a,h=t+f,p=n+l,d=e+f,v=r+l,_=(h+d)/2,y=(p+v)/2,g=d-h,m=v-p,x=g*g+m*m,b=i-o,w=h*v-d*p,M=(m<0?-1:1)*Ab(Nb(0,b*b*x-w*w)),T=(w*m-g*M)/x,k=(-w*g-m*M)/x,N=(w*m+g*M)/x,S=(-w*g+m*M)/x,E=T-_,A=k-y,C=N-_,z=S-y;return E*E+A*A>C*C+z*z&&(T=N,k=S),{cx:T,cy:k,x01:-f,y01:-l,x11:T*(i/b-1),y11:k*(i/b-1)}}function dc(t){this._context=t}function vc(t){return t[0]}function _c(t){return t[1]}function yc(t){this._curve=t}function gc(t){function n(n){return new yc(t(n))}return n._curve=t,n}function mc(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(gc(t)):n()._curve},t}function xc(t){return t.source}function bc(t){return t.target}function wc(t){function n(){var n,a=jb.call(arguments),c=e.apply(this,a),s=r.apply(this,a);if(u||(u=n=Ue()),t(u,+i.apply(this,(a[0]=c,a)),+o.apply(this,a),+i.apply(this,(a[0]=s,a)),+o.apply(this,a)),n)return u=null,n+""||null}var e=xc,r=bc,i=vc,o=_c,u=null;return n.source=function(t){return arguments.length?(e=t,n):e},n.target=function(t){return arguments.length?(r=t,n):r},n.x=function(t){return arguments.length?(i="function"==typeof t?t:wb(+t),n):i},n.y=function(t){return arguments.length?(o="function"==typeof t?t:wb(+t),n):o},n.context=function(t){return arguments.length?(u=null==t?null:t,n):u},n}function Mc(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function Tc(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function kc(t,n,e,r,i){var o=Xb(n,e),u=Xb(n,e=(e+i)/2),a=Xb(r,e),c=Xb(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(u[0],u[1],a[0],a[1],c[0],c[1])}function Nc(){return wc(Mc)}function Sc(){return wc(Tc)}function Ec(){var t=wc(kc);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}function Ac(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Cc(t){this._context=t}function zc(t){this._context=t}function Pc(t){this._context=t}function Lc(t,n){this._basis=new Cc(t),this._beta=n}function Rc(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function qc(t,n){this._context=t,this._k=(1-n)/6}function Uc(t,n){this._context=t,this._k=(1-n)/6}function Dc(t,n){this._context=t,this._k=(1-n)/6}function Oc(t,n,e){var r=t._x1,i=t._y1,o=t._x2,u=t._y2;if(t._l01_a>Cb){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>Cb){var s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-n*t._l12_2a)/f,u=(u*s+t._y1*t._l23_2a-e*t._l12_2a)/f}t._context.bezierCurveTo(r,i,o,u,t._x2,t._y2)}function Fc(t,n){this._context=t,this._alpha=n}function Ic(t,n){this._context=t,this._alpha=n}function Yc(t,n){this._context=t,this._alpha=n}function Bc(t){this._context=t}function Hc(t){return t<0?-1:1}function jc(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),u=(e-t._y1)/(i||r<0&&-0),a=(o*i+u*r)/(r+i);return(Hc(o)+Hc(u))*Math.min(Math.abs(o),Math.abs(u),.5*Math.abs(a))||0}function Xc(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function $c(t,n,e){var r=t._x0,i=t._y0,o=t._x1,u=t._y1,a=(o-r)/3;t._context.bezierCurveTo(r+a,i+a*n,o-a,u-a*e,o,u)}function Vc(t){this._context=t}function Wc(t){this._context=new Zc(t)}function Zc(t){this._context=t}function Gc(t){return new Vc(t)}function Jc(t){return new Wc(t)}function Qc(t){this._context=t}function Kc(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),u=new Array(r);for(i[0]=0,o[0]=2,u[0]=t[0]+2*t[1],n=1;n=0;--n)i[n]=(u[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n0)){if(o/=d,d<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=r-c,d||!(o<0)){if(o/=d,d<0){if(o>p)return;o>h&&(h=o)}else if(d>0){if(o0)){if(o/=v,v<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=i-s,v||!(o<0)){if(o/=v,v<0){if(o>p)return;o>h&&(h=o)}else if(v>0){if(o0||p<1)||(h>0&&(t[0]=[c+h*d,s+h*v]),p<1&&(t[1]=[c+p*d,s+p*v]),!0)}}}}}function _s(t,n,e,r,i){var o=t[1];if(o)return!0;var u,a,c=t[0],s=t.left,f=t.right,l=s[0],h=s[1],p=f[0],d=f[1],v=(l+p)/2,_=(h+d)/2;if(d===h){if(v=r)return;if(l>p){if(c){if(c[1]>=i)return}else c=[v,e];o=[v,i]}else{if(c){if(c[1]1)if(l>p){if(c){if(c[1]>=i)return}else c=[(e-a)/u,e];o=[(i-a)/u,i]}else{if(c){if(c[1]=r)return}else c=[n,u*n+a];o=[r,u*r+a]}else{if(c){if(c[0]jw||Math.abs(i[0][1]-i[1][1])>jw)||delete Yw[o]}function gs(t){return Fw[t.index]={site:t,halfedges:[]}}function ms(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function xs(t,n){return n[+(n.left!==t.site)]}function bs(t,n){return n[+(n.left===t.site)]}function ws(){for(var t,n,e,r,i=0,o=Fw.length;ijw||Math.abs(v-h)>jw)&&(c.splice(a,0,Yw.push(ps(u,p,Math.abs(d-t)jw?[t,Math.abs(l-t)jw?[Math.abs(h-r)jw?[e,Math.abs(l-e)jw?[Math.abs(h-n)=-Xw)){var p=c*c+s*s,d=f*f+l*l,v=(l*p-s*d)/h,_=(c*d-f*p)/h,y=Bw.pop()||new Ts;y.arc=t,y.site=i,y.x=v+u,y.y=(y.cy=_+a)+Math.sqrt(v*v+_*_),t.circle=y;for(var g=null,m=Iw._;m;)if(y.yjw)a=a.L;else{if(!((i=o-Ls(a,u))>jw)){r>-jw?(n=a.P,e=a):i>-jw?(n=a,e=a.N):n=e=a;break}if(!a.R){n=a;break}a=a.R}gs(t);var c=Es(t);if(Ow.insert(n,c),n||e){if(n===e)return Ns(n),e=Es(n.site),Ow.insert(c,e),c.edge=e.edge=hs(n.site,c.site),ks(n),void ks(e);if(!e)return void(c.edge=hs(n.site,c.site));Ns(n),Ns(e);var s=n.site,f=s[0],l=s[1],h=t[0]-f,p=t[1]-l,d=e.site,v=d[0]-f,_=d[1]-l,y=2*(h*_-p*v),g=h*h+p*p,m=v*v+_*_,x=[(_*g-p*m)/y+f,(h*m-v*g)/y+l];ds(e.edge,s,d,x),c.edge=hs(s,t,null,x),e.edge=hs(t,d,null,x),ks(n),ks(e)}}function Ps(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var u=t.P;if(!u)return-1/0;e=u.site;var a=e[0],c=e[1],s=c-n;if(!s)return a;var f=a-r,l=1/o-1/s,h=f/s;return l?(-h+Math.sqrt(h*h-2*l*(f*f/(-2*s)-c+s/2+i-o/2)))/l+r:(r+a)/2}function Ls(t,n){var e=t.N;if(e)return Ps(e,n);var r=t.site;return r[1]===n?r[0]:1/0}function Rs(t,n,e){return(t[0]-e[0])*(n[1]-t[1])-(t[0]-n[0])*(e[1]-t[1])}function qs(t,n){return n[1]-t[1]||n[0]-t[0]}function Us(t,n){var e,r,i,o=t.sort(qs).pop();for(Yw=[],Fw=new Array(t.length),Ow=new as,Iw=new as;;)if(i=Dw,o&&(!i||o[1]n?1:t>=n?0:NaN},Xs=function(t){return 1===t.length&&(t=n(t)),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;t(n[o],e)>0?i=o:r=o+1}return r}}},$s=Xs(js),Vs=$s.right,Ws=$s.left,Zs=function(t,n){null==n&&(n=e);for(var r=0,i=t.length-1,o=t[0],u=new Array(i<0?0:i);rt?1:n>=t?0:NaN},Qs=function(t){return null===t?NaN:+t},Ks=function(t,n){var e,r,i=t.length,o=0,u=-1,a=0,c=0;if(null==n)for(;++u1)return c/(o-1)},tf=function(t,n){var e=Ks(t,n);return e?Math.sqrt(e):e},nf=function(t,n){var e,r,i,o=t.length,u=-1;if(null==n){for(;++u=e)for(r=i=e;++ue&&(r=e),i=e)for(r=i=e;++ue&&(r=e),i0)for(t=Math.ceil(t/u),n=Math.floor(n/u),o=new Array(i=Math.ceil(n-t+1));++cl;)h.pop(),--p;var d,v=new Array(p+1);for(o=0;o<=p;++o)d=v[o]=[],d.x0=o>0?h[o-1]:f,d.x1=o=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),u=+e(t[o],o,t);return u+(+e(t[o+1],o+1,t)-u)*(i-o)}},_f=function(t,n,e){return t=of.call(t,Qs).sort(js),Math.ceil((e-n)/(2*(vf(t,.75)-vf(t,.25))*Math.pow(t.length,-1/3)))},yf=function(t,n,e){return Math.ceil((e-n)/(3.5*tf(t)*Math.pow(t.length,-1/3)))},gf=function(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o=e)for(r=e;++or&&(r=e)}else for(;++o=e)for(r=e;++or&&(r=e);return r},mf=function(t,n){var e,r=t.length,i=r,o=-1,u=0;if(null==n)for(;++o=0;)for(r=t[i],n=r.length;--n>=0;)e[--u]=r[n];return e},wf=function(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o=e)for(r=e;++oe&&(r=e)}else for(;++o=e)for(r=e;++oe&&(r=e);return r},Mf=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},Tf=function(t,n){if(e=t.length){var e,r,i=0,o=0,u=t[o];for(null==n&&(n=js);++i0)for(var e,r,i=new Array(e),o=0;o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Of.hasOwnProperty(n)?{space:Of[n],local:t}:t},If=function(t){var n=Ff(t);return(n.local?b:x)(n)},Yf=0;M.prototype=w.prototype={constructor:M,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var Bf=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var Hf=document.documentElement;if(!Hf.matches){var jf=Hf.webkitMatchesSelector||Hf.msMatchesSelector||Hf.mozMatchesSelector||Hf.oMatchesSelector;Bf=function(t){return function(){return jf.call(this,t)}}}}var Xf=Bf,$f={};if(t.event=null,"undefined"!=typeof document){"onmouseenter"in document.documentElement||($f={mouseenter:"mouseover",mouseleave:"mouseout"})}var Vf=function(t,n,e){var r,i,o=N(t+""),u=o.length;{if(!(arguments.length<2)){for(a=n?E:S,null==e&&(e=!1),r=0;r=x&&(x=m+1);!(g=_[x])&&++x=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},fl=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=q);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?B:"function"==typeof n?j:H)(t,n,null==e?"":e)):X(this.node(),t)},xl=function(t,n){return arguments.length>1?this.each((null==n?$:"function"==typeof n?W:V)(t,n)):this.node()[t]};J.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var bl=function(t,n){var e=Z(t+"");if(arguments.length<2){for(var r=G(this.node()),i=-1,o=e.length;++ix}y.mouse("drag")}function i(){Pl(t.event.view).on("mousemove.drag mouseup.drag",null),mt(t.event.view,l),Ul(),y.mouse("end")}function o(){if(p.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=d.apply(this,arguments),o=r.length;for(n=0;n=240?t-240:t+120,i,r),Ut(t,i,r),Ut(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Kl=Math.PI/180,th=180/Math.PI,nh=.95047,eh=1,rh=1.08883,ih=4/29,oh=6/29,uh=3*oh*oh,ah=oh*oh*oh;Il(Ft,Ot,Tt(kt,{brighter:function(t){return new Ft(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Ft(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=eh*Yt(t),n=nh*Yt(n),e=rh*Yt(e),new zt(Bt(3.2404542*n-1.5371385*t-.4985314*e),Bt(-.969266*n+1.8760108*t+.041556*e),Bt(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),Il($t,Xt,Tt(kt,{brighter:function(t){return new $t(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new $t(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Dt(this).rgb()}}));var ch=-.14861,sh=1.78277,fh=-.29227,lh=-.90649,hh=1.97294,ph=hh*lh,dh=hh*sh,vh=sh*fh-lh*ch;Il(Zt,Wt,Tt(kt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Zt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Zt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Kl,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new zt(255*(n+e*(ch*r+sh*i)),255*(n+e*(fh*r+lh*i)),255*(n+e*(hh*r)),this.opacity)}}));var _h,yh,gh,mh,xh,bh,wh=function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],u=r>0?t[r-1]:2*i-o,a=ro&&(i=n.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:Ch(e,r)})),o=Lh.lastIndex;return ohp&&e.statelp&&e.name===n)return new ne([[t]],ld,n,+r)}return null},pd=function(t){return function(){return t}},dd=function(t,n,e){this.target=t,this.type=n,this.selection=e},vd=function(){t.event.preventDefault(),t.event.stopImmediatePropagation()},_d={name:"drag"},yd={name:"space"},gd={name:"handle"},md={name:"center"},xd={name:"x",handles:["e","w"].map(ke),input:function(t,n){return t&&[[t[0],n[0][1]],[t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},bd={name:"y",handles:["n","s"].map(ke),input:function(t,n){return t&&[[n[0][0],t[0]],[n[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},wd={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(ke),input:function(t){return t},output:function(t){return t}},Md={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Td={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},kd={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Nd={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Sd={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1},Ed=function(){return Le(wd)},Ad=Math.cos,Cd=Math.sin,zd=Math.PI,Pd=zd/2,Ld=2*zd,Rd=Math.max,qd=function(){function t(t){var o,u,a,c,s,f,l=t.length,h=[],p=cf(l),d=[],v=[],_=v.groups=new Array(l),y=new Array(l*l);for(o=0,s=-1;++s1e-6)if(Math.abs(f*a-c*s)>1e-6&&i){var h=e-o,p=r-u,d=a*a+c*c,v=h*h+p*p,_=Math.sqrt(d),y=Math.sqrt(l),g=i*Math.tan((Od-Math.acos((d+l-v)/(2*_*y)))/2),m=g/y,x=g/_;Math.abs(m-1)>1e-6&&(this._+="L"+(t+m*s)+","+(n+m*f)),this._+="A"+i+","+i+",0,0,"+ +(f*h>s*p)+","+(this._x1=t+x*a)+","+(this._y1=n+x*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n,e=+e;var u=e*Math.cos(r),a=e*Math.sin(r),c=t+u,s=n+a,f=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+s:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+c+","+s),e&&(l<0&&(l=l%Fd+Fd),l>Id?this._+="A"+e+","+e+",0,1,"+f+","+(t-u)+","+(n-a)+"A"+e+","+e+",0,1,"+f+","+(this._x1=c)+","+(this._y1=s):l>1e-6&&(this._+="A"+e+","+e+",0,"+ +(l>=Od)+","+f+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var Yd=function(){function t(){var t,a=Ud.call(arguments),c=n.apply(this,a),s=e.apply(this,a),f=+r.apply(this,(a[0]=c,a)),l=i.apply(this,a)-Pd,h=o.apply(this,a)-Pd,p=f*Ad(l),d=f*Cd(l),v=+r.apply(this,(a[0]=s,a)),_=i.apply(this,a)-Pd,y=o.apply(this,a)-Pd;if(u||(u=t=Ue()),u.moveTo(p,d),u.arc(0,0,f,l,h),l===_&&h===y||(u.quadraticCurveTo(0,0,v*Ad(_),v*Cd(_)),u.arc(0,0,v,_,y)),u.quadraticCurveTo(0,0,p,d),u.closePath(),t)return u=null,t+""||null}var n=De,e=Oe,r=Fe,i=Ie,o=Ye,u=null;return t.radius=function(n){return arguments.length?(r="function"==typeof n?n:Dd(+n),t):r},t.startAngle=function(n){return arguments.length?(i="function"==typeof n?n:Dd(+n),t):i},t.endAngle=function(n){return arguments.length?(o="function"==typeof n?n:Dd(+n),t):o},t.source=function(e){return arguments.length?(n=e,t):n},t.target=function(n){return arguments.length?(e=n,t):e},t.context=function(n){return arguments.length?(u=null==n?null:n,t):u},t};Be.prototype=He.prototype={constructor:Be,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var Bd=function(){function t(n,i,u,a){if(i>=o.length)return null!=r?r(n):null!=e?n.sort(e):n;for(var c,s,f,l=-1,h=n.length,p=o[i++],d=He(),v=u();++lo.length)return t;var i,a=u[e-1];return null!=r&&e>=o.length?i=t.entries():(i=[],t.each(function(t,r){i.push({key:r,values:n(t,e)})})),null!=a?i.sort(function(t,n){return a(t.key,n.key)}):i}var e,r,i,o=[],u=[];return i={object:function(n){return t(n,0,je,Xe)},map:function(n){return t(n,0,$e,Ve)},entries:function(e){return n(t(e,0,$e,Ve),0)},key:function(t){return o.push(t),i},sortKeys:function(t){return u[o.length-1]=t,i},sortValues:function(t){return e=t,i},rollup:function(t){return r=t,i}}},Hd=He.prototype;We.prototype=Ze.prototype={constructor:We,has:Hd.has,add:function(t){return t+="",this["$"+t]=t,this},remove:Hd.remove,clear:Hd.clear,values:Hd.keys,size:Hd.size,empty:Hd.empty,each:Hd.each};var jd=function(t){var n=[];for(var e in t)n.push(e);return n},Xd=function(t){var n=[];for(var e in t)n.push(t[e]);return n},$d=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},Vd=function(t){function n(t,n){var r,i,o=e(t,function(t,e){if(r)return r(t,e-1);i=t,r=n?Je(t,n):Ge(t)});return o.columns=i,o}function e(t,n){function e(){if(f>=s)return u;if(i)return i=!1,o;var n,e=f;if(34===t.charCodeAt(e)){for(var r=e;r++t||t>i||r>n||n>o))return this;var u,a,c=i-e,s=this._root;switch(a=(n<(r+o)/2)<<1|t<(e+i)/2){case 0:do{u=new Array(4),u[a]=s,s=u}while(c*=2,i=e+c,o=r+c,t>i||n>o);break;case 1:do{u=new Array(4),u[a]=s,s=u}while(c*=2,e=i-c,o=r+c,e>t||n>o);break;case 2:do{u=new Array(4),u[a]=s,s=u}while(c*=2,i=e+c,r=o-c,t>i||r>n);break;case 3:do{u=new Array(4),u[a]=s,s=u}while(c*=2,e=i-c,r=o-c,e>t||r>n)}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},sv=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},fv=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},lv=function(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i},hv=function(t,n,e){var r,i,o,u,a,c,s,f=this._x0,l=this._y0,h=this._x1,p=this._y1,d=[],v=this._root;for(v&&d.push(new lv(v,f,l,h,p)),null==e?e=1/0:(f=t-e,l=n-e,h=t+e,p=n+e,e*=e);c=d.pop();)if(!(!(v=c.node)||(i=c.x0)>h||(o=c.y0)>p||(u=c.x1)=y)<<1|t>=_)&&(c=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=c)}else{var g=t-+this._x.call(null,v.data),m=n-+this._y.call(null,v.data),x=g*g+m*m;if(x=(a=(d+_)/2))?d=a:_=a,(f=u>=(c=(v+y)/2))?v=c:y=c,n=p,!(p=p[l=f<<1|s]))return this;if(!p.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[h]=p:this._root=p),this):(this._root=i,this)},dv=function(){return this._root},vv=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},_v=function(t){var n,e,r,i,o,u,a=[],c=this._root;for(c&&a.push(new lv(c,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(c=n.node,r=n.x0,i=n.y0,o=n.x1,u=n.y1)&&c.length){var s=(r+o)/2,f=(i+u)/2;(e=c[3])&&a.push(new lv(e,s,f,o,u)),(e=c[2])&&a.push(new lv(e,r,f,s,u)),(e=c[1])&&a.push(new lv(e,s,i,o,f)),(e=c[0])&&a.push(new lv(e,r,i,s,f))}return this},yv=function(t){var n,e=[],r=[];for(this._root&&e.push(new lv(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,u=n.x0,a=n.y0,c=n.x1,s=n.y1,f=(u+c)/2,l=(a+s)/2;(o=i[0])&&e.push(new lv(o,u,a,f,l)),(o=i[1])&&e.push(new lv(o,f,a,c,l)),(o=i[2])&&e.push(new lv(o,u,l,f,s)),(o=i[3])&&e.push(new lv(o,f,l,c,s))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},gv=function(t){return arguments.length?(this._x=t,this):this._x},mv=function(t){return arguments.length?(this._y=t,this):this._y},xv=ir.prototype=or.prototype;xv.copy=function(){var t,n,e=new or(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=ur(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=ur(n));return e},xv.add=av,xv.addAll=tr,xv.cover=cv,xv.data=sv,xv.extent=fv,xv.find=hv,xv.remove=pv,xv.removeAll=nr,xv.root=dv,xv.size=vv,xv.visit=_v,xv.visitAfter=yv,xv.x=gv,xv.y=mv;var bv,wv=function(t){function n(){function t(t,n,e,r,i){var o=t.data,a=t.r,p=l+a;{if(!o)return n>s+p||rf+p||ic.index){var d=s-o.x-o.vx,v=f-o.y-o.vy,_=d*d+v*v;_t.r&&(t.r=t[n].r)}function r(){if(i){var n,e,r=i.length;for(o=new Array(r),n=0;n1?(null==n?l.remove(t):l.set(t,i(n)),o):l.get(t)},find:function(n,e,r){var i,o,u,a,c,s=0,f=t.length;for(null==r?r=1/0:r*=r,s=0;s1?(p.on(t,n),o):p.on(t)}}},Sv=function(){function t(t){var n,a=i.length,c=ir(i,lr,hr).visitAfter(e);for(u=t,n=0;n=f)){(t.data!==o||t.next)&&(0===i&&(i=uv(),p+=i*i),0===c&&(c=uv(),p+=c*c),p1?r[0]+r.slice(2):r,+t.slice(e+1)]},zv=function(t){return t=Cv(Math.abs(t)),t?t[1]:NaN},Pv=function(t,n){return function(e,r){for(var i=e.length,o=[],u=0,a=t[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(e.substring(i-=a,i+a)),!((c+=a+1)>r));)a=t[u=(u+1)%t.length];return o.reverse().join(n)}},Lv=function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}},Rv=function(t,n){t=t.toPrecision(n);t:for(var e,r=t.length,i=1,o=-1;i0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t},qv=function(t,n){var e=Cv(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(bv=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return o===u?r:o>u?r+new Array(o-u+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Cv(t,Math.max(0,n+o-1))[0]},Uv=function(t,n){var e=Cv(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},Dv={"":Rv,"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Uv(100*t,n)},r:Uv,s:qv,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Ov=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;pr.prototype=dr.prototype,dr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var Fv,Iv=function(t){return t},Yv=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Bv=function(t){function n(t){function n(t){var n,i,a,f=_,x=y;if("c"===v)x=g(t)+x,t="";else{t=+t;var b=t<0;if(t=g(Math.abs(t),d),b&&0==+t&&(b=!1),f=(b?"("===s?s:"-":"-"===s||"("===s?"":s)+f,x=x+("s"===v?Yv[8+bv/3]:"")+(b&&"("===s?")":""),m)for(n=-1,i=t.length;++n(a=t.charCodeAt(n))||a>57){x=(46===a?o+t.slice(n+1):t.slice(n))+x,t=t.slice(0,n);break}}p&&!l&&(t=r(t,1/0));var w=f.length+t.length+x.length,M=w>1)+f+t+x+M.slice(w);break;default:t=M+f+t+x}return u(t)}t=pr(t);var e=t.fill,c=t.align,s=t.sign,f=t.symbol,l=t.zero,h=t.width,p=t.comma,d=t.precision,v=t.type,_="$"===f?i[0]:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===f?i[1]:/[%p]/.test(v)?a:"",g=Dv[v],m=!v||/[defgprs%]/.test(v);return d=null==d?v?6:12:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),n.toString=function(){return t+""},n}function e(t,e){var r=n((t=pr(t),t.type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(zv(e)/3))),o=Math.pow(10,-i),u=Yv[8+i/3];return function(t){return r(o*t)+u}}var r=t.grouping&&t.thousands?Pv(t.grouping,t.thousands):Iv,i=t.currency,o=t.decimal,u=t.numerals?Lv(t.numerals):Iv,a=t.percent||"%";return{format:n,formatPrefix:e}};vr({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var Hv=function(t){return Math.max(0,-zv(Math.abs(t)))},jv=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(zv(n)/3)))-zv(Math.abs(t)))},Xv=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,zv(n)-zv(t))+1},$v=function(){return new _r};_r.prototype={constructor:_r,reset:function(){this.s=this.t=0},add:function(t){yr(T_,t,this.t),yr(this,T_.s,this.s),this.s?this.t+=T_.t:this.s=T_.t},valueOf:function(){return this.s}};var Vv,Wv,Zv,Gv,Jv,Qv,Kv,t_,n_,e_,r_,i_,o_,u_,a_,c_,s_,f_,l_,h_,p_,d_,v_,__,y_,g_,m_,x_,b_,w_,M_,T_=new _r,k_=1e-6,N_=Math.PI,S_=N_/2,E_=N_/4,A_=2*N_,C_=180/N_,z_=N_/180,P_=Math.abs,L_=Math.atan,R_=Math.atan2,q_=Math.cos,U_=Math.ceil,D_=Math.exp,O_=Math.log,F_=Math.pow,I_=Math.sin,Y_=Math.sign||function(t){return t>0?1:t<0?-1:0},B_=Math.sqrt,H_=Math.tan,j_={Feature:function(t,n){wr(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++rk_?n_=90:J_<-k_&&(Kv=-90),a_[0]=Qv,a_[1]=t_}},K_=function(t){var n,e,r,i,o,u,a;if(n_=t_=-(Qv=Kv=1/0),u_=[],$_(t,Q_),e=u_.length){for(u_.sort(jr),n=1,r=u_[0],o=[r];nHr(r[0],r[1])&&(r[1]=i[1]),Hr(i[0],r[1])>Hr(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(u=-1/0,e=o.length-1,n=0,r=o[e];n<=e;r=i,++n)i=o[n],(a=Hr(r[1],i[0]))>u&&(u=a,Qv=i[0],t_=r[1])}return u_=a_=null,Qv===1/0||Kv===1/0?[[NaN,NaN],[NaN,NaN]]:[[Qv,Kv],[t_,n_]]},ty={sphere:br,point:$r,lineStart:Wr,lineEnd:Jr,polygonStart:function(){ty.lineStart=Qr,ty.lineEnd=Kr},polygonEnd:function(){ty.lineStart=Wr,ty.lineEnd=Jr}},ny=function(t){c_=s_=f_=l_=h_=p_=d_=v_=__=y_=g_=0,$_(t,ty);var n=__,e=y_,r=g_,i=n*n+e*e+r*r;return i<1e-12&&(n=p_,e=d_,r=v_,s_2?t[2]*z_:0),n.invert=function(n){return n=t.invert(n[0]*z_,n[1]*z_),n[0]*=C_,n[1]*=C_,n},n},_y=function(){function t(t,n){e.push(t=r(t,n)),t[0]*=C_,t[1]*=C_}function n(){var t=i.apply(this,arguments),n=o.apply(this,arguments)*z_,c=u.apply(this,arguments)*z_;return e=[],r=ri(-t[0]*z_,-t[1]*z_,0).invert,ai(a,n,c,1),t={type:"Polygon",coordinates:[e]},e=r=null,t}var e,r,i=ey([0,0]),o=ey(90),u=ey(6),a={point:t};return n.center=function(t){return arguments.length?(i="function"==typeof t?t:ey([+t[0],+t[1]]),n):i},n.radius=function(t){return arguments.length?(o="function"==typeof t?t:ey(+t),n):o},n.precision=function(t){return arguments.length?(u="function"==typeof t?t:ey(+t),n):u},n},yy=function(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:br,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}},gy=function(t,n,e,r,i,o){var u,a=t[0],c=t[1],s=n[0],f=n[1],l=0,h=1,p=s-a,d=f-c;if(u=e-a,p||!(u>0)){if(u/=p,p<0){if(u0){if(u>h)return;u>l&&(l=u)}if(u=i-a,p||!(u<0)){if(u/=p,p<0){if(u>h)return;u>l&&(l=u)}else if(p>0){if(u0)){if(u/=d,d<0){if(u0){if(u>h)return;u>l&&(l=u)}if(u=o-c,d||!(u<0)){if(u/=d,d<0){if(u>h)return;u>l&&(l=u)}else if(d>0){if(u0&&(t[0]=a+l*p,t[1]=c+l*d),h<1&&(n[0]=a+h*p,n[1]=c+h*d),!0}}}}},my=function(t,n){return P_(t[0]-n[0])=0;--o)i.point((f=s[o])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,s=h.z,p=!p}while(!h.v);i.lineEnd()}}},by=1e9,wy=-by,My=function(){var t,n,e,r=0,i=0,o=960,u=500;return e={stream:function(e){return t&&n===e?t:t=li(r,i,o,u)(n=e)},extent:function(a){return arguments.length?(r=+a[0][0],i=+a[0][1],o=+a[1][0],u=+a[1][1],t=n=null,e):[[r,i],[o,u]]}}},Ty=$v(),ky=function(t,n){var e=n[0],r=n[1],i=[I_(e),-q_(e),0],o=0,u=0;Ty.reset();for(var a=0,c=t.length;a=0?1:-1,T=M*w,k=T>N_,N=d*x;if(Ty.add(R_(N*M*I_(T),v*b+N*q_(T))),o+=k?w+M*A_:w,k^h>=e^g>=e){var S=Pr(Cr(l),Cr(y));qr(S);var E=Pr(i,S);qr(E);var A=(k^w>=0?-1:1)*mr(E[2]);(r>A||r===A&&(S[0]||S[1]))&&(u+=k^w>=0?1:-1)}}return(o<-k_||o0){for(x||(o.polygonStart(),x=!0),o.lineStart(),t=0;t1&&2&i&&u.push(u.pop().concat(u.shift())),d.push(u.filter(Xi))}var p,d,v,_=n(o),y=i.invert(r[0],r[1]),g=yy(),m=n(g),x=!1,b={point:u,lineStart:c,lineEnd:s,polygonStart:function(){b.point=f,b.lineStart=l,b.lineEnd=h,d=[],p=[]},polygonEnd:function(){b.point=u,b.lineStart=c,b.lineEnd=s,d=bf(d);var t=ky(p,y);d.length?(x||(o.polygonStart(),x=!0),xy(d,$i,t,e,o)):t&&(x||(o.polygonStart(),x=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),x&&(o.polygonEnd(),x=!1),d=p=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}};return b}},fg=sg(function(){return!0},Vi,Zi,[-N_,-S_]),lg=function(t,n){function e(e,r,i,o){ai(o,t,n,i,e,r)}function r(t,n){return q_(t)*q_(n)>a}function i(t){var n,e,i,a,f;return{lineStart:function(){a=i=!1,f=1},point:function(l,h){var p,d=[l,h],v=r(l,h),_=c?v?0:u(l,h):v?u(l+(l<0?N_:-N_),h):0;if(!n&&(a=i=v)&&t.lineStart(),v!==i&&(!(p=o(n,d))||my(n,p)||my(d,p))&&(d[0]+=k_,d[1]+=k_,v=r(d[0],d[1])),v!==i)f=0,v?(t.lineStart(),p=o(d,n),t.point(p[0],p[1])):(p=o(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(s&&n&&c^v){var y;_&e||!(y=o(d,n,!0))||(f=0,c?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!v||n&&my(n,d)||t.point(d[0],d[1]),n=d,i=v,e=_},lineEnd:function(){i&&t.lineEnd(),n=null},clean:function(){return f|(a&&i)<<1}}}function o(t,n,e){var r=Cr(t),i=Cr(n),o=[1,0,0],u=Pr(r,i),c=zr(u,u),s=u[0],f=c-s*s;if(!f)return!e&&t;var l=a*c/f,h=-a*s/f,p=Pr(o,u),d=Rr(o,l);Lr(d,Rr(u,h));var v=p,_=zr(d,v),y=zr(v,v),g=_*_-y*(zr(d,d)-1);if(!(g<0)){var m=B_(g),x=Rr(v,(-_-m)/y);if(Lr(x,d),x=Ar(x),!e)return x;var b,w=t[0],M=n[0],T=t[1],k=n[1];M0^x[1]<(P_(x[0]-w)N_^(w<=x[0]&&x[0]<=M)){var A=Rr(v,(-_+m)/y);return Lr(A,d),[x,Ar(A)]}}}function u(n,e){var r=c?t:N_-t,i=0;return n<-r?i|=1:n>r&&(i|=2),e<-r?i|=4:e>r&&(i|=8),i}var a=q_(t),c=a>0,s=P_(a)>k_;return sg(r,i,e,c?[0,-t]:[-N_,t-N_])},hg=function(t){return{stream:Gi(t)}};Ji.prototype={constructor:Ji,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var pg=16,dg=q_(30*z_),vg=function(t,n){return+n?no(t,n):to(t)},_g=Gi({point:function(t,n){this.stream.point(t*z_,n*z_)}}),yg=function(){return io(uo).scale(155.424).center([0,33.6442])},gg=function(){return yg().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])},mg=function(){function t(t){var n=t[0],e=t[1];return a=null,i.point(n,e),a||(o.point(n,e),a)||(u.point(n,e),a)}function n(){return e=r=null,t}var e,r,i,o,u,a,c=gg(),s=yg().rotate([154,0]).center([-2,58.5]).parallels([55,65]),f=yg().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){a=[t,n]}};return t.invert=function(t){var n=c.scale(),e=c.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?f:c).invert(t)},t.stream=function(t){return e&&r===t?e:e=ao([c.stream(r=t),s.stream(t),f.stream(t)])},t.precision=function(t){return arguments.length?(c.precision(t),s.precision(t),f.precision(t),n()):c.precision()},t.scale=function(n){return arguments.length?(c.scale(n),s.scale(.35*n),f.scale(n),t.translate(c.translate())):c.scale()},t.translate=function(t){if(!arguments.length)return c.translate();var e=c.scale(),r=+t[0],a=+t[1];return i=c.translate(t).clipExtent([[r-.455*e,a-.238*e],[r+.455*e,a+.238*e]]).stream(l),o=s.translate([r-.307*e,a+.201*e]).clipExtent([[r-.425*e+k_,a+.12*e+k_],[r-.214*e-k_,a+.234*e-k_]]).stream(l),u=f.translate([r-.205*e,a+.212*e]).clipExtent([[r-.214*e+k_,a+.166*e+k_],[r-.115*e-k_,a+.234*e-k_]]).stream(l),n()},t.fitExtent=function(n,e){return Qi(t,n,e)},t.fitSize=function(n,e){return Ki(t,n,e)},t.scale(1070)},xg=co(function(t){return B_(2/(1+t))});xg.invert=so(function(t){return 2*mr(t/2)});var bg=function(){return eo(xg).scale(124.75).clipAngle(179.999)},wg=co(function(t){return(t=gr(t))&&t/I_(t)});wg.invert=so(function(t){return t});var Mg=function(){return eo(wg).scale(79.4188).clipAngle(179.999)};fo.invert=function(t,n){return[t,2*L_(D_(n))-S_]};var Tg=function(){return lo(fo).scale(961/A_)},kg=function(){return io(po).scale(109.5).parallels([30,30])};vo.invert=vo;var Ng=function(){return eo(vo).scale(152.63)},Sg=function(){return io(_o).scale(131.154).center([0,13.9389])};yo.invert=so(L_);var Eg=function(){return eo(yo).scale(144.049).clipAngle(60)},Ag=function(){function t(){return i=o=null,u}var n,e,r,i,o,u,a=1,c=0,s=0,f=1,l=1,h=Uy,p=null,d=Uy;return u={stream:function(t){return i&&o===t?i:i=h(d(o=t))},clipExtent:function(i){return arguments.length?(d=null==i?(p=n=e=r=null,Uy):li(p=+i[0][0],n=+i[0][1],e=+i[1][0],r=+i[1][1]),t()):null==p?null:[[p,n],[e,r]]},scale:function(n){return arguments.length?(h=go((a=+n)*f,a*l,c,s),t()):a},translate:function(n){return arguments.length?(h=go(a*f,a*l,c=+n[0],s=+n[1]),t()):[c,s]},reflectX:function(n){return arguments.length?(h=go(a*(f=n?-1:1),a*l,c,s),t()):f<0},reflectY:function(n){return arguments.length?(h=go(a*f,a*(l=n?-1:1),c,s),t()):l<0},fitExtent:function(t,n){return Qi(u,t,n)},fitSize:function(t,n){return Ki(u,t,n)}}};mo.invert=so(mr);var Cg=function(){return eo(mo).scale(249.5).clipAngle(90+k_)};xo.invert=so(function(t){return 2*L_(t)});var zg=function(){return eo(xo).scale(250).clipAngle(142)};bo.invert=function(t,n){return[-n,2*L_(D_(t))-S_]};var Pg=function(){var t=lo(bo),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):(t=n(),[t[1],-t[0]])},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):(t=e(),[t[0],t[1],t[2]-90])},e([0,0,90]).scale(159.155)},Lg=function(){function t(t){var o,u=0;t.eachAfter(function(t){var e=t.children;e?(t.x=Mo(e),t.y=ko(e)):(t.x=o?u+=n(t,o):0,t.y=0,o=t)});var a=So(t),c=Eo(t),s=a.x-n(a,c)/2,f=c.x+n(c,a)/2;return t.eachAfter(i?function(n){n.x=(n.x-t.x)*e,n.y=(t.y-n.y)*r}:function(n){n.x=(n.x-s)/(f-s)*e,n.y=(1-(t.y?n.y/t.y:1))*r})}var n=wo,e=1,r=1,i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(n){return arguments.length?(i=!1,e=+n[0],r=+n[1],t):i?null:[e,r]},t.nodeSize=function(n){return arguments.length?(i=!0,e=+n[0],r=+n[1],t):i?[e,r]:null},t},Rg=function(){return this.eachAfter(Ao)},qg=function(t){var n,e,r,i,o=this,u=[o];do{for(n=u.reverse(),u=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r=0;--e)i.push(n[e]);return this},Dg=function(t){for(var n,e,r,i=this,o=[i],u=[];i=o.pop();)if(u.push(i),n=i.children)for(e=0,r=n.length;e=0;)e+=r[i].value;n.value=e})},Fg=function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},Ig=function(t){for(var n=this,e=Co(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},Yg=function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},Bg=function(){var t=[];return this.each(function(n){t.push(n)}),t},Hg=function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},jg=function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n};Uo.prototype=zo.prototype={constructor:Uo,count:Rg,each:qg,eachAfter:Dg,eachBefore:Ug,sum:Og,sort:Fg,path:Ig,ancestors:Yg,descendants:Bg,leaves:Hg,links:jg,copy:Po};var Xg=function(t){for(var n=(t=t.slice()).length,e=null,r=e;n;){var i=new Do(t[n-1]);r=r?r.next=i:e=i,t[void 0]=t[--n]}return{head:e,tail:r}},$g=function(t){return Fo(Xg(t),[])},Vg=function(t){return Vo(t),t},Wg=function(t){return function(){return t}},Zg=function(){function t(t){return t.x=e/2,t.y=r/2,n?t.eachBefore(Qo(n)).eachAfter(Ko(i,.5)).eachBefore(tu(1)):t.eachBefore(Qo(Jo)).eachAfter(Ko(Go,1)).eachAfter(Ko(i,t.r/Math.min(e,r))).eachBefore(tu(Math.min(e,r)/(2*t.r))),t}var n=null,e=1,r=1,i=Go;return t.radius=function(e){return arguments.length?(n=Wo(e),t):n},t.size=function(n){return arguments.length?(e=+n[0],r=+n[1],t):[e,r]},t.padding=function(n){return arguments.length?(i="function"==typeof n?n:Wg(+n),t):i},t},Gg=function(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)},Jg=function(t,n,e,r,i){for(var o,u=t.children,a=-1,c=u.length,s=t.value&&(r-n)/t.value;++a0)throw new Error("cycle");return o}var n=nu,e=eu;return t.id=function(e){return arguments.length?(n=Zo(e),t):n},t.parentId=function(n){return arguments.length?(e=Zo(n),t):e},t};su.prototype=Object.create(Uo.prototype);var rm=function(){function t(t){var r=fu(t);if(r.eachAfter(n),r.parent.m=-r.z,r.eachBefore(e),c)t.eachBefore(i);else{var s=t,f=t,l=t;t.eachBefore(function(t){t.xf.x&&(f=t),t.depth>l.depth&&(l=t)});var h=s===f?1:o(s,f)/2,p=h-s.x,d=u/(f.x+h+p),v=a/(l.depth||1);t.eachBefore(function(t){t.x=(t.x+p)*d,t.y=t.depth*v})}return t}function n(t){var n=t.children,e=t.parent.children,i=t.i?e[t.i-1]:null;if(n){au(t);var u=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+o(t._,i._),t.m=t.z-u):t.z=u}else i&&(t.z=i.z+o(t._,i._));t.parent.A=r(t,i,t.parent.A||e[0])}function e(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function r(t,n,e){if(n){for(var r,i=t,u=t,a=n,c=i.parent.children[0],s=i.m,f=u.m,l=a.m,h=c.m;a=ou(a),i=iu(i),a&&i;)c=iu(c),u=ou(u),u.a=t,r=a.z+l-i.z-s+o(a._,i._),r>0&&(uu(cu(a,t,e),t,r),s+=r,f+=r),l+=a.m,s+=i.m,h+=c.m,f+=u.m;a&&!ou(u)&&(u.t=a,u.m+=l-f),i&&!iu(c)&&(c.t=i,c.m+=s-h,e=t)}return e}function i(t){t.x*=u,t.y=t.depth*a}var o=ru,u=1,a=1,c=null;return t.separation=function(n){return arguments.length?(o=n,t):o},t.size=function(n){return arguments.length?(c=!1,u=+n[0],a=+n[1],t):c?null:[u,a]},t.nodeSize=function(n){return arguments.length?(c=!0,u=+n[0],a=+n[1],t):c?[u,a]:null},t},im=function(t,n,e,r,i){for(var o,u=t.children,a=-1,c=u.length,s=t.value&&(i-e)/t.value;++a1?n:1)},e}(om),am=function(){function t(t){return t.x0=t.y0=0,t.x1=i,t.y1=o,t.eachBefore(n),u=[0],r&&t.eachBefore(Gg),t}function n(t){var n=u[t.depth],r=t.x0+n,i=t.y0+n,o=t.x1-n,h=t.y1-n;o=n-1){var s=c[t];return s.x0=r,s.y0=i,s.x1=u,s.y1=a,void 0}for(var l=f[t],h=e/2+l,p=t+1,d=n-1;p>>1;f[v]a-i){var g=(r*y+u*_)/e;o(t,p,_,r,i,g,a),o(p,n,y,g,i,u,a)}else{var m=(i*y+a*_)/e;o(t,p,_,r,i,u,m),o(p,n,y,r,m,u,a)}}var u,a,c=t.children,s=c.length,f=new Array(s+1);for(f[0]=a=u=0;u1?n:1)},e}(om),lm=function(t){for(var n,e=-1,r=t.length,i=t[r-1],o=0;++e=0;--n)s.push(t[r[o[n]][2]]);for(n=+a;na!=s>a&&u<(c-e)*(a-r)/(s-r)+e&&(f=!f),c=e,s=r;return f},_m=function(t){for(var n,e,r=-1,i=t.length,o=t[i-1],u=o[0],a=o[1],c=0;++r1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(mm),wm=function t(n){function e(){var t=bm.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(mm),Mm=function t(n){function e(t){return function(){for(var e=0,r=0;r=200&&e<300||304===e){if(o)try{n=o.call(r,s)}catch(t){return void a.call("error",r,t)}else n=s;a.call("load",r,n)}else a.call("error",r,t)}var r,i,o,u,a=v("beforesend","progress","load","error"),c=He(),s=new XMLHttpRequest,f=null,l=null,h=0;if("undefined"==typeof XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=s.ontimeout=e:s.onreadystatechange=function(t){s.readyState>3&&e(t)},s.onprogress=function(t){a.call("progress",r,t)},r={header:function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?c.get(t):(null==n?c.remove(t):c.set(t,n+""),r)},mimeType:function(t){return arguments.length?(i=null==t?null:t+"",r):i},responseType:function(t){return arguments.length?(u=t,r):u},timeout:function(t){return arguments.length?(h=+t,r):h},user:function(t){return arguments.length<1?f:(f=null==t?null:t+"",r)},password:function(t){return arguments.length<1?l:(l=null==t?null:t+"",r)},response:function(t){return o=t,r},get:function(t,n){return r.send("GET",t,n)},post:function(t,n){return r.send("POST",t,n)},send:function(n,e,o){return s.open(n,t,!0,f,l),null==i||c.has("accept")||c.set("accept",i+",*/*"),s.setRequestHeader&&c.each(function(t,n){s.setRequestHeader(n,t)}),null!=i&&s.overrideMimeType&&s.overrideMimeType(i),null!=u&&(s.responseType=u),h>0&&(s.timeout=h),null==o&&"function"==typeof e&&(o=e,e=null),null!=o&&1===o.length&&(o=bu(o)),null!=o&&r.on("error",o).on("load",function(t){o(null,t)}),a.call("beforesend",r,s),s.send(null==e?null:e),r},abort:function(){return s.abort(),r},on:function(){var t=a.on.apply(a,arguments);return t===a?r:t}},null!=n){if("function"!=typeof n)throw new Error("invalid callback: "+n);return r.get(n)}return r},Sm=function(t,n){return function(e,r){var i=Nm(e).mimeType(t).response(n);if(null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return i.get(r)}return i}},Em=Sm("text/html",function(t){return document.createRange().createContextualFragment(t.responseText)}),Am=Sm("application/json",function(t){return JSON.parse(t.responseText)}),Cm=Sm("text/plain",function(t){return t.responseText}),zm=Sm("application/xml",function(t){var n=t.responseXML;if(!n)throw new Error("parse error");return n}),Pm=function(t,n){return function(e,r,i){arguments.length<3&&(i=r,r=null);var o=Nm(e).mimeType(t);return o.row=function(t){return arguments.length?o.response(Mu(n,r=t)):r},o.row(r),i?o.get(i):o}},Lm=Pm("text/csv",Zd),Rm=Pm("text/tab-separated-values",tv),qm=Array.prototype,Um=qm.map,Dm=qm.slice,Om={name:"implicit"},Fm=function(t){return function(){return t}},Im=function(t){return+t},Ym=[0,1],Bm=function(n,e,r){var o,u=n[0],a=n[n.length-1],c=i(u,a,null==e?10:e);switch(r=pr(null==r?",f":r),r.type){case"s":var s=Math.max(Math.abs(u),Math.abs(a));return null!=r.precision||isNaN(o=jv(c,s))||(r.precision=o),t.formatPrefix(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(o=Xv(c,Math.max(Math.abs(u),Math.abs(a))))||(r.precision=o-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(o=Hv(c))||(r.precision=o-2*("%"===r.type))}return t.format(r)},Hm=function(t,n){t=t.slice();var e,r=0,i=t.length-1,o=t[r],u=t[i];return u0?t>1?Ju(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):$m:null};var Vm=$m.range,Wm=6e4,Zm=6048e5,Gm=Ju(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),Jm=Gm.range,Qm=Ju(function(t){t.setTime(Math.floor(t/Wm)*Wm)},function(t,n){t.setTime(+t+n*Wm)},function(t,n){return(n-t)/Wm},function(t){return t.getMinutes()}),Km=Qm.range,tx=Ju(function(t){var n=t.getTimezoneOffset()*Wm%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()}),nx=tx.range,ex=Ju(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Wm)/864e5},function(t){return t.getDate()-1}),rx=ex.range,ix=Qu(0),ox=Qu(1),ux=Qu(2),ax=Qu(3),cx=Qu(4),sx=Qu(5),fx=Qu(6),lx=ix.range,hx=ox.range,px=ux.range,dx=ax.range,vx=cx.range,_x=sx.range,yx=fx.range,gx=Ju(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),mx=gx.range,xx=Ju(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});xx.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ju(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};var bx=xx.range,wx=Ju(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Wm)},function(t,n){return(n-t)/Wm},function(t){return t.getUTCMinutes()}),Mx=wx.range,Tx=Ju(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()}),kx=Tx.range,Nx=Ju(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1}),Sx=Nx.range,Ex=Ku(0),Ax=Ku(1),Cx=Ku(2),zx=Ku(3),Px=Ku(4),Lx=Ku(5),Rx=Ku(6),qx=Ex.range,Ux=Ax.range,Dx=Cx.range,Ox=zx.range,Fx=Px.range,Ix=Lx.range,Yx=Rx.range,Bx=Ju(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),Hx=Bx.range,jx=Ju(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});jx.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ju(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var Xx,$x=jx.range,Vx={"-":"",_:" ",0:"0"},Wx=/^\s*\d+/,Zx=/^%/,Gx=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;Ja({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Jx=Date.prototype.toISOString?Qa:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ"),Qx=+new Date("2000-01-01T00:00:00.000Z")?Ka:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ"),Kx=1e3,tb=60*Kx,nb=60*tb,eb=24*nb,rb=7*eb,ib=30*eb,ob=365*eb,ub=function(){return ec(xx,gx,ix,ex,tx,Qm,Gm,$m,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},ab=function(){return ec(jx,Bx,Ex,Nx,Tx,wx,Gm,$m,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},cb=function(t){return t.match(/.{6}/g).map(function(t){return"#"+t})},sb=cb("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),fb=cb("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),lb=cb("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),hb=cb("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),pb=Zh(Wt(300,.5,0),Wt(-240,.5,1)),db=Zh(Wt(-100,.75,.35),Wt(80,1.5,.8)),vb=Zh(Wt(260,.75,.35),Wt(80,1.5,.8)),_b=Wt(),yb=function(t){(t<0||t>1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return _b.h=360*t-100,_b.s=1.5-1.5*n,_b.l=.8-.9*n,_b+""},gb=rc(cb("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),mb=rc(cb("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),xb=rc(cb("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),bb=rc(cb("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),wb=function(t){return function(){return t}},Mb=Math.abs,Tb=Math.atan2,kb=Math.cos,Nb=Math.max,Sb=Math.min,Eb=Math.sin,Ab=Math.sqrt,Cb=1e-12,zb=Math.PI,Pb=zb/2,Lb=2*zb,Rb=function(){function t(){var t,s,f=+n.apply(this,arguments),l=+e.apply(this,arguments),h=o.apply(this,arguments)-Pb,p=u.apply(this,arguments)-Pb,d=Mb(p-h),v=p>h;if(c||(c=t=Ue()),lCb)if(d>Lb-Cb)c.moveTo(l*kb(h),l*Eb(h)),c.arc(0,0,l,h,p,!v),f>Cb&&(c.moveTo(f*kb(p),f*Eb(p)),c.arc(0,0,f,p,h,v));else{var _,y,g=h,m=p,x=h,b=p,w=d,M=d,T=a.apply(this,arguments)/2,k=T>Cb&&(i?+i.apply(this,arguments):Ab(f*f+l*l)),N=Sb(Mb(l-f)/2,+r.apply(this,arguments)),S=N,E=N;if(k>Cb){var A=uc(k/f*Eb(T)),C=uc(k/l*Eb(T));(w-=2*A)>Cb?(A*=v?1:-1,x+=A,b-=A):(w=0,x=b=(h+p)/2),(M-=2*C)>Cb?(C*=v?1:-1,g+=C,m-=C):(M=0,g=m=(h+p)/2)}var z=l*kb(g),P=l*Eb(g),L=f*kb(b),R=f*Eb(b);if(N>Cb){var q=l*kb(m),U=l*Eb(m),D=f*kb(x),O=f*Eb(x);if(dCb?hc(z,P,D,O,q,U,L,R):[L,R],I=z-F[0],Y=P-F[1],B=q-F[0],H=U-F[1],j=1/Eb(oc((I*B+Y*H)/(Ab(I*I+Y*Y)*Ab(B*B+H*H)))/2),X=Ab(F[0]*F[0]+F[1]*F[1]);S=Sb(N,(f-X)/(j-1)),E=Sb(N,(l-X)/(j+1))}}M>Cb?E>Cb?(_=pc(D,O,z,P,l,E,v),y=pc(q,U,L,R,l,E,v),c.moveTo(_.cx+_.x01,_.cy+_.y01),ECb&&w>Cb?S>Cb?(_=pc(L,R,q,U,f,-S,v),y=pc(z,P,D,O,f,-S,v),c.lineTo(_.cx+_.x01,_.cy+_.y01),S=f;--l)s.point(_[l],y[l]);s.lineEnd(),s.areaEnd()}v&&(_[n]=+e(h,n,t),y[n]=+i(h,n,t),s.point(r?+r(h,n,t):_[n],o?+o(h,n,t):y[n]))}if(p)return s=null,p+""||null}function n(){return Ub().defined(u).curve(c).context(a)}var e=vc,r=null,i=wb(0),o=_c,u=wb(!0),a=null,c=qb,s=null;return t.x=function(n){return arguments.length?(e="function"==typeof n?n:wb(+n),r=null,t):e},t.x0=function(n){return arguments.length?(e="function"==typeof n?n:wb(+n),t):e},t.x1=function(n){return arguments.length?(r=null==n?null:"function"==typeof n?n:wb(+n),t):r},t.y=function(n){return arguments.length?(i="function"==typeof n?n:wb(+n),o=null,t):i},t.y0=function(n){return arguments.length?(i="function"==typeof n?n:wb(+n),t):i},t.y1=function(n){return arguments.length?(o=null==n?null:"function"==typeof n?n:wb(+n),t):o},t.lineX0=t.lineY0=function(){return n().x(e).y(i)},t.lineY1=function(){return n().x(e).y(o)},t.lineX1=function(){return n().x(r).y(i)},t.defined=function(n){return arguments.length?(u="function"==typeof n?n:wb(!!n),t):u},t.curve=function(n){return arguments.length?(c=n,null!=a&&(s=c(a)),t):c},t.context=function(n){return arguments.length?(null==n?a=s=null:s=c(a=n),t):a},t},Ob=function(t,n){return nt?1:n>=t?0:NaN},Fb=function(t){return t},Ib=function(){function t(t){var a,c,s,f,l,h=t.length,p=0,d=new Array(h),v=new Array(h),_=+i.apply(this,arguments),y=Math.min(Lb,Math.max(-Lb,o.apply(this,arguments)-_)),g=Math.min(Math.abs(y)/h,u.apply(this,arguments)),m=g*(y<0?-1:1);for(a=0;a0&&(p+=l);for(null!=e?d.sort(function(t,n){return e(v[t],v[n])}):null!=r&&d.sort(function(n,e){return r(t[n],t[e])}),a=0,s=p?(y-h*m)/p:0;a0?l*s:0)+m,v[c]={data:t[c],index:a,value:l,startAngle:_,endAngle:f,padAngle:g};return v}var n=Fb,e=Ob,r=null,i=wb(0),o=wb(Lb),u=wb(0);return t.value=function(e){return arguments.length?(n="function"==typeof e?e:wb(+e),t):n},t.sortValues=function(n){return arguments.length?(e=n,r=null,t):e},t.sort=function(n){return arguments.length?(r=n,e=null,t):r},t.startAngle=function(n){return arguments.length?(i="function"==typeof n?n:wb(+n),t):i},t.endAngle=function(n){return arguments.length?(o="function"==typeof n?n:wb(+n),t):o},t.padAngle=function(n){return arguments.length?(u="function"==typeof n?n:wb(+n),t):u},t},Yb=gc(qb);yc.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var Bb=function(){return mc(Ub().curve(Yb))},Hb=function(){var t=Db().curve(Yb),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return mc(e())},delete t.lineX0,t.lineEndAngle=function(){return mc(r())},delete t.lineX1,t.lineInnerRadius=function(){return mc(i())},delete t.lineY0,t.lineOuterRadius=function(){return mc(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(gc(t)):n()._curve},t},jb=Array.prototype.slice,Xb=function(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]},$b={draw:function(t,n){var e=Math.sqrt(n/zb);t.moveTo(e,0),t.arc(0,0,e,0,Lb)}},Vb={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},Wb=Math.sqrt(1/3),Zb=2*Wb,Gb={draw:function(t,n){var e=Math.sqrt(n/Zb),r=e*Wb;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},Jb=Math.sin(zb/10)/Math.sin(7*zb/10),Qb=Math.sin(Lb/10)*Jb,Kb=-Math.cos(Lb/10)*Jb,tw={draw:function(t,n){var e=Math.sqrt(.8908130915292852*n),r=Qb*e,i=Kb*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var u=Lb*o/5,a=Math.cos(u),c=Math.sin(u);t.lineTo(c*e,-a*e),t.lineTo(a*r-c*i,c*r+a*i)}t.closePath()}},nw={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},ew=Math.sqrt(3),rw={draw:function(t,n){var e=-Math.sqrt(n/(3*ew));t.moveTo(0,2*e),t.lineTo(-ew*e,-e),t.lineTo(ew*e,-e),t.closePath()}},iw=-.5,ow=Math.sqrt(3)/2,uw=1/Math.sqrt(12),aw=3*(uw/2+1),cw={draw:function(t,n){var e=Math.sqrt(n/aw),r=e/2,i=e*uw,o=r,u=e*uw+e,a=-o,c=u;t.moveTo(r,i),t.lineTo(o,u),t.lineTo(a,c),t.lineTo(iw*r-ow*i,ow*r+iw*i),t.lineTo(iw*o-ow*u,ow*o+iw*u),t.lineTo(iw*a-ow*c,ow*a+iw*c),t.lineTo(iw*r+ow*i,iw*i-ow*r),t.lineTo(iw*o+ow*u,iw*u-ow*o),t.lineTo(iw*a+ow*c,iw*c-ow*a),t.closePath()}},sw=[$b,Vb,Gb,nw,tw,rw,cw],fw=function(){function t(){var t;if(r||(r=t=Ue()),n.apply(this,arguments).draw(r,+e.apply(this,arguments)),t)return r=null,t+""||null}var n=wb($b),e=wb(64),r=null;return t.type=function(e){return arguments.length?(n="function"==typeof e?e:wb(e),t):n},t.size=function(n){return arguments.length?(e="function"==typeof n?n:wb(+n),t):e},t.context=function(n){return arguments.length?(r=null==n?null:n,t):r},t},lw=function(){};Cc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ac(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ac(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var hw=function(t){return new Cc(t)};zc.prototype={areaStart:lw,areaEnd:lw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Ac(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var pw=function(t){return new zc(t)};Pc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Ac(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var dw=function(t){return new Pc(t)};Lc.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],u=t[e]-i,a=n[e]-o,c=-1;++c<=e;)r=c/e,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*u),this._beta*n[c]+(1-this._beta)*(o+r*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var vw=function t(n){function e(t){return 1===n?new Cc(t):new Lc(t,n)}return e.beta=function(n){return t(+n)},e}(.85);qc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Rc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Rc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1, +this._y1=this._y2,this._y2=n}};var _w=function t(n){function e(t){return new qc(t,n)}return e.tension=function(n){return t(+n)},e}(0);Uc.prototype={areaStart:lw,areaEnd:lw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Rc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var yw=function t(n){function e(t){return new Uc(t,n)}return e.tension=function(n){return t(+n)},e}(0);Dc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Rc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var gw=function t(n){function e(t){return new Dc(t,n)}return e.tension=function(n){return t(+n)},e}(0);Fc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Oc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var mw=function t(n){function e(t){return n?new Fc(t,n):new qc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Ic.prototype={areaStart:lw,areaEnd:lw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Oc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var xw=function t(n){function e(t){return n?new Ic(t,n):new Uc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Yc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Oc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var bw=function t(n){function e(t){return n?new Yc(t,n):new Dc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Bc.prototype={areaStart:lw,areaEnd:lw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}};var ww=function(t){return new Bc(t)};Vc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:$c(this,this._t0,Xc(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(t=+t,n=+n,t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,$c(this,Xc(this,e=jc(this,t,n)),e);break;default:$c(this,this._t0,e=jc(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(Wc.prototype=Object.create(Vc.prototype)).point=function(t,n){Vc.prototype.point.call(this,n,t)},Zc.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},Qc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=Kc(t),i=Kc(n),o=0,u=1;u=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};var Tw=function(t){return new ts(t,.5)},kw=function(t,n){if((i=t.length)>1)for(var e,r,i,o=1,u=t[n[0]],a=u.length;o=0;)e[n]=n;return e},Sw=function(){function t(t){var o,u,a=n.apply(this,arguments),c=t.length,s=a.length,f=new Array(s);for(o=0;o0){for(var e,r,i,o=0,u=t[0].length;o1)for(var e,r,i,o,u,a,c=0,s=t[n[0]].length;c=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=u,r[0]=u+=i):r[0]=o},Cw=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,u=1;u=a)return null;var c=t-i.site[0],s=n-i.site[1],f=c*c+s*s;do{i=o.cells[r=u],u=null,i.halfedges.forEach(function(e){var r=o.edges[e],a=r.left;if(a!==i.site&&a||(a=r.right)){var c=t-a[0],s=n-a[1],l=c*c+s*s;le?(e+r)/2:Math.min(0,e)||Math.max(0,r),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function o(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function u(t,n,e){t.on("start.zoom",function(){a(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){a(this,arguments).end()}).tween("zoom",function(){var t=this,r=arguments,i=a(t,r),u=m.apply(t,r),c=e||o(u),s=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),f=t.__zoom,l="function"==typeof n?n.apply(t,r):n,h=S(f.invert(c).concat(s/f.k),l.invert(c).concat(s/l.k));return function(t){if(1===t)t=l;else{var n=h(t),e=s/n[2];t=new Os(e,c[0]-n[0]*e,c[1]-n[1]*e)}i.zoom(null,t)}})}function a(t,n){for(var e,r=0,i=E.length;rL}o.zoom("mouse",i(r(o.that.__zoom,o.mouse[0]=Gf(o.that),o.mouse[1]),o.extent))}function e(){u.on("mousemove.zoom mouseup.zoom",null),mt(t.event.view,o.moved),Zw(),o.end()}if(!y&&g.apply(this,arguments)){var o=a(this,arguments),u=Pl(t.event.view).on("mousemove.zoom",n,!0).on("mouseup.zoom",e,!0),c=Gf(this),s=t.event.clientX,f=t.event.clientY;Dl(t.event.view),Is(),o.mouse=[c,this.__zoom.invert(c)],gp(this),o.start()}}function l(){if(g.apply(this,arguments)){var o=this.__zoom,a=Gf(this),c=o.invert(a),s=o.k*(t.event.shiftKey?.5:2),f=i(r(e(o,s),a,c),m.apply(this,arguments));Zw(),N>0?Pl(this).transition().duration(N).call(u,f,a):Pl(this).call(n.transform,f)}}function h(){if(g.apply(this,arguments)){var n,e,r,i,o=a(this,arguments),u=t.event.changedTouches,c=u.length;for(Is(),e=0;e + + + + + + + + + + + +
+
+

CinemaCompare

+
+ +
+
+
+
+
+
Image Size
+ +
+
+
+
+
+ +
 
+ + + + + + diff --git a/examples/WitU/cintools/__init__.py b/examples/WitU/cintools/__init__.py new file mode 100644 index 00000000..be28f886 --- /dev/null +++ b/examples/WitU/cintools/__init__.py @@ -0,0 +1,2 @@ +from . import install +from . import cdb diff --git a/examples/WitU/cintools/__pycache__/__init__.cpython-36.pyc b/examples/WitU/cintools/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 00000000..e34b50ff Binary files /dev/null and b/examples/WitU/cintools/__pycache__/__init__.cpython-36.pyc differ diff --git a/examples/WitU/cintools/__pycache__/__init__.cpython-37.pyc b/examples/WitU/cintools/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 00000000..f0f12cb0 Binary files /dev/null and b/examples/WitU/cintools/__pycache__/__init__.cpython-37.pyc differ diff --git a/examples/WitU/cintools/cdb/__init__.py b/examples/WitU/cintools/cdb/__init__.py new file mode 100644 index 00000000..fe59763e --- /dev/null +++ b/examples/WitU/cintools/cdb/__init__.py @@ -0,0 +1 @@ +from . import cdb diff --git a/examples/WitU/cintools/cdb/__pycache__/__init__.cpython-36.pyc b/examples/WitU/cintools/cdb/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 00000000..f2c0097a Binary files /dev/null and b/examples/WitU/cintools/cdb/__pycache__/__init__.cpython-36.pyc differ diff --git a/examples/WitU/cintools/cdb/__pycache__/__init__.cpython-37.pyc b/examples/WitU/cintools/cdb/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 00000000..93026c1d Binary files /dev/null and b/examples/WitU/cintools/cdb/__pycache__/__init__.cpython-37.pyc differ diff --git a/examples/WitU/cintools/cdb/__pycache__/cdb.cpython-36.pyc b/examples/WitU/cintools/cdb/__pycache__/cdb.cpython-36.pyc new file mode 100644 index 00000000..e77260b8 Binary files /dev/null and b/examples/WitU/cintools/cdb/__pycache__/cdb.cpython-36.pyc differ diff --git a/examples/WitU/cintools/cdb/__pycache__/cdb.cpython-37.pyc b/examples/WitU/cintools/cdb/__pycache__/cdb.cpython-37.pyc new file mode 100644 index 00000000..7966fc9e Binary files /dev/null and b/examples/WitU/cintools/cdb/__pycache__/cdb.cpython-37.pyc differ diff --git a/examples/WitU/cintools/cdb/cdb.py b/examples/WitU/cintools/cdb/cdb.py new file mode 100644 index 00000000..2cb886d8 --- /dev/null +++ b/examples/WitU/cintools/cdb/cdb.py @@ -0,0 +1,49 @@ +import os.path + +class CDB: + + def __init__(self, path): + self.path = path + self.datafile = os.path.join(path, "data.csv") + self.keys = [] + self.entries = [] + + def create(self): + result = True + + os.makedirs(self.path) + + return result + + def add_entry(self, parameters): + for param in parameters: + if not param in self.keys: + self.keys.append(param) + self.entries.append(parameters) + + def __write_entry(self, parameters): + print(parameters) + + def finalize(self): + with open( self.datafile, "w+") as dfile: + notFirst = False + for key in self.keys: + if notFirst: + dfile.write(",") + else: + notFirst = True + dfile.write("{}".format(key)) + dfile.write("\n") + + for entry in self.entries: + notFirst = False + for key in self.keys: + if notFirst: + dfile.write(",") + else: + notFirst = True + if key in entry: + dfile.write("{}".format(entry[key])) + dfile.write("\n") + + diff --git a/examples/WitU/cintools/cinema.source/compare/1.0/cinema_compare.html b/examples/WitU/cintools/cinema.source/compare/1.0/cinema_compare.html new file mode 100644 index 00000000..88e382ab --- /dev/null +++ b/examples/WitU/cintools/cinema.source/compare/1.0/cinema_compare.html @@ -0,0 +1,187 @@ + + + + + + + + + + + + +
+
+

CinemaCompare

+
+ +
+
+
+
+
+
Image Size
+ +
+
+
+
+
+ +
 
+ + + + + + diff --git a/examples/WitU/cintools/cinema.source/compare/1.0/css/common.css b/examples/WitU/cintools/cinema.source/compare/1.0/css/common.css new file mode 100644 index 00000000..b12697a2 --- /dev/null +++ b/examples/WitU/cintools/cinema.source/compare/1.0/css/common.css @@ -0,0 +1,29 @@ +* { + font-family: helvetica !important; +} + +div.container { + width: 100%; + border: 1px solid gray; +} + +body { + background-color: #f9f9f9; +} + +header, footer { + padding-left: 1px; + padding-right: 1px; + padding-top: 10px; + padding-bottom: 10px; + color: white; + background-color: #373737; + clear: left; + text-align: center; +} + +#header h2 { + display: inline-block; + margin: initial; +} + diff --git a/examples/WitU/cintools/cinema.source/compare/1.0/css/compare.css b/examples/WitU/cintools/cinema.source/compare/1.0/css/compare.css new file mode 100644 index 00000000..8080383d --- /dev/null +++ b/examples/WitU/cintools/cinema.source/compare/1.0/css/compare.css @@ -0,0 +1,26 @@ +#resultsArea { + float: left; + left: 0px; + right: 0px; + width: 100%; + padding: 10px; + background-color: white; +} + +.imageArea { + float: left; + position: relative; + width: 75%; +} + +.sliderArea { + float: left; + position: relative; + width: 20%; +} + +.cinemaImage { + float: left; + position: relative; + padding: 2px; +} diff --git a/examples/WitU/cintools/cinema.source/compare/1.0/images/empty.png b/examples/WitU/cintools/cinema.source/compare/1.0/images/empty.png new file mode 100644 index 00000000..c0f72016 Binary files /dev/null and b/examples/WitU/cintools/cinema.source/compare/1.0/images/empty.png differ diff --git a/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.js b/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.js new file mode 100644 index 00000000..7cc0f065 --- /dev/null +++ b/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.js @@ -0,0 +1,5055 @@ +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * DATABASE + * + * The Database module for the CINEMA_COMPONENTS library. + * Contains functions and objects for dealing with the purely data-related + * parts of a SpecD database. (Parsing, Querying, etc. data. No GUI stuff) + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + /** @type {boolean} - Flag to indicate that the Database module has been included */ + CINEMA_COMPONENTS.DATABASE_INCLUDED = true; + + /** + * Enum for the type of dimension (column) + * @enum {number} + */ + CINEMA_COMPONENTS.DIMENSION_TYPE = Object.freeze({ + INTEGER: 0, + FLOAT: 1, + STRING: 2 + }); + + /** + * Database + * Creates a new instance of Database which represents the data in a SpecD Database + * + * @constructor + * @param {string} directory - Path to the '.cdb' directory containing the database + * @param {function({Database} self)} callback - Function to call when loading has finished + * (only called if loading finished without errors) + * @param {function({string} message)} errorCallback - Function to call if errors were found with data + * @param {Object} filter - An object defining a filter to apply to the incoming data (so that + * only some of the data from the file is actually represented in the database). Keys in the + * filter object should match a numeric dimension and contain an array of two values representing + * the minimum and maximum values to allow. + */ + CINEMA_COMPONENTS.Database = function(directory, callback, errorCallback, filter) { + /** @type {string} - Path to the '.cdb' directory containing the database */ + this.directory = directory; + + /** @type {boolean} - Whether or not the database has finished loading */ + this.loaded = false; + + /** @type {string?} - The error message for errors found in the data. Undefined if no errors */ + this.error; + + /** @type {Object[]} - An array of the data rows */ + this.data = []; + /** @type {string[]} - An array of dimension names for the data (column headers) */ + this.dimensions = []; + /** @type {Object} - Contains the type for each dimension */ + this.dimensionTypes = {}; + /** @type {Object} - Contains the domains for each dimension (formatted like the domain for a d3 scale) */ + this.dimensionDomains = {}; + + /** @type {Object} - The filter applied to incoming data */ + this.filter = filter + + /** @type {boolean} Whether or not this database has additional axis ordering data */ + this.hasAxisOrdering = false; + /** @type {Object} Axis Ordering data (if it exists) */ + this.axisOrderData; + + this.dispatch = d3.dispatch("dataUpdated"); + + this.errorCallback = errorCallback; + + var self = this; + self.path = directory+'/data.csv'; + getAndParseCSV(self.path, function(data_arr, request) { + self.prevContentLength = request.getResponseHeader('Content-Length'); + + //Check for errors + self.error = checkErrors(data_arr); + if (self.error) { + console.warn(self.error); + if (errorCallback) + errorCallback(); + return; + } + + calcData(self, data_arr); + + //Attempt to load an axis_order.csv file + getAndParseCSV(directory+'/axis_order.csv', + //Normal callback, if axis_order.csv found + function(axis_data_arr) { + var error = checkAxisDataErrors(axis_data_arr,self.dimensions); + if (!error) { + self.hasAxisOrdering = true; + self.axisOrderData = parseAxisOrderData(axis_data_arr); + } + else + console.warn("ERROR in axis_order.csv: " + error); + self.loaded = true; + if (callback) + callback(self); + }, + //Error callback, if axis_order.csv request fails + function() { + self.loaded = true; + if (callback) + callback(self); + } + ); + //errorCallback. If data.csv request fails + }, function() { + if (errorCallback) + errorCallback("Error loading data.csv!"); + }); + }; + + /** + * Shortcut function to check if a given dimension is of type string or not + * @param {string} dimension - The dimension to check + */ + CINEMA_COMPONENTS.Database.prototype.isStringDimension = function(dimension) { + return this.dimensionTypes[dimension] === CINEMA_COMPONENTS.DIMENSION_TYPE.STRING; + }; + + /** + * Set the database's data and calculate dimension information based off the given + * array of data. Sets the 'data', 'dimensions', 'dimensionTypes' and 'dimensionDomains' + * fields in the given database. + * @param {object} self - The database object + * @param {string} data_arr - The array of data (we assume it has already been error-checked) + */ + var calcData = function(self, data_arr) { + //Get dimensions (First row of data) + self.dimensions = data_arr[0]; + + //Convert rows from arrays to objects + self.data = data_arr.slice(1).map(function(d) { + var obj = {}; + self.dimensions.forEach(function(p,i){obj[p] = d[i];}); + return obj; + }); + + //Keep track of data that gets caught in the filter while parsing + //to remove after all the parsing has been done + var filterdOut = [] + + //Determine dimension types and calculate domains + self.dimensions.forEach(function(d) { + //The value used to determine the dimension type + //is the first defined value in the column + var val = self.data[0][d]; + var i = 0; + while (val === undefined && i < self.data.length) + val = self.data[++i][d]; + + //Check if value is a float or integer + //The text "NaN" (not case sensitive) counts as a float + if (!isNaN(val) || val.toUpperCase() === "NAN") { + if (isNaN(val) || !Number.isInteger(val)) + self.dimensionTypes[d] = CINEMA_COMPONENTS.DIMENSION_TYPE.FLOAT; + else + self.dimensionTypes[d] = CINEMA_COMPONENTS.DIMENSION_TYPE.INTEGER; + //Check if this dimension is listed in the filter + var filter = self.filter ? self.filter[d] : null + if (filter && (!Array.isArray(filter) || filter.length != 2)) { + console.warn("Filter for dimension '"+d+"' must be an array of length two.") + filter = null + } + //calculate domain for numeric dimension + var i;//the first index to contain a value that is not "NaN" + for (i = 0; i < self.data.length && isNaN(self.data[i][d]); i++) {} + if (i == self.data.length) + //if all values are NaN, domain is [0,0] + self.dimensionDomains[d] = [0,0] + else { + var min = self.data[i][d]; + var max = self.data[i][d]; + //Calculated min and max cannot extend outside of min and max + //defined in filter + if (filter) { + min = Math.max(min,filter[0]) + max = Math.min(max,filter[1]) + } + for (var j = i; j < self.data.length; j++) { + if (!isNaN(self.data[j][d])) { + //Ignore data that lies outside the min and max defined in the filter + if (filter && + (self.data[j][d] < filter[0] || self.data[j][d] > filter[1]) + ) { + filterdOut[j] = true; + continue; + } + min = Math.min(min,self.data[j][d]); + max = Math.max(max,self.data[j][d]); + } + } + self.dimensionDomains[d] = [min,max]; + } + } + //Anything else is a string type + else { + self.dimensionTypes[d] = CINEMA_COMPONENTS.DIMENSION_TYPE.STRING; + self.dimensionDomains[d] = self.data.map(function(p){return p[d];}); + } + });//end dimensions.foreach() + + //Remove any data that was marked to be filtered out while parsing + self.data = self.data.filter(function(d,i){return !filterdOut[i]}); + }; + + /** + * Reloads the database's CSV file and refreshes the data if changes have been made. + * If changes are found, sends an event through the dataUpdated dispatcher. + * By default, this will only check that the size of the CSV has changed (i.e. rows have + * been added or removed). Use the reloadAllData parameter to force an update of all data. + */ + CINEMA_COMPONENTS.Database.prototype.refreshData = function(reloadAllData) { + var self = this; + + if (reloadAllData) { + // Check all data in the file + getAndParseCSV(self.path, + function(data_arr, request) { + dataUpdateCallback(self, data_arr, request); + }, + self.errorCallback); + } + else { + // Only check for file size changes + var xhReq = new XMLHttpRequest(); + xhReq.open("HEAD", self.path, true);//HEAD request returns only Http response header + xhReq.onreadystatechange = function() { + if (xhReq.readyState === 4) { + if (xhReq.status === 200 || + //Safari returns 0 on success (while other browsers use 0 for an error) + (navigator.userAgent.match(/Safari/) && xhReq.status === 0) + ) { + //If contentLength is different, request the full file + //and update + var contentLength = xhReq.getResponseHeader('Content-Length'); + if (contentLength != self.prevContentLength) { + getAndParseCSV(self.path, + function(data_arr, request) { + dataUpdateCallback(self, data_arr, request); + }, + self.errorCallback); + } + } + } + } + + xhReq.send(null); + } + } + + /** + * Callback when getAndParseCSV returns a data array to update the data in the database. + * @param {object} self - The database object + * @param {string} data_arr = The data from the file (not yet error checked) + * @param {XMLHttpRequest} request = The request where we can get the response header information + */ + var dataUpdateCallback = function(self, data_arr, request) { + //Ensure that the dimensions have not changed + if (data_arr[0].length != self.dimensions.length) { + console.warn("Updates to data cannot change the number of dimensions!") + return; + } + for (var i in self.dimensions) { + if (self.dimensions[i] != data_arr[0][i]) { + console.warn("Updates to data cannot change the names of dimensions!") + return; + } + } + + //If there are errors in the data, don't update + var error = checkErrors(data_arr); + if (error) { + console.warn("Error in updated data!\n"+error); + return; + } + + // Get new content length + self.prevContentLength = request.getResponseHeader('Content-Length'); + + //Convert rows from arrays to objects + var newData = data_arr.slice(1).map(function(d) { + var obj = {}; + self.dimensions.forEach(function(p,i){obj[p] = d[i];}); + return obj; + }); + + // Determine whether there has been a change in the data + var updated = false; + var updateInfo = { added: [], modified: [], removed: [], oldData: self.data, oldDimensionDomains: self.dimensionDomains }; + for (var f = 0; f < self.data.length || f < newData.length; f++) { + if (f >= self.data.length) { + updateInfo.added.push(f); + updated = true; + } + else if (f >= newData.length) { + updateInfo.removed.push(f); + updated = true; + } + else if (!(JSON.stringify(self.data[f]) === JSON.stringify(newData[f])) ) { + updateInfo.modified.push(f); + updated = true; + } + } + + // If the data is updated, reset the dimensions and call the dataUpdated dispather. + if (updated) { + self.data = newData; + self.dimensionDomains = {}; + calcData(self, data_arr); + + self.dispatch.call("dataUpdated",self, updateInfo); + } + } + + /** + * Get data rows (returned as an array of indices) that are similar to the given data. + * Difference between two data points is measured as the Manhattan distance where each dimension + * is normalized. i.e. The sum of the differencs on each dimension (each scaled from 0 to 1). + * On string dimensions, the distance is considered 0 if the strings are the same, otherwise 1 + * NaN values have 0 distance from each other, but 1 from anything else + * undefined values 0 distance from each other, but 1 from defined values + * @param {Object} query - An object representing the data to compare against + * (it does not necessarily have to be a data point already in the database) + * (dimensions in query can be undefined and will not add to distance) + * @param {number} threshold - The value that the difference must be below to be considerd "similiar" + */ + CINEMA_COMPONENTS.Database.prototype.getSimilar = function(query, threshold) { + var self = this; + var similar = []; + this.data.forEach(function(row,index) { + var dist = 0; //manhattan distance + self.dimensions.forEach(function(d) { + if (query[d] !== undefined) { + //On string dimensions, the distance is considered 0 if the strings are the same, otherwise 1 + if (self.isStringDimension(d)) + dist += (row[d] == query[d] ? 0 : 1); + //Compare number dimensions + else { + //NaN values have 0 distance from each other, but 1 from anything else + if (isNaN(query[d])) + dist += (isNaN(row[d]) ? 0 : 1); + //undefined values 0 distance from each other, but 1 from defined values + else if (row[d] === undefined) + dist += 1; + //calculate normalized distance + else { + var extent = self.dimensionDomains[d]; + dist += Math.abs( + getNormalizedValue(query[d],extent[0],extent[1]) + - + getNormalizedValue(row[d],extent[0],extent[1]) + ); + } + } + } + });//end self.dimensions.forEach() + if (dist <= threshold) { + similar.push(index); + } + });//end this.data.forEach() + return similar; + } + + /** + * Parse this database's axis data from the given array of data (from axis_order.csv) + */ + var parseAxisOrderData = function(data_arr) { + var data = {}; + + data_arr.slice(1).forEach(function(row) { + var category = row[0]; + if (!data[category]) + data[category] = []; + var value = row[1]; + data[category].push({name: value}); + var ordering = data_arr[0].slice(2).map(function(d,i) { + return [row[i+2],i]; + }).sort(function(a,b) { + if (a[0] === undefined) {return 1;} + if (b[0] === undefined) {return -1;} + return a[0]-b[0]; + }).map(function(d) {return data_arr[0].slice(2)[d[1]];}); + data[category][data[category].length-1].order = ordering; + }); + + return data; + } + + /** + * Fetch a CSV file and parse the data into a two-dimensional array. + * @param {String} path URL of CSV file + * @param {Function} callback Callback if succesful, provides the data array and a reference + * to the XMLHttpRequest that retrieved it + * @param {Function} errorCallback Called if an error occured with the request + */ + var getAndParseCSV = function(path,callback,errorCallback) { + var request = new XMLHttpRequest(); + request.open("GET",path,true); + request.onreadystatechange = function() { + if (request.readyState === 4) { + if (request.status === 200 || + //Safari returns 0 on success (while other browsers use 0 for an error) + (navigator.userAgent.match(/Safari/) && request.status === 0) + ) { + var data = parseCSV(request.responseText); + if (callback) + callback(data, request); + } + else if (errorCallback) { + errorCallback(); + } + } + } + request.send(null); + } + + /** + * Get a value from 0 to 1 reprsenting where val lies between min and max + */ + var getNormalizedValue = function(val, min, max) { + return (max-min == 0) ? 0 : ((val-min) / (max-min)); + } + + /** + * Parse the text of a csv file into a 2 dimensional array. + * Distinguishes between empty strings and undefined values + * + * Based on example code from Ben Nadel + * https://www.bennadel.com/blog/1504-ask-ben-parsing-csv-strings-with-javascript-exec-regular-expression-command.htm + */ + var parseCSV = function(csvText) { + // (delimiter) (quoted value) (value) + var csvRegex = /(\,|\r?\n|\r|^)(?:"([^"]*(?:""[^"]*)*)"|([^\,\r\n]*))/gi; + var data = []; + var matches; + //If text is empty, stop now. Otherwise will get caught in infinite loop + if (csvText === "") + return data; + while (matches = csvRegex.exec(csvText)) { + //Newline,beginning of string, or a comma + var delimiter = matches[1]; + //If the value is in quotes, it will be here (without the outside quotes) + var quotedValue = matches[2]; + //If the value wasn't in quotes, it will be here + var value = matches[3]; + + //If the deilimiter is not a comma (meaning its a new line), + //add a row to the data + if (delimiter != ',') + data.push([]); + //If a quoted value, escape any pairs of quotes and add to data + if (quotedValue !== undefined) + data[data.length-1].push(quotedValue.replace(/""/g,"\"")); + //If an unquoted value, escape any pairs of quotes add to data, or undefined if empty + else + data[data.length-1].push(value === "" ? undefined : value.replace(/""/g,"\"")); + } + //If the last line is a single, undefined value (caused by a stray newline at the end of the file), remove it. + if (data.length > 1 && data[data.length-1].length == 1 && data[data.length-1][0] === undefined) { + data = data.slice(0,data.length-1); + } + return data; + } + + /** + * Check for critical errors in the given data. + * Returns an error message if an error was found. + * Doesn't return anything if no errors were found. + */ + var checkErrors = function(data) { + //Check that there are at least two lines of data + if (data.length < 2) + return "The first and second lines in the file are required."; + + //Check that there at least two dimensions to the data + if (data[0].length < 2) + return "The dataset must include at least two dimensions"; + + //Check that there are no empty values in the first row + var emptyValFound = false; + for (var i in data[0]) + emptyValFound = emptyValFound || (data[0][i] === undefined); + if (emptyValFound) + return "Empty values may not occur in the header (first line)."; + + //Check that all rows of data have the same length + var testLength = data[0].length; + for (var i in data) + if (data[i].length != testLength) + return "Each line must have an equal number of comma separated values (columns)."; + + //Check that no colummns have all undefined values + for (var i = 0; i < data[0].length; i++) { + var allEmpty = true; + for (var j = 0; j < data.length; j++) + allEmpty = allEmpty && (data[j][i] === undefined); + if (allEmpty) + return "There cannot be any columns with all undefined values."; + } + } + + /** + * Check for critical errors in the given axis data + * Checks against the given list of dimensions + * Returns an error message if an error was found. + * Doesn't return anything if no errors were found + */ + var checkAxisDataErrors = function(data, dimensions) { + //Check that there are at least two lines of data + if (data.length < 2) + return "The first and second lines in the file are required."; + + //Check that all rows of data have the same length + var testLength = data[0].length; + for (var i in data) + if (data[i].length != testLength) + return "Each line must have an equal number of comma separated values (columns)."; + + /*//Check that there are dimensions+2 columns (+2 for category and value columns) + if (data[0].length !== dimensions.length+2) + return "All dimensions must be specified in the header of the file."*/ + + //Check that each dimension in the header is valid + for (var i = 2; i < data[0].length; i++) { + if (!dimensions.includes(data[0][i])) + return "Dimension in axis order file '"+data[0][i]+"' is not valid"; + } + + //Check that the first two columns contain to undefined values + for (var i = 0; i < data.length; i++) { + if (data[i][0] === undefined) + return "Category cannot be undefined." + if (data[i][1] === undefined) + return "Value cannot be undefined." + } + + //Check that all other data are numbers + for (var i = 1; i < data.length; i++) { + for (var j = 2; j < data[i].length; j++) { + if (isNaN(data[i][j]) && data[i][j] !== undefined) + return "Values for dimensions cannot be NaN." + } + } + } + +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * COMPONENT + * + * The Component module for the CINEMA_COMPONENTS library. + * Contiains the constructor for components (PcoordSVG,PcoordCanvas,Glyph, etc.) + * The object contains common methods and fields used by all components. + * + * Also contains definitions for a few classes that may be used by components. + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the database module be included + if (!CINEMA_COMPONENTS.DATABASE_INCLUDED) + throw new Error("CINEMA_COMPONENTS Component module requires that Database"+ + " module be included. Please make sure that Database module"+ + " is included BEFORE Component module"); + + /** @type {boolean} - Flag to indicate that the Component module has been included */ + CINEMA_COMPONENTS.COMPONENT_INCLUDED = true; + + /** + * Abstract constructor for Component. + * Represents a component for displaying and interacting with a database. + * Objects such as Pcoord and Glyph inherit from this + * @param {DOM} parent - The DOM object to build this component inside of (all children will be removed) + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.Component = function(parent, database, filterRegex) { + if (this.constructor === CINEMA_COMPONENTS.Component) + throw new Error("Cannot instantiate abstract class 'Component.'"+ + " Please use a subclass."); + + /** @type {DOM} The parent DOM object to build this component inside of */ + this.parent = parent; + + //Clear children + this.parent.innerHTML = ''; + + /** @type {CINEMA_COMPONENTS.Database} A reference to the database behind this component */ + this.db = database; + /** @type {string[]} The filtered list of dimensions that are shown on the component */ + this.dimensions = []; + + //NOTE that this.dimensions is filtered to have only the dimensions shown on the component + //while this.db.dimensions includes all dimensions in the database + + /** @type {RegExp} The regex used to filter out dimensions to not be shown on the component*/ + this.filter = filterRegex; + + //Get filtered Dimensions according to filterRegex + this.dimensions = this.db.dimensions.filter(function(d) { + return filterRegex ? !filterRegex.test(d) : true; + }); + + //Create DOM content + /** @type {DOM} The whole content of the component*/ + this.container = parent.appendChild(document.createElement('div')); + this.container.setAttribute('class','CINEMA_COMPONENT'); + this.container.style.position = 'absolute'; + + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + }; + + /** + * Resize this component to fit the size of its parent. + * This should be called every time the size of the component's + * parent changes. + */ + CINEMA_COMPONENTS.Component.prototype.updateSize = function(){ + this.margin = this.margin || new CINEMA_COMPONENTS.Margin(0,0,0,0); + this.parentRect = this.parent.getBoundingClientRect(); + this.internalWidth = this.parentRect.width - this.margin.left - this.margin.right; + this.internalHeight = this.parentRect.height - this.margin.top - this.margin.bottom; + + this.container.style.width = this.parentRect.width+'px'; + this.container.style.height = this.parentRect.height+'px'; + }; + + /** + * Remove this component from the scene + */ + CINEMA_COMPONENTS.Component.prototype.destroy = function() { + d3.select(this.container).remove(); + }; + + /** + * Constructor for Margin object + * Defines the top,right,bottom and left margins for drawing a component. + * @param {number} top - top margin (in pixels) + * @param {number} right - right margin (in pixels) + * @param {number} bottom - bottom margin (in pixels) + * @param {number} left - left margin (in pixels) + */ + CINEMA_COMPONENTS.Margin = function(top,right,bottom,left) { + this.top = top; + this.right = right; + this.bottom = bottom; + this.left = left; + } + + /** + * Constructor for ExtraData object + * Defines extra, custom data that may be shown on a component. + * @param {Object} data - The data to show + * (in the same format as the data points in the database) + * @param {any} style - Object representing how to draw the data. + * (the interpretation of this is up to specific components) + * (for example PcoordSVG expects a CSS string and + * PcoordCanvas expects an object with canvas context attributes) + */ + CINEMA_COMPONENTS.ExtraData = function(data, style) { + this.data = data; + this.style = style; + } +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * GLYPH + * + * The Glyph Component for the CINEMA_COMPONENTS library. + * Contains the constructor for a Glyph component. + * The Glyph component allows for viewing one data point at a time in a glyph chart + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS Glyph module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE Glyph module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS Glyph module requires that"+ + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the"+ + " the Glyph module"); + } + + /** @type {boolean} - Flag to indicate that the Glpyph module has been included */ + CINEMA_COMPONENTS.GLYPH_INCLUDED = true; + + //Constants + var RADTODEG = (180/Math.PI), + DEGTORAD = (Math.PI/180); + + CINEMA_COMPONENTS.Glyph = function(parent, database, filterRegex) { + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + /** @type {CINEMA_COMPONENTS.Margin} Override default margin */ + this.margin = new CINEMA_COMPONENTS.Margin(50,50,50,50); + /** @type {number} the space between the center and lowest data values on the chart */ + this.innerMargin; + /** @type {number} The radius of the glyph */ + this.radius; + + //call super-constructor + CINEMA_COMPONENTS.Component.call(this,parent,database,filterRegex); + //after size is calculate in the super-constructor, set radius and innerMargin + this.radius = Math.min(this.internalHeight,this.internalWidth)/2; + this.innerMargin = this.radius/11; + + /*************************************** + * DATA + ***************************************/ + + /** @type {number} The index of the selected data point */ + this.selected = 0; + + /*************************************** + * SCALES + ***************************************/ + + /** @type {d3.scalePoint} Rotation scale. Maps dimensions to a rotation in radians */ + this.rotation = d3.scalePoint() + .domain(this.dimensions) + .range([0,Math.PI*2-Math.PI*2/(this.dimensions.length+1)]); + + /** @type {Object(d3.scale)} Scales for each dimension + * Maps a value to a distance from the center + */ + this.scales = {}; + this.dimensions.forEach(function(d) { + //Create point scale for string dimensions + if (self.db.isStringDimension(d)) + self.scales[d] = d3.scalePoint() + .domain(self.db.dimensionDomains[d]) + .range([self.radius-self.innerMargin,0]); + //Create linear scale for numeric dimensions + else + self.scales[d] = d3.scaleLinear() + .domain(self.db.dimensionDomains[d]) + .range([self.radius-self.innerMargin,0]); + }); + + /*************************************** + * DOM Content + ***************************************/ + + //Create DOM content + //Specify that this is a Glyph component + d3.select(this.container).classed('GLYPH',true); + + /** @type {d3.selection (svg)} The SVG element containing all the content of the component */ + this.svg = d3.select(this.container).append('svg') + .attr('class','glyphChart') + .attr('viewBox',(-this.margin.right)+' '+(-this.margin.top)+' '+ + (this.parentRect.width)+' '+ + (this.parentRect.height)) + .attr('preserveAspectRatio','none') + .attr('width','100%') + .attr('height','100%'); + + /** @type {d3.selection (path)} The path representing the selected data */ + this.path = this.svg.append('path') + .classed('glyph',true); + + /** @type {d3.selection g} Labels for each dimension */ + this.labels = self.svg.append('g') + .classed('labels',true) + .selectAll('g.label') + .data(this.dimensions) + .enter().append('g') + .classed('label',true) + .attr('transform',function(d){return self.getAxisTransform(d);}); + //Add label text + this.labels.append('text') + .style('text-anchor','middle') + .text(function(d){return d;}) + .attr('transform',function(d) { + return "translate(0 -15) " + +"rotate("+self.getTextRotation(d)+")"; + }); + + + /*************************************** + * AXES + ***************************************/ + + /** @type {d3.selection (g)} The SVG group containing all the axes */ + this.axisContainer = this.svg.append('g') + .classed('axisContainer',true); + + /** @type {d3.selection (g)} Groups for each axis*/ + this.axes = this.axisContainer.selectAll('.axisGroup') + .data(this.dimensions) + .enter().append('g') + .classed('axisGroup',true) + .attr('transform',function(d){return self.getAxisTransform(d);}); + //Create d3 axes + this.axes.append('g') + .classed('axis',true) + .each(function(d) { + d3.select(this).call(d3.axisLeft().scale(self.scales[d])); + d3.select(this).selectAll('text') + .style('text-anchor','end') + .attr('transform',"rotate("+self.getTextRotation(d)+" -15 0)"); + }); + + this.redraw(); + } + //establish prototype chain + CINEMA_COMPONENTS.Glyph.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.Glyph.prototype.constructor = CINEMA_COMPONENTS.Glyph; + + /** + * Get the path (contents of the 'd' attribute) for the given data point + * @param {Object} p The data point + */ + CINEMA_COMPONENTS.Glyph.prototype.getPath = function(p) { + var self = this; + var path; + var startPoint; + this.dimensions.forEach(function(d,i) { + var point = self.getPoint(d,p); + if (i == 0) { + startPoint = point; + path = "M "+point.x+" "+point.y+" " + } + else if (i == self.dimensions.length-1) { + //loop back to the start point at the end to close the path + path += "L "+point.x+" "+point.y+" "+ + "L "+startPoint.x+" "+startPoint.y; + } + else { + path += "L "+point.x+" "+point.y+" "; + } + }); + return path; + } + + /** + * The x,y point on the chart where the given data point passes + * through the axis for the given dimension + * @param {string} d The dimension + * @param {Object} p The data point + */ + CINEMA_COMPONENTS.Glyph.prototype.getPoint = function(d,p) { + if (isNaN(p[d])) + //NaN values are placed in the center of the chart + return {x: this.radius, y: this.radius}; + var len = this.radius-this.scales[d](p[d]); + var rot = this.rotation(d)-Math.PI/2; + var x = Math.cos(rot)*len; + var y = Math.sin(rot)*len; + return {x: x+this.radius, y: y+this.radius}; + } + + /** + * Should be called every time the size of the chart's container changes. + * Updates the sizing and scaling of all parts of the chart and redraws + */ + CINEMA_COMPONENTS.Glyph.prototype.updateSize = function() { + var self = this; + + //Call super (will recalculate size) + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + //Update radius and innerMargin + this.radius = Math.min(this.internalHeight,this.internalWidth)/2; + this.innerMargin = this.radius/11; + + //Rescale SVG + this.svg.attr('viewBox',(-this.margin.right)+' '+(-this.margin.top)+' '+ + (this.parentRect.width)+' '+ + (this.parentRect.height)) + + //Rescale scales + this.dimensions.forEach(function (d) { + self.scales[d].range([self.radius-self.innerMargin,0]); + }); + + //Re-transform axes + this.axes.attr('transform',function(d){return self.getAxisTransform(d);}) + //Rebuild axes + .each(function(d) { + d3.select(this).select('.axis').call(d3.axisLeft().scale(self.scales[d])); + }); + + //Re-tranform labels + this.labels.attr('transform',function(d){return self.getAxisTransform(d);}); + + //Rebuild path + this.path.attr('d',function(d) {return self.getPath(self.db.data[d]);}); + }; + + /** + * Should be called whenever the data in the associated database changes. + * Will update scales, axes and selection to fit the new data. + */ + CINEMA_COMPONENTS.Glyph.prototype.updateData = function() { + var self = this; + + //Update scale domains + this.dimensions.forEach(function (d) { + self.scales[d].domain(self.db.dimensionDomains[d]); + }); + + //Rebuild axes + this.axes.each(function(d) { + d3.select(this).select('.axis').call(d3.axisLeft().scale(self.scales[d])); + }); + + this.redraw(); + } + + /** + * Set the selected data point to the one with the given index + */ + CINEMA_COMPONENTS.Glyph.prototype.setSelected = function(index) { + this.selected = index; + this.redraw(); + + }; + + /** + * Redraw the glyph path + */ + CINEMA_COMPONENTS.Glyph.prototype.redraw = function() { + var self = this; + this.path.datum(this.selected) + .transition(1000) + .attr('d',function(d){return self.getPath(self.db.data[d]);}); + } + + /** + * Get the transform attribute for an axis with the given dimension + * @param {string} d The dimension to transform to + */ + CINEMA_COMPONENTS.Glyph.prototype.getAxisTransform = function(d) { + var r = this.radius; + var rot = this.rotation(d)*RADTODEG; + return "translate("+r+") "+ + "rotate("+rot+" 0 "+r+")"; + }; + + /** + * Get the rotation (in degrees) for text on an axis with the given dimension + * so that the text will appear right-side-up + * @param {string} d The dimension to rotate for + */ + CINEMA_COMPONENTS.Glyph.prototype.getTextRotation = function(d) { + var rot = this.rotation(d)*(180/Math.PI); + return (rot > 90 && rot < 270) ? 180 : 0; + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * IMAGESPREAD + * + * The ImageSpread Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the ImageSpread Component + * Which displays image data for a set of rows in a database. + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if(window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if(!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS ImageSpread module requires that Component" + + " module be included. Please make sure that Component module" + + " is included BEFORE ImageSpread module"); + + //Require that d3 be included + if(!window.d3) { + throw new Error("CINEMA_COMPONENTS ImageSpread module requires that" + + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the" + + " the ImageSpread module"); + } + + /** @type {boolean} - Flag to indicate that the ImageSpread module has been included */ + CINEMA_COMPONENTS.IMAGE_SPREAD_INCLUDED = true; + + /** + * Checks if a dimension name starts with a string from the list + * @type {String} dimension - name of the dimension to check + * @type {Array} prefixList - list of prefixes + */ + var startsWithPrefixes = function(dimension, prefixList) { + if(typeof prefixList === 'undefined') + return false; + for(i = 0; i < prefixList.length; i++) { + if(dimension.startsWith(prefixList[i])) + return true; + } + return false; + } + + /** + * Constructor for ImageSpread Component + * Represents a component for viewing a spread of images from a selection of data + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * (Note that ImageSpread does not use a filterRegex) + */ + CINEMA_COMPONENTS.ImageSpread = function(parent, database, image_measures, excluded_dimensions) { + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + //Call super-constructor (will calculate size) + CINEMA_COMPONENTS.Component.call(this, parent, database); + + /*************************************** + * DATA + ***************************************/ + + //Allowed prefixes for image measures, check for unused beforehand + if(typeof image_measures !== 'undefined') { + this.allowedUPrefixes = []; + const image_measuresLength = image_measures.length; + for (var i = 0; i < image_measuresLength; i++) { + for (var key in self.db.dimensionTypes) { + if(key.startsWith(image_measures[i])) { + this.allowedUPrefixes.push(image_measures[i]); + break; + } + } + } + } + + //Excluded dimensions for x-axis + this.excludedDim = excluded_dimensions; + + //Get all non image measure and non file dimensions + this.validDim = []; + for(var i=0, len=self.dimensions.length; i < len; i++) { + if(!(self.dimensions[i].startsWith("FILE") || + startsWithPrefixes(self.dimensions[i], this.allowedUPrefixes) || + startsWithPrefixes(self.dimensions[i], this.excludedDim))) { + self.validDim.push(self.dimensions[i]); + } + } + + //override this.dimensions to include only FILE dimensions + this.dimensions = this.dimensions.filter(function(d) { + return (/^FILE/).test(d); + }); + /** @type {boolean} Whether any FILE dimensions exist in the dataset */ + this.hasFileDimensions = this.dimensions.length != 0; + + /** @type {number[]} Inidices of all the data points to display */ + this.selection = []; + + /** @type {number} The page number currently being viewed*/ + this.currentPage = 1; + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. Ex: this.dispatch.on('mouseover',handlerFunction(i)) + * 'mouseover': Triggered when a set of images is moused over + * (arguments are the index of moused over data and mouse event) + */ + this.dispatch = d3.dispatch('mouseover'); + + /*************************************** + * DOM Content + ***************************************/ + + //Specify that this is an ImageSpread component + d3.select(this.container).classed('IMAGE_SPREAD', true); + + //If there are no file dimensions, place a warning and stop here + if(!this.hasFileDimensions) { + this.noFileWarning = d3.select(this.container).append('div') + .classed('noFileWarning', true) + .text("No file information to display"); + return; + } + + //NOTHING IN THE CONSTRUCTOR AFTER THIS POINT WILL BE EXECUTED + //IF THERE ARE NO FILE DIMENSIONS + + /** @type {d3.selection} The header/control panel */ + this.header = d3.select(this.container).append('div') + .classed('header', true) + .style('position', 'absolute') + .style('width', '100%'); + + /** @type {d3.selection} The container for all the images */ + this.imageContainer = d3.select(this.container).append('div') + .classed('imageContainer', true) + .style('position', 'absolute') + .style('width', '100%') + .style('overflow-y', 'auto'); + + /*************************************** + * HEADER/CONTROLS + ***************************************/ + + //pageSize controls + /** @type {d3.selection} The control panel for pageSize */ + this.pageSizeContainer = this.header.append('div') + .classed('controlPanel pageSize', true); + this.pageSizeContainer.append('span') + .classed('label', true) + .text("Results Per Page:"); + this.pageSizeContainer.append('br'); + /** @type {DOM (select)} The select node controlling page size */ + this.pageSizeNode = this.pageSizeContainer.append('select') + .on('change', function() { + self.updatePageNav(); + self.populateResults(); + }) + .node(); + //append options + d3.select(this.pageSizeNode).selectAll('option') + .data([10, 25, 50, 100]) + .enter().append('option') + .attr('value', function(d) { + return d; + }) + .text(function(d) { + return d; + }); + //Select 25 as default option + d3.select(this.pageSizeNode).select('option[value="25"]') + .attr('selected', 'true'); + + //sort controls + /** @type {d3.selection} The control panel for choosing sort dimension */ + this.sortContainer = this.header.append('div') + .classed('controlPanel sort', true); + this.sortContainer.append('span') + .classed('label', true) + .text("Sort By:"); + this.sortContainer.append('br'); + /** @type {DOM (select)} The select node controlling sort dimension */ + this.sortNode = this.sortContainer.append('select') + .on('change', function() { + self.selection.sort(self.getSortComparator()); + self.populateResults(); + }) + .node(); + //append options + d3.select(this.sortNode).selectAll('option') + .data(this.db.dimensions.filter(function(d) { + return !self.db.isStringDimension(d); + })) + .enter().append('option') + .attr('value', function(d) { + return d; + }) + .text(function(d) { + return d; + }); + + //sortOrder controls + /** @type {d3.selection} The control panel for toggling sort order */ + this.sortOrderContainer = this.header.append('div') + .classed('controlPanel sortOrder', true); + this.sortOrderContainer.append('span') + .classed('label', true) + .text("Reverse Sort Order:"); + this.sortOrderContainer.append('br'); + /** @type {DOM (input/checkbox)} The node for toggling sort order */ + this.sortOrderNode = this.sortOrderContainer.append('input') + .attr("type", "checkbox") + .on('change', function() { + self.selection.sort(self.getSortComparator()); + self.populateResults(); + }) + .node(); + + //grouping controls + /** @type {d3.selection} The control panel for toggling sort order */ + this.groupsortingContainer = this.header.append('div') + .classed('controlPanel groupingOption', true); + this.groupsortingContainer.append('span') + .classed('label', true) + .text("Group equal values:"); + this.groupsortingContainer.append('br'); + /** @type {DOM (input/checkbox)} The node for toggling grouping order */ + this.groupsortingNode = this.groupsortingContainer.append('input') + .attr('type', 'checkbox') + .on('change', function() { + self.selection.sort(self.getSortComparator()); + self.populateResults(); + }) + .node(); + + //imageSize controls + /** @type {d3.selection} The control panel for controlling image size */ + this.imageSizeContainer = this.header.append('div') + .classed('controlPanel imageSize', true); + this.imageSizeContainer.append('span') + .classed('label', true) + .text("Image Size: 150px"); + this.imageSizeContainer.append('br'); + /** @type {DOM (input/range)} The node for adjusting imageSize */ + this.imageSizeNode = this.imageSizeContainer.append('input') + .attr('type', 'range') + .attr('min', '100') + .attr('max', '500') + .on('input', function() { + d3.select(self.container).selectAll('.display') + .style('width', this.value + 'px'); + d3.select(self.container).select('.controlPanel.imageSize .label') + .text("Image Size: " + this.value + "px"); + }) + .node(); + this.imageSizeNode.value = 150; + + //Update size + this.updateSize(); + } + //establish prototype chain + CINEMA_COMPONENTS.ImageSpread.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.ImageSpread.prototype.constructor = CINEMA_COMPONENTS.ImageSpread; + + /** + * Should be called every time the size of the component's container changes. + * Updates the sizing of the imageSpread container + */ + CINEMA_COMPONENTS.ImageSpread.prototype.updateSize = function() { + //Call super + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + if(this.hasFileDimensions) { + var headerSize = this.header.node().getBoundingClientRect().height; + this.imageContainer + .style('top', headerSize + 'px') + .style('height', (this.parentRect.height - headerSize) + 'px'); + } + }; + + /** + * Set the data to be shown to the data represented with the given array of indices + */ + CINEMA_COMPONENTS.ImageSpread.prototype.setSelection = function(indices) { + this.selection = indices; + this.selection.sort(this.getSortComparator()); + this.updatePageNav(); + this.populateResults(); + } + + /** + * Get a comparator function for sorting the selection + * according to selected sort dimension and the sortOrder checkbox + */ + CINEMA_COMPONENTS.ImageSpread.prototype.getSortComparator = function() { + var self = this; + var d = this.sortNode.value; + var checkedMultiplier = 1; + + if(this.sortOrderNode.checked) + checkedMultiplier = -1; + + //Group images with equal values, not looking at the sort dimension + //Then sort groups by the sorting dimension + if(this.groupsortingNode.checked) { + return function(a, b) { + if(self.db.data[a][d] === undefined) + return -1 * checkedMultiplier; + + if(self.db.data[b][d] === undefined) + return 1 * checkedMultiplier; + + if(isNaN(self.db.data[a][d])) + return -1 * checkedMultiplier; + + if(isNaN(self.db.data[b][d])) + return 1 * checkedMultiplier; + + //Get all vlid dimensions but the sorting dimension + const nonSortDimensions = self.validDim.filter(function(value) { + return value != d; + }); + //Grouping + for(var i = 0; i < nonSortDimensions.length; i += 1) { + if(self.db.data[a][nonSortDimensions[i]] == self.db.data[b][nonSortDimensions[i]]) { + continue; + } + else { + return (self.db.data[a][nonSortDimensions[i]] - self.db.data[b][nonSortDimensions[i]]) * checkedMultiplier; + } + } + //Equal non sorting dimensions, sort by sorting dimension + return (self.db.data[a][d] - self.db.data[b][d]) * checkedMultiplier; + } + } + //Only sort by sorting dimension + else { + return function(a, b) { + if(self.db.data[a][d] === undefined) + return -1 * checkedMultiplier; + + if(self.db.data[b][d] === undefined) + return 1 * checkedMultiplier; + + if(isNaN(self.db.data[a][d])) + return -1 * checkedMultiplier; + + if(isNaN(self.db.data[b][d])) + return 1 * checkedMultiplier; + + return (self.db.data[a][d] - self.db.data[b][d]) * checkedMultiplier; + } + } + } + + /** + * Fill the imageContainer with dataDisplays for the current page of results + */ + CINEMA_COMPONENTS.ImageSpread.prototype.populateResults = function() { + var self = this; + if(this.hasFileDimensions) { + var pageSize = this.pageSizeNode.value; + var pageData = this.selection.slice((this.currentPage - 1) * pageSize, + Math.min(this.currentPage * pageSize, this.selection.length)); + //Bind pageData and update dataDisplays + var displays = this.imageContainer.selectAll('.dataDisplay') + .data(pageData); + displays.exit().remove(); //remove unused dataDisplays + displays.enter() //add new dataDisplays + .append('div').classed('dataDisplay', true) + .merge(displays) //update + //Set up mouse events + .on('mouseenter', function(d) { + self.dispatch.call('mouseover', self, d, d3.event); + }) + .on('mouseleave', function(d) { + self.dispatch.call('mouseover', self, null, d3.event); + }) + //For each data display, create file displays for every file in it + .each(function(d) { + var files = self.dimensions.map(function(dimension) { + return self.db.data[d][dimension]; + }); + //bind files data + var fileDisplays = d3.select(this).selectAll('.fileDisplay') + .data(files); + fileDisplays.exit().remove(); + var ENTER = fileDisplays.enter().append('div') + .classed('fileDisplay', true); + ENTER.append('div').classed('display', true) + .style('width', self.imageSizeNode.value + 'px'); + ENTER.append('div').classed('displayLabel', true); + var UPDATE = ENTER.merge(fileDisplays) + //Create content of each file display + .each(function(f, i) { + d3.select(this).select('.display').html(''); + //Create an image in the display if the it is an image filetype + var ext = getFileExtension(f); + if(isValidFiletype(ext)) { + if(ext.toUpperCase() === 'VTI') { + d3.select(this).select('.display') + .classed('image', true) + .classed('text', false).append('img') + .attr('src', 'https://kitware.github.io/vtk-js/logo.svg') + .attr('width', '100%') + .on('click', function() {self.createModalVTI(self.db.directory + '/' + f);}); + } else if(ext.toUpperCase() === 'PDB') { + d3.select(this).select('.display') + .classed('image', true) + .classed('text', false).append('img') + .attr('src', 'https://kitware.github.io/vtk-js/logo.svg') + .attr('width', '100%') + .on('click', function() {self.createModalPDB(self.db.directory + '/' + f);}); + } else { + d3.select(this).select('.display') + .classed('image', true) + .classed('text', false) + .append('img') + .attr('src', self.db.directory + '/' + f) + .attr('width', '100%') + .on('click', self.createModalImg); + } + } + //Otherwise create an error message + else + d3.select(this).select('.display') + .classed('text', true) + .classed('image', false) + .append('div') + .attr('class', 'resultErrorText') + .text('Cannot display file: ' + f); + //Update label + d3.select(this).select('.displayLabel') + .text(self.dimensions[i]); + }); + }); + } + }; + + /** + * An event handler for an image that will create a modal overlay + * of the image when clicked + */ + CINEMA_COMPONENTS.ImageSpread.prototype.createModalImg = function() { + d3.select('body').append('div') + .attr('class', 'modalBackground') + .on('click', function() { + //clicking the modal removes it + d3.select(this).remove(); + }) + .append('img') + .attr('class', 'modalImg') + .attr('src', d3.select(this).attr('src')); + } + + /** + * An event handler for an image that will create a modal overlay + * of the image when clicked + */ + CINEMA_COMPONENTS.ImageSpread.prototype.createModalVTI = function(url) { + const rootContainer = d3.select('body'); + const backgroundContainer = d3.select('body').append('div'); + backgroundContainer.attr('class', 'modalBackground') + .on('click', function() { + //clicking the modal removes it + if(d3.event.target.tagName === 'IMG') { + d3.select(this).remove(); + } + }); + const container = backgroundContainer.append('div'); + container.attr('class', 'modalViewer').on('click', function() { + //clicking the modal removes it + //d3.select(this).remove(); + //d3.event.stopPropagation(); + }); + + var global = {}; + // ---------------------------------------------------------------------------- + // Standard rendering code setup + // ---------------------------------------------------------------------------- + + //const rootContainer = document.querySelector('body'); + const background = [0, 0, 0]; + const fullScreenRenderer = vtk.Rendering.Misc.vtkFullScreenRenderWindow.newInstance({ + background: background, + rootContainer: rootContainer.node(), + //containerStyle: { height: '100%' }, + container: container.node() + }); + const renderer = fullScreenRenderer.getRenderer(); + const renderWindow = fullScreenRenderer.getRenderWindow(); + + // ---------------------------------------------------------------------------- + // Example code + // ---------------------------------------------------------------------------- + + const reader = vtk.IO.Misc.vtkPDBReader.newInstance(); + const filter = vtk.Filters.General.vtkMoleculeToRepresentation.newInstance(); + const sphereMapper = vtk.Rendering.Core.vtkSphereMapper.newInstance(); + const stickMapper = vtk.Rendering.Core.vtkStickMapper.newInstance(); + const sphereActor = vtk.Rendering.Core.vtkActor.newInstance(); + const stickActor = vtk.Rendering.Core.vtkActor.newInstance(); + + const vtiReader = vtk.IO.XML.vtkXMLImageDataReader.newInstance(); + //vtiReader.parseAsArrayBuffer(fileContents); + + + filter.setInputConnection(reader.getOutputPort()); + //filter.setInputConnection(vtiReader.getOutputPort()); + filter.setHideElements(['H']); + + // render sphere + sphereMapper.setInputConnection(filter.getOutputPort(0)); + sphereMapper.setScaleArray(filter.getSphereScaleArrayName()); + sphereActor.setMapper(sphereMapper); + + // render sticks + stickMapper.setInputConnection(filter.getOutputPort(1)); + stickMapper.setScaleArray('stickScales'); + stickMapper.setOrientationArray('orientation'); + stickActor.setMapper(stickMapper); + + vtk.IO.Core.DataAccessHelper.get().fetchBinary(url, { + function(pe) { + console.log(pe); + }, + }).then((binary) => { + vtiReader.parseAsArrayBuffer(binary); + const source = vtiReader.getOutputData(0); + const mapper = vtk.Rendering.Core.vtkVolumeMapper.newInstance(); + const actor = vtk.Rendering.Core.vtkVolume.newInstance(); + + const dataArray = + source.getPointData().getScalars() || source.getPointData().getArrays()[0]; + const dataRange = dataArray.getRange(); + + const lookupTable = vtk.Rendering.Core.vtkColorTransferFunction.newInstance(); + const piecewiseFunction = vtk.Common.DataModel.vtkPiecewiseFunction.newInstance(); + + // Pipeline handling + actor.setMapper(mapper); + mapper.setInputData(source); + renderer.addActor(actor); + + // Configuration + const sampleDistance = + 0.7 * + Math.sqrt( + source + .getSpacing() + .map((v) => v * v) + .reduce((a, b) => a + b, 0) + ); + mapper.setSampleDistance(sampleDistance); + actor.getProperty().setRGBTransferFunction(0, lookupTable); + actor.getProperty().setScalarOpacity(0, piecewiseFunction); + // actor.getProperty().setInterpolationTypeToFastLinear(); + actor.getProperty().setInterpolationTypeToLinear(); + + // For better looking volume rendering + // - distance in world coordinates a scalar opacity of 1.0 + actor + .getProperty() + .setScalarOpacityUnitDistance( + 0, + vtk.Common.DataModel.vtkBoundingBox.getDiagonalLength(source.getBounds()) / + Math.max(...source.getDimensions()) + ); + // - control how we emphasize surface boundaries + // => max should be around the average gradient magnitude for the + // volume or maybe average plus one std dev of the gradient magnitude + // (adjusted for spacing, this is a world coordinate gradient, not a + // pixel gradient) + // => max hack: (dataRange[1] - dataRange[0]) * 0.05 + actor.getProperty().setGradientOpacityMinimumValue(0, 0); + actor + .getProperty() + .setGradientOpacityMaximumValue(0, (dataRange[1] - dataRange[0]) * 0.05); + // - Use shading based on gradient + actor.getProperty().setShade(true); + actor.getProperty().setUseGradientOpacity(0, true); + // - generic good default + actor.getProperty().setGradientOpacityMinimumOpacity(0, 0.0); + actor.getProperty().setGradientOpacityMaximumOpacity(0, 1.0); + actor.getProperty().setAmbient(0.2); + actor.getProperty().setDiffuse(0.7); + actor.getProperty().setSpecular(0.3); + actor.getProperty().setSpecularPower(8.0); + + // Control UI + const controllerWidget = vtk.Interaction.UI.vtkVolumeController.newInstance({ + size: [400, 150], + rescaleColorMap: true, + }); + const isBackgroundDark = background[0] + background[1] + background[2] < 1.5; + controllerWidget.setContainer(container.node()); + controllerWidget.setupContent(renderWindow, actor, isBackgroundDark); + fullScreenRenderer.setResizeCallback(({ + width, + height + }) => { + // 2px padding + 2x1px boder + 5px edge = 14 + if(width > 414) { + controllerWidget.setSize(400, 150); + } else { + controllerWidget.setSize(width - 14, 150); + } + controllerWidget.render(); + //fpsMonitor.update(); + }); + + // First render + renderer.resetCamera(); + renderWindow.render(); + + global.pipeline = { + actor, + renderer, + renderWindow, + lookupTable, + mapper, + source, + piecewiseFunction, + fullScreenRenderer, + }; + }); + } + /* .append('img') + .attr('class', 'modalImg') + .attr('src',d3.select(this).attr('src'));*/ + + + /** + * An event handler for an image that will create a modal overlay + * of the image when clicked + */ + CINEMA_COMPONENTS.ImageSpread.prototype.createModalPDB = function(url) { + const rootContainer = d3.select('body'); + const backgroundContainer = d3.select('body').append('div'); + backgroundContainer.attr('class', 'modalBackground') + .on('click', function() { + //clicking the modal removes it + if(d3.event.target.tagName === 'IMG') { + d3.select(this).remove(); + } + }); + const container = backgroundContainer.append('div'); + container.attr('class', 'modalViewer').on('click', function() { + //clicking the modal removes it + //d3.select(this).remove(); + //d3.event.stopPropagation(); + }); + + var global = {}; + // ---------------------------------------------------------------------------- + // Standard rendering code setup + // ---------------------------------------------------------------------------- + + //const rootContainer = document.querySelector('body'); + const background = [0, 0, 0]; + const fullScreenRenderer = vtk.Rendering.Misc.vtkFullScreenRenderWindow.newInstance({ + background: background, + rootContainer: rootContainer.node(), + //containerStyle: { height: '100%' }, + container: container.node() + }); + const renderer = fullScreenRenderer.getRenderer(); + const renderWindow = fullScreenRenderer.getRenderWindow(); + // ---------------------------------------------------------------------------- + // Example code + // ---------------------------------------------------------------------------- + + const reader = vtk.IO.Misc.vtkPDBReader.newInstance(); + const filter = vtk.Filters.General.vtkMoleculeToRepresentation.newInstance(); + const sphereMapper = vtk.Rendering.Core.vtkSphereMapper.newInstance(); + const stickMapper = vtk.Rendering.Core.vtkStickMapper.newInstance(); + const sphereActor = vtk.Rendering.Core.vtkActor.newInstance(); + const stickActor = vtk.Rendering.Core.vtkActor.newInstance(); + + + + + filter.setInputConnection(reader.getOutputPort()); + filter.setHideElements(['H']); + + // render sphere + sphereMapper.setInputConnection(filter.getOutputPort(0)); + sphereMapper.setScaleArray(filter.getSphereScaleArrayName()); + sphereActor.setMapper(sphereMapper); + + // render sticks + stickMapper.setInputConnection(filter.getOutputPort(1)); + stickMapper.setScaleArray('stickScales'); + stickMapper.setOrientationArray('orientation'); + stickActor.setMapper(stickMapper); + + // reader.setUrl(`${__BASE_PATH__}/data/molecule/pdb/caffeine.pdb`).then(() => { + reader.setUrl(url).then(() => { + renderer.resetCamera(); + renderWindow.render(); + }); + + renderer.addActor(sphereActor); + renderer.addActor(stickActor); + renderer.resetCamera(); + renderWindow.render(); + + // ----------------------------------------------------------- + // Make some variables global so that you can inspect and + // modify objects in your browser's developer console: + // ----------------------------------------------------------- + + global.reader = reader; + global.filter = filter; + global.sphereMapper = sphereMapper; + global.stickMapper = stickMapper; + global.sphereActor = sphereActor; + global.stickActor = stickActor; + global.renderer = renderer; + global.renderWindow = renderWindow; + } + + /** + * Calculate the number of pages needed to show all results and rebuild + * the page navigation widget. + */ + CINEMA_COMPONENTS.ImageSpread.prototype.updatePageNav = function() { + var self = this; + d3.select(this.container).select('.pageNavWrapper').remove(); //remove previous widget + var pageSize = this.pageSizeNode.value; + //If there are more results than can fit on one page, build a pageNav widget + if(this.selection.length > pageSize) { + //calculate number of pages needed + var numPages = Math.ceil(this.selection.length / pageSize); + //If the currently selected page is higher than the new number of pages, set to last page + if(this.currentPage > numPages) { + this.currentPage = numPages + }; + //Add pageNav and buttons + d3.select(this.container).append('div') + .classed('pageNavWrapper', true) + .append('ul') + .classed('pageNav', true) + .selectAll('li') + //Get data for which buttons to build, then build + .data(getPageButtons(numPages, this.currentPage)) + .enter().append('li') + .classed('pageButton', true) + .attr('mode', function(d) { + return d.page == self.currentPage ? 'selected' : 'default'; + }) + .text(function(d) { + return d.text; + }) + .on('click', function(d) { + if(d3.select(this).attr('mode') != 'selected') { + self.currentPage = d.page; + if(d.do_rebuild) { + self.updatePageNav(); + self.populateResults(); + } else { + d3.select(self.container).select('.pageButton[mode="selected"]') + .attr('mode', 'default'); + d3.select(this).attr('mode', 'selected'); + d3.select('.pageReadout').text(self.currentPage + " / " + numPages); + self.populateResults(); + } + } + }); + //Add readout of currentPage/totalPages + d3.select('.pageNavWrapper').append('div') + .classed('pageReadout', true) + .text(this.currentPage + " / " + numPages); + } //end if(this.selection.length > pageSize) + //Otherwise, don't build a widget and go to first (only) page + else { + this.currentPage = 1; + } + } + + /** + * Get the state of all inputs + */ + CINEMA_COMPONENTS.ImageSpread.prototype.getOptionsData = function() { + return { + pageSize: this.pageSizeNode.value, + sortDimension: this.sortNode.value, + sortOrderIsReversed: this.sortOrderNode.checked, + sortOrderIsGrouped: this.groupsortingNode.checked, + imageSize: this.imageSizeNode.value + }; + } + + /** + * Set the state of all inputs + */ + CINEMA_COMPONENTS.ImageSpread.prototype.setOptionsData = function(dataObject) { + d3.select(this.pageSizeNode).property("value", dataObject.pageSize); + d3.select(this.sortNode).property("value", dataObject.sortDimension); + d3.select(this.sortOrderNode).property("checked", dataObject.sortOrderIsReversed); + d3.select(this.groupsortingNode).property("checked", dataObject.sortOrderIsGrouped); + d3.select(this.imageSizeNode).property("value", dataObject.imageSize); + d3.select(this.container).select('.controlPanel.imageSize .label') + .text("Image Size: " + dataObject.imageSize + "px"); + } + + /** + * Given the number of pages needed and the currently selected page, return + * a list of objects represented the pageNav buttons to show + * objects are formatted like so: + * {text: [button_text], + * page: [pageNumber to link to], + * do_rebuild: [whether or not the pageNav widget should be rebuilt when this button is clicked]} + **/ + function getPageButtons(numPages, current) { + //If there are 7 or fewer pages, create a widget with a button for each page ([1|2|3|4|5|6|7]) + if(numPages <= 7) { + var pageData = []; + for (var i = 0; i < numPages; i++) + pageData.push({ + text: i + 1, + page: i + 1, + do_rebuild: false + }); + return pageData; + } + //Otherwise, create a widget with buttons for navigating relative to selected page ([|<|<<|10|20|30|>>|>|]) + else { + //step size is one order of magnitude below the total number of pages + var stepSize = Math.pow(10, Math.round(Math.log10(numPages) - 1)); + var pageData = []; + //Create buttons for selecting lower pages if current is not already one + if(current != 1) { + pageData.push({ + text: "|<", + page: 1, + do_rebuild: true + }); + pageData.push({ + text: "<", + page: current - 1, + do_rebuild: true + }); + var prevStep = current - stepSize >= 1 ? current - stepSize : current - 1; + pageData.push({ + text: prevStep, + page: prevStep, + do_rebuild: true + }); + } + //Create button for currently selected page + pageData.push({ + text: current, + page: current, + do_rebuild: false + }); + //Create buttons for selecting higher pages if current is not already at the end + if(current != numPages) { + var nextStep = current + stepSize <= numPages ? current + stepSize : current + 1; + pageData.push({ + text: nextStep, + page: nextStep, + do_rebuild: true + }); + pageData.push({ + text: ">", + page: current + 1, + do_rebuild: true + }); + pageData.push({ + text: ">|", + page: numPages, + do_rebuild: true + }); + } + return pageData; + } + } + + //Get if the given filetype is a valid image filetype + function isValidFiletype(type) { + if(!type) + return false; + var validFiletypes = ['JPG', 'JPEG', 'PNG', 'GIF', 'VTI', 'PDB']; + type = type.trimLeft().trimRight(); + var index = validFiletypes.indexOf(type.toUpperCase()); + + return (index >= 0); + } + + //Get the extension/filetype of the given path + function getFileExtension(path) { + return path ? path.substr(path.lastIndexOf('.') + 1).trimRight() : undefined; + } + +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * PCOORD + * + * The Pcoord Component for the CINEMA_COMPONENTS library. + * Contains the constructor for Parallel Coordinates Components (e.g. PcoordSVG, PcoordCanvas) + * It is a sublcass of Component and contains methods and fields common to all Parallel Coordinates Components + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS Pcoord module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE Pcoord module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS Pcoord module requires that"+ + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the"+ + " the Pcoord module"); + } + + /** @type {boolean} - Flag to indicate that the Pcoord module has been included */ + CINEMA_COMPONENTS.PCOORD_INCLUDED = true; + + /** + * Abstract constructor for Pcoord Components + * Represents a component for displaying and interacting with a database on a parallel coordinates chart + * Objects such as PcoordSVG and PcoordCanvas inherit from this + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.Pcoord = function(parent, database, filterRegex) { + if (this.constructor === CINEMA_COMPONENTS.Pcoord) + throw new Error("Cannot instantiate abstract class 'Pcoord'"+ + " Please use a subclass"); + + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + /** @type {CINEMA_COMPONENTS.Margin} Override default margin */ + this.margin = new CINEMA_COMPONENTS.Margin(30,10,10,10); + /** @type {number} the room left at the bottom of the chart for NaN values */ + this.NaNMargin; + + //call super-constructor + CINEMA_COMPONENTS.Component.call(this,parent,database,filterRegex); + //after size is calculated in the super-constructor, Set NaNMargin + this.NaNMargin = this.internalHeight/11; + + /*************************************** + * DATA + ***************************************/ + + /** @type {number[]} Indices of all currently selected data */ + this.selection = d3.range(0,this.db.data.length); + /** @type {number} Indices of all currently highlighted data*/ + this.highlighted = []; + /** @type {CINEMA_COMPONENTS.ExtraData[]} Custom data to overlay on chart */ + this.overlayData = []; + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. Ex: this.dispatch.on('click',handlerFunction(i)) + * 'selectionchange': Triggered when selection of data changes + * (called with array of indices of selected data) + * 'mouseover': Triggered when a path is moused over + * (called with index of moused over data and reference to mouse event) + * 'click': Triggered when a path is clicked on + * (called with index of clicked data and reference to mouse event) + * 'axisorderchange': Triggered when the axis ordering is manually changed + * (called with the list of the dimensions in the new order) + */ + this.dispatch = d3.dispatch("selectionchange", "mouseover", "click", "axisorderchange"); + + /*************************************** + * SCALES + ***************************************/ + + /** @type {d3.scalePoint} - Scale for x axis on chart + * Maps dimensions to position (in pixels) along width of chart.*/ + this.x = d3.scalePoint() + .domain(this.dimensions) + .range([0,this.internalWidth]) + .padding(1); + + /** @type {Object(d3.scale)} + * Scales for each dimension axis on the chart. One scale for each dimension */ + this.y = {}; + this.dimensions.forEach(function (d) { + //Create point scale for string dimensions + if (self.db.isStringDimension(d)) { + if (!self.y[d]) { + self.y[d] = d3.scalePoint(); + } + self.y[d].domain(self.db.dimensionDomains[d]) + .range([self.internalHeight,0]); + } + //Create linear scale for numeric dimensions + else { + if (!self.y[d]) { + self.y[d] = d3.scaleLinear(); + } + self.y[d].domain(self.db.dimensionDomains[d]) + .range([self.internalHeight-self.NaNMargin,0]); + } + }); + + /*************************************** + * DRAGGING + ***************************************/ + + /** @type {Object (numbers)} Keeps track of the x-position of each axis currently being dragged */ + this.dragging = {}; + + //Drag event handlers + this.axisDragStart = function(d) { + self.dragging[d] = self.x(d); + //Reorder axes such that the one being dragged is on top + self.axes.sort(function(a,b) { + if (a == d) return 1; + if (b == d) return -1; + return 0; + }); + }; + this.axisDrag = function(d) { + self.dragging[d] = Math.min(self.internalWidth,Math.max(0,d3.event.x)); + self.redrawPaths(); + var oldDimensions = self.dimensions.slice(); + self.dimensions.sort(function(a,b){ + return self.getXPosition(a)-self.getXPosition(b); + }); + if (!arraysEqual(oldDimensions,self.dimensions)) + self.dispatch.call('axisorderchange',self,self.dimensions); + self.x.domain(self.dimensions); + self.axes.attr('transform',function(d) { + return "translate("+self.getXPosition(d)+")"; + }); + }; + this.axisDragEnd = function(d) { + delete self.dragging[d]; + d3.select(this).attr('transform',"translate("+self.x(d)+")"); + //Reorder axes in DOM + self.axes.sort(function(a,b){ + return self.x(a) - self.x(b); + }); + self.redrawPaths(); + }; + + /** @type {d3.drag} */ + this.drag = d3.drag() + .subject(function(d){return {x: self.x(d)};}) + .on('start',this.axisDragStart) + .on('drag',this.axisDrag) + .on('end',this.axisDragEnd); + + /*************************************** + * BRUSHES + ***************************************/ + + /** @type {Object (Arrays)} Keeps track of the extents of the brush for each dimension*/ + this.brushExtents = {} + + /** @type {boolean} If true, don't update selection when brushes change */ + this.dontUpdateSelectionOnBrush = false; + + //Brush event handler + this.axisBrush = function(d) { + //If this is called due to an event (as opposed to manually called) + //update corresponding brush extent + if (d3.event != null) { + self.brushExtents[d] = d3.event.selection; + //Ignore brush if its start and end coordinates are the same + if (self.brushExtents[d] != null && self.brushExtents[d][0] === self.brushExtents[d][1]) + delete self.brushExtents[d]; + } + if (!self.dontUpdateSelectionOnBrush) + self.updateSelection(); + } + + /** @type {d3.brushY} The brushes for each axis */ + this.brush = d3.brushY() + .extent([[-8,0],[8,this.internalHeight]]) + .on('start', function(){d3.event.sourceEvent.stopPropagation();}) + .on('start brush',this.axisBrush); + + /*************************************** + * DOM Content + ***************************************/ + + //Create DOM content + //Specify that this is a Pcoord component + d3.select(this.container).classed('PCOORD',true); + /** @type {d3.selection} Where the paths for the chart will be drawn + * The actual drawing of paths depends on the specific Pcoord subclass + */ + this.pathContainer = d3.select(this.container).append('div') + .classed('pathContainer',true) + .style('position','absolute') + .style('width',this.parentRect.width+'px') + .style('height',this.parentRect.height+'px'); + + /** @type {boolean} Indicates if the lines on the chart should be smooth(curved) or not + * Be sure to call redrawPaths() after changing this so it takes effect + */ + this.smoothPaths = true; + + /*************************************** + * AXES + ***************************************/ + + /** @type {d3.selection} The container for all axes (as an svg object) */ + this.axisContainer = d3.select(this.container).append('svg') + .classed('axisContainer',true) + .style('position','absolute') + .attr('viewBox',(-this.margin.right)+' '+(-this.margin.top)+' '+ + (this.parentRect.width)+' '+ + (this.parentRect.height)) + .attr('preserveAspectRatio','none') + .attr('width','100%') + .attr('height','100%') + //disable pointer events on axisContainer so it doesn't block pathContainer + .style('pointer-events','none'); + /** @type {d3.selction} Groups for each axis */ + this.axes = this.axisContainer.selectAll('.axisGroup') + .data(this.dimensions) + .enter().append('g') + .classed('axisGroup',true) + .attr('dimension',function(d){return d;}) + .attr('transform', function(d) { + return "translate("+self.x(d)+")"; + }) + .call(this.drag) + //Add d3 axes to each axis group + this.axes.append('g') + .classed('axis',true) + .each(function(d) { + d3.select(this).call(d3.axisLeft().scale(self.y[d])); + if (!self.db.isStringDimension(d)) + self.addNaNExtensionToAxis(this); + }); + var labels = this.axes.append('g') + .classed('axisLabel',true) + //allow pointer-events on axisLabel so axes can be dragged + .style('pointer-events','initial') + //add text to each label + labels.append('text') + .style('text-anchor','middle') + .attr('y',-9) + .text(function(d){return d;}); + //prepend background rectangle to each label + labels.insert('rect',':first-child') + //each background is bound to their corresponding text's + //bounding box as data + .data(function() { + var boxes = []; + labels.selectAll('text').each(function(){ + boxes.push(this.getBBox()); + }); + return boxes; + }) + .attr('x',function(d){return d.x + 3;}) + .attr('y',function(d){return d.y;}) + .attr('width',function(d){return d.width - 6;}) + .attr('height',function(d){return d.height;}); + //Add brush group to each axis group + this.axes.append('g') + .classed('brush',true) + .each(function(){d3.select(this).call(self.brush);}); + + }; + //establish prototype chain + CINEMA_COMPONENTS.Pcoord.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.Pcoord.prototype.constructor = CINEMA_COMPONENTS.Pcoord; + + /** + * Add an additional line segment and tick to the end of an axis to represent the area + * for NaN values. + * @param {DOM} node - The DOM node for the svg group containing the axis (g.axis) + */ + CINEMA_COMPONENTS.Pcoord.prototype.addNaNExtensionToAxis = function(node) { + d3.select(node).append('path') + .attr('class','NaNExtension') + .attr('d',"M0.5,"+String(this.internalHeight-this.NaNMargin+0.5)+"V"+String(this.internalHeight-0.5)); + var NaNTick = d3.select(node).append('g') + .attr('class','NaNExtensionTick') + .attr('transform',"translate(0,"+String(this.internalHeight-0.5)+")"); + NaNTick.append('line') + .attr('x2','-6'); + NaNTick.append('text') + .attr('x','-9') + .attr('dy','0.32em') + .text('NaN'); + } + + /** + * Should be called every time the size of the chart's container changes. + * Updates the sizing and scaling of all parts of the chart and redraws + */ + CINEMA_COMPONENTS.Pcoord.prototype.updateSize = function() { + var self = this; + var oldHeight = this.internalHeight;//old height needed to rescale brushes + + //Call super (will recalculate size) + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + //update NaNMargin + this.NaNMargin = this.internalHeight/11; + + //update PathContainer size + this.pathContainer + .style('width',this.parentRect.width+'px') + .style('height',this.parentRect.height+'px'); + + //Rescale x + this.x.range([0,this.internalWidth]); + + //Rescale y scales + this.dimensions.forEach(function(d) { + self.y[d].range([self.db.isStringDimension(d) ? self.internalHeight : self.internalHeight-self.NaNMargin, 0]); + }); + + this.redrawPaths(); + + //Reposition and rescale axes + this.axisContainer + .attr('viewBox',(-this.margin.right)+' '+(-this.margin.top)+' '+ + (this.parentRect.width)+' '+ + (this.parentRect.height)); + this.axes.attr("transform", function(d) { + return "translate("+self.getXPosition(d)+")"; + }); + this.axes.each(function(d) { + d3.select(this).select('.axis').call(d3.axisLeft().scale(self.y[d])); + //if scale is linear, then update the NaN extension on the axis + if (!self.db.isStringDimension(d)) { + d3.select(this).select('path.NaNExtension') + .attr('d',"M0.5,"+String(self.internalHeight-self.NaNMargin+0.5)+"V"+String(self.internalHeight-0.5)); + d3.select(this).select('.NaNExtensionTick') + .attr('transform',"translate(0,"+String(self.internalHeight-0.5)+")"); + } + }); + + //Redraw brushes + this.dontUpdateSelectionOnBrush = true; //avoid updating selection when resizing brushes + this.brush.extent([[-8,0],[8,this.internalHeight]]); + this.axes.selectAll('g.brush').each(function(d) { + d3.select(this).call(self.brush); + d3.select(this).call(self.brush.move, function() { + if (self.brushExtents[d] == null) + return null; + + return self.brushExtents[d].map(function(i) { + return i/oldHeight * self.internalHeight; + }); + }); + }); + this.dontUpdateSelectionOnBrush = false; + } + + /** + * Should be called whenever the data in the associated database changes. + * Will update scales, axes and selection to fit the new data. + */ + CINEMA_COMPONENTS.Pcoord.prototype.updateData = function() { + var self = this; + + //Update scale domains + this.dimensions.forEach(function(d){ + self.y[d].domain(self.db.dimensionDomains[d]); + }); + + //Rebuild axes + this.axes.each(function(d) { + d3.select(this).select('.axis').call(d3.axisLeft().scale(self.y[d])); + }); + + this.updateSelection(true); + } + + /** + * Called whenever a brush changes the selection + * Updates selection to hold the indices of all data points that are + * selected by the brushes. + * @param {bool} force - If true, selectionchange event will be triggered + * and paths will be redrawn even if the set the of selected points did + * not change. + */ + CINEMA_COMPONENTS.Pcoord.prototype.updateSelection = function(force) { + var self = this; + var newSelection = []; + this.db.data.forEach(function(d,i) { + var selected = true; + for (var p in self.dimensions) { + var extent = self.brushExtents[self.dimensions[p]]; + if (extent) { + var y = self.getYPosition(self.dimensions[p],d); + selected = selected && extent[0] <= y && y <= extent[1]; + if (!selected) + break; + } + } + if (selected) + newSelection.push(i); + }); + if (!arraysEqual(this.selection,newSelection) || force) { + this.selection = newSelection; + this.dispatch.call("selectionchange",this, this.selection.slice()); + this.redrawSelectedPaths(); + } + } + + /** + * Set the indices of the currently highlighted data + */ + CINEMA_COMPONENTS.Pcoord.prototype.setHighlightedPaths = function(indices) { + this.highlighted = indices; + this.redrawHighlightedPaths(); + } + + /** + * Set the current overlay paths + */ + CINEMA_COMPONENTS.Pcoord.prototype.setOverlayPaths = function(data) { + this.overlayData = data; + this.redrawOverlayPaths(); + }; + + //Shortcut function for redrawSelectedPaths, redrawHighlightedPath, redrawOverlayPaths + CINEMA_COMPONENTS.Pcoord.prototype.redrawPaths = function() { + this.redrawSelectedPaths(); + this.redrawHighlightedPaths(); + this.redrawOverlayPaths(); + } + + /** + * Set the chart's selection to encapsulate the data represented by + * the given array of indices + */ + CINEMA_COMPONENTS.Pcoord.prototype.setSelection = function(selection) { + var ranges = {}; + var self = this; + console.log(selection); + this.dimensions.forEach(function(d) { + ranges[d] = d3.extent(selection, function(i) { + return self.getYPosition(d, self.db.data[i]); + }); + }); + this.axes.selectAll('g.brush') + .each(function(d) { + d3.select(this).call(self.brush.move, function() { + return [ranges[d][0]-5,ranges[d][1]+5]; + }); + }); + //call brush event handler + this.axisBrush(); + } + + /** + * Set the chart's selection to match the ranges defined in the given + * filter. + * @param {Object} filter Object defining the filter. Each key is the name + * of numeric dimension and each value is a 2-length array containing the minimum + * and maximum values. + */ + CINEMA_COMPONENTS.Pcoord.prototype.filterSelection = function(filter) { + var self = this; + this.dimensions.forEach(function(d) { + //get filter for this particular dimension 'f' + var f = filter ? filter[d] : null + if (f && Array.isArray(f) && f.length == 2 && !isNaN(f[0]) && !isNaN(f[1])) { + //clamp range to bounds of chart + var range = [ + Math.max(self.y[d](f[1]),0), + Math.min(self.y[d](f[0]),self.internalHeight) + ] + self.axisContainer.select('.axisGroup[dimension='+d+']').select('g.brush') + .call(self.brush.move, function() {return range;}) + } + }); + //call brush event handler + this.axisBrush(); + } + + /** + * Reorder the axes to the order given + */ + CINEMA_COMPONENTS.Pcoord.prototype.setAxisOrder = function(order) { + var self = this; + //filter out dimensions in order, but not in chart's dimensions + var order = order.filter(function(d) { + return self.dimensions.includes(d); + }); + //Add any dimensions in chart's dimensions but not in order + this.dimensions.forEach(function(d) { + if (!order.includes[d]) + order.push(d); + }); + //update domain + this.x.domain(order); + //update dimensions list + self.dimensions.sort(function(a,b){ + return self.getXPosition(a)-self.getXPosition(b); + }); + //update axes + this.axes.attr('transform',function(d) { + return "translate("+self.getXPosition(d)+")"; + }); + //Reorder axes in DOM + self.axes.sort(function(a,b){ + return self.x(a) - self.x(b); + }); + //redraw + this.redrawPaths(); + } + + /** + * Redraw the current selection of paths. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.Pcoord.prototype.redrawSelectedPaths = function() { + throw new Error("Cannot call abstract function 'redrawSelectedPaths()'!"+ + " Please override function in a subclass"); + } + + /** + * Redraw the currently highlighted path. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.Pcoord.prototype.redrawHighlightedPaths = function() { + throw new Error("Cannot call abstract function 'redrawHighlightedPaths()'!"+ + " Please override function in a subclass"); + } + + /** + * Redraw the overlay paths. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.Pcoord.prototype.redrawOverlayPaths = function() { + throw new Error("Cannot call abstract function 'redrawOverlayPaths()'!"+ + " Please override function in a subclass"); + } + + /** + * Get the path (the contents of the 'd' attribute) for the path + * represented by the given data point. + * Draws a physical break in the path where values are undefined. + * @param {Object} d The data point to base the path off + */ + CINEMA_COMPONENTS.Pcoord.prototype.getPath = function(d) { + var self = this; + var curveLength = this.smoothPaths ? this.internalWidth/this.dimensions.length/3 : 0; + var singleSegmentLength = this.internalWidth/this.dimensions.length/5; + var path = ''; + + //Split dimensions into sections deliminated by undefined values + var sections = []; + var currentSection = []; + this.dimensions.forEach(function(p) { + if (d[p] != undefined) { + currentSection.push(p); + } + else if (currentSection.length != 0) { + sections.push(currentSection.slice()); + currentSection = []; + } + }); + if (currentSection.length > 0) + sections.push(currentSection.slice()); + + //Draw individual sections + sections.forEach(function(section) { + //If a section contains only one dimension, draw a short line across the axis + if (section.length == 1) { + var p = section[0]; + var x = self.getXPosition(p); + var y = self.getYPosition(p,d); + path += ('M '+(x-singleSegmentLength/2)+' '+y+' L ')+ + ((x+singleSegmentLength/2)+' '+y); + } + else { + section.forEach(function (p,i) { + var x = self.getXPosition(p); + var y = self.getYPosition(p,d); + if (i == 0) {//beginning of path + path += ('M '+x+' '+y+' C ')+ + ((x+curveLength)+' '+y+' '); + } + else if (i == section.length-1) {//end of path + path += ((x-curveLength)+' '+y+' ')+ + (x+' '+y+' '); + } + else {//midpoints + path += ((x-curveLength)+' '+y+' ')+ + (x+' '+y+' ')+ + ((x+curveLength)+' '+y+' '); + } + }); + } + }); + return path; + } + + /** + * Get the x-coordinate of the axis representing the given dimension + * @param {string} d - The dimension to get the x-coordinate for + */ + CINEMA_COMPONENTS.Pcoord.prototype.getXPosition = function(d) { + var v = this.dragging[d]; + return v == null ? this.x(d) : v; + }; + + /** + * Get the y-coordinate of the line for data point p on dimension d + * @param {string} d - The dimension on the data point + * @param {Object} p - The data point + */ + CINEMA_COMPONENTS.Pcoord.prototype.getYPosition = function(d, p) { + if (!this.db.isStringDimension(d) && isNaN(p[d])) + //If the value is NaN on a linear scale, return internalHeight as the position + //(to place the line on the NaN tick) + return this.internalHeight; + return this.y[d](p[d]); + } + + /** + * Get the y-coordinate of the line for data point p on dimension d + * @param {Object} dimObject - dimension / startDate / endDate selected} + */ + CINEMA_COMPONENTS.Pcoord.prototype.addSelectionByDimensionValues = function(dimObject) { + var self = this; + + //Get pixel values of given dates + var startpx = this.y[dimObject.dimension](dimObject.startDate) + var endpx = this.y[dimObject.dimension](dimObject.endDate) + + //avoid 0px selection + if(startpx === endpx) { + startpx += 1; + endpx -= 1; + } + + //Check if inside boundary + var range = [ + Math.min(endpx,self.internalHeight), + Math.max(startpx,0) + ] + + //Set selection + self.axisContainer + .select('.axisGroup[dimension='+dimObject.dimension+']') + .select('g.brush') + .call(self.brush.move, function() {return range;}); + } + + /** + * Convenience function to compare arrays + * (used to compare the selection to the previous one) + */ + function arraysEqual(a, b) { + if (a === b) return true; + if (a == null || b == null) return false; + if (a.length != b.length) return false; + + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) return false; + } + return true; + } + +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * PCOORD_CANVAS + * + * The PcoordSVG Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the PcoordCanvas component: + * A subclass of Pcoord which draws a Paralell Coordinates chart using canvas elements. + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Pcoord Component be included + if (!CINEMA_COMPONENTS.PCOORD_INCLUDED) + throw new Error("CINEMA_COMPONENTS PcoordCanvas Component requires that Pcoord"+ + " component be included. Please make sure that Pcoord component"+ + " is included BEFORE PcoordCanvas module"); + + /** @type {boolean} - Flag to indicate that the PcoordCanvas Component has been included */ + CINEMA_COMPONENTS.PCOORD_CANVAS_INCLUDED = true; + + /** + * Constructor for PcoordCanvas Component + * Represents a component for displaying and interacting with a database on a parallel coordinates chart + * rendered with canvas elements + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.PcoordCanvas = function(parent, database, filterRegex) { + var self = this; + //call super-constructor + CINEMA_COMPONENTS.Pcoord.call(this,parent,database,filterRegex); + + //Specify that this is a Pcoord Canvas component + d3.select(this.container).classed('CANVAS',true); + + //Add canvases to pathContainer + this.selectedCanvas = this.pathContainer.append('canvas') + .classed('selectedCanvas',true) + .node(); + this.highlightedCanvas = this.pathContainer.append('canvas') + .classed('highlightedCanvas',true) + .node(); + this.overlayCanvas = this.pathContainer.append('canvas') + .classed('overlayCanvas',true) + .node(); + //Index canvas is invisible and draws in a unique color for each path + //Its color data is used to determine which path is being moused over + this.indexCanvas = this.pathContainer.append('canvas') + .classed('indexCanvas',true) + .style('display','none') + .node(); + //Size/position canvases + this.pathContainer.selectAll('canvas') + .style('position','absolute') + .style('top',this.margin.top+'px') + .style('left',this.margin.left+'px'); + + //Determine screen DPI to rescale canvas contexts + //(prevents artifacts and blurring on some displays) + //https://stackoverflow.com/a/15666143/2827258 + this.pixelRatio = (function() { + var ctx = document.createElement('canvas').getContext("2d"), + dpr = window.devicePixelRatio || 1, + bsr = ctx.webkitBackingStorePixelRatio || + ctx.mozBackingStorePixelRatio || + ctx.msBackingStorePixelRatio || + ctx.oBackingStorePixelRatio || + ctx.backingStorePixelRatio || 1; + return dpr / bsr; + })(); + + //Loading/still drawing indicator + this.loading = d3.select(this.container).append('div') + .classed('loadingIndicator',true) + .style('display','none') + .text('Drawing...'); + + //Set an interval to call drawIterator if it exists + //roughly 60 times a second + this.interval = setInterval(function(self) { + for (var i = 0; i < 25; i++) { + if (self.drawIterator) { + if (self.drawIterator.next().done) { + self.drawIterator = undefined; + self.loading.style('display','none'); + } + } + } + }, 16, this); + + //Set up mousemove listener to get moused-over paths + this.lastMouseMove = null; //remember last result, to prevent excessive dispatch calls + this.pathContainer.on('mousemove', function() { + var x = d3.mouse(self.selectedCanvas)[0]*self.pixelRatio; + var y = d3.mouse(self.selectedCanvas)[1]*self.pixelRatio; + if (x >= 0 && y >= 0) { + var index = getIndexAtPoint(x,y,self.indexCanvas); + if (index != -1) { + if (self.lastMouseMove != self.selection[index]) { + self.lastMouseMove = self.selection[index]; + self.dispatch.call('mouseover',self,self.selection[index],d3.event); + } + } + else { + if (self.lastMouseMove !== null) { + self.lastMouseMove = null; + self.dispatch.call('mouseover',self,null,d3.event); + } + } + } + }); + + this.updateSize(); + } + //establish prototype chain + CINEMA_COMPONENTS.PcoordCanvas.prototype = Object.create(CINEMA_COMPONENTS.Pcoord.prototype); + CINEMA_COMPONENTS.PcoordCanvas.prototype.constructor = CINEMA_COMPONENTS.PcoordCanvas; + + /************************** + * OVERRIDE METHODS + **************************/ + + CINEMA_COMPONENTS.PcoordCanvas.prototype.updateSize = function() { + var self = this; + //call super + CINEMA_COMPONENTS.Pcoord.prototype.updateSize.call(this); + + //Resize canvases + this.pathContainer.selectAll('canvas') + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px') + // width/height styles are distinct from attributes + // (attributes determine context size, style is the size the canvas appears in on screen) + .attr('width',this.internalWidth*this.pixelRatio+'px') + .attr('height',this.internalHeight*this.pixelRatio+'px') + .each(function(){ + this.getContext('2d').scale(self.pixelRatio,self.pixelRatio); + }); + //Init canvas contexts + var selectedContext = this.selectedCanvas.getContext('2d'); + selectedContext.strokeStyle = 'lightgray'; + selectedContext.globalAlpha = 0.3; + selectedContext.lineWidth = 2; + var highlightedContext = this.highlightedCanvas.getContext('2d'); + highlightedContext.strokeStyle = 'lightskyblue'; + highlightedContext.lineWidth = 4; + var indexContext = this.indexCanvas.getContext('2d'); + indexContext.lineWidth = 3; + + this.redrawPaths(); + } + + /** + * Redraw the current selection of paths. + */ + CINEMA_COMPONENTS.PcoordCanvas.prototype.redrawSelectedPaths = function() { + var self = this; + + var ctx = this.selectedCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + var indexCtx = this.indexCanvas.getContext('2d'); + indexCtx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.drawIterator = (function*(queue){ + self.loading.style('display','initial'); + var i = 0; + while (i < queue.length) { + var path = new Path2D(self.getPath(self.db.data[queue[i]])); + ctx.stroke(path); + + indexCtx.strokeStyle = indexToColor(i); + indexCtx.stroke(path); + + yield ++i; + } + })(this.selection); + } + + /** + * Redraw the currently highlighted path. + */ + CINEMA_COMPONENTS.PcoordCanvas.prototype.redrawHighlightedPaths = function() { + var self = this; + + var ctx = this.highlightedCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.highlighted.forEach(function(d) { + var path = new Path2D(self.getPath(self.db.data[d])); + ctx.stroke(path); + }); + } + + /** + * Redraw the overlay paths. + */ + CINEMA_COMPONENTS.PcoordCanvas.prototype.redrawOverlayPaths = function() { + var self = this; + + var ctx = this.overlayCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.overlayData.forEach(function(d) { + //Parse style + ctx.lineWidth = d.style.lineWidth || 1; + ctx.lineCap = d.style.lineCap || 'butt'; + ctx.lineJoin = d.style.lineJoin || 'miter'; + ctx.miterLimit = d.style.miterLimit || 10; + ctx.strokeStyle = d.style.strokeStyle || 'black'; + if (d.style.lineDash) + ctx.setLineDash(d.style.lineDash); + else + ctx.setLineDash([]); + //Draw line + var path = new Path2D(self.getPath(d.data)); + ctx.stroke(path); + }) + } + + /** + * Override destroy() to also clear interval + */ + CINEMA_COMPONENTS.PcoordCanvas.prototype.destroy = function() { + clearInterval(this.interval); + //Call super + CINEMA_COMPONENTS.Component.prototype.destroy.call(this); + } + + //Get the index of the path at the given point + //using the colors on the index canvas + //returns -1 if there is no path, or the area around the point is too noisy + var getIndexAtPoint = function(x,y,canvas) { + //get the color data for a 3x3 pixel area around the point + var colorData = canvas.getContext('2d').getImageData(x-1,y-1,3,3).data; + //get the index for each pixel + var indices = []; + for (var i = 0; i < colorData.length/4; i++) { + indices.push(colorToIndex(colorData.slice(i*4,i*4+3))); + } + + //for a positive match, must find at least 5 pixels with the same index + indices.sort(); + var matched = -1; + var count = 0; + var counting = -1; + for (var i = 0; i < indices.length; i++) { + if (counting != indices[i]) { + count = 1; + counting = indices[i]; + } + else { + count++; + if (count == 5) { + matched = counting; + break; + } + } + } + + return matched; + } + + //convert an index value to a color + //Mapping -1 through 256^3 to rgb(0,0,0) through rgb(255,255,255) + var indexToColor = function(i) { + if (i > 256*256*256) { + return 'rgb(255,255,255)'; + } + i++; + var b = Math.floor(i/256/256); + var g = Math.floor((i - b*256*256) / 256); + var r = (i - b*256*256 - g*256); + return 'rgb('+r+','+g+','+b+')'; + } + + //convert a color to an index value + //Mapping [0,0,0] through [255,255,255] to -1 through 256^3 + var colorToIndex = function(rgb) { + return (rgb[0] + rgb[1]*256 + rgb[2]*256*256)-1; + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * PCOORDSVG + * + * The PcoordSVG Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the PcoordSVG component: + * A subclass of Pcoord which draws a Paralell Coordinates chart using SVG. + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Pcoord Component be included + if (!CINEMA_COMPONENTS.PCOORD_INCLUDED) + throw new Error("CINEMA_COMPONENTS PcoordSVG Component requires that Pcoord"+ + " component be included. Please make sure that Pcoord component"+ + " is included BEFORE PcoordSVG module"); + + /** @type {boolean} - Flag to indicate that the PcoordSVG Component has been included */ + CINEMA_COMPONENTS.PCOORDSVG_INCLUDED = true; + + /** + * Constructor for PcoordSVG Component + * Represents a component for displaying and interacting with a database on a parallel coordinates chart + * rendered with SVG + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.PcoordSVG = function(parent, database, filterRegex) { + //call super-constructor + CINEMA_COMPONENTS.Pcoord.call(this,parent,database,filterRegex); + + //Specify that this is a Pcoord SVG component + d3.select(this.container).classed('SVG',true); + + //Add SVG Components to pathContainer + this.svg = this.pathContainer.append('svg') + .style('position','absolute') + .style('top',this.margin.top+'px') + .style('left',this.margin.left+'px') + .attr('width',this.internalWidth+'px') + .attr('height',this.internalHeight+'px'); + //Add group for selected paths + this.selectedPaths = this.svg.append('g') + .classed('selectedPaths',true); + //Add group for highlighted paths + this.highlightedPaths = this.svg.append('g') + .classed('highlightedPaths',true); + //Add group for overlay paths + this.overlayPaths = this.svg.append('g') + .classed('overlayPaths',true); + + this.redrawPaths(); + } + //establish prototype chain + CINEMA_COMPONENTS.PcoordSVG.prototype = Object.create(CINEMA_COMPONENTS.Pcoord.prototype); + CINEMA_COMPONENTS.PcoordSVG.prototype.constructor = CINEMA_COMPONENTS.PcoordSVG; + + /************************** + * OVERRIDE METHODS + **************************/ + + CINEMA_COMPONENTS.PcoordSVG.prototype.updateSize = function() { + //call super + CINEMA_COMPONENTS.Pcoord.prototype.updateSize.call(this); + + //rescale svg + this.svg + .attr('width',this.internalWidth+'px') + .attr('height',this.internalHeight+'px'); + } + + /** + * Redraw the current selection of paths. + */ + CINEMA_COMPONENTS.PcoordSVG.prototype.redrawSelectedPaths = function() { + var self = this; + //Bind to selection and update + var update = this.selectedPaths + .selectAll('path').data(this.selection); + update.enter() //ENTER + .append('path') + .merge(update) //ENTER + UPDATE + .attr('index',function(d){return d;}) + .attr('d',function(d){ + return self.getPath(self.db.data[d]); + }) + .on('mouseenter',function(d){ + self.dispatch.call("mouseover",self,d,d3.event); + }) + .on('mouseleave',function(d){ + self.dispatch.call("mouseover",self,null,d3.event); + }) + .on('click', function(d) { + self.dispatch.call("click",self,d); + }); + update.exit() //EXIT + .remove(); + } + + /** + * Redraw the currently highlighted path. + */ + CINEMA_COMPONENTS.PcoordSVG.prototype.redrawHighlightedPaths = function() { + var self = this; + //Bind to highlighted and update + var update = this.highlightedPaths + .selectAll('path').data(this.highlighted); + update.enter() //ENTER + .append('path') + .merge(update) //ENTER + UPDATE + .attr('index',function(d){return d;}) + .attr('d',function(d){ + return self.getPath(self.db.data[d]); + }); + update.exit() //EXIT + .remove(); + } + + /** + * Redraw the overlay paths. + */ + CINEMA_COMPONENTS.PcoordSVG.prototype.redrawOverlayPaths = function() { + var self = this; + //Bind to overlayData and update + var update = this.overlayPaths + .selectAll('path').data(this.overlayData); + update.enter() //ENTER + .append('path') + .merge(update) //ENTER + UPDATE + .attr('style',function(d){return d.style;}) + .attr('d',function(d){ + return self.getPath(d.data); + }); + update.exit() //EXIT + .remove(); + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * QUERY + * + * The Query Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the Query Component + * Which allows for defining a custom data point and querying + * a database for similar data points + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS Query module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE Query module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS Query module requires that"+ + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the"+ + " the Query module"); + } + + /** @type {boolean} - Flag to indicate that the Query module has been included */ + CINEMA_COMPONENTS.QUERY_INCLUDED = true; + + /** + * Constructor for Query Component + * Represents a component for querying a database + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * (Note that Query does not use a filterRegex) + */ + CINEMA_COMPONENTS.Query = function(parent, database) { + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + //Call super-constructor (will calculate size) + CINEMA_COMPONENTS.Component.call(this,parent,database); + + /*************************************** + * DATA + ***************************************/ + + //override this.dimensions to include only numeric dimensions + this.dimensions = this.dimensions.filter(function(d) { + return !self.db.isStringDimension(d); + }); + + /** @type {number[]} Indices of the similar results to the last query */ + this.results = []; + + /** @type {CINEMA_COMPONENTS.ExtraData} The custom-defined data point */ + this.custom = new CINEMA_COMPONENTS.ExtraData({},""); + /** @type {CINEMA_COMPONENTS.ExtraData} Approximations of the boudnaries for similar data given the threshold */ + this.upper = new CINEMA_COMPONENTS.ExtraData({},""); + this.lower = new CINEMA_COMPONENTS.ExtraData({},""); + // (styles will be decided by a client program) + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. Ex: this.dispatch.on('query',handlerFunction(results)) + * 'query': Triggered when a query is made + * (argument is the results of the query (as an array of indices)) + * 'customchange': Triggered when the custom-defined data point changes + * (arguemnt is an array with extra data custom,upper and lower (in that order)) + */ + this.dispatch = d3.dispatch('query','customchange'); + + /*************************************** + * SCALES + ***************************************/ + + //Input sliders for each dimension range from 0 to 100 + //So create scales to scale a slider's value to a value in its dimension + this.scales = {}; + this.dimensions.forEach(function(d) { + self.scales[d] = d3.scaleLinear() + .domain([0,100]) + .range(self.db.dimensionDomains[d]); + }); + + /*************************************** + * DOM Content + ***************************************/ + + //Specify that this is a Query component + d3.select(this.container).classed('QUERY',true); + + /** @type {DOM (button)} Button to perform a query when pressed */ + this.queryButton = d3.select(this.container).append('button') + .classed('queryButton',true) + .text("Find Similar") + .on('click',function() { + var results = self.db.getSimilar(self.custom.data,self.thresholdNode.value); + d3.select(self.readout).text(results.length+ " results found!"); + self.dispatch.call('query',self,results.slice()); + }) + .node(); + + /** @type {DOM (span)} Label for Threshold input */ + this.thresholdLabel = d3.select(this.container).append('span') + .classed('thresholdLabel',true) + .text("Threshold:") + .node(); + + /** @type {DOM (input/number)} Number input for threshold */ + this.thresholdNode = d3.select(this.container).append('input') + .classed('thresholdInput',true) + .attr('type','number') + .attr('max',this.dimensions.length) + .attr('min',0) + .attr('step',0.05) + .on('change',function() { + self.updateBounds(); + self.dispatch.call('customchange',self,[self.custom,self.upper,self.lower]); + }) + .node(); + this.thresholdNode.value = 1.0; + + /** @type {DOM (span)} Readout for number of found results */ + this.readout = d3.select(this.container).append('span') + .classed('readout',true) + .node(); + + /** @type {d3.selection} Input rows for each dimension */ + this.rows = d3.select(this.container).selectAll('.inputRow') + .data(this.dimensions) + .enter().append('div') + .classed('inputRow',true) + .style('position','relative'); + //Create contents of each input row + //labels + this.rows.append('span') + .classed('label',true) + .style('position','absolute') + .text(function(d){return d;}); + //checkbox + this.rows.append('input') + .attr('type','checkbox') + .style('position','absolute') + .on('input',function(d) { + if (this.checked) { + var slider = d3.select(this.parentNode).select('input[type="range"]'); + self.custom.data[d] = self.scales[d](slider.node().value); + } + else { + delete self.custom.data[d]; + } + self.updateBounds(); + self.dispatch.call('customchange',self,[self.custom,self.upper,self.lower]); + }); + //slider + this.rows.append('input') + .attr('type','range') + .attr('min',0) + .attr('max',100) + .attr('step',1) + .each(function(){this.value = 50;}) + .style('position','absolute') + .on('input',function(d){ + var check = d3.select(this.parentNode).select('input[type="checkbox"]'); + if (!check.node().checked) + check.node().checked = true; + self.custom.data[d] = self.scales[d](this.value); + self.updateBounds(); + self.dispatch.call('customchange',self,[self.custom,self.upper,self.lower]); + }); + + } + //establish prototype chain + CINEMA_COMPONENTS.Query.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.Query.prototype.constructor = CINEMA_COMPONENTS.Query; + + /** + * Should be called whenever the data in the associated database changes. + * Will update scales to fit the new data. + */ + CINEMA_COMPONENTS.Query.prototype.updateData = function() { + var self = this; + + this.dimensions.forEach(function(d) { + self.scales[d].range(self.db.dimensionDomains[d]); + }) + } + + /** + * Update upper and lower data depending on custom data and current threshold value + */ + CINEMA_COMPONENTS.Query.prototype.updateBounds = function() { + var self = this; + var threshold = this.thresholdNode.value; + //average difference along each dimension + var avg = (threshold/d3.keys(this.custom.data).length)*100; + this.upper.data = {}; + this.lower.data = {}; + this.dimensions.forEach(function(d) { + if (self.custom.data[d] !== undefined) { + var s = self.scales[d]; + self.lower.data[d] = s(Math.max(s.invert(self.custom.data[d])-avg,0)); + self.upper.data[d] = s(Math.min(s.invert(self.custom.data[d])+avg,100)); + } + }); + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * SCATTER_PLOT + * + * The ScatterPlot component for the CINEMA_COMPONENTS library. + * Contains the constructor for ScatterPlot Components (Eg. ScatterPlotSVG, ScatterPlotCanvas) + * It is a subclass of Component and contains methods and fields common to all ScatterPlot Components + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS ScatterPlot module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE ScatterPlot module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS ScatterPlot module requires that"+ + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the"+ + " the ScatterPlot module"); + } + + /** @type {boolean} - Flag to indicate that the ScatterPlot module has been included */ + CINEMA_COMPONENTS.SCATTER_PLOT_INCLUDED = true; + + /** + * Abstract constructor for ScatterPlot Components + * Represents a component for displaying the data in a database on a 2D scatter plot. + * Objects such as ScatterPlotSVG and ScatterPlotCanvas inherit from this. + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.ScatterPlot = function(parent, database, filterRegex) { + /*if (this.constructor === CINEMA_COMPONENTS.ScatterPlot) + throw new Error("Cannot instantiate abstract class 'ScatterPlot'"+ + "Please use a subclass.");*/ + + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + /** @type {CINEMA_COMPONENTS.Margin} Override default margin */ + this.margin = new CINEMA_COMPONENTS.Margin(25,25,60,150); + + //Call super-constructor + CINEMA_COMPONENTS.Component.call(this,parent,database,filterRegex); + + /*************************************** + * DATA + ***************************************/ + + /** @type {number[]} Indices of all currently displayed data */ + this.selection = []; + /** @type {number} Indices of all currently highlighted data */ + this.highlighted = []; + /** @type {CINEMA_COMPONENTS.ExtraData[]} Custom data to overlay on chart */ + this.overlayData = []; + + /** @type {string} The currently selected dimensions for each axis*/ + this.xDimension = this.dimensions[0]; + this.yDimension = this.dimensions[1]; + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. Ex: this.dispatch.on('mouseover',handlerFunction(i)) + * 'mouseover': Triggered when a point is moused over. + * (called with the index of moused over data and a reference to the mouse event) + * 'xchanged': Triggered when the x dimension being viewed is changed + * (called with the new dimension as an argument) + * 'ychanged': Triggered when the y dimension being viewed is changed + * (called with the new dimension as an argument) + */ + this.dispatch = d3.dispatch("mouseover",'xchanged','ychanged'); + + /*************************************** + * SCALES + ***************************************/ + + /** @type {d3.scale} The scales for the x and y axes */ + this.x = (this.db.isStringDimension(this.xDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(this.db.dimensionDomains[this.xDimension]) + .range([15,this.internalWidth-15]); + this.y = (this.db.isStringDimension(this.yDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(this.db.dimensionDomains[this.yDimension]) + .range([this.internalHeight-15,15]); + + /*************************************** + * DOM Content + ***************************************/ + + //Specify that this a ScatterPlot component + d3.select(this.container).classed('SCATTER_PLOT',true); + + /** @type {d3.selection} Where the data on the chart will be drawn + * The actual drawing depends on the specific ScatterPlot sublcass + */ + this.pointContainer = d3.select(this.container).append('div') + .classed('pointContainer',true) + .style('position','absolute') + .style('top',this.margin.top+'px') + .style('right',this.margin.right+'px') + .style('bottom',this.margin.bottom+'px') + .style('left',this.margin.left+'px') + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px'); + + /** @type {DOM (select)} The select elements for selecting the dimension for each axis */ + //x + this.xSelect = d3.select(this.container).append('select') + .classed('dimensionSelect x',true) + .style('position','absolute') + .node(); + //y + this.ySelect = d3.select(this.container).append('select') + .classed('dimensionSelect y',true) + .style('position','absolute') + .node(); + //Bind data and append options + //x + d3.select(this.xSelect).selectAll('option') + .data(this.dimensions) + .enter().append('option') + .attr('value',function(d){return d;}) + .text(function(d){return d;}); + d3.select(this.xSelect).node().value = this.xDimension; + //y + d3.select(this.ySelect).selectAll('option') + .data(this.dimensions) + .enter().append('option') + .attr('value',function(d){return d;}) + .text(function(d){return d;}); + d3.select(this.ySelect).node().value = this.yDimension; + //Add change listeners to select elements + //x + d3.select(this.xSelect).on('input',function() { + self.xDimension = this.value; + self.x = (self.db.isStringDimension(self.xDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(self.db.dimensionDomains[self.xDimension]) + .range([0,self.internalWidth]); + self.xAxisContainer.select('.axis') + .call(d3.axisBottom().scale(self.x)); + self.dispatch.call('xchanged',self,self.xDimension); + self.redrawPoints(); + }); + //y + d3.select(this.ySelect).on('input',function() { + self.yDimension = this.value; + self.y = (self.db.isStringDimension(self.yDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(self.db.dimensionDomains[self.yDimension]) + .range([self.internalHeight,0]); + self.yAxisContainer.select('.axis') + .call(d3.axisLeft().scale(self.y)); + self.dispatch.call('ychanged',self,self.yDimension); + self.redrawPoints(); + }); + + /** @type {d3.selection} A readout in the corner of the chart + * that warns if any data could not be plotted + */ + this.warningReadout = d3.select(this.container).append('div') + .classed('warningReadout',true) + .style('position','absolute'); + + /*************************************** + * AXES + ***************************************/ + + /** @type {d3.selection} The container for each axis */ + //x + this.xAxisContainer = d3.select(this.container).append('svg') + .classed('axisContainer x',true) + .style('position','absolute') + .style('width',this.internalWidth+'px') + .style('height',25+'px') + .style('top',this.margin.top+this.internalHeight+'px') + .style('left',this.margin.left+'px'); + //y + this.yAxisContainer = d3.select(this.container).append('svg') + .classed('axisContainer y',true) + .style('position','absolute') + .style('width',50+'px') + .style('height',this.internalHeight+'px') + .style('left',(this.margin.left-50)+'px') + .style('top',this.margin.top+'px'); + //Add axis to each axis container + //x + this.xAxisContainer.append('g') + .classed('axis',true) + .call(d3.axisBottom().scale(this.x)); + //y + this.yAxisContainer.append('g') + .classed('axis',true) + .attr('transform','translate(50)') + .call(d3.axisLeft().scale(this.y)); + + }; + //establish prototype chain + CINEMA_COMPONENTS.ScatterPlot.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.ScatterPlot.prototype.constructor = CINEMA_COMPONENTS.ScatterPlot; + + /** + * Should be called every time the size of the chart's container changes. + * Updates the sizing and scaling of all parts of the chart and redraws + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.updateSize = function() { + //Call super (will recalculate size) + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + //update pointContainer size + this.pointContainer + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px'); + + //Rescale + this.x.range([15,this.internalWidth-15]); + this.y.range([this.internalHeight-15,15]); + + //Reposition and rescale axes + this.xAxisContainer + .style('top',this.margin.top+this.internalHeight+'px') + .style('width',this.internalWidth+'px') + .select('.axis') + .call(d3.axisBottom().scale(this.x)); + this.yAxisContainer + .style('height',this.internalHeight+'px') + .select('.axis') + .call(d3.axisLeft().scale(this.y)); + + this.redrawPoints(); + } + + /** + * Should be called whenever the data in the associated database changes. + * Will update scales, axes and selection to fit the new data. + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.updateData = function() { + + //Update scale domains + this.x.domain(this.db.dimensionDomains[this.xDimension]); + this.y.domain(this.db.dimensionDomains[this.yDimension]); + + //Rebuild axes + this.xAxisContainer.select('.axis') + .call(d3.axisBottom().scale(this.x)); + this.yAxisContainer.select('.axis') + .call(d3.axisLeft().scale(this.y)); + + this.redrawPoints(); + } + + //Shortcut function for redrawSelectedPoints, redrawHighlightedPoints and redrawOverlayPoints + CINEMA_COMPONENTS.ScatterPlot.prototype.redrawPoints = function() { + this.redrawSelectedPoints(); + this.redrawHighlightedPoints(); + this.redrawOverlayPoints(); + } + + /** + * Filter the given selection into only the points that can be shown + * on the plot (i.e. do not have NaN or undefined values on current dimensions) + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.getPlottablePoints = function(selection) { + var self = this; + return selection.filter(function(d) { + var xCoord = self.x(self.db.data[d][self.xDimension]); + var yCoord = self.y(self.db.data[d][self.yDimension]); + return !(isNaN(xCoord) || isNaN(yCoord)); + }); + } + + /** + * Set the chart's selection of data to the data represented + * by the given list of indices + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.setSelection = function(selection) { + this.selection = selection; + this.redrawSelectedPoints(); + } + + /** + * Set the chart's current highlighted data to the data represented + * by the given list of indices + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.setHighlightedPoints = function(indices) { + this.highlighted = indices; + this.redrawHighlightedPoints(); + } + + /** + * Set the current overlay points + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.setOverlayPoints = function(data) { + this.overlayData = data; + this.redrawOverlayPaths(); + }; + + /** + * Redraw the current selection of points. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.redrawSelectedPoints = function() { + throw new Error("Cannot call abstract function 'redrawSelectedPoints()'!"+ + " Please override function in a subclass"); + } + + /** + * Redraw the currently highlighted points. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.redrawHighlightedPoints = function() { + throw new Error("Cannot call abstract function 'redrawHighlightedPoints()'!"+ + " Please override function in a subclass"); + } + + /** + * Redraw the overlay points. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.redrawOverlayPoints = function() { + throw new Error("Cannot call abstract function 'redrawOverlayPoints()'!"+ + " Please override function in a subclass"); + } +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * SCATTER_PLOT_CANVAS + * + * The ScatterPlotCanvas Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the ScatterplotCanvas Component: + * A subclass of ScatterPlot which draws data using canvas elements + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the ScatterPlot Component be included + if (!CINEMA_COMPONENTS.SCATTER_PLOT_INCLUDED) + throw new Error("CINEMA_COMPONENTS ScatterPlotCanvas Component requires that ScatterPlot"+ + " component be included. Please make sure that ScatterPlot component"+ + " is included BEFORE ScatterPlotCanvas module"); + + /** @type {boolean} - Flag to indicate that the ScatterPlotSVG Component has been included */ + CINEMA_COMPONENTS.SCATTER_PLOT_CANVAS_INCLUDED = true; + + /** + * Constructor for ScatterPlotCanvas Component + * Represents a component for displaying data on a 2D Scatter Plot + * Rendered with canvas elements + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.ScatterPlotCanvas = function(parent, database, filterRegex) { + var self = this; + + //call super-constructor + CINEMA_COMPONENTS.ScatterPlot.call(this,parent,database,filterRegex); + + //specify that this is a ScatterPlot Canvas component. + d3.select(this.container).classed('CANVAS',true); + + //Because not every point in the selection will be on the plot, + //need to keep track of plottablePoints so that their + //index can be used on indexCanvas + this.plottablePoints = []; + + //Add canvases to pathContainer + this.selectedCanvas = this.pointContainer.append('canvas') + .classed('selectedCanvas',true) + .node(); + this.highlightedCanvas = this.pointContainer.append('canvas') + .classed('highlightedCanvas',true) + .node(); + this.overlayCanvas = this.pointContainer.append('canvas') + .classed('overlayCanvas',true) + .node(); + //Index canvas is invisible and draws in a unique color for each path + //Its color data is used to determine which path is being moused over + this.indexCanvas = this.pointContainer.append('canvas') + .classed('indexCanvas',true) + .style('display','none') + .node(); + //Size/position canvases + this.pointContainer.selectAll('canvas') + .style('position','absolute'); + + //Determine screen DPI to rescale canvas contexts + //(prevents artifacts and blurring on some displays) + //https://stackoverflow.com/a/15666143/2827258 + this.pixelRatio = (function() { + var ctx = document.createElement('canvas').getContext("2d"), + dpr = window.devicePixelRatio || 1, + bsr = ctx.webkitBackingStorePixelRatio || + ctx.mozBackingStorePixelRatio || + ctx.msBackingStorePixelRatio || + ctx.oBackingStorePixelRatio || + ctx.backingStorePixelRatio || 1; + return dpr / bsr; + })(); + + //Loading/still drawing indicator + this.loading = d3.select(this.container).append('div') + .classed('loadingIndicator',true) + .style('display','none') + .text('Drawing...'); + + //Set an interval to call drawIterator if it exists + //roughly 60 times a second + this.interval = setInterval(function(self) { + for (var i = 0; i < 25; i++) { + if (self.drawIterator) { + if (self.drawIterator.next().done) { + self.drawIterator = undefined; + self.loading.style('display','none'); + } + } + } + }, 16, this); + + //Set up mousemove listener to get moused-over paths + this.lastMouseMove = null; //remember last result, to prevent excessive dispatch calls + this.pointContainer.on('mousemove', function() { + var x = d3.mouse(self.selectedCanvas)[0]*self.pixelRatio; + var y = d3.mouse(self.selectedCanvas)[1]*self.pixelRatio; + if (x >= 0 && y >= 0) { + var index = getIndexAtPoint(x,y,self.indexCanvas); + if (index != -1) { + if (self.lastMouseMove != self.plottablePoints[index]) { + self.lastMouseMove = self.plottablePoints[index]; + self.dispatch.call('mouseover',self,self.plottablePoints[index],d3.event); + } + } + else { + if (self.lastMouseMove !== null) { + self.lastMouseMove = null; + self.dispatch.call('mouseover',self,null,d3.event); + } + } + } + }); + + this.updateSize(); + } + //establish prototype chain + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype = Object.create(CINEMA_COMPONENTS.ScatterPlot.prototype); + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.constructor = CINEMA_COMPONENTS.ScatterPlotCanvas; + + /************************** + * OVERRIDE METHODS + **************************/ + + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.updateSize = function() { + var self = this; + //call super + CINEMA_COMPONENTS.ScatterPlot.prototype.updateSize.call(this); + + //Resize canvases + this.pointContainer.selectAll('canvas') + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px') + // width/height styles are distinct from attributes + // (attributes determine context size, style is the size the canvas appears in on screen) + .attr('width',this.internalWidth*this.pixelRatio+'px') + .attr('height',this.internalHeight*this.pixelRatio+'px') + .each(function(){ + this.getContext('2d').scale(self.pixelRatio,self.pixelRatio); + }); + //Init canvas contexts + var selectedContext = this.selectedCanvas.getContext('2d'); + selectedContext.fillStyle = 'rgba(82, 137, 163, 0.521)'; + selectedContext.strokeStyle = 'rgb(69, 121, 153)'; + selectedContext.lineWidth = 2; + var highlightedContext = this.highlightedCanvas.getContext('2d'); + highlightedContext.fillStyle = 'rgb(252, 127, 127)'; + highlightedContext.strokeStyle = 'rgb(153, 80, 80)'; + highlightedContext.lineWidth = 3; + + this.redrawPoints(); + } + + /** + * Redraw the current selection of points + */ + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.redrawSelectedPoints = function() { + var self = this; + + this.plottablePoints = this.getPlottablePoints(this.selection); + //Update warningReadout + if (this.plottablePoints.length < this.selection.length) + this.warningReadout.text((this.selection.length-this.plottablePoints.length) + + " point(s) could not be plotted (because they contain NaN or undefined values)."); + else + this.warningReadout.text(''); + + var ctx = this.selectedCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + var indexCtx = this.indexCanvas.getContext('2d'); + indexCtx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.drawIterator = (function*(queue){ + self.loading.style('display','initial'); + var i = 0; + while (i < queue.length) { + var x = self.x(self.db.data[queue[i]][self.xDimension]); + var y = self.y(self.db.data[queue[i]][self.yDimension]); + ctx.beginPath(); + ctx.arc(x,y,6,0,2*Math.PI); + ctx.fill(); + ctx.stroke(); + + indexCtx.fillStyle = indexToColor(i); + indexCtx.beginPath(); + indexCtx.arc(x,y,10,0,2*Math.PI); + indexCtx.fill(); + + yield ++i; + } + })(this.plottablePoints); + } + + /** + * Redraw the current selection of points + */ + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.redrawHighlightedPoints = function() { + var self = this; + + var plottable = this.getPlottablePoints(this.highlighted); + + var ctx = this.highlightedCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + plottable.forEach(function(d) { + var x = self.x(self.db.data[d][self.xDimension]); + var y = self.y(self.db.data[d][self.yDimension]); + ctx.beginPath(); + ctx.arc(x,y,10,0,2*Math.PI); + ctx.fill(); + ctx.stroke(); + }); + } + + /** + * Redraw the overlay points + */ + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.redrawOverlayPoints = function() { + var self = this; + + var ctx = this.overlayCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.overlayData.forEach(function(d) { + //Parse style + ctx.lineWidth = d.style.lineWidth || 0; + ctx.lineCap = d.style.lineCap || 'butt'; + ctx.lineJoin = d.style.lineJoin || 'miter'; + ctx.miterLimit = d.style.miterLimit || 10; + ctx.strokeStyle = d.style.strokeStyle || 'black'; + ctx.fillStyle = d.style.fillStyle || 'black'; + if (d.style.lineDash) + ctx.setLineDash(d.style.lineDash); + else + ctx.setLineDash([]); + //Draw line + var x = self.x(d.data[self.xDimension]); + var y = self.y(d.data[self.yDimension]); + ctx.beginPath(); + ctx.arc(x,y,(d.style.r || 6),0,2*Math.PI); + ctx.fill(); + ctx.stroke(); + }); + + } + + //Get the index of the path at the given point + //using the colors on the index canvas + //returns -1 if there is no path, or the area around the point is too noisy + var getIndexAtPoint = function(x,y,canvas) { + //get the color data for a 3x3 pixel area around the point + var colorData = canvas.getContext('2d').getImageData(x-1,y-1,3,3).data; + //get the index for each pixel + var indices = []; + for (var i = 0; i < colorData.length/4; i++) { + indices.push(colorToIndex(colorData.slice(i*4,i*4+3))); + } + + //for a positive match, must find at least 5 pixels with the same index + indices.sort(); + var matched = -1; + var count = 0; + var counting = -1; + for (var i = 0; i < indices.length; i++) { + if (counting != indices[i]) { + count = 1; + counting = indices[i]; + } + else { + count++; + if (count == 5) { + matched = counting; + break; + } + } + } + + return matched; + } + + //convert an index value to a color + //Mapping -1 through 256^3 to rgb(0,0,0) through rgb(255,255,255) + var indexToColor = function(i) { + if (i > 256*256*256) { + return 'rgb(255,255,255)'; + } + i++; + var b = Math.floor(i/256/256); + var g = Math.floor((i - b*256*256) / 256); + var r = (i - b*256*256 - g*256); + return 'rgb('+r+','+g+','+b+')'; + } + + //convert a color to an index value + //Mapping [0,0,0] through [255,255,255] to -1 through 256^3 + var colorToIndex = function(rgb) { + return (rgb[0] + rgb[1]*256 + rgb[2]*256*256)-1; + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * SCATTER_PLOT_SVG + * + * The ScatterPlotSVG Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the ScatterplotSVG Component: + * A subclass of ScatterPlot which draws data using SVG + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the ScatterPlot Component be included + if (!CINEMA_COMPONENTS.SCATTER_PLOT_INCLUDED) + throw new Error("CINEMA_COMPONENTS ScatterPlotSVG Component requires that ScatterPlot"+ + " component be included. Please make sure that ScatterPlot component"+ + " is included BEFORE ScatterPlotSVG module"); + + /** @type {boolean} - Flag to indicate that the ScatterPlotSVG Component has been included */ + CINEMA_COMPONENTS.SCATTER_PLOT_SVG_INCLUDED = true; + + /** + * Constructor for ScatterPlotSVG Component + * Represents a component for displaying data on a 2D Scatter Plot + * Rendered with SVG + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.ScatterPlotSVG = function(parent, database, filterRegex) { + //call super-constructor + CINEMA_COMPONENTS.ScatterPlot.call(this,parent,database,filterRegex); + + //specify that this is a ScatterPlot SVG component. + d3.select(this.container).classed('SVG',true); + + //Add SVG Components to pointContainer + this.svg = this.pointContainer.append('svg') + .style('position','absolute') + .attr('viewBox','0 0 '+this.internalWidth+' '+this.internalHeight) + .attr('preserveAspectRatio','none') + .attr('width','100%') + .attr('height','100%'); + //Add group for selected points + this.selectedPoints = this.svg.append('g') + .classed('selectedPoints',true); + //Add group for highlighted points + this.highlightedPoints = this.svg.append('g') + .classed('highlightedPoints',true); + //Add group for overlay points + this.overlayPoints = this.svg.append('g') + .classed('overlayPoints',true); + + this.redrawPoints(); + } + //establish prototype chain + CINEMA_COMPONENTS.ScatterPlotSVG.prototype = Object.create(CINEMA_COMPONENTS.ScatterPlot.prototype); + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.constructor = CINEMA_COMPONENTS.ScatterPlotSVG; + + /************************** + * OVERRIDE METHODS + **************************/ + + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.updateSize = function() { + //call super + CINEMA_COMPONENTS.ScatterPlot.prototype.updateSize.call(this); + + //rescale svg + this.svg.attr('viewBox','0 0 '+this.internalWidth+' '+this.internalHeight); + } + + /** + * Redraw the current selection of points + */ + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.redrawSelectedPoints = function() { + var self = this; + var plottable = this.getPlottablePoints(this.selection); + //Update warningReadout + if (plottable.length < this.selection.length) + this.warningReadout.text((this.selection.length-plottable.length) + + " point(s) could not be plotted (because they contain NaN or undefined values)."); + else + this.warningReadout.text(''); + //Bind to selection and update + var update = this.selectedPoints + .selectAll('circle').data(plottable); + update.enter() //ENTER + .append('circle') + .attr('r','6') + .merge(update) //ENTER + UPDATE + .attr('index',function(d){return d;}) + .attr('cx',function(d) { + return self.x(self.db.data[d][self.xDimension]); + }) + .attr('cy',function(d) { + return self.y(self.db.data[d][self.yDimension]); + }) + .on('mouseenter',function(d) { + self.dispatch.call('mouseover',self,d,d3.event); + }) + .on('mouseleave',function(d) { + self.dispatch.call('mouseover',self,null,d3.event); + }); + update.exit() + .remove(); + } + + /** + * Redraw the set of highlighted points + */ + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.redrawHighlightedPoints = function() { + var self = this; + //Bind to selection and update + var update = this.highlightedPoints + .selectAll('circle').data(this.getPlottablePoints(this.highlighted)); + update.enter() //ENTER + .append('circle') + .attr('r','10') + .merge(update) //ENTER + UPDATE + .attr('index',function(d){return d;}) + .attr('cx',function(d) { + return self.x(self.db.data[d][self.xDimension]); + }) + .attr('cy',function(d) { + return self.y(self.db.data[d][self.yDimension]); + }); + update.exit() + .remove(); + } + + /** + * Redraw the overlay points + */ + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.redrawOverlayPoints = function() { + var self = this; + //Bind to selection and update + var update = this.overlayPoints + .selectAll('circle').data(this.overlayData); + update.enter() //ENTER + .append('circle') + .attr('r','5') + .merge(update) //ENTER + UPDATE + .attr('cx',function(d) { + return self.x(d.data[self.xDimension]); + }) + .attr('cy',function(d) { + return self.y(d.data[self.yDimension]); + }) + .attr('style',function(d) { + return d.style; + }); + update.exit() + .remove(); + } + +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * LineChart + * + * The LineChart Component for the CINEMA_COMPONENTS library. + * It is a sublcass of Component + * + * This component views multiple parameters as a line chart. + * + * @exports CINEMA_COMPONENTS + * + * @author Robin Maack + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS LineChart module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE LineChart module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS LineChart module requires that"+ + " d3 be included (at least d3v5). Please make sure that d3 is included BEFORE the"+ + " the Pcoord module"); + } + + /** @type {boolean} - Flag to indicate that the LineChart module has been included */ + CINEMA_COMPONENTS.LINECHART_INCLUDED = true; + + /** + * Abstract constructor for LineCart Components + * Represents a component for displaying and interacting with a database on a chart with multiple lines + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.LineChart = function(parent, database, filterRegex, image_measures, excluded_dimensions) { + var self = this; + + //call super-constructor + CINEMA_COMPONENTS.Component.call(this,parent,database,filterRegex); + + //Allowed prefixes for image measures, check for unused beforehand + if(typeof image_measures !== 'undefined') { + this.allowedUPrefixes = []; + const image_measuresLength = image_measures.length; + for (var i = 0; i < image_measuresLength; i++) { + for (var key in self.db.dimensionTypes) { + if(key.startsWith(image_measures[i])) { + this.allowedUPrefixes.push(image_measures[i]); + break; + } + } + } + } + + //Excluded dimensions for x-axis + this.excludedDim = excluded_dimensions; + + /*************************************** + * SIZING + ***************************************/ + + /** @type {CINEMA_COMPONENTS.Margin} Override default margin */ + this.margin = new CINEMA_COMPONENTS.Margin(20,30,50,170); + + /** @type {CINEMA_COMPONENTS.Margin} Margins of axis to the SVG plane */ + this.axismargin = new CINEMA_COMPONENTS.Margin(15,15,15,15); + + /*************************************** + * DATA + ***************************************/ + + /** @type {String} The currently selected dimensions for each axis*/ + this.xDimension = this.dimensions[0]; + + /** @type {Object} Currently selected data point*/ + this.currentlySelectedPoint = {}; + + /** @type {Object} Data to be shown by the plot*/ + this.plotData = {}; + + //Prepare the plot data + this.prepareData(); + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. + * 'selectionchanged': Triggered when the user makes a selection. + * (called with the index of mouse up data and a reference to the mouse event) + * 'xchanged': Triggered when the x dimension being viewed is changed + * (called with the new dimension as an argument) + */ + this.dispatch = d3.dispatch("selectionchanged", "xchanged"); + + /*************************************** + * DRAGGING + ***************************************/ + + /** @type {boolean} Is left mouse button pushed down*/ + this.dragging = false; + + /** @type {int} svg x position where mouse left mouse button was pushed down*/ + this.dragStartX = 0; + + /** @type {Object} Save selected data when mouse button was pushed down*/ + this.dragStartData = {}; + + /** @type {Object} Save start and end data if drag action */ + this.dragResult = {}; + + /*************************************** + * DOM Content + ***************************************/ + + /** Main Container **/ + + //Give plot container a class + d3.select(this.container).classed('LINE_CHART',true); + + //Add a div as main container to add other components later + this.mainContainer = d3.select(this.container).append('div') + .classed('mainContainer',true) + .style('position','absolute') + .style('top',this.margin.top+'px') + .style('right',this.margin.right+'px') + .style('bottom',this.margin.bottom+'px') + .style('left',this.margin.left+'px') + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px'); + + /** Dimension selection for x-axis **/ + + //Get all non image measure and non file dimensions + this.validDim = []; + for(var i=0, len=self.dimensions.length; i < len; i++) { + if(!(self.dimensions[i].startsWith("FILE") || + startsWithPrefixes(self.dimensions[i], this.allowedUPrefixes) || + startsWithPrefixes(self.dimensions[i], this.excludedDim))) { + self.validDim.push(self.dimensions[i]); + } + } + + //Add Dimension selection dropdown menu + this.xSelect = d3.select(this.container).append('select') + .classed('dimensionSelect x', true) + .style('position','absolute') + .node(); + + //Add all options to dropdown menu + d3.select(this.xSelect).selectAll('option') + .data(this.validDim) + .enter().append('option') + .attr('value',function(d){return d;}) + .text(function(d){return d;}); + d3.select(this.xSelect).node().value = this.xDimension; + + //Define actions when a new Dimension is selected + d3.select(this.xSelect).on('input',function() { + self.xDimension = this.value; + self.prepareData(); + self.x = (self.db.isStringDimension(self.xDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(self.plotData.dimensionDomain); + self.xAxisContainer.select('.axis') + .call(d3.axisBottom().scale(self.x)); + self.dispatch.call('xchanged',self,self.xDimension); + self.updateLineVisibility(); + self.redraw(); + }); + + /** Checkboxtable for selecting uncertainty measures **/ + + this.tableContainer = d3.select(this.container).append('div') + .classed('tableContainer',true) + .style('position','absolute') + .style('top', 20 + 'px') + .style('left', 5 + 'px') + .style('bottom',this.margin.bottom+'px') + .style('overflow-y', 'auto') + .style('overflow-x', 'hidden'); + + //Set the checkboxes for the whole group and update + this.updateLineGroupVisibility = function() { + d3.selectAll(".lineGroupSelectCheckbox").each(function(d) { + const cbgroup = d3.select(this); + d3.selectAll(".lineSelectCheckbox").each(function(d) { + const cb = d3.select(this); + if(cb.property("value").startsWith(cbgroup.property("value"))) + cb.property("checked", cbgroup.property("checked")); + }); + }); + self.updateLineVisibility(); + } + + //Function to toggle Checkboxes for uncertainty measures + this.updateLineVisibility = function() { + d3.selectAll(".lineSelectCheckbox").each(function(d) { + const cb = d3.select(this); + self.setLineVisibility(cb.property("value"), cb.property("checked")); + }); + self.redraw(); + } + + /** Measure group checkboxes **/ + + //Table containing the checkboxes + this.ySelectGroupTable = self.tableContainer + .append('table') + .classed("lineSelect yGroup", true); + + //Rows in the checkbox table + this.yTableGroupRows = this.ySelectGroupTable.selectAll('tr') + .classed("lineSelectRow y", true) + .data(this.allowedUPrefixes) + .enter().append('tr'); + + //Add checkboxes to the table + this.yTableGroupRows.selectAll('td') + .data((d) => [d]) + .enter() + .append('td') + .append("input") + .classed("lineGroupSelectCheckbox", true) + .attr("checked", true) + .attr("type", "checkbox") + .attr("id", function(d,i) { return 'a'+i; }) + .attr("value", (d) => d) + .on("change", self.updateLineGroupVisibility); + + //Add text next to the checkboxes + this.yTableGroupRows.selectAll("td") + .data((d) => [d]) + .append("text") + .classed("lineGroupSelect checkboxtext", true) + .text((d) => "All " + d); + + /** Measure checkboxes **/ + + //Table containing the checkboxes + this.ySelectTable = self.tableContainer + .append('table') + .classed("lineSelect y", true); + + //Rows in the checkbox table + this.yTableRows = this.ySelectTable.selectAll('tr') + .classed("lineSelectRow y", true) + .data(self.plotData.series) + .enter().append('tr'); + + //Add checkboxes to the table + this.yTableRows.selectAll('td') + .data((d) => [d]) + .enter() + .append('td') + .append("input") + .classed("lineSelectCheckbox", true) + .attr("checked", true) + .attr("type", "checkbox") + .attr("id", function(d,i) { return 'a'+i; }) + .attr("value", (d) => d.name) + .on("change", self.updateLineVisibility); + + //Add text next to the checkboxes + this.yTableRows.selectAll("td") + .data((d) => [d]) + .append("text") + .classed("lineSelect checkboxtext", true) + .text((d) => d.name); + + /** SVG plane **/ + + this.initChart = function() { + /** SVG plane creation **/ + + //Create svg plane + this.svg = this.mainContainer.append('svg') + .attr('class','lineChart') + .attr('viewBox','0 0 '+this.internalWidth+' '+this.internalHeight) + .attr('preserveAspectRatio','none') + .attr('width','100%') + .attr('height','100%'); + + //set svg position + this.svg.style("position", "relative"); + + //Add interaction to the svg plane + this.svg + .on('mousemove', function() { + self.moved(d3.event); + }) + .on('mouseenter', function() { + self.entered(d3.event); + }) + .on('mouseleave', function() { + self.left(d3.event); + }) + .on("mousedown", function() { + self.down(d3.event); + }) + .on("mouseup", function() { + self.up(d3.event); + }); + + /** + * Gets called when the mouse is moved inside the svg plane + * Highlights the selected path and changes the selected data point + * Updates the dragging square if currently dragging + * @type {Object} eventdata - Mouse event data + */ + this.moved = function(eventdata) { + var self = this; + if(this.getVisibileLineCount()) { + //Prevent selecting text + eventdata.preventDefault(); + + //Get currently selected data point + var currentDatapoint = this.getMousePositionData(eventdata); + + //If dragging update dragging square + if(this.dragging) { + //Startpoint is right of current position + if(self.dragStartX > eventdata.layerX){ + self.svg.select("rect") + .attr("x", eventdata.layerX) + .attr("width", self.dragStartX - eventdata.layerX); + } + //Startpoint is left of current position + else { + self.svg.select("rect") + .attr("width", eventdata.layerX - self.dragStartX); + } + } + + //Redraw paths and dot + this.path.selectAll("path").attr("stroke", d => d === currentDatapoint.series ? null : "#ddd").filter(d => d === currentDatapoint.series).raise(); + this.dot.attr("transform", `translate(${self.x(currentDatapoint.date)},${self.y(currentDatapoint.value)})`); + this.dot.select("#dot_name_text").attr("overflow", "visible").text(currentDatapoint.umeasurename); + this.dot.select("#dot_number_text").attr("overflow", "visible").text(currentDatapoint.value.toFixed(2)); + } + } + + /** + * Gets called when the mouse enters the svg plane + * Resets the paths and dot + * @type {Object} eventdata - Mouse event data + */ + this.entered = function() { + if(this.getVisibileLineCount()) { + this.path.selectAll("path").style("mix-blend-mode", null).attr("stroke", "#ddd"); + this.dot.attr("display", null); + } + } + + /** + * Gets called when the mouse leaves the svg plane + * Resets the paths and dot + * @type {Object} eventdata - Mouse event data + */ + this.left = function() { + var self = this; + + //Reset paths and dot + if(this.getVisibileLineCount()) { + this.path.selectAll("path").style("mix-blend-mode", "multiply").attr("stroke", null); + this.dot.attr("display", "none"); + } + //Prevent draging from continuing and show failure(red square) + if(self.dragging) { + self.dragging = false; + self.svg.selectAll("rect") + .transition() + .duration(100) + .attr("stroke-width", 10) + .attr("stroke", "red") + .delay(200) + .transition() + .duration(1000) + .attr("opacity", 0.0) + .remove(); + } + } + + /** + * Gets called when the mouse gets pushed down on the svg plane + * Saves the start position and data + * Creates the dragging rectange + * @type {Object} eventdata - Mouse event data + */ + this.down = function(eventdata) { + var self = this; + + if(eventdata.button === 0) { + //Prevent selecting text + eventdata.preventDefault(); + + //Set dragging values + self.dragging = true; + self.dragStartData = this.getMousePositionData(eventdata); + self.dragStartX = eventdata.layerX; + + //Create dragging rectange + var rect = this.svg.append("rect") + .attr("x", self.dragStartX) + .attr("y", 0) + .attr("width", 1) + .attr("height", self.svg.style("height")) + .attr("opacity", 0.5) + .attr("fill", "yellow"); + } + } + + /** + * Gets called when the mouse gets released on the svg plane + * Calculates the result of dragging(selected Data) + * Draws the "green rectange" and destroys it + * @type {Object} eventdata - Mouse event data + */ + this.up = function(eventdata) { + var self = this; + + if(eventdata.button === 0 && self.dragging) { + //Stop dragging + self.dragging = false; + + //Get data point ad end location + var dragEndData = this.getMousePositionData(eventdata); + + //Calculate the selected start and end date + self.dragResult = { + dimension : self.xDimension, + startDate: self.x(self.dragStartData.date) < self.x(dragEndData.date) ? self.dragStartData.date : dragEndData.date, + endDate: self.x(self.dragStartData.date) > self.x(dragEndData.date) ? self.dragStartData.date : dragEndData.date + } + + //Adjusted X and Y position of the rectange to include all selected data + var adjustedStartX = self.x(self.dragResult.startDate); + var adjustedEndX = self.x(self.dragResult.endDate); + + //Solve problem with 0 width rectange + if(adjustedStartX === adjustedEndX) { + adjustedStartX -= 1; + adjustedEndX += 1; + } + + //Draw animation and destroy + self.svg.selectAll("rect") + .transition() + .duration(500) + .attr("x", adjustedStartX) + .attr("width", adjustedEndX - adjustedStartX) + .delay(50) + .transition() + .duration(100) + .attr("stroke-width", 10) + .attr("stroke", "green") + .delay(200) + .transition() + .duration(1000) + .attr("opacity", 0.0) + .remove(); + + this.dispatch.call('selectionchanged',self, self.dragResult); + } + } + + /** Draw paths **/ + + //Line to draw on svg plane, mapping data and indexes to lines + this.chartline = d3.line() + .defined(d => !isNaN(d)) + .x((d, i) => this.x(this.plotData.dates[i])) + .y(d => this.y(d)); + + //Create all g elements for lines in the plot + this.path = this.svg.append("g") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("stroke-linejoin", "round") + .attr("stroke-linecap", "round") + + //Add all chartlines + this.path.selectAll("path") + .data(this.plotData.series.filter(entry => entry.show)) + .join("path") + .style("mix-blend-mode", "multiply") + .attr("d", d => self.chartline(d.values)); + + /** Add dot/circle to show current data point **/ + + //create Dot g element to show currently selected data + this.dot = this.svg.append("g") + .attr("display", "none"); + + //Add the circle + this.dot.append("circle") + .attr("r", 2.5); + + //Add text showing the uncertainty measure name + this.dot.append("text") + .attr("id", "dot_name_text") + .style("font", "10px sans-serif") + .attr("text-anchor", "middle") + .attr("y", -6); + + //Add text showing the current value of the uncertainty measure + this.dot.append("text") + .attr("id", "dot_number_text") + .style("font", "10px sans-serif") + .attr("text-anchor", "middle") + .attr("y", +10); + + return this.svg.node(); + } + + /*************************************** + * AXES + ***************************************/ + + /** @type {d3.scalePoint} - Scale for x axis on chart + * Maps dimension value to position (in pixels) along width of chart.*/ + this.x = (this.db.isStringDimension(this.xDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(self.plotData.dimensionDomain) + .range([this.axismargin.left,self.internalWidth - this.axismargin.right]); + + /** @type {d3.scalePoint} - Scale for x axis on chart + * Maps measure values to position (in pixels) along height of chart.*/ + this.y = d3.scaleLinear() + .domain([0, d3.max(this.plotData.series, d => d3.max(d.values))]).nice() + .range([self.internalHeight - this.axismargin.bottom,this.axismargin.top]); + + //Container for the x-axis + this.xAxisContainer = d3.select(this.container).append('svg') + .classed('axisContainer x',true) + .style('position','absolute') + .style('width',this.internalWidth+'px') + .style('height',25+'px') + .style('top',this.margin.top+this.internalHeight+'px') + .style('left',this.margin.left+'px'); + + //Container for the y-axis + this.yAxisContainer = d3.select(this.container).append('svg') + .classed('axisContainer y',true) + .style('position','absolute') + .style('width',50+'px') + .style('height',this.internalHeight+'px') + .style('left',(this.margin.left-50)+'px') + .style('top',this.margin.top+'px'); + + //Draw the x-axis + this.xAxisContainer.append('g') + .classed('axis',true) + .call(d3.axisBottom().scale(this.x)); + + //Draw the y-axis + this.yAxisContainer.append('g') + .classed('axis',true) + .attr('transform','translate(50)') + .call(d3.axisLeft().scale(this.y)); + + //Save the width of the axis line to adjust the graph later on + this.axislineWidth = parseInt(getComputedStyle( + document.querySelector('.CINEMA_COMPONENT.LINE_CHART .axis line')) + .getPropertyValue('stroke-width'), 10); + + //Set the position of both axis + this.xAxisContainer.style('top',this.margin.top+this.internalHeight+this.axislineWidth+'px'); + this.yAxisContainer.style('left', (this.margin.left - 50 - this.axislineWidth) +'px'); + + /** @type {d3.selection (svg)} The SVG element containing all the content of the svg plane */ + this.chart = this.initChart(); + + //Draw + this.redraw(); + } + //establish prototype chain + CINEMA_COMPONENTS.LineChart.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.LineChart.prototype.constructor = CINEMA_COMPONENTS.LineChart; + /** + * Should be called every time the size of the chart's container changes. + * Updates the sizing and scaling of all parts of the chart and redraws + */ + CINEMA_COMPONENTS.LineChart.prototype.updateSize = function() { + var self = this; + + //Call super (will recalculate size) + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + if(this.internalHeight > 100){ + //update mainContainer size + this.mainContainer + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px'); + + //update svg plane size + this.svg.attr('viewBox','0 0 '+this.internalWidth+' '+this.internalHeight); + + //Rescale + this.x.range([this.axismargin.left, this.internalWidth - this.axismargin.right]); + this.y.range([this.internalHeight - this.axismargin.bottom, this.axismargin.top]); + + //Update the x-axis + this.xAxisContainer + .style('width',this.internalWidth+'px') + .style('top',this.margin.top+this.internalHeight+this.axislineWidth+'px') + .select('.axis') + .call(d3.axisBottom().scale(this.x)); + + //Update the y-axis + this.yAxisContainer + .style('height',this.internalHeight+'px') + .select('.axis') + .call(d3.axisLeft().scale(this.y)); + + //Update the chart line drawing method + this.chartline + .x((d, i) => (this.plotData.isNonNumberDomain ? + self.x(this.plotData.dimensionDomain[i]) : + self.x(this.plotData.dates[i]))) + .y(d => this.y(d)) + + //Redraw all paths + this.path.selectAll("path") + .attr("d", d => self.chartline(d.values)); + } + }; + + /** + * Receive the closest data point to the current mouse location + * @type {Object} eventdata - Mouse event data + */ + CINEMA_COMPONENTS.LineChart.prototype.getMousePositionData = function(eventdata) { + var self = this; + + var scaleBandInvert = function(scale) { + var domain = self.x.domain(); + var paddingOuter = self.x(domain[0]); + var eachBand = self.x.step(); + return function (value) { + return Math.floor(((value - paddingOuter + (eachBand / 2)) / eachBand)); + //return domain[Math.max(0,Math.min(index, domain.length-1))]; + } + } + + //If any line is visible + if(this.getVisibileLineCount()) { + //Get the index of the closest x; + var ym = this.y.invert(eventdata.layerY); + var i; + + if(self.plotData.isNonNumberDomain) { + i = scaleBandInvert(self.x)(eventdata.layerX); + } + else { + var xm = this.x.invert(eventdata.layerX); + var i1 = d3.bisectLeft(this.plotData.dates, xm, 1); + var i0 = i1 - 1; + i = xm - self.plotData.dates[i0] > self.plotData.dates[i1] - xm ? i1 : i0; + } + + //Find closest point + var s = this.plotData.series.filter(entry => entry.show).reduce((a, b) => Math.abs(a.values[i] - ym) < Math.abs(b.values[i] - ym) ? a : b); + + //Save the selected point + this.currentlySelectedPoint = { + date: self.plotData.dates[i], + value: s.values[i], + umeasurename: s.name, + series: s + } + return this.currentlySelectedPoint; + } + } + + /** + * Redraw the chart path + */ + CINEMA_COMPONENTS.LineChart.prototype.redraw = function() { + var self = this; + + //Rescale x-axis + self.x + .domain(self.plotData.dimensionDomain) + .range([self.axismargin.left, self.internalWidth - self.axismargin.right]); + + //Rescale y-axis + self.y + .domain([ + d3.min(self.plotData.series.filter(entry => entry.show), d => d3.min(d.values)), + d3.max(self.plotData.series.filter(entry => entry.show), d => d3.max(d.values)) + ]).nice() + .range([self.internalHeight - self.axismargin.bottom, self.axismargin.top]); + + //Redraw x-axis + self.xAxisContainer + .select('.axis') + .call(d3.axisBottom().scale(self.x)); + + //Redraw y-axis + self.yAxisContainer + .select('.axis') + .call(d3.axisLeft().scale(self.y)); + + //Recalculate chartline method + self.chartline + .x((d, i) => (this.plotData.isNonNumberDomain ? + self.x(this.plotData.dimensionDomain[i]) : + self.x(this.plotData.dates[i]))) + .y(d => self.y(d)); + + //Enter Update Exit paths + var updatePaths = self.path.selectAll("path") + .data(this.plotData.series.filter(entry => entry.show)); + + updatePaths.enter() + .append('path') + .merge(updatePaths) + .join("path") + .style("mix-blend-mode", "multiply") + .attr("d", d => self.chartline(d.values)); + + updatePaths.exit() + .remove(); + }; + + /** + * Take the data from cinema DB and put it in a format readable for the plot + */ + CINEMA_COMPONENTS.LineChart.prototype.prepareData = function() { + var self = this; + + //Check if non number dimensions + var isNonNumberDomain = isNaN(this.db.dimensionDomains[this.xDimension][0]); + + //Retrieve all uncertainty dimensions + var uncertaintyDims = []; + for(var i=0, len=this.dimensions.length; i < len; i++) + if(startsWithPrefixes(self.dimensions[i], this.allowedUPrefixes) + && !startsWithPrefixes(self.dimensions[i], this.excludedDim)) + uncertaintyDims.push(this.dimensions[i]); + + //Retrieve all possible values of the current dimension + var dataDates = []; + if(isNonNumberDomain) { + dataDates = self.db.dimensionDomains[self.xDimension]; + } + else { + this.db.data.forEach(function(value) { + if(!containedInArray.call(dataDates, Number(value[self.xDimension]))) { + dataDates.push(Number(value[self.xDimension])); + } + }); + dataDates.sort(function(a, b){return a-b}); + } + + //Create data template + var dataSeries = []; + uncertaintyDims.forEach(function(value) { + dataSeries.push({ + name: value, + values : Array(dataDates.length).fill(0), + occurences : Array(dataDates.length).fill(0), + show : true + }); + }); + + //Fill with data values / Sum on same dimension value and count occurences + this.db.data.forEach(function(dataRow) { + var currentIndex = 0; + if(isNonNumberDomain) { + currentIndex = dataDates.indexOf(dataRow[self.xDimension]); + } + else { + currentIndex = dataDates.indexOf(Number(dataRow[self.xDimension])); + } + + dataSeries.forEach(function(dataSeriesObject) { + if(!isNaN(dataRow[dataSeriesObject.name])) { + dataSeriesObject.values[currentIndex] += parseFloat(dataRow[dataSeriesObject.name]); + dataSeriesObject.occurences[currentIndex] += 1; + } + }); + }); + + //Divide by occurences to retrieve the average + dataSeries.forEach(function(dataSeriesObject, indexObject) { + dataSeriesObject.values.forEach(function(dataValue, index) { + dataSeries[indexObject].values[index] = dataValue / dataSeriesObject.occurences[index]; + }); + }); + + //Add summed uncertainty measures for each dimension type => e.g. Total avg brightness uncertainty + this.allowedUPrefixes.forEach(function(uncertaintyDim, index) { + var averageUncertainty = Array(dataDates.length).fill(0); + var count = 0; + + //Sum and count + dataSeries.forEach(function(dataSeriesObject, indexObject) { + if(dataSeriesObject.name.startsWith(uncertaintyDim)) + { + dataSeriesObject.values.forEach(function(value, index) { + averageUncertainty[index] += value; + }); + count += 1; + } + }); + + //Calculate averages + if(count > 0) { + averageUncertainty.forEach(function(value, index) { + averageUncertainty[index] = value / count; + }); + + //Put into object + dataSeries.push({ + name: uncertaintyDim + " Uncertainty", + values : averageUncertainty, + occurences : count, + show : true + }); + } + }); + + //Combine the data + this.plotData = { + series: dataSeries, + dates: dataDates, + dimensionDomain : self.db.dimensionDomains[self.xDimension], + isNonNumberDomain : isNonNumberDomain + }; + }; + + /** + * Set the visibility of a line by using the uncertainty measure name + * @type {String} name - name of uncertainty measure + * @type {boolean} isShown - if the line shoudl be shown + */ + CINEMA_COMPONENTS.LineChart.prototype.setLineVisibility = function(name, isShown) { + var self = this; + for(var i = 0; i < this.plotData.series.length; i++) { + if(self.plotData.series[i].name === name) { + self.plotData.series[i].show = isShown; + break; + } + } + } + + /** + * Retrieve the amount of visible lines + */ + CINEMA_COMPONENTS.LineChart.prototype.getVisibileLineCount = function() { + return this.plotData.series.filter(entry => entry.show).length; + } + + /** + * Get the state of all checkboxes + */ + CINEMA_COMPONENTS.LineChart.prototype.getCheckboxStates = function() { + var lineGroupSelectData = []; + d3.selectAll(".lineGroupSelectCheckbox").each(function(d) { + const cb = d3.select(this); + lineGroupSelectData.push([cb.property("value"), cb.property("checked")]); + }); + var lineSelectData = []; + d3.selectAll(".lineSelectCheckbox").each(function(d) { + const cb = d3.select(this); + lineSelectData.push([cb.property("value"), cb.property("checked")]); + }); + + return {lineGroup: lineGroupSelectData, line: lineSelectData}; + } + + /** + * Set the state of all checkboxes + */ + CINEMA_COMPONENTS.LineChart.prototype.setCheckboxStates = function(dataObject) { + d3.selectAll(".lineSelectCheckbox").each(function(d) { + const cb = d3.select(this); + for(var i = 0; i < dataObject.line.length; i++) { + if(dataObject.line[i][0] === cb.property("value")) + cb.property("checked", dataObject.line[i][1]) ; + } + }); + var lineGroupSelectData = []; + d3.selectAll(".lineGroupSelectCheckbox").each(function(d) { + const cb = d3.select(this); + for(var i = 0; i < dataObject.lineGroup.length; i++) { + if(dataObject.lineGroup[i][0] === cb.property("value")) + cb.property("checked", dataObject.lineGroup[i][1]); + } + }); + this.updateLineVisibility(); + } + + /** + * Retrieve if a value is contained in an array + * @param {ANY} needle - Element to search for in Array + */ + var containedInArray = function(needle) { + //Per spec, the way to identify NaN is that it is not equal to itself + var findNaN = needle !== needle; + var indexOf; + + if(!findNaN && typeof Array.prototype.indexOf === 'function') { + indexOf = Array.prototype.indexOf; + } + else { + indexOf = function(needle) { + var i = -1, index = -1; + + for(i = 0; i < this.length; i++) { + var item = this[i]; + + if((findNaN && item !== item) || item === needle) { + index = i; + break; + } + } + + return index; + }; + } + + return indexOf.call(this, needle) > -1; + }; + + /** @type {RegExp} - Regular Expression to check for scientific notation*/ + const scientificNotationRegExp = new RegExp(/^((\d)+|(\d+\.\d+))(e|E)(\+|-)(\d)+$/); + + /** + * Check if numberString is in scientifc notation + * @param {String} numberString - String which might contain a scientific notation + */ + var isInScientificNotation = function(numberString) { + if(typeof numberString === 'string' || numberString instanceof String) + if(scientificNotationRegExp.test(numberString)) + return true; + return false; + } + + /** + * Checks if a dimension name starts with a string from the list + * @type {String} dimension - name of the dimension to check + * @type {Array} prefixList - list of prefixes + */ + var startsWithPrefixes = function(dimension, prefixList) { + if(typeof prefixList === 'undefined') + return false; + for(var i = 0; i < prefixList.length; i++) { + if(dimension.startsWith(prefixList[i])) + return true; + } + return false; + } + +})(); diff --git a/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.min.css b/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.min.css new file mode 100644 index 00000000..9491593d --- /dev/null +++ b/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.min.css @@ -0,0 +1,479 @@ +.CINEMA_COMPONENT.GLYPH .axes path { + stroke-opacity: 0.4; + stroke: black; +} + +.CINEMA_COMPONENT.GLYPH .axes text { + text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff; +} + +.CINEMA_COMPONENT.GLYPH .glyph { + fill: rgba(0, 0, 0, 0.034); + stroke: rgba(95, 153, 201, 0.747); + stroke-width: 5px; + stroke-linejoin: round; +}.CINEMA_COMPONENT.IMAGE_SPREAD .header { + background: #e2e2e2; + padding: 5px 20px; + border-bottom: 3px solid dimgray; + box-sizing: border-box; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .controlPanel { + margin: 0px 10px; + display: inline-table; + color: black; + font-size: 14px; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .controlPanel.imageSize { + float: right; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .dataDisplay { + display: inline-block; + margin: 5px; + padding: 2px; + border: 4px solid black; + background-color: lightgray; + box-shadow: 1px 1px 2px black; +} +.CINEMA_COMPONENT.IMAGE_SPREAD .dataDisplay:hover { + box-shadow: 2px 4px 8px black; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .fileDisplay { + display: inline-block; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .fileDisplay .display { + margin: 2px; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .fileDisplay .display.image { + border: 2px solid black; + line-height: 0; + cursor: pointer; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .fileDisplay .display.image:hover { + border: 2px solid rgb(23, 165, 221); + box-shadow: 1px 1px 2px black; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .fileDisplay .displayLabel { + font-size: 12px; + text-align: center; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .fileDisplay .display.text { + text-align: center; + padding: 5px; + font-size: 14px; + font-weight: bold; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .fileDisplay .display.image img { + line-height: 0; +} + +.modalBackground { + position: fixed; + z-index: 3; + padding-top: 100px; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgba(0,0,0,0.9); +} + +.modalImg { + margin: auto; + display: block; +} + +.modalViewer { + margin: auto; + width: 50%; + height: 80%; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .pageNavWrapper { + padding: initial; + z-index: 2; + position: fixed; + bottom: 30px; + left: 50%; + width: auto; + height: auto; + transform: translate(-50%,-50%); + border: 2px solid lightgray; + border-radius: 3px; + box-shadow: 3px 3px 10px dimgray; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .pageNav { + margin: initial; + padding: initial; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .pageButton { + cursor: pointer; + color: white; + font-size: 14px; + display: inline-flex; + background-color: rgba(25,25,25,0.85); + padding: 10px; +} +.CINEMA_COMPONENT.IMAGE_SPREAD .pageButton:hover { + background-color: rgba(50,50,50,0.85); +} +.CINEMA_COMPONENT.IMAGE_SPREAD .pageButton[mode='selected'], +.CINEMA_COMPONENT.IMAGE_SPREAD .pageButton[mode='selected']:hover { + color: white; + background-color: rgba(100,100,100,0.85); +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .pageReadout { + background-color: rgba(25,25,25,0.85); + color: white; + text-align: center; + font-size: 12px; + padding: 3px; +} + +.CINEMA_COMPONENT.IMAGE_SPREAD .noFileWarning { + padding: 10px; + width: 35%; + margin-left: auto; + margin-right: auto; + margin-top: 10px; + text-align: center; + background: rgb(201, 201, 201); + border: solid #333 5px; + border-radius: 10px; + box-shadow: 2px 2px 5px dimgray; + + color: black; + font-weight: bold; + font-size: 24px; + +} +.CINEMA_COMPONENT.LINE_CHART { + background: #e2e2e2; +} + +.CINEMA_COMPONENT.LINE_CHART .mainContainer { + background-color: white; + border: 2px solid black; + border-width: 2px 2px 0px 0px; +} + +.CINEMA_COMPONENT.LINE_CHART .dimensionSelect.x { + left: 50%; + transform: translateX(-50%); + bottom: 10px; +} + +.CINEMA_COMPONENT.LINE_CHART .tableContainer { + background-color: #eaeaea; + width: 135px; +} + +.CINEMA_COMPONENT.LINE_CHART .lineSelect.y td { + background-color: #eaeaea; + width: 135px; + white-space: nowrap; +} + +.CINEMA_COMPONENT.LINE_CHART .lineSelect.yGroup td { + background-color: #eaeaea; + width: 135px; + white-space: nowrap; +} + +.CINEMA_COMPONENT.LINE_CHART .lineSelect.checkboxtext{ + font-size: 10px; +} + +.CINEMA_COMPONENT.LINE_CHART .lineGroupSelect.checkboxtext{ + font-size: 10px; + font-weight: bold; +} + +.CINEMA_COMPONENT.LINE_CHART .lineChart { + font: 10px sans-serif; + background-color: whitesmoke; +} + +.CINEMA_COMPONENT.LINE_CHART .axisContainer { + pointer-events: none; + overflow: visible; +} + +.CINEMA_COMPONENT.LINE_CHART .axis line, +.CINEMA_COMPONENT.LINE_CHART .axis path { + fill: none; + stroke: black; + stroke-width: 2px; + shape-rendering: crispEdges; +} + +.CINEMA_COMPONENT.LINE_CHART .axis text { + fill: black; +} +CINEMA_COMPONENT.PCOORD.CANVAS .brush .extent { + fill-opacity: .3; + stroke: #fff; + shape-rendering: crispEdges; +} + +.CINEMA_COMPONENT.PCOORD.CANVAS .axis line, +.CINEMA_COMPONENT.PCOORD.CANVAS .axis path { + fill: none; + stroke: black; + shape-rendering: crispEdges; +} + +.CINEMA_COMPONENT.PCOORD.CANVAS .axisLabel rect { + fill: whitesmoke; +} + +.CINEMA_COMPONENT.PCOORD.CANVAS .axisLabel text { + fill: black; + cursor: move; +} + +.CINEMA_COMPONENT.PCOORD.CANVAS .axis path.NaNExtension, +.CINEMA_COMPONENT.PCOORD.CANVAS .axis .NaNExtensionTick line { + stroke: rgb(196, 23, 57); +} +.CINEMA_COMPONENT.PCOORD.CANVAS .axis .NaNExtensionTick text{ + fill: rgb(196, 23, 57); +} + +.CINEMA_COMPONENT.PCOORD.CANVAS .loadingIndicator { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%,-50%); + + color: white; + font-size: 12px; + background: rgba(0, 0, 0, 0.671); + border-radius: 5px; + padding: 5px; +}.CINEMA_COMPONENT.PCOORD.SVG { + font: 10px sans-serif; + background-color: whitesmoke; +} + +/*.CINEMA_COMPONENT.PCOORD.SVG .pathContainer, +.CINEMA_COMPONENT.PCOORD.SVG .pathContainer svg, +.CINEMA_COMPONENT.PCOORD.SVG .pathContainer svg .selectedPaths { + pointer-events: none; +}*/ + +.CINEMA_COMPONENT.PCOORD.SVG .selectedPaths path { + fill: none; + stroke-width: 2px; + stroke: lightgray; + stroke-opacity: 0.3; + vector-effect: non-scaling-stroke; +} + +.CINEMA_COMPONENT.PCOORD.SVG .highlightedPaths path { + pointer-events: none; + fill: none; + stroke-width: 4px; + stroke: lightskyblue; + stroke-opacity: 1; +} + +.CINEMA_COMPONENT.PCOORD.SVG .overlayPaths path { + fill: none; + pointer-events: none; + stroke-dasharray: 20, 10; + stroke: crimson; + stroke-width: 3px; + stroke-opacity: 1; +} + +.CINEMA_COMPONENT.PCOORD.SVG .brush .extent { + fill-opacity: .3; + stroke: #fff; + shape-rendering: crispEdges; +} + +.CINEMA_COMPONENT.PCOORD.SVG .axis line, +.CINEMA_COMPONENT.PCOORD.SVG .axis path { + fill: none; + stroke: black; + shape-rendering: crispEdges; +} + +.CINEMA_COMPONENT.PCOORD.SVG .axisLabel rect { + fill: whitesmoke; +} + +.CINEMA_COMPONENT.PCOORD.SVG .axisLabel text { + fill: black; + cursor: move; +} + +.CINEMA_COMPONENT.PCOORD.SVG .axis path.NaNExtension, +.CINEMA_COMPONENT.PCOORD.SVG .axis .NaNExtensionTick line { + stroke: rgb(196, 23, 57); +} +.CINEMA_COMPONENT.PCOORD.SVG .axis .NaNExtensionTick text{ + fill: rgb(196, 23, 57); +}.CINEMA_COMPONENT.QUERY { + font-size: 14px; + color: white; +} + +.CINEMA_COMPONENT.QUERY .thresholdInput { + width: 50px; +} + +.CINEMA_COMPONENT.QUERY .thresholdLabel, +.CINEMA_COMPONENT.QUERY .readout { + margin: 0px 10px; +} + +.CINEMA_COMPONENT.QUERY .inputRow { + height: 25px; + position: relative; + font-size: 14px; + margin: 5px; + border-bottom: 1px solid dimgray; +} +.CINEMA_COMPONENT.QUERY .inputRow .label { + text-align: center; + position: absolute; + top: 50%; + transform: translateY(-50%); +} +.CINEMA_COMPONENT.QUERY .inputRow input { + position: absolute; + top: 50%; + transform: translateY(-50%); +} +.CINEMA_COMPONENT.QUERY .inputRow input[type="range"] { + right: 10px; + width: 150px; +} +.CINEMA_COMPONENT.QUERY .inputRow input[type="checkbox"] { + right: 180px; + transform: translateY(-100%); +}.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .loadingIndicator { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%,-50%); + + color: white; + font-size: 12px; + background: rgba(0, 0, 0, 0.671); + border-radius: 5px; + padding: 5px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .pointContainer { + background: white; + border: 2px solid black; + border-width: 2px 2px 0px 0px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .dimensionSelect.x { + left: 50%; + transform: translateX(-50%); + bottom: 10px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .dimensionSelect.y { + top: 50%; + transform: translateY(-50%); + left: 10px; + max-width: 100px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .axisContainer { + pointer-events: none; + overflow: visible; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .axis line, +.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .axis path { + fill: none; + stroke: black; + stroke-width: 2px; + shape-rendering: crispEdges; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .axis text { + fill: black; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.CANVAS .warningReadout { + bottom: 10px; + right: 10px; + font-size: 12px; + color: darkred; +}.CINEMA_COMPONENT.SCATTER_PLOT.SVG .pointContainer { + background: white; + border: 2px solid black; + border-width: 2px 2px 0px 0px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.SVG .dimensionSelect.x { + left: 50%; + transform: translateX(-50%); + bottom: 10px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.SVG .dimensionSelect.y { + top: 50%; + transform: translateY(-50%); + left: 10px; + max-width: 100px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.SVG .axisContainer { + pointer-events: none; + overflow: visible; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.SVG .axis line, +.CINEMA_COMPONENT.SCATTER_PLOT.SVG .axis path { + fill: none; + stroke: black; + stroke-width: 2px; + shape-rendering: crispEdges; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.SVG .axis text { + fill: black; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.SVG .selectedPoints circle { + fill: rgba(82, 137, 163, 0.521); + stroke: rgb(69, 121, 153); + stroke-width: 2px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT.SVG .highlightedPoints circle { + pointer-events: none; + fill: rgb(252, 127, 127); + stroke: rgb(153, 80, 80); + stroke-width: 3px; +} + +.CINEMA_COMPONENT.SCATTER_PLOT .warningReadout { + bottom: 10px; + right: 10px; + font-size: 12px; + color: darkred; +} \ No newline at end of file diff --git a/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.min.js b/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.min.js new file mode 100644 index 00000000..7cc0f065 --- /dev/null +++ b/examples/WitU/cintools/cinema.source/components/2.7/CinemaComponents.v2.7.1.min.js @@ -0,0 +1,5055 @@ +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * DATABASE + * + * The Database module for the CINEMA_COMPONENTS library. + * Contains functions and objects for dealing with the purely data-related + * parts of a SpecD database. (Parsing, Querying, etc. data. No GUI stuff) + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + /** @type {boolean} - Flag to indicate that the Database module has been included */ + CINEMA_COMPONENTS.DATABASE_INCLUDED = true; + + /** + * Enum for the type of dimension (column) + * @enum {number} + */ + CINEMA_COMPONENTS.DIMENSION_TYPE = Object.freeze({ + INTEGER: 0, + FLOAT: 1, + STRING: 2 + }); + + /** + * Database + * Creates a new instance of Database which represents the data in a SpecD Database + * + * @constructor + * @param {string} directory - Path to the '.cdb' directory containing the database + * @param {function({Database} self)} callback - Function to call when loading has finished + * (only called if loading finished without errors) + * @param {function({string} message)} errorCallback - Function to call if errors were found with data + * @param {Object} filter - An object defining a filter to apply to the incoming data (so that + * only some of the data from the file is actually represented in the database). Keys in the + * filter object should match a numeric dimension and contain an array of two values representing + * the minimum and maximum values to allow. + */ + CINEMA_COMPONENTS.Database = function(directory, callback, errorCallback, filter) { + /** @type {string} - Path to the '.cdb' directory containing the database */ + this.directory = directory; + + /** @type {boolean} - Whether or not the database has finished loading */ + this.loaded = false; + + /** @type {string?} - The error message for errors found in the data. Undefined if no errors */ + this.error; + + /** @type {Object[]} - An array of the data rows */ + this.data = []; + /** @type {string[]} - An array of dimension names for the data (column headers) */ + this.dimensions = []; + /** @type {Object} - Contains the type for each dimension */ + this.dimensionTypes = {}; + /** @type {Object} - Contains the domains for each dimension (formatted like the domain for a d3 scale) */ + this.dimensionDomains = {}; + + /** @type {Object} - The filter applied to incoming data */ + this.filter = filter + + /** @type {boolean} Whether or not this database has additional axis ordering data */ + this.hasAxisOrdering = false; + /** @type {Object} Axis Ordering data (if it exists) */ + this.axisOrderData; + + this.dispatch = d3.dispatch("dataUpdated"); + + this.errorCallback = errorCallback; + + var self = this; + self.path = directory+'/data.csv'; + getAndParseCSV(self.path, function(data_arr, request) { + self.prevContentLength = request.getResponseHeader('Content-Length'); + + //Check for errors + self.error = checkErrors(data_arr); + if (self.error) { + console.warn(self.error); + if (errorCallback) + errorCallback(); + return; + } + + calcData(self, data_arr); + + //Attempt to load an axis_order.csv file + getAndParseCSV(directory+'/axis_order.csv', + //Normal callback, if axis_order.csv found + function(axis_data_arr) { + var error = checkAxisDataErrors(axis_data_arr,self.dimensions); + if (!error) { + self.hasAxisOrdering = true; + self.axisOrderData = parseAxisOrderData(axis_data_arr); + } + else + console.warn("ERROR in axis_order.csv: " + error); + self.loaded = true; + if (callback) + callback(self); + }, + //Error callback, if axis_order.csv request fails + function() { + self.loaded = true; + if (callback) + callback(self); + } + ); + //errorCallback. If data.csv request fails + }, function() { + if (errorCallback) + errorCallback("Error loading data.csv!"); + }); + }; + + /** + * Shortcut function to check if a given dimension is of type string or not + * @param {string} dimension - The dimension to check + */ + CINEMA_COMPONENTS.Database.prototype.isStringDimension = function(dimension) { + return this.dimensionTypes[dimension] === CINEMA_COMPONENTS.DIMENSION_TYPE.STRING; + }; + + /** + * Set the database's data and calculate dimension information based off the given + * array of data. Sets the 'data', 'dimensions', 'dimensionTypes' and 'dimensionDomains' + * fields in the given database. + * @param {object} self - The database object + * @param {string} data_arr - The array of data (we assume it has already been error-checked) + */ + var calcData = function(self, data_arr) { + //Get dimensions (First row of data) + self.dimensions = data_arr[0]; + + //Convert rows from arrays to objects + self.data = data_arr.slice(1).map(function(d) { + var obj = {}; + self.dimensions.forEach(function(p,i){obj[p] = d[i];}); + return obj; + }); + + //Keep track of data that gets caught in the filter while parsing + //to remove after all the parsing has been done + var filterdOut = [] + + //Determine dimension types and calculate domains + self.dimensions.forEach(function(d) { + //The value used to determine the dimension type + //is the first defined value in the column + var val = self.data[0][d]; + var i = 0; + while (val === undefined && i < self.data.length) + val = self.data[++i][d]; + + //Check if value is a float or integer + //The text "NaN" (not case sensitive) counts as a float + if (!isNaN(val) || val.toUpperCase() === "NAN") { + if (isNaN(val) || !Number.isInteger(val)) + self.dimensionTypes[d] = CINEMA_COMPONENTS.DIMENSION_TYPE.FLOAT; + else + self.dimensionTypes[d] = CINEMA_COMPONENTS.DIMENSION_TYPE.INTEGER; + //Check if this dimension is listed in the filter + var filter = self.filter ? self.filter[d] : null + if (filter && (!Array.isArray(filter) || filter.length != 2)) { + console.warn("Filter for dimension '"+d+"' must be an array of length two.") + filter = null + } + //calculate domain for numeric dimension + var i;//the first index to contain a value that is not "NaN" + for (i = 0; i < self.data.length && isNaN(self.data[i][d]); i++) {} + if (i == self.data.length) + //if all values are NaN, domain is [0,0] + self.dimensionDomains[d] = [0,0] + else { + var min = self.data[i][d]; + var max = self.data[i][d]; + //Calculated min and max cannot extend outside of min and max + //defined in filter + if (filter) { + min = Math.max(min,filter[0]) + max = Math.min(max,filter[1]) + } + for (var j = i; j < self.data.length; j++) { + if (!isNaN(self.data[j][d])) { + //Ignore data that lies outside the min and max defined in the filter + if (filter && + (self.data[j][d] < filter[0] || self.data[j][d] > filter[1]) + ) { + filterdOut[j] = true; + continue; + } + min = Math.min(min,self.data[j][d]); + max = Math.max(max,self.data[j][d]); + } + } + self.dimensionDomains[d] = [min,max]; + } + } + //Anything else is a string type + else { + self.dimensionTypes[d] = CINEMA_COMPONENTS.DIMENSION_TYPE.STRING; + self.dimensionDomains[d] = self.data.map(function(p){return p[d];}); + } + });//end dimensions.foreach() + + //Remove any data that was marked to be filtered out while parsing + self.data = self.data.filter(function(d,i){return !filterdOut[i]}); + }; + + /** + * Reloads the database's CSV file and refreshes the data if changes have been made. + * If changes are found, sends an event through the dataUpdated dispatcher. + * By default, this will only check that the size of the CSV has changed (i.e. rows have + * been added or removed). Use the reloadAllData parameter to force an update of all data. + */ + CINEMA_COMPONENTS.Database.prototype.refreshData = function(reloadAllData) { + var self = this; + + if (reloadAllData) { + // Check all data in the file + getAndParseCSV(self.path, + function(data_arr, request) { + dataUpdateCallback(self, data_arr, request); + }, + self.errorCallback); + } + else { + // Only check for file size changes + var xhReq = new XMLHttpRequest(); + xhReq.open("HEAD", self.path, true);//HEAD request returns only Http response header + xhReq.onreadystatechange = function() { + if (xhReq.readyState === 4) { + if (xhReq.status === 200 || + //Safari returns 0 on success (while other browsers use 0 for an error) + (navigator.userAgent.match(/Safari/) && xhReq.status === 0) + ) { + //If contentLength is different, request the full file + //and update + var contentLength = xhReq.getResponseHeader('Content-Length'); + if (contentLength != self.prevContentLength) { + getAndParseCSV(self.path, + function(data_arr, request) { + dataUpdateCallback(self, data_arr, request); + }, + self.errorCallback); + } + } + } + } + + xhReq.send(null); + } + } + + /** + * Callback when getAndParseCSV returns a data array to update the data in the database. + * @param {object} self - The database object + * @param {string} data_arr = The data from the file (not yet error checked) + * @param {XMLHttpRequest} request = The request where we can get the response header information + */ + var dataUpdateCallback = function(self, data_arr, request) { + //Ensure that the dimensions have not changed + if (data_arr[0].length != self.dimensions.length) { + console.warn("Updates to data cannot change the number of dimensions!") + return; + } + for (var i in self.dimensions) { + if (self.dimensions[i] != data_arr[0][i]) { + console.warn("Updates to data cannot change the names of dimensions!") + return; + } + } + + //If there are errors in the data, don't update + var error = checkErrors(data_arr); + if (error) { + console.warn("Error in updated data!\n"+error); + return; + } + + // Get new content length + self.prevContentLength = request.getResponseHeader('Content-Length'); + + //Convert rows from arrays to objects + var newData = data_arr.slice(1).map(function(d) { + var obj = {}; + self.dimensions.forEach(function(p,i){obj[p] = d[i];}); + return obj; + }); + + // Determine whether there has been a change in the data + var updated = false; + var updateInfo = { added: [], modified: [], removed: [], oldData: self.data, oldDimensionDomains: self.dimensionDomains }; + for (var f = 0; f < self.data.length || f < newData.length; f++) { + if (f >= self.data.length) { + updateInfo.added.push(f); + updated = true; + } + else if (f >= newData.length) { + updateInfo.removed.push(f); + updated = true; + } + else if (!(JSON.stringify(self.data[f]) === JSON.stringify(newData[f])) ) { + updateInfo.modified.push(f); + updated = true; + } + } + + // If the data is updated, reset the dimensions and call the dataUpdated dispather. + if (updated) { + self.data = newData; + self.dimensionDomains = {}; + calcData(self, data_arr); + + self.dispatch.call("dataUpdated",self, updateInfo); + } + } + + /** + * Get data rows (returned as an array of indices) that are similar to the given data. + * Difference between two data points is measured as the Manhattan distance where each dimension + * is normalized. i.e. The sum of the differencs on each dimension (each scaled from 0 to 1). + * On string dimensions, the distance is considered 0 if the strings are the same, otherwise 1 + * NaN values have 0 distance from each other, but 1 from anything else + * undefined values 0 distance from each other, but 1 from defined values + * @param {Object} query - An object representing the data to compare against + * (it does not necessarily have to be a data point already in the database) + * (dimensions in query can be undefined and will not add to distance) + * @param {number} threshold - The value that the difference must be below to be considerd "similiar" + */ + CINEMA_COMPONENTS.Database.prototype.getSimilar = function(query, threshold) { + var self = this; + var similar = []; + this.data.forEach(function(row,index) { + var dist = 0; //manhattan distance + self.dimensions.forEach(function(d) { + if (query[d] !== undefined) { + //On string dimensions, the distance is considered 0 if the strings are the same, otherwise 1 + if (self.isStringDimension(d)) + dist += (row[d] == query[d] ? 0 : 1); + //Compare number dimensions + else { + //NaN values have 0 distance from each other, but 1 from anything else + if (isNaN(query[d])) + dist += (isNaN(row[d]) ? 0 : 1); + //undefined values 0 distance from each other, but 1 from defined values + else if (row[d] === undefined) + dist += 1; + //calculate normalized distance + else { + var extent = self.dimensionDomains[d]; + dist += Math.abs( + getNormalizedValue(query[d],extent[0],extent[1]) + - + getNormalizedValue(row[d],extent[0],extent[1]) + ); + } + } + } + });//end self.dimensions.forEach() + if (dist <= threshold) { + similar.push(index); + } + });//end this.data.forEach() + return similar; + } + + /** + * Parse this database's axis data from the given array of data (from axis_order.csv) + */ + var parseAxisOrderData = function(data_arr) { + var data = {}; + + data_arr.slice(1).forEach(function(row) { + var category = row[0]; + if (!data[category]) + data[category] = []; + var value = row[1]; + data[category].push({name: value}); + var ordering = data_arr[0].slice(2).map(function(d,i) { + return [row[i+2],i]; + }).sort(function(a,b) { + if (a[0] === undefined) {return 1;} + if (b[0] === undefined) {return -1;} + return a[0]-b[0]; + }).map(function(d) {return data_arr[0].slice(2)[d[1]];}); + data[category][data[category].length-1].order = ordering; + }); + + return data; + } + + /** + * Fetch a CSV file and parse the data into a two-dimensional array. + * @param {String} path URL of CSV file + * @param {Function} callback Callback if succesful, provides the data array and a reference + * to the XMLHttpRequest that retrieved it + * @param {Function} errorCallback Called if an error occured with the request + */ + var getAndParseCSV = function(path,callback,errorCallback) { + var request = new XMLHttpRequest(); + request.open("GET",path,true); + request.onreadystatechange = function() { + if (request.readyState === 4) { + if (request.status === 200 || + //Safari returns 0 on success (while other browsers use 0 for an error) + (navigator.userAgent.match(/Safari/) && request.status === 0) + ) { + var data = parseCSV(request.responseText); + if (callback) + callback(data, request); + } + else if (errorCallback) { + errorCallback(); + } + } + } + request.send(null); + } + + /** + * Get a value from 0 to 1 reprsenting where val lies between min and max + */ + var getNormalizedValue = function(val, min, max) { + return (max-min == 0) ? 0 : ((val-min) / (max-min)); + } + + /** + * Parse the text of a csv file into a 2 dimensional array. + * Distinguishes between empty strings and undefined values + * + * Based on example code from Ben Nadel + * https://www.bennadel.com/blog/1504-ask-ben-parsing-csv-strings-with-javascript-exec-regular-expression-command.htm + */ + var parseCSV = function(csvText) { + // (delimiter) (quoted value) (value) + var csvRegex = /(\,|\r?\n|\r|^)(?:"([^"]*(?:""[^"]*)*)"|([^\,\r\n]*))/gi; + var data = []; + var matches; + //If text is empty, stop now. Otherwise will get caught in infinite loop + if (csvText === "") + return data; + while (matches = csvRegex.exec(csvText)) { + //Newline,beginning of string, or a comma + var delimiter = matches[1]; + //If the value is in quotes, it will be here (without the outside quotes) + var quotedValue = matches[2]; + //If the value wasn't in quotes, it will be here + var value = matches[3]; + + //If the deilimiter is not a comma (meaning its a new line), + //add a row to the data + if (delimiter != ',') + data.push([]); + //If a quoted value, escape any pairs of quotes and add to data + if (quotedValue !== undefined) + data[data.length-1].push(quotedValue.replace(/""/g,"\"")); + //If an unquoted value, escape any pairs of quotes add to data, or undefined if empty + else + data[data.length-1].push(value === "" ? undefined : value.replace(/""/g,"\"")); + } + //If the last line is a single, undefined value (caused by a stray newline at the end of the file), remove it. + if (data.length > 1 && data[data.length-1].length == 1 && data[data.length-1][0] === undefined) { + data = data.slice(0,data.length-1); + } + return data; + } + + /** + * Check for critical errors in the given data. + * Returns an error message if an error was found. + * Doesn't return anything if no errors were found. + */ + var checkErrors = function(data) { + //Check that there are at least two lines of data + if (data.length < 2) + return "The first and second lines in the file are required."; + + //Check that there at least two dimensions to the data + if (data[0].length < 2) + return "The dataset must include at least two dimensions"; + + //Check that there are no empty values in the first row + var emptyValFound = false; + for (var i in data[0]) + emptyValFound = emptyValFound || (data[0][i] === undefined); + if (emptyValFound) + return "Empty values may not occur in the header (first line)."; + + //Check that all rows of data have the same length + var testLength = data[0].length; + for (var i in data) + if (data[i].length != testLength) + return "Each line must have an equal number of comma separated values (columns)."; + + //Check that no colummns have all undefined values + for (var i = 0; i < data[0].length; i++) { + var allEmpty = true; + for (var j = 0; j < data.length; j++) + allEmpty = allEmpty && (data[j][i] === undefined); + if (allEmpty) + return "There cannot be any columns with all undefined values."; + } + } + + /** + * Check for critical errors in the given axis data + * Checks against the given list of dimensions + * Returns an error message if an error was found. + * Doesn't return anything if no errors were found + */ + var checkAxisDataErrors = function(data, dimensions) { + //Check that there are at least two lines of data + if (data.length < 2) + return "The first and second lines in the file are required."; + + //Check that all rows of data have the same length + var testLength = data[0].length; + for (var i in data) + if (data[i].length != testLength) + return "Each line must have an equal number of comma separated values (columns)."; + + /*//Check that there are dimensions+2 columns (+2 for category and value columns) + if (data[0].length !== dimensions.length+2) + return "All dimensions must be specified in the header of the file."*/ + + //Check that each dimension in the header is valid + for (var i = 2; i < data[0].length; i++) { + if (!dimensions.includes(data[0][i])) + return "Dimension in axis order file '"+data[0][i]+"' is not valid"; + } + + //Check that the first two columns contain to undefined values + for (var i = 0; i < data.length; i++) { + if (data[i][0] === undefined) + return "Category cannot be undefined." + if (data[i][1] === undefined) + return "Value cannot be undefined." + } + + //Check that all other data are numbers + for (var i = 1; i < data.length; i++) { + for (var j = 2; j < data[i].length; j++) { + if (isNaN(data[i][j]) && data[i][j] !== undefined) + return "Values for dimensions cannot be NaN." + } + } + } + +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * COMPONENT + * + * The Component module for the CINEMA_COMPONENTS library. + * Contiains the constructor for components (PcoordSVG,PcoordCanvas,Glyph, etc.) + * The object contains common methods and fields used by all components. + * + * Also contains definitions for a few classes that may be used by components. + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the database module be included + if (!CINEMA_COMPONENTS.DATABASE_INCLUDED) + throw new Error("CINEMA_COMPONENTS Component module requires that Database"+ + " module be included. Please make sure that Database module"+ + " is included BEFORE Component module"); + + /** @type {boolean} - Flag to indicate that the Component module has been included */ + CINEMA_COMPONENTS.COMPONENT_INCLUDED = true; + + /** + * Abstract constructor for Component. + * Represents a component for displaying and interacting with a database. + * Objects such as Pcoord and Glyph inherit from this + * @param {DOM} parent - The DOM object to build this component inside of (all children will be removed) + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.Component = function(parent, database, filterRegex) { + if (this.constructor === CINEMA_COMPONENTS.Component) + throw new Error("Cannot instantiate abstract class 'Component.'"+ + " Please use a subclass."); + + /** @type {DOM} The parent DOM object to build this component inside of */ + this.parent = parent; + + //Clear children + this.parent.innerHTML = ''; + + /** @type {CINEMA_COMPONENTS.Database} A reference to the database behind this component */ + this.db = database; + /** @type {string[]} The filtered list of dimensions that are shown on the component */ + this.dimensions = []; + + //NOTE that this.dimensions is filtered to have only the dimensions shown on the component + //while this.db.dimensions includes all dimensions in the database + + /** @type {RegExp} The regex used to filter out dimensions to not be shown on the component*/ + this.filter = filterRegex; + + //Get filtered Dimensions according to filterRegex + this.dimensions = this.db.dimensions.filter(function(d) { + return filterRegex ? !filterRegex.test(d) : true; + }); + + //Create DOM content + /** @type {DOM} The whole content of the component*/ + this.container = parent.appendChild(document.createElement('div')); + this.container.setAttribute('class','CINEMA_COMPONENT'); + this.container.style.position = 'absolute'; + + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + }; + + /** + * Resize this component to fit the size of its parent. + * This should be called every time the size of the component's + * parent changes. + */ + CINEMA_COMPONENTS.Component.prototype.updateSize = function(){ + this.margin = this.margin || new CINEMA_COMPONENTS.Margin(0,0,0,0); + this.parentRect = this.parent.getBoundingClientRect(); + this.internalWidth = this.parentRect.width - this.margin.left - this.margin.right; + this.internalHeight = this.parentRect.height - this.margin.top - this.margin.bottom; + + this.container.style.width = this.parentRect.width+'px'; + this.container.style.height = this.parentRect.height+'px'; + }; + + /** + * Remove this component from the scene + */ + CINEMA_COMPONENTS.Component.prototype.destroy = function() { + d3.select(this.container).remove(); + }; + + /** + * Constructor for Margin object + * Defines the top,right,bottom and left margins for drawing a component. + * @param {number} top - top margin (in pixels) + * @param {number} right - right margin (in pixels) + * @param {number} bottom - bottom margin (in pixels) + * @param {number} left - left margin (in pixels) + */ + CINEMA_COMPONENTS.Margin = function(top,right,bottom,left) { + this.top = top; + this.right = right; + this.bottom = bottom; + this.left = left; + } + + /** + * Constructor for ExtraData object + * Defines extra, custom data that may be shown on a component. + * @param {Object} data - The data to show + * (in the same format as the data points in the database) + * @param {any} style - Object representing how to draw the data. + * (the interpretation of this is up to specific components) + * (for example PcoordSVG expects a CSS string and + * PcoordCanvas expects an object with canvas context attributes) + */ + CINEMA_COMPONENTS.ExtraData = function(data, style) { + this.data = data; + this.style = style; + } +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * GLYPH + * + * The Glyph Component for the CINEMA_COMPONENTS library. + * Contains the constructor for a Glyph component. + * The Glyph component allows for viewing one data point at a time in a glyph chart + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS Glyph module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE Glyph module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS Glyph module requires that"+ + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the"+ + " the Glyph module"); + } + + /** @type {boolean} - Flag to indicate that the Glpyph module has been included */ + CINEMA_COMPONENTS.GLYPH_INCLUDED = true; + + //Constants + var RADTODEG = (180/Math.PI), + DEGTORAD = (Math.PI/180); + + CINEMA_COMPONENTS.Glyph = function(parent, database, filterRegex) { + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + /** @type {CINEMA_COMPONENTS.Margin} Override default margin */ + this.margin = new CINEMA_COMPONENTS.Margin(50,50,50,50); + /** @type {number} the space between the center and lowest data values on the chart */ + this.innerMargin; + /** @type {number} The radius of the glyph */ + this.radius; + + //call super-constructor + CINEMA_COMPONENTS.Component.call(this,parent,database,filterRegex); + //after size is calculate in the super-constructor, set radius and innerMargin + this.radius = Math.min(this.internalHeight,this.internalWidth)/2; + this.innerMargin = this.radius/11; + + /*************************************** + * DATA + ***************************************/ + + /** @type {number} The index of the selected data point */ + this.selected = 0; + + /*************************************** + * SCALES + ***************************************/ + + /** @type {d3.scalePoint} Rotation scale. Maps dimensions to a rotation in radians */ + this.rotation = d3.scalePoint() + .domain(this.dimensions) + .range([0,Math.PI*2-Math.PI*2/(this.dimensions.length+1)]); + + /** @type {Object(d3.scale)} Scales for each dimension + * Maps a value to a distance from the center + */ + this.scales = {}; + this.dimensions.forEach(function(d) { + //Create point scale for string dimensions + if (self.db.isStringDimension(d)) + self.scales[d] = d3.scalePoint() + .domain(self.db.dimensionDomains[d]) + .range([self.radius-self.innerMargin,0]); + //Create linear scale for numeric dimensions + else + self.scales[d] = d3.scaleLinear() + .domain(self.db.dimensionDomains[d]) + .range([self.radius-self.innerMargin,0]); + }); + + /*************************************** + * DOM Content + ***************************************/ + + //Create DOM content + //Specify that this is a Glyph component + d3.select(this.container).classed('GLYPH',true); + + /** @type {d3.selection (svg)} The SVG element containing all the content of the component */ + this.svg = d3.select(this.container).append('svg') + .attr('class','glyphChart') + .attr('viewBox',(-this.margin.right)+' '+(-this.margin.top)+' '+ + (this.parentRect.width)+' '+ + (this.parentRect.height)) + .attr('preserveAspectRatio','none') + .attr('width','100%') + .attr('height','100%'); + + /** @type {d3.selection (path)} The path representing the selected data */ + this.path = this.svg.append('path') + .classed('glyph',true); + + /** @type {d3.selection g} Labels for each dimension */ + this.labels = self.svg.append('g') + .classed('labels',true) + .selectAll('g.label') + .data(this.dimensions) + .enter().append('g') + .classed('label',true) + .attr('transform',function(d){return self.getAxisTransform(d);}); + //Add label text + this.labels.append('text') + .style('text-anchor','middle') + .text(function(d){return d;}) + .attr('transform',function(d) { + return "translate(0 -15) " + +"rotate("+self.getTextRotation(d)+")"; + }); + + + /*************************************** + * AXES + ***************************************/ + + /** @type {d3.selection (g)} The SVG group containing all the axes */ + this.axisContainer = this.svg.append('g') + .classed('axisContainer',true); + + /** @type {d3.selection (g)} Groups for each axis*/ + this.axes = this.axisContainer.selectAll('.axisGroup') + .data(this.dimensions) + .enter().append('g') + .classed('axisGroup',true) + .attr('transform',function(d){return self.getAxisTransform(d);}); + //Create d3 axes + this.axes.append('g') + .classed('axis',true) + .each(function(d) { + d3.select(this).call(d3.axisLeft().scale(self.scales[d])); + d3.select(this).selectAll('text') + .style('text-anchor','end') + .attr('transform',"rotate("+self.getTextRotation(d)+" -15 0)"); + }); + + this.redraw(); + } + //establish prototype chain + CINEMA_COMPONENTS.Glyph.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.Glyph.prototype.constructor = CINEMA_COMPONENTS.Glyph; + + /** + * Get the path (contents of the 'd' attribute) for the given data point + * @param {Object} p The data point + */ + CINEMA_COMPONENTS.Glyph.prototype.getPath = function(p) { + var self = this; + var path; + var startPoint; + this.dimensions.forEach(function(d,i) { + var point = self.getPoint(d,p); + if (i == 0) { + startPoint = point; + path = "M "+point.x+" "+point.y+" " + } + else if (i == self.dimensions.length-1) { + //loop back to the start point at the end to close the path + path += "L "+point.x+" "+point.y+" "+ + "L "+startPoint.x+" "+startPoint.y; + } + else { + path += "L "+point.x+" "+point.y+" "; + } + }); + return path; + } + + /** + * The x,y point on the chart where the given data point passes + * through the axis for the given dimension + * @param {string} d The dimension + * @param {Object} p The data point + */ + CINEMA_COMPONENTS.Glyph.prototype.getPoint = function(d,p) { + if (isNaN(p[d])) + //NaN values are placed in the center of the chart + return {x: this.radius, y: this.radius}; + var len = this.radius-this.scales[d](p[d]); + var rot = this.rotation(d)-Math.PI/2; + var x = Math.cos(rot)*len; + var y = Math.sin(rot)*len; + return {x: x+this.radius, y: y+this.radius}; + } + + /** + * Should be called every time the size of the chart's container changes. + * Updates the sizing and scaling of all parts of the chart and redraws + */ + CINEMA_COMPONENTS.Glyph.prototype.updateSize = function() { + var self = this; + + //Call super (will recalculate size) + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + //Update radius and innerMargin + this.radius = Math.min(this.internalHeight,this.internalWidth)/2; + this.innerMargin = this.radius/11; + + //Rescale SVG + this.svg.attr('viewBox',(-this.margin.right)+' '+(-this.margin.top)+' '+ + (this.parentRect.width)+' '+ + (this.parentRect.height)) + + //Rescale scales + this.dimensions.forEach(function (d) { + self.scales[d].range([self.radius-self.innerMargin,0]); + }); + + //Re-transform axes + this.axes.attr('transform',function(d){return self.getAxisTransform(d);}) + //Rebuild axes + .each(function(d) { + d3.select(this).select('.axis').call(d3.axisLeft().scale(self.scales[d])); + }); + + //Re-tranform labels + this.labels.attr('transform',function(d){return self.getAxisTransform(d);}); + + //Rebuild path + this.path.attr('d',function(d) {return self.getPath(self.db.data[d]);}); + }; + + /** + * Should be called whenever the data in the associated database changes. + * Will update scales, axes and selection to fit the new data. + */ + CINEMA_COMPONENTS.Glyph.prototype.updateData = function() { + var self = this; + + //Update scale domains + this.dimensions.forEach(function (d) { + self.scales[d].domain(self.db.dimensionDomains[d]); + }); + + //Rebuild axes + this.axes.each(function(d) { + d3.select(this).select('.axis').call(d3.axisLeft().scale(self.scales[d])); + }); + + this.redraw(); + } + + /** + * Set the selected data point to the one with the given index + */ + CINEMA_COMPONENTS.Glyph.prototype.setSelected = function(index) { + this.selected = index; + this.redraw(); + + }; + + /** + * Redraw the glyph path + */ + CINEMA_COMPONENTS.Glyph.prototype.redraw = function() { + var self = this; + this.path.datum(this.selected) + .transition(1000) + .attr('d',function(d){return self.getPath(self.db.data[d]);}); + } + + /** + * Get the transform attribute for an axis with the given dimension + * @param {string} d The dimension to transform to + */ + CINEMA_COMPONENTS.Glyph.prototype.getAxisTransform = function(d) { + var r = this.radius; + var rot = this.rotation(d)*RADTODEG; + return "translate("+r+") "+ + "rotate("+rot+" 0 "+r+")"; + }; + + /** + * Get the rotation (in degrees) for text on an axis with the given dimension + * so that the text will appear right-side-up + * @param {string} d The dimension to rotate for + */ + CINEMA_COMPONENTS.Glyph.prototype.getTextRotation = function(d) { + var rot = this.rotation(d)*(180/Math.PI); + return (rot > 90 && rot < 270) ? 180 : 0; + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * IMAGESPREAD + * + * The ImageSpread Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the ImageSpread Component + * Which displays image data for a set of rows in a database. + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if(window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if(!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS ImageSpread module requires that Component" + + " module be included. Please make sure that Component module" + + " is included BEFORE ImageSpread module"); + + //Require that d3 be included + if(!window.d3) { + throw new Error("CINEMA_COMPONENTS ImageSpread module requires that" + + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the" + + " the ImageSpread module"); + } + + /** @type {boolean} - Flag to indicate that the ImageSpread module has been included */ + CINEMA_COMPONENTS.IMAGE_SPREAD_INCLUDED = true; + + /** + * Checks if a dimension name starts with a string from the list + * @type {String} dimension - name of the dimension to check + * @type {Array} prefixList - list of prefixes + */ + var startsWithPrefixes = function(dimension, prefixList) { + if(typeof prefixList === 'undefined') + return false; + for(i = 0; i < prefixList.length; i++) { + if(dimension.startsWith(prefixList[i])) + return true; + } + return false; + } + + /** + * Constructor for ImageSpread Component + * Represents a component for viewing a spread of images from a selection of data + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * (Note that ImageSpread does not use a filterRegex) + */ + CINEMA_COMPONENTS.ImageSpread = function(parent, database, image_measures, excluded_dimensions) { + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + //Call super-constructor (will calculate size) + CINEMA_COMPONENTS.Component.call(this, parent, database); + + /*************************************** + * DATA + ***************************************/ + + //Allowed prefixes for image measures, check for unused beforehand + if(typeof image_measures !== 'undefined') { + this.allowedUPrefixes = []; + const image_measuresLength = image_measures.length; + for (var i = 0; i < image_measuresLength; i++) { + for (var key in self.db.dimensionTypes) { + if(key.startsWith(image_measures[i])) { + this.allowedUPrefixes.push(image_measures[i]); + break; + } + } + } + } + + //Excluded dimensions for x-axis + this.excludedDim = excluded_dimensions; + + //Get all non image measure and non file dimensions + this.validDim = []; + for(var i=0, len=self.dimensions.length; i < len; i++) { + if(!(self.dimensions[i].startsWith("FILE") || + startsWithPrefixes(self.dimensions[i], this.allowedUPrefixes) || + startsWithPrefixes(self.dimensions[i], this.excludedDim))) { + self.validDim.push(self.dimensions[i]); + } + } + + //override this.dimensions to include only FILE dimensions + this.dimensions = this.dimensions.filter(function(d) { + return (/^FILE/).test(d); + }); + /** @type {boolean} Whether any FILE dimensions exist in the dataset */ + this.hasFileDimensions = this.dimensions.length != 0; + + /** @type {number[]} Inidices of all the data points to display */ + this.selection = []; + + /** @type {number} The page number currently being viewed*/ + this.currentPage = 1; + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. Ex: this.dispatch.on('mouseover',handlerFunction(i)) + * 'mouseover': Triggered when a set of images is moused over + * (arguments are the index of moused over data and mouse event) + */ + this.dispatch = d3.dispatch('mouseover'); + + /*************************************** + * DOM Content + ***************************************/ + + //Specify that this is an ImageSpread component + d3.select(this.container).classed('IMAGE_SPREAD', true); + + //If there are no file dimensions, place a warning and stop here + if(!this.hasFileDimensions) { + this.noFileWarning = d3.select(this.container).append('div') + .classed('noFileWarning', true) + .text("No file information to display"); + return; + } + + //NOTHING IN THE CONSTRUCTOR AFTER THIS POINT WILL BE EXECUTED + //IF THERE ARE NO FILE DIMENSIONS + + /** @type {d3.selection} The header/control panel */ + this.header = d3.select(this.container).append('div') + .classed('header', true) + .style('position', 'absolute') + .style('width', '100%'); + + /** @type {d3.selection} The container for all the images */ + this.imageContainer = d3.select(this.container).append('div') + .classed('imageContainer', true) + .style('position', 'absolute') + .style('width', '100%') + .style('overflow-y', 'auto'); + + /*************************************** + * HEADER/CONTROLS + ***************************************/ + + //pageSize controls + /** @type {d3.selection} The control panel for pageSize */ + this.pageSizeContainer = this.header.append('div') + .classed('controlPanel pageSize', true); + this.pageSizeContainer.append('span') + .classed('label', true) + .text("Results Per Page:"); + this.pageSizeContainer.append('br'); + /** @type {DOM (select)} The select node controlling page size */ + this.pageSizeNode = this.pageSizeContainer.append('select') + .on('change', function() { + self.updatePageNav(); + self.populateResults(); + }) + .node(); + //append options + d3.select(this.pageSizeNode).selectAll('option') + .data([10, 25, 50, 100]) + .enter().append('option') + .attr('value', function(d) { + return d; + }) + .text(function(d) { + return d; + }); + //Select 25 as default option + d3.select(this.pageSizeNode).select('option[value="25"]') + .attr('selected', 'true'); + + //sort controls + /** @type {d3.selection} The control panel for choosing sort dimension */ + this.sortContainer = this.header.append('div') + .classed('controlPanel sort', true); + this.sortContainer.append('span') + .classed('label', true) + .text("Sort By:"); + this.sortContainer.append('br'); + /** @type {DOM (select)} The select node controlling sort dimension */ + this.sortNode = this.sortContainer.append('select') + .on('change', function() { + self.selection.sort(self.getSortComparator()); + self.populateResults(); + }) + .node(); + //append options + d3.select(this.sortNode).selectAll('option') + .data(this.db.dimensions.filter(function(d) { + return !self.db.isStringDimension(d); + })) + .enter().append('option') + .attr('value', function(d) { + return d; + }) + .text(function(d) { + return d; + }); + + //sortOrder controls + /** @type {d3.selection} The control panel for toggling sort order */ + this.sortOrderContainer = this.header.append('div') + .classed('controlPanel sortOrder', true); + this.sortOrderContainer.append('span') + .classed('label', true) + .text("Reverse Sort Order:"); + this.sortOrderContainer.append('br'); + /** @type {DOM (input/checkbox)} The node for toggling sort order */ + this.sortOrderNode = this.sortOrderContainer.append('input') + .attr("type", "checkbox") + .on('change', function() { + self.selection.sort(self.getSortComparator()); + self.populateResults(); + }) + .node(); + + //grouping controls + /** @type {d3.selection} The control panel for toggling sort order */ + this.groupsortingContainer = this.header.append('div') + .classed('controlPanel groupingOption', true); + this.groupsortingContainer.append('span') + .classed('label', true) + .text("Group equal values:"); + this.groupsortingContainer.append('br'); + /** @type {DOM (input/checkbox)} The node for toggling grouping order */ + this.groupsortingNode = this.groupsortingContainer.append('input') + .attr('type', 'checkbox') + .on('change', function() { + self.selection.sort(self.getSortComparator()); + self.populateResults(); + }) + .node(); + + //imageSize controls + /** @type {d3.selection} The control panel for controlling image size */ + this.imageSizeContainer = this.header.append('div') + .classed('controlPanel imageSize', true); + this.imageSizeContainer.append('span') + .classed('label', true) + .text("Image Size: 150px"); + this.imageSizeContainer.append('br'); + /** @type {DOM (input/range)} The node for adjusting imageSize */ + this.imageSizeNode = this.imageSizeContainer.append('input') + .attr('type', 'range') + .attr('min', '100') + .attr('max', '500') + .on('input', function() { + d3.select(self.container).selectAll('.display') + .style('width', this.value + 'px'); + d3.select(self.container).select('.controlPanel.imageSize .label') + .text("Image Size: " + this.value + "px"); + }) + .node(); + this.imageSizeNode.value = 150; + + //Update size + this.updateSize(); + } + //establish prototype chain + CINEMA_COMPONENTS.ImageSpread.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.ImageSpread.prototype.constructor = CINEMA_COMPONENTS.ImageSpread; + + /** + * Should be called every time the size of the component's container changes. + * Updates the sizing of the imageSpread container + */ + CINEMA_COMPONENTS.ImageSpread.prototype.updateSize = function() { + //Call super + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + if(this.hasFileDimensions) { + var headerSize = this.header.node().getBoundingClientRect().height; + this.imageContainer + .style('top', headerSize + 'px') + .style('height', (this.parentRect.height - headerSize) + 'px'); + } + }; + + /** + * Set the data to be shown to the data represented with the given array of indices + */ + CINEMA_COMPONENTS.ImageSpread.prototype.setSelection = function(indices) { + this.selection = indices; + this.selection.sort(this.getSortComparator()); + this.updatePageNav(); + this.populateResults(); + } + + /** + * Get a comparator function for sorting the selection + * according to selected sort dimension and the sortOrder checkbox + */ + CINEMA_COMPONENTS.ImageSpread.prototype.getSortComparator = function() { + var self = this; + var d = this.sortNode.value; + var checkedMultiplier = 1; + + if(this.sortOrderNode.checked) + checkedMultiplier = -1; + + //Group images with equal values, not looking at the sort dimension + //Then sort groups by the sorting dimension + if(this.groupsortingNode.checked) { + return function(a, b) { + if(self.db.data[a][d] === undefined) + return -1 * checkedMultiplier; + + if(self.db.data[b][d] === undefined) + return 1 * checkedMultiplier; + + if(isNaN(self.db.data[a][d])) + return -1 * checkedMultiplier; + + if(isNaN(self.db.data[b][d])) + return 1 * checkedMultiplier; + + //Get all vlid dimensions but the sorting dimension + const nonSortDimensions = self.validDim.filter(function(value) { + return value != d; + }); + //Grouping + for(var i = 0; i < nonSortDimensions.length; i += 1) { + if(self.db.data[a][nonSortDimensions[i]] == self.db.data[b][nonSortDimensions[i]]) { + continue; + } + else { + return (self.db.data[a][nonSortDimensions[i]] - self.db.data[b][nonSortDimensions[i]]) * checkedMultiplier; + } + } + //Equal non sorting dimensions, sort by sorting dimension + return (self.db.data[a][d] - self.db.data[b][d]) * checkedMultiplier; + } + } + //Only sort by sorting dimension + else { + return function(a, b) { + if(self.db.data[a][d] === undefined) + return -1 * checkedMultiplier; + + if(self.db.data[b][d] === undefined) + return 1 * checkedMultiplier; + + if(isNaN(self.db.data[a][d])) + return -1 * checkedMultiplier; + + if(isNaN(self.db.data[b][d])) + return 1 * checkedMultiplier; + + return (self.db.data[a][d] - self.db.data[b][d]) * checkedMultiplier; + } + } + } + + /** + * Fill the imageContainer with dataDisplays for the current page of results + */ + CINEMA_COMPONENTS.ImageSpread.prototype.populateResults = function() { + var self = this; + if(this.hasFileDimensions) { + var pageSize = this.pageSizeNode.value; + var pageData = this.selection.slice((this.currentPage - 1) * pageSize, + Math.min(this.currentPage * pageSize, this.selection.length)); + //Bind pageData and update dataDisplays + var displays = this.imageContainer.selectAll('.dataDisplay') + .data(pageData); + displays.exit().remove(); //remove unused dataDisplays + displays.enter() //add new dataDisplays + .append('div').classed('dataDisplay', true) + .merge(displays) //update + //Set up mouse events + .on('mouseenter', function(d) { + self.dispatch.call('mouseover', self, d, d3.event); + }) + .on('mouseleave', function(d) { + self.dispatch.call('mouseover', self, null, d3.event); + }) + //For each data display, create file displays for every file in it + .each(function(d) { + var files = self.dimensions.map(function(dimension) { + return self.db.data[d][dimension]; + }); + //bind files data + var fileDisplays = d3.select(this).selectAll('.fileDisplay') + .data(files); + fileDisplays.exit().remove(); + var ENTER = fileDisplays.enter().append('div') + .classed('fileDisplay', true); + ENTER.append('div').classed('display', true) + .style('width', self.imageSizeNode.value + 'px'); + ENTER.append('div').classed('displayLabel', true); + var UPDATE = ENTER.merge(fileDisplays) + //Create content of each file display + .each(function(f, i) { + d3.select(this).select('.display').html(''); + //Create an image in the display if the it is an image filetype + var ext = getFileExtension(f); + if(isValidFiletype(ext)) { + if(ext.toUpperCase() === 'VTI') { + d3.select(this).select('.display') + .classed('image', true) + .classed('text', false).append('img') + .attr('src', 'https://kitware.github.io/vtk-js/logo.svg') + .attr('width', '100%') + .on('click', function() {self.createModalVTI(self.db.directory + '/' + f);}); + } else if(ext.toUpperCase() === 'PDB') { + d3.select(this).select('.display') + .classed('image', true) + .classed('text', false).append('img') + .attr('src', 'https://kitware.github.io/vtk-js/logo.svg') + .attr('width', '100%') + .on('click', function() {self.createModalPDB(self.db.directory + '/' + f);}); + } else { + d3.select(this).select('.display') + .classed('image', true) + .classed('text', false) + .append('img') + .attr('src', self.db.directory + '/' + f) + .attr('width', '100%') + .on('click', self.createModalImg); + } + } + //Otherwise create an error message + else + d3.select(this).select('.display') + .classed('text', true) + .classed('image', false) + .append('div') + .attr('class', 'resultErrorText') + .text('Cannot display file: ' + f); + //Update label + d3.select(this).select('.displayLabel') + .text(self.dimensions[i]); + }); + }); + } + }; + + /** + * An event handler for an image that will create a modal overlay + * of the image when clicked + */ + CINEMA_COMPONENTS.ImageSpread.prototype.createModalImg = function() { + d3.select('body').append('div') + .attr('class', 'modalBackground') + .on('click', function() { + //clicking the modal removes it + d3.select(this).remove(); + }) + .append('img') + .attr('class', 'modalImg') + .attr('src', d3.select(this).attr('src')); + } + + /** + * An event handler for an image that will create a modal overlay + * of the image when clicked + */ + CINEMA_COMPONENTS.ImageSpread.prototype.createModalVTI = function(url) { + const rootContainer = d3.select('body'); + const backgroundContainer = d3.select('body').append('div'); + backgroundContainer.attr('class', 'modalBackground') + .on('click', function() { + //clicking the modal removes it + if(d3.event.target.tagName === 'IMG') { + d3.select(this).remove(); + } + }); + const container = backgroundContainer.append('div'); + container.attr('class', 'modalViewer').on('click', function() { + //clicking the modal removes it + //d3.select(this).remove(); + //d3.event.stopPropagation(); + }); + + var global = {}; + // ---------------------------------------------------------------------------- + // Standard rendering code setup + // ---------------------------------------------------------------------------- + + //const rootContainer = document.querySelector('body'); + const background = [0, 0, 0]; + const fullScreenRenderer = vtk.Rendering.Misc.vtkFullScreenRenderWindow.newInstance({ + background: background, + rootContainer: rootContainer.node(), + //containerStyle: { height: '100%' }, + container: container.node() + }); + const renderer = fullScreenRenderer.getRenderer(); + const renderWindow = fullScreenRenderer.getRenderWindow(); + + // ---------------------------------------------------------------------------- + // Example code + // ---------------------------------------------------------------------------- + + const reader = vtk.IO.Misc.vtkPDBReader.newInstance(); + const filter = vtk.Filters.General.vtkMoleculeToRepresentation.newInstance(); + const sphereMapper = vtk.Rendering.Core.vtkSphereMapper.newInstance(); + const stickMapper = vtk.Rendering.Core.vtkStickMapper.newInstance(); + const sphereActor = vtk.Rendering.Core.vtkActor.newInstance(); + const stickActor = vtk.Rendering.Core.vtkActor.newInstance(); + + const vtiReader = vtk.IO.XML.vtkXMLImageDataReader.newInstance(); + //vtiReader.parseAsArrayBuffer(fileContents); + + + filter.setInputConnection(reader.getOutputPort()); + //filter.setInputConnection(vtiReader.getOutputPort()); + filter.setHideElements(['H']); + + // render sphere + sphereMapper.setInputConnection(filter.getOutputPort(0)); + sphereMapper.setScaleArray(filter.getSphereScaleArrayName()); + sphereActor.setMapper(sphereMapper); + + // render sticks + stickMapper.setInputConnection(filter.getOutputPort(1)); + stickMapper.setScaleArray('stickScales'); + stickMapper.setOrientationArray('orientation'); + stickActor.setMapper(stickMapper); + + vtk.IO.Core.DataAccessHelper.get().fetchBinary(url, { + function(pe) { + console.log(pe); + }, + }).then((binary) => { + vtiReader.parseAsArrayBuffer(binary); + const source = vtiReader.getOutputData(0); + const mapper = vtk.Rendering.Core.vtkVolumeMapper.newInstance(); + const actor = vtk.Rendering.Core.vtkVolume.newInstance(); + + const dataArray = + source.getPointData().getScalars() || source.getPointData().getArrays()[0]; + const dataRange = dataArray.getRange(); + + const lookupTable = vtk.Rendering.Core.vtkColorTransferFunction.newInstance(); + const piecewiseFunction = vtk.Common.DataModel.vtkPiecewiseFunction.newInstance(); + + // Pipeline handling + actor.setMapper(mapper); + mapper.setInputData(source); + renderer.addActor(actor); + + // Configuration + const sampleDistance = + 0.7 * + Math.sqrt( + source + .getSpacing() + .map((v) => v * v) + .reduce((a, b) => a + b, 0) + ); + mapper.setSampleDistance(sampleDistance); + actor.getProperty().setRGBTransferFunction(0, lookupTable); + actor.getProperty().setScalarOpacity(0, piecewiseFunction); + // actor.getProperty().setInterpolationTypeToFastLinear(); + actor.getProperty().setInterpolationTypeToLinear(); + + // For better looking volume rendering + // - distance in world coordinates a scalar opacity of 1.0 + actor + .getProperty() + .setScalarOpacityUnitDistance( + 0, + vtk.Common.DataModel.vtkBoundingBox.getDiagonalLength(source.getBounds()) / + Math.max(...source.getDimensions()) + ); + // - control how we emphasize surface boundaries + // => max should be around the average gradient magnitude for the + // volume or maybe average plus one std dev of the gradient magnitude + // (adjusted for spacing, this is a world coordinate gradient, not a + // pixel gradient) + // => max hack: (dataRange[1] - dataRange[0]) * 0.05 + actor.getProperty().setGradientOpacityMinimumValue(0, 0); + actor + .getProperty() + .setGradientOpacityMaximumValue(0, (dataRange[1] - dataRange[0]) * 0.05); + // - Use shading based on gradient + actor.getProperty().setShade(true); + actor.getProperty().setUseGradientOpacity(0, true); + // - generic good default + actor.getProperty().setGradientOpacityMinimumOpacity(0, 0.0); + actor.getProperty().setGradientOpacityMaximumOpacity(0, 1.0); + actor.getProperty().setAmbient(0.2); + actor.getProperty().setDiffuse(0.7); + actor.getProperty().setSpecular(0.3); + actor.getProperty().setSpecularPower(8.0); + + // Control UI + const controllerWidget = vtk.Interaction.UI.vtkVolumeController.newInstance({ + size: [400, 150], + rescaleColorMap: true, + }); + const isBackgroundDark = background[0] + background[1] + background[2] < 1.5; + controllerWidget.setContainer(container.node()); + controllerWidget.setupContent(renderWindow, actor, isBackgroundDark); + fullScreenRenderer.setResizeCallback(({ + width, + height + }) => { + // 2px padding + 2x1px boder + 5px edge = 14 + if(width > 414) { + controllerWidget.setSize(400, 150); + } else { + controllerWidget.setSize(width - 14, 150); + } + controllerWidget.render(); + //fpsMonitor.update(); + }); + + // First render + renderer.resetCamera(); + renderWindow.render(); + + global.pipeline = { + actor, + renderer, + renderWindow, + lookupTable, + mapper, + source, + piecewiseFunction, + fullScreenRenderer, + }; + }); + } + /* .append('img') + .attr('class', 'modalImg') + .attr('src',d3.select(this).attr('src'));*/ + + + /** + * An event handler for an image that will create a modal overlay + * of the image when clicked + */ + CINEMA_COMPONENTS.ImageSpread.prototype.createModalPDB = function(url) { + const rootContainer = d3.select('body'); + const backgroundContainer = d3.select('body').append('div'); + backgroundContainer.attr('class', 'modalBackground') + .on('click', function() { + //clicking the modal removes it + if(d3.event.target.tagName === 'IMG') { + d3.select(this).remove(); + } + }); + const container = backgroundContainer.append('div'); + container.attr('class', 'modalViewer').on('click', function() { + //clicking the modal removes it + //d3.select(this).remove(); + //d3.event.stopPropagation(); + }); + + var global = {}; + // ---------------------------------------------------------------------------- + // Standard rendering code setup + // ---------------------------------------------------------------------------- + + //const rootContainer = document.querySelector('body'); + const background = [0, 0, 0]; + const fullScreenRenderer = vtk.Rendering.Misc.vtkFullScreenRenderWindow.newInstance({ + background: background, + rootContainer: rootContainer.node(), + //containerStyle: { height: '100%' }, + container: container.node() + }); + const renderer = fullScreenRenderer.getRenderer(); + const renderWindow = fullScreenRenderer.getRenderWindow(); + // ---------------------------------------------------------------------------- + // Example code + // ---------------------------------------------------------------------------- + + const reader = vtk.IO.Misc.vtkPDBReader.newInstance(); + const filter = vtk.Filters.General.vtkMoleculeToRepresentation.newInstance(); + const sphereMapper = vtk.Rendering.Core.vtkSphereMapper.newInstance(); + const stickMapper = vtk.Rendering.Core.vtkStickMapper.newInstance(); + const sphereActor = vtk.Rendering.Core.vtkActor.newInstance(); + const stickActor = vtk.Rendering.Core.vtkActor.newInstance(); + + + + + filter.setInputConnection(reader.getOutputPort()); + filter.setHideElements(['H']); + + // render sphere + sphereMapper.setInputConnection(filter.getOutputPort(0)); + sphereMapper.setScaleArray(filter.getSphereScaleArrayName()); + sphereActor.setMapper(sphereMapper); + + // render sticks + stickMapper.setInputConnection(filter.getOutputPort(1)); + stickMapper.setScaleArray('stickScales'); + stickMapper.setOrientationArray('orientation'); + stickActor.setMapper(stickMapper); + + // reader.setUrl(`${__BASE_PATH__}/data/molecule/pdb/caffeine.pdb`).then(() => { + reader.setUrl(url).then(() => { + renderer.resetCamera(); + renderWindow.render(); + }); + + renderer.addActor(sphereActor); + renderer.addActor(stickActor); + renderer.resetCamera(); + renderWindow.render(); + + // ----------------------------------------------------------- + // Make some variables global so that you can inspect and + // modify objects in your browser's developer console: + // ----------------------------------------------------------- + + global.reader = reader; + global.filter = filter; + global.sphereMapper = sphereMapper; + global.stickMapper = stickMapper; + global.sphereActor = sphereActor; + global.stickActor = stickActor; + global.renderer = renderer; + global.renderWindow = renderWindow; + } + + /** + * Calculate the number of pages needed to show all results and rebuild + * the page navigation widget. + */ + CINEMA_COMPONENTS.ImageSpread.prototype.updatePageNav = function() { + var self = this; + d3.select(this.container).select('.pageNavWrapper').remove(); //remove previous widget + var pageSize = this.pageSizeNode.value; + //If there are more results than can fit on one page, build a pageNav widget + if(this.selection.length > pageSize) { + //calculate number of pages needed + var numPages = Math.ceil(this.selection.length / pageSize); + //If the currently selected page is higher than the new number of pages, set to last page + if(this.currentPage > numPages) { + this.currentPage = numPages + }; + //Add pageNav and buttons + d3.select(this.container).append('div') + .classed('pageNavWrapper', true) + .append('ul') + .classed('pageNav', true) + .selectAll('li') + //Get data for which buttons to build, then build + .data(getPageButtons(numPages, this.currentPage)) + .enter().append('li') + .classed('pageButton', true) + .attr('mode', function(d) { + return d.page == self.currentPage ? 'selected' : 'default'; + }) + .text(function(d) { + return d.text; + }) + .on('click', function(d) { + if(d3.select(this).attr('mode') != 'selected') { + self.currentPage = d.page; + if(d.do_rebuild) { + self.updatePageNav(); + self.populateResults(); + } else { + d3.select(self.container).select('.pageButton[mode="selected"]') + .attr('mode', 'default'); + d3.select(this).attr('mode', 'selected'); + d3.select('.pageReadout').text(self.currentPage + " / " + numPages); + self.populateResults(); + } + } + }); + //Add readout of currentPage/totalPages + d3.select('.pageNavWrapper').append('div') + .classed('pageReadout', true) + .text(this.currentPage + " / " + numPages); + } //end if(this.selection.length > pageSize) + //Otherwise, don't build a widget and go to first (only) page + else { + this.currentPage = 1; + } + } + + /** + * Get the state of all inputs + */ + CINEMA_COMPONENTS.ImageSpread.prototype.getOptionsData = function() { + return { + pageSize: this.pageSizeNode.value, + sortDimension: this.sortNode.value, + sortOrderIsReversed: this.sortOrderNode.checked, + sortOrderIsGrouped: this.groupsortingNode.checked, + imageSize: this.imageSizeNode.value + }; + } + + /** + * Set the state of all inputs + */ + CINEMA_COMPONENTS.ImageSpread.prototype.setOptionsData = function(dataObject) { + d3.select(this.pageSizeNode).property("value", dataObject.pageSize); + d3.select(this.sortNode).property("value", dataObject.sortDimension); + d3.select(this.sortOrderNode).property("checked", dataObject.sortOrderIsReversed); + d3.select(this.groupsortingNode).property("checked", dataObject.sortOrderIsGrouped); + d3.select(this.imageSizeNode).property("value", dataObject.imageSize); + d3.select(this.container).select('.controlPanel.imageSize .label') + .text("Image Size: " + dataObject.imageSize + "px"); + } + + /** + * Given the number of pages needed and the currently selected page, return + * a list of objects represented the pageNav buttons to show + * objects are formatted like so: + * {text: [button_text], + * page: [pageNumber to link to], + * do_rebuild: [whether or not the pageNav widget should be rebuilt when this button is clicked]} + **/ + function getPageButtons(numPages, current) { + //If there are 7 or fewer pages, create a widget with a button for each page ([1|2|3|4|5|6|7]) + if(numPages <= 7) { + var pageData = []; + for (var i = 0; i < numPages; i++) + pageData.push({ + text: i + 1, + page: i + 1, + do_rebuild: false + }); + return pageData; + } + //Otherwise, create a widget with buttons for navigating relative to selected page ([|<|<<|10|20|30|>>|>|]) + else { + //step size is one order of magnitude below the total number of pages + var stepSize = Math.pow(10, Math.round(Math.log10(numPages) - 1)); + var pageData = []; + //Create buttons for selecting lower pages if current is not already one + if(current != 1) { + pageData.push({ + text: "|<", + page: 1, + do_rebuild: true + }); + pageData.push({ + text: "<", + page: current - 1, + do_rebuild: true + }); + var prevStep = current - stepSize >= 1 ? current - stepSize : current - 1; + pageData.push({ + text: prevStep, + page: prevStep, + do_rebuild: true + }); + } + //Create button for currently selected page + pageData.push({ + text: current, + page: current, + do_rebuild: false + }); + //Create buttons for selecting higher pages if current is not already at the end + if(current != numPages) { + var nextStep = current + stepSize <= numPages ? current + stepSize : current + 1; + pageData.push({ + text: nextStep, + page: nextStep, + do_rebuild: true + }); + pageData.push({ + text: ">", + page: current + 1, + do_rebuild: true + }); + pageData.push({ + text: ">|", + page: numPages, + do_rebuild: true + }); + } + return pageData; + } + } + + //Get if the given filetype is a valid image filetype + function isValidFiletype(type) { + if(!type) + return false; + var validFiletypes = ['JPG', 'JPEG', 'PNG', 'GIF', 'VTI', 'PDB']; + type = type.trimLeft().trimRight(); + var index = validFiletypes.indexOf(type.toUpperCase()); + + return (index >= 0); + } + + //Get the extension/filetype of the given path + function getFileExtension(path) { + return path ? path.substr(path.lastIndexOf('.') + 1).trimRight() : undefined; + } + +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * PCOORD + * + * The Pcoord Component for the CINEMA_COMPONENTS library. + * Contains the constructor for Parallel Coordinates Components (e.g. PcoordSVG, PcoordCanvas) + * It is a sublcass of Component and contains methods and fields common to all Parallel Coordinates Components + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS Pcoord module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE Pcoord module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS Pcoord module requires that"+ + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the"+ + " the Pcoord module"); + } + + /** @type {boolean} - Flag to indicate that the Pcoord module has been included */ + CINEMA_COMPONENTS.PCOORD_INCLUDED = true; + + /** + * Abstract constructor for Pcoord Components + * Represents a component for displaying and interacting with a database on a parallel coordinates chart + * Objects such as PcoordSVG and PcoordCanvas inherit from this + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.Pcoord = function(parent, database, filterRegex) { + if (this.constructor === CINEMA_COMPONENTS.Pcoord) + throw new Error("Cannot instantiate abstract class 'Pcoord'"+ + " Please use a subclass"); + + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + /** @type {CINEMA_COMPONENTS.Margin} Override default margin */ + this.margin = new CINEMA_COMPONENTS.Margin(30,10,10,10); + /** @type {number} the room left at the bottom of the chart for NaN values */ + this.NaNMargin; + + //call super-constructor + CINEMA_COMPONENTS.Component.call(this,parent,database,filterRegex); + //after size is calculated in the super-constructor, Set NaNMargin + this.NaNMargin = this.internalHeight/11; + + /*************************************** + * DATA + ***************************************/ + + /** @type {number[]} Indices of all currently selected data */ + this.selection = d3.range(0,this.db.data.length); + /** @type {number} Indices of all currently highlighted data*/ + this.highlighted = []; + /** @type {CINEMA_COMPONENTS.ExtraData[]} Custom data to overlay on chart */ + this.overlayData = []; + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. Ex: this.dispatch.on('click',handlerFunction(i)) + * 'selectionchange': Triggered when selection of data changes + * (called with array of indices of selected data) + * 'mouseover': Triggered when a path is moused over + * (called with index of moused over data and reference to mouse event) + * 'click': Triggered when a path is clicked on + * (called with index of clicked data and reference to mouse event) + * 'axisorderchange': Triggered when the axis ordering is manually changed + * (called with the list of the dimensions in the new order) + */ + this.dispatch = d3.dispatch("selectionchange", "mouseover", "click", "axisorderchange"); + + /*************************************** + * SCALES + ***************************************/ + + /** @type {d3.scalePoint} - Scale for x axis on chart + * Maps dimensions to position (in pixels) along width of chart.*/ + this.x = d3.scalePoint() + .domain(this.dimensions) + .range([0,this.internalWidth]) + .padding(1); + + /** @type {Object(d3.scale)} + * Scales for each dimension axis on the chart. One scale for each dimension */ + this.y = {}; + this.dimensions.forEach(function (d) { + //Create point scale for string dimensions + if (self.db.isStringDimension(d)) { + if (!self.y[d]) { + self.y[d] = d3.scalePoint(); + } + self.y[d].domain(self.db.dimensionDomains[d]) + .range([self.internalHeight,0]); + } + //Create linear scale for numeric dimensions + else { + if (!self.y[d]) { + self.y[d] = d3.scaleLinear(); + } + self.y[d].domain(self.db.dimensionDomains[d]) + .range([self.internalHeight-self.NaNMargin,0]); + } + }); + + /*************************************** + * DRAGGING + ***************************************/ + + /** @type {Object (numbers)} Keeps track of the x-position of each axis currently being dragged */ + this.dragging = {}; + + //Drag event handlers + this.axisDragStart = function(d) { + self.dragging[d] = self.x(d); + //Reorder axes such that the one being dragged is on top + self.axes.sort(function(a,b) { + if (a == d) return 1; + if (b == d) return -1; + return 0; + }); + }; + this.axisDrag = function(d) { + self.dragging[d] = Math.min(self.internalWidth,Math.max(0,d3.event.x)); + self.redrawPaths(); + var oldDimensions = self.dimensions.slice(); + self.dimensions.sort(function(a,b){ + return self.getXPosition(a)-self.getXPosition(b); + }); + if (!arraysEqual(oldDimensions,self.dimensions)) + self.dispatch.call('axisorderchange',self,self.dimensions); + self.x.domain(self.dimensions); + self.axes.attr('transform',function(d) { + return "translate("+self.getXPosition(d)+")"; + }); + }; + this.axisDragEnd = function(d) { + delete self.dragging[d]; + d3.select(this).attr('transform',"translate("+self.x(d)+")"); + //Reorder axes in DOM + self.axes.sort(function(a,b){ + return self.x(a) - self.x(b); + }); + self.redrawPaths(); + }; + + /** @type {d3.drag} */ + this.drag = d3.drag() + .subject(function(d){return {x: self.x(d)};}) + .on('start',this.axisDragStart) + .on('drag',this.axisDrag) + .on('end',this.axisDragEnd); + + /*************************************** + * BRUSHES + ***************************************/ + + /** @type {Object (Arrays)} Keeps track of the extents of the brush for each dimension*/ + this.brushExtents = {} + + /** @type {boolean} If true, don't update selection when brushes change */ + this.dontUpdateSelectionOnBrush = false; + + //Brush event handler + this.axisBrush = function(d) { + //If this is called due to an event (as opposed to manually called) + //update corresponding brush extent + if (d3.event != null) { + self.brushExtents[d] = d3.event.selection; + //Ignore brush if its start and end coordinates are the same + if (self.brushExtents[d] != null && self.brushExtents[d][0] === self.brushExtents[d][1]) + delete self.brushExtents[d]; + } + if (!self.dontUpdateSelectionOnBrush) + self.updateSelection(); + } + + /** @type {d3.brushY} The brushes for each axis */ + this.brush = d3.brushY() + .extent([[-8,0],[8,this.internalHeight]]) + .on('start', function(){d3.event.sourceEvent.stopPropagation();}) + .on('start brush',this.axisBrush); + + /*************************************** + * DOM Content + ***************************************/ + + //Create DOM content + //Specify that this is a Pcoord component + d3.select(this.container).classed('PCOORD',true); + /** @type {d3.selection} Where the paths for the chart will be drawn + * The actual drawing of paths depends on the specific Pcoord subclass + */ + this.pathContainer = d3.select(this.container).append('div') + .classed('pathContainer',true) + .style('position','absolute') + .style('width',this.parentRect.width+'px') + .style('height',this.parentRect.height+'px'); + + /** @type {boolean} Indicates if the lines on the chart should be smooth(curved) or not + * Be sure to call redrawPaths() after changing this so it takes effect + */ + this.smoothPaths = true; + + /*************************************** + * AXES + ***************************************/ + + /** @type {d3.selection} The container for all axes (as an svg object) */ + this.axisContainer = d3.select(this.container).append('svg') + .classed('axisContainer',true) + .style('position','absolute') + .attr('viewBox',(-this.margin.right)+' '+(-this.margin.top)+' '+ + (this.parentRect.width)+' '+ + (this.parentRect.height)) + .attr('preserveAspectRatio','none') + .attr('width','100%') + .attr('height','100%') + //disable pointer events on axisContainer so it doesn't block pathContainer + .style('pointer-events','none'); + /** @type {d3.selction} Groups for each axis */ + this.axes = this.axisContainer.selectAll('.axisGroup') + .data(this.dimensions) + .enter().append('g') + .classed('axisGroup',true) + .attr('dimension',function(d){return d;}) + .attr('transform', function(d) { + return "translate("+self.x(d)+")"; + }) + .call(this.drag) + //Add d3 axes to each axis group + this.axes.append('g') + .classed('axis',true) + .each(function(d) { + d3.select(this).call(d3.axisLeft().scale(self.y[d])); + if (!self.db.isStringDimension(d)) + self.addNaNExtensionToAxis(this); + }); + var labels = this.axes.append('g') + .classed('axisLabel',true) + //allow pointer-events on axisLabel so axes can be dragged + .style('pointer-events','initial') + //add text to each label + labels.append('text') + .style('text-anchor','middle') + .attr('y',-9) + .text(function(d){return d;}); + //prepend background rectangle to each label + labels.insert('rect',':first-child') + //each background is bound to their corresponding text's + //bounding box as data + .data(function() { + var boxes = []; + labels.selectAll('text').each(function(){ + boxes.push(this.getBBox()); + }); + return boxes; + }) + .attr('x',function(d){return d.x + 3;}) + .attr('y',function(d){return d.y;}) + .attr('width',function(d){return d.width - 6;}) + .attr('height',function(d){return d.height;}); + //Add brush group to each axis group + this.axes.append('g') + .classed('brush',true) + .each(function(){d3.select(this).call(self.brush);}); + + }; + //establish prototype chain + CINEMA_COMPONENTS.Pcoord.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.Pcoord.prototype.constructor = CINEMA_COMPONENTS.Pcoord; + + /** + * Add an additional line segment and tick to the end of an axis to represent the area + * for NaN values. + * @param {DOM} node - The DOM node for the svg group containing the axis (g.axis) + */ + CINEMA_COMPONENTS.Pcoord.prototype.addNaNExtensionToAxis = function(node) { + d3.select(node).append('path') + .attr('class','NaNExtension') + .attr('d',"M0.5,"+String(this.internalHeight-this.NaNMargin+0.5)+"V"+String(this.internalHeight-0.5)); + var NaNTick = d3.select(node).append('g') + .attr('class','NaNExtensionTick') + .attr('transform',"translate(0,"+String(this.internalHeight-0.5)+")"); + NaNTick.append('line') + .attr('x2','-6'); + NaNTick.append('text') + .attr('x','-9') + .attr('dy','0.32em') + .text('NaN'); + } + + /** + * Should be called every time the size of the chart's container changes. + * Updates the sizing and scaling of all parts of the chart and redraws + */ + CINEMA_COMPONENTS.Pcoord.prototype.updateSize = function() { + var self = this; + var oldHeight = this.internalHeight;//old height needed to rescale brushes + + //Call super (will recalculate size) + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + //update NaNMargin + this.NaNMargin = this.internalHeight/11; + + //update PathContainer size + this.pathContainer + .style('width',this.parentRect.width+'px') + .style('height',this.parentRect.height+'px'); + + //Rescale x + this.x.range([0,this.internalWidth]); + + //Rescale y scales + this.dimensions.forEach(function(d) { + self.y[d].range([self.db.isStringDimension(d) ? self.internalHeight : self.internalHeight-self.NaNMargin, 0]); + }); + + this.redrawPaths(); + + //Reposition and rescale axes + this.axisContainer + .attr('viewBox',(-this.margin.right)+' '+(-this.margin.top)+' '+ + (this.parentRect.width)+' '+ + (this.parentRect.height)); + this.axes.attr("transform", function(d) { + return "translate("+self.getXPosition(d)+")"; + }); + this.axes.each(function(d) { + d3.select(this).select('.axis').call(d3.axisLeft().scale(self.y[d])); + //if scale is linear, then update the NaN extension on the axis + if (!self.db.isStringDimension(d)) { + d3.select(this).select('path.NaNExtension') + .attr('d',"M0.5,"+String(self.internalHeight-self.NaNMargin+0.5)+"V"+String(self.internalHeight-0.5)); + d3.select(this).select('.NaNExtensionTick') + .attr('transform',"translate(0,"+String(self.internalHeight-0.5)+")"); + } + }); + + //Redraw brushes + this.dontUpdateSelectionOnBrush = true; //avoid updating selection when resizing brushes + this.brush.extent([[-8,0],[8,this.internalHeight]]); + this.axes.selectAll('g.brush').each(function(d) { + d3.select(this).call(self.brush); + d3.select(this).call(self.brush.move, function() { + if (self.brushExtents[d] == null) + return null; + + return self.brushExtents[d].map(function(i) { + return i/oldHeight * self.internalHeight; + }); + }); + }); + this.dontUpdateSelectionOnBrush = false; + } + + /** + * Should be called whenever the data in the associated database changes. + * Will update scales, axes and selection to fit the new data. + */ + CINEMA_COMPONENTS.Pcoord.prototype.updateData = function() { + var self = this; + + //Update scale domains + this.dimensions.forEach(function(d){ + self.y[d].domain(self.db.dimensionDomains[d]); + }); + + //Rebuild axes + this.axes.each(function(d) { + d3.select(this).select('.axis').call(d3.axisLeft().scale(self.y[d])); + }); + + this.updateSelection(true); + } + + /** + * Called whenever a brush changes the selection + * Updates selection to hold the indices of all data points that are + * selected by the brushes. + * @param {bool} force - If true, selectionchange event will be triggered + * and paths will be redrawn even if the set the of selected points did + * not change. + */ + CINEMA_COMPONENTS.Pcoord.prototype.updateSelection = function(force) { + var self = this; + var newSelection = []; + this.db.data.forEach(function(d,i) { + var selected = true; + for (var p in self.dimensions) { + var extent = self.brushExtents[self.dimensions[p]]; + if (extent) { + var y = self.getYPosition(self.dimensions[p],d); + selected = selected && extent[0] <= y && y <= extent[1]; + if (!selected) + break; + } + } + if (selected) + newSelection.push(i); + }); + if (!arraysEqual(this.selection,newSelection) || force) { + this.selection = newSelection; + this.dispatch.call("selectionchange",this, this.selection.slice()); + this.redrawSelectedPaths(); + } + } + + /** + * Set the indices of the currently highlighted data + */ + CINEMA_COMPONENTS.Pcoord.prototype.setHighlightedPaths = function(indices) { + this.highlighted = indices; + this.redrawHighlightedPaths(); + } + + /** + * Set the current overlay paths + */ + CINEMA_COMPONENTS.Pcoord.prototype.setOverlayPaths = function(data) { + this.overlayData = data; + this.redrawOverlayPaths(); + }; + + //Shortcut function for redrawSelectedPaths, redrawHighlightedPath, redrawOverlayPaths + CINEMA_COMPONENTS.Pcoord.prototype.redrawPaths = function() { + this.redrawSelectedPaths(); + this.redrawHighlightedPaths(); + this.redrawOverlayPaths(); + } + + /** + * Set the chart's selection to encapsulate the data represented by + * the given array of indices + */ + CINEMA_COMPONENTS.Pcoord.prototype.setSelection = function(selection) { + var ranges = {}; + var self = this; + console.log(selection); + this.dimensions.forEach(function(d) { + ranges[d] = d3.extent(selection, function(i) { + return self.getYPosition(d, self.db.data[i]); + }); + }); + this.axes.selectAll('g.brush') + .each(function(d) { + d3.select(this).call(self.brush.move, function() { + return [ranges[d][0]-5,ranges[d][1]+5]; + }); + }); + //call brush event handler + this.axisBrush(); + } + + /** + * Set the chart's selection to match the ranges defined in the given + * filter. + * @param {Object} filter Object defining the filter. Each key is the name + * of numeric dimension and each value is a 2-length array containing the minimum + * and maximum values. + */ + CINEMA_COMPONENTS.Pcoord.prototype.filterSelection = function(filter) { + var self = this; + this.dimensions.forEach(function(d) { + //get filter for this particular dimension 'f' + var f = filter ? filter[d] : null + if (f && Array.isArray(f) && f.length == 2 && !isNaN(f[0]) && !isNaN(f[1])) { + //clamp range to bounds of chart + var range = [ + Math.max(self.y[d](f[1]),0), + Math.min(self.y[d](f[0]),self.internalHeight) + ] + self.axisContainer.select('.axisGroup[dimension='+d+']').select('g.brush') + .call(self.brush.move, function() {return range;}) + } + }); + //call brush event handler + this.axisBrush(); + } + + /** + * Reorder the axes to the order given + */ + CINEMA_COMPONENTS.Pcoord.prototype.setAxisOrder = function(order) { + var self = this; + //filter out dimensions in order, but not in chart's dimensions + var order = order.filter(function(d) { + return self.dimensions.includes(d); + }); + //Add any dimensions in chart's dimensions but not in order + this.dimensions.forEach(function(d) { + if (!order.includes[d]) + order.push(d); + }); + //update domain + this.x.domain(order); + //update dimensions list + self.dimensions.sort(function(a,b){ + return self.getXPosition(a)-self.getXPosition(b); + }); + //update axes + this.axes.attr('transform',function(d) { + return "translate("+self.getXPosition(d)+")"; + }); + //Reorder axes in DOM + self.axes.sort(function(a,b){ + return self.x(a) - self.x(b); + }); + //redraw + this.redrawPaths(); + } + + /** + * Redraw the current selection of paths. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.Pcoord.prototype.redrawSelectedPaths = function() { + throw new Error("Cannot call abstract function 'redrawSelectedPaths()'!"+ + " Please override function in a subclass"); + } + + /** + * Redraw the currently highlighted path. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.Pcoord.prototype.redrawHighlightedPaths = function() { + throw new Error("Cannot call abstract function 'redrawHighlightedPaths()'!"+ + " Please override function in a subclass"); + } + + /** + * Redraw the overlay paths. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.Pcoord.prototype.redrawOverlayPaths = function() { + throw new Error("Cannot call abstract function 'redrawOverlayPaths()'!"+ + " Please override function in a subclass"); + } + + /** + * Get the path (the contents of the 'd' attribute) for the path + * represented by the given data point. + * Draws a physical break in the path where values are undefined. + * @param {Object} d The data point to base the path off + */ + CINEMA_COMPONENTS.Pcoord.prototype.getPath = function(d) { + var self = this; + var curveLength = this.smoothPaths ? this.internalWidth/this.dimensions.length/3 : 0; + var singleSegmentLength = this.internalWidth/this.dimensions.length/5; + var path = ''; + + //Split dimensions into sections deliminated by undefined values + var sections = []; + var currentSection = []; + this.dimensions.forEach(function(p) { + if (d[p] != undefined) { + currentSection.push(p); + } + else if (currentSection.length != 0) { + sections.push(currentSection.slice()); + currentSection = []; + } + }); + if (currentSection.length > 0) + sections.push(currentSection.slice()); + + //Draw individual sections + sections.forEach(function(section) { + //If a section contains only one dimension, draw a short line across the axis + if (section.length == 1) { + var p = section[0]; + var x = self.getXPosition(p); + var y = self.getYPosition(p,d); + path += ('M '+(x-singleSegmentLength/2)+' '+y+' L ')+ + ((x+singleSegmentLength/2)+' '+y); + } + else { + section.forEach(function (p,i) { + var x = self.getXPosition(p); + var y = self.getYPosition(p,d); + if (i == 0) {//beginning of path + path += ('M '+x+' '+y+' C ')+ + ((x+curveLength)+' '+y+' '); + } + else if (i == section.length-1) {//end of path + path += ((x-curveLength)+' '+y+' ')+ + (x+' '+y+' '); + } + else {//midpoints + path += ((x-curveLength)+' '+y+' ')+ + (x+' '+y+' ')+ + ((x+curveLength)+' '+y+' '); + } + }); + } + }); + return path; + } + + /** + * Get the x-coordinate of the axis representing the given dimension + * @param {string} d - The dimension to get the x-coordinate for + */ + CINEMA_COMPONENTS.Pcoord.prototype.getXPosition = function(d) { + var v = this.dragging[d]; + return v == null ? this.x(d) : v; + }; + + /** + * Get the y-coordinate of the line for data point p on dimension d + * @param {string} d - The dimension on the data point + * @param {Object} p - The data point + */ + CINEMA_COMPONENTS.Pcoord.prototype.getYPosition = function(d, p) { + if (!this.db.isStringDimension(d) && isNaN(p[d])) + //If the value is NaN on a linear scale, return internalHeight as the position + //(to place the line on the NaN tick) + return this.internalHeight; + return this.y[d](p[d]); + } + + /** + * Get the y-coordinate of the line for data point p on dimension d + * @param {Object} dimObject - dimension / startDate / endDate selected} + */ + CINEMA_COMPONENTS.Pcoord.prototype.addSelectionByDimensionValues = function(dimObject) { + var self = this; + + //Get pixel values of given dates + var startpx = this.y[dimObject.dimension](dimObject.startDate) + var endpx = this.y[dimObject.dimension](dimObject.endDate) + + //avoid 0px selection + if(startpx === endpx) { + startpx += 1; + endpx -= 1; + } + + //Check if inside boundary + var range = [ + Math.min(endpx,self.internalHeight), + Math.max(startpx,0) + ] + + //Set selection + self.axisContainer + .select('.axisGroup[dimension='+dimObject.dimension+']') + .select('g.brush') + .call(self.brush.move, function() {return range;}); + } + + /** + * Convenience function to compare arrays + * (used to compare the selection to the previous one) + */ + function arraysEqual(a, b) { + if (a === b) return true; + if (a == null || b == null) return false; + if (a.length != b.length) return false; + + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) return false; + } + return true; + } + +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * PCOORD_CANVAS + * + * The PcoordSVG Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the PcoordCanvas component: + * A subclass of Pcoord which draws a Paralell Coordinates chart using canvas elements. + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Pcoord Component be included + if (!CINEMA_COMPONENTS.PCOORD_INCLUDED) + throw new Error("CINEMA_COMPONENTS PcoordCanvas Component requires that Pcoord"+ + " component be included. Please make sure that Pcoord component"+ + " is included BEFORE PcoordCanvas module"); + + /** @type {boolean} - Flag to indicate that the PcoordCanvas Component has been included */ + CINEMA_COMPONENTS.PCOORD_CANVAS_INCLUDED = true; + + /** + * Constructor for PcoordCanvas Component + * Represents a component for displaying and interacting with a database on a parallel coordinates chart + * rendered with canvas elements + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.PcoordCanvas = function(parent, database, filterRegex) { + var self = this; + //call super-constructor + CINEMA_COMPONENTS.Pcoord.call(this,parent,database,filterRegex); + + //Specify that this is a Pcoord Canvas component + d3.select(this.container).classed('CANVAS',true); + + //Add canvases to pathContainer + this.selectedCanvas = this.pathContainer.append('canvas') + .classed('selectedCanvas',true) + .node(); + this.highlightedCanvas = this.pathContainer.append('canvas') + .classed('highlightedCanvas',true) + .node(); + this.overlayCanvas = this.pathContainer.append('canvas') + .classed('overlayCanvas',true) + .node(); + //Index canvas is invisible and draws in a unique color for each path + //Its color data is used to determine which path is being moused over + this.indexCanvas = this.pathContainer.append('canvas') + .classed('indexCanvas',true) + .style('display','none') + .node(); + //Size/position canvases + this.pathContainer.selectAll('canvas') + .style('position','absolute') + .style('top',this.margin.top+'px') + .style('left',this.margin.left+'px'); + + //Determine screen DPI to rescale canvas contexts + //(prevents artifacts and blurring on some displays) + //https://stackoverflow.com/a/15666143/2827258 + this.pixelRatio = (function() { + var ctx = document.createElement('canvas').getContext("2d"), + dpr = window.devicePixelRatio || 1, + bsr = ctx.webkitBackingStorePixelRatio || + ctx.mozBackingStorePixelRatio || + ctx.msBackingStorePixelRatio || + ctx.oBackingStorePixelRatio || + ctx.backingStorePixelRatio || 1; + return dpr / bsr; + })(); + + //Loading/still drawing indicator + this.loading = d3.select(this.container).append('div') + .classed('loadingIndicator',true) + .style('display','none') + .text('Drawing...'); + + //Set an interval to call drawIterator if it exists + //roughly 60 times a second + this.interval = setInterval(function(self) { + for (var i = 0; i < 25; i++) { + if (self.drawIterator) { + if (self.drawIterator.next().done) { + self.drawIterator = undefined; + self.loading.style('display','none'); + } + } + } + }, 16, this); + + //Set up mousemove listener to get moused-over paths + this.lastMouseMove = null; //remember last result, to prevent excessive dispatch calls + this.pathContainer.on('mousemove', function() { + var x = d3.mouse(self.selectedCanvas)[0]*self.pixelRatio; + var y = d3.mouse(self.selectedCanvas)[1]*self.pixelRatio; + if (x >= 0 && y >= 0) { + var index = getIndexAtPoint(x,y,self.indexCanvas); + if (index != -1) { + if (self.lastMouseMove != self.selection[index]) { + self.lastMouseMove = self.selection[index]; + self.dispatch.call('mouseover',self,self.selection[index],d3.event); + } + } + else { + if (self.lastMouseMove !== null) { + self.lastMouseMove = null; + self.dispatch.call('mouseover',self,null,d3.event); + } + } + } + }); + + this.updateSize(); + } + //establish prototype chain + CINEMA_COMPONENTS.PcoordCanvas.prototype = Object.create(CINEMA_COMPONENTS.Pcoord.prototype); + CINEMA_COMPONENTS.PcoordCanvas.prototype.constructor = CINEMA_COMPONENTS.PcoordCanvas; + + /************************** + * OVERRIDE METHODS + **************************/ + + CINEMA_COMPONENTS.PcoordCanvas.prototype.updateSize = function() { + var self = this; + //call super + CINEMA_COMPONENTS.Pcoord.prototype.updateSize.call(this); + + //Resize canvases + this.pathContainer.selectAll('canvas') + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px') + // width/height styles are distinct from attributes + // (attributes determine context size, style is the size the canvas appears in on screen) + .attr('width',this.internalWidth*this.pixelRatio+'px') + .attr('height',this.internalHeight*this.pixelRatio+'px') + .each(function(){ + this.getContext('2d').scale(self.pixelRatio,self.pixelRatio); + }); + //Init canvas contexts + var selectedContext = this.selectedCanvas.getContext('2d'); + selectedContext.strokeStyle = 'lightgray'; + selectedContext.globalAlpha = 0.3; + selectedContext.lineWidth = 2; + var highlightedContext = this.highlightedCanvas.getContext('2d'); + highlightedContext.strokeStyle = 'lightskyblue'; + highlightedContext.lineWidth = 4; + var indexContext = this.indexCanvas.getContext('2d'); + indexContext.lineWidth = 3; + + this.redrawPaths(); + } + + /** + * Redraw the current selection of paths. + */ + CINEMA_COMPONENTS.PcoordCanvas.prototype.redrawSelectedPaths = function() { + var self = this; + + var ctx = this.selectedCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + var indexCtx = this.indexCanvas.getContext('2d'); + indexCtx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.drawIterator = (function*(queue){ + self.loading.style('display','initial'); + var i = 0; + while (i < queue.length) { + var path = new Path2D(self.getPath(self.db.data[queue[i]])); + ctx.stroke(path); + + indexCtx.strokeStyle = indexToColor(i); + indexCtx.stroke(path); + + yield ++i; + } + })(this.selection); + } + + /** + * Redraw the currently highlighted path. + */ + CINEMA_COMPONENTS.PcoordCanvas.prototype.redrawHighlightedPaths = function() { + var self = this; + + var ctx = this.highlightedCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.highlighted.forEach(function(d) { + var path = new Path2D(self.getPath(self.db.data[d])); + ctx.stroke(path); + }); + } + + /** + * Redraw the overlay paths. + */ + CINEMA_COMPONENTS.PcoordCanvas.prototype.redrawOverlayPaths = function() { + var self = this; + + var ctx = this.overlayCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.overlayData.forEach(function(d) { + //Parse style + ctx.lineWidth = d.style.lineWidth || 1; + ctx.lineCap = d.style.lineCap || 'butt'; + ctx.lineJoin = d.style.lineJoin || 'miter'; + ctx.miterLimit = d.style.miterLimit || 10; + ctx.strokeStyle = d.style.strokeStyle || 'black'; + if (d.style.lineDash) + ctx.setLineDash(d.style.lineDash); + else + ctx.setLineDash([]); + //Draw line + var path = new Path2D(self.getPath(d.data)); + ctx.stroke(path); + }) + } + + /** + * Override destroy() to also clear interval + */ + CINEMA_COMPONENTS.PcoordCanvas.prototype.destroy = function() { + clearInterval(this.interval); + //Call super + CINEMA_COMPONENTS.Component.prototype.destroy.call(this); + } + + //Get the index of the path at the given point + //using the colors on the index canvas + //returns -1 if there is no path, or the area around the point is too noisy + var getIndexAtPoint = function(x,y,canvas) { + //get the color data for a 3x3 pixel area around the point + var colorData = canvas.getContext('2d').getImageData(x-1,y-1,3,3).data; + //get the index for each pixel + var indices = []; + for (var i = 0; i < colorData.length/4; i++) { + indices.push(colorToIndex(colorData.slice(i*4,i*4+3))); + } + + //for a positive match, must find at least 5 pixels with the same index + indices.sort(); + var matched = -1; + var count = 0; + var counting = -1; + for (var i = 0; i < indices.length; i++) { + if (counting != indices[i]) { + count = 1; + counting = indices[i]; + } + else { + count++; + if (count == 5) { + matched = counting; + break; + } + } + } + + return matched; + } + + //convert an index value to a color + //Mapping -1 through 256^3 to rgb(0,0,0) through rgb(255,255,255) + var indexToColor = function(i) { + if (i > 256*256*256) { + return 'rgb(255,255,255)'; + } + i++; + var b = Math.floor(i/256/256); + var g = Math.floor((i - b*256*256) / 256); + var r = (i - b*256*256 - g*256); + return 'rgb('+r+','+g+','+b+')'; + } + + //convert a color to an index value + //Mapping [0,0,0] through [255,255,255] to -1 through 256^3 + var colorToIndex = function(rgb) { + return (rgb[0] + rgb[1]*256 + rgb[2]*256*256)-1; + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * PCOORDSVG + * + * The PcoordSVG Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the PcoordSVG component: + * A subclass of Pcoord which draws a Paralell Coordinates chart using SVG. + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Pcoord Component be included + if (!CINEMA_COMPONENTS.PCOORD_INCLUDED) + throw new Error("CINEMA_COMPONENTS PcoordSVG Component requires that Pcoord"+ + " component be included. Please make sure that Pcoord component"+ + " is included BEFORE PcoordSVG module"); + + /** @type {boolean} - Flag to indicate that the PcoordSVG Component has been included */ + CINEMA_COMPONENTS.PCOORDSVG_INCLUDED = true; + + /** + * Constructor for PcoordSVG Component + * Represents a component for displaying and interacting with a database on a parallel coordinates chart + * rendered with SVG + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.PcoordSVG = function(parent, database, filterRegex) { + //call super-constructor + CINEMA_COMPONENTS.Pcoord.call(this,parent,database,filterRegex); + + //Specify that this is a Pcoord SVG component + d3.select(this.container).classed('SVG',true); + + //Add SVG Components to pathContainer + this.svg = this.pathContainer.append('svg') + .style('position','absolute') + .style('top',this.margin.top+'px') + .style('left',this.margin.left+'px') + .attr('width',this.internalWidth+'px') + .attr('height',this.internalHeight+'px'); + //Add group for selected paths + this.selectedPaths = this.svg.append('g') + .classed('selectedPaths',true); + //Add group for highlighted paths + this.highlightedPaths = this.svg.append('g') + .classed('highlightedPaths',true); + //Add group for overlay paths + this.overlayPaths = this.svg.append('g') + .classed('overlayPaths',true); + + this.redrawPaths(); + } + //establish prototype chain + CINEMA_COMPONENTS.PcoordSVG.prototype = Object.create(CINEMA_COMPONENTS.Pcoord.prototype); + CINEMA_COMPONENTS.PcoordSVG.prototype.constructor = CINEMA_COMPONENTS.PcoordSVG; + + /************************** + * OVERRIDE METHODS + **************************/ + + CINEMA_COMPONENTS.PcoordSVG.prototype.updateSize = function() { + //call super + CINEMA_COMPONENTS.Pcoord.prototype.updateSize.call(this); + + //rescale svg + this.svg + .attr('width',this.internalWidth+'px') + .attr('height',this.internalHeight+'px'); + } + + /** + * Redraw the current selection of paths. + */ + CINEMA_COMPONENTS.PcoordSVG.prototype.redrawSelectedPaths = function() { + var self = this; + //Bind to selection and update + var update = this.selectedPaths + .selectAll('path').data(this.selection); + update.enter() //ENTER + .append('path') + .merge(update) //ENTER + UPDATE + .attr('index',function(d){return d;}) + .attr('d',function(d){ + return self.getPath(self.db.data[d]); + }) + .on('mouseenter',function(d){ + self.dispatch.call("mouseover",self,d,d3.event); + }) + .on('mouseleave',function(d){ + self.dispatch.call("mouseover",self,null,d3.event); + }) + .on('click', function(d) { + self.dispatch.call("click",self,d); + }); + update.exit() //EXIT + .remove(); + } + + /** + * Redraw the currently highlighted path. + */ + CINEMA_COMPONENTS.PcoordSVG.prototype.redrawHighlightedPaths = function() { + var self = this; + //Bind to highlighted and update + var update = this.highlightedPaths + .selectAll('path').data(this.highlighted); + update.enter() //ENTER + .append('path') + .merge(update) //ENTER + UPDATE + .attr('index',function(d){return d;}) + .attr('d',function(d){ + return self.getPath(self.db.data[d]); + }); + update.exit() //EXIT + .remove(); + } + + /** + * Redraw the overlay paths. + */ + CINEMA_COMPONENTS.PcoordSVG.prototype.redrawOverlayPaths = function() { + var self = this; + //Bind to overlayData and update + var update = this.overlayPaths + .selectAll('path').data(this.overlayData); + update.enter() //ENTER + .append('path') + .merge(update) //ENTER + UPDATE + .attr('style',function(d){return d.style;}) + .attr('d',function(d){ + return self.getPath(d.data); + }); + update.exit() //EXIT + .remove(); + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * QUERY + * + * The Query Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the Query Component + * Which allows for defining a custom data point and querying + * a database for similar data points + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS Query module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE Query module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS Query module requires that"+ + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the"+ + " the Query module"); + } + + /** @type {boolean} - Flag to indicate that the Query module has been included */ + CINEMA_COMPONENTS.QUERY_INCLUDED = true; + + /** + * Constructor for Query Component + * Represents a component for querying a database + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * (Note that Query does not use a filterRegex) + */ + CINEMA_COMPONENTS.Query = function(parent, database) { + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + //Call super-constructor (will calculate size) + CINEMA_COMPONENTS.Component.call(this,parent,database); + + /*************************************** + * DATA + ***************************************/ + + //override this.dimensions to include only numeric dimensions + this.dimensions = this.dimensions.filter(function(d) { + return !self.db.isStringDimension(d); + }); + + /** @type {number[]} Indices of the similar results to the last query */ + this.results = []; + + /** @type {CINEMA_COMPONENTS.ExtraData} The custom-defined data point */ + this.custom = new CINEMA_COMPONENTS.ExtraData({},""); + /** @type {CINEMA_COMPONENTS.ExtraData} Approximations of the boudnaries for similar data given the threshold */ + this.upper = new CINEMA_COMPONENTS.ExtraData({},""); + this.lower = new CINEMA_COMPONENTS.ExtraData({},""); + // (styles will be decided by a client program) + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. Ex: this.dispatch.on('query',handlerFunction(results)) + * 'query': Triggered when a query is made + * (argument is the results of the query (as an array of indices)) + * 'customchange': Triggered when the custom-defined data point changes + * (arguemnt is an array with extra data custom,upper and lower (in that order)) + */ + this.dispatch = d3.dispatch('query','customchange'); + + /*************************************** + * SCALES + ***************************************/ + + //Input sliders for each dimension range from 0 to 100 + //So create scales to scale a slider's value to a value in its dimension + this.scales = {}; + this.dimensions.forEach(function(d) { + self.scales[d] = d3.scaleLinear() + .domain([0,100]) + .range(self.db.dimensionDomains[d]); + }); + + /*************************************** + * DOM Content + ***************************************/ + + //Specify that this is a Query component + d3.select(this.container).classed('QUERY',true); + + /** @type {DOM (button)} Button to perform a query when pressed */ + this.queryButton = d3.select(this.container).append('button') + .classed('queryButton',true) + .text("Find Similar") + .on('click',function() { + var results = self.db.getSimilar(self.custom.data,self.thresholdNode.value); + d3.select(self.readout).text(results.length+ " results found!"); + self.dispatch.call('query',self,results.slice()); + }) + .node(); + + /** @type {DOM (span)} Label for Threshold input */ + this.thresholdLabel = d3.select(this.container).append('span') + .classed('thresholdLabel',true) + .text("Threshold:") + .node(); + + /** @type {DOM (input/number)} Number input for threshold */ + this.thresholdNode = d3.select(this.container).append('input') + .classed('thresholdInput',true) + .attr('type','number') + .attr('max',this.dimensions.length) + .attr('min',0) + .attr('step',0.05) + .on('change',function() { + self.updateBounds(); + self.dispatch.call('customchange',self,[self.custom,self.upper,self.lower]); + }) + .node(); + this.thresholdNode.value = 1.0; + + /** @type {DOM (span)} Readout for number of found results */ + this.readout = d3.select(this.container).append('span') + .classed('readout',true) + .node(); + + /** @type {d3.selection} Input rows for each dimension */ + this.rows = d3.select(this.container).selectAll('.inputRow') + .data(this.dimensions) + .enter().append('div') + .classed('inputRow',true) + .style('position','relative'); + //Create contents of each input row + //labels + this.rows.append('span') + .classed('label',true) + .style('position','absolute') + .text(function(d){return d;}); + //checkbox + this.rows.append('input') + .attr('type','checkbox') + .style('position','absolute') + .on('input',function(d) { + if (this.checked) { + var slider = d3.select(this.parentNode).select('input[type="range"]'); + self.custom.data[d] = self.scales[d](slider.node().value); + } + else { + delete self.custom.data[d]; + } + self.updateBounds(); + self.dispatch.call('customchange',self,[self.custom,self.upper,self.lower]); + }); + //slider + this.rows.append('input') + .attr('type','range') + .attr('min',0) + .attr('max',100) + .attr('step',1) + .each(function(){this.value = 50;}) + .style('position','absolute') + .on('input',function(d){ + var check = d3.select(this.parentNode).select('input[type="checkbox"]'); + if (!check.node().checked) + check.node().checked = true; + self.custom.data[d] = self.scales[d](this.value); + self.updateBounds(); + self.dispatch.call('customchange',self,[self.custom,self.upper,self.lower]); + }); + + } + //establish prototype chain + CINEMA_COMPONENTS.Query.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.Query.prototype.constructor = CINEMA_COMPONENTS.Query; + + /** + * Should be called whenever the data in the associated database changes. + * Will update scales to fit the new data. + */ + CINEMA_COMPONENTS.Query.prototype.updateData = function() { + var self = this; + + this.dimensions.forEach(function(d) { + self.scales[d].range(self.db.dimensionDomains[d]); + }) + } + + /** + * Update upper and lower data depending on custom data and current threshold value + */ + CINEMA_COMPONENTS.Query.prototype.updateBounds = function() { + var self = this; + var threshold = this.thresholdNode.value; + //average difference along each dimension + var avg = (threshold/d3.keys(this.custom.data).length)*100; + this.upper.data = {}; + this.lower.data = {}; + this.dimensions.forEach(function(d) { + if (self.custom.data[d] !== undefined) { + var s = self.scales[d]; + self.lower.data[d] = s(Math.max(s.invert(self.custom.data[d])-avg,0)); + self.upper.data[d] = s(Math.min(s.invert(self.custom.data[d])+avg,100)); + } + }); + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * SCATTER_PLOT + * + * The ScatterPlot component for the CINEMA_COMPONENTS library. + * Contains the constructor for ScatterPlot Components (Eg. ScatterPlotSVG, ScatterPlotCanvas) + * It is a subclass of Component and contains methods and fields common to all ScatterPlot Components + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS ScatterPlot module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE ScatterPlot module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS ScatterPlot module requires that"+ + " d3 be included (at least d3v4). Please make sure that d3 is included BEFORE the"+ + " the ScatterPlot module"); + } + + /** @type {boolean} - Flag to indicate that the ScatterPlot module has been included */ + CINEMA_COMPONENTS.SCATTER_PLOT_INCLUDED = true; + + /** + * Abstract constructor for ScatterPlot Components + * Represents a component for displaying the data in a database on a 2D scatter plot. + * Objects such as ScatterPlotSVG and ScatterPlotCanvas inherit from this. + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.ScatterPlot = function(parent, database, filterRegex) { + /*if (this.constructor === CINEMA_COMPONENTS.ScatterPlot) + throw new Error("Cannot instantiate abstract class 'ScatterPlot'"+ + "Please use a subclass.");*/ + + var self = this; + + /*************************************** + * SIZING + ***************************************/ + + /** @type {CINEMA_COMPONENTS.Margin} Override default margin */ + this.margin = new CINEMA_COMPONENTS.Margin(25,25,60,150); + + //Call super-constructor + CINEMA_COMPONENTS.Component.call(this,parent,database,filterRegex); + + /*************************************** + * DATA + ***************************************/ + + /** @type {number[]} Indices of all currently displayed data */ + this.selection = []; + /** @type {number} Indices of all currently highlighted data */ + this.highlighted = []; + /** @type {CINEMA_COMPONENTS.ExtraData[]} Custom data to overlay on chart */ + this.overlayData = []; + + /** @type {string} The currently selected dimensions for each axis*/ + this.xDimension = this.dimensions[0]; + this.yDimension = this.dimensions[1]; + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. Ex: this.dispatch.on('mouseover',handlerFunction(i)) + * 'mouseover': Triggered when a point is moused over. + * (called with the index of moused over data and a reference to the mouse event) + * 'xchanged': Triggered when the x dimension being viewed is changed + * (called with the new dimension as an argument) + * 'ychanged': Triggered when the y dimension being viewed is changed + * (called with the new dimension as an argument) + */ + this.dispatch = d3.dispatch("mouseover",'xchanged','ychanged'); + + /*************************************** + * SCALES + ***************************************/ + + /** @type {d3.scale} The scales for the x and y axes */ + this.x = (this.db.isStringDimension(this.xDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(this.db.dimensionDomains[this.xDimension]) + .range([15,this.internalWidth-15]); + this.y = (this.db.isStringDimension(this.yDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(this.db.dimensionDomains[this.yDimension]) + .range([this.internalHeight-15,15]); + + /*************************************** + * DOM Content + ***************************************/ + + //Specify that this a ScatterPlot component + d3.select(this.container).classed('SCATTER_PLOT',true); + + /** @type {d3.selection} Where the data on the chart will be drawn + * The actual drawing depends on the specific ScatterPlot sublcass + */ + this.pointContainer = d3.select(this.container).append('div') + .classed('pointContainer',true) + .style('position','absolute') + .style('top',this.margin.top+'px') + .style('right',this.margin.right+'px') + .style('bottom',this.margin.bottom+'px') + .style('left',this.margin.left+'px') + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px'); + + /** @type {DOM (select)} The select elements for selecting the dimension for each axis */ + //x + this.xSelect = d3.select(this.container).append('select') + .classed('dimensionSelect x',true) + .style('position','absolute') + .node(); + //y + this.ySelect = d3.select(this.container).append('select') + .classed('dimensionSelect y',true) + .style('position','absolute') + .node(); + //Bind data and append options + //x + d3.select(this.xSelect).selectAll('option') + .data(this.dimensions) + .enter().append('option') + .attr('value',function(d){return d;}) + .text(function(d){return d;}); + d3.select(this.xSelect).node().value = this.xDimension; + //y + d3.select(this.ySelect).selectAll('option') + .data(this.dimensions) + .enter().append('option') + .attr('value',function(d){return d;}) + .text(function(d){return d;}); + d3.select(this.ySelect).node().value = this.yDimension; + //Add change listeners to select elements + //x + d3.select(this.xSelect).on('input',function() { + self.xDimension = this.value; + self.x = (self.db.isStringDimension(self.xDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(self.db.dimensionDomains[self.xDimension]) + .range([0,self.internalWidth]); + self.xAxisContainer.select('.axis') + .call(d3.axisBottom().scale(self.x)); + self.dispatch.call('xchanged',self,self.xDimension); + self.redrawPoints(); + }); + //y + d3.select(this.ySelect).on('input',function() { + self.yDimension = this.value; + self.y = (self.db.isStringDimension(self.yDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(self.db.dimensionDomains[self.yDimension]) + .range([self.internalHeight,0]); + self.yAxisContainer.select('.axis') + .call(d3.axisLeft().scale(self.y)); + self.dispatch.call('ychanged',self,self.yDimension); + self.redrawPoints(); + }); + + /** @type {d3.selection} A readout in the corner of the chart + * that warns if any data could not be plotted + */ + this.warningReadout = d3.select(this.container).append('div') + .classed('warningReadout',true) + .style('position','absolute'); + + /*************************************** + * AXES + ***************************************/ + + /** @type {d3.selection} The container for each axis */ + //x + this.xAxisContainer = d3.select(this.container).append('svg') + .classed('axisContainer x',true) + .style('position','absolute') + .style('width',this.internalWidth+'px') + .style('height',25+'px') + .style('top',this.margin.top+this.internalHeight+'px') + .style('left',this.margin.left+'px'); + //y + this.yAxisContainer = d3.select(this.container).append('svg') + .classed('axisContainer y',true) + .style('position','absolute') + .style('width',50+'px') + .style('height',this.internalHeight+'px') + .style('left',(this.margin.left-50)+'px') + .style('top',this.margin.top+'px'); + //Add axis to each axis container + //x + this.xAxisContainer.append('g') + .classed('axis',true) + .call(d3.axisBottom().scale(this.x)); + //y + this.yAxisContainer.append('g') + .classed('axis',true) + .attr('transform','translate(50)') + .call(d3.axisLeft().scale(this.y)); + + }; + //establish prototype chain + CINEMA_COMPONENTS.ScatterPlot.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.ScatterPlot.prototype.constructor = CINEMA_COMPONENTS.ScatterPlot; + + /** + * Should be called every time the size of the chart's container changes. + * Updates the sizing and scaling of all parts of the chart and redraws + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.updateSize = function() { + //Call super (will recalculate size) + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + //update pointContainer size + this.pointContainer + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px'); + + //Rescale + this.x.range([15,this.internalWidth-15]); + this.y.range([this.internalHeight-15,15]); + + //Reposition and rescale axes + this.xAxisContainer + .style('top',this.margin.top+this.internalHeight+'px') + .style('width',this.internalWidth+'px') + .select('.axis') + .call(d3.axisBottom().scale(this.x)); + this.yAxisContainer + .style('height',this.internalHeight+'px') + .select('.axis') + .call(d3.axisLeft().scale(this.y)); + + this.redrawPoints(); + } + + /** + * Should be called whenever the data in the associated database changes. + * Will update scales, axes and selection to fit the new data. + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.updateData = function() { + + //Update scale domains + this.x.domain(this.db.dimensionDomains[this.xDimension]); + this.y.domain(this.db.dimensionDomains[this.yDimension]); + + //Rebuild axes + this.xAxisContainer.select('.axis') + .call(d3.axisBottom().scale(this.x)); + this.yAxisContainer.select('.axis') + .call(d3.axisLeft().scale(this.y)); + + this.redrawPoints(); + } + + //Shortcut function for redrawSelectedPoints, redrawHighlightedPoints and redrawOverlayPoints + CINEMA_COMPONENTS.ScatterPlot.prototype.redrawPoints = function() { + this.redrawSelectedPoints(); + this.redrawHighlightedPoints(); + this.redrawOverlayPoints(); + } + + /** + * Filter the given selection into only the points that can be shown + * on the plot (i.e. do not have NaN or undefined values on current dimensions) + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.getPlottablePoints = function(selection) { + var self = this; + return selection.filter(function(d) { + var xCoord = self.x(self.db.data[d][self.xDimension]); + var yCoord = self.y(self.db.data[d][self.yDimension]); + return !(isNaN(xCoord) || isNaN(yCoord)); + }); + } + + /** + * Set the chart's selection of data to the data represented + * by the given list of indices + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.setSelection = function(selection) { + this.selection = selection; + this.redrawSelectedPoints(); + } + + /** + * Set the chart's current highlighted data to the data represented + * by the given list of indices + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.setHighlightedPoints = function(indices) { + this.highlighted = indices; + this.redrawHighlightedPoints(); + } + + /** + * Set the current overlay points + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.setOverlayPoints = function(data) { + this.overlayData = data; + this.redrawOverlayPaths(); + }; + + /** + * Redraw the current selection of points. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.redrawSelectedPoints = function() { + throw new Error("Cannot call abstract function 'redrawSelectedPoints()'!"+ + " Please override function in a subclass"); + } + + /** + * Redraw the currently highlighted points. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.redrawHighlightedPoints = function() { + throw new Error("Cannot call abstract function 'redrawHighlightedPoints()'!"+ + " Please override function in a subclass"); + } + + /** + * Redraw the overlay points. + * Actual implementation is up to specific subclasses + */ + CINEMA_COMPONENTS.ScatterPlot.prototype.redrawOverlayPoints = function() { + throw new Error("Cannot call abstract function 'redrawOverlayPoints()'!"+ + " Please override function in a subclass"); + } +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * SCATTER_PLOT_CANVAS + * + * The ScatterPlotCanvas Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the ScatterplotCanvas Component: + * A subclass of ScatterPlot which draws data using canvas elements + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the ScatterPlot Component be included + if (!CINEMA_COMPONENTS.SCATTER_PLOT_INCLUDED) + throw new Error("CINEMA_COMPONENTS ScatterPlotCanvas Component requires that ScatterPlot"+ + " component be included. Please make sure that ScatterPlot component"+ + " is included BEFORE ScatterPlotCanvas module"); + + /** @type {boolean} - Flag to indicate that the ScatterPlotSVG Component has been included */ + CINEMA_COMPONENTS.SCATTER_PLOT_CANVAS_INCLUDED = true; + + /** + * Constructor for ScatterPlotCanvas Component + * Represents a component for displaying data on a 2D Scatter Plot + * Rendered with canvas elements + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.ScatterPlotCanvas = function(parent, database, filterRegex) { + var self = this; + + //call super-constructor + CINEMA_COMPONENTS.ScatterPlot.call(this,parent,database,filterRegex); + + //specify that this is a ScatterPlot Canvas component. + d3.select(this.container).classed('CANVAS',true); + + //Because not every point in the selection will be on the plot, + //need to keep track of plottablePoints so that their + //index can be used on indexCanvas + this.plottablePoints = []; + + //Add canvases to pathContainer + this.selectedCanvas = this.pointContainer.append('canvas') + .classed('selectedCanvas',true) + .node(); + this.highlightedCanvas = this.pointContainer.append('canvas') + .classed('highlightedCanvas',true) + .node(); + this.overlayCanvas = this.pointContainer.append('canvas') + .classed('overlayCanvas',true) + .node(); + //Index canvas is invisible and draws in a unique color for each path + //Its color data is used to determine which path is being moused over + this.indexCanvas = this.pointContainer.append('canvas') + .classed('indexCanvas',true) + .style('display','none') + .node(); + //Size/position canvases + this.pointContainer.selectAll('canvas') + .style('position','absolute'); + + //Determine screen DPI to rescale canvas contexts + //(prevents artifacts and blurring on some displays) + //https://stackoverflow.com/a/15666143/2827258 + this.pixelRatio = (function() { + var ctx = document.createElement('canvas').getContext("2d"), + dpr = window.devicePixelRatio || 1, + bsr = ctx.webkitBackingStorePixelRatio || + ctx.mozBackingStorePixelRatio || + ctx.msBackingStorePixelRatio || + ctx.oBackingStorePixelRatio || + ctx.backingStorePixelRatio || 1; + return dpr / bsr; + })(); + + //Loading/still drawing indicator + this.loading = d3.select(this.container).append('div') + .classed('loadingIndicator',true) + .style('display','none') + .text('Drawing...'); + + //Set an interval to call drawIterator if it exists + //roughly 60 times a second + this.interval = setInterval(function(self) { + for (var i = 0; i < 25; i++) { + if (self.drawIterator) { + if (self.drawIterator.next().done) { + self.drawIterator = undefined; + self.loading.style('display','none'); + } + } + } + }, 16, this); + + //Set up mousemove listener to get moused-over paths + this.lastMouseMove = null; //remember last result, to prevent excessive dispatch calls + this.pointContainer.on('mousemove', function() { + var x = d3.mouse(self.selectedCanvas)[0]*self.pixelRatio; + var y = d3.mouse(self.selectedCanvas)[1]*self.pixelRatio; + if (x >= 0 && y >= 0) { + var index = getIndexAtPoint(x,y,self.indexCanvas); + if (index != -1) { + if (self.lastMouseMove != self.plottablePoints[index]) { + self.lastMouseMove = self.plottablePoints[index]; + self.dispatch.call('mouseover',self,self.plottablePoints[index],d3.event); + } + } + else { + if (self.lastMouseMove !== null) { + self.lastMouseMove = null; + self.dispatch.call('mouseover',self,null,d3.event); + } + } + } + }); + + this.updateSize(); + } + //establish prototype chain + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype = Object.create(CINEMA_COMPONENTS.ScatterPlot.prototype); + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.constructor = CINEMA_COMPONENTS.ScatterPlotCanvas; + + /************************** + * OVERRIDE METHODS + **************************/ + + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.updateSize = function() { + var self = this; + //call super + CINEMA_COMPONENTS.ScatterPlot.prototype.updateSize.call(this); + + //Resize canvases + this.pointContainer.selectAll('canvas') + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px') + // width/height styles are distinct from attributes + // (attributes determine context size, style is the size the canvas appears in on screen) + .attr('width',this.internalWidth*this.pixelRatio+'px') + .attr('height',this.internalHeight*this.pixelRatio+'px') + .each(function(){ + this.getContext('2d').scale(self.pixelRatio,self.pixelRatio); + }); + //Init canvas contexts + var selectedContext = this.selectedCanvas.getContext('2d'); + selectedContext.fillStyle = 'rgba(82, 137, 163, 0.521)'; + selectedContext.strokeStyle = 'rgb(69, 121, 153)'; + selectedContext.lineWidth = 2; + var highlightedContext = this.highlightedCanvas.getContext('2d'); + highlightedContext.fillStyle = 'rgb(252, 127, 127)'; + highlightedContext.strokeStyle = 'rgb(153, 80, 80)'; + highlightedContext.lineWidth = 3; + + this.redrawPoints(); + } + + /** + * Redraw the current selection of points + */ + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.redrawSelectedPoints = function() { + var self = this; + + this.plottablePoints = this.getPlottablePoints(this.selection); + //Update warningReadout + if (this.plottablePoints.length < this.selection.length) + this.warningReadout.text((this.selection.length-this.plottablePoints.length) + + " point(s) could not be plotted (because they contain NaN or undefined values)."); + else + this.warningReadout.text(''); + + var ctx = this.selectedCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + var indexCtx = this.indexCanvas.getContext('2d'); + indexCtx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.drawIterator = (function*(queue){ + self.loading.style('display','initial'); + var i = 0; + while (i < queue.length) { + var x = self.x(self.db.data[queue[i]][self.xDimension]); + var y = self.y(self.db.data[queue[i]][self.yDimension]); + ctx.beginPath(); + ctx.arc(x,y,6,0,2*Math.PI); + ctx.fill(); + ctx.stroke(); + + indexCtx.fillStyle = indexToColor(i); + indexCtx.beginPath(); + indexCtx.arc(x,y,10,0,2*Math.PI); + indexCtx.fill(); + + yield ++i; + } + })(this.plottablePoints); + } + + /** + * Redraw the current selection of points + */ + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.redrawHighlightedPoints = function() { + var self = this; + + var plottable = this.getPlottablePoints(this.highlighted); + + var ctx = this.highlightedCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + plottable.forEach(function(d) { + var x = self.x(self.db.data[d][self.xDimension]); + var y = self.y(self.db.data[d][self.yDimension]); + ctx.beginPath(); + ctx.arc(x,y,10,0,2*Math.PI); + ctx.fill(); + ctx.stroke(); + }); + } + + /** + * Redraw the overlay points + */ + CINEMA_COMPONENTS.ScatterPlotCanvas.prototype.redrawOverlayPoints = function() { + var self = this; + + var ctx = this.overlayCanvas.getContext('2d'); + ctx.clearRect(0,0,this.internalWidth,this.internalHeight); + + this.overlayData.forEach(function(d) { + //Parse style + ctx.lineWidth = d.style.lineWidth || 0; + ctx.lineCap = d.style.lineCap || 'butt'; + ctx.lineJoin = d.style.lineJoin || 'miter'; + ctx.miterLimit = d.style.miterLimit || 10; + ctx.strokeStyle = d.style.strokeStyle || 'black'; + ctx.fillStyle = d.style.fillStyle || 'black'; + if (d.style.lineDash) + ctx.setLineDash(d.style.lineDash); + else + ctx.setLineDash([]); + //Draw line + var x = self.x(d.data[self.xDimension]); + var y = self.y(d.data[self.yDimension]); + ctx.beginPath(); + ctx.arc(x,y,(d.style.r || 6),0,2*Math.PI); + ctx.fill(); + ctx.stroke(); + }); + + } + + //Get the index of the path at the given point + //using the colors on the index canvas + //returns -1 if there is no path, or the area around the point is too noisy + var getIndexAtPoint = function(x,y,canvas) { + //get the color data for a 3x3 pixel area around the point + var colorData = canvas.getContext('2d').getImageData(x-1,y-1,3,3).data; + //get the index for each pixel + var indices = []; + for (var i = 0; i < colorData.length/4; i++) { + indices.push(colorToIndex(colorData.slice(i*4,i*4+3))); + } + + //for a positive match, must find at least 5 pixels with the same index + indices.sort(); + var matched = -1; + var count = 0; + var counting = -1; + for (var i = 0; i < indices.length; i++) { + if (counting != indices[i]) { + count = 1; + counting = indices[i]; + } + else { + count++; + if (count == 5) { + matched = counting; + break; + } + } + } + + return matched; + } + + //convert an index value to a color + //Mapping -1 through 256^3 to rgb(0,0,0) through rgb(255,255,255) + var indexToColor = function(i) { + if (i > 256*256*256) { + return 'rgb(255,255,255)'; + } + i++; + var b = Math.floor(i/256/256); + var g = Math.floor((i - b*256*256) / 256); + var r = (i - b*256*256 - g*256); + return 'rgb('+r+','+g+','+b+')'; + } + + //convert a color to an index value + //Mapping [0,0,0] through [255,255,255] to -1 through 256^3 + var colorToIndex = function(rgb) { + return (rgb[0] + rgb[1]*256 + rgb[2]*256*256)-1; + } + +})();'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * SCATTER_PLOT_SVG + * + * The ScatterPlotSVG Component for the CINEMA_COMPONENTS library. + * Contains the constructor for the ScatterplotSVG Component: + * A subclass of ScatterPlot which draws data using SVG + * + * @exports CINEMA_COMPONENTS + * + * @author Cameron Tauxe + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the ScatterPlot Component be included + if (!CINEMA_COMPONENTS.SCATTER_PLOT_INCLUDED) + throw new Error("CINEMA_COMPONENTS ScatterPlotSVG Component requires that ScatterPlot"+ + " component be included. Please make sure that ScatterPlot component"+ + " is included BEFORE ScatterPlotSVG module"); + + /** @type {boolean} - Flag to indicate that the ScatterPlotSVG Component has been included */ + CINEMA_COMPONENTS.SCATTER_PLOT_SVG_INCLUDED = true; + + /** + * Constructor for ScatterPlotSVG Component + * Represents a component for displaying data on a 2D Scatter Plot + * Rendered with SVG + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.ScatterPlotSVG = function(parent, database, filterRegex) { + //call super-constructor + CINEMA_COMPONENTS.ScatterPlot.call(this,parent,database,filterRegex); + + //specify that this is a ScatterPlot SVG component. + d3.select(this.container).classed('SVG',true); + + //Add SVG Components to pointContainer + this.svg = this.pointContainer.append('svg') + .style('position','absolute') + .attr('viewBox','0 0 '+this.internalWidth+' '+this.internalHeight) + .attr('preserveAspectRatio','none') + .attr('width','100%') + .attr('height','100%'); + //Add group for selected points + this.selectedPoints = this.svg.append('g') + .classed('selectedPoints',true); + //Add group for highlighted points + this.highlightedPoints = this.svg.append('g') + .classed('highlightedPoints',true); + //Add group for overlay points + this.overlayPoints = this.svg.append('g') + .classed('overlayPoints',true); + + this.redrawPoints(); + } + //establish prototype chain + CINEMA_COMPONENTS.ScatterPlotSVG.prototype = Object.create(CINEMA_COMPONENTS.ScatterPlot.prototype); + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.constructor = CINEMA_COMPONENTS.ScatterPlotSVG; + + /************************** + * OVERRIDE METHODS + **************************/ + + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.updateSize = function() { + //call super + CINEMA_COMPONENTS.ScatterPlot.prototype.updateSize.call(this); + + //rescale svg + this.svg.attr('viewBox','0 0 '+this.internalWidth+' '+this.internalHeight); + } + + /** + * Redraw the current selection of points + */ + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.redrawSelectedPoints = function() { + var self = this; + var plottable = this.getPlottablePoints(this.selection); + //Update warningReadout + if (plottable.length < this.selection.length) + this.warningReadout.text((this.selection.length-plottable.length) + + " point(s) could not be plotted (because they contain NaN or undefined values)."); + else + this.warningReadout.text(''); + //Bind to selection and update + var update = this.selectedPoints + .selectAll('circle').data(plottable); + update.enter() //ENTER + .append('circle') + .attr('r','6') + .merge(update) //ENTER + UPDATE + .attr('index',function(d){return d;}) + .attr('cx',function(d) { + return self.x(self.db.data[d][self.xDimension]); + }) + .attr('cy',function(d) { + return self.y(self.db.data[d][self.yDimension]); + }) + .on('mouseenter',function(d) { + self.dispatch.call('mouseover',self,d,d3.event); + }) + .on('mouseleave',function(d) { + self.dispatch.call('mouseover',self,null,d3.event); + }); + update.exit() + .remove(); + } + + /** + * Redraw the set of highlighted points + */ + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.redrawHighlightedPoints = function() { + var self = this; + //Bind to selection and update + var update = this.highlightedPoints + .selectAll('circle').data(this.getPlottablePoints(this.highlighted)); + update.enter() //ENTER + .append('circle') + .attr('r','10') + .merge(update) //ENTER + UPDATE + .attr('index',function(d){return d;}) + .attr('cx',function(d) { + return self.x(self.db.data[d][self.xDimension]); + }) + .attr('cy',function(d) { + return self.y(self.db.data[d][self.yDimension]); + }); + update.exit() + .remove(); + } + + /** + * Redraw the overlay points + */ + CINEMA_COMPONENTS.ScatterPlotSVG.prototype.redrawOverlayPoints = function() { + var self = this; + //Bind to selection and update + var update = this.overlayPoints + .selectAll('circle').data(this.overlayData); + update.enter() //ENTER + .append('circle') + .attr('r','5') + .merge(update) //ENTER + UPDATE + .attr('cx',function(d) { + return self.x(d.data[self.xDimension]); + }) + .attr('cy',function(d) { + return self.y(d.data[self.yDimension]); + }) + .attr('style',function(d) { + return d.style; + }); + update.exit() + .remove(); + } + +})(); +'use strict'; +(function() { + /** + * CINEMA_COMPONENTS + * LineChart + * + * The LineChart Component for the CINEMA_COMPONENTS library. + * It is a sublcass of Component + * + * This component views multiple parameters as a line chart. + * + * @exports CINEMA_COMPONENTS + * + * @author Robin Maack + */ + + //If CINEMA_COMPONENTS is already defined, add to it, otherwise create it + var CINEMA_COMPONENTS = {} + if (window.CINEMA_COMPONENTS) + CINEMA_COMPONENTS = window.CINEMA_COMPONENTS; + else + window.CINEMA_COMPONENTS = CINEMA_COMPONENTS; + + //Require that the Component module be included + if (!CINEMA_COMPONENTS.COMPONENT_INCLUDED) + throw new Error("CINEMA_COMPONENTS LineChart module requires that Component"+ + " module be included. Please make sure that Component module"+ + " is included BEFORE LineChart module"); + + //Require that d3 be included + if (!window.d3) { + throw new Error("CINEMA_COMPONENTS LineChart module requires that"+ + " d3 be included (at least d3v5). Please make sure that d3 is included BEFORE the"+ + " the Pcoord module"); + } + + /** @type {boolean} - Flag to indicate that the LineChart module has been included */ + CINEMA_COMPONENTS.LINECHART_INCLUDED = true; + + /** + * Abstract constructor for LineCart Components + * Represents a component for displaying and interacting with a database on a chart with multiple lines + * @param {DOM} parent - The DOM object to build this component inside of + * @param {CINEMA_COMPONENTS.Database} database - The database behind this component + * @param {RegExp} filterRegex - A regex to determine which dimensions to NOT show on the component + */ + CINEMA_COMPONENTS.LineChart = function(parent, database, filterRegex, image_measures, excluded_dimensions) { + var self = this; + + //call super-constructor + CINEMA_COMPONENTS.Component.call(this,parent,database,filterRegex); + + //Allowed prefixes for image measures, check for unused beforehand + if(typeof image_measures !== 'undefined') { + this.allowedUPrefixes = []; + const image_measuresLength = image_measures.length; + for (var i = 0; i < image_measuresLength; i++) { + for (var key in self.db.dimensionTypes) { + if(key.startsWith(image_measures[i])) { + this.allowedUPrefixes.push(image_measures[i]); + break; + } + } + } + } + + //Excluded dimensions for x-axis + this.excludedDim = excluded_dimensions; + + /*************************************** + * SIZING + ***************************************/ + + /** @type {CINEMA_COMPONENTS.Margin} Override default margin */ + this.margin = new CINEMA_COMPONENTS.Margin(20,30,50,170); + + /** @type {CINEMA_COMPONENTS.Margin} Margins of axis to the SVG plane */ + this.axismargin = new CINEMA_COMPONENTS.Margin(15,15,15,15); + + /*************************************** + * DATA + ***************************************/ + + /** @type {String} The currently selected dimensions for each axis*/ + this.xDimension = this.dimensions[0]; + + /** @type {Object} Currently selected data point*/ + this.currentlySelectedPoint = {}; + + /** @type {Object} Data to be shown by the plot*/ + this.plotData = {}; + + //Prepare the plot data + this.prepareData(); + + /*************************************** + * EVENTS + ***************************************/ + + /** @type {d3.dispatch} Hook for events on chart + * Set handlers with on() function. + * 'selectionchanged': Triggered when the user makes a selection. + * (called with the index of mouse up data and a reference to the mouse event) + * 'xchanged': Triggered when the x dimension being viewed is changed + * (called with the new dimension as an argument) + */ + this.dispatch = d3.dispatch("selectionchanged", "xchanged"); + + /*************************************** + * DRAGGING + ***************************************/ + + /** @type {boolean} Is left mouse button pushed down*/ + this.dragging = false; + + /** @type {int} svg x position where mouse left mouse button was pushed down*/ + this.dragStartX = 0; + + /** @type {Object} Save selected data when mouse button was pushed down*/ + this.dragStartData = {}; + + /** @type {Object} Save start and end data if drag action */ + this.dragResult = {}; + + /*************************************** + * DOM Content + ***************************************/ + + /** Main Container **/ + + //Give plot container a class + d3.select(this.container).classed('LINE_CHART',true); + + //Add a div as main container to add other components later + this.mainContainer = d3.select(this.container).append('div') + .classed('mainContainer',true) + .style('position','absolute') + .style('top',this.margin.top+'px') + .style('right',this.margin.right+'px') + .style('bottom',this.margin.bottom+'px') + .style('left',this.margin.left+'px') + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px'); + + /** Dimension selection for x-axis **/ + + //Get all non image measure and non file dimensions + this.validDim = []; + for(var i=0, len=self.dimensions.length; i < len; i++) { + if(!(self.dimensions[i].startsWith("FILE") || + startsWithPrefixes(self.dimensions[i], this.allowedUPrefixes) || + startsWithPrefixes(self.dimensions[i], this.excludedDim))) { + self.validDim.push(self.dimensions[i]); + } + } + + //Add Dimension selection dropdown menu + this.xSelect = d3.select(this.container).append('select') + .classed('dimensionSelect x', true) + .style('position','absolute') + .node(); + + //Add all options to dropdown menu + d3.select(this.xSelect).selectAll('option') + .data(this.validDim) + .enter().append('option') + .attr('value',function(d){return d;}) + .text(function(d){return d;}); + d3.select(this.xSelect).node().value = this.xDimension; + + //Define actions when a new Dimension is selected + d3.select(this.xSelect).on('input',function() { + self.xDimension = this.value; + self.prepareData(); + self.x = (self.db.isStringDimension(self.xDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(self.plotData.dimensionDomain); + self.xAxisContainer.select('.axis') + .call(d3.axisBottom().scale(self.x)); + self.dispatch.call('xchanged',self,self.xDimension); + self.updateLineVisibility(); + self.redraw(); + }); + + /** Checkboxtable for selecting uncertainty measures **/ + + this.tableContainer = d3.select(this.container).append('div') + .classed('tableContainer',true) + .style('position','absolute') + .style('top', 20 + 'px') + .style('left', 5 + 'px') + .style('bottom',this.margin.bottom+'px') + .style('overflow-y', 'auto') + .style('overflow-x', 'hidden'); + + //Set the checkboxes for the whole group and update + this.updateLineGroupVisibility = function() { + d3.selectAll(".lineGroupSelectCheckbox").each(function(d) { + const cbgroup = d3.select(this); + d3.selectAll(".lineSelectCheckbox").each(function(d) { + const cb = d3.select(this); + if(cb.property("value").startsWith(cbgroup.property("value"))) + cb.property("checked", cbgroup.property("checked")); + }); + }); + self.updateLineVisibility(); + } + + //Function to toggle Checkboxes for uncertainty measures + this.updateLineVisibility = function() { + d3.selectAll(".lineSelectCheckbox").each(function(d) { + const cb = d3.select(this); + self.setLineVisibility(cb.property("value"), cb.property("checked")); + }); + self.redraw(); + } + + /** Measure group checkboxes **/ + + //Table containing the checkboxes + this.ySelectGroupTable = self.tableContainer + .append('table') + .classed("lineSelect yGroup", true); + + //Rows in the checkbox table + this.yTableGroupRows = this.ySelectGroupTable.selectAll('tr') + .classed("lineSelectRow y", true) + .data(this.allowedUPrefixes) + .enter().append('tr'); + + //Add checkboxes to the table + this.yTableGroupRows.selectAll('td') + .data((d) => [d]) + .enter() + .append('td') + .append("input") + .classed("lineGroupSelectCheckbox", true) + .attr("checked", true) + .attr("type", "checkbox") + .attr("id", function(d,i) { return 'a'+i; }) + .attr("value", (d) => d) + .on("change", self.updateLineGroupVisibility); + + //Add text next to the checkboxes + this.yTableGroupRows.selectAll("td") + .data((d) => [d]) + .append("text") + .classed("lineGroupSelect checkboxtext", true) + .text((d) => "All " + d); + + /** Measure checkboxes **/ + + //Table containing the checkboxes + this.ySelectTable = self.tableContainer + .append('table') + .classed("lineSelect y", true); + + //Rows in the checkbox table + this.yTableRows = this.ySelectTable.selectAll('tr') + .classed("lineSelectRow y", true) + .data(self.plotData.series) + .enter().append('tr'); + + //Add checkboxes to the table + this.yTableRows.selectAll('td') + .data((d) => [d]) + .enter() + .append('td') + .append("input") + .classed("lineSelectCheckbox", true) + .attr("checked", true) + .attr("type", "checkbox") + .attr("id", function(d,i) { return 'a'+i; }) + .attr("value", (d) => d.name) + .on("change", self.updateLineVisibility); + + //Add text next to the checkboxes + this.yTableRows.selectAll("td") + .data((d) => [d]) + .append("text") + .classed("lineSelect checkboxtext", true) + .text((d) => d.name); + + /** SVG plane **/ + + this.initChart = function() { + /** SVG plane creation **/ + + //Create svg plane + this.svg = this.mainContainer.append('svg') + .attr('class','lineChart') + .attr('viewBox','0 0 '+this.internalWidth+' '+this.internalHeight) + .attr('preserveAspectRatio','none') + .attr('width','100%') + .attr('height','100%'); + + //set svg position + this.svg.style("position", "relative"); + + //Add interaction to the svg plane + this.svg + .on('mousemove', function() { + self.moved(d3.event); + }) + .on('mouseenter', function() { + self.entered(d3.event); + }) + .on('mouseleave', function() { + self.left(d3.event); + }) + .on("mousedown", function() { + self.down(d3.event); + }) + .on("mouseup", function() { + self.up(d3.event); + }); + + /** + * Gets called when the mouse is moved inside the svg plane + * Highlights the selected path and changes the selected data point + * Updates the dragging square if currently dragging + * @type {Object} eventdata - Mouse event data + */ + this.moved = function(eventdata) { + var self = this; + if(this.getVisibileLineCount()) { + //Prevent selecting text + eventdata.preventDefault(); + + //Get currently selected data point + var currentDatapoint = this.getMousePositionData(eventdata); + + //If dragging update dragging square + if(this.dragging) { + //Startpoint is right of current position + if(self.dragStartX > eventdata.layerX){ + self.svg.select("rect") + .attr("x", eventdata.layerX) + .attr("width", self.dragStartX - eventdata.layerX); + } + //Startpoint is left of current position + else { + self.svg.select("rect") + .attr("width", eventdata.layerX - self.dragStartX); + } + } + + //Redraw paths and dot + this.path.selectAll("path").attr("stroke", d => d === currentDatapoint.series ? null : "#ddd").filter(d => d === currentDatapoint.series).raise(); + this.dot.attr("transform", `translate(${self.x(currentDatapoint.date)},${self.y(currentDatapoint.value)})`); + this.dot.select("#dot_name_text").attr("overflow", "visible").text(currentDatapoint.umeasurename); + this.dot.select("#dot_number_text").attr("overflow", "visible").text(currentDatapoint.value.toFixed(2)); + } + } + + /** + * Gets called when the mouse enters the svg plane + * Resets the paths and dot + * @type {Object} eventdata - Mouse event data + */ + this.entered = function() { + if(this.getVisibileLineCount()) { + this.path.selectAll("path").style("mix-blend-mode", null).attr("stroke", "#ddd"); + this.dot.attr("display", null); + } + } + + /** + * Gets called when the mouse leaves the svg plane + * Resets the paths and dot + * @type {Object} eventdata - Mouse event data + */ + this.left = function() { + var self = this; + + //Reset paths and dot + if(this.getVisibileLineCount()) { + this.path.selectAll("path").style("mix-blend-mode", "multiply").attr("stroke", null); + this.dot.attr("display", "none"); + } + //Prevent draging from continuing and show failure(red square) + if(self.dragging) { + self.dragging = false; + self.svg.selectAll("rect") + .transition() + .duration(100) + .attr("stroke-width", 10) + .attr("stroke", "red") + .delay(200) + .transition() + .duration(1000) + .attr("opacity", 0.0) + .remove(); + } + } + + /** + * Gets called when the mouse gets pushed down on the svg plane + * Saves the start position and data + * Creates the dragging rectange + * @type {Object} eventdata - Mouse event data + */ + this.down = function(eventdata) { + var self = this; + + if(eventdata.button === 0) { + //Prevent selecting text + eventdata.preventDefault(); + + //Set dragging values + self.dragging = true; + self.dragStartData = this.getMousePositionData(eventdata); + self.dragStartX = eventdata.layerX; + + //Create dragging rectange + var rect = this.svg.append("rect") + .attr("x", self.dragStartX) + .attr("y", 0) + .attr("width", 1) + .attr("height", self.svg.style("height")) + .attr("opacity", 0.5) + .attr("fill", "yellow"); + } + } + + /** + * Gets called when the mouse gets released on the svg plane + * Calculates the result of dragging(selected Data) + * Draws the "green rectange" and destroys it + * @type {Object} eventdata - Mouse event data + */ + this.up = function(eventdata) { + var self = this; + + if(eventdata.button === 0 && self.dragging) { + //Stop dragging + self.dragging = false; + + //Get data point ad end location + var dragEndData = this.getMousePositionData(eventdata); + + //Calculate the selected start and end date + self.dragResult = { + dimension : self.xDimension, + startDate: self.x(self.dragStartData.date) < self.x(dragEndData.date) ? self.dragStartData.date : dragEndData.date, + endDate: self.x(self.dragStartData.date) > self.x(dragEndData.date) ? self.dragStartData.date : dragEndData.date + } + + //Adjusted X and Y position of the rectange to include all selected data + var adjustedStartX = self.x(self.dragResult.startDate); + var adjustedEndX = self.x(self.dragResult.endDate); + + //Solve problem with 0 width rectange + if(adjustedStartX === adjustedEndX) { + adjustedStartX -= 1; + adjustedEndX += 1; + } + + //Draw animation and destroy + self.svg.selectAll("rect") + .transition() + .duration(500) + .attr("x", adjustedStartX) + .attr("width", adjustedEndX - adjustedStartX) + .delay(50) + .transition() + .duration(100) + .attr("stroke-width", 10) + .attr("stroke", "green") + .delay(200) + .transition() + .duration(1000) + .attr("opacity", 0.0) + .remove(); + + this.dispatch.call('selectionchanged',self, self.dragResult); + } + } + + /** Draw paths **/ + + //Line to draw on svg plane, mapping data and indexes to lines + this.chartline = d3.line() + .defined(d => !isNaN(d)) + .x((d, i) => this.x(this.plotData.dates[i])) + .y(d => this.y(d)); + + //Create all g elements for lines in the plot + this.path = this.svg.append("g") + .attr("fill", "none") + .attr("stroke", "steelblue") + .attr("stroke-width", 1.5) + .attr("stroke-linejoin", "round") + .attr("stroke-linecap", "round") + + //Add all chartlines + this.path.selectAll("path") + .data(this.plotData.series.filter(entry => entry.show)) + .join("path") + .style("mix-blend-mode", "multiply") + .attr("d", d => self.chartline(d.values)); + + /** Add dot/circle to show current data point **/ + + //create Dot g element to show currently selected data + this.dot = this.svg.append("g") + .attr("display", "none"); + + //Add the circle + this.dot.append("circle") + .attr("r", 2.5); + + //Add text showing the uncertainty measure name + this.dot.append("text") + .attr("id", "dot_name_text") + .style("font", "10px sans-serif") + .attr("text-anchor", "middle") + .attr("y", -6); + + //Add text showing the current value of the uncertainty measure + this.dot.append("text") + .attr("id", "dot_number_text") + .style("font", "10px sans-serif") + .attr("text-anchor", "middle") + .attr("y", +10); + + return this.svg.node(); + } + + /*************************************** + * AXES + ***************************************/ + + /** @type {d3.scalePoint} - Scale for x axis on chart + * Maps dimension value to position (in pixels) along width of chart.*/ + this.x = (this.db.isStringDimension(this.xDimension) ? d3.scalePoint() : d3.scaleLinear()) + .domain(self.plotData.dimensionDomain) + .range([this.axismargin.left,self.internalWidth - this.axismargin.right]); + + /** @type {d3.scalePoint} - Scale for x axis on chart + * Maps measure values to position (in pixels) along height of chart.*/ + this.y = d3.scaleLinear() + .domain([0, d3.max(this.plotData.series, d => d3.max(d.values))]).nice() + .range([self.internalHeight - this.axismargin.bottom,this.axismargin.top]); + + //Container for the x-axis + this.xAxisContainer = d3.select(this.container).append('svg') + .classed('axisContainer x',true) + .style('position','absolute') + .style('width',this.internalWidth+'px') + .style('height',25+'px') + .style('top',this.margin.top+this.internalHeight+'px') + .style('left',this.margin.left+'px'); + + //Container for the y-axis + this.yAxisContainer = d3.select(this.container).append('svg') + .classed('axisContainer y',true) + .style('position','absolute') + .style('width',50+'px') + .style('height',this.internalHeight+'px') + .style('left',(this.margin.left-50)+'px') + .style('top',this.margin.top+'px'); + + //Draw the x-axis + this.xAxisContainer.append('g') + .classed('axis',true) + .call(d3.axisBottom().scale(this.x)); + + //Draw the y-axis + this.yAxisContainer.append('g') + .classed('axis',true) + .attr('transform','translate(50)') + .call(d3.axisLeft().scale(this.y)); + + //Save the width of the axis line to adjust the graph later on + this.axislineWidth = parseInt(getComputedStyle( + document.querySelector('.CINEMA_COMPONENT.LINE_CHART .axis line')) + .getPropertyValue('stroke-width'), 10); + + //Set the position of both axis + this.xAxisContainer.style('top',this.margin.top+this.internalHeight+this.axislineWidth+'px'); + this.yAxisContainer.style('left', (this.margin.left - 50 - this.axislineWidth) +'px'); + + /** @type {d3.selection (svg)} The SVG element containing all the content of the svg plane */ + this.chart = this.initChart(); + + //Draw + this.redraw(); + } + //establish prototype chain + CINEMA_COMPONENTS.LineChart.prototype = Object.create(CINEMA_COMPONENTS.Component.prototype); + CINEMA_COMPONENTS.LineChart.prototype.constructor = CINEMA_COMPONENTS.LineChart; + /** + * Should be called every time the size of the chart's container changes. + * Updates the sizing and scaling of all parts of the chart and redraws + */ + CINEMA_COMPONENTS.LineChart.prototype.updateSize = function() { + var self = this; + + //Call super (will recalculate size) + CINEMA_COMPONENTS.Component.prototype.updateSize.call(this); + + if(this.internalHeight > 100){ + //update mainContainer size + this.mainContainer + .style('width',this.internalWidth+'px') + .style('height',this.internalHeight+'px'); + + //update svg plane size + this.svg.attr('viewBox','0 0 '+this.internalWidth+' '+this.internalHeight); + + //Rescale + this.x.range([this.axismargin.left, this.internalWidth - this.axismargin.right]); + this.y.range([this.internalHeight - this.axismargin.bottom, this.axismargin.top]); + + //Update the x-axis + this.xAxisContainer + .style('width',this.internalWidth+'px') + .style('top',this.margin.top+this.internalHeight+this.axislineWidth+'px') + .select('.axis') + .call(d3.axisBottom().scale(this.x)); + + //Update the y-axis + this.yAxisContainer + .style('height',this.internalHeight+'px') + .select('.axis') + .call(d3.axisLeft().scale(this.y)); + + //Update the chart line drawing method + this.chartline + .x((d, i) => (this.plotData.isNonNumberDomain ? + self.x(this.plotData.dimensionDomain[i]) : + self.x(this.plotData.dates[i]))) + .y(d => this.y(d)) + + //Redraw all paths + this.path.selectAll("path") + .attr("d", d => self.chartline(d.values)); + } + }; + + /** + * Receive the closest data point to the current mouse location + * @type {Object} eventdata - Mouse event data + */ + CINEMA_COMPONENTS.LineChart.prototype.getMousePositionData = function(eventdata) { + var self = this; + + var scaleBandInvert = function(scale) { + var domain = self.x.domain(); + var paddingOuter = self.x(domain[0]); + var eachBand = self.x.step(); + return function (value) { + return Math.floor(((value - paddingOuter + (eachBand / 2)) / eachBand)); + //return domain[Math.max(0,Math.min(index, domain.length-1))]; + } + } + + //If any line is visible + if(this.getVisibileLineCount()) { + //Get the index of the closest x; + var ym = this.y.invert(eventdata.layerY); + var i; + + if(self.plotData.isNonNumberDomain) { + i = scaleBandInvert(self.x)(eventdata.layerX); + } + else { + var xm = this.x.invert(eventdata.layerX); + var i1 = d3.bisectLeft(this.plotData.dates, xm, 1); + var i0 = i1 - 1; + i = xm - self.plotData.dates[i0] > self.plotData.dates[i1] - xm ? i1 : i0; + } + + //Find closest point + var s = this.plotData.series.filter(entry => entry.show).reduce((a, b) => Math.abs(a.values[i] - ym) < Math.abs(b.values[i] - ym) ? a : b); + + //Save the selected point + this.currentlySelectedPoint = { + date: self.plotData.dates[i], + value: s.values[i], + umeasurename: s.name, + series: s + } + return this.currentlySelectedPoint; + } + } + + /** + * Redraw the chart path + */ + CINEMA_COMPONENTS.LineChart.prototype.redraw = function() { + var self = this; + + //Rescale x-axis + self.x + .domain(self.plotData.dimensionDomain) + .range([self.axismargin.left, self.internalWidth - self.axismargin.right]); + + //Rescale y-axis + self.y + .domain([ + d3.min(self.plotData.series.filter(entry => entry.show), d => d3.min(d.values)), + d3.max(self.plotData.series.filter(entry => entry.show), d => d3.max(d.values)) + ]).nice() + .range([self.internalHeight - self.axismargin.bottom, self.axismargin.top]); + + //Redraw x-axis + self.xAxisContainer + .select('.axis') + .call(d3.axisBottom().scale(self.x)); + + //Redraw y-axis + self.yAxisContainer + .select('.axis') + .call(d3.axisLeft().scale(self.y)); + + //Recalculate chartline method + self.chartline + .x((d, i) => (this.plotData.isNonNumberDomain ? + self.x(this.plotData.dimensionDomain[i]) : + self.x(this.plotData.dates[i]))) + .y(d => self.y(d)); + + //Enter Update Exit paths + var updatePaths = self.path.selectAll("path") + .data(this.plotData.series.filter(entry => entry.show)); + + updatePaths.enter() + .append('path') + .merge(updatePaths) + .join("path") + .style("mix-blend-mode", "multiply") + .attr("d", d => self.chartline(d.values)); + + updatePaths.exit() + .remove(); + }; + + /** + * Take the data from cinema DB and put it in a format readable for the plot + */ + CINEMA_COMPONENTS.LineChart.prototype.prepareData = function() { + var self = this; + + //Check if non number dimensions + var isNonNumberDomain = isNaN(this.db.dimensionDomains[this.xDimension][0]); + + //Retrieve all uncertainty dimensions + var uncertaintyDims = []; + for(var i=0, len=this.dimensions.length; i < len; i++) + if(startsWithPrefixes(self.dimensions[i], this.allowedUPrefixes) + && !startsWithPrefixes(self.dimensions[i], this.excludedDim)) + uncertaintyDims.push(this.dimensions[i]); + + //Retrieve all possible values of the current dimension + var dataDates = []; + if(isNonNumberDomain) { + dataDates = self.db.dimensionDomains[self.xDimension]; + } + else { + this.db.data.forEach(function(value) { + if(!containedInArray.call(dataDates, Number(value[self.xDimension]))) { + dataDates.push(Number(value[self.xDimension])); + } + }); + dataDates.sort(function(a, b){return a-b}); + } + + //Create data template + var dataSeries = []; + uncertaintyDims.forEach(function(value) { + dataSeries.push({ + name: value, + values : Array(dataDates.length).fill(0), + occurences : Array(dataDates.length).fill(0), + show : true + }); + }); + + //Fill with data values / Sum on same dimension value and count occurences + this.db.data.forEach(function(dataRow) { + var currentIndex = 0; + if(isNonNumberDomain) { + currentIndex = dataDates.indexOf(dataRow[self.xDimension]); + } + else { + currentIndex = dataDates.indexOf(Number(dataRow[self.xDimension])); + } + + dataSeries.forEach(function(dataSeriesObject) { + if(!isNaN(dataRow[dataSeriesObject.name])) { + dataSeriesObject.values[currentIndex] += parseFloat(dataRow[dataSeriesObject.name]); + dataSeriesObject.occurences[currentIndex] += 1; + } + }); + }); + + //Divide by occurences to retrieve the average + dataSeries.forEach(function(dataSeriesObject, indexObject) { + dataSeriesObject.values.forEach(function(dataValue, index) { + dataSeries[indexObject].values[index] = dataValue / dataSeriesObject.occurences[index]; + }); + }); + + //Add summed uncertainty measures for each dimension type => e.g. Total avg brightness uncertainty + this.allowedUPrefixes.forEach(function(uncertaintyDim, index) { + var averageUncertainty = Array(dataDates.length).fill(0); + var count = 0; + + //Sum and count + dataSeries.forEach(function(dataSeriesObject, indexObject) { + if(dataSeriesObject.name.startsWith(uncertaintyDim)) + { + dataSeriesObject.values.forEach(function(value, index) { + averageUncertainty[index] += value; + }); + count += 1; + } + }); + + //Calculate averages + if(count > 0) { + averageUncertainty.forEach(function(value, index) { + averageUncertainty[index] = value / count; + }); + + //Put into object + dataSeries.push({ + name: uncertaintyDim + " Uncertainty", + values : averageUncertainty, + occurences : count, + show : true + }); + } + }); + + //Combine the data + this.plotData = { + series: dataSeries, + dates: dataDates, + dimensionDomain : self.db.dimensionDomains[self.xDimension], + isNonNumberDomain : isNonNumberDomain + }; + }; + + /** + * Set the visibility of a line by using the uncertainty measure name + * @type {String} name - name of uncertainty measure + * @type {boolean} isShown - if the line shoudl be shown + */ + CINEMA_COMPONENTS.LineChart.prototype.setLineVisibility = function(name, isShown) { + var self = this; + for(var i = 0; i < this.plotData.series.length; i++) { + if(self.plotData.series[i].name === name) { + self.plotData.series[i].show = isShown; + break; + } + } + } + + /** + * Retrieve the amount of visible lines + */ + CINEMA_COMPONENTS.LineChart.prototype.getVisibileLineCount = function() { + return this.plotData.series.filter(entry => entry.show).length; + } + + /** + * Get the state of all checkboxes + */ + CINEMA_COMPONENTS.LineChart.prototype.getCheckboxStates = function() { + var lineGroupSelectData = []; + d3.selectAll(".lineGroupSelectCheckbox").each(function(d) { + const cb = d3.select(this); + lineGroupSelectData.push([cb.property("value"), cb.property("checked")]); + }); + var lineSelectData = []; + d3.selectAll(".lineSelectCheckbox").each(function(d) { + const cb = d3.select(this); + lineSelectData.push([cb.property("value"), cb.property("checked")]); + }); + + return {lineGroup: lineGroupSelectData, line: lineSelectData}; + } + + /** + * Set the state of all checkboxes + */ + CINEMA_COMPONENTS.LineChart.prototype.setCheckboxStates = function(dataObject) { + d3.selectAll(".lineSelectCheckbox").each(function(d) { + const cb = d3.select(this); + for(var i = 0; i < dataObject.line.length; i++) { + if(dataObject.line[i][0] === cb.property("value")) + cb.property("checked", dataObject.line[i][1]) ; + } + }); + var lineGroupSelectData = []; + d3.selectAll(".lineGroupSelectCheckbox").each(function(d) { + const cb = d3.select(this); + for(var i = 0; i < dataObject.lineGroup.length; i++) { + if(dataObject.lineGroup[i][0] === cb.property("value")) + cb.property("checked", dataObject.lineGroup[i][1]); + } + }); + this.updateLineVisibility(); + } + + /** + * Retrieve if a value is contained in an array + * @param {ANY} needle - Element to search for in Array + */ + var containedInArray = function(needle) { + //Per spec, the way to identify NaN is that it is not equal to itself + var findNaN = needle !== needle; + var indexOf; + + if(!findNaN && typeof Array.prototype.indexOf === 'function') { + indexOf = Array.prototype.indexOf; + } + else { + indexOf = function(needle) { + var i = -1, index = -1; + + for(i = 0; i < this.length; i++) { + var item = this[i]; + + if((findNaN && item !== item) || item === needle) { + index = i; + break; + } + } + + return index; + }; + } + + return indexOf.call(this, needle) > -1; + }; + + /** @type {RegExp} - Regular Expression to check for scientific notation*/ + const scientificNotationRegExp = new RegExp(/^((\d)+|(\d+\.\d+))(e|E)(\+|-)(\d)+$/); + + /** + * Check if numberString is in scientifc notation + * @param {String} numberString - String which might contain a scientific notation + */ + var isInScientificNotation = function(numberString) { + if(typeof numberString === 'string' || numberString instanceof String) + if(scientificNotationRegExp.test(numberString)) + return true; + return false; + } + + /** + * Checks if a dimension name starts with a string from the list + * @type {String} dimension - name of the dimension to check + * @type {Array} prefixList - list of prefixes + */ + var startsWithPrefixes = function(dimension, prefixList) { + if(typeof prefixList === 'undefined') + return false; + for(var i = 0; i < prefixList.length; i++) { + if(dimension.startsWith(prefixList[i])) + return true; + } + return false; + } + +})(); diff --git a/examples/WitU/cintools/cinema.source/explorer/1.9/cinema_explorer.html b/examples/WitU/cintools/cinema.source/explorer/1.9/cinema_explorer.html new file mode 100644 index 00000000..dc8881ad --- /dev/null +++ b/examples/WitU/cintools/cinema.source/explorer/1.9/cinema_explorer.html @@ -0,0 +1,124 @@ + + + + + Cinema:Explorer + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+ > +
+
+ +
+ +
+ +
+ Smooth Lines +
+
+ +
+
+ + + +
+
Image Spread
+
Scatter Plot
+
Line Chart
+
+ +
+ + + + + diff --git a/examples/WitU/cintools/cinema.source/explorer/1.9/css/viewer.css b/examples/WitU/cintools/cinema.source/explorer/1.9/css/viewer.css new file mode 100644 index 00000000..e78b3e57 --- /dev/null +++ b/examples/WitU/cintools/cinema.source/explorer/1.9/css/viewer.css @@ -0,0 +1,213 @@ +/* +A general Parallel Coordinates-based viewer for Spec-D cinema databases + +pcoord_viewer Version 1.8 + +Copyright 2017 Los Alamos National Laboratory + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +body { + background-color: gray; + margin: initial; + overflow: hidden; + + color: #404040; + font-family: Ubuntu, Tahoma, Helvetica, sans-serif +} + +#top { + box-sizing: border-box; + box-shadow: 0px 4px 4px black; +} + +#header { + border-bottom: 3px solid rgba(100,100,100,0.35); + background: #e2e2e2; + padding: 6px 24px 6px; +} + +#header h1 { + display: inline-block; + margin: initial; +} + +#databaseControls, +#axisOrderPanel { + display: inline-block; + margin-left: 40px; +} + +#pcoordArea { + position: relative; + height: 300px; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + padding: 10px 25px 15px; + background-color: whitesmoke; +} + +#slideOut { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 25px; + background-color: rgba(25,25,25,0.85); +} +#slideOutContents { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 25px; + padding: 5px; + box-sizing: border-box; + overflow: auto; + white-space: nowrap; +} +#queryContainer { + width: 100%; + height: 100%; +} + +#showHideButton { + position: absolute; + top: 0; + bottom: 0; + right: 0; + width: 25px; + background-color: #e2e2e2; +} +#showHideButton:hover { + background-color: lightgray;; +} +#showHideLabel { + font-size: 24px; + font-weight: bold; + position: absolute; + top: 50%; + left: 50%; + transform: translateY(-50%) translateX(-50%); +} + +#pcoordContainer { + width: 100%; + height: 100%; +} + +#smoothLinesWrapper { + position: absolute; + top: 3px; + right: 10px; + font-size: 12px; +} + +#selectionStats { + position: absolute; + bottom: 0px; + right: 2px; + padding: 2px 5px 5px 2px; + background-color: #e2e2e2; + border-radius: 6px 6px 0px 0px; + font-size: 12px; +} + +#resizeBar { + cursor: ns-resize; + height: 3px; + background-color: rgb(50,50,50); +} +#resizeBar:hover { + background-color: lightskyblue; +} +#resizeBar[mode="dragging"], +#resizeBar[mode="dragging"]:hover { + background-color: rgb(105, 168, 207); +} + +#tabContainer { + position: relative; + height: 45px; +} + +.tab { + position: absolute; + box-sizing: border-box; + width: 33%; + height: 35px; + top: 10px; + padding: 5px; + + text-align: center; + border-radius: 15px 15px 0px 0px; +} +.tab:first-child { + left: 0px; +} +.tab:nth-child(2) { + left: 33.5%; +} +.tab:last-child { + right: 0px; +} +.tab[selected="selected"] { + background: #e2e2e2; + border: 2px solid #9c9c9c; + border-bottom-width: 0px; +} +.tab[selected="default"] { + background: #6b6b6b; + border: 2px solid #505050; + border-bottom-width: 0px; + color: rgb(36, 36, 36); +} +.tab[selected="default"]:hover { + cursor: pointer; + background: #8b8b8b; + color: rgb(36, 36, 36); +} + +.infoPane { + position: fixed; + bottom: 30px; + white-space: nowrap; + padding: 8px; + + background-color: rgba(25,25,25,0.85); + box-shadow: 0px 0px 8px black; + color: white; + font-family: initial; + border: 3px solid white; + border-radius: 5px; +} + +/*Override background for Scatter Plot*/ +.CINEMA_COMPONENT.SCATTER_PLOT { + background: #e2e2e2; +} diff --git a/examples/WitU/cintools/cinema.source/explorer/1.9/databases.json b/examples/WitU/cintools/cinema.source/explorer/1.9/databases.json new file mode 100644 index 00000000..3bce4fea --- /dev/null +++ b/examples/WitU/cintools/cinema.source/explorer/1.9/databases.json @@ -0,0 +1,54 @@ +[ + { + "name" : "sphere", + "directory" : "data/sphere.cdb" + }, + { + "name" : "Sphere Multi-Image", + "directory" : "data/sphere_multi-image.cdb" + }, + { + "name" : "Many File Types", + "directory" : "data/file_types.cdb" + }, + { + "name" : "Bogus 1", + "directory" : "data/bogus/bogus_1.cdb", + "filter" : "(^FILE)|(5$)", + "query": { + "Float_6" : [20, 70], + "Integer_2": [40, 60] + }, + "selection": { + "Integer_3": [20, 50] + } + }, + { + "name" : "Bogus 2", + "directory" : "data/bogus/bogus_2.cdb" + }, + { + "name" : "Bogus 3", + "directory" : "data/bogus/bogus_3.cdb" + }, + { + "name" : "Bogus 4", + "directory" : "data/bogus/bogus_4.cdb" + }, + { + "name" : "Big Bogus 1", + "directory" : "data/bogus/big_bogus_1.cdb" + }, + { + "name" : "Big Bogus 2", + "directory" : "data/bogus/big_bogus_2.cdb" + }, + { + "name" : "Big Bogus 3", + "directory" : "data/bogus/big_bogus_3.cdb" + }, + { + "name" : "Big Bogus 4", + "directory" : "data/bogus/big_bogus_4.cdb" + } +] diff --git a/examples/WitU/cintools/cinema.source/explorer/1.9/js/main.js b/examples/WitU/cintools/cinema.source/explorer/1.9/js/main.js new file mode 100644 index 00000000..8b238f8a --- /dev/null +++ b/examples/WitU/cintools/cinema.source/explorer/1.9/js/main.js @@ -0,0 +1,588 @@ +/* +A general Parallel Coordinates-based viewer for Spec-D cinema databases + +Copyright 2017 Los Alamos National Laboratory + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +//Init variables +var databaseInfo;//An array of the databases as defined in databases.json +var currentDbInfo; //Info for the currently selected database as defined in databases.json +var currentDb;//The currently loaded database (as CINEMA_COMPONENTS.Database instance) +var hasAxisOrdering = false; //whether or not the currentDb has extra axis ordering data +var databaseFile = 'cinema/explorer/1.9/databases.json'; //this can be overriden with HTTP params + +var loaded = false; + +//Components +var pcoord;//The Parallel Coordinates Chart +var view; //The component for viewing selected results +var query; //The component for querying results + +//View type enum +var viewType = Object.freeze({ + IMAGESPREAD: 0, + SCATTERPLOT: 1, + LINECHART: 2 +}); +var currentView = viewType.IMAGESPREAD; + +//save last-used dimensions on scatter plot between tab switches +var savedDimensions = {}; +var linechartCheckboxState; +var imagespreadOptionsState; + +//Pcoord type enum +var pcoordType = Object.freeze({ + SVG: 0, + CANVAS: 1 +}) +var currentPcoord = pcoordType.SVG; + +//State of the slideOut Panel +var slideOutOpen = false; + +// --------------------------------------------------------------------------- +// Parse arguments that come in through the URL +// --------------------------------------------------------------------------- + +// @TODO: +// Javascript has some built in methods parsing HTTP parameters, maybe we should use those? +var url = window.location.href; +var urlArgs = url.split('?'); + + +if (urlArgs.length > 1) { + var urlArgPairs = urlArgs[1].split('&'); + + // go through all the pairs, and if you find something you expect, deal with it + for (var i in urlArgPairs) { + var kvpair = urlArgPairs[i].split('='); + + // now look for the values you expect, and do something with them + if (kvpair[0] == 'databases') { + databaseFile = kvpair[1]; + } + } +} + +//Load database file and register databases into the database selection +//then load the first one +var jsonRequest = new XMLHttpRequest(); +jsonRequest.open("GET",databaseFile,true); +jsonRequest.onreadystatechange = function() { + if (jsonRequest.readyState === 4) { + if (jsonRequest.status === 200 || jsonRequest.status === 0) { + databaseInfo = JSON.parse(jsonRequest.responseText); + d3.select('#database').selectAll('option') + .data(databaseInfo) + .enter().append('option') + .attr('value',function(d,i){return i;}) + .text(function(d) { + return d.name ? d.name: d.directory; + }); + load(); + } + } +} +jsonRequest.send(null); + +//init margins and image size +updateViewContainerSize(); + +//Set up dragging on the resize bar +var resizeDrag = d3.drag() + .on('start', function() { + d3.select(this).attr('mode', 'dragging'); + }) + .on('drag', function() { + var headerRect = d3.select('#header').node().getBoundingClientRect(); + d3.select('#pcoordArea').style('height',(d3.event.y - headerRect.height)+'px'); + updateViewContainerSize(); + if (loaded) { + pcoord.updateSize(); + view.updateSize(); + } + }) + .on('end', function() { + d3.select(this).attr('mode', 'default'); + }); +d3.select('#resizeBar').call(resizeDrag); + +//Resize chart and update margins when window is resized +window.onresize = function(){ + updateViewContainerSize(); + if (loaded) { + pcoord.updateSize(); + view.updateSize(); + } +}; + +//********* +//END MAIN THREAD +//FUNCTION DEFINITIONS BELOW +//********* + +/** + * Set the current database to the one selected in the database selection + * and load it, rebuilding all components + */ +function load() { + loaded = false; + savedDimensions = {}; + + //Remove old components + if (window.pcoord) {pcoord.destroy();} + if (window.view) {view.destroy();} + if (window.query) {query.destroy();} + + //Remove axisOrdering panel if it exists + if (hasAxisOrdering) { + d3.select('#axisOrderPanel').remove(); + } + hasAxisOrdering = false; + + currentDbInfo = databaseInfo[d3.select('#database').node().value]; + //Init Database + //Will call doneLoading if succesful, otherwise wil call loadingError + currentDb = new CINEMA_COMPONENTS.Database( + currentDbInfo.directory, + doneLoading, + loadingError, + currentDbInfo.query); +} + +/** + * Called if an error was found when loading the database + */ +function loadingError(error) { + window.alert(error); +} + +/** + * Called when a database finishes loading. + * Builds components + * and sets up event listeners + */ +function doneLoading() { + loaded = true; + + linechartCheckboxState = undefined; + imagespreadOptionsState = undefined; + + //Build pcoord + //Use a PcoordCanvas for larger datasets to prevent slowdown + if (currentDb.data.length > 300) { + currentPcoord = pcoordType.CANVAS; + window.alert("This database is very large. The viewer will switch to a faster "+ + "version of components. Some functionality may be unavailable."); + pcoord = new CINEMA_COMPONENTS.PcoordCanvas(d3.select('#pcoordContainer').node(), + currentDb, + currentDbInfo.filter === undefined ? /^FILE/ : new RegExp(currentDbInfo.filter)); + } + else { + currentPcoord = pcoordType.SVG; + pcoord = new CINEMA_COMPONENTS.PcoordSVG(d3.select('#pcoordContainer').node(), + currentDb, + currentDbInfo.filter === undefined ? /^FILE/ : new RegExp(currentDbInfo.filter)); + } + //Set initial state of smoothPaths according to status of smoothLines checkbox + pcoord.smoothPaths = d3.select('#smoothLines').node().checked; + if (!pcoord.smoothPaths) + pcoord.redrawPaths();//redraw if smoothPaths should be false + + //Build view depending on selected viewType + if (currentView == viewType.IMAGESPREAD) + view = new CINEMA_COMPONENTS.ImageSpread(d3.select('#viewContainer').node(),currentDb, + currentDbInfo.image_measures, currentDbInfo.exclude_dimension); + else if (currentView == viewType.SCATTERPLOT) { + //Use either an SVG or a Canvas Scatter Plot depending on pcoordType + if (currentPcoord == pcoordType.SVG) + view = new CINEMA_COMPONENTS.ScatterPlotSVG(d3.select('#viewContainer').node(),currentDb, + currentDbInfo.filter === undefined ? /^FILE/ : new RegExp(currentDbInfo.filter)); + else + view = new CINEMA_COMPONENTS.ScatterPlotCanvas(d3.select('#viewContainer').node(),currentDb, + currentDbInfo.filter === undefined ? /^FILE/ : new RegExp(currentDbInfo.filter)); + } + else if (currentView == viewType.LINECHART) { + if(typeof currentDbInfo.image_measures !== 'undefined') { + view = new CINEMA_COMPONENTS.LineChart(d3.select('#viewContainer').node(),currentDb, + currentDbInfo.filter === undefined ? /^FILE/ : new RegExp(currentDbInfo.filter), + currentDbInfo.image_measures, currentDbInfo.exclude_dimension); + } + else { + window.alert('This database does not have any image measures. \n' + + 'Please add an image measure to databases.json \n' + + 'Use "image_measures" : ["measure_prefix1",...] property'); + } + } + + //Build Query panel + query = new CINEMA_COMPONENTS.Query(d3.select('#queryContainer').node(),currentDb); + + //When selection in pcoord chart changes, set readout + //and update view component + pcoord.dispatch.on('selectionchange',function(selection) { + d3.select('#selectionStats') + .text(selection.length+' out of '+currentDb.data.length+' results selected'); + if (currentView != viewType.LINECHART) + view.setSelection(selection); + }); + + //Set mouseover handler for pcoord and views component + pcoord.dispatch.on("mouseover",handleMouseover); + if (currentView != viewType.LINECHART) + view.dispatch.on('mouseover',handleMouseover); + + //If the view is a Scatter Plot, set listeners to save dimensions when they are changed + if (currentView == viewType.SCATTERPLOT) { + view.dispatch.on('xchanged',function(d){savedDimensions.x = d;}); + view.dispatch.on('ychanged',function(d){savedDimensions.y = d;}); + } + + if(currentView == viewType.LINECHART) { + view.dispatch + .on('selectionchanged', handleSelectionChanged) + .on('xchanged', function(d){savedDimensions.x = d;}); + } + + //Set styles for query data + //Style is interpreted differently by SVG and Canvas components + if (currentPcoord == pcoordType.SVG) { + query.custom.style = "stroke-dasharray:20,7;stroke-width:3px;stroke:red"; + query.lower.style = "stroke-dasharray:initial;stroke-width:2px;stroke:pink;"; + query.upper.style = "stroke-dasharray:initial;stroke-width:2px;stroke:pink;"; + } + else { + query.custom.style = {lineWidth:3,strokeStyle:'red',lineDash:[20,7]}; + query.lower.style = {lineWidth:2,strokeStyle:'pink'}; + query.upper.style = {lineWidth:2,strokeStyle:'pink'}; + } + //Add query data as overlays to pcoord chart + pcoord.setOverlayPaths([query.custom,query.upper,query.lower]); + + //Set pcoord chart to repond to change in query data + query.dispatch.on('customchange',function(newData) { + pcoord.redrawOverlayPaths(); + }); + + //Set pcoord query to respond to a query + query.dispatch.on('query',function(results) { + pcoord.setSelection(results); + }) + + //Update size now that components are built + updateViewContainerSize(); + view.updateSize(); + + //Trigger initial selectionchange event + pcoord.dispatch.call('selectionchange',pcoord,pcoord.selection.slice()); + + //Build the axis ordering panel if the database has additional axis order data + if (currentDb.hasAxisOrdering) { + hasAxisOrdering = true; + buildAxisOrderPanel(); + } + + //If we defined a pre-set selection, set it in the pcoord chart + if (currentDbInfo.selection) { + pcoord.filterSelection(currentDbInfo.selection) + } +} + +/** + * Open or close the slideOut Panel + */ +function toggleShowHide() { + slideOutOpen = !slideOutOpen; + if (slideOutOpen) { //slide out + d3.select('#slideOut').transition() + .duration(500) + .style('width','500px') + .on('start',function(){ + d3.select('#slideOutContents').style('display','initial'); + pcoord.setOverlayPaths([query.custom,query.upper,query.lower]); + }) + .on('end',function() { + query.updateSize(); + }); + d3.select('#pcoordArea').transition() + .duration(500) + .style('padding-left','500px') + .on('end',function(){pcoord.updateSize();}) + d3.select('#showHideLabel').text('<'); + } + else { //slide in + d3.select('#slideOut').transition() + .duration(500) + .style('width','25px') + .on('start',function(){ + pcoord.setOverlayPaths([]); + }) + .on('end',function(){ + d3.select('#slideOutContents').style('display','hidden'); + query.updateSize(); + }); + d3.select('#pcoordArea').transition() + .duration(500) + .style('padding-left','25px') + .on('end',function(){pcoord.updateSize();}) + d3.select('#showHideLabel').text('>'); + } + +} + +/** + * Change the view component to the specified viewType + * Called by clicking one of the tabs + */ +function changeView(type) { + if(typeof currentDbInfo.image_measures === 'undefined' && type === viewType.LINECHART) { + window.alert('This database does not have any image measures. \n' + + 'Please add an image measure to databases.json \n' + + 'Use "image_measures" : ["measure_prefix1",...] property'); + return; + } + + if (loaded && type != currentView) { + if(currentView == viewType.LINECHART && typeof view !== "undefined") + linechartCheckboxState = view.getCheckboxStates(); + if(currentView == viewType.IMAGESPREAD && typeof view !== "undefined") + imagespreadOptionsState = view.getOptionsData(); + + view.destroy();//destroy current view + currentView = type; + //Build ImageSpread if Image Spread tab is selected + if (currentView == viewType.IMAGESPREAD) { + view = new CINEMA_COMPONENTS.ImageSpread(d3.select('#viewContainer').node(),currentDb, + currentDbInfo.image_measures, currentDbInfo.exclude_dimension); + //change selected tab + d3.select('#imageSpreadTab').attr('selected','selected'); + d3.select('#scatterPlotTab').attr('selected','default'); + d3.select('#linechartChartTab').attr('selected','default'); + + if(typeof imagespreadOptionsState !== "undefined") { + view.setOptionsData(imagespreadOptionsState); + } + } + //Build ScatterPlot if Scatter Plot tab is selected + else if (currentView == viewType.SCATTERPLOT) { + //Build either SVG or Canvas ScatterPlot depending on pcoordType + if (currentPcoord == pcoordType.SVG) + view = new CINEMA_COMPONENTS.ScatterPlotSVG(d3.select('#viewContainer').node(),currentDb, + currentDbInfo.filter === undefined ? /^FILE/ : new RegExp(currentDbInfo.filter)); + else + view = new CINEMA_COMPONENTS.ScatterPlotCanvas(d3.select('#viewContainer').node(),currentDb, + currentDbInfo.filter === undefined ? /^FILE/ : new RegExp(currentDbInfo.filter)); + //change selected tab + d3.select('#scatterPlotTab').attr('selected','selected'); + d3.select('#imageSpreadTab').attr('selected','default'); + d3.select('#linechartChartTab').attr('selected','default'); + + //add listeners to save dimensions when they are changed + view.dispatch.on('xchanged',function(d){savedDimensions.x = d;}); + view.dispatch.on('ychanged',function(d){savedDimensions.y = d;}); + + //set view to currently saved dimensions if defined + if (savedDimensions.x) { + var node = d3.select(view.xSelect).node(); + node.value = savedDimensions.x; + d3.select(node).on('input').call(node);//trigger input event on select + } + if (savedDimensions.y) { + var node = d3.select(view.ySelect).node(); + node.value = savedDimensions.y; + d3.select(node).on('input').call(node);//trigger input event on select + } + } + else if (currentView == viewType.LINECHART) { + d3.select('#scatterPlotTab').attr('selected','default'); + d3.select('#imageSpreadTab').attr('selected','default'); + d3.select('#linechartChartTab').attr('selected','selected'); + view = new CINEMA_COMPONENTS.LineChart(d3.select('#viewContainer').node(),currentDb, + currentDbInfo.filter === undefined ? /^FILE/ : new RegExp(currentDbInfo.filter), + currentDbInfo.image_measures, currentDbInfo.exclude_dimension); + //change selected tab + + view.dispatch + .on('selectionchanged', handleSelectionChanged) + .on('xchanged', function(d){savedDimensions.x = d;}); + + //set view to currently saved dimensions if defined + if (savedDimensions.x) { + var node = d3.select(view.xSelect).node(); + node.value = savedDimensions.x; + d3.select(node).on('input').call(node);//trigger input event on select + } + + if(typeof linechartCheckboxState !== "undefined") { + view.setCheckboxStates(linechartCheckboxState); + } + } + + //Set mouseover handler for new view and update size + if (currentView != viewType.LINECHART) + view.dispatch.on('mouseover',handleMouseover); + + updateViewContainerSize(); + view.updateSize(); + + //Set view's initial selection to the current pcoord selection + if (currentView != viewType.LINECHART) + view.setSelection(pcoord.selection.slice()); + } +} + +/** + * Build a panel for selecting axis orderings + * Add listeners for pcoord chart + */ +function buildAxisOrderPanel() { + //Add panel + var axisOrderPanel = d3.select('#header').append('div') + .attr('id','axisOrderPanel'); + //Add label + axisOrderPanel.append('span') + .attr('id','axisOrderLabel') + .text("Axis Order:"); + axisOrderPanel.append('br'); + //Add select for category + axisOrderPanel.append('select') + .attr('id','axis_category') + .selectAll('option').data(d3.keys(currentDb.axisOrderData)) + .enter().append('option') + .attr('value',function(d){return d;}) + .text(function(d){return d;}); + //Set onchange for category select to populate value select + d3.select('#axis_category').on('change',function() { + var category = currentDb.axisOrderData[this.value]; + var val = d3.select('#axis_value').selectAll('option') + .data(d3.range(-1,category.length));//-1 is 'custom' order + val.exit().remove(); + val.enter().append('option') + .merge(val) + .attr('value',function(d){return d;}) + .text(function(d){return d == -1 ? 'Custom' : category[d].name;}); + //set onchange for value select to change order in pcoord chart + d3.select('#axis_value').on('change',function() { + if (this.value != -1) { + var order = category[this.value].order; + pcoord.setAxisOrder(order); + } + }); + d3.select('#axis_value').node().value = -1; //set to custom + }); + //Add spacer + axisOrderPanel.append('span').text(' : '); + //Add value select + axisOrderPanel.append('select') + .attr('id','axis_value'); + + //Add handler to pcoord chart to set value select to "custom" + //when axis order is manually changed + pcoord.dispatch.on('axisorderchange',function() { + d3.select('#axis_value').node().value = -1; + }); + + //trigger change in category to populate value select + d3.select('#axis_category').on('change').call(d3.select('#axis_category').node()); +} + +/** + * Respond to smoothLines checkbox. + * Update lines in pcoord chart + */ +function updateSmoothLines() { + if (loaded) { + pcoord.smoothPaths = d3.select('#smoothLines').node().checked; + pcoord.redrawPaths(); + } +} + +/** + * Update the size of viewContainer to fill the remaining space below the top panel + **/ +function updateViewContainerSize() { + var topRect = d3.select('#top').node().getBoundingClientRect(); + var tabRect = d3.select('#tabContainer').node().getBoundingClientRect(); + d3.select('#viewContainer').style('height',window.innerHeight-topRect.height-tabRect.height+'px'); +} + +//Respond to mouseover event. +//Set highlight in pcoord chart +//and update info pane +//Also sets highlight in view if its a Scatter Plot +function handleMouseover(index, event) { + if (index != null) { + pcoord.setHighlightedPaths([index]); + if (currentView == viewType.SCATTERPLOT) + view.setHighlightedPoints([index]); + } + else { + pcoord.setHighlightedPaths([]); + if (currentView == viewType.SCATTERPLOT) + view.setHighlightedPoints([]); + } + updateInfoPane(index,event); +} + +//Finalize dragging, add selection +function handleSelectionChanged(index, event) { + if (currentView == viewType.LINECHART) { + pcoord.addSelectionByDimensionValues(view.dragResult); + } +} + +//Update the info pane according to the index of the data +//being moused over +function updateInfoPane(index, event) { + var pane = d3.select('.infoPane'); + if (index != null && pane.empty()) { + pane = d3.select('body').append('div') + .attr('class', 'infoPane') + } + if (index != null) { + pane.html(function() { + var text = 'Index: '+index+'
'; + var data = currentDb.data[index] + for (i in data) { + text += (''+i+': '); + text += (data[i] + '
'); + } + return text; + }); + //Draw the info pane in the side of the window opposite the mouse + var leftHalf = (event.clientX <= window.innerWidth/2) + if (leftHalf) + pane.style('right', '30px'); + else + pane.style('left', '30px'); + } + else { + d3.select('.infoPane').remove(); + } +} diff --git a/examples/WitU/cintools/cinema.source/explorer/1.9/uncertainty.json b/examples/WitU/cintools/cinema.source/explorer/1.9/uncertainty.json new file mode 100644 index 00000000..672e35ef --- /dev/null +++ b/examples/WitU/cintools/cinema.source/explorer/1.9/uncertainty.json @@ -0,0 +1,130 @@ +[ + { + "name" : "UC volume", + "directory" : "data/tester.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + }, + { + "name" : "UC volume", + "directory" : "data/volume_uncertainty.cdb", + "image_measures" : ["u_avg_"] + + }, + { + "name" : "sphere", + "directory" : "data/sphere.cdb" + }, + { + "name" : "Sphere Multi-Image", + "directory" : "data/sphere_multi-image.cdb" + }, + { + "name" : "Many File Types", + "directory" : "data/file_types.cdb" + }, + { + "name" : "Bogus 1", + "directory" : "data/bogus/bogus_1.cdb", + "filter" : "(^FILE)|(5$)", + "query": { + "Float_6" : [20, 70], + "Integer_2": [40, 60] + }, + "selection": { + "Integer_3": [20, 50] + } + }, + { + "name" : "Bogus 2", + "directory" : "data/bogus/bogus_2.cdb" + }, + { + "name" : "Bogus 3", + "directory" : "data/bogus/bogus_3.cdb" + }, + { + "name" : "Bogus 4", + "directory" : "data/bogus/bogus_4.cdb" + }, + { + "name" : "Big Bogus 1", + "directory" : "data/bogus/big_bogus_1.cdb" + }, + { + "name" : "Big Bogus 2", + "directory" : "data/bogus/big_bogus_2.cdb" + }, + { + "name" : "Big Bogus 3", + "directory" : "data/bogus/big_bogus_3.cdb" + }, + { + "name" : "Big Bogus 4", + "directory" : "data/bogus/big_bogus_4.cdb" + }, + { + "name" : "volume", + "directory" : "data/volume.cdb" + }, + { + "name" : "Uncertainty Example", + "directory" : "data/example_uncertainty.cdb" + }, + { + "name" : "Density Field", + "directory" : "data/density_field.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + }, + { + "name" : "Bubbles", + "directory" : "data/bubbles.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + }, + { + "name" : "Sampled Data", + "directory" : "data/sampled_data.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + }, + { + "name" : "Parameters2D", + "directory" : "data/parameters2D.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + }, + { + "name" : "Parameters3D", + "directory" : "data/parameters3D.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + }, + { + "name" : "Warp3D_1", + "directory" : "data/warp3d_Ex_videocopy1_fixedbar_fixedrot.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + }, + { + "name" : "Warp3D_2", + "directory" : "data/warp3d_Ex_videocopy2_fixedbar_fixedrot.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + }, + { + "name" : "Warp3D_2 only avg", + "directory" : "data/warp3d_Ex_videocopy2_fixedbar_fixedrot.cdb", + "image_measures" : ["u_avg_"], + "exclude_dimension" : ["u_min_","u_max_"] + }, + { + "name" : "Warp3D_2 only u", + "directory" : "data/warp3d_Ex_videocopy2_fixedbar_fixedrot.cdb", + "image_measures" : ["u_"] + }, + { + "name" : "Warp3D_2 only u - min max", + "directory" : "data/warp3d_Ex_videocopy2_fixedbar_fixedrot.cdb", + "image_measures" : ["u_"], + "exclude_dimension" : ["u_max_"] + }, + { + "name" : "HGlass", + "directory" : "data/sample_stratified_random_hist_0.1.cdb", + "image_measures" : ["u_min_","u_avg_","u_max_"] + } +] diff --git a/examples/WitU/cintools/cinema.source/lib/d3.v4.min.js b/examples/WitU/cintools/cinema.source/lib/d3.v4.min.js new file mode 100644 index 00000000..8a0709b3 --- /dev/null +++ b/examples/WitU/cintools/cinema.source/lib/d3.v4.min.js @@ -0,0 +1,8 @@ +// https://d3js.org Version 4.9.1. Copyright 2017 Mike Bostock. +(function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})})(this,function(t){"use strict";function n(t){return function(n,e){return js(t(n),e)}}function e(t,n){return[t,n]}function r(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=sf?10:o>=ff?5:o>=lf?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=sf?10:o>=ff?5:o>=lf?2:1)}function i(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=sf?i*=10:o>=ff?i*=5:o>=lf&&(i*=2),n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}function g(t,n){for(var e,r=0,i=t.length;r=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function S(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;rn?1:t>=n?0:NaN}function U(t){return function(){this.removeAttribute(t)}}function D(t){return function(){this.removeAttributeNS(t.space,t.local)}}function O(t,n){return function(){this.setAttribute(t,n)}}function F(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function Y(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function B(t){return function(){this.style.removeProperty(t)}}function H(t,n,e){return function(){this.style.setProperty(t,n,e)}}function j(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function X(t,n){return t.style.getPropertyValue(n)||gl(t).getComputedStyle(t,null).getPropertyValue(n)}function $(t){return function(){delete this[t]}}function V(t,n){return function(){this[t]=n}}function W(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function Z(t){return t.trim().split(/^|\s+/)}function G(t){return t.classList||new J(t)}function J(t){this._node=t,this._names=Z(t.getAttribute("class")||"")}function Q(t,n){for(var e=G(t),r=-1,i=n.length;++r>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Xl.exec(t))?St(parseInt(n[1],16)):(n=$l.exec(t))?new zt(n[1],n[2],n[3],1):(n=Vl.exec(t))?new zt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Wl.exec(t))?Et(n[1],n[2],n[3],n[4]):(n=Zl.exec(t))?Et(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Gl.exec(t))?Pt(n[1],n[2]/100,n[3]/100,1):(n=Jl.exec(t))?Pt(n[1],n[2]/100,n[3]/100,n[4]):Ql.hasOwnProperty(t)?St(Ql[t]):"transparent"===t?new zt(NaN,NaN,NaN,0):null}function St(t){return new zt(t>>16&255,t>>8&255,255&t,1)}function Et(t,n,e,r){return r<=0&&(t=n=e=NaN),new zt(t,n,e,r)}function At(t){return t instanceof kt||(t=Nt(t)),t?(t=t.rgb(),new zt(t.r,t.g,t.b,t.opacity)):new zt}function Ct(t,n,e,r){return 1===arguments.length?At(t):new zt(t,n,e,null==r?1:r)}function zt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Pt(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new qt(t,n,e,r)}function Lt(t){if(t instanceof qt)return new qt(t.h,t.s,t.l,t.opacity);if(t instanceof kt||(t=Nt(t)),!t)return new qt;if(t instanceof qt)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,c=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(e0&&c<1?0:u,new qt(u,a,c,t.opacity)}function Rt(t,n,e,r){return 1===arguments.length?Lt(t):new qt(t,n,e,null==r?1:r)}function qt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ut(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function Dt(t){if(t instanceof Ft)return new Ft(t.l,t.a,t.b,t.opacity);if(t instanceof $t){var n=t.h*Kl;return new Ft(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof zt||(t=At(t));var e=Ht(t.r),r=Ht(t.g),i=Ht(t.b),o=It((.4124564*e+.3575761*r+.1804375*i)/nh),u=It((.2126729*e+.7151522*r+.072175*i)/eh);return new Ft(116*u-16,500*(o-u),200*(u-It((.0193339*e+.119192*r+.9503041*i)/rh)),t.opacity)}function Ot(t,n,e,r){return 1===arguments.length?Dt(t):new Ft(t,n,e,null==r?1:r)}function Ft(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function It(t){return t>ah?Math.pow(t,1/3):t/uh+ih}function Yt(t){return t>oh?t*t*t:uh*(t-ih)}function Bt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ht(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function jt(t){if(t instanceof $t)return new $t(t.h,t.c,t.l,t.opacity);t instanceof Ft||(t=Dt(t));var n=Math.atan2(t.b,t.a)*th;return new $t(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Xt(t,n,e,r){return 1===arguments.length?jt(t):new $t(t,n,e,null==r?1:r)}function $t(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Vt(t){if(t instanceof Zt)return new Zt(t.h,t.s,t.l,t.opacity);t instanceof zt||(t=At(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(vh*r+ph*n-dh*e)/(vh+ph-dh),o=r-i,u=(hh*(e-i)-fh*o)/lh,a=Math.sqrt(u*u+o*o)/(hh*i*(1-i)),c=a?Math.atan2(u,o)*th-120:NaN;return new Zt(c<0?c+360:c,a,i,t.opacity)}function Wt(t,n,e,r){return 1===arguments.length?Vt(t):new Zt(t,n,e,null==r?1:r)}function Zt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Gt(t,n,e,r,i){var o=t*t,u=o*t;return((1-3*t+3*o-u)*n+(4-6*o+3*u)*e+(1+3*t+3*o-3*u)*r+u*i)/6}function Jt(t,n){return function(e){return t+e*n}}function Qt(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function Kt(t,n){var e=n-t;return e?Jt(t,e>180||e<-180?e-360*Math.round(e/360):e):Th(isNaN(t)?n:t)}function tn(t){return 1==(t=+t)?nn:function(n,e){return e-n?Qt(n,e,t):Th(isNaN(n)?e:n)}}function nn(t,n){var e=n-t;return e?Jt(t,e):Th(isNaN(t)?n:t)}function en(t){return function(n){var e,r,i=n.length,o=new Array(i),u=new Array(i),a=new Array(i);for(e=0;e180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Ch(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}function a(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Ch(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}function c(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:Ch(t,e)},{i:a-2,x:Ch(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}return function(n,e){var r=[],i=[];return n=t(n),e=t(e),o(n.translateX,n.translateY,e.translateX,e.translateY,r,i),u(n.rotate,e.rotate,r,i),a(n.skewX,e.skewX,r,i),c(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,i),n=e=null,function(t){for(var n,e=-1,o=i.length;++e=0&&n._call.call(null,t),n=n._next;--Jh}function bn(){ep=(np=ip.now())+rp,Jh=Qh=0;try{xn()}finally{Jh=0,Mn(),ep=0}}function wn(){var t=ip.now(),n=t-np;n>tp&&(rp-=n,np=t)}function Mn(){for(var t,n,e=xh,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:xh=n);bh=t,Tn(r)}function Tn(t){if(!Jh){Qh&&(Qh=clearTimeout(Qh));var n=t-ep;n>24?(t<1/0&&(Qh=setTimeout(bn,n)),Kh&&(Kh=clearInterval(Kh))):(Kh||(np=ep,Kh=setInterval(wn,tp)),Jh=1,op(bn))}}function kn(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>fp)throw new Error("too late");return e}function Nn(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>hp)throw new Error("too late");return e}function Sn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function En(t,n,e){function r(t){e.state=lp,e.timer.restart(i,e.delay,e.time),e.delay<=t&&i(t-e.delay)}function i(r){var s,f,l,h;if(e.state!==lp)return u();for(s in c)if(h=c[s],h.name===e.name){if(h.state===pp)return up(i);h.state===dp?(h.state=_p,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete c[s]):+s=0&&(t=t.slice(0,n)),!t||"start"===t})}function $n(t,n,e){var r,i,o=Xn(n)?kn:Nn;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function Vn(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function Wn(t,n){var e,r,i;return function(){var o=X(this,t),u=(this.style.removeProperty(t),X(this,t));return o===u?null:o===e&&u===r?i:i=n(e=o,r=u)}}function Zn(t){return function(){this.style.removeProperty(t)}}function Gn(t,n,e){var r,i;return function(){var o=X(this,t);return o===e?null:o===r?i:i=n(r=o,e)}}function Jn(t,n,e){var r,i,o;return function(){var u=X(this,t),a=e(this);return null==a&&(this.style.removeProperty(t),a=X(this,t)),u===a?null:u===r&&a===i?o:o=n(r=u,i=a)}}function Qn(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}function Kn(t){return function(){this.textContent=t}}function te(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function ne(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ee(t){return yt().transition(t)}function re(){return++Fp}function ie(t){return+t}function oe(t){return t*t}function ue(t){return t*(2-t)}function ae(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function ce(t){return t*t*t}function se(t){return--t*t*t+1}function fe(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function le(t){return 1-Math.cos(t*Xp)}function he(t){return Math.sin(t*Xp)}function pe(t){return(1-Math.cos(jp*t))/2}function de(t){return Math.pow(2,10*t-10)}function ve(t){return 1-Math.pow(2,-10*t)}function _e(t){return((t*=2)<=1?Math.pow(2,10*t-10):2-Math.pow(2,10-10*t))/2}function ye(t){return 1-Math.sqrt(1-t*t)}function ge(t){return Math.sqrt(1- --t*t)}function me(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}function xe(t){return 1-be(1-t)}function be(t){return(t=+t)<$p?nd*t*t:tMath.abs(t[1]-O[1])?M=!0:w=!0),O=t,b=!0,vd(),o()}function o(){var t;switch(m=O[0]-D[0],x=O[1]-D[1],N){case yd:case _d:S&&(m=Math.max(P-l,Math.min(R-v,m)),h=l+m,_=v+m),E&&(x=Math.max(L-p,Math.min(q-y,x)),d=p+x,g=y+x);break;case gd:S<0?(m=Math.max(P-l,Math.min(R-l,m)),h=l+m,_=v):S>0&&(m=Math.max(P-v,Math.min(R-v,m)),h=l,_=v+m),E<0?(x=Math.max(L-p,Math.min(q-p,x)),d=p+x,g=y):E>0&&(x=Math.max(L-y,Math.min(q-y,x)),d=p,g=y+x);break;case md:S&&(h=Math.max(P,Math.min(R,l-m*S)),_=Math.max(P,Math.min(R,v+m*S))),E&&(d=Math.max(L,Math.min(q,p-x*E)),g=Math.max(L,Math.min(q,y+x*E)))}_0&&(l=h-m),E<0?y=g-x:E>0&&(p=d-x),N=yd,Y.attr("cursor",Md.selection),o());break;default:return}vd()}function s(){switch(t.event.keyCode){case 16:U&&(w=M=U=!1,o());break;case 18:N===md&&(S<0?v=_:S>0&&(l=h),E<0?y=g:E>0&&(p=d),N=gd,o());break;case 32:N===yd&&(t.event.altKey?(S&&(v=_-m*S,l=h+m*S),E&&(y=g-x*E,p=d+x*E),N=md):(S<0?v=_:S>0&&(l=h),E<0?y=g:E>0&&(p=d),N=gd),Y.attr("cursor",Md[k]),o());break;default:return}vd()}if(t.event.touches){if(t.event.changedTouches.length=(o=(v+y)/2))?v=o:y=o,(f=e>=(u=(_+g)/2))?_=u:g=u,i=p,!(p=p[l=f<<1|s]))return i[l]=d,t;if(a=+t._x.call(null,p.data),c=+t._y.call(null,p.data),n===a&&e===c)return d.next=p,i?i[l]=d:t._root=d,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(s=n>=(o=(v+y)/2))?v=o:y=o,(f=e>=(u=(_+g)/2))?_=u:g=u}while((l=f<<1|s)==(h=(c>=u)<<1|a>=o));return i[h]=p,i[l]=d,t}function tr(t){var n,e,r,i,o=t.length,u=new Array(o),a=new Array(o),c=1/0,s=1/0,f=-1/0,l=-1/0;for(e=0;ef&&(f=r),il&&(l=i));for(f",i=n[3]||"-",o=n[4]||"",u=!!n[5],a=n[6]&&+n[6],c=!!n[7],s=n[8]&&+n[8].slice(1),f=n[9]||"";"n"===f?(c=!0,f="g"):Dv[f]||(f=""),(u||"0"===e&&"="===r)&&(u=!0,e="0",r="="),this.fill=e,this.align=r, +this.sign=i,this.symbol=o,this.zero=u,this.width=a,this.comma=c,this.precision=s,this.type=f}function vr(n){return Fv=Bv(n),t.format=Fv.format,t.formatPrefix=Fv.formatPrefix,Fv}function _r(){this.reset()}function yr(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}function gr(t){return t>1?0:t<-1?N_:Math.acos(t)}function mr(t){return t>1?S_:t<-1?-S_:Math.asin(t)}function xr(t){return(t=I_(t/2))*t}function br(){}function wr(t,n){t&&X_.hasOwnProperty(t.type)&&X_[t.type](t,n)}function Mr(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i=0?1:-1,i=r*e,o=q_(n),u=I_(n),a=Jv*u,c=Gv*o+a*q_(i),s=a*r*I_(i);V_.add(R_(s,c)),Zv=t,Gv=o,Jv=u}function Ar(t){return[R_(t[1],t[0]),mr(t[2])]}function Cr(t){var n=t[0],e=t[1],r=q_(e);return[r*q_(n),r*I_(n),I_(e)]}function zr(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Pr(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Lr(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Rr(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function qr(t){var n=B_(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function Ur(t,n){u_.push(a_=[Qv=t,t_=t]),nn_&&(n_=n)}function Dr(t,n){var e=Cr([t*z_,n*z_]);if(o_){var r=Pr(o_,e),i=[r[1],-r[0],0],o=Pr(i,r);qr(o),o=Ar(o);var u,a=t-e_,c=a>0?1:-1,s=o[0]*C_*c,f=P_(a)>180;f^(c*e_n_&&(n_=u):(s=(s+360)%360-180,f^(c*e_n_&&(n_=n))),f?tHr(Qv,t_)&&(t_=t):Hr(t,t_)>Hr(Qv,t_)&&(Qv=t):t_>=Qv?(tt_&&(t_=t)):t>e_?Hr(Qv,t)>Hr(Qv,t_)&&(t_=t):Hr(t,t_)>Hr(Qv,t_)&&(Qv=t)}else u_.push(a_=[Qv=t,t_=t]);nn_&&(n_=n),o_=e,e_=t}function Or(){Q_.point=Dr}function Fr(){a_[0]=Qv,a_[1]=t_,Q_.point=Ur,o_=null}function Ir(t,n){if(o_){var e=t-e_;J_.add(P_(e)>180?e+(e>0?360:-360):e)}else r_=t,i_=n;Z_.point(t,n),Dr(t,n)}function Yr(){Z_.lineStart()}function Br(){Ir(r_,i_),Z_.lineEnd(),P_(J_)>k_&&(Qv=-(t_=180)),a_[0]=Qv,a_[1]=t_,o_=null}function Hr(t,n){return(n-=t)<0?n+360:n}function jr(t,n){return t[0]-n[0]}function Xr(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nN_?t-A_:t<-N_?t+A_:t,n]}function ri(t,n,e){return(t%=A_)?n||e?ry(oi(t),ui(n,e)):oi(t):n||e?ui(n,e):ei}function ii(t){return function(n,e){return n+=t,[n>N_?n-A_:n<-N_?n+A_:n,e]}}function oi(t){var n=ii(t);return n.invert=ii(-t),n}function ui(t,n){function e(t,n){var e=q_(n),a=q_(t)*e,c=I_(t)*e,s=I_(n),f=s*r+a*i;return[R_(c*o-f*u,a*r-s*i),mr(f*o+c*u)]}var r=q_(t),i=I_(t),o=q_(n),u=I_(n);return e.invert=function(t,n){var e=q_(n),a=q_(t)*e,c=I_(t)*e,s=I_(n),f=s*o-c*u;return[R_(c*o+s*u,a*r+f*i),mr(f*r-a*i)]},e}function ai(t,n,e,r,i,o){if(e){var u=q_(n),a=I_(n),c=r*e;null==i?(i=n+r*A_,o=n-c/2):(i=ci(u,i),o=ci(u,o),(r>0?io)&&(i+=r*A_));for(var s,f=i;r>0?f>o:f0)do{s.point(0===f||3===f?t:e,f>1?r:n)}while((f=(f+a+4)%4)!==l);else s.point(o[0],o[1])}function u(r,i){return P_(r[0]-t)0?0:3:P_(r[0]-e)0?2:1:P_(r[1]-n)0?1:0:i>0?3:2}function a(t,n){return c(t.x,n.x)}function c(t,n){var e=u(t,1),r=u(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(u){function c(t,n){i(t,n)&&N.point(t,n)}function s(){for(var n=0,e=0,i=_.length;er&&(l-o)*(r-u)>(h-u)*(t-o)&&++n:h<=r&&(l-o)*(r-u)<(h-u)*(t-o)&&--n;return n}function f(){N=S,v=[],_=[],k=!0}function l(){var t=s(),n=k&&t,e=(v=bf(v)).length;(n||e)&&(u.polygonStart(),n&&(u.lineStart(),o(null,null,1,u),u.lineEnd()),e&&xy(v,a,t,o,u),u.polygonEnd()),N=u,v=_=y=null}function h(){E.point=d,_&&_.push(y=[]),T=!0,M=!1,b=w=NaN}function p(){v&&(d(g,m),x&&M&&S.rejoin(),v.push(S.result())),E.point=c,M&&N.lineEnd()}function d(o,u){var a=i(o,u);if(_&&y.push([o,u]),T)g=o,m=u,x=a,T=!1,a&&(N.lineStart(),N.point(o,u));else if(a&&M)N.point(o,u);else{var c=[b=Math.max(wy,Math.min(by,b)),w=Math.max(wy,Math.min(by,w))],s=[o=Math.max(wy,Math.min(by,o)),u=Math.max(wy,Math.min(by,u))];gy(c,s,t,n,e,r)?(M||(N.lineStart(),N.point(c[0],c[1])),N.point(s[0],s[1]),a||N.lineEnd(),k=!1):a&&(N.lineStart(),N.point(o,u),k=!1)}b=o,w=u,M=a}var v,_,y,g,m,x,b,w,M,T,k,N=u,S=yy(),E={point:c,lineStart:h,lineEnd:p,polygonStart:f,polygonEnd:l};return E}}function hi(){Sy.point=di,Sy.lineEnd=pi}function pi(){Sy.point=Sy.lineEnd=br}function di(t,n){t*=z_,n*=z_,iy=t,oy=I_(n),uy=q_(n),Sy.point=vi}function vi(t,n){t*=z_,n*=z_;var e=I_(n),r=q_(n),i=P_(t-iy),o=q_(i),u=I_(i),a=r*u,c=uy*e-oy*r*o,s=oy*e+uy*r*o;Ny.add(R_(B_(a*a+c*c),s)),iy=t,oy=e,uy=r}function _i(t,n){return!(!t||!Ly.hasOwnProperty(t.type))&&Ly[t.type](t,n)}function yi(t,n){return 0===zy(t,n)}function gi(t,n){var e=zy(t[0],t[1]);return zy(t[0],n)+zy(n,t[1])<=e+k_}function mi(t,n){return!!ky(t.map(xi),bi(n))}function xi(t){return t=t.map(bi),t.pop(),t}function bi(t){return[t[0]*z_,t[1]*z_]}function wi(t,n,e){var r=cf(t,n-k_,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function Mi(t,n,e){var r=cf(t,n-k_,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function Ti(){function t(){return{type:"MultiLineString",coordinates:n()}}function n(){return cf(U_(o/_)*_,i,_).map(h).concat(cf(U_(s/y)*y,c,y).map(p)).concat(cf(U_(r/d)*d,e,d).filter(function(t){return P_(t%_)>k_}).map(f)).concat(cf(U_(a/v)*v,u,v).filter(function(t){return P_(t%y)>k_}).map(l))}var e,r,i,o,u,a,c,s,f,l,h,p,d=10,v=d,_=90,y=360,g=2.5;return t.lines=function(){return n().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(p(c).slice(1),h(i).reverse().slice(1),p(s).reverse().slice(1))]}},t.extent=function(n){return arguments.length?t.extentMajor(n).extentMinor(n):t.extentMinor()},t.extentMajor=function(n){return arguments.length?(o=+n[0][0],i=+n[1][0],s=+n[0][1],c=+n[1][1],o>i&&(n=o,o=i,i=n),s>c&&(n=s,s=c,c=n),t.precision(g)):[[o,s],[i,c]]},t.extentMinor=function(n){return arguments.length?(r=+n[0][0],e=+n[1][0],a=+n[0][1],u=+n[1][1],r>e&&(n=r,r=e,e=n),a>u&&(n=a,a=u,u=n),t.precision(g)):[[r,a],[e,u]]},t.step=function(n){return arguments.length?t.stepMajor(n).stepMinor(n):t.stepMinor()},t.stepMajor=function(n){return arguments.length?(_=+n[0],y=+n[1],t):[_,y]},t.stepMinor=function(n){return arguments.length?(d=+n[0],v=+n[1],t):[d,v]},t.precision=function(n){return arguments.length?(g=+n,f=wi(a,u,90),l=Mi(r,e,g),h=wi(s,c,90),p=Mi(o,i,g),t):g},t.extentMajor([[-180,-90+k_],[180,90-k_]]).extentMinor([[-180,-80-k_],[180,80+k_]])}function ki(){return Ti()()}function Ni(){Fy.point=Si}function Si(t,n){Fy.point=Ei,ay=sy=t,cy=fy=n}function Ei(t,n){Oy.add(fy*t-sy*n),sy=t,fy=n}function Ai(){Ei(ay,cy)}function Ci(t,n){tBy&&(By=t),nHy&&(Hy=n)}function zi(t,n){Xy+=t,$y+=n,++Vy}function Pi(){tg.point=Li}function Li(t,n){tg.point=Ri,zi(py=t,dy=n)}function Ri(t,n){var e=t-py,r=n-dy,i=B_(e*e+r*r);Wy+=i*(py+t)/2,Zy+=i*(dy+n)/2,Gy+=i,zi(py=t,dy=n)}function qi(){tg.point=zi}function Ui(){tg.point=Oi}function Di(){Fi(ly,hy)}function Oi(t,n){tg.point=Fi,zi(ly=py=t,hy=dy=n)}function Fi(t,n){var e=t-py,r=n-dy,i=B_(e*e+r*r);Wy+=i*(py+t)/2,Zy+=i*(dy+n)/2,Gy+=i,i=dy*t-py*n,Jy+=i*(py+t),Qy+=i*(dy+n),Ky+=3*i,zi(py=t,dy=n)}function Ii(t){this._context=t}function Yi(t,n){ag.point=Bi,eg=ig=t,rg=og=n}function Bi(t,n){ig-=t,og-=n,ug.add(B_(ig*ig+og*og)),ig=t,og=n}function Hi(){this._string=[]}function ji(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Xi(t){return t.length>1}function $i(t,n){return((t=t.x)[0]<0?t[1]-S_-k_:S_-t[1])-((n=n.x)[0]<0?n[1]-S_-k_:S_-n[1])}function Vi(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,u){var a=o>0?N_:-N_,c=P_(o-e);P_(c-N_)0?S_:-S_),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),n=0):i!==a&&c>=N_&&(P_(e-i)k_?L_((I_(n)*(o=q_(r))*I_(e)-I_(r)*(i=q_(n))*I_(t))/(i*o*u)):(n+r)/2}function Zi(t,n,e,r){var i;if(null==t)i=e*S_,r.point(-N_,i),r.point(0,i),r.point(N_,i),r.point(N_,0),r.point(N_,-i),r.point(0,-i),r.point(-N_,-i),r.point(-N_,0),r.point(-N_,i);else if(P_(t[0]-n[0])>k_){var o=t[0]4*n&&v--){var x=u+h,b=a+p,w=c+d,M=B_(x*x+b*b+w*w),T=mr(w/=M),k=P_(P_(w)-1)n||P_((y*A+g*C)/m-.5)>.3||u*h+a*p+c*d2?t[2]%360*z_:0,i()):[b*C_,w*C_,M*C_]},n.precision=function(t){return arguments.length?(A=vg(r,E=t*t),o()):B_(E)},n.fitExtent=function(t,e){return Qi(n,t,e)},n.fitSize=function(t,e){return Ki(n,t,e)},function(){return u=t.apply(this,arguments),n.invert=u.invert&&e,i()}}function io(t){var n=0,e=N_/3,r=ro(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*z_,e=t[1]*z_):[n*C_,e*C_]},i}function oo(t){function n(t,n){return[t*e,I_(n)/e]}var e=q_(t);return n.invert=function(t,n){return[t/e,mr(n*e)]},n}function uo(t,n){function e(t,n){var e=B_(o-2*i*I_(n))/i;return[e*I_(t*=i),u-e*q_(t)]}var r=I_(t),i=(r+I_(n))/2;if(P_(i)0?n<-S_+k_&&(n=-S_+k_):n>S_-k_&&(n=S_-k_);var e=o/F_(ho(n),i);return[e*I_(i*t),o-e*q_(i*t)]}var r=q_(t),i=t===n?I_(t):O_(r/q_(n))/O_(ho(n)/ho(t)),o=r*F_(ho(t),i)/i;return i?(e.invert=function(t,n){var e=o-n,r=Y_(i)*B_(t*t+e*e);return[R_(t,P_(e))/i*Y_(e),2*L_(F_(o/r,1/i))-S_]},e):fo}function vo(t,n){return[t,n]}function _o(t,n){function e(t,n){var e=o-n,r=i*t;return[e*I_(r),o-e*q_(r)]}var r=q_(t),i=t===n?I_(t):(r-q_(n))/(n-t),o=r/i+t;return P_(i)=0;)n+=e[r].value;else n=1;t.value=n}function Co(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}function zo(t,n){var e,r,i,o,u,a=new Uo(t),c=+t.value&&(a.value=t.value),s=[a];for(null==n&&(n=Lo);e=s.pop();)if(c&&(e.value=+e.data.value),(i=n(e.data))&&(u=i.length))for(e.children=new Array(u),o=u-1;o>=0;--o)s.push(r=e.children[o]=new Uo(i[o])),r.parent=e,r.depth=e.depth+1;return a.eachBefore(qo)}function Po(){return zo(this).eachBefore(Ro)}function Lo(t){return t.children}function Ro(t){t.data=t.data.data}function qo(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function Uo(t){this.data=t,this.depth=this.height=0,this.parent=null}function Do(t){this._=t,this.next=null}function Oo(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r-n.r;return i*i+1e-6>e*e+r*r}function Fo(t,n){var e,r,i,o=null,u=t.head;switch(n.length){case 1:e=Io(n[0]);break;case 2:e=Yo(n[0],n[1]);break;case 3:e=Bo(n[0],n[1],n[2])}for(;u;)i=u._,r=u.next,e&&Oo(e,i)?o=u:(o?(t.tail=o,o.next=null):t.head=t.tail=null,n.push(i),e=Fo(t,n),n.pop(),t.head?(u.next=t.head,t.head=u):(u.next=null,t.head=t.tail=u),o=t.tail,o.next=r),u=r;return t.tail=o,e}function Io(t){return{x:t.x,y:t.y,r:t.r}}function Yo(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,u=n.y,a=n.r,c=o-e,s=u-r,f=a-i,l=Math.sqrt(c*c+s*s);return{x:(e+o+c/l*f)/2,y:(r+u+s/l*f)/2,r:(l+i+a)/2}}function Bo(t,n,e){var r=t.x,i=t.y,o=t.r,u=n.x,a=n.y,c=n.r,s=e.x,f=e.y,l=e.r,h=2*(r-u),p=2*(i-a),d=2*(c-o),v=r*r+i*i-o*o-u*u-a*a+c*c,_=2*(r-s),y=2*(i-f),g=2*(l-o),m=r*r+i*i-o*o-s*s-f*f+l*l,x=_*p-h*y,b=(p*m-y*v)/x-r,w=(y*d-p*g)/x,M=(_*v-h*m)/x-i,T=(h*g-_*d)/x,k=w*w+T*T-1,N=2*(b*w+M*T+o),S=b*b+M*M-o*o,E=(-N-Math.sqrt(N*N-4*k*S))/(2*k);return{x:b+w*E+r,y:M+T*E+i,r:E}}function Ho(t,n,e){var r=t.x,i=t.y,o=n.r+e.r,u=t.r+e.r,a=n.x-r,c=n.y-i,s=a*a+c*c;if(s){var f=.5+((u*=u)-(o*=o))/(2*s),l=Math.sqrt(Math.max(0,2*o*(u+s)-(u-=s)*u-o*o))/(2*s);e.x=r+f*a+l*c,e.y=i+f*c-l*a}else e.x=r+u,e.y=i}function jo(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return i*i-1e-6>e*e+r*r}function Xo(t,n,e){var r=t._,i=t.next._,o=r.r+i.r,u=(r.x*i.r+i.x*r.r)/o-n,a=(r.y*i.r+i.y*r.r)/o-e;return u*u+a*a}function $o(t){this._=t,this.next=null,this.previous=null}function Vo(t){if(!(i=t.length))return 0;var n,e,r,i;if(n=t[0],n.x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;Ho(e,n,r=t[2]);var o,u,a,c,s,f,l,h=n.r*n.r,p=e.r*e.r,d=r.r*r.r,v=h+p+d,_=h*n.x+p*e.x+d*r.x,y=h*n.y+p*e.y+d*r.y;n=new $o(n),e=new $o(e),r=new $o(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(a=3;a=0;)n=i[o],n.z+=e,n.m+=e,e+=n.s+(r+=n.c)}function cu(t,n,e){return t.a.parent===n.parent?t.a:e}function su(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function fu(t){for(var n,e,r,i,o,u=new su(t,0),a=[u];n=a.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)a.push(e=n.children[i]=new su(r[i],i)),e.parent=n;return(u.parent=new su(null,0)).children=[u],u}function lu(t,n,e,r,i,o){for(var u,a,c,s,f,l,h,p,d,v,_,y=[],g=n.children,m=0,x=0,b=g.length,w=n.value;mh&&(h=a),_=f*f*v,(p=Math.max(h/_,_/l))>d){f-=a;break}d=p}y.push(u={value:f,dice:c1&&pm(t[e[r-2]],t[e[r-1]],t[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function du(t){this._size=t,this._call=this._error=null,this._tasks=[],this._data=[],this._waiting=this._active=this._ended=this._start=0}function vu(t){if(!t._start)try{_u(t)}catch(n){if(t._tasks[t._ended+t._active-1])gu(t,n);else if(!t._data)throw n}}function _u(t){for(;t._start=t._waiting&&t._active=0;)if((e=t._tasks[r])&&(t._tasks[r]=null,e.abort))try{e.abort()}catch(n){}t._active=NaN,mu(t)}function mu(t){if(!t._active&&t._call){var n=t._data;t._data=void 0,t._call(t._error,n)}}function xu(t){if(null==t)t=1/0;else if(!((t=+t)>=1))throw new Error("invalid concurrency");return new du(t)}function bu(t){return function(n,e){t(null==n?e:null)}}function wu(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}function Mu(t,n){return function(e){return t(e.responseText,n)}}function Tu(t){function n(n){var o=n+"",u=e.get(o);if(!u){if(i!==Om)return i;e.set(o,u=r.push(n))}return t[(u-1)%t.length]}var e=He(),r=[],i=Om;return t=null==t?[]:Dm.call(t),n.domain=function(t){if(!arguments.length)return r.slice();r=[],e=He();for(var i,o,u=-1,a=t.length;++u=e?1:r(t)}}}function Cu(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}function zu(t,n,e,r){var i=t[0],o=t[1],u=n[0],a=n[1];return o2?Pu:zu,o=u=null,r}function r(n){return(o||(o=i(a,c,f?Au(t):t,s)))(+n)}var i,o,u,a=Ym,c=Ym,s=qh,f=!1;return r.invert=function(t){return(u||(u=i(c,a,Eu,f?Cu(n):n)))(+t)},r.domain=function(t){return arguments.length?(a=Um.call(t,Im),e()):a.slice()},r.range=function(t){return arguments.length?(c=Dm.call(t),e()):c.slice()},r.rangeRound=function(t){return c=Dm.call(t),s=Uh,e()},r.clamp=function(t){return arguments.length?(f=!!t,e()):f},r.interpolate=function(t){return arguments.length?(s=t,e()):s},e()}function qu(t){var n=t.domain;return t.ticks=function(t){var e=n();return hf(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){return Bm(n(),t,e)},t.nice=function(e){null==e&&(e=10);var i,o=n(),u=0,a=o.length-1,c=o[u],s=o[a];return s0?(c=Math.floor(c/i)*i,s=Math.ceil(s/i)*i,i=r(c,s,e)):i<0&&(c=Math.ceil(c*i)/i,s=Math.floor(s*i)/i,i=r(c,s,e)),i>0?(o[u]=Math.floor(c/i)*i,o[a]=Math.ceil(s/i)*i,n(o)):i<0&&(o[u]=Math.ceil(c*i)/i,o[a]=Math.floor(s*i)/i,n(o)),t},t}function Uu(){var t=Ru(Eu,Ch);return t.copy=function(){return Lu(t,Uu())},qu(t)}function Du(){function t(t){return+t}var n=[0,1];return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=Um.call(e,Im),t):n.slice()},t.copy=function(){return Du().domain(n)},qu(t)}function Ou(t,n){return(n=Math.log(n/t))?function(e){return Math.log(e/t)/n}:Fm(n)}function Fu(t,n){return t<0?function(e){return-Math.pow(-n,e)*Math.pow(-t,1-e)}:function(e){return Math.pow(n,e)*Math.pow(t,1-e)}}function Iu(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Yu(t){return 10===t?Iu:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}function Bu(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}function Hu(t){return function(n){return-t(-n)}}function ju(){function n(){return o=Bu(i),u=Yu(i),r()[0]<0&&(o=Hu(o),u=Hu(u)),e}var e=Ru(Ou,Fu).domain([1,10]),r=e.domain,i=10,o=Bu(10),u=Yu(10);return e.base=function(t){return arguments.length?(i=+t,n()):i},e.domain=function(t){return arguments.length?(r(t),n()):r()},e.ticks=function(t){var n,e=r(),a=e[0],c=e[e.length-1];(n=c0){for(;hc)break;v.push(l)}}else for(;h=1;--f)if(!((l=s*f)c)break;v.push(l)}}else v=hf(h,p,Math.min(p-h,d)).map(u);return n?v.reverse():v},e.tickFormat=function(n,r){if(null==r&&(r=10===i?".0e":","),"function"!=typeof r&&(r=t.format(r)),n===1/0)return r;null==n&&(n=10);var a=Math.max(1,i*n/e.ticks().length);return function(t){var n=t/u(Math.round(o(t)));return n*i0?i[n-1]:e[0],n=i?[o[i-1],r]:[o[n-1],o[n]]},t.copy=function(){return Zu().domain([e,r]).range(u)},qu(t)}function Gu(){function t(t){if(t<=t)return e[Vs(n,t,0,r)]}var n=[.5],e=[0,1],r=1;return t.domain=function(i){return arguments.length?(n=Dm.call(i),r=Math.min(n.length,e.length-1),t):n.slice()},t.range=function(i){return arguments.length?(e=Dm.call(i),r=Math.min(n.length,e.length-1),t):e.slice()},t.invertExtent=function(t){var r=e.indexOf(t);return[n[r-1],n[r]]},t.copy=function(){return Gu().domain(n).range(e)},t}function Ju(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n0))return u;do{u.push(new Date(+e))}while(n(e,o),t(e),e=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return jm.setTime(+n),Xm.setTime(+r),t(jm),t(Xm),Math.floor(e(jm,Xm))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}function Qu(t){return Ju(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Wm)/Zm})}function Ku(t){return Ju(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/Zm})}function ta(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function na(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ea(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function ra(t){function n(t,n){return function(e){var r,i,o,u=[],a=-1,c=0,s=t.length;for(e instanceof Date||(e=new Date(+e));++a=c)return-1;if(37===(i=n.charCodeAt(u++))){if(i=n.charAt(u++),!(o=B[i in Vx?n.charAt(u++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function i(t,n,e){var r=C.exec(n.slice(e));return r?(t.p=z[r[0].toLowerCase()],e+r[0].length):-1}function o(t,n,e){var r=R.exec(n.slice(e));return r?(t.w=q[r[0].toLowerCase()],e+r[0].length):-1}function u(t,n,e){var r=P.exec(n.slice(e));return r?(t.w=L[r[0].toLowerCase()],e+r[0].length):-1}function a(t,n,e){var r=O.exec(n.slice(e));return r?(t.m=F[r[0].toLowerCase()],e+r[0].length):-1}function c(t,n,e){var r=U.exec(n.slice(e));return r?(t.m=D[r[0].toLowerCase()],e+r[0].length):-1}function s(t,n,e){return r(t,w,n,e)}function f(t,n,e){return r(t,M,n,e)}function l(t,n,e){return r(t,T,n,e)}function h(t){return S[t.getDay()]}function p(t){return N[t.getDay()]}function d(t){return A[t.getMonth()]}function v(t){return E[t.getMonth()]}function _(t){return k[+(t.getHours()>=12)]}function y(t){return S[t.getUTCDay()]}function g(t){return N[t.getUTCDay()]}function m(t){return A[t.getUTCMonth()]}function x(t){return E[t.getUTCMonth()]}function b(t){return k[+(t.getUTCHours()>=12)]}var w=t.dateTime,M=t.date,T=t.time,k=t.periods,N=t.days,S=t.shortDays,E=t.months,A=t.shortMonths,C=ua(k),z=aa(k),P=ua(N),L=aa(N),R=ua(S),q=aa(S),U=ua(E),D=aa(E),O=ua(A),F=aa(A),I={a:h,A:p,b:d,B:v,c:null,d:wa,e:wa,H:Ma,I:Ta,j:ka,L:Na,m:Sa,M:Ea,p:_,S:Aa,U:Ca,w:za,W:Pa,x:null,X:null,y:La,Y:Ra,Z:qa,"%":Ga},Y={a:y,A:g,b:m,B:x,c:null,d:Ua,e:Ua,H:Da,I:Oa,j:Fa,L:Ia,m:Ya,M:Ba,p:b,S:Ha,U:ja,w:Xa,W:$a,x:null,X:null,y:Va,Y:Wa,Z:Za,"%":Ga},B={a:o,A:u,b:a,B:c,c:s,d:va,e:va,H:ya,I:ya,j:_a,L:xa,m:da,M:ga,p:i,S:ma,U:sa,w:ca,W:fa,x:f,X:l,y:ha,Y:la,Z:pa,"%":ba};return I.x=n(M,I),I.X=n(T,I),I.c=n(w,I),Y.x=n(M,Y),Y.X=n(T,Y),Y.c=n(w,Y),{format:function(t){var e=n(t+="",I);return e.toString=function(){return t},e},parse:function(t){var n=e(t+="",ta);return n.toString=function(){return t},n},utcFormat:function(t){var e=n(t+="",Y);return e.toString=function(){return t},e},utcParse:function(t){var n=e(t,na);return n.toString=function(){return t},n}}}function ia(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),e+r[0].length):-1}function pa(t,n,e){var r=/^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function da(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function va(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function _a(t,n,e){var r=Wx.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function ya(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ga(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ma(t,n,e){var r=Wx.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function xa(t,n,e){var r=Wx.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function ba(t,n,e){var r=Zx.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function wa(t,n){return ia(t.getDate(),n,2)}function Ma(t,n){return ia(t.getHours(),n,2)}function Ta(t,n){return ia(t.getHours()%12||12,n,2)}function ka(t,n){return ia(1+ex.count(xx(t),t),n,3)}function Na(t,n){return ia(t.getMilliseconds(),n,3)}function Sa(t,n){return ia(t.getMonth()+1,n,2)}function Ea(t,n){return ia(t.getMinutes(),n,2)}function Aa(t,n){return ia(t.getSeconds(),n,2)}function Ca(t,n){return ia(ix.count(xx(t),t),n,2)}function za(t){return t.getDay()}function Pa(t,n){return ia(ox.count(xx(t),t),n,2)}function La(t,n){return ia(t.getFullYear()%100,n,2)}function Ra(t,n){return ia(t.getFullYear()%1e4,n,4)}function qa(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+ia(n/60|0,"0",2)+ia(n%60,"0",2)}function Ua(t,n){return ia(t.getUTCDate(),n,2)}function Da(t,n){return ia(t.getUTCHours(),n,2)}function Oa(t,n){return ia(t.getUTCHours()%12||12,n,2)}function Fa(t,n){return ia(1+Nx.count(jx(t),t),n,3)}function Ia(t,n){return ia(t.getUTCMilliseconds(),n,3)}function Ya(t,n){return ia(t.getUTCMonth()+1,n,2)}function Ba(t,n){return ia(t.getUTCMinutes(),n,2)}function Ha(t,n){return ia(t.getUTCSeconds(),n,2)}function ja(t,n){return ia(Ex.count(jx(t),t),n,2)}function Xa(t){return t.getUTCDay()}function $a(t,n){return ia(Ax.count(jx(t),t),n,2)}function Va(t,n){return ia(t.getUTCFullYear()%100,n,2)}function Wa(t,n){return ia(t.getUTCFullYear()%1e4,n,4)}function Za(){return"+0000"}function Ga(){return"%"}function Ja(n){return Xx=ra(n),t.timeFormat=Xx.format,t.timeParse=Xx.parse,t.utcFormat=Xx.utcFormat,t.utcParse=Xx.utcParse,Xx}function Qa(t){return t.toISOString()}function Ka(t){var n=new Date(t);return isNaN(n)?null:n}function tc(t){return new Date(t)}function nc(t){return t instanceof Date?+t:+new Date(+t)}function ec(t,n,e,r,o,u,a,c,s){function f(i){return(a(i)1?0:t<-1?zb:Math.acos(t)}function uc(t){return t>=1?Pb:t<=-1?-Pb:Math.asin(t)}function ac(t){return t.innerRadius}function cc(t){return t.outerRadius}function sc(t){return t.startAngle}function fc(t){return t.endAngle}function lc(t){return t&&t.padAngle}function hc(t,n,e,r,i,o,u,a){var c=e-t,s=r-n,f=u-i,l=a-o,h=(f*(n-o)-l*(t-i))/(l*c-f*s);return[t+h*c,n+h*s]}function pc(t,n,e,r,i,o,u){var a=t-e,c=n-r,s=(u?o:-o)/Ab(a*a+c*c),f=s*c,l=-s*a,h=t+f,p=n+l,d=e+f,v=r+l,_=(h+d)/2,y=(p+v)/2,g=d-h,m=v-p,x=g*g+m*m,b=i-o,w=h*v-d*p,M=(m<0?-1:1)*Ab(Nb(0,b*b*x-w*w)),T=(w*m-g*M)/x,k=(-w*g-m*M)/x,N=(w*m+g*M)/x,S=(-w*g+m*M)/x,E=T-_,A=k-y,C=N-_,z=S-y;return E*E+A*A>C*C+z*z&&(T=N,k=S),{cx:T,cy:k,x01:-f,y01:-l,x11:T*(i/b-1),y11:k*(i/b-1)}}function dc(t){this._context=t}function vc(t){return t[0]}function _c(t){return t[1]}function yc(t){this._curve=t}function gc(t){function n(n){return new yc(t(n))}return n._curve=t,n}function mc(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(gc(t)):n()._curve},t}function xc(t){return t.source}function bc(t){return t.target}function wc(t){function n(){var n,a=jb.call(arguments),c=e.apply(this,a),s=r.apply(this,a);if(u||(u=n=Ue()),t(u,+i.apply(this,(a[0]=c,a)),+o.apply(this,a),+i.apply(this,(a[0]=s,a)),+o.apply(this,a)),n)return u=null,n+""||null}var e=xc,r=bc,i=vc,o=_c,u=null;return n.source=function(t){return arguments.length?(e=t,n):e},n.target=function(t){return arguments.length?(r=t,n):r},n.x=function(t){return arguments.length?(i="function"==typeof t?t:wb(+t),n):i},n.y=function(t){return arguments.length?(o="function"==typeof t?t:wb(+t),n):o},n.context=function(t){return arguments.length?(u=null==t?null:t,n):u},n}function Mc(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function Tc(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function kc(t,n,e,r,i){var o=Xb(n,e),u=Xb(n,e=(e+i)/2),a=Xb(r,e),c=Xb(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(u[0],u[1],a[0],a[1],c[0],c[1])}function Nc(){return wc(Mc)}function Sc(){return wc(Tc)}function Ec(){var t=wc(kc);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}function Ac(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Cc(t){this._context=t}function zc(t){this._context=t}function Pc(t){this._context=t}function Lc(t,n){this._basis=new Cc(t),this._beta=n}function Rc(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function qc(t,n){this._context=t,this._k=(1-n)/6}function Uc(t,n){this._context=t,this._k=(1-n)/6}function Dc(t,n){this._context=t,this._k=(1-n)/6}function Oc(t,n,e){var r=t._x1,i=t._y1,o=t._x2,u=t._y2;if(t._l01_a>Cb){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>Cb){var s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-n*t._l12_2a)/f,u=(u*s+t._y1*t._l23_2a-e*t._l12_2a)/f}t._context.bezierCurveTo(r,i,o,u,t._x2,t._y2)}function Fc(t,n){this._context=t,this._alpha=n}function Ic(t,n){this._context=t,this._alpha=n}function Yc(t,n){this._context=t,this._alpha=n}function Bc(t){this._context=t}function Hc(t){return t<0?-1:1}function jc(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),u=(e-t._y1)/(i||r<0&&-0),a=(o*i+u*r)/(r+i);return(Hc(o)+Hc(u))*Math.min(Math.abs(o),Math.abs(u),.5*Math.abs(a))||0}function Xc(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function $c(t,n,e){var r=t._x0,i=t._y0,o=t._x1,u=t._y1,a=(o-r)/3;t._context.bezierCurveTo(r+a,i+a*n,o-a,u-a*e,o,u)}function Vc(t){this._context=t}function Wc(t){this._context=new Zc(t)}function Zc(t){this._context=t}function Gc(t){return new Vc(t)}function Jc(t){return new Wc(t)}function Qc(t){this._context=t}function Kc(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),u=new Array(r);for(i[0]=0,o[0]=2,u[0]=t[0]+2*t[1],n=1;n=0;--n)i[n]=(u[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n0)){if(o/=d,d<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=r-c,d||!(o<0)){if(o/=d,d<0){if(o>p)return;o>h&&(h=o)}else if(d>0){if(o0)){if(o/=v,v<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=i-s,v||!(o<0)){if(o/=v,v<0){if(o>p)return;o>h&&(h=o)}else if(v>0){if(o0||p<1)||(h>0&&(t[0]=[c+h*d,s+h*v]),p<1&&(t[1]=[c+p*d,s+p*v]),!0)}}}}}function _s(t,n,e,r,i){var o=t[1];if(o)return!0;var u,a,c=t[0],s=t.left,f=t.right,l=s[0],h=s[1],p=f[0],d=f[1],v=(l+p)/2,_=(h+d)/2;if(d===h){if(v=r)return;if(l>p){if(c){if(c[1]>=i)return}else c=[v,e];o=[v,i]}else{if(c){if(c[1]1)if(l>p){if(c){if(c[1]>=i)return}else c=[(e-a)/u,e];o=[(i-a)/u,i]}else{if(c){if(c[1]=r)return}else c=[n,u*n+a];o=[r,u*r+a]}else{if(c){if(c[0]jw||Math.abs(i[0][1]-i[1][1])>jw)||delete Yw[o]}function gs(t){return Fw[t.index]={site:t,halfedges:[]}}function ms(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function xs(t,n){return n[+(n.left!==t.site)]}function bs(t,n){return n[+(n.left===t.site)]}function ws(){for(var t,n,e,r,i=0,o=Fw.length;ijw||Math.abs(v-h)>jw)&&(c.splice(a,0,Yw.push(ps(u,p,Math.abs(d-t)jw?[t,Math.abs(l-t)jw?[Math.abs(h-r)jw?[e,Math.abs(l-e)jw?[Math.abs(h-n)=-Xw)){var p=c*c+s*s,d=f*f+l*l,v=(l*p-s*d)/h,_=(c*d-f*p)/h,y=Bw.pop()||new Ts;y.arc=t,y.site=i,y.x=v+u,y.y=(y.cy=_+a)+Math.sqrt(v*v+_*_),t.circle=y;for(var g=null,m=Iw._;m;)if(y.yjw)a=a.L;else{if(!((i=o-Ls(a,u))>jw)){r>-jw?(n=a.P,e=a):i>-jw?(n=a,e=a.N):n=e=a;break}if(!a.R){n=a;break}a=a.R}gs(t);var c=Es(t);if(Ow.insert(n,c),n||e){if(n===e)return Ns(n),e=Es(n.site),Ow.insert(c,e),c.edge=e.edge=hs(n.site,c.site),ks(n),void ks(e);if(!e)return void(c.edge=hs(n.site,c.site));Ns(n),Ns(e);var s=n.site,f=s[0],l=s[1],h=t[0]-f,p=t[1]-l,d=e.site,v=d[0]-f,_=d[1]-l,y=2*(h*_-p*v),g=h*h+p*p,m=v*v+_*_,x=[(_*g-p*m)/y+f,(h*m-v*g)/y+l];ds(e.edge,s,d,x),c.edge=hs(s,t,null,x),e.edge=hs(t,d,null,x),ks(n),ks(e)}}function Ps(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var u=t.P;if(!u)return-1/0;e=u.site;var a=e[0],c=e[1],s=c-n;if(!s)return a;var f=a-r,l=1/o-1/s,h=f/s;return l?(-h+Math.sqrt(h*h-2*l*(f*f/(-2*s)-c+s/2+i-o/2)))/l+r:(r+a)/2}function Ls(t,n){var e=t.N;if(e)return Ps(e,n);var r=t.site;return r[1]===n?r[0]:1/0}function Rs(t,n,e){return(t[0]-e[0])*(n[1]-t[1])-(t[0]-n[0])*(e[1]-t[1])}function qs(t,n){return n[1]-t[1]||n[0]-t[0]}function Us(t,n){var e,r,i,o=t.sort(qs).pop();for(Yw=[],Fw=new Array(t.length),Ow=new as,Iw=new as;;)if(i=Dw,o&&(!i||o[1]n?1:t>=n?0:NaN},Xs=function(t){return 1===t.length&&(t=n(t)),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;t(n[o],e)>0?i=o:r=o+1}return r}}},$s=Xs(js),Vs=$s.right,Ws=$s.left,Zs=function(t,n){null==n&&(n=e);for(var r=0,i=t.length-1,o=t[0],u=new Array(i<0?0:i);rt?1:n>=t?0:NaN},Qs=function(t){return null===t?NaN:+t},Ks=function(t,n){var e,r,i=t.length,o=0,u=-1,a=0,c=0;if(null==n)for(;++u1)return c/(o-1)},tf=function(t,n){var e=Ks(t,n);return e?Math.sqrt(e):e},nf=function(t,n){var e,r,i,o=t.length,u=-1;if(null==n){for(;++u=e)for(r=i=e;++ue&&(r=e),i=e)for(r=i=e;++ue&&(r=e),i0)for(t=Math.ceil(t/u),n=Math.floor(n/u),o=new Array(i=Math.ceil(n-t+1));++cl;)h.pop(),--p;var d,v=new Array(p+1);for(o=0;o<=p;++o)d=v[o]=[],d.x0=o>0?h[o-1]:f,d.x1=o=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),u=+e(t[o],o,t);return u+(+e(t[o+1],o+1,t)-u)*(i-o)}},_f=function(t,n,e){return t=of.call(t,Qs).sort(js),Math.ceil((e-n)/(2*(vf(t,.75)-vf(t,.25))*Math.pow(t.length,-1/3)))},yf=function(t,n,e){return Math.ceil((e-n)/(3.5*tf(t)*Math.pow(t.length,-1/3)))},gf=function(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o=e)for(r=e;++or&&(r=e)}else for(;++o=e)for(r=e;++or&&(r=e);return r},mf=function(t,n){var e,r=t.length,i=r,o=-1,u=0;if(null==n)for(;++o=0;)for(r=t[i],n=r.length;--n>=0;)e[--u]=r[n];return e},wf=function(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o=e)for(r=e;++oe&&(r=e)}else for(;++o=e)for(r=e;++oe&&(r=e);return r},Mf=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},Tf=function(t,n){if(e=t.length){var e,r,i=0,o=0,u=t[o];for(null==n&&(n=js);++i0)for(var e,r,i=new Array(e),o=0;o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Of.hasOwnProperty(n)?{space:Of[n],local:t}:t},If=function(t){var n=Ff(t);return(n.local?b:x)(n)},Yf=0;M.prototype=w.prototype={constructor:M,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var Bf=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var Hf=document.documentElement;if(!Hf.matches){var jf=Hf.webkitMatchesSelector||Hf.msMatchesSelector||Hf.mozMatchesSelector||Hf.oMatchesSelector;Bf=function(t){return function(){return jf.call(this,t)}}}}var Xf=Bf,$f={};if(t.event=null,"undefined"!=typeof document){"onmouseenter"in document.documentElement||($f={mouseenter:"mouseover",mouseleave:"mouseout"})}var Vf=function(t,n,e){var r,i,o=N(t+""),u=o.length;{if(!(arguments.length<2)){for(a=n?E:S,null==e&&(e=!1),r=0;r=x&&(x=m+1);!(g=_[x])&&++x=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},fl=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=q);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?B:"function"==typeof n?j:H)(t,n,null==e?"":e)):X(this.node(),t)},xl=function(t,n){return arguments.length>1?this.each((null==n?$:"function"==typeof n?W:V)(t,n)):this.node()[t]};J.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var bl=function(t,n){var e=Z(t+"");if(arguments.length<2){for(var r=G(this.node()),i=-1,o=e.length;++ix}y.mouse("drag")}function i(){Pl(t.event.view).on("mousemove.drag mouseup.drag",null),mt(t.event.view,l),Ul(),y.mouse("end")}function o(){if(p.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=d.apply(this,arguments),o=r.length;for(n=0;n=240?t-240:t+120,i,r),Ut(t,i,r),Ut(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Kl=Math.PI/180,th=180/Math.PI,nh=.95047,eh=1,rh=1.08883,ih=4/29,oh=6/29,uh=3*oh*oh,ah=oh*oh*oh;Il(Ft,Ot,Tt(kt,{brighter:function(t){return new Ft(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Ft(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=eh*Yt(t),n=nh*Yt(n),e=rh*Yt(e),new zt(Bt(3.2404542*n-1.5371385*t-.4985314*e),Bt(-.969266*n+1.8760108*t+.041556*e),Bt(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),Il($t,Xt,Tt(kt,{brighter:function(t){return new $t(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new $t(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Dt(this).rgb()}}));var ch=-.14861,sh=1.78277,fh=-.29227,lh=-.90649,hh=1.97294,ph=hh*lh,dh=hh*sh,vh=sh*fh-lh*ch;Il(Zt,Wt,Tt(kt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Zt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Zt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Kl,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new zt(255*(n+e*(ch*r+sh*i)),255*(n+e*(fh*r+lh*i)),255*(n+e*(hh*r)),this.opacity)}}));var _h,yh,gh,mh,xh,bh,wh=function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],u=r>0?t[r-1]:2*i-o,a=ro&&(i=n.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:Ch(e,r)})),o=Lh.lastIndex;return ohp&&e.statelp&&e.name===n)return new ne([[t]],ld,n,+r)}return null},pd=function(t){return function(){return t}},dd=function(t,n,e){this.target=t,this.type=n,this.selection=e},vd=function(){t.event.preventDefault(),t.event.stopImmediatePropagation()},_d={name:"drag"},yd={name:"space"},gd={name:"handle"},md={name:"center"},xd={name:"x",handles:["e","w"].map(ke),input:function(t,n){return t&&[[t[0],n[0][1]],[t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},bd={name:"y",handles:["n","s"].map(ke),input:function(t,n){return t&&[[n[0][0],t[0]],[n[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},wd={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(ke),input:function(t){return t},output:function(t){return t}},Md={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Td={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},kd={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Nd={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Sd={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1},Ed=function(){return Le(wd)},Ad=Math.cos,Cd=Math.sin,zd=Math.PI,Pd=zd/2,Ld=2*zd,Rd=Math.max,qd=function(){function t(t){var o,u,a,c,s,f,l=t.length,h=[],p=cf(l),d=[],v=[],_=v.groups=new Array(l),y=new Array(l*l);for(o=0,s=-1;++s1e-6)if(Math.abs(f*a-c*s)>1e-6&&i){var h=e-o,p=r-u,d=a*a+c*c,v=h*h+p*p,_=Math.sqrt(d),y=Math.sqrt(l),g=i*Math.tan((Od-Math.acos((d+l-v)/(2*_*y)))/2),m=g/y,x=g/_;Math.abs(m-1)>1e-6&&(this._+="L"+(t+m*s)+","+(n+m*f)),this._+="A"+i+","+i+",0,0,"+ +(f*h>s*p)+","+(this._x1=t+x*a)+","+(this._y1=n+x*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n,e=+e;var u=e*Math.cos(r),a=e*Math.sin(r),c=t+u,s=n+a,f=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+s:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+c+","+s),e&&(l<0&&(l=l%Fd+Fd),l>Id?this._+="A"+e+","+e+",0,1,"+f+","+(t-u)+","+(n-a)+"A"+e+","+e+",0,1,"+f+","+(this._x1=c)+","+(this._y1=s):l>1e-6&&(this._+="A"+e+","+e+",0,"+ +(l>=Od)+","+f+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var Yd=function(){function t(){var t,a=Ud.call(arguments),c=n.apply(this,a),s=e.apply(this,a),f=+r.apply(this,(a[0]=c,a)),l=i.apply(this,a)-Pd,h=o.apply(this,a)-Pd,p=f*Ad(l),d=f*Cd(l),v=+r.apply(this,(a[0]=s,a)),_=i.apply(this,a)-Pd,y=o.apply(this,a)-Pd;if(u||(u=t=Ue()),u.moveTo(p,d),u.arc(0,0,f,l,h),l===_&&h===y||(u.quadraticCurveTo(0,0,v*Ad(_),v*Cd(_)),u.arc(0,0,v,_,y)),u.quadraticCurveTo(0,0,p,d),u.closePath(),t)return u=null,t+""||null}var n=De,e=Oe,r=Fe,i=Ie,o=Ye,u=null;return t.radius=function(n){return arguments.length?(r="function"==typeof n?n:Dd(+n),t):r},t.startAngle=function(n){return arguments.length?(i="function"==typeof n?n:Dd(+n),t):i},t.endAngle=function(n){return arguments.length?(o="function"==typeof n?n:Dd(+n),t):o},t.source=function(e){return arguments.length?(n=e,t):n},t.target=function(n){return arguments.length?(e=n,t):e},t.context=function(n){return arguments.length?(u=null==n?null:n,t):u},t};Be.prototype=He.prototype={constructor:Be,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var Bd=function(){function t(n,i,u,a){if(i>=o.length)return null!=r?r(n):null!=e?n.sort(e):n;for(var c,s,f,l=-1,h=n.length,p=o[i++],d=He(),v=u();++lo.length)return t;var i,a=u[e-1];return null!=r&&e>=o.length?i=t.entries():(i=[],t.each(function(t,r){i.push({key:r,values:n(t,e)})})),null!=a?i.sort(function(t,n){return a(t.key,n.key)}):i}var e,r,i,o=[],u=[];return i={object:function(n){return t(n,0,je,Xe)},map:function(n){return t(n,0,$e,Ve)},entries:function(e){return n(t(e,0,$e,Ve),0)},key:function(t){return o.push(t),i},sortKeys:function(t){return u[o.length-1]=t,i},sortValues:function(t){return e=t,i},rollup:function(t){return r=t,i}}},Hd=He.prototype;We.prototype=Ze.prototype={constructor:We,has:Hd.has,add:function(t){return t+="",this["$"+t]=t,this},remove:Hd.remove,clear:Hd.clear,values:Hd.keys,size:Hd.size,empty:Hd.empty,each:Hd.each};var jd=function(t){var n=[];for(var e in t)n.push(e);return n},Xd=function(t){var n=[];for(var e in t)n.push(t[e]);return n},$d=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},Vd=function(t){function n(t,n){var r,i,o=e(t,function(t,e){if(r)return r(t,e-1);i=t,r=n?Je(t,n):Ge(t)});return o.columns=i,o}function e(t,n){function e(){if(f>=s)return u;if(i)return i=!1,o;var n,e=f;if(34===t.charCodeAt(e)){for(var r=e;r++t||t>i||r>n||n>o))return this;var u,a,c=i-e,s=this._root;switch(a=(n<(r+o)/2)<<1|t<(e+i)/2){case 0:do{u=new Array(4),u[a]=s,s=u}while(c*=2,i=e+c,o=r+c,t>i||n>o);break;case 1:do{u=new Array(4),u[a]=s,s=u}while(c*=2,e=i-c,o=r+c,e>t||n>o);break;case 2:do{u=new Array(4),u[a]=s,s=u}while(c*=2,i=e+c,r=o-c,t>i||r>n);break;case 3:do{u=new Array(4),u[a]=s,s=u}while(c*=2,e=i-c,r=o-c,e>t||r>n)}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},sv=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},fv=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},lv=function(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i},hv=function(t,n,e){var r,i,o,u,a,c,s,f=this._x0,l=this._y0,h=this._x1,p=this._y1,d=[],v=this._root;for(v&&d.push(new lv(v,f,l,h,p)),null==e?e=1/0:(f=t-e,l=n-e,h=t+e,p=n+e,e*=e);c=d.pop();)if(!(!(v=c.node)||(i=c.x0)>h||(o=c.y0)>p||(u=c.x1)=y)<<1|t>=_)&&(c=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=c)}else{var g=t-+this._x.call(null,v.data),m=n-+this._y.call(null,v.data),x=g*g+m*m;if(x=(a=(d+_)/2))?d=a:_=a,(f=u>=(c=(v+y)/2))?v=c:y=c,n=p,!(p=p[l=f<<1|s]))return this;if(!p.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[h]=p:this._root=p),this):(this._root=i,this)},dv=function(){return this._root},vv=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},_v=function(t){var n,e,r,i,o,u,a=[],c=this._root;for(c&&a.push(new lv(c,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(c=n.node,r=n.x0,i=n.y0,o=n.x1,u=n.y1)&&c.length){var s=(r+o)/2,f=(i+u)/2;(e=c[3])&&a.push(new lv(e,s,f,o,u)),(e=c[2])&&a.push(new lv(e,r,f,s,u)),(e=c[1])&&a.push(new lv(e,s,i,o,f)),(e=c[0])&&a.push(new lv(e,r,i,s,f))}return this},yv=function(t){var n,e=[],r=[];for(this._root&&e.push(new lv(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,u=n.x0,a=n.y0,c=n.x1,s=n.y1,f=(u+c)/2,l=(a+s)/2;(o=i[0])&&e.push(new lv(o,u,a,f,l)),(o=i[1])&&e.push(new lv(o,f,a,c,l)),(o=i[2])&&e.push(new lv(o,u,l,f,s)),(o=i[3])&&e.push(new lv(o,f,l,c,s))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},gv=function(t){return arguments.length?(this._x=t,this):this._x},mv=function(t){return arguments.length?(this._y=t,this):this._y},xv=ir.prototype=or.prototype;xv.copy=function(){var t,n,e=new or(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=ur(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=ur(n));return e},xv.add=av,xv.addAll=tr,xv.cover=cv,xv.data=sv,xv.extent=fv,xv.find=hv,xv.remove=pv,xv.removeAll=nr,xv.root=dv,xv.size=vv,xv.visit=_v,xv.visitAfter=yv,xv.x=gv,xv.y=mv;var bv,wv=function(t){function n(){function t(t,n,e,r,i){var o=t.data,a=t.r,p=l+a;{if(!o)return n>s+p||rf+p||ic.index){var d=s-o.x-o.vx,v=f-o.y-o.vy,_=d*d+v*v;_t.r&&(t.r=t[n].r)}function r(){if(i){var n,e,r=i.length;for(o=new Array(r),n=0;n1?(null==n?l.remove(t):l.set(t,i(n)),o):l.get(t)},find:function(n,e,r){var i,o,u,a,c,s=0,f=t.length;for(null==r?r=1/0:r*=r,s=0;s1?(p.on(t,n),o):p.on(t)}}},Sv=function(){function t(t){var n,a=i.length,c=ir(i,lr,hr).visitAfter(e);for(u=t,n=0;n=f)){(t.data!==o||t.next)&&(0===i&&(i=uv(),p+=i*i),0===c&&(c=uv(),p+=c*c),p1?r[0]+r.slice(2):r,+t.slice(e+1)]},zv=function(t){return t=Cv(Math.abs(t)),t?t[1]:NaN},Pv=function(t,n){return function(e,r){for(var i=e.length,o=[],u=0,a=t[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(e.substring(i-=a,i+a)),!((c+=a+1)>r));)a=t[u=(u+1)%t.length];return o.reverse().join(n)}},Lv=function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}},Rv=function(t,n){t=t.toPrecision(n);t:for(var e,r=t.length,i=1,o=-1;i0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t},qv=function(t,n){var e=Cv(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(bv=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return o===u?r:o>u?r+new Array(o-u+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Cv(t,Math.max(0,n+o-1))[0]},Uv=function(t,n){var e=Cv(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},Dv={"":Rv,"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Uv(100*t,n)},r:Uv,s:qv,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Ov=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;pr.prototype=dr.prototype,dr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var Fv,Iv=function(t){return t},Yv=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Bv=function(t){function n(t){function n(t){var n,i,a,f=_,x=y;if("c"===v)x=g(t)+x,t="";else{t=+t;var b=t<0;if(t=g(Math.abs(t),d),b&&0==+t&&(b=!1),f=(b?"("===s?s:"-":"-"===s||"("===s?"":s)+f,x=x+("s"===v?Yv[8+bv/3]:"")+(b&&"("===s?")":""),m)for(n=-1,i=t.length;++n(a=t.charCodeAt(n))||a>57){x=(46===a?o+t.slice(n+1):t.slice(n))+x,t=t.slice(0,n);break}}p&&!l&&(t=r(t,1/0));var w=f.length+t.length+x.length,M=w>1)+f+t+x+M.slice(w);break;default:t=M+f+t+x}return u(t)}t=pr(t);var e=t.fill,c=t.align,s=t.sign,f=t.symbol,l=t.zero,h=t.width,p=t.comma,d=t.precision,v=t.type,_="$"===f?i[0]:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===f?i[1]:/[%p]/.test(v)?a:"",g=Dv[v],m=!v||/[defgprs%]/.test(v);return d=null==d?v?6:12:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),n.toString=function(){return t+""},n}function e(t,e){var r=n((t=pr(t),t.type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(zv(e)/3))),o=Math.pow(10,-i),u=Yv[8+i/3];return function(t){return r(o*t)+u}}var r=t.grouping&&t.thousands?Pv(t.grouping,t.thousands):Iv,i=t.currency,o=t.decimal,u=t.numerals?Lv(t.numerals):Iv,a=t.percent||"%";return{format:n,formatPrefix:e}};vr({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var Hv=function(t){return Math.max(0,-zv(Math.abs(t)))},jv=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(zv(n)/3)))-zv(Math.abs(t)))},Xv=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,zv(n)-zv(t))+1},$v=function(){return new _r};_r.prototype={constructor:_r,reset:function(){this.s=this.t=0},add:function(t){yr(T_,t,this.t),yr(this,T_.s,this.s),this.s?this.t+=T_.t:this.s=T_.t},valueOf:function(){return this.s}};var Vv,Wv,Zv,Gv,Jv,Qv,Kv,t_,n_,e_,r_,i_,o_,u_,a_,c_,s_,f_,l_,h_,p_,d_,v_,__,y_,g_,m_,x_,b_,w_,M_,T_=new _r,k_=1e-6,N_=Math.PI,S_=N_/2,E_=N_/4,A_=2*N_,C_=180/N_,z_=N_/180,P_=Math.abs,L_=Math.atan,R_=Math.atan2,q_=Math.cos,U_=Math.ceil,D_=Math.exp,O_=Math.log,F_=Math.pow,I_=Math.sin,Y_=Math.sign||function(t){return t>0?1:t<0?-1:0},B_=Math.sqrt,H_=Math.tan,j_={Feature:function(t,n){wr(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++rk_?n_=90:J_<-k_&&(Kv=-90),a_[0]=Qv,a_[1]=t_}},K_=function(t){var n,e,r,i,o,u,a;if(n_=t_=-(Qv=Kv=1/0),u_=[],$_(t,Q_),e=u_.length){for(u_.sort(jr),n=1,r=u_[0],o=[r];nHr(r[0],r[1])&&(r[1]=i[1]),Hr(i[0],r[1])>Hr(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(u=-1/0,e=o.length-1,n=0,r=o[e];n<=e;r=i,++n)i=o[n],(a=Hr(r[1],i[0]))>u&&(u=a,Qv=i[0],t_=r[1])}return u_=a_=null,Qv===1/0||Kv===1/0?[[NaN,NaN],[NaN,NaN]]:[[Qv,Kv],[t_,n_]]},ty={sphere:br,point:$r,lineStart:Wr,lineEnd:Jr,polygonStart:function(){ty.lineStart=Qr,ty.lineEnd=Kr},polygonEnd:function(){ty.lineStart=Wr,ty.lineEnd=Jr}},ny=function(t){c_=s_=f_=l_=h_=p_=d_=v_=__=y_=g_=0,$_(t,ty);var n=__,e=y_,r=g_,i=n*n+e*e+r*r;return i<1e-12&&(n=p_,e=d_,r=v_,s_2?t[2]*z_:0),n.invert=function(n){return n=t.invert(n[0]*z_,n[1]*z_),n[0]*=C_,n[1]*=C_,n},n},_y=function(){function t(t,n){e.push(t=r(t,n)),t[0]*=C_,t[1]*=C_}function n(){var t=i.apply(this,arguments),n=o.apply(this,arguments)*z_,c=u.apply(this,arguments)*z_;return e=[],r=ri(-t[0]*z_,-t[1]*z_,0).invert,ai(a,n,c,1),t={type:"Polygon",coordinates:[e]},e=r=null,t}var e,r,i=ey([0,0]),o=ey(90),u=ey(6),a={point:t};return n.center=function(t){return arguments.length?(i="function"==typeof t?t:ey([+t[0],+t[1]]),n):i},n.radius=function(t){return arguments.length?(o="function"==typeof t?t:ey(+t),n):o},n.precision=function(t){return arguments.length?(u="function"==typeof t?t:ey(+t),n):u},n},yy=function(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:br,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}},gy=function(t,n,e,r,i,o){var u,a=t[0],c=t[1],s=n[0],f=n[1],l=0,h=1,p=s-a,d=f-c;if(u=e-a,p||!(u>0)){if(u/=p,p<0){if(u0){if(u>h)return;u>l&&(l=u)}if(u=i-a,p||!(u<0)){if(u/=p,p<0){if(u>h)return;u>l&&(l=u)}else if(p>0){if(u0)){if(u/=d,d<0){if(u0){if(u>h)return;u>l&&(l=u)}if(u=o-c,d||!(u<0)){if(u/=d,d<0){if(u>h)return;u>l&&(l=u)}else if(d>0){if(u0&&(t[0]=a+l*p,t[1]=c+l*d),h<1&&(n[0]=a+h*p,n[1]=c+h*d),!0}}}}},my=function(t,n){return P_(t[0]-n[0])=0;--o)i.point((f=s[o])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,s=h.z,p=!p}while(!h.v);i.lineEnd()}}},by=1e9,wy=-by,My=function(){var t,n,e,r=0,i=0,o=960,u=500;return e={stream:function(e){return t&&n===e?t:t=li(r,i,o,u)(n=e)},extent:function(a){return arguments.length?(r=+a[0][0],i=+a[0][1],o=+a[1][0],u=+a[1][1],t=n=null,e):[[r,i],[o,u]]}}},Ty=$v(),ky=function(t,n){var e=n[0],r=n[1],i=[I_(e),-q_(e),0],o=0,u=0;Ty.reset();for(var a=0,c=t.length;a=0?1:-1,T=M*w,k=T>N_,N=d*x;if(Ty.add(R_(N*M*I_(T),v*b+N*q_(T))),o+=k?w+M*A_:w,k^h>=e^g>=e){var S=Pr(Cr(l),Cr(y));qr(S);var E=Pr(i,S);qr(E);var A=(k^w>=0?-1:1)*mr(E[2]);(r>A||r===A&&(S[0]||S[1]))&&(u+=k^w>=0?1:-1)}}return(o<-k_||o0){for(x||(o.polygonStart(),x=!0),o.lineStart(),t=0;t1&&2&i&&u.push(u.pop().concat(u.shift())),d.push(u.filter(Xi))}var p,d,v,_=n(o),y=i.invert(r[0],r[1]),g=yy(),m=n(g),x=!1,b={point:u,lineStart:c,lineEnd:s,polygonStart:function(){b.point=f,b.lineStart=l,b.lineEnd=h,d=[],p=[]},polygonEnd:function(){b.point=u,b.lineStart=c,b.lineEnd=s,d=bf(d);var t=ky(p,y);d.length?(x||(o.polygonStart(),x=!0),xy(d,$i,t,e,o)):t&&(x||(o.polygonStart(),x=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),x&&(o.polygonEnd(),x=!1),d=p=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}};return b}},fg=sg(function(){return!0},Vi,Zi,[-N_,-S_]),lg=function(t,n){function e(e,r,i,o){ai(o,t,n,i,e,r)}function r(t,n){return q_(t)*q_(n)>a}function i(t){var n,e,i,a,f;return{lineStart:function(){a=i=!1,f=1},point:function(l,h){var p,d=[l,h],v=r(l,h),_=c?v?0:u(l,h):v?u(l+(l<0?N_:-N_),h):0;if(!n&&(a=i=v)&&t.lineStart(),v!==i&&(!(p=o(n,d))||my(n,p)||my(d,p))&&(d[0]+=k_,d[1]+=k_,v=r(d[0],d[1])),v!==i)f=0,v?(t.lineStart(),p=o(d,n),t.point(p[0],p[1])):(p=o(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(s&&n&&c^v){var y;_&e||!(y=o(d,n,!0))||(f=0,c?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!v||n&&my(n,d)||t.point(d[0],d[1]),n=d,i=v,e=_},lineEnd:function(){i&&t.lineEnd(),n=null},clean:function(){return f|(a&&i)<<1}}}function o(t,n,e){var r=Cr(t),i=Cr(n),o=[1,0,0],u=Pr(r,i),c=zr(u,u),s=u[0],f=c-s*s;if(!f)return!e&&t;var l=a*c/f,h=-a*s/f,p=Pr(o,u),d=Rr(o,l);Lr(d,Rr(u,h));var v=p,_=zr(d,v),y=zr(v,v),g=_*_-y*(zr(d,d)-1);if(!(g<0)){var m=B_(g),x=Rr(v,(-_-m)/y);if(Lr(x,d),x=Ar(x),!e)return x;var b,w=t[0],M=n[0],T=t[1],k=n[1];M0^x[1]<(P_(x[0]-w)N_^(w<=x[0]&&x[0]<=M)){var A=Rr(v,(-_+m)/y);return Lr(A,d),[x,Ar(A)]}}}function u(n,e){var r=c?t:N_-t,i=0;return n<-r?i|=1:n>r&&(i|=2),e<-r?i|=4:e>r&&(i|=8),i}var a=q_(t),c=a>0,s=P_(a)>k_;return sg(r,i,e,c?[0,-t]:[-N_,t-N_])},hg=function(t){return{stream:Gi(t)}};Ji.prototype={constructor:Ji,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var pg=16,dg=q_(30*z_),vg=function(t,n){return+n?no(t,n):to(t)},_g=Gi({point:function(t,n){this.stream.point(t*z_,n*z_)}}),yg=function(){return io(uo).scale(155.424).center([0,33.6442])},gg=function(){return yg().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])},mg=function(){function t(t){var n=t[0],e=t[1];return a=null,i.point(n,e),a||(o.point(n,e),a)||(u.point(n,e),a)}function n(){return e=r=null,t}var e,r,i,o,u,a,c=gg(),s=yg().rotate([154,0]).center([-2,58.5]).parallels([55,65]),f=yg().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){a=[t,n]}};return t.invert=function(t){var n=c.scale(),e=c.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?f:c).invert(t)},t.stream=function(t){return e&&r===t?e:e=ao([c.stream(r=t),s.stream(t),f.stream(t)])},t.precision=function(t){return arguments.length?(c.precision(t),s.precision(t),f.precision(t),n()):c.precision()},t.scale=function(n){return arguments.length?(c.scale(n),s.scale(.35*n),f.scale(n),t.translate(c.translate())):c.scale()},t.translate=function(t){if(!arguments.length)return c.translate();var e=c.scale(),r=+t[0],a=+t[1];return i=c.translate(t).clipExtent([[r-.455*e,a-.238*e],[r+.455*e,a+.238*e]]).stream(l),o=s.translate([r-.307*e,a+.201*e]).clipExtent([[r-.425*e+k_,a+.12*e+k_],[r-.214*e-k_,a+.234*e-k_]]).stream(l),u=f.translate([r-.205*e,a+.212*e]).clipExtent([[r-.214*e+k_,a+.166*e+k_],[r-.115*e-k_,a+.234*e-k_]]).stream(l),n()},t.fitExtent=function(n,e){return Qi(t,n,e)},t.fitSize=function(n,e){return Ki(t,n,e)},t.scale(1070)},xg=co(function(t){return B_(2/(1+t))});xg.invert=so(function(t){return 2*mr(t/2)});var bg=function(){return eo(xg).scale(124.75).clipAngle(179.999)},wg=co(function(t){return(t=gr(t))&&t/I_(t)});wg.invert=so(function(t){return t});var Mg=function(){return eo(wg).scale(79.4188).clipAngle(179.999)};fo.invert=function(t,n){return[t,2*L_(D_(n))-S_]};var Tg=function(){return lo(fo).scale(961/A_)},kg=function(){return io(po).scale(109.5).parallels([30,30])};vo.invert=vo;var Ng=function(){return eo(vo).scale(152.63)},Sg=function(){return io(_o).scale(131.154).center([0,13.9389])};yo.invert=so(L_);var Eg=function(){return eo(yo).scale(144.049).clipAngle(60)},Ag=function(){function t(){return i=o=null,u}var n,e,r,i,o,u,a=1,c=0,s=0,f=1,l=1,h=Uy,p=null,d=Uy;return u={stream:function(t){return i&&o===t?i:i=h(d(o=t))},clipExtent:function(i){return arguments.length?(d=null==i?(p=n=e=r=null,Uy):li(p=+i[0][0],n=+i[0][1],e=+i[1][0],r=+i[1][1]),t()):null==p?null:[[p,n],[e,r]]},scale:function(n){return arguments.length?(h=go((a=+n)*f,a*l,c,s),t()):a},translate:function(n){return arguments.length?(h=go(a*f,a*l,c=+n[0],s=+n[1]),t()):[c,s]},reflectX:function(n){return arguments.length?(h=go(a*(f=n?-1:1),a*l,c,s),t()):f<0},reflectY:function(n){return arguments.length?(h=go(a*f,a*(l=n?-1:1),c,s),t()):l<0},fitExtent:function(t,n){return Qi(u,t,n)},fitSize:function(t,n){return Ki(u,t,n)}}};mo.invert=so(mr);var Cg=function(){return eo(mo).scale(249.5).clipAngle(90+k_)};xo.invert=so(function(t){return 2*L_(t)});var zg=function(){return eo(xo).scale(250).clipAngle(142)};bo.invert=function(t,n){return[-n,2*L_(D_(t))-S_]};var Pg=function(){var t=lo(bo),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):(t=n(),[t[1],-t[0]])},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):(t=e(),[t[0],t[1],t[2]-90])},e([0,0,90]).scale(159.155)},Lg=function(){function t(t){var o,u=0;t.eachAfter(function(t){var e=t.children;e?(t.x=Mo(e),t.y=ko(e)):(t.x=o?u+=n(t,o):0,t.y=0,o=t)});var a=So(t),c=Eo(t),s=a.x-n(a,c)/2,f=c.x+n(c,a)/2;return t.eachAfter(i?function(n){n.x=(n.x-t.x)*e,n.y=(t.y-n.y)*r}:function(n){n.x=(n.x-s)/(f-s)*e,n.y=(1-(t.y?n.y/t.y:1))*r})}var n=wo,e=1,r=1,i=!1;return t.separation=function(e){return arguments.length?(n=e,t):n},t.size=function(n){return arguments.length?(i=!1,e=+n[0],r=+n[1],t):i?null:[e,r]},t.nodeSize=function(n){return arguments.length?(i=!0,e=+n[0],r=+n[1],t):i?[e,r]:null},t},Rg=function(){return this.eachAfter(Ao)},qg=function(t){var n,e,r,i,o=this,u=[o];do{for(n=u.reverse(),u=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r=0;--e)i.push(n[e]);return this},Dg=function(t){for(var n,e,r,i=this,o=[i],u=[];i=o.pop();)if(u.push(i),n=i.children)for(e=0,r=n.length;e=0;)e+=r[i].value;n.value=e})},Fg=function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},Ig=function(t){for(var n=this,e=Co(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},Yg=function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},Bg=function(){var t=[];return this.each(function(n){t.push(n)}),t},Hg=function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},jg=function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n};Uo.prototype=zo.prototype={constructor:Uo,count:Rg,each:qg,eachAfter:Dg,eachBefore:Ug,sum:Og,sort:Fg,path:Ig,ancestors:Yg,descendants:Bg,leaves:Hg,links:jg,copy:Po};var Xg=function(t){for(var n=(t=t.slice()).length,e=null,r=e;n;){var i=new Do(t[n-1]);r=r?r.next=i:e=i,t[void 0]=t[--n]}return{head:e,tail:r}},$g=function(t){return Fo(Xg(t),[])},Vg=function(t){return Vo(t),t},Wg=function(t){return function(){return t}},Zg=function(){function t(t){return t.x=e/2,t.y=r/2,n?t.eachBefore(Qo(n)).eachAfter(Ko(i,.5)).eachBefore(tu(1)):t.eachBefore(Qo(Jo)).eachAfter(Ko(Go,1)).eachAfter(Ko(i,t.r/Math.min(e,r))).eachBefore(tu(Math.min(e,r)/(2*t.r))),t}var n=null,e=1,r=1,i=Go;return t.radius=function(e){return arguments.length?(n=Wo(e),t):n},t.size=function(n){return arguments.length?(e=+n[0],r=+n[1],t):[e,r]},t.padding=function(n){return arguments.length?(i="function"==typeof n?n:Wg(+n),t):i},t},Gg=function(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)},Jg=function(t,n,e,r,i){for(var o,u=t.children,a=-1,c=u.length,s=t.value&&(r-n)/t.value;++a0)throw new Error("cycle");return o}var n=nu,e=eu;return t.id=function(e){return arguments.length?(n=Zo(e),t):n},t.parentId=function(n){return arguments.length?(e=Zo(n),t):e},t};su.prototype=Object.create(Uo.prototype);var rm=function(){function t(t){var r=fu(t);if(r.eachAfter(n),r.parent.m=-r.z,r.eachBefore(e),c)t.eachBefore(i);else{var s=t,f=t,l=t;t.eachBefore(function(t){t.xf.x&&(f=t),t.depth>l.depth&&(l=t)});var h=s===f?1:o(s,f)/2,p=h-s.x,d=u/(f.x+h+p),v=a/(l.depth||1);t.eachBefore(function(t){t.x=(t.x+p)*d,t.y=t.depth*v})}return t}function n(t){var n=t.children,e=t.parent.children,i=t.i?e[t.i-1]:null;if(n){au(t);var u=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+o(t._,i._),t.m=t.z-u):t.z=u}else i&&(t.z=i.z+o(t._,i._));t.parent.A=r(t,i,t.parent.A||e[0])}function e(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function r(t,n,e){if(n){for(var r,i=t,u=t,a=n,c=i.parent.children[0],s=i.m,f=u.m,l=a.m,h=c.m;a=ou(a),i=iu(i),a&&i;)c=iu(c),u=ou(u),u.a=t,r=a.z+l-i.z-s+o(a._,i._),r>0&&(uu(cu(a,t,e),t,r),s+=r,f+=r),l+=a.m,s+=i.m,h+=c.m,f+=u.m;a&&!ou(u)&&(u.t=a,u.m+=l-f),i&&!iu(c)&&(c.t=i,c.m+=s-h,e=t)}return e}function i(t){t.x*=u,t.y=t.depth*a}var o=ru,u=1,a=1,c=null;return t.separation=function(n){return arguments.length?(o=n,t):o},t.size=function(n){return arguments.length?(c=!1,u=+n[0],a=+n[1],t):c?null:[u,a]},t.nodeSize=function(n){return arguments.length?(c=!0,u=+n[0],a=+n[1],t):c?[u,a]:null},t},im=function(t,n,e,r,i){for(var o,u=t.children,a=-1,c=u.length,s=t.value&&(i-e)/t.value;++a1?n:1)},e}(om),am=function(){function t(t){return t.x0=t.y0=0,t.x1=i,t.y1=o,t.eachBefore(n),u=[0],r&&t.eachBefore(Gg),t}function n(t){var n=u[t.depth],r=t.x0+n,i=t.y0+n,o=t.x1-n,h=t.y1-n;o=n-1){var s=c[t];return s.x0=r,s.y0=i,s.x1=u,s.y1=a,void 0}for(var l=f[t],h=e/2+l,p=t+1,d=n-1;p>>1;f[v]a-i){var g=(r*y+u*_)/e;o(t,p,_,r,i,g,a),o(p,n,y,g,i,u,a)}else{var m=(i*y+a*_)/e;o(t,p,_,r,i,u,m),o(p,n,y,r,m,u,a)}}var u,a,c=t.children,s=c.length,f=new Array(s+1);for(f[0]=a=u=0;u1?n:1)},e}(om),lm=function(t){for(var n,e=-1,r=t.length,i=t[r-1],o=0;++e=0;--n)s.push(t[r[o[n]][2]]);for(n=+a;na!=s>a&&u<(c-e)*(a-r)/(s-r)+e&&(f=!f),c=e,s=r;return f},_m=function(t){for(var n,e,r=-1,i=t.length,o=t[i-1],u=o[0],a=o[1],c=0;++r1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(mm),wm=function t(n){function e(){var t=bm.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(mm),Mm=function t(n){function e(t){return function(){for(var e=0,r=0;r=200&&e<300||304===e){if(o)try{n=o.call(r,s)}catch(t){return void a.call("error",r,t)}else n=s;a.call("load",r,n)}else a.call("error",r,t)}var r,i,o,u,a=v("beforesend","progress","load","error"),c=He(),s=new XMLHttpRequest,f=null,l=null,h=0;if("undefined"==typeof XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=s.ontimeout=e:s.onreadystatechange=function(t){s.readyState>3&&e(t)},s.onprogress=function(t){a.call("progress",r,t)},r={header:function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?c.get(t):(null==n?c.remove(t):c.set(t,n+""),r)},mimeType:function(t){return arguments.length?(i=null==t?null:t+"",r):i},responseType:function(t){return arguments.length?(u=t,r):u},timeout:function(t){return arguments.length?(h=+t,r):h},user:function(t){return arguments.length<1?f:(f=null==t?null:t+"",r)},password:function(t){return arguments.length<1?l:(l=null==t?null:t+"",r)},response:function(t){return o=t,r},get:function(t,n){return r.send("GET",t,n)},post:function(t,n){return r.send("POST",t,n)},send:function(n,e,o){return s.open(n,t,!0,f,l),null==i||c.has("accept")||c.set("accept",i+",*/*"),s.setRequestHeader&&c.each(function(t,n){s.setRequestHeader(n,t)}),null!=i&&s.overrideMimeType&&s.overrideMimeType(i),null!=u&&(s.responseType=u),h>0&&(s.timeout=h),null==o&&"function"==typeof e&&(o=e,e=null),null!=o&&1===o.length&&(o=bu(o)),null!=o&&r.on("error",o).on("load",function(t){o(null,t)}),a.call("beforesend",r,s),s.send(null==e?null:e),r},abort:function(){return s.abort(),r},on:function(){var t=a.on.apply(a,arguments);return t===a?r:t}},null!=n){if("function"!=typeof n)throw new Error("invalid callback: "+n);return r.get(n)}return r},Sm=function(t,n){return function(e,r){var i=Nm(e).mimeType(t).response(n);if(null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return i.get(r)}return i}},Em=Sm("text/html",function(t){return document.createRange().createContextualFragment(t.responseText)}),Am=Sm("application/json",function(t){return JSON.parse(t.responseText)}),Cm=Sm("text/plain",function(t){return t.responseText}),zm=Sm("application/xml",function(t){var n=t.responseXML;if(!n)throw new Error("parse error");return n}),Pm=function(t,n){return function(e,r,i){arguments.length<3&&(i=r,r=null);var o=Nm(e).mimeType(t);return o.row=function(t){return arguments.length?o.response(Mu(n,r=t)):r},o.row(r),i?o.get(i):o}},Lm=Pm("text/csv",Zd),Rm=Pm("text/tab-separated-values",tv),qm=Array.prototype,Um=qm.map,Dm=qm.slice,Om={name:"implicit"},Fm=function(t){return function(){return t}},Im=function(t){return+t},Ym=[0,1],Bm=function(n,e,r){var o,u=n[0],a=n[n.length-1],c=i(u,a,null==e?10:e);switch(r=pr(null==r?",f":r),r.type){case"s":var s=Math.max(Math.abs(u),Math.abs(a));return null!=r.precision||isNaN(o=jv(c,s))||(r.precision=o),t.formatPrefix(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(o=Xv(c,Math.max(Math.abs(u),Math.abs(a))))||(r.precision=o-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(o=Hv(c))||(r.precision=o-2*("%"===r.type))}return t.format(r)},Hm=function(t,n){t=t.slice();var e,r=0,i=t.length-1,o=t[r],u=t[i];return u0?t>1?Ju(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):$m:null};var Vm=$m.range,Wm=6e4,Zm=6048e5,Gm=Ju(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),Jm=Gm.range,Qm=Ju(function(t){t.setTime(Math.floor(t/Wm)*Wm)},function(t,n){t.setTime(+t+n*Wm)},function(t,n){return(n-t)/Wm},function(t){return t.getMinutes()}),Km=Qm.range,tx=Ju(function(t){var n=t.getTimezoneOffset()*Wm%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()}),nx=tx.range,ex=Ju(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Wm)/864e5},function(t){return t.getDate()-1}),rx=ex.range,ix=Qu(0),ox=Qu(1),ux=Qu(2),ax=Qu(3),cx=Qu(4),sx=Qu(5),fx=Qu(6),lx=ix.range,hx=ox.range,px=ux.range,dx=ax.range,vx=cx.range,_x=sx.range,yx=fx.range,gx=Ju(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),mx=gx.range,xx=Ju(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});xx.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ju(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};var bx=xx.range,wx=Ju(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Wm)},function(t,n){return(n-t)/Wm},function(t){return t.getUTCMinutes()}),Mx=wx.range,Tx=Ju(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()}),kx=Tx.range,Nx=Ju(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1}),Sx=Nx.range,Ex=Ku(0),Ax=Ku(1),Cx=Ku(2),zx=Ku(3),Px=Ku(4),Lx=Ku(5),Rx=Ku(6),qx=Ex.range,Ux=Ax.range,Dx=Cx.range,Ox=zx.range,Fx=Px.range,Ix=Lx.range,Yx=Rx.range,Bx=Ju(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),Hx=Bx.range,jx=Ju(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});jx.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ju(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var Xx,$x=jx.range,Vx={"-":"",_:" ",0:"0"},Wx=/^\s*\d+/,Zx=/^%/,Gx=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;Ja({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Jx=Date.prototype.toISOString?Qa:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ"),Qx=+new Date("2000-01-01T00:00:00.000Z")?Ka:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ"),Kx=1e3,tb=60*Kx,nb=60*tb,eb=24*nb,rb=7*eb,ib=30*eb,ob=365*eb,ub=function(){return ec(xx,gx,ix,ex,tx,Qm,Gm,$m,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)])},ab=function(){return ec(jx,Bx,Ex,Nx,Tx,wx,Gm,$m,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)])},cb=function(t){return t.match(/.{6}/g).map(function(t){return"#"+t})},sb=cb("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),fb=cb("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),lb=cb("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),hb=cb("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),pb=Zh(Wt(300,.5,0),Wt(-240,.5,1)),db=Zh(Wt(-100,.75,.35),Wt(80,1.5,.8)),vb=Zh(Wt(260,.75,.35),Wt(80,1.5,.8)),_b=Wt(),yb=function(t){(t<0||t>1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return _b.h=360*t-100,_b.s=1.5-1.5*n,_b.l=.8-.9*n,_b+""},gb=rc(cb("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),mb=rc(cb("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),xb=rc(cb("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),bb=rc(cb("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),wb=function(t){return function(){return t}},Mb=Math.abs,Tb=Math.atan2,kb=Math.cos,Nb=Math.max,Sb=Math.min,Eb=Math.sin,Ab=Math.sqrt,Cb=1e-12,zb=Math.PI,Pb=zb/2,Lb=2*zb,Rb=function(){function t(){var t,s,f=+n.apply(this,arguments),l=+e.apply(this,arguments),h=o.apply(this,arguments)-Pb,p=u.apply(this,arguments)-Pb,d=Mb(p-h),v=p>h;if(c||(c=t=Ue()),lCb)if(d>Lb-Cb)c.moveTo(l*kb(h),l*Eb(h)),c.arc(0,0,l,h,p,!v),f>Cb&&(c.moveTo(f*kb(p),f*Eb(p)),c.arc(0,0,f,p,h,v));else{var _,y,g=h,m=p,x=h,b=p,w=d,M=d,T=a.apply(this,arguments)/2,k=T>Cb&&(i?+i.apply(this,arguments):Ab(f*f+l*l)),N=Sb(Mb(l-f)/2,+r.apply(this,arguments)),S=N,E=N;if(k>Cb){var A=uc(k/f*Eb(T)),C=uc(k/l*Eb(T));(w-=2*A)>Cb?(A*=v?1:-1,x+=A,b-=A):(w=0,x=b=(h+p)/2),(M-=2*C)>Cb?(C*=v?1:-1,g+=C,m-=C):(M=0,g=m=(h+p)/2)}var z=l*kb(g),P=l*Eb(g),L=f*kb(b),R=f*Eb(b);if(N>Cb){var q=l*kb(m),U=l*Eb(m),D=f*kb(x),O=f*Eb(x);if(dCb?hc(z,P,D,O,q,U,L,R):[L,R],I=z-F[0],Y=P-F[1],B=q-F[0],H=U-F[1],j=1/Eb(oc((I*B+Y*H)/(Ab(I*I+Y*Y)*Ab(B*B+H*H)))/2),X=Ab(F[0]*F[0]+F[1]*F[1]);S=Sb(N,(f-X)/(j-1)),E=Sb(N,(l-X)/(j+1))}}M>Cb?E>Cb?(_=pc(D,O,z,P,l,E,v),y=pc(q,U,L,R,l,E,v),c.moveTo(_.cx+_.x01,_.cy+_.y01),ECb&&w>Cb?S>Cb?(_=pc(L,R,q,U,f,-S,v),y=pc(z,P,D,O,f,-S,v),c.lineTo(_.cx+_.x01,_.cy+_.y01),S=f;--l)s.point(_[l],y[l]);s.lineEnd(),s.areaEnd()}v&&(_[n]=+e(h,n,t),y[n]=+i(h,n,t),s.point(r?+r(h,n,t):_[n],o?+o(h,n,t):y[n]))}if(p)return s=null,p+""||null}function n(){return Ub().defined(u).curve(c).context(a)}var e=vc,r=null,i=wb(0),o=_c,u=wb(!0),a=null,c=qb,s=null;return t.x=function(n){return arguments.length?(e="function"==typeof n?n:wb(+n),r=null,t):e},t.x0=function(n){return arguments.length?(e="function"==typeof n?n:wb(+n),t):e},t.x1=function(n){return arguments.length?(r=null==n?null:"function"==typeof n?n:wb(+n),t):r},t.y=function(n){return arguments.length?(i="function"==typeof n?n:wb(+n),o=null,t):i},t.y0=function(n){return arguments.length?(i="function"==typeof n?n:wb(+n),t):i},t.y1=function(n){return arguments.length?(o=null==n?null:"function"==typeof n?n:wb(+n),t):o},t.lineX0=t.lineY0=function(){return n().x(e).y(i)},t.lineY1=function(){return n().x(e).y(o)},t.lineX1=function(){return n().x(r).y(i)},t.defined=function(n){return arguments.length?(u="function"==typeof n?n:wb(!!n),t):u},t.curve=function(n){return arguments.length?(c=n,null!=a&&(s=c(a)),t):c},t.context=function(n){return arguments.length?(null==n?a=s=null:s=c(a=n),t):a},t},Ob=function(t,n){return nt?1:n>=t?0:NaN},Fb=function(t){return t},Ib=function(){function t(t){var a,c,s,f,l,h=t.length,p=0,d=new Array(h),v=new Array(h),_=+i.apply(this,arguments),y=Math.min(Lb,Math.max(-Lb,o.apply(this,arguments)-_)),g=Math.min(Math.abs(y)/h,u.apply(this,arguments)),m=g*(y<0?-1:1);for(a=0;a0&&(p+=l);for(null!=e?d.sort(function(t,n){return e(v[t],v[n])}):null!=r&&d.sort(function(n,e){return r(t[n],t[e])}),a=0,s=p?(y-h*m)/p:0;a0?l*s:0)+m,v[c]={data:t[c],index:a,value:l,startAngle:_,endAngle:f,padAngle:g};return v}var n=Fb,e=Ob,r=null,i=wb(0),o=wb(Lb),u=wb(0);return t.value=function(e){return arguments.length?(n="function"==typeof e?e:wb(+e),t):n},t.sortValues=function(n){return arguments.length?(e=n,r=null,t):e},t.sort=function(n){return arguments.length?(r=n,e=null,t):r},t.startAngle=function(n){return arguments.length?(i="function"==typeof n?n:wb(+n),t):i},t.endAngle=function(n){return arguments.length?(o="function"==typeof n?n:wb(+n),t):o},t.padAngle=function(n){return arguments.length?(u="function"==typeof n?n:wb(+n),t):u},t},Yb=gc(qb);yc.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var Bb=function(){return mc(Ub().curve(Yb))},Hb=function(){var t=Db().curve(Yb),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return mc(e())},delete t.lineX0,t.lineEndAngle=function(){return mc(r())},delete t.lineX1,t.lineInnerRadius=function(){return mc(i())},delete t.lineY0,t.lineOuterRadius=function(){return mc(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(gc(t)):n()._curve},t},jb=Array.prototype.slice,Xb=function(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]},$b={draw:function(t,n){var e=Math.sqrt(n/zb);t.moveTo(e,0),t.arc(0,0,e,0,Lb)}},Vb={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},Wb=Math.sqrt(1/3),Zb=2*Wb,Gb={draw:function(t,n){var e=Math.sqrt(n/Zb),r=e*Wb;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},Jb=Math.sin(zb/10)/Math.sin(7*zb/10),Qb=Math.sin(Lb/10)*Jb,Kb=-Math.cos(Lb/10)*Jb,tw={draw:function(t,n){var e=Math.sqrt(.8908130915292852*n),r=Qb*e,i=Kb*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var u=Lb*o/5,a=Math.cos(u),c=Math.sin(u);t.lineTo(c*e,-a*e),t.lineTo(a*r-c*i,c*r+a*i)}t.closePath()}},nw={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},ew=Math.sqrt(3),rw={draw:function(t,n){var e=-Math.sqrt(n/(3*ew));t.moveTo(0,2*e),t.lineTo(-ew*e,-e),t.lineTo(ew*e,-e),t.closePath()}},iw=-.5,ow=Math.sqrt(3)/2,uw=1/Math.sqrt(12),aw=3*(uw/2+1),cw={draw:function(t,n){var e=Math.sqrt(n/aw),r=e/2,i=e*uw,o=r,u=e*uw+e,a=-o,c=u;t.moveTo(r,i),t.lineTo(o,u),t.lineTo(a,c),t.lineTo(iw*r-ow*i,ow*r+iw*i),t.lineTo(iw*o-ow*u,ow*o+iw*u),t.lineTo(iw*a-ow*c,ow*a+iw*c),t.lineTo(iw*r+ow*i,iw*i-ow*r),t.lineTo(iw*o+ow*u,iw*u-ow*o),t.lineTo(iw*a+ow*c,iw*c-ow*a),t.closePath()}},sw=[$b,Vb,Gb,nw,tw,rw,cw],fw=function(){function t(){var t;if(r||(r=t=Ue()),n.apply(this,arguments).draw(r,+e.apply(this,arguments)),t)return r=null,t+""||null}var n=wb($b),e=wb(64),r=null;return t.type=function(e){return arguments.length?(n="function"==typeof e?e:wb(e),t):n},t.size=function(n){return arguments.length?(e="function"==typeof n?n:wb(+n),t):e},t.context=function(n){return arguments.length?(r=null==n?null:n,t):r},t},lw=function(){};Cc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ac(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ac(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var hw=function(t){return new Cc(t)};zc.prototype={areaStart:lw,areaEnd:lw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Ac(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var pw=function(t){return new zc(t)};Pc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Ac(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var dw=function(t){return new Pc(t)};Lc.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],u=t[e]-i,a=n[e]-o,c=-1;++c<=e;)r=c/e,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*u),this._beta*n[c]+(1-this._beta)*(o+r*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var vw=function t(n){function e(t){return 1===n?new Cc(t):new Lc(t,n)}return e.beta=function(n){return t(+n)},e}(.85);qc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Rc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Rc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1, +this._y1=this._y2,this._y2=n}};var _w=function t(n){function e(t){return new qc(t,n)}return e.tension=function(n){return t(+n)},e}(0);Uc.prototype={areaStart:lw,areaEnd:lw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Rc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var yw=function t(n){function e(t){return new Uc(t,n)}return e.tension=function(n){return t(+n)},e}(0);Dc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Rc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var gw=function t(n){function e(t){return new Dc(t,n)}return e.tension=function(n){return t(+n)},e}(0);Fc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Oc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var mw=function t(n){function e(t){return n?new Fc(t,n):new qc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Ic.prototype={areaStart:lw,areaEnd:lw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Oc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var xw=function t(n){function e(t){return n?new Ic(t,n):new Uc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Yc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Oc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var bw=function t(n){function e(t){return n?new Yc(t,n):new Dc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);Bc.prototype={areaStart:lw,areaEnd:lw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}};var ww=function(t){return new Bc(t)};Vc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:$c(this,this._t0,Xc(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(t=+t,n=+n,t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,$c(this,Xc(this,e=jc(this,t,n)),e);break;default:$c(this,this._t0,e=jc(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(Wc.prototype=Object.create(Vc.prototype)).point=function(t,n){Vc.prototype.point.call(this,n,t)},Zc.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},Qc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=Kc(t),i=Kc(n),o=0,u=1;u=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};var Tw=function(t){return new ts(t,.5)},kw=function(t,n){if((i=t.length)>1)for(var e,r,i,o=1,u=t[n[0]],a=u.length;o=0;)e[n]=n;return e},Sw=function(){function t(t){var o,u,a=n.apply(this,arguments),c=t.length,s=a.length,f=new Array(s);for(o=0;o0){for(var e,r,i,o=0,u=t[0].length;o1)for(var e,r,i,o,u,a,c=0,s=t[n[0]].length;c=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=u,r[0]=u+=i):r[0]=o},Cw=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,u=1;u=a)return null;var c=t-i.site[0],s=n-i.site[1],f=c*c+s*s;do{i=o.cells[r=u],u=null,i.halfedges.forEach(function(e){var r=o.edges[e],a=r.left;if(a!==i.site&&a||(a=r.right)){var c=t-a[0],s=n-a[1],l=c*c+s*s;le?(e+r)/2:Math.min(0,e)||Math.max(0,r),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function o(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function u(t,n,e){t.on("start.zoom",function(){a(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){a(this,arguments).end()}).tween("zoom",function(){var t=this,r=arguments,i=a(t,r),u=m.apply(t,r),c=e||o(u),s=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),f=t.__zoom,l="function"==typeof n?n.apply(t,r):n,h=S(f.invert(c).concat(s/f.k),l.invert(c).concat(s/l.k));return function(t){if(1===t)t=l;else{var n=h(t),e=s/n[2];t=new Os(e,c[0]-n[0]*e,c[1]-n[1]*e)}i.zoom(null,t)}})}function a(t,n){for(var e,r=0,i=E.length;rL}o.zoom("mouse",i(r(o.that.__zoom,o.mouse[0]=Gf(o.that),o.mouse[1]),o.extent))}function e(){u.on("mousemove.zoom mouseup.zoom",null),mt(t.event.view,o.moved),Zw(),o.end()}if(!y&&g.apply(this,arguments)){var o=a(this,arguments),u=Pl(t.event.view).on("mousemove.zoom",n,!0).on("mouseup.zoom",e,!0),c=Gf(this),s=t.event.clientX,f=t.event.clientY;Dl(t.event.view),Is(),o.mouse=[c,this.__zoom.invert(c)],gp(this),o.start()}}function l(){if(g.apply(this,arguments)){var o=this.__zoom,a=Gf(this),c=o.invert(a),s=o.k*(t.event.shiftKey?.5:2),f=i(r(e(o,s),a,c),m.apply(this,arguments));Zw(),N>0?Pl(this).transition().duration(N).call(u,f,a):Pl(this).call(n.transform,f)}}function h(){if(g.apply(this,arguments)){var n,e,r,i,o=a(this,arguments),u=t.event.changedTouches,c=u.length;for(Is(),e=0;en?1:t>=n?0:NaN}function e(t){var e;return 1===t.length&&(e=t,t=function(t,r){return n(e(t),r)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}var r=e(n),i=r.right,o=r.left;function a(t,n){return[t,n]}function u(t){return null===t?NaN:+t}function c(t,n){var e,r,i=t.length,o=0,a=-1,c=0,f=0;if(null==n)for(;++a1)return f/(o-1)}function f(t,n){var e=c(t,n);return e?Math.sqrt(e):e}function s(t,n){var e,r,i,o=t.length,a=-1;if(null==n){for(;++a=e)for(r=i=e;++ae&&(r=e),i=e)for(r=i=e;++ae&&(r=e),i0)return[t];if((r=n0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u=0?(o>=y?10:o>=_?5:o>=b?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=y?10:o>=_?5:o>=b?2:1)}function w(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=y?i*=10:o>=_?i*=5:o>=b&&(i*=2),n=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function A(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o=e)for(r=e;++or&&(r=e)}else for(;++o=e)for(r=e;++or&&(r=e);return r}function T(t){for(var n,e,r,i=t.length,o=-1,a=0;++o=0;)for(n=(r=t[i]).length;--n>=0;)e[--a]=r[n];return e}function S(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o=e)for(r=e;++oe&&(r=e)}else for(;++o=e)for(r=e;++oe&&(r=e);return r}function k(t){if(!(i=t.length))return[];for(var n=-1,e=S(t,E),r=new Array(e);++n=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a0)for(var e,r,i=new Array(e),o=0;o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),V.hasOwnProperty(n)?{space:V[n],local:t}:t}function W(t){var n=$(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===G&&n.documentElement.namespaceURI===G?n.createElement(t):n.createElementNS(e,t)}})(n)}function Z(){}function Q(t){return null==t?Z:function(){return this.querySelector(t)}}function J(){return[]}function K(t){return null==t?J:function(){return this.querySelectorAll(t)}}function tt(t){return function(){return this.matches(t)}}function nt(t){return new Array(t.length)}function et(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}et.prototype={constructor:et,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var rt="$";function it(t,n,e,r,i,o){for(var a,u=0,c=n.length,f=o.length;un?1:t>=n?0:NaN}function ut(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ct(t,n){return t.style.getPropertyValue(n)||ut(t).getComputedStyle(t,null).getPropertyValue(n)}function ft(t){return t.trim().split(/^|\s+/)}function st(t){return t.classList||new lt(t)}function lt(t){this._node=t,this._names=ft(t.getAttribute("class")||"")}function ht(t,n){for(var e=st(t),r=-1,i=n.length;++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var wt={};(t.event=null,"undefined"!=typeof document)&&("onmouseenter"in document.documentElement||(wt={mouseenter:"mouseover",mouseleave:"mouseout"}));function Mt(t,n,e){return t=Nt(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function Nt(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function At(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=x&&(x=m+1);!(b=y[x])&&++x=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=at);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):ct(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=ft(t+"");if(arguments.length<2){for(var r=st(this.node()),i=-1,o=e.length;++i=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?Tt:At,null==e&&(e=!1),r=0;r>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=rn.exec(t))?dn(parseInt(n[1],16)):(n=on.exec(t))?new yn(n[1],n[2],n[3],1):(n=an.exec(t))?new yn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=un.exec(t))?pn(n[1],n[2],n[3],n[4]):(n=cn.exec(t))?pn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=fn.exec(t))?bn(n[1],n[2]/100,n[3]/100,1):(n=sn.exec(t))?bn(n[1],n[2]/100,n[3]/100,n[4]):ln.hasOwnProperty(t)?dn(ln[t]):"transparent"===t?new yn(NaN,NaN,NaN,0):null}function dn(t){return new yn(t>>16&255,t>>8&255,255&t,1)}function pn(t,n,e,r){return r<=0&&(t=n=e=NaN),new yn(t,n,e,r)}function vn(t){return t instanceof Jt||(t=hn(t)),t?new yn((t=t.rgb()).r,t.g,t.b,t.opacity):new yn}function gn(t,n,e,r){return 1===arguments.length?vn(t):new yn(t,n,e,null==r?1:r)}function yn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function _n(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function bn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new xn(t,n,e,r)}function mn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof xn)return new xn(t.h,t.s,t.l,t.opacity);if(t instanceof Jt||(t=hn(t)),!t)return new xn;if(t instanceof xn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e0&&c<1?0:a,new xn(a,u,c,t.opacity)}(t):new xn(t,n,e,null==r?1:r)}function xn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function wn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Zt(Jt,hn,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Zt(yn,gn,Qt(Jt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new yn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+_n(this.r)+_n(this.g)+_n(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Zt(xn,mn,Qt(Jt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new xn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new xn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new yn(wn(t>=240?t-240:t+120,i,r),wn(t,i,r),wn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Mn=Math.PI/180,Nn=180/Math.PI,An=.96422,Tn=1,Sn=.82521,kn=4/29,En=6/29,Cn=3*En*En,Pn=En*En*En;function zn(t){if(t instanceof Dn)return new Dn(t.l,t.a,t.b,t.opacity);if(t instanceof Fn){if(isNaN(t.h))return new Dn(t.l,0,0,t.opacity);var n=t.h*Mn;return new Dn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof yn||(t=vn(t));var e,r,i=On(t.r),o=On(t.g),a=On(t.b),u=qn((.2225045*i+.7168786*o+.0606169*a)/Tn);return i===o&&o===a?e=r=u:(e=qn((.4360747*i+.3850649*o+.1430804*a)/An),r=qn((.0139322*i+.0971045*o+.7141733*a)/Sn)),new Dn(116*u-16,500*(e-u),200*(u-r),t.opacity)}function Rn(t,n,e,r){return 1===arguments.length?zn(t):new Dn(t,n,e,null==r?1:r)}function Dn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function qn(t){return t>Pn?Math.pow(t,1/3):t/Cn+kn}function Ln(t){return t>En?t*t*t:Cn*(t-kn)}function Un(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function On(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Bn(t){if(t instanceof Fn)return new Fn(t.h,t.c,t.l,t.opacity);if(t instanceof Dn||(t=zn(t)),0===t.a&&0===t.b)return new Fn(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Nn;return new Fn(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Yn(t,n,e,r){return 1===arguments.length?Bn(t):new Fn(t,n,e,null==r?1:r)}function Fn(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}Zt(Dn,Rn,Qt(Jt,{brighter:function(t){return new Dn(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Dn(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new yn(Un(3.1338561*(n=An*Ln(n))-1.6168667*(t=Tn*Ln(t))-.4906146*(e=Sn*Ln(e))),Un(-.9787684*n+1.9161415*t+.033454*e),Un(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Zt(Fn,Yn,Qt(Jt,{brighter:function(t){return new Fn(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Fn(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return zn(this).rgb()}}));var In=-.14861,jn=1.78277,Hn=-.29227,Xn=-.90649,Gn=1.97294,Vn=Gn*Xn,$n=Gn*jn,Wn=jn*Hn-Xn*In;function Zn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Qn)return new Qn(t.h,t.s,t.l,t.opacity);t instanceof yn||(t=vn(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Wn*r+Vn*n-$n*e)/(Wn+Vn-$n),o=r-i,a=(Gn*(e-i)-Hn*o)/Xn,u=Math.sqrt(a*a+o*o)/(Gn*i*(1-i)),c=u?Math.atan2(a,o)*Nn-120:NaN;return new Qn(c<0?c+360:c,u,i,t.opacity)}(t):new Qn(t,n,e,null==r?1:r)}function Qn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Jn(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function Kn(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r180||e<-180?e-360*Math.round(e/360):e):ne(isNaN(t)?n:t)}function ie(t){return 1==(t=+t)?oe:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):ne(isNaN(n)?e:n)}}function oe(t,n){var e=n-t;return e?ee(t,e):ne(isNaN(t)?n:t)}Zt(Qn,Zn,Qt(Jt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Qn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Qn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Mn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new yn(255*(n+e*(In*r+jn*i)),255*(n+e*(Hn*r+Xn*i)),255*(n+e*(Gn*r)),this.opacity)}}));var ae=function t(n){var e=ie(n);function r(t,n){var r=e((t=gn(t)).r,(n=gn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=oe(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function ue(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;eo&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:he(e,r)})),o=ve.lastIndex;return o180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:he(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:he(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,c),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:he(t,e)},{i:u-2,x:he(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,c),o=a=null,function(t){for(var n,e=-1,r=c.length;++e=0&&n._call.call(null,t),n=n._next;--Ge}function ar(){Qe=(Ze=Ke.now())+Je,Ge=Ve=0;try{or()}finally{Ge=0,function(){var t,n,e=He,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:He=n);Xe=t,cr(r)}(),Qe=0}}function ur(){var t=Ke.now(),n=t-Ze;n>We&&(Je-=n,Ze=t)}function cr(t){Ge||(Ve&&(Ve=clearTimeout(Ve)),t-Qe>24?(t<1/0&&(Ve=setTimeout(ar,t-Ke.now()-Je)),$e&&($e=clearInterval($e))):($e||(Ze=Ke.now(),$e=setInterval(ur,We)),Ge=1,tr(ar)))}function fr(t,n,e){var r=new rr;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}rr.prototype=ir.prototype={constructor:rr,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?nr():+e)+(null==n?0:+n),this._next||Xe===this||(Xe?Xe._next=this:He=this,Xe=this),this._call=t,this._time=e,cr()},stop:function(){this._call&&(this._call=null,this._time=1/0,cr())}};var sr=I("start","end","cancel","interrupt"),lr=[],hr=0,dr=1,pr=2,vr=3,gr=4,yr=5,_r=6;function br(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(c){var f,s,l,h;if(e.state!==dr)return u();for(f in i)if((h=i[f]).name===e.name){if(h.state===vr)return fr(o);h.state===gr?(h.state=_r,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[f]):+fhr)throw new Error("too late; already scheduled");return e}function xr(t,n){var e=wr(t,n);if(e.state>vr)throw new Error("too late; already running");return e}function wr(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Mr(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>pr&&e.state=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?mr:xr;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=$(t),r="transform"===e?ke:Ar;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var a,u,c=e(this);if(null!=c)return(a=this.getAttributeNS(t.space,t.local))===(u=c+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,c));this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var a,u,c=e(this);if(null!=c)return(a=this.getAttribute(t))===(u=c+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,c));this.removeAttribute(t)}})(e,r,Nr(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}:function(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}})(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=$(t);return this.tween(e,(r.local?function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n(e))}}(t,i)),e}return i._value=n,i}:function(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n(e))}}(t,i)),e}return i._value=n,i})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?Se:Ar;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=ct(this,t),a=(this.style.removeProperty(t),ct(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,Sr(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=ct(this,t),u=e(this),c=u+"";return null==u&&(this.style.removeProperty(t),c=u=ct(this,t)),a===c?null:a===r&&c===i?o:(i=c,o=n(r=a,u))}}(t,r,Nr(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,u="end."+a;return function(){var c=xr(this,t),f=c.on,s=null==c.value[a]?o||(o=Sr(n)):void 0;f===e&&i===s||(r=(e=f).copy()).on(u,i=s),c.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=ct(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n(r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Nr(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",(t=this._id,function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}));var t},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=wr(this.node(),e).tween,o=0,a=i.length;o0&&(r=o-p),M<0?h=d-v:M>0&&(a=u-v),x=vi,L.attr("cursor",xi.selection),B());break;default:return}di()},!0).on("keyup.brush",function(){switch(t.event.keyCode){case 16:P&&(y=_=P=!1,B());break;case 18:x===yi&&(w<0?s=l:w>0&&(r=o),M<0?h=d:M>0&&(a=u),x=gi,B());break;case 32:x===vi&&(t.event.altKey?(w&&(s=l-p*w,r=o+p*w),M&&(h=d-v*M,a=u+v*M),x=yi):(w<0?s=l:w>0&&(r=o),M<0?h=d:M>0&&(a=u),x=gi),L.attr("cursor",xi[m]),B());break;default:return}di()},!0).on("mousemove.brush",O,!0).on("mouseup.brush",Y,!0);It(t.event.view)}hi(),Mr(b),c.call(b),D.start()}function O(){var t=Ot(b);!P||y||_||(Math.abs(t[0]-R[0])>Math.abs(t[1]-R[1])?_=!0:y=!0),R=t,g=!0,di(),B()}function B(){var t;switch(p=R[0]-z[0],v=R[1]-z[1],x){case vi:case pi:w&&(p=Math.max(S-r,Math.min(E-s,p)),o=r+p,l=s+p),M&&(v=Math.max(k-a,Math.min(C-h,v)),u=a+v,d=h+v);break;case gi:w<0?(p=Math.max(S-r,Math.min(E-r,p)),o=r+p,l=s):w>0&&(p=Math.max(S-s,Math.min(E-s,p)),o=r,l=s+p),M<0?(v=Math.max(k-a,Math.min(C-a,v)),u=a+v,d=h):M>0&&(v=Math.max(k-h,Math.min(C-h,v)),u=a,d=h+v);break;case yi:w&&(o=Math.max(S,Math.min(E,r-p*w)),l=Math.max(S,Math.min(E,s+p*w))),M&&(u=Math.max(k,Math.min(C,a-v*M)),d=Math.max(k,Math.min(C,h+v*M)))}l1e-6)if(Math.abs(s*u-c*f)>1e-6&&i){var h=e-o,d=r-a,p=u*u+c*c,v=h*h+d*d,g=Math.sqrt(p),y=Math.sqrt(l),_=i*Math.tan((Yi-Math.acos((p+l-v)/(2*g*y)))/2),b=_/y,m=_/g;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*f)+","+(n+b*s)),this._+="A"+i+","+i+",0,0,"+ +(s*h>f*d)+","+(this._x1=t+m*u)+","+(this._y1=n+m*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n;var a=(e=+e)*Math.cos(r),u=e*Math.sin(r),c=t+a,f=n+u,s=1^o,l=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+f:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-f)>1e-6)&&(this._+="L"+c+","+f),e&&(l<0&&(l=l%Fi+Fi),l>Ii?this._+="A"+e+","+e+",0,1,"+s+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+s+","+(this._x1=c)+","+(this._y1=f):l>1e-6&&(this._+="A"+e+","+e+",0,"+ +(l>=Yi)+","+s+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};function Zi(){}function Qi(t,n){var e=new Zi;if(t instanceof Zi)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++ir!=d>r&&e<(h-f)*(r-s)/(d-s)+f&&(i=-i)}return i}function so(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],o=e[r],a=n[r],i<=o&&o<=a||a<=o&&o<=i)}function lo(){}var ho=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function po(){var t=1,n=1,e=M,r=u;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(ao);else{var r=s(t),i=r[0],a=r[1];n=w(i,a,n),n=g(Math.floor(i/n)*n,Math.floor(a/n)*n,n)}return n.map(function(n){return o(t,n)})}function o(e,i){var o=[],u=[];return function(e,r,i){var o,u,c,f,s,l,h=new Array,d=new Array;o=u=-1,f=e[0]>=r,ho[f<<1].forEach(p);for(;++o=r,ho[c|f<<1].forEach(p);ho[f<<0].forEach(p);for(;++u=r,s=e[u*t]>=r,ho[f<<1|s<<2].forEach(p);++o=r,l=s,s=e[u*t+o+1]>=r,ho[c|f<<1|s<<2|l<<3].forEach(p);ho[f|s<<3].forEach(p)}o=-1,s=e[u*t]>=r,ho[s<<2].forEach(p);for(;++o=r,ho[s<<2|l<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+o,t[0][1]+u],c=[t[1][0]+o,t[1][1]+u],f=a(r),s=a(c);(n=d[f])?(e=h[s])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(c),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(c),d[n.end=s]=n):(n=h[s])?(e=d[f])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(c),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=f]=n):h[f]=d[s]={start:f,end:s,ring:[r,c]}}ho[s<<3].forEach(p)}(e,i,function(t){r(t,e,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n0?o.push([t]):u.push(t)}),u.forEach(function(t){for(var n,e=0,r=o.length;e0&&a0&&u0&&o>0))throw new Error("invalid size");return t=r,n=o,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?uo(oo.call(t)):uo(t),i):e},i.smooth=function(t){return arguments.length?(r=t?u:lo,i):r===u},i}function vo(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a=e&&(u>=o&&(c-=t.data[u-o+a*r]),n.data[u-e+a*r]=c/Math.min(u+1,r-1+o-u,o))}function go(t,n,e){for(var r=t.width,i=t.height,o=1+(e<<1),a=0;a=e&&(u>=o&&(c-=t.data[a+(u-o)*r]),n.data[a+(u-e)*r]=c/Math.min(u+1,i-1+o-u,o))}function yo(t){return t[0]}function _o(t){return t[1]}function bo(){return 1}var mo={},xo={},wo=34,Mo=10,No=13;function Ao(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}")}function To(t){var n=Object.create(null),e=[];return t.forEach(function(t){for(var r in t)r in n||e.push(n[r]=r)}),e}function So(t,n){var e=t+"",r=e.length;return r9999?"+"+So(n,6):So(n,4))+"-"+So(t.getUTCMonth()+1,2)+"-"+So(t.getUTCDate(),2)+(o?"T"+So(e,2)+":"+So(r,2)+":"+So(i,2)+"."+So(o,3)+"Z":i?"T"+So(e,2)+":"+So(r,2)+":"+So(i,2)+"Z":r||e?"T"+So(e,2)+":"+So(r,2)+"Z":"")}function Eo(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,c=o<=0,f=!1;function s(){if(c)return xo;if(f)return f=!1,mo;var n,r,i=a;if(t.charCodeAt(i)===wo){for(;a++=o?c=!0:(r=t.charCodeAt(a++))===Mo?f=!0:r===No&&(f=!0,t.charCodeAt(a)===Mo&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a=(o=(v+y)/2))?v=o:y=o,(s=e>=(a=(g+_)/2))?g=a:_=a,i=d,!(d=d[l=s<<1|f]))return i[l]=p,t;if(u=+t._x.call(null,d.data),c=+t._y.call(null,d.data),n===u&&e===c)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(f=n>=(o=(v+y)/2))?v=o:y=o,(s=e>=(a=(g+_)/2))?g=a:_=a}while((l=s<<1|f)==(h=(c>=a)<<1|u>=o));return i[h]=d,i[l]=p,t}function ra(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function ia(t){return t[0]}function oa(t){return t[1]}function aa(t,n,e){var r=new ua(null==n?ia:n,null==e?oa:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function ua(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function ca(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var fa=aa.prototype=ua.prototype;function sa(t){return t.x+t.vx}function la(t){return t.y+t.vy}function ha(t){return t.index}function da(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}function pa(t){return t.x}function va(t){return t.y}fa.copy=function(){var t,n,e=new ua(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=ca(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=ca(n));return e},fa.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return ea(this.cover(n,e),n,e,t)},fa.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),c=1/0,f=1/0,s=-1/0,l=-1/0;for(e=0;es&&(s=r),il&&(l=i));if(c>s||f>l)return this;for(this.cover(c,f).cover(s,l),e=0;et||t>=i||r>n||n>=o;)switch(u=(nh||(o=c.y0)>d||(a=c.x1)=y)<<1|t>=g)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=c)}else{var _=t-+this._x.call(null,v.data),b=n-+this._y.call(null,v.data),m=_*_+b*b;if(m=(u=(p+g)/2))?p=u:g=u,(s=a>=(c=(v+y)/2))?v=c:y=c,n=d,!(d=d[l=s<<1|f]))return this;if(!d.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},fa.removeAll=function(t){for(var n=0,e=t.length;n1?r[0]+r.slice(2):r,+t.slice(e+1)]}function ba(t){return(t=_a(Math.abs(t)))?t[1]:NaN}var ma,xa=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wa(t){return new Ma(t)}function Ma(t){if(!(n=xa.exec(t)))throw new Error("invalid format: "+t);var n;this.fill=n[1]||" ",this.align=n[2]||">",this.sign=n[3]||"-",this.symbol=n[4]||"",this.zero=!!n[5],this.width=n[6]&&+n[6],this.comma=!!n[7],this.precision=n[8]&&+n[8].slice(1),this.trim=!!n[9],this.type=n[10]||""}function Na(t,n){var e=_a(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}wa.prototype=Ma.prototype,Ma.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Aa={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Na(100*t,n)},r:Na,s:function(t,n){var e=_a(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(ma=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+_a(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Ta(t){return t}var Sa,ka=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ea(t){var n,e,r=t.grouping&&t.thousands?(n=t.grouping,e=t.thousands,function(t,r){for(var i=t.length,o=[],a=0,u=n[0],c=0;i>0&&u>0&&(c+u+1>r&&(u=Math.max(1,r-c)),o.push(t.substring(i-=u,i+u)),!((c+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}):Ta,i=t.currency,o=t.decimal,a=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(t.numerals):Ta,u=t.percent||"%";function c(t){var n=(t=wa(t)).fill,e=t.align,c=t.sign,f=t.symbol,s=t.zero,l=t.width,h=t.comma,d=t.precision,p=t.trim,v=t.type;"n"===v?(h=!0,v="g"):Aa[v]||(null==d&&(d=12),p=!0,v="g"),(s||"0"===n&&"="===e)&&(s=!0,n="0",e="=");var g="$"===f?i[0]:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===f?i[1]:/[%p]/.test(v)?u:"",_=Aa[v],b=/[defgprs%]/.test(v);function m(t){var i,u,f,m=g,x=y;if("c"===v)x=_(t)+x,t="";else{var w=(t=+t)<0;if(t=_(Math.abs(t),d),p&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),w&&0==+t&&(w=!1),m=(w?"("===c?c:"-":"-"===c||"("===c?"":c)+m,x=("s"===v?ka[8+ma/3]:"")+x+(w&&"("===c?")":""),b)for(i=-1,u=t.length;++i(f=t.charCodeAt(i))||f>57){x=(46===f?o+t.slice(i+1):t.slice(i))+x,t=t.slice(0,i);break}}h&&!s&&(t=r(t,1/0));var M=m.length+t.length+x.length,N=M>1)+m+t+x+N.slice(M);break;default:t=N+m+t+x}return a(t)}return d=null==d?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),m.toString=function(){return t+""},m}return{format:c,formatPrefix:function(t,n){var e=c(((t=wa(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ba(n)/3))),i=Math.pow(10,-r),o=ka[8+r/3];return function(t){return e(i*t)+o}}}}function Ca(n){return Sa=Ea(n),t.format=Sa.format,t.formatPrefix=Sa.formatPrefix,Sa}function Pa(t){return Math.max(0,-ba(Math.abs(t)))}function za(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ba(n)/3)))-ba(Math.abs(t)))}function Ra(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ba(n)-ba(t))+1}function Da(){return new qa}function qa(){this.reset()}Ca({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),qa.prototype={constructor:qa,reset:function(){this.s=this.t=0},add:function(t){Ua(La,t,this.t),Ua(this,La.s,this.s),this.s?this.t+=La.t:this.s=La.t},valueOf:function(){return this.s}};var La=new qa;function Ua(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}var Oa=1e-6,Ba=1e-12,Ya=Math.PI,Fa=Ya/2,Ia=Ya/4,ja=2*Ya,Ha=180/Ya,Xa=Ya/180,Ga=Math.abs,Va=Math.atan,$a=Math.atan2,Wa=Math.cos,Za=Math.ceil,Qa=Math.exp,Ja=Math.log,Ka=Math.pow,tu=Math.sin,nu=Math.sign||function(t){return t>0?1:t<0?-1:0},eu=Math.sqrt,ru=Math.tan;function iu(t){return t>1?0:t<-1?Ya:Math.acos(t)}function ou(t){return t>1?Fa:t<-1?-Fa:Math.asin(t)}function au(t){return(t=tu(t/2))*t}function uu(){}function cu(t,n){t&&su.hasOwnProperty(t.type)&&su[t.type](t,n)}var fu={Feature:function(t,n){cu(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r=0?1:-1,i=r*e,o=Wa(n=(n*=Xa)/2+Ia),a=tu(n),u=_u*a,c=yu*o+u*Wa(i),f=u*r*tu(i);bu.add($a(f,c)),gu=t,yu=o,_u=a}function Tu(t){return[$a(t[1],t[0]),ou(t[2])]}function Su(t){var n=t[0],e=t[1],r=Wa(e);return[r*Wa(n),r*tu(n),tu(e)]}function ku(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Eu(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Cu(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Pu(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function zu(t){var n=eu(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Ru,Du,qu,Lu,Uu,Ou,Bu,Yu,Fu,Iu,ju,Hu,Xu,Gu,Vu,$u,Wu,Zu,Qu,Ju,Ku,tc,nc,ec,rc,ic,oc=Da(),ac={point:uc,lineStart:fc,lineEnd:sc,polygonStart:function(){ac.point=lc,ac.lineStart=hc,ac.lineEnd=dc,oc.reset(),xu.polygonStart()},polygonEnd:function(){xu.polygonEnd(),ac.point=uc,ac.lineStart=fc,ac.lineEnd=sc,bu<0?(Ru=-(qu=180),Du=-(Lu=90)):oc>Oa?Lu=90:oc<-Oa&&(Du=-90),Iu[0]=Ru,Iu[1]=qu}};function uc(t,n){Fu.push(Iu=[Ru=t,qu=t]),nLu&&(Lu=n)}function cc(t,n){var e=Su([t*Xa,n*Xa]);if(Yu){var r=Eu(Yu,e),i=Eu([r[1],-r[0],0],r);zu(i),i=Tu(i);var o,a=t-Uu,u=a>0?1:-1,c=i[0]*Ha*u,f=Ga(a)>180;f^(u*UuLu&&(Lu=o):f^(u*Uu<(c=(c+360)%360-180)&&cLu&&(Lu=n)),f?tpc(Ru,qu)&&(qu=t):pc(t,qu)>pc(Ru,qu)&&(Ru=t):qu>=Ru?(tqu&&(qu=t)):t>Uu?pc(Ru,t)>pc(Ru,qu)&&(qu=t):pc(t,qu)>pc(Ru,qu)&&(Ru=t)}else Fu.push(Iu=[Ru=t,qu=t]);nLu&&(Lu=n),Yu=e,Uu=t}function fc(){ac.point=cc}function sc(){Iu[0]=Ru,Iu[1]=qu,ac.point=uc,Yu=null}function lc(t,n){if(Yu){var e=t-Uu;oc.add(Ga(e)>180?e+(e>0?360:-360):e)}else Ou=t,Bu=n;xu.point(t,n),cc(t,n)}function hc(){xu.lineStart()}function dc(){lc(Ou,Bu),xu.lineEnd(),Ga(oc)>Oa&&(Ru=-(qu=180)),Iu[0]=Ru,Iu[1]=qu,Yu=null}function pc(t,n){return(n-=t)<0?n+360:n}function vc(t,n){return t[0]-n[0]}function gc(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nYa?t+Math.round(-t/ja)*ja:t,n]}function Pc(t,n,e){return(t%=ja)?n||e?Ec(Rc(t),Dc(n,e)):Rc(t):n||e?Dc(n,e):Cc}function zc(t){return function(n,e){return[(n+=t)>Ya?n-ja:n<-Ya?n+ja:n,e]}}function Rc(t){var n=zc(t);return n.invert=zc(-t),n}function Dc(t,n){var e=Wa(t),r=tu(t),i=Wa(n),o=tu(n);function a(t,n){var a=Wa(n),u=Wa(t)*a,c=tu(t)*a,f=tu(n),s=f*e+u*r;return[$a(c*i-s*o,u*e-f*r),ou(s*i+c*o)]}return a.invert=function(t,n){var a=Wa(n),u=Wa(t)*a,c=tu(t)*a,f=tu(n),s=f*i-c*o;return[$a(c*i+f*o,u*e+s*r),ou(s*e-u*r)]},a}function qc(t){function n(n){return(n=t(n[0]*Xa,n[1]*Xa))[0]*=Ha,n[1]*=Ha,n}return t=Pc(t[0]*Xa,t[1]*Xa,t.length>2?t[2]*Xa:0),n.invert=function(n){return(n=t.invert(n[0]*Xa,n[1]*Xa))[0]*=Ha,n[1]*=Ha,n},n}function Lc(t,n,e,r,i,o){if(e){var a=Wa(n),u=tu(n),c=r*e;null==i?(i=n+r*ja,o=n-c/2):(i=Uc(a,i),o=Uc(a,o),(r>0?io)&&(i+=r*ja));for(var f,s=i;r>0?s>o:s1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Bc(t,n){return Ga(t[0]-n[0])=0;--o)i.point((s=f[o])[0],s[1]);else r(h.x,h.p.x,-1,i);h=h.p}f=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function Ic(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r=0?1:-1,A=N*M,T=A>Ya,S=v*x;if(jc.add($a(S*N*tu(A),g*w+S*Wa(A))),a+=T?M+N*ja:M,T^d>=e^b>=e){var k=Eu(Su(h),Su(_));zu(k);var E=Eu(o,k);zu(E);var C=(T^M>=0?-1:1)*ou(E[2]);(r>C||r===C&&(k[0]||k[1]))&&(u+=T^M>=0?1:-1)}}return(a<-Oa||a0){for(l||(i.polygonStart(),l=!0),i.lineStart(),t=0;t1&&2&c&&h.push(h.pop().concat(h.shift())),a.push(h.filter(Gc))}return h}}function Gc(t){return t.length>1}function Vc(t,n){return((t=t.x)[0]<0?t[1]-Fa-Oa:Fa-t[1])-((n=n.x)[0]<0?n[1]-Fa-Oa:Fa-n[1])}var $c=Xc(function(){return!0},function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?Ya:-Ya,c=Ga(o-e);Ga(c-Ya)0?Fa:-Fa),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&c>=Ya&&(Ga(e-i)Oa?Va((tu(n)*(o=Wa(r))*tu(e)-tu(r)*(i=Wa(n))*tu(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}},function(t,n,e,r){var i;if(null==t)i=e*Fa,r.point(-Ya,i),r.point(0,i),r.point(Ya,i),r.point(Ya,0),r.point(Ya,-i),r.point(0,-i),r.point(-Ya,-i),r.point(-Ya,0),r.point(-Ya,i);else if(Ga(t[0]-n[0])>Oa){var o=t[0]0,i=Ga(n)>Oa;function o(t,e){return Wa(t)*Wa(e)>n}function a(t,e,r){var i=[1,0,0],o=Eu(Su(t),Su(e)),a=ku(o,o),u=o[0],c=a-u*u;if(!c)return!r&&t;var f=n*a/c,s=-n*u/c,l=Eu(i,o),h=Pu(i,f);Cu(h,Pu(o,s));var d=l,p=ku(h,d),v=ku(d,d),g=p*p-v*(ku(h,h)-1);if(!(g<0)){var y=eu(g),_=Pu(d,(-p-y)/v);if(Cu(_,h),_=Tu(_),!r)return _;var b,m=t[0],x=e[0],w=t[1],M=e[1];x0^_[1]<(Ga(_[0]-m)Ya^(m<=_[0]&&_[0]<=x)){var T=Pu(d,(-p+y)/v);return Cu(T,h),[_,Tu(T)]}}}function u(n,e){var i=r?t:Ya-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return Xc(o,function(t){var n,e,c,f,s;return{lineStart:function(){f=c=!1,s=1},point:function(l,h){var d,p=[l,h],v=o(l,h),g=r?v?0:u(l,h):v?u(l+(l<0?Ya:-Ya),h):0;if(!n&&(f=c=v)&&t.lineStart(),v!==c&&(!(d=a(n,p))||Bc(n,d)||Bc(p,d))&&(p[0]+=Oa,p[1]+=Oa,v=o(p[0],p[1])),v!==c)s=0,v?(t.lineStart(),d=a(p,n),t.point(d[0],d[1])):(d=a(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(i&&n&&r^v){var y;g&e||!(y=a(p,n,!0))||(s=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!v||n&&Bc(n,p)||t.point(p[0],p[1]),n=p,c=v,e=g},lineEnd:function(){c&&t.lineEnd(),n=null},clean:function(){return s|(f&&c)<<1}}},function(n,r,i,o){Lc(o,t,e,i,n,r)},r?[0,-t]:[-Ya,t-Ya])}var Zc=1e9,Qc=-Zc;function Jc(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,f){var s=0,l=0;if(null==i||(s=a(i,u))!==(l=a(o,u))||c(i,o)<0^u>0)do{f.point(0===s||3===s?t:e,s>1?r:n)}while((s=(s+u+4)%4)!==l);else f.point(o[0],o[1])}function a(r,i){return Ga(r[0]-t)0?0:3:Ga(r[0]-e)0?2:1:Ga(r[1]-n)0?1:0:i>0?3:2}function u(t,n){return c(t.x,n.x)}function c(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var c,f,s,l,h,d,p,v,g,y,_,b=a,m=Oc(),x={point:w,lineStart:function(){x.point=M,f&&f.push(s=[]);y=!0,g=!1,p=v=NaN},lineEnd:function(){c&&(M(l,h),d&&g&&m.rejoin(),c.push(m.result()));x.point=w,g&&b.lineEnd()},polygonStart:function(){b=m,c=[],f=[],_=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=f.length;er&&(h-o)*(r-a)>(d-a)*(t-o)&&++n:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--n;return n}(),e=_&&n,i=(c=T(c)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Fc(c,u,n,o,a),a.polygonEnd());b=a,c=f=s=null}};function w(t,n){i(t,n)&&b.point(t,n)}function M(o,a){var u=i(o,a);if(f&&s.push([o,a]),y)l=o,h=a,d=u,y=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var c=[p=Math.max(Qc,Math.min(Zc,p)),v=Math.max(Qc,Math.min(Zc,v))],m=[o=Math.max(Qc,Math.min(Zc,o)),a=Math.max(Qc,Math.min(Zc,a))];!function(t,n,e,r,i,o){var a,u=t[0],c=t[1],f=0,s=1,l=n[0]-u,h=n[1]-c;if(a=e-u,l||!(a>0)){if(a/=l,l<0){if(a0){if(a>s)return;a>f&&(f=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>s)return;a>f&&(f=a)}else if(l>0){if(a0)){if(a/=h,h<0){if(a0){if(a>s)return;a>f&&(f=a)}if(a=o-c,h||!(a<0)){if(a/=h,h<0){if(a>s)return;a>f&&(f=a)}else if(h>0){if(a0&&(t[0]=u+f*l,t[1]=c+f*h),s<1&&(n[0]=u+s*l,n[1]=c+s*h),!0}}}}}(c,m,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),_=!1):(g||(b.lineStart(),b.point(c[0],c[1])),b.point(m[0],m[1]),u||b.lineEnd(),_=!1)}p=o,v=a,g=u}return x}}var Kc,tf,nf,ef=Da(),rf={sphere:uu,point:uu,lineStart:function(){rf.point=af,rf.lineEnd=of},lineEnd:uu,polygonStart:uu,polygonEnd:uu};function of(){rf.point=rf.lineEnd=uu}function af(t,n){Kc=t*=Xa,tf=tu(n*=Xa),nf=Wa(n),rf.point=uf}function uf(t,n){t*=Xa;var e=tu(n*=Xa),r=Wa(n),i=Ga(t-Kc),o=Wa(i),a=r*tu(i),u=nf*e-tf*r*o,c=tf*e+nf*r*o;ef.add($a(eu(a*a+u*u),c)),Kc=t,tf=e,nf=r}function cf(t){return ef.reset(),du(t,rf),+ef}var ff=[null,null],sf={type:"LineString",coordinates:ff};function lf(t,n){return ff[0]=t,ff[1]=n,cf(sf)}var hf={Feature:function(t,n){return pf(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++rOa}).map(c)).concat(g(Za(o/d)*d,i,d).filter(function(t){return Ga(t%v)>Oa}).map(f))}return _.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})},_.outline=function(){return{type:"Polygon",coordinates:[s(r).concat(l(a).slice(1),s(e).reverse().slice(1),l(u).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.extentMajor(t).extentMinor(t):_.extentMinor()},_.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),_.precision(y)):[[r,u],[e,a]]},_.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),_.precision(y)):[[n,o],[t,i]]},_.step=function(t){return arguments.length?_.stepMajor(t).stepMinor(t):_.stepMinor()},_.stepMajor=function(t){return arguments.length?(p=+t[0],v=+t[1],_):[p,v]},_.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],_):[h,d]},_.precision=function(h){return arguments.length?(y=+h,c=mf(o,i,90),f=xf(n,t,y),s=mf(u,a,90),l=xf(r,e,y),_):y},_.extentMajor([[-180,-90+Oa],[180,90-Oa]]).extentMinor([[-180,-80-Oa],[180,80+Oa]])}function Mf(t){return t}var Nf,Af,Tf,Sf,kf=Da(),Ef=Da(),Cf={point:uu,lineStart:uu,lineEnd:uu,polygonStart:function(){Cf.lineStart=Pf,Cf.lineEnd=Df},polygonEnd:function(){Cf.lineStart=Cf.lineEnd=Cf.point=uu,kf.add(Ga(Ef)),Ef.reset()},result:function(){var t=kf/2;return kf.reset(),t}};function Pf(){Cf.point=zf}function zf(t,n){Cf.point=Rf,Nf=Tf=t,Af=Sf=n}function Rf(t,n){Ef.add(Sf*t-Tf*n),Tf=t,Sf=n}function Df(){Rf(Nf,Af)}var qf=1/0,Lf=qf,Uf=-qf,Of=Uf,Bf={point:function(t,n){tUf&&(Uf=t);nOf&&(Of=n)},lineStart:uu,lineEnd:uu,polygonStart:uu,polygonEnd:uu,result:function(){var t=[[qf,Lf],[Uf,Of]];return Uf=Of=-(Lf=qf=1/0),t}};var Yf,Ff,If,jf,Hf=0,Xf=0,Gf=0,Vf=0,$f=0,Wf=0,Zf=0,Qf=0,Jf=0,Kf={point:ts,lineStart:ns,lineEnd:is,polygonStart:function(){Kf.lineStart=os,Kf.lineEnd=as},polygonEnd:function(){Kf.point=ts,Kf.lineStart=ns,Kf.lineEnd=is},result:function(){var t=Jf?[Zf/Jf,Qf/Jf]:Wf?[Vf/Wf,$f/Wf]:Gf?[Hf/Gf,Xf/Gf]:[NaN,NaN];return Hf=Xf=Gf=Vf=$f=Wf=Zf=Qf=Jf=0,t}};function ts(t,n){Hf+=t,Xf+=n,++Gf}function ns(){Kf.point=es}function es(t,n){Kf.point=rs,ts(If=t,jf=n)}function rs(t,n){var e=t-If,r=n-jf,i=eu(e*e+r*r);Vf+=i*(If+t)/2,$f+=i*(jf+n)/2,Wf+=i,ts(If=t,jf=n)}function is(){Kf.point=ts}function os(){Kf.point=us}function as(){cs(Yf,Ff)}function us(t,n){Kf.point=cs,ts(Yf=If=t,Ff=jf=n)}function cs(t,n){var e=t-If,r=n-jf,i=eu(e*e+r*r);Vf+=i*(If+t)/2,$f+=i*(jf+n)/2,Wf+=i,Zf+=(i=jf*t-If*n)*(If+t),Qf+=i*(jf+n),Jf+=3*i,ts(If=t,jf=n)}function fs(t){this._context=t}fs.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,ja)}},result:uu};var ss,ls,hs,ds,ps,vs=Da(),gs={point:uu,lineStart:function(){gs.point=ys},lineEnd:function(){ss&&_s(ls,hs),gs.point=uu},polygonStart:function(){ss=!0},polygonEnd:function(){ss=null},result:function(){var t=+vs;return vs.reset(),t}};function ys(t,n){gs.point=_s,ls=ds=t,hs=ps=n}function _s(t,n){ds-=t,ps-=n,vs.add(eu(ds*ds+ps*ps)),ds=t,ps=n}function bs(){this._string=[]}function ms(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function xs(t){return function(n){var e=new ws;for(var r in t)e[r]=t[r];return e.stream=n,e}}function ws(){}function Ms(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),du(e,t.stream(Bf)),n(Bf.result()),null!=r&&t.clipExtent(r),t}function Ns(t,n,e){return Ms(t,function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])},e)}function As(t,n,e){return Ns(t,[[0,0],n],e)}function Ts(t,n,e){return Ms(t,function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])},e)}function Ss(t,n,e){return Ms(t,function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])},e)}bs.prototype={_radius:4.5,_circle:ms(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=ms(this._radius)),this._string.push("M",t,",",n,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},ws.prototype={constructor:ws,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var ks=16,Es=Wa(30*Xa);function Cs(t,n){return+n?function(t,n){function e(r,i,o,a,u,c,f,s,l,h,d,p,v,g){var y=f-r,_=s-i,b=y*y+_*_;if(b>4*n&&v--){var m=a+h,x=u+d,w=c+p,M=eu(m*m+x*x+w*w),N=ou(w/=M),A=Ga(Ga(w)-1)n||Ga((y*E+_*C)/b-.5)>.3||a*h+u*d+c*p2?t[2]%360*Xa:0,S()):[g*Ha,y*Ha,_*Ha]},A.angle=function(t){return arguments.length?(b=t%360*Xa,S()):b*Ha},A.precision=function(t){return arguments.length?(a=Cs(u,N=t*t),k()):eu(N)},A.fitExtent=function(t,n){return Ns(A,t,n)},A.fitSize=function(t,n){return As(A,t,n)},A.fitWidth=function(t,n){return Ts(A,t,n)},A.fitHeight=function(t,n){return Ss(A,t,n)},function(){return n=t.apply(this,arguments),A.invert=n.invert&&T,S()}}function qs(t){var n=0,e=Ya/3,r=Ds(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Xa,e=t[1]*Xa):[n*Ha,e*Ha]},i}function Ls(t,n){var e=tu(t),r=(e+tu(n))/2;if(Ga(r)0?n<-Fa+Oa&&(n=-Fa+Oa):n>Fa-Oa&&(n=Fa-Oa);var e=i/Ka(Xs(n),r);return[e*tu(r*t),i-e*Wa(r*t)]}return o.invert=function(t,n){var e=i-n,o=nu(r)*eu(t*t+e*e);return[$a(t,Ga(e))/r*nu(e),2*Va(Ka(i/o,1/r))-Fa]},o}function Vs(t,n){return[t,n]}function $s(t,n){var e=Wa(t),r=t===n?tu(t):(e-Wa(n))/(n-t),i=e/r+t;if(Ga(r)=0;)n+=e[r].value;else n=1;t.value=n}function ll(t,n){var e,r,i,o,a,u=new vl(t),c=+t.value&&(u.value=t.value),f=[u];for(null==n&&(n=hl);e=f.pop();)if(c&&(e.value=+e.data.value),(i=n(e.data))&&(a=i.length))for(e.children=new Array(a),o=a-1;o>=0;--o)f.push(r=e.children[o]=new vl(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(pl)}function hl(t){return t.children}function dl(t){t.data=t.data.data}function pl(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function vl(t){this.data=t,this.depth=this.height=0,this.parent=null}tl.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(Ws+Zs*i+o*(Qs+Js*i))-n)/(Ws+3*Zs*i+o*(7*Qs+9*Js*i)))*r)*i*i,!(Ga(e)Oa&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},il.invert=Ys(ou),ol.invert=Ys(function(t){return 2*Va(t)}),al.invert=function(t,n){return[-n,2*Va(Qa(t))-Fa]},vl.prototype=ll.prototype={constructor:vl,count:function(){return this.eachAfter(sl)},each:function(t){var n,e,r,i,o=this,a=[o];do{for(n=a.reverse(),a=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each(function(n){t.push(n)}),t},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return ll(this).eachBefore(dl)}};var gl=Array.prototype.slice;function yl(t){for(var n,e,r=0,i=(t=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t}(gl.call(t))).length,o=[];r0&&e*e>r*r+i*i}function xl(t,n){for(var e=0;e(a*=a)?(r=(f+a-i)/(2*f),o=Math.sqrt(Math.max(0,a/f-r*r)),e.x=t.x-r*u-o*c,e.y=t.y-r*c+o*u):(r=(f+i-a)/(2*f),o=Math.sqrt(Math.max(0,i/f-r*r)),e.x=n.x+r*u-o*c,e.y=n.y+r*c+o*u)):(e.x=n.x+e.r,e.y=n.y)}function Tl(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function Sl(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function kl(t){this._=t,this.next=null,this.previous=null}function El(t){if(!(i=t.length))return 0;var n,e,r,i,o,a,u,c,f,s,l;if((n=t[0]).x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;Al(e,n,r=t[2]),n=new kl(n),e=new kl(e),r=new kl(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(u=3;uh&&(h=u),g=s*s*v,(d=Math.max(h/g,g/l))>p){s-=u;break}p=d}y.push(a={value:s,dice:c1?n:1)},e}(Ql);var th=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,c,f,s,l=-1,h=a.length,d=t.value;++l1?n:1)},e}(Ql);function nh(t,n){return t[0]-n[0]||t[1]-n[1]}function eh(t){for(var n,e,r,i=t.length,o=[0,1],a=2,u=2;u1&&(n=t[o[a-2]],e=t[o[a-1]],r=t[u],(e[0]-n[0])*(r[1]-n[1])-(e[1]-n[1])*(r[0]-n[0])<=0);)--a;o[a++]=u}return o.slice(0,a)}function rh(){return Math.random()}var ih=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(rh),oh=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(rh),ah=function t(n){function e(){var t=oh.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(rh),uh=function t(n){function e(t){return function(){for(var e=0,r=0;rr&&(n=e,e=r,r=n),function(t){return Math.max(e,Math.min(r,t))}}function Mh(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i2?Nh:Mh,i=o=null,l}function l(n){return isNaN(n=+n)?e:(i||(i=r(a.map(t),u,c)))(t(f(n)))}return l.invert=function(e){return f(n((o||(o=r(u,a.map(t),he)))(e)))},l.domain=function(t){return arguments.length?(a=dh.call(t,_h),f===mh||(f=wh(a)),s()):a.slice()},l.range=function(t){return arguments.length?(u=ph.call(t),s()):u.slice()},l.rangeRound=function(t){return u=ph.call(t),c=_e,s()},l.clamp=function(t){return arguments.length?(f=t?wh(a):mh,l):f!==mh},l.interpolate=function(t){return arguments.length?(c=t,s()):c},l.unknown=function(t){return arguments.length?(e=t,l):e},function(e,r){return t=e,n=r,s()}}function Sh(t,n){return Th()(t,n)}function kh(n,e,r,i){var o,a=w(n,e,r);switch((i=wa(null==i?",f":i)).type){case"s":var u=Math.max(Math.abs(n),Math.abs(e));return null!=i.precision||isNaN(o=za(a,u))||(i.precision=o),t.formatPrefix(i,u);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=Ra(a,Math.max(Math.abs(n),Math.abs(e))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=Pa(a))||(i.precision=o-2*("%"===i.type))}return t.format(i)}function Eh(t){var n=t.domain;return t.ticks=function(t){var e=n();return m(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return kh(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),o=0,a=i.length-1,u=i[o],c=i[a];return c0?r=x(u=Math.floor(u/r)*r,c=Math.ceil(c/r)*r,e):r<0&&(r=x(u=Math.ceil(u*r)/r,c=Math.floor(c*r)/r,e)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(c/r)*r,n(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(c*r)/r,n(i)),t},t}function Ch(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a0){for(;hc)break;v.push(l)}}else for(;h=1;--s)if(!((l=f*s)c)break;v.push(l)}}else v=m(h,d,Math.min(d-h,p)).map(r);return n?v.reverse():v},i.tickFormat=function(n,o){if(null==o&&(o=10===a?".0e":","),"function"!=typeof o&&(o=t.format(o)),n===1/0)return o;null==n&&(n=10);var u=Math.max(1,a*n/i.ticks().length);return function(t){var n=t/r(Math.round(e(t)));return n*a0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return Gh.setTime(+n),Vh.setTime(+r),t(Gh),t(Vh),Math.floor(e(Gh,Vh))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var Wh=$h(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});Wh.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?$h(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):Wh:null};var Zh=Wh.range,Qh=6e4,Jh=6048e5,Kh=$h(function(t){t.setTime(t-t.getMilliseconds())},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),td=Kh.range,nd=$h(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},function(t,n){t.setTime(+t+n*Qh)},function(t,n){return(n-t)/Qh},function(t){return t.getMinutes()}),ed=nd.range,rd=$h(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-t.getMinutes()*Qh)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()}),id=rd.range,od=$h(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Qh)/864e5},function(t){return t.getDate()-1}),ad=od.range;function ud(t){return $h(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Qh)/Jh})}var cd=ud(0),fd=ud(1),sd=ud(2),ld=ud(3),hd=ud(4),dd=ud(5),pd=ud(6),vd=cd.range,gd=fd.range,yd=sd.range,_d=ld.range,bd=hd.range,md=dd.range,xd=pd.range,wd=$h(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),Md=wd.range,Nd=$h(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});Nd.every=function(t){return isFinite(t=Math.floor(t))&&t>0?$h(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};var Ad=Nd.range,Td=$h(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Qh)},function(t,n){return(n-t)/Qh},function(t){return t.getUTCMinutes()}),Sd=Td.range,kd=$h(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()}),Ed=kd.range,Cd=$h(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1}),Pd=Cd.range;function zd(t){return $h(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/Jh})}var Rd=zd(0),Dd=zd(1),qd=zd(2),Ld=zd(3),Ud=zd(4),Od=zd(5),Bd=zd(6),Yd=Rd.range,Fd=Dd.range,Id=qd.range,jd=Ld.range,Hd=Ud.range,Xd=Od.range,Gd=Bd.range,Vd=$h(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),$d=Vd.range,Wd=$h(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});Wd.every=function(t){return isFinite(t=Math.floor(t))&&t>0?$h(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var Zd=Wd.range;function Qd(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Jd(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Kd(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function tp(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,c=t.shortMonths,f=cp(i),s=fp(i),l=cp(o),h=fp(o),d=cp(a),p=fp(a),v=cp(u),g=fp(u),y=cp(c),_=fp(c),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:Ep,e:Ep,f:Dp,H:Cp,I:Pp,j:zp,L:Rp,m:qp,M:Lp,p:function(t){return i[+(t.getHours()>=12)]},Q:sv,s:lv,S:Up,u:Op,U:Bp,V:Yp,w:Fp,W:Ip,x:null,X:null,y:jp,Y:Hp,Z:Xp,"%":fv},m={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Gp,e:Gp,f:Qp,H:Vp,I:$p,j:Wp,L:Zp,m:Jp,M:Kp,p:function(t){return i[+(t.getUTCHours()>=12)]},Q:sv,s:lv,S:tv,u:nv,U:ev,V:rv,w:iv,W:ov,x:null,X:null,y:av,Y:uv,Z:cv,"%":fv},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=p[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=_[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return N(t,n,e,r)},d:bp,e:bp,f:Ap,H:xp,I:xp,j:mp,L:Np,m:_p,M:wp,p:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.p=s[r[0].toLowerCase()],e+r[0].length):-1},Q:Sp,s:kp,S:Mp,u:lp,U:hp,V:dp,w:sp,W:pp,x:function(t,n,r){return N(t,e,n,r)},X:function(t,n,e){return N(t,r,n,e)},y:gp,Y:vp,Z:yp,"%":Tp};function w(t,n){return function(e){var r,i,o,a=[],u=-1,c=0,f=t.length;for(e instanceof Date||(e=new Date(+e));++u53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Jd(Kd(o.y))).getUTCDay(),r=i>4||0===i?Dd.ceil(r):Dd(r),r=Cd.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=n(Kd(o.y))).getDay(),r=i>4||0===i?fd.ceil(r):fd(r),r=od.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Jd(Kd(o.y)).getUTCDay():n(Kd(o.y)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Jd(o)):n(o)}}function N(t,n,e,r){for(var i,o,a=0,u=n.length,c=e.length;a=c)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in ep?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=w(e,b),b.X=w(r,b),b.c=w(n,b),m.x=w(e,m),m.X=w(r,m),m.c=w(n,m),{format:function(t){var n=w(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",Qd);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",m);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t,Jd);return n.toString=function(){return t},n}}}var np,ep={"-":"",_:" ",0:"0"},rp=/^\s*\d+/,ip=/^%/,op=/[\\^$*+?|[\]().{}]/g;function ap(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),e+r[0].length):-1}function yp(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function _p(t,n,e){var r=rp.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function bp(t,n,e){var r=rp.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function mp(t,n,e){var r=rp.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function xp(t,n,e){var r=rp.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function wp(t,n,e){var r=rp.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Mp(t,n,e){var r=rp.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Np(t,n,e){var r=rp.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Ap(t,n,e){var r=rp.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Tp(t,n,e){var r=ip.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Sp(t,n,e){var r=rp.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function kp(t,n,e){var r=rp.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function Ep(t,n){return ap(t.getDate(),n,2)}function Cp(t,n){return ap(t.getHours(),n,2)}function Pp(t,n){return ap(t.getHours()%12||12,n,2)}function zp(t,n){return ap(1+od.count(Nd(t),t),n,3)}function Rp(t,n){return ap(t.getMilliseconds(),n,3)}function Dp(t,n){return Rp(t,n)+"000"}function qp(t,n){return ap(t.getMonth()+1,n,2)}function Lp(t,n){return ap(t.getMinutes(),n,2)}function Up(t,n){return ap(t.getSeconds(),n,2)}function Op(t){var n=t.getDay();return 0===n?7:n}function Bp(t,n){return ap(cd.count(Nd(t),t),n,2)}function Yp(t,n){var e=t.getDay();return t=e>=4||0===e?hd(t):hd.ceil(t),ap(hd.count(Nd(t),t)+(4===Nd(t).getDay()),n,2)}function Fp(t){return t.getDay()}function Ip(t,n){return ap(fd.count(Nd(t),t),n,2)}function jp(t,n){return ap(t.getFullYear()%100,n,2)}function Hp(t,n){return ap(t.getFullYear()%1e4,n,4)}function Xp(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+ap(n/60|0,"0",2)+ap(n%60,"0",2)}function Gp(t,n){return ap(t.getUTCDate(),n,2)}function Vp(t,n){return ap(t.getUTCHours(),n,2)}function $p(t,n){return ap(t.getUTCHours()%12||12,n,2)}function Wp(t,n){return ap(1+Cd.count(Wd(t),t),n,3)}function Zp(t,n){return ap(t.getUTCMilliseconds(),n,3)}function Qp(t,n){return Zp(t,n)+"000"}function Jp(t,n){return ap(t.getUTCMonth()+1,n,2)}function Kp(t,n){return ap(t.getUTCMinutes(),n,2)}function tv(t,n){return ap(t.getUTCSeconds(),n,2)}function nv(t){var n=t.getUTCDay();return 0===n?7:n}function ev(t,n){return ap(Rd.count(Wd(t),t),n,2)}function rv(t,n){var e=t.getUTCDay();return t=e>=4||0===e?Ud(t):Ud.ceil(t),ap(Ud.count(Wd(t),t)+(4===Wd(t).getUTCDay()),n,2)}function iv(t){return t.getUTCDay()}function ov(t,n){return ap(Dd.count(Wd(t),t),n,2)}function av(t,n){return ap(t.getUTCFullYear()%100,n,2)}function uv(t,n){return ap(t.getUTCFullYear()%1e4,n,4)}function cv(){return"+0000"}function fv(){return"%"}function sv(t){return+t}function lv(t){return Math.floor(+t/1e3)}function hv(n){return np=tp(n),t.timeFormat=np.format,t.timeParse=np.parse,t.utcFormat=np.utcFormat,t.utcParse=np.utcParse,np}hv({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var dv=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");var pv=+new Date("2000-01-01T00:00:00.000Z")?function(t){var n=new Date(t);return isNaN(n)?null:n}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ"),vv=1e3,gv=60*vv,yv=60*gv,_v=24*yv,bv=7*_v,mv=30*_v,xv=365*_v;function wv(t){return new Date(t)}function Mv(t){return t instanceof Date?+t:+new Date(+t)}function Nv(t,n,r,i,o,a,u,c,f){var s=Sh(mh,mh),l=s.invert,h=s.domain,d=f(".%L"),p=f(":%S"),v=f("%I:%M"),g=f("%I %p"),y=f("%a %d"),_=f("%b %d"),b=f("%B"),m=f("%Y"),x=[[u,1,vv],[u,5,5*vv],[u,15,15*vv],[u,30,30*vv],[a,1,gv],[a,5,5*gv],[a,15,15*gv],[a,30,30*gv],[o,1,yv],[o,3,3*yv],[o,6,6*yv],[o,12,12*yv],[i,1,_v],[i,2,2*_v],[r,1,bv],[n,1,mv],[n,3,3*mv],[t,1,xv]];function M(e){return(u(e)=1?fy:t<=-1?-fy:Math.asin(t)}function hy(t){return t.innerRadius}function dy(t){return t.outerRadius}function py(t){return t.startAngle}function vy(t){return t.endAngle}function gy(t){return t&&t.padAngle}function yy(t,n,e,r,i,o,a){var u=t-e,c=n-r,f=(a?o:-o)/ay(u*u+c*c),s=f*c,l=-f*u,h=t+s,d=n+l,p=e+s,v=r+l,g=(h+p)/2,y=(d+v)/2,_=p-h,b=v-d,m=_*_+b*b,x=i-o,w=h*v-p*d,M=(b<0?-1:1)*ay(ry(0,x*x*m-w*w)),N=(w*b-_*M)/m,A=(-w*_-b*M)/m,T=(w*b+_*M)/m,S=(-w*_+b*M)/m,k=N-g,E=A-y,C=T-g,P=S-y;return k*k+E*E>C*C+P*P&&(N=T,A=S),{cx:N,cy:A,x01:-s,y01:-l,x11:N*(i/x-1),y11:A*(i/x-1)}}function _y(t){this._context=t}function by(t){return new _y(t)}function my(t){return t[0]}function xy(t){return t[1]}function wy(){var t=my,n=xy,e=Kg(!0),r=null,i=by,o=null;function a(a){var u,c,f,s=a.length,l=!1;for(null==r&&(o=i(f=Hi())),u=0;u<=s;++u)!(u=s;--l)u.point(g[l],y[l]);u.lineEnd(),u.areaEnd()}v&&(g[f]=+t(h,f,c),y[f]=+e(h,f,c),u.point(n?+n(h,f,c):g[f],r?+r(h,f,c):y[f]))}if(d)return u=null,d+""||null}function f(){return wy().defined(i).curve(a).context(o)}return c.x=function(e){return arguments.length?(t="function"==typeof e?e:Kg(+e),n=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:Kg(+n),c):t},c.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:Kg(+t),c):n},c.y=function(t){return arguments.length?(e="function"==typeof t?t:Kg(+t),r=null,c):e},c.y0=function(t){return arguments.length?(e="function"==typeof t?t:Kg(+t),c):e},c.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Kg(+t),c):r},c.lineX0=c.lineY0=function(){return f().x(t).y(e)},c.lineY1=function(){return f().x(t).y(r)},c.lineX1=function(){return f().x(n).y(e)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:Kg(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),c):o},c}function Ny(t,n){return nt?1:n>=t?0:NaN}function Ay(t){return t}_y.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var Ty=ky(by);function Sy(t){this._curve=t}function ky(t){function n(n){return new Sy(t(n))}return n._curve=t,n}function Ey(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(ky(t)):n()._curve},t}function Cy(){return Ey(wy().curve(Ty))}function Py(){var t=My().curve(Ty),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return Ey(e())},delete t.lineX0,t.lineEndAngle=function(){return Ey(r())},delete t.lineX1,t.lineInnerRadius=function(){return Ey(i())},delete t.lineY0,t.lineOuterRadius=function(){return Ey(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(ky(t)):n()._curve},t}function zy(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}Sy.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var Ry=Array.prototype.slice;function Dy(t){return t.source}function qy(t){return t.target}function Ly(t){var n=Dy,e=qy,r=my,i=xy,o=null;function a(){var a,u=Ry.call(arguments),c=n.apply(this,u),f=e.apply(this,u);if(o||(o=a=Hi()),t(o,+r.apply(this,(u[0]=c,u)),+i.apply(this,u),+r.apply(this,(u[0]=f,u)),+i.apply(this,u)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(n=t,a):n},a.target=function(t){return arguments.length?(e=t,a):e},a.x=function(t){return arguments.length?(r="function"==typeof t?t:Kg(+t),a):r},a.y=function(t){return arguments.length?(i="function"==typeof t?t:Kg(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function Uy(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function Oy(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function By(t,n,e,r,i){var o=zy(n,e),a=zy(n,e=(e+i)/2),u=zy(r,e),c=zy(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],u[0],u[1],c[0],c[1])}var Yy={draw:function(t,n){var e=Math.sqrt(n/cy);t.moveTo(e,0),t.arc(0,0,e,0,sy)}},Fy={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},Iy=Math.sqrt(1/3),jy=2*Iy,Hy={draw:function(t,n){var e=Math.sqrt(n/jy),r=e*Iy;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},Xy=Math.sin(cy/10)/Math.sin(7*cy/10),Gy=Math.sin(sy/10)*Xy,Vy=-Math.cos(sy/10)*Xy,$y={draw:function(t,n){var e=Math.sqrt(.8908130915292852*n),r=Gy*e,i=Vy*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var a=sy*o/5,u=Math.cos(a),c=Math.sin(a);t.lineTo(c*e,-u*e),t.lineTo(u*r-c*i,c*r+u*i)}t.closePath()}},Wy={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},Zy=Math.sqrt(3),Qy={draw:function(t,n){var e=-Math.sqrt(n/(3*Zy));t.moveTo(0,2*e),t.lineTo(-Zy*e,-e),t.lineTo(Zy*e,-e),t.closePath()}},Jy=Math.sqrt(3)/2,Ky=1/Math.sqrt(12),t_=3*(Ky/2+1),n_={draw:function(t,n){var e=Math.sqrt(n/t_),r=e/2,i=e*Ky,o=r,a=e*Ky+e,u=-o,c=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(u,c),t.lineTo(-.5*r-Jy*i,Jy*r+-.5*i),t.lineTo(-.5*o-Jy*a,Jy*o+-.5*a),t.lineTo(-.5*u-Jy*c,Jy*u+-.5*c),t.lineTo(-.5*r+Jy*i,-.5*i-Jy*r),t.lineTo(-.5*o+Jy*a,-.5*a-Jy*o),t.lineTo(-.5*u+Jy*c,-.5*c-Jy*u),t.closePath()}},e_=[Yy,Fy,Hy,Wy,$y,Qy,n_];function r_(){}function i_(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function o_(t){this._context=t}function a_(t){this._context=t}function u_(t){this._context=t}function c_(t,n){this._basis=new o_(t),this._beta=n}o_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:i_(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:i_(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},a_.prototype={areaStart:r_,areaEnd:r_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:i_(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},u_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:i_(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},c_.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,c=-1;++c<=e;)r=c/e,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*a),this._beta*n[c]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var f_=function t(n){function e(t){return 1===n?new o_(t):new c_(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function s_(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function l_(t,n){this._context=t,this._k=(1-n)/6}l_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:s_(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:s_(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var h_=function t(n){function e(t){return new l_(t,n)}return e.tension=function(n){return t(+n)},e}(0);function d_(t,n){this._context=t,this._k=(1-n)/6}d_.prototype={areaStart:r_,areaEnd:r_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:s_(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var p_=function t(n){function e(t){return new d_(t,n)}return e.tension=function(n){return t(+n)},e}(0);function v_(t,n){this._context=t,this._k=(1-n)/6}v_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:s_(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var g_=function t(n){function e(t){return new v_(t,n)}return e.tension=function(n){return t(+n)},e}(0);function y_(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>uy){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>uy){var f=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,s=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*f+t._x1*t._l23_2a-n*t._l12_2a)/s,a=(a*f+t._y1*t._l23_2a-e*t._l12_2a)/s}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function __(t,n){this._context=t,this._alpha=n}__.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:y_(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var b_=function t(n){function e(t){return n?new __(t,n):new l_(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function m_(t,n){this._context=t,this._alpha=n}m_.prototype={areaStart:r_,areaEnd:r_,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:y_(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var x_=function t(n){function e(t){return n?new m_(t,n):new d_(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function w_(t,n){this._context=t,this._alpha=n}w_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:y_(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var M_=function t(n){function e(t){return n?new w_(t,n):new v_(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function N_(t){this._context=t}function A_(t){return t<0?-1:1}function T_(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(A_(o)+A_(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function S_(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function k_(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*n,o-u,a-u*e,o,a)}function E_(t){this._context=t}function C_(t){this._context=new P_(t)}function P_(t){this._context=t}function z_(t){this._context=t}function R_(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n1)for(var e,r,i,o=1,a=t[n[0]],u=a.length;o=0;)e[n]=n;return e}function U_(t,n){return t[n]}function O_(t){var n=t.map(B_);return L_(t).sort(function(t,e){return n[t]-n[e]})}function B_(t){for(var n,e=-1,r=0,i=t.length,o=-1/0;++eo&&(o=n,r=e);return r}function Y_(t){var n=t.map(F_);return L_(t).sort(function(t,e){return n[t]-n[e]})}function F_(t){for(var n,e=0,r=-1,i=t.length;++r0)){if(o/=h,h<0){if(o0){if(o>l)return;o>s&&(s=o)}if(o=r-c,h||!(o<0)){if(o/=h,h<0){if(o>l)return;o>s&&(s=o)}else if(h>0){if(o0)){if(o/=d,d<0){if(o0){if(o>l)return;o>s&&(s=o)}if(o=i-f,d||!(o<0)){if(o/=d,d<0){if(o>l)return;o>s&&(s=o)}else if(d>0){if(o0||l<1)||(s>0&&(t[0]=[c+s*h,f+s*d]),l<1&&(t[1]=[c+l*h,f+l*d]),!0)}}}}}function tb(t,n,e,r,i){var o=t[1];if(o)return!0;var a,u,c=t[0],f=t.left,s=t.right,l=f[0],h=f[1],d=s[0],p=s[1],v=(l+d)/2,g=(h+p)/2;if(p===h){if(v=r)return;if(l>d){if(c){if(c[1]>=i)return}else c=[v,e];o=[v,i]}else{if(c){if(c[1]1)if(l>d){if(c){if(c[1]>=i)return}else c=[(e-u)/a,e];o=[(i-u)/a,i]}else{if(c){if(c[1]=r)return}else c=[n,a*n+u];o=[r,a*r+u]}else{if(c){if(c[0]=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}},X_.prototype={constructor:X_,insert:function(t,n){var e,r,i;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=W_(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(i=r.R)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.R&&(V_(this,e),e=(t=e).U),e.C=!1,r.C=!0,$_(this,r)):(i=r.L)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.L&&($_(this,e),e=(t=e).U),e.C=!1,r.C=!0,V_(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,i=t.U,o=t.L,a=t.R;if(e=o?a?W_(a):o:a,i?i.L===t?i.L=e:i.R=e:this._=e,o&&a?(r=e.C,e.C=t.C,e.L=o,o.U=e,e!==a?(i=e.U,e.U=t.U,t=e.R,i.L=t,e.R=a,a.U=e):(e.U=i,i=e,t=e.R)):(r=t.C,t=e),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((n=i.R).C&&(n.C=!1,i.C=!0,V_(this,i),n=i.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,$_(this,n),n=i.R),n.C=i.C,i.C=n.R.C=!1,V_(this,i),t=this._;break}}else if((n=i.L).C&&(n.C=!1,i.C=!0,$_(this,i),n=i.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,V_(this,n),n=i.L),n.C=i.C,i.C=n.L.C=!1,$_(this,i),t=this._;break}n.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var ib,ob=[];function ab(){G_(this),this.x=this.y=this.arc=this.site=this.cy=null}function ub(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var a=i[0],u=i[1],c=r[0]-a,f=r[1]-u,s=o[0]-a,l=o[1]-u,h=2*(c*l-f*s);if(!(h>=-wb)){var d=c*c+f*f,p=s*s+l*l,v=(l*d-f*p)/h,g=(c*p-s*d)/h,y=ob.pop()||new ab;y.arc=t,y.site=i,y.x=v+a,y.y=(y.cy=g+u)+Math.sqrt(v*v+g*g),t.circle=y;for(var _=null,b=bb._;b;)if(y.yxb)u=u.L;else{if(!((i=o-gb(u,a))>xb)){r>-xb?(n=u.P,e=u):i>-xb?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}!function(t){_b[t.index]={site:t,halfedges:[]}}(t);var c=lb(t);if(yb.insert(n,c),n||e){if(n===e)return cb(n),e=lb(n.site),yb.insert(c,e),c.edge=e.edge=Z_(n.site,c.site),ub(n),void ub(e);if(e){cb(n),cb(e);var f=n.site,s=f[0],l=f[1],h=t[0]-s,d=t[1]-l,p=e.site,v=p[0]-s,g=p[1]-l,y=2*(h*g-d*v),_=h*h+d*d,b=v*v+g*g,m=[(g*_-d*b)/y+s,(h*b-v*_)/y+l];J_(e.edge,f,p,m),c.edge=Z_(f,t,null,m),e.edge=Z_(t,p,null,m),ub(n),ub(e)}else c.edge=Z_(n.site,c.site)}}function vb(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var a=t.P;if(!a)return-1/0;var u=(e=a.site)[0],c=e[1],f=c-n;if(!f)return u;var s=u-r,l=1/o-1/f,h=s/f;return l?(-h+Math.sqrt(h*h-2*l*(s*s/(-2*f)-c+f/2+i-o/2)))/l+r:(r+u)/2}function gb(t,n){var e=t.N;if(e)return vb(e,n);var r=t.site;return r[1]===n?r[0]:1/0}var yb,_b,bb,mb,xb=1e-6,wb=1e-12;function Mb(t,n){return n[1]-t[1]||n[0]-t[0]}function Nb(t,n){var e,r,i,o=t.sort(Mb).pop();for(mb=[],_b=new Array(t.length),yb=new X_,bb=new X_;;)if(i=ib,o&&(!i||o[1]xb||Math.abs(i[0][1]-i[1][1])>xb)||delete mb[o]}(a,u,c,f),function(t,n,e,r){var i,o,a,u,c,f,s,l,h,d,p,v,g=_b.length,y=!0;for(i=0;ixb||Math.abs(v-h)>xb)&&(c.splice(u,0,mb.push(Q_(a,d,Math.abs(p-t)xb?[t,Math.abs(l-t)xb?[Math.abs(h-r)xb?[e,Math.abs(l-e)xb?[Math.abs(h-n)=u)return null;var c=t-i.site[0],f=n-i.site[1],s=c*c+f*f;do{i=o.cells[r=a],a=null,i.halfedges.forEach(function(e){var r=o.edges[e],u=r.left;if(u!==i.site&&u||(u=r.right)){var c=t-u[0],f=n-u[1],l=c*c+f*f;lr?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}Eb.prototype=Sb.prototype,t.version="5.9.2",t.bisect=i,t.bisectRight=i,t.bisectLeft=o,t.ascending=n,t.bisector=e,t.cross=function(t,n,e){var r,i,o,u,c=t.length,f=n.length,s=new Array(c*f);for(null==e&&(e=a),r=o=0;rt?1:n>=t?0:NaN},t.deviation=f,t.extent=s,t.histogram=function(){var t=v,n=s,e=M;function r(r){var o,a,u=r.length,c=new Array(u);for(o=0;ol;)h.pop(),--d;var p,v=new Array(d+1);for(o=0;o<=d;++o)(p=v[o]=[]).x0=o>0?h[o-1]:s,p.x1=o=r.length)return null!=t&&e.sort(t),null!=n?n(e):e;for(var c,f,s,l=-1,h=e.length,d=r[i++],p=Qi(),v=a();++lr.length)return e;var a,u=i[o-1];return null!=n&&o>=r.length?a=e.entries():(a=[],e.each(function(n,e){a.push({key:e,values:t(n,o)})})),null!=u?a.sort(function(t,n){return u(t.key,n.key)}):a}(o(t,0,to,no),0)},key:function(t){return r.push(t),e},sortKeys:function(t){return i[r.length-1]=t,e},sortValues:function(n){return t=n,e},rollup:function(t){return n=t,e}}},t.set=io,t.map=Qi,t.keys=function(t){var n=[];for(var e in t)n.push(e);return n},t.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},t.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},t.color=hn,t.rgb=gn,t.hsl=mn,t.lab=Rn,t.hcl=Yn,t.lch=function(t,n,e,r){return 1===arguments.length?Bn(t):new Fn(e,n,t,null==r?1:r)},t.gray=function(t,n){return new Dn(t,0,0,null==n?1:n)},t.cubehelix=Zn,t.contours=po,t.contourDensity=function(){var t=yo,n=_o,e=bo,r=960,i=500,o=20,a=2,u=3*o,c=r+2*u>>a,f=i+2*u>>a,s=uo(20);function l(r){var i=new Float32Array(c*f),l=new Float32Array(c*f);r.forEach(function(r,o,s){var l=+t(r,o,s)+u>>a,h=+n(r,o,s)+u>>a,d=+e(r,o,s);l>=0&&l=0&&h>a),go({width:c,height:f,data:l},{width:c,height:f,data:i},o>>a),vo({width:c,height:f,data:i},{width:c,height:f,data:l},o>>a),go({width:c,height:f,data:l},{width:c,height:f,data:i},o>>a),vo({width:c,height:f,data:i},{width:c,height:f,data:l},o>>a),go({width:c,height:f,data:l},{width:c,height:f,data:i},o>>a);var d=s(i);if(!Array.isArray(d)){var p=A(i);d=w(0,p,d),(d=g(0,Math.floor(p/d)*d,d)).shift()}return po().thresholds(d).size([c,f])(i).map(h)}function h(t){return t.value*=Math.pow(2,-2*a),t.coordinates.forEach(d),t}function d(t){t.forEach(p)}function p(t){t.forEach(v)}function v(t){t[0]=t[0]*Math.pow(2,a)-u,t[1]=t[1]*Math.pow(2,a)-u}function y(){return c=r+2*(u=3*o)>>a,f=i+2*u>>a,l}return l.x=function(n){return arguments.length?(t="function"==typeof n?n:uo(+n),l):t},l.y=function(t){return arguments.length?(n="function"==typeof t?t:uo(+t),l):n},l.weight=function(t){return arguments.length?(e="function"==typeof t?t:uo(+t),l):e},l.size=function(t){if(!arguments.length)return[r,i];var n=Math.ceil(t[0]),e=Math.ceil(t[1]);if(!(n>=0||n>=0))throw new Error("invalid size");return r=n,i=e,y()},l.cellSize=function(t){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),y()},l.thresholds=function(t){return arguments.length?(s="function"==typeof t?t:Array.isArray(t)?uo(oo.call(t)):uo(t),l):s},l.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=Math.round((Math.sqrt(4*t*t+1)-1)/2),y()},l},t.dispatch=I,t.drag=function(){var n,e,r,i,o=Gt,a=Vt,u=$t,c=Wt,f={},s=I("start","drag","end"),l=0,h=0;function d(t){t.on("mousedown.drag",p).filter(c).on("touchstart.drag",y).on("touchmove.drag",_).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(){if(!i&&o.apply(this,arguments)){var u=m("mouse",a.apply(this,arguments),Ot,this,arguments);u&&(zt(t.event.view).on("mousemove.drag",v,!0).on("mouseup.drag",g,!0),It(t.event.view),Yt(),r=!1,n=t.event.clientX,e=t.event.clientY,u("start"))}}function v(){if(Ft(),!r){var i=t.event.clientX-n,o=t.event.clientY-e;r=i*i+o*o>h}f.mouse("drag")}function g(){zt(t.event.view).on("mousemove.drag mouseup.drag",null),jt(t.event.view,r),Ft(),f.mouse("end")}function y(){if(o.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=a.apply(this,arguments),u=r.length;for(n=0;nc+d||if+d||ou.index){var p=c-a.x-a.vx,v=f-a.y-a.vy,g=p*p+v*v;gt.r&&(t.r=t[n].r)}function u(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r=a)){(t.data!==n||t.next)&&(0===s&&(d+=(s=na())*s),0===l&&(d+=(l=na())*l),d1?(null==e?u.remove(t):u.set(t,d(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,c,f=0,s=t.length;for(null==r?r=1/0:r*=r,f=0;f1?(f.on(t,e),n):f.on(t)}}},t.forceX=function(t){var n,e,r,i=ta(.1);function o(t){for(var i,o=0,a=n.length;opc(r[0],r[1])&&(r[1]=i[1]),pc(i[0],r[1])>pc(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(u=pc(r[1],i[0]))>a&&(a=u,Ru=i[0],qu=r[1])}return Fu=Iu=null,Ru===1/0||Du===1/0?[[NaN,NaN],[NaN,NaN]]:[[Ru,Du],[qu,Lu]]},t.geoCentroid=function(t){ju=Hu=Xu=Gu=Vu=$u=Wu=Zu=Qu=Ju=Ku=0,du(t,yc);var n=Qu,e=Ju,r=Ku,i=n*n+e*e+r*r;return i=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?c:a).invert(t)},s.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),c.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=al,t.geoRotation=qc,t.geoStream=du,t.geoTransform=function(t){return{stream:xs(t)}},t.cluster=function(){var t=ul,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter(function(n){var e=n.children;e?(n.x=function(t){return t.reduce(cl,0)/t.length}(e),n.y=function(t){return 1+t.reduce(fl,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)});var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),c=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),f=u.x-t(u,c)/2,s=c.x+t(c,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-f)/(s-f)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.hierarchy=ll,t.pack=function(){var t=null,n=1,e=1,r=Pl;function i(i){return i.x=n/2,i.y=e/2,t?i.eachBefore(Dl(t)).eachAfter(ql(r,.5)).eachBefore(Ll(1)):i.eachBefore(Dl(Rl)).eachAfter(ql(Pl,1)).eachAfter(ql(r,i.r/Math.min(n,e))).eachBefore(Ll(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=null==(e=n)?null:Cl(e),i):t;var e},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:zl(+t),i):r},i},t.packSiblings=function(t){return El(t),t},t.packEnclose=yl,t.partition=function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&Ol(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a0)throw new Error("cycle");return o}return e.id=function(n){return arguments.length?(t=Cl(n),e):t},e.parentId=function(t){return arguments.length?(n=Cl(t),e):n},e},t.tree=function(){var t=Hl,n=1,e=1,r=null;function i(i){var c=function(t){for(var n,e,r,i,o,a=new Wl(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new Wl(r[i],i)),e.parent=n;return(a.parent=new Wl(null,0)).children=[a],a}(i);if(c.eachAfter(o),c.parent.m=-c.z,c.eachBefore(a),r)i.eachBefore(u);else{var f=i,s=i,l=i;i.eachBefore(function(t){t.xs.x&&(s=t),t.depth>l.depth&&(l=t)});var h=f===s?1:t(f,s)/2,d=h-f.x,p=n/(s.x+h+d),v=e/(l.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*v})}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,c=o.parent.children[0],f=o.m,s=a.m,l=u.m,h=c.m;u=Gl(u),o=Xl(o),u&&o;)c=Xl(c),(a=Gl(a)).a=n,(i=u.z+l-o.z-f+t(u._,o._))>0&&(Vl($l(u,n,r),n,i),f+=i,s+=i),l+=u.m,f+=o.m,h+=c.m,s+=a.m;u&&!Gl(a)&&(a.t=u,a.m+=l-s),o&&!Xl(c)&&(c.t=o,c.m+=f-h,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},t.treemap=function(){var t=Kl,n=!1,e=1,r=1,i=[0],o=Pl,a=Pl,u=Pl,c=Pl,f=Pl;function s(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(l),i=[0],n&&t.eachBefore(Ul),t}function l(n){var e=i[n.depth],r=n.x0+e,s=n.y0+e,l=n.x1-e,h=n.y1-e;l=e-1){var s=u[n];return s.x0=i,s.y0=o,s.x1=a,void(s.y1=c)}for(var l=f[n],h=r/2+l,d=n+1,p=e-1;d>>1;f[v]c-o){var _=(i*y+a*g)/r;t(n,d,g,i,o,_,c),t(d,e,y,_,o,a,c)}else{var b=(o*y+c*g)/r;t(n,d,g,i,o,a,b),t(d,e,y,i,b,a,c)}}(0,c,t.value,n,e,r,i)},t.treemapDice=Ol,t.treemapSlice=Zl,t.treemapSliceDice=function(t,n,e,r,i){(1&t.depth?Zl:Ol)(t,n,e,r,i)},t.treemapSquarify=Kl,t.treemapResquarify=th,t.interpolate=ye,t.interpolateArray=se,t.interpolateBasis=Kn,t.interpolateBasisClosed=te,t.interpolateDate=le,t.interpolateDiscrete=function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},t.interpolateHue=function(t,n){var e=re(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},t.interpolateNumber=he,t.interpolateObject=de,t.interpolateRound=_e,t.interpolateString=ge,t.interpolateTransformCss=Se,t.interpolateTransformSvg=ke,t.interpolateZoom=De,t.interpolateRgb=ae,t.interpolateRgbBasis=ce,t.interpolateRgbBasisClosed=fe,t.interpolateHsl=Le,t.interpolateHslLong=Ue,t.interpolateLab=function(t,n){var e=oe((t=Rn(t)).l,(n=Rn(n)).l),r=oe(t.a,n.a),i=oe(t.b,n.b),o=oe(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},t.interpolateHcl=Be,t.interpolateHclLong=Ye,t.interpolateCubehelix=Ie,t.interpolateCubehelixLong=je,t.piecewise=function(t,n){for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e=0;--n)f.push(t[r[o[n]][2]]);for(n=+u;nu!=f>u&&a<(c-e)*(u-r)/(f-r)+e&&(s=!s),c=e,f=r;return s},t.polygonLength=function(t){for(var n,e,r=-1,i=t.length,o=t[i-1],a=o[0],u=o[1],c=0;++r0?a[n-1]:r[0],n=o?[a[o-1],r]:[a[n-1],a[n]]},c.unknown=function(t){return arguments.length?(n=t,c):c},c.thresholds=function(){return a.slice()},c.copy=function(){return t().domain([e,r]).range(u).unknown(n)},sh.apply(Eh(c),arguments)},t.scaleThreshold=function t(){var n,e=[.5],r=[0,1],o=1;function a(t){return t<=t?r[i(e,t,0,o)]:n}return a.domain=function(t){return arguments.length?(e=ph.call(t),o=Math.min(e.length,r.length-1),a):e.slice()},a.range=function(t){return arguments.length?(r=ph.call(t),o=Math.min(e.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},a.unknown=function(t){return arguments.length?(n=t,a):n},a.copy=function(){return t().domain(e).range(r).unknown(n)},sh.apply(a,arguments)},t.scaleTime=function(){return sh.apply(Nv(Nd,wd,cd,od,rd,nd,Kh,Wh,t.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},t.scaleUtc=function(){return sh.apply(Nv(Wd,Vd,Rd,Cd,kd,Td,Kh,Wh,t.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},t.scaleSequential=function t(){var n=Eh(Av()(mh));return n.copy=function(){return Tv(n,t())},lh.apply(n,arguments)},t.scaleSequentialLog=function t(){var n=Uh(Av()).domain([1,10]);return n.copy=function(){return Tv(n,t()).base(n.base())},lh.apply(n,arguments)},t.scaleSequentialPow=Sv,t.scaleSequentialSqrt=function(){return Sv.apply(null,arguments).exponent(.5)},t.scaleSequentialSymlog=function t(){var n=Yh(Av());return n.copy=function(){return Tv(n,t()).constant(n.constant())},lh.apply(n,arguments)},t.scaleSequentialQuantile=function t(){var e=[],r=mh;function o(t){if(!isNaN(t=+t))return r((i(e,t)-1)/(e.length-1))}return o.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var r,i=0,a=t.length;i1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return Hg.h=360*t-100,Hg.s=1.5-1.5*n,Hg.l=.8-.9*n,Hg+""},t.interpolateWarm=Ig,t.interpolateCool=jg,t.interpolateSinebow=function(t){var n;return t=(.5-t)*Math.PI,Xg.r=255*(n=Math.sin(t))*n,Xg.g=255*(n=Math.sin(t+Gg))*n,Xg.b=255*(n=Math.sin(t+Vg))*n,Xg+""},t.interpolateViridis=Wg,t.interpolateMagma=Zg,t.interpolateInferno=Qg,t.interpolatePlasma=Jg,t.create=function(t){return zt(W(t).call(document.documentElement))},t.creator=W,t.local=Dt,t.matcher=tt,t.mouse=Ot,t.namespace=$,t.namespaces=V,t.clientPoint=Ut,t.select=zt,t.selectAll=function(t){return"string"==typeof t?new Ct([document.querySelectorAll(t)],[document.documentElement]):new Ct([null==t?[]:t],Et)},t.selection=Pt,t.selector=Q,t.selectorAll=K,t.style=ct,t.touch=Bt,t.touches=function(t,n){null==n&&(n=Lt().touches);for(var e=0,r=n?n.length:0,i=new Array(r);ed;if(u||(u=c=Hi()),huy)if(v>sy-uy)u.moveTo(h*ey(d),h*oy(d)),u.arc(0,0,h,d,p,!g),l>uy&&(u.moveTo(l*ey(p),l*oy(p)),u.arc(0,0,l,p,d,g));else{var y,_,b=d,m=p,x=d,w=p,M=v,N=v,A=a.apply(this,arguments)/2,T=A>uy&&(r?+r.apply(this,arguments):ay(l*l+h*h)),S=iy(ty(h-l)/2,+e.apply(this,arguments)),k=S,E=S;if(T>uy){var C=ly(T/l*oy(A)),P=ly(T/h*oy(A));(M-=2*C)>uy?(x+=C*=g?1:-1,w-=C):(M=0,x=w=(d+p)/2),(N-=2*P)>uy?(b+=P*=g?1:-1,m-=P):(N=0,b=m=(d+p)/2)}var z=h*ey(b),R=h*oy(b),D=l*ey(w),q=l*oy(w);if(S>uy){var L,U=h*ey(m),O=h*oy(m),B=l*ey(x),Y=l*oy(x);if(v1?0:s<-1?cy:Math.acos(s))/2),G=ay(L[0]*L[0]+L[1]*L[1]);k=iy(S,(l-G)/(X-1)),E=iy(S,(h-G)/(X+1))}}N>uy?E>uy?(y=yy(B,Y,z,R,h,E,g),_=yy(U,O,D,q,h,E,g),u.moveTo(y.cx+y.x01,y.cy+y.y01),Euy&&M>uy?k>uy?(y=yy(D,q,U,O,l,-k,g),_=yy(z,R,B,Y,l,-k,g),u.lineTo(y.cx+y.x01,y.cy+y.y01),k0&&(d+=l);for(null!=n?p.sort(function(t,e){return n(v[t],v[e])}):null!=e&&p.sort(function(t,n){return e(a[t],a[n])}),u=0,f=d?(y-h*b)/d:0;u0?l*f:0)+b,v[c]={data:a[c],index:u,value:l,startAngle:g,endAngle:s,padAngle:_};return v}return a.value=function(n){return arguments.length?(t="function"==typeof n?n:Kg(+n),a):t},a.sortValues=function(t){return arguments.length?(n=t,e=null,a):n},a.sort=function(t){return arguments.length?(e=t,n=null,a):e},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Kg(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Kg(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:Kg(+t),a):o},a},t.areaRadial=Py,t.radialArea=Py,t.lineRadial=Cy,t.radialLine=Cy,t.pointRadial=zy,t.linkHorizontal=function(){return Ly(Uy)},t.linkVertical=function(){return Ly(Oy)},t.linkRadial=function(){var t=Ly(By);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t},t.symbol=function(){var t=Kg(Yy),n=Kg(64),e=null;function r(){var r;if(e||(e=r=Hi()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return r.type=function(n){return arguments.length?(t="function"==typeof n?n:Kg(n),r):t},r.size=function(t){return arguments.length?(n="function"==typeof t?t:Kg(+t),r):n},r.context=function(t){return arguments.length?(e=null==t?null:t,r):e},r},t.symbols=e_,t.symbolCircle=Yy,t.symbolCross=Fy,t.symbolDiamond=Hy,t.symbolSquare=Wy,t.symbolStar=$y,t.symbolTriangle=Qy,t.symbolWye=n_,t.curveBasisClosed=function(t){return new a_(t)},t.curveBasisOpen=function(t){return new u_(t)},t.curveBasis=function(t){return new o_(t)},t.curveBundle=f_,t.curveCardinalClosed=p_,t.curveCardinalOpen=g_,t.curveCardinal=h_,t.curveCatmullRomClosed=x_,t.curveCatmullRomOpen=M_,t.curveCatmullRom=b_,t.curveLinearClosed=function(t){return new N_(t)},t.curveLinear=by,t.curveMonotoneX=function(t){return new E_(t)},t.curveMonotoneY=function(t){return new C_(t)},t.curveNatural=function(t){return new z_(t)},t.curveStep=function(t){return new D_(t,.5)},t.curveStepAfter=function(t){return new D_(t,1)},t.curveStepBefore=function(t){return new D_(t,0)},t.stack=function(){var t=Kg([]),n=L_,e=q_,r=U_;function i(i){var o,a,u=t.apply(this,arguments),c=i.length,f=u.length,s=new Array(f);for(o=0;o0){for(var e,r,i,o=0,a=t[0].length;o1)for(var e,r,i,o,a,u,c=0,f=t[n[0]].length;c=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):r[0]=o},t.stackOffsetNone=q_,t.stackOffsetSilhouette=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;adr&&e.name===n)return new Er([[t]],fi,n,+r);return null},t.interrupt=Mr,t.voronoi=function(){var t=j_,n=H_,e=null;function r(r){return new Nb(r.map(function(e,i){var o=[Math.round(t(e,i,r)/xb)*xb,Math.round(n(e,i,r)/xb)*xb];return o.index=i,o.data=e,o}),e)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(n){return arguments.length?(t="function"==typeof n?n:I_(+n),r):t},r.y=function(t){return arguments.length?(n="function"==typeof t?t:I_(+t),r):n},r.extent=function(t){return arguments.length?(e=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):e&&[[e[0][0],e[0][1]],[e[1][0],e[1][1]]]},r.size=function(t){return arguments.length?(e=null==t?null:[[0,0],[+t[0],+t[1]]],r):e&&[e[1][0]-e[0][0],e[1][1]-e[0][1]]},r},t.zoom=function(){var n,e,r=zb,i=Rb,o=Ub,a=qb,u=Lb,c=[0,1/0],f=[[-1/0,-1/0],[1/0,1/0]],s=250,l=De,h=[],d=I("start","zoom","end"),p=500,v=150,g=0;function y(t){t.property("__zoom",Db).on("wheel.zoom",N).on("mousedown.zoom",A).on("dblclick.zoom",T).filter(u).on("touchstart.zoom",S).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,n){return(n=Math.max(c[0],Math.min(c[1],n)))===t.k?t:new Sb(n,t.x,t.y)}function b(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new Sb(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function x(t,n,e){t.on("start.zoom",function(){w(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).end()}).tween("zoom",function(){var t=arguments,r=w(this,t),o=i.apply(this,t),a=e||m(o),u=Math.max(o[1][0]-o[0][0],o[1][1]-o[0][1]),c=this.__zoom,f="function"==typeof n?n.apply(this,t):n,s=l(c.invert(a).concat(u/c.k),f.invert(a).concat(u/f.k));return function(t){if(1===t)t=f;else{var n=s(t),e=u/n[2];t=new Sb(e,a[0]-n[0]*e,a[1]-n[1]*e)}r.zoom(null,t)}})}function w(t,n){for(var e,r=0,i=h.length;rg}n.zoom("mouse",o(b(n.that.__zoom,n.mouse[0]=Ot(n.that),n.mouse[1]),n.extent,f))},!0).on("mouseup.zoom",function(){i.on("mousemove.zoom mouseup.zoom",null),jt(t.event.view,n.moved),Pb(),n.end()},!0),a=Ot(this),u=t.event.clientX,c=t.event.clientY;It(t.event.view),Cb(),n.mouse=[a,this.__zoom.invert(a)],Mr(this),n.start()}}function T(){if(r.apply(this,arguments)){var n=this.__zoom,e=Ot(this),a=n.invert(e),u=n.k*(t.event.shiftKey?.5:2),c=o(b(_(n,u),e,a),i.apply(this,arguments),f);Pb(),s>0?zt(this).transition().duration(s).call(x,c,e):zt(this).call(y.transform,c)}}function S(){if(r.apply(this,arguments)){var e,i,o,a,u=w(this,arguments),c=t.event.changedTouches,f=c.length;for(Cb(),i=0;i0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};M(t);var n=[];function r(e){n[e]=null}return Number.isInteger(t.mtime)||(t.mtime=++u),t.classHierarchy=["vtkObject"],e.isDeleted=function(){return!!t.deleted},e.modified=function(r){t.deleted?g("instance deleted - cannot call any method"):r&&r0&&void 0!==arguments[0]?arguments[0]:0;return t.classHierarchy[t.classHierarchy.length-1-e]},e.set=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1;return Object.keys(n).forEach(function(o){var u=a?null:e["set".concat(y(o))];u&&Array.isArray(n[o])&&u.length>1?i=u.apply(void 0,s(n[o]))||i:u?i=u(n[o])||i:(-1!==["mtime"].indexOf(o)||r||m("Warning: Set value to model directly ".concat(o,", ").concat(n[o])),t[o]=n[o],i=!0)}),i},e.get=function(){for(var e=arguments.length,n=new Array(e),r=0;r1&&void 0!==arguments[1]&&arguments[1];if(n.getClassName()!==e.getClassName())throw new Error("Cannot ShallowCopy ".concat(n.getClassName()," into ").concat(e.getClassName()));var a=n.get(),i=Object.keys(t).sort();Object.keys(a).sort().forEach(function(e){var n=i.indexOf(e);-1===n?r&&p("add ".concat(e," in shallowCopy")):i.splice(n,1),t[e]=a[e]}),i.length&&r&&p("Untouched keys: ".concat(i.join(", "))),e.modified()},e}function D(e,t,n){n.forEach(function(n){"object"===o(n)?e["get".concat(y(n.name))]=function(){return t[n.name]}:e["get".concat(y(n))]=function(){return t[n]}})}var T={enum:function(e,t,n){return function(r){if("string"==typeof r){if(void 0!==n.enum[r])return t[n.name]!==n.enum[r]&&(t[n.name]=n.enum[r],e.modified(),!0);throw g("Set Enum with invalid argument ".concat(n,", ").concat(r)),new RangeError("Set Enum with invalid string argument")}if("number"==typeof r){if(t[n.name]!==r){if(-1!==Object.keys(n.enum).map(function(e){return n.enum[e]}).indexOf(r))return t[n.name]=r,e.modified(),!0;throw g("Set Enum outside numeric range ".concat(n,", ").concat(r)),new RangeError("Set Enum outside numeric range")}return!1}throw g("Set Enum with invalid argument (String/Number) ".concat(n,", ").concat(r)),new TypeError("Set Enum with invalid argument (String/Number)")}}};function C(e){if("object"===o(e)){var t=T[e.type];if(t)return function(n,r){return t(n,r,e)};throw g("No setter for field ".concat(e)),new TypeError("No setter for field")}return function(t,n){return function(r){return n.deleted?(g("instance deleted - cannot call any method"),!1):n[e]!==r&&(n[e]=r,t.modified(),!0)}}}function I(e,t,n){n.forEach(function(n){"object"===o(n)?e["set".concat(y(n.name))]=C(n)(e,t):e["set".concat(y(n))]=C(n)(e,t)})}function x(e,t,n){D(e,t,n),I(e,t,n)}function S(e,t,n){n.forEach(function(n){e["get".concat(y(n))]=function(){return[].concat(t[n])},e["get".concat(y(n),"ByReference")]=function(){return t[n]}})}function N(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;n.forEach(function(n){e["set".concat(y(n))]=function(){if(t.deleted)return g("instance deleted - cannot call any method"),!1;for(var i=arguments.length,o=new Array(i),s=0;s1&&void 0!==arguments[1]?arguments[1]:0;if(!e.apply)return console.error("Invalid callback for event ".concat(n)),null;if(t.deleted)return g("instance deleted - cannot call any method"),null;var i=o++;return r.push([i,e,a]),r.sort(function(e,t){return t[2]-e[2]}),function(e){return Object.freeze({unsubscribe:function(){s(e)}})}(i)},e.delete=function(){a(),r.forEach(function(e){return s(i(e,1)[0])})}}function L(e,t){var n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n={};return e(n,{},t),Object.freeze(n)};return t&&r.a.register(t,n),n}function P(e){return e&&e.isA&&e.isA("vtkObject")}function k(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.keystore=Object.assign(t.keystore||{},n),e.setKey=function(e,n){t.keystore[e]=n},e.getKey=function(e,n){return t.keystore[e]},e.getAllKeys=function(e,n){return Object.keys(t.keystore)},e.deleteKey=function(e,n){return delete t.keystore[e]},e.clearKeystore=function(){return e.getAllKeys().forEach(function(e){return delete t.keystore[e]})}}var R=1,j="__root__";var B=10,z=40,_=800;t.a={algo:function(e,t,n,a){function i(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t.deleted?g("instance deleted - cannot call any method"):r>=t.numberOfInputs?g("algorithm ".concat(e.getClassName()," only has ").concat(t.numberOfInputs," input ports. To add more input ports, use addInputData()")):(t.inputData[r]!==n||t.inputConnection[r])&&(t.inputData[r]=n,t.inputConnection[r]=null,e.modified&&e.modified())}function o(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t.deleted)g("instance deleted - cannot call any method");else{if(r>=t.numberOfInputs){var a="algorithm ".concat(e.getClassName()," only has ");return a+="".concat(t.numberOfInputs),void g(a+=" input ports. To add more input ports, use addInputConnection()")}t.inputData[r]=null,t.inputConnection[r]=n}}function s(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.deleted?(g("instance deleted - cannot call any method"),null):(e.shouldUpdate()&&e.update(),t.output[n])}if(t.inputData?t.inputData=t.inputData.map(r.a):t.inputData=[],t.inputConnection?t.inputConnection=t.inputConnection.map(r.a):t.inputConnection=[],t.output?t.output=t.output.map(r.a):t.output=[],t.inputArrayToProcess?t.inputArrayToProcess=t.inputArrayToProcess.map(r.a):t.inputArrayToProcess=[],t.numberOfInputs=n,e.shouldUpdate=function(){for(var n=e.getMTime(),r=a,i=1/0;r--;){if(!t.output[r])return!0;var o=t.output[r].getMTime();if(oi)return!0;return!1},t.numberOfInputs){for(var u=t.numberOfInputs;u--;)t.inputData.push(null),t.inputConnection.push(null);e.setInputData=i,e.setInputConnection=o,e.addInputData=function(e){t.deleted?g("instance deleted - cannot call any method"):(t.numberOfInputs++,i(e,t.numberOfInputs-1))},e.addInputConnection=function(e){t.deleted?g("instance deleted - cannot call any method"):(t.numberOfInputs++,o(e,t.numberOfInputs-1))},e.getInputData=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]&&(t.inputData[e]=t.inputConnection[e]()),t.inputData[e]},e.getInputConnection=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t.inputConnection[e]}}a&&(e.getOutputData=s,e.getOutputPort=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=function(){return s(t)};return n.filter=e,n}),e.update=function(){var n=[];if(t.numberOfInputs)for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:"Scalars";t.inputArrayToProcess.length1&&void 0!==arguments[1]?arguments[1]:2,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=["TB","GB","MB","KB"],a=Number(e),i="B";a>n;)a/=n,i=r.pop();return"".concat(a.toFixed(t)," ").concat(i)},formatNumbersWithThousandSeparator:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",n=[],r=e;r>1e3;)n.push("000".concat(r%1e3).slice(-3)),r=Math.floor(r/1e3);return r>0&&n.push(r),n.reverse(),n.join(t)},get:D,getArray:S,getCurrentGlobalMTime:function(){return u},getStateArrayMapFunc:A,isVtkObject:P,keystore:k,newInstance:L,normalizeWheel:function(e){var t=0,n=0,r=0,a=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=t*B,a=n*B,"deltaY"in e&&(a=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||a)&&e.deltaMode&&(1===e.deltaMode?(r*=z,a*=z):(r*=_,a*=_)),r&&!t&&(t=r<1?-1:1),a&&!n&&(n=a<1?-1:1),{spinX:t,spinY:n,pixelX:r,pixelY:a}},obj:w,proxy:function(e,t){k(e,t);var n=e.delete;t.proxyId="".concat(R++),t.ui=JSON.parse(JSON.stringify(t.ui||[])),D(e,t,["proxyId","proxyGroup","proxyName"]),x(e,t,["proxyManager"]);var r={},i={};function o(e,t){i[t]||(i[t]=[]);for(var n=i[t],a=0;a0&&void 0!==arguments[0]?arguments[0]:j,r=[],a=t.proxyId,o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j;return i[e]}(n)||[],u=0;u1&&void 0!==arguments[1]&&arguments[1];if(t.propertyLinkMap[e])return t.propertyLinkMap[e];var r=null,i=[],o=0,s=!1;function u(n){var u=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(s)return null;var l=[],c=null;for(o=i.length;o--;){var d=i[o];d.instance===n?c=d:l.push(d)}if(!c)return null;var f=c.instance["get".concat(y(c.propertyName))]();if(f!==r||u){for(r=f,s=!0;l.length;){var p=l.pop();p.instance.set(a({},p.propertyName,r))}s=!1}return t.propertyLinkMap[e].persistent&&(t.propertyLinkMap[e].value=f),f}function l(e,t){var n=[];for(o=i.length;o--;){var r=i[o];r.instance!==e||r.propertyName!==t&&void 0!==t||(r.subscription.unsubscribe(),n.push(o))}for(;n.length;)i.splice(n.pop(),1)}var c={bind:function(n,r){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=n.onModified(u),c=i[0];return i.push({instance:n,propertyName:r,subscription:s}),o&&(t.propertyLinkMap[e].persistent&&void 0!==t.propertyLinkMap[e].value?n.set(a({},r,t.propertyLinkMap[e].value)):c&&u(c.instance,!0)),{unsubscribe:function(){return l(n,r)}}},unbind:l,unsubscribe:function(){for(;i.length;)i.pop().subscription.unsubscribe()},persistent:n};return t.propertyLinkMap[e]=c,c},e.listPropertyNames=function(){return s().map(function(e){return e.name})},e.getPropertyByName=function(e){return s().find(function(t){return t.name===e})},e.getPropertyDomainByName=function(e){return r[e].domain},e.getProxySection=function(){return{id:t.proxyId,name:t.proxyGroup,ui:t.ui,properties:s()}},e.delete=function(){for(var r=Object.keys(t.propertyLinkMap),a=r.length;a--;)t.propertyLinkMap[r[a]].unsubscribe();Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks),n()},b(function(){if(t.links)for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};t.this=e;for(var a=Object.keys(r),i=a.length,o=function(){var o=a[i];t[o]=r[o];var s=n[o];e["set".concat(y(o))]=function(n){n!==t[o]&&(t[o]=n,function(e){for(var n=Object.keys(e),r=n.length;r--;){var a=n[r];t[a].set(e[a])}}(s[n]),e.modified())}};i--;)o();a.length&&D(e,t,a)},safeArrays:M,set:I,setArray:N,setGet:x,setGetArray:function(e,t,n,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;S(e,t,n),N(e,t,n,r,a)},setImmediate:b,setLoggerFunction:function(e,t){f[e]&&(f[e]=t||d)},throttle:function(e,t){var n=!1,r=null;function a(){n=!1,null!==r&&(i.apply(void 0,s(r)),r=null)}function i(){for(var i=arguments.length,o=new Array(i),s=0;s2&&void 0!==arguments[2]?arguments[2]:[],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(P(t)){if(a.indexOf(t)>=0)return r;a.push(t);var i=n(t);void 0!==i&&r.push(i);var o=t.get();Object.keys(o).forEach(function(t){var i=o[t];Array.isArray(i)?i.forEach(function(t){e(t,n,r,a)}):e(i,n,r,a)})}return r},TYPED_ARRAYS:v,uncapitalize:function(e){return e.charAt(0).toLowerCase()+e.slice(1)},VOID:l,vtkDebugMacro:p,vtkErrorMacro:g,vtkInfoMacro:function(){f.info.apply(f,arguments)},vtkLogMacro:function(){f.log.apply(f,arguments)},vtkOnceErrorMacro:function(e){h[e]||(f.error(e),h[e]=!0)},vtkWarningMacro:m}}).call(this,n(33))},function(e,t,n){"use strict";var r={};n.r(r),n.d(r,"EPSILON",function(){return l}),n.d(r,"ARRAY_TYPE",function(){return c}),n.d(r,"RANDOM",function(){return d}),n.d(r,"setMatrixArrayType",function(){return f}),n.d(r,"toRadian",function(){return g}),n.d(r,"equals",function(){return m});var a={};n.r(a),n.d(a,"create",function(){return h}),n.d(a,"fromMat4",function(){return v}),n.d(a,"clone",function(){return y}),n.d(a,"copy",function(){return M}),n.d(a,"fromValues",function(){return A}),n.d(a,"set",function(){return b}),n.d(a,"identity",function(){return w}),n.d(a,"transpose",function(){return D}),n.d(a,"invert",function(){return T}),n.d(a,"adjoint",function(){return C}),n.d(a,"determinant",function(){return I}),n.d(a,"multiply",function(){return x}),n.d(a,"translate",function(){return S}),n.d(a,"rotate",function(){return N}),n.d(a,"scale",function(){return E}),n.d(a,"fromTranslation",function(){return O}),n.d(a,"fromRotation",function(){return L}),n.d(a,"fromScaling",function(){return P}),n.d(a,"fromMat2d",function(){return k}),n.d(a,"fromQuat",function(){return R}),n.d(a,"normalFromMat4",function(){return j}),n.d(a,"projection",function(){return B}),n.d(a,"str",function(){return z}),n.d(a,"frob",function(){return _}),n.d(a,"add",function(){return V}),n.d(a,"subtract",function(){return F}),n.d(a,"multiplyScalar",function(){return U}),n.d(a,"multiplyScalarAndAdd",function(){return G}),n.d(a,"exactEquals",function(){return W}),n.d(a,"equals",function(){return Q}),n.d(a,"mul",function(){return Y}),n.d(a,"sub",function(){return H});var i={};n.r(i),n.d(i,"create",function(){return K}),n.d(i,"clone",function(){return X}),n.d(i,"copy",function(){return q}),n.d(i,"fromValues",function(){return Z}),n.d(i,"set",function(){return J}),n.d(i,"identity",function(){return $}),n.d(i,"transpose",function(){return ee}),n.d(i,"invert",function(){return te}),n.d(i,"adjoint",function(){return ne}),n.d(i,"determinant",function(){return re}),n.d(i,"multiply",function(){return ae}),n.d(i,"translate",function(){return ie}),n.d(i,"scale",function(){return oe}),n.d(i,"rotate",function(){return se}),n.d(i,"rotateX",function(){return ue}),n.d(i,"rotateY",function(){return le}),n.d(i,"rotateZ",function(){return ce}),n.d(i,"fromTranslation",function(){return de}),n.d(i,"fromScaling",function(){return fe}),n.d(i,"fromRotation",function(){return pe}),n.d(i,"fromXRotation",function(){return ge}),n.d(i,"fromYRotation",function(){return me}),n.d(i,"fromZRotation",function(){return he}),n.d(i,"fromRotationTranslation",function(){return ve}),n.d(i,"fromQuat2",function(){return ye}),n.d(i,"getTranslation",function(){return Me}),n.d(i,"getScaling",function(){return Ae}),n.d(i,"getRotation",function(){return be}),n.d(i,"fromRotationTranslationScale",function(){return we}),n.d(i,"fromRotationTranslationScaleOrigin",function(){return De}),n.d(i,"fromQuat",function(){return Te}),n.d(i,"frustum",function(){return Ce}),n.d(i,"perspective",function(){return Ie}),n.d(i,"perspectiveFromFieldOfView",function(){return xe}),n.d(i,"ortho",function(){return Se}),n.d(i,"lookAt",function(){return Ne}),n.d(i,"targetTo",function(){return Ee}),n.d(i,"str",function(){return Oe}),n.d(i,"frob",function(){return Le}),n.d(i,"add",function(){return Pe}),n.d(i,"subtract",function(){return ke}),n.d(i,"multiplyScalar",function(){return Re}),n.d(i,"multiplyScalarAndAdd",function(){return je}),n.d(i,"exactEquals",function(){return Be}),n.d(i,"equals",function(){return ze}),n.d(i,"mul",function(){return _e}),n.d(i,"sub",function(){return Ve});var o={};n.r(o),n.d(o,"create",function(){return Fe}),n.d(o,"clone",function(){return Ue}),n.d(o,"length",function(){return Ge}),n.d(o,"fromValues",function(){return We}),n.d(o,"copy",function(){return Qe}),n.d(o,"set",function(){return Ye}),n.d(o,"add",function(){return He}),n.d(o,"subtract",function(){return Ke}),n.d(o,"multiply",function(){return Xe}),n.d(o,"divide",function(){return qe}),n.d(o,"ceil",function(){return Ze}),n.d(o,"floor",function(){return Je}),n.d(o,"min",function(){return $e}),n.d(o,"max",function(){return et}),n.d(o,"round",function(){return tt}),n.d(o,"scale",function(){return nt}),n.d(o,"scaleAndAdd",function(){return rt}),n.d(o,"distance",function(){return at}),n.d(o,"squaredDistance",function(){return it}),n.d(o,"squaredLength",function(){return ot}),n.d(o,"negate",function(){return st}),n.d(o,"inverse",function(){return ut}),n.d(o,"normalize",function(){return lt}),n.d(o,"dot",function(){return ct}),n.d(o,"cross",function(){return dt}),n.d(o,"lerp",function(){return ft}),n.d(o,"hermite",function(){return pt}),n.d(o,"bezier",function(){return gt}),n.d(o,"random",function(){return mt}),n.d(o,"transformMat4",function(){return ht}),n.d(o,"transformMat3",function(){return vt}),n.d(o,"transformQuat",function(){return yt}),n.d(o,"rotateX",function(){return Mt}),n.d(o,"rotateY",function(){return At}),n.d(o,"rotateZ",function(){return bt}),n.d(o,"angle",function(){return wt}),n.d(o,"zero",function(){return Dt}),n.d(o,"str",function(){return Tt}),n.d(o,"exactEquals",function(){return Ct}),n.d(o,"equals",function(){return It}),n.d(o,"sub",function(){return St}),n.d(o,"mul",function(){return Nt}),n.d(o,"div",function(){return Et}),n.d(o,"dist",function(){return Ot}),n.d(o,"sqrDist",function(){return Lt}),n.d(o,"len",function(){return Pt}),n.d(o,"sqrLen",function(){return kt}),n.d(o,"forEach",function(){return Rt});var s={};n.r(s),n.d(s,"create",function(){return jt}),n.d(s,"clone",function(){return Bt}),n.d(s,"fromValues",function(){return zt}),n.d(s,"copy",function(){return _t}),n.d(s,"set",function(){return Vt}),n.d(s,"add",function(){return Ft}),n.d(s,"subtract",function(){return Ut}),n.d(s,"multiply",function(){return Gt}),n.d(s,"divide",function(){return Wt}),n.d(s,"ceil",function(){return Qt}),n.d(s,"floor",function(){return Yt}),n.d(s,"min",function(){return Ht}),n.d(s,"max",function(){return Kt}),n.d(s,"round",function(){return Xt}),n.d(s,"scale",function(){return qt}),n.d(s,"scaleAndAdd",function(){return Zt}),n.d(s,"distance",function(){return Jt}),n.d(s,"squaredDistance",function(){return $t}),n.d(s,"length",function(){return en}),n.d(s,"squaredLength",function(){return tn}),n.d(s,"negate",function(){return nn}),n.d(s,"inverse",function(){return rn}),n.d(s,"normalize",function(){return an}),n.d(s,"dot",function(){return on}),n.d(s,"cross",function(){return sn}),n.d(s,"lerp",function(){return un}),n.d(s,"random",function(){return ln}),n.d(s,"transformMat4",function(){return cn}),n.d(s,"transformQuat",function(){return dn}),n.d(s,"zero",function(){return fn}),n.d(s,"str",function(){return pn}),n.d(s,"exactEquals",function(){return gn}),n.d(s,"equals",function(){return mn}),n.d(s,"sub",function(){return hn}),n.d(s,"mul",function(){return vn}),n.d(s,"div",function(){return yn}),n.d(s,"dist",function(){return Mn}),n.d(s,"sqrDist",function(){return An}),n.d(s,"len",function(){return bn}),n.d(s,"sqrLen",function(){return wn}),n.d(s,"forEach",function(){return Dn});var u={};n.r(u),n.d(u,"create",function(){return Tn}),n.d(u,"identity",function(){return Cn}),n.d(u,"setAxisAngle",function(){return In}),n.d(u,"getAxisAngle",function(){return xn}),n.d(u,"multiply",function(){return Sn}),n.d(u,"rotateX",function(){return Nn}),n.d(u,"rotateY",function(){return En}),n.d(u,"rotateZ",function(){return On}),n.d(u,"calculateW",function(){return Ln}),n.d(u,"slerp",function(){return Pn}),n.d(u,"random",function(){return kn}),n.d(u,"invert",function(){return Rn}),n.d(u,"conjugate",function(){return jn}),n.d(u,"fromMat3",function(){return Bn}),n.d(u,"fromEuler",function(){return zn}),n.d(u,"str",function(){return _n}),n.d(u,"clone",function(){return Yn}),n.d(u,"fromValues",function(){return Hn}),n.d(u,"copy",function(){return Kn}),n.d(u,"set",function(){return Xn}),n.d(u,"add",function(){return qn}),n.d(u,"mul",function(){return Zn}),n.d(u,"scale",function(){return Jn}),n.d(u,"dot",function(){return $n}),n.d(u,"lerp",function(){return er}),n.d(u,"length",function(){return tr}),n.d(u,"len",function(){return nr}),n.d(u,"squaredLength",function(){return rr}),n.d(u,"sqrLen",function(){return ar}),n.d(u,"normalize",function(){return ir}),n.d(u,"exactEquals",function(){return or}),n.d(u,"equals",function(){return sr}),n.d(u,"rotationTo",function(){return ur}),n.d(u,"sqlerp",function(){return lr}),n.d(u,"setAxes",function(){return cr});var l=1e-6,c="undefined"!=typeof Float32Array?Float32Array:Array,d=Math.random;function f(e){c=e}var p=Math.PI/180;function g(e){return e*p}function m(e,t){return Math.abs(e-t)<=l*Math.max(1,Math.abs(e),Math.abs(t))}function h(){var e=new c(9);return c!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function v(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function y(e){var t=new c(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function M(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function A(e,t,n,r,a,i,o,s,u){var l=new c(9);return l[0]=e,l[1]=t,l[2]=n,l[3]=r,l[4]=a,l[5]=i,l[6]=o,l[7]=s,l[8]=u,l}function b(e,t,n,r,a,i,o,s,u,l){return e[0]=t,e[1]=n,e[2]=r,e[3]=a,e[4]=i,e[5]=o,e[6]=s,e[7]=u,e[8]=l,e}function w(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function D(e,t){if(e===t){var n=t[1],r=t[2],a=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=a}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function T(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8],d=c*o-s*l,f=-c*i+s*u,p=l*i-o*u,g=n*d+r*f+a*p;return g?(g=1/g,e[0]=d*g,e[1]=(-c*r+a*l)*g,e[2]=(s*r-a*o)*g,e[3]=f*g,e[4]=(c*n-a*u)*g,e[5]=(-s*n+a*i)*g,e[6]=p*g,e[7]=(-l*n+r*u)*g,e[8]=(o*n-r*i)*g,e):null}function C(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8];return e[0]=o*c-s*l,e[1]=a*l-r*c,e[2]=r*s-a*o,e[3]=s*u-i*c,e[4]=n*c-a*u,e[5]=a*i-n*s,e[6]=i*l-o*u,e[7]=r*u-n*l,e[8]=n*o-r*i,e}function I(e){var t=e[0],n=e[1],r=e[2],a=e[3],i=e[4],o=e[5],s=e[6],u=e[7],l=e[8];return t*(l*i-o*u)+n*(-l*a+o*s)+r*(u*a-i*s)}function x(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],f=n[0],p=n[1],g=n[2],m=n[3],h=n[4],v=n[5],y=n[6],M=n[7],A=n[8];return e[0]=f*r+p*o+g*l,e[1]=f*a+p*s+g*c,e[2]=f*i+p*u+g*d,e[3]=m*r+h*o+v*l,e[4]=m*a+h*s+v*c,e[5]=m*i+h*u+v*d,e[6]=y*r+M*o+A*l,e[7]=y*a+M*s+A*c,e[8]=y*i+M*u+A*d,e}function S(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],f=n[0],p=n[1];return e[0]=r,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=u,e[6]=f*r+p*o+l,e[7]=f*a+p*s+c,e[8]=f*i+p*u+d,e}function N(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],f=Math.sin(n),p=Math.cos(n);return e[0]=p*r+f*o,e[1]=p*a+f*s,e[2]=p*i+f*u,e[3]=p*o-f*r,e[4]=p*s-f*a,e[5]=p*u-f*i,e[6]=l,e[7]=c,e[8]=d,e}function E(e,t,n){var r=n[0],a=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function O(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function L(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function P(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function k(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function R(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=n+n,s=r+r,u=a+a,l=n*o,c=r*o,d=r*s,f=a*o,p=a*s,g=a*u,m=i*o,h=i*s,v=i*u;return e[0]=1-d-g,e[3]=c-v,e[6]=f+h,e[1]=c+v,e[4]=1-l-g,e[7]=p-m,e[2]=f-h,e[5]=p+m,e[8]=1-l-d,e}function j(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8],d=t[9],f=t[10],p=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*o,M=n*u-a*o,A=n*l-i*o,b=r*u-a*s,w=r*l-i*s,D=a*l-i*u,T=c*m-d*g,C=c*h-f*g,I=c*v-p*g,x=d*h-f*m,S=d*v-p*m,N=f*v-p*h,E=y*N-M*S+A*x+b*I-w*C+D*T;return E?(E=1/E,e[0]=(s*N-u*S+l*x)*E,e[1]=(u*I-o*N-l*C)*E,e[2]=(o*S-s*I+l*T)*E,e[3]=(a*S-r*N-i*x)*E,e[4]=(n*N-a*I+i*C)*E,e[5]=(r*I-n*S-i*T)*E,e[6]=(m*D-h*w+v*b)*E,e[7]=(h*A-g*D-v*M)*E,e[8]=(g*w-m*A+v*y)*E,e):null}function B(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function z(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function _(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2))}function V(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e}function F(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e}function U(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e}function G(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e}function W(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function Q(e,t){var n=e[0],r=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],c=e[7],d=e[8],f=t[0],p=t[1],g=t[2],m=t[3],h=t[4],v=t[5],y=t[6],M=t[7],A=t[8];return Math.abs(n-f)<=l*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(r-p)<=l*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(a-g)<=l*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(i-m)<=l*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(o-h)<=l*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-v)<=l*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(u-y)<=l*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-M)<=l*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(d-A)<=l*Math.max(1,Math.abs(d),Math.abs(A))}var Y=x,H=F;function K(){var e=new c(16);return c!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function X(e){var t=new c(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function q(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Z(e,t,n,r,a,i,o,s,u,l,d,f,p,g,m,h){var v=new c(16);return v[0]=e,v[1]=t,v[2]=n,v[3]=r,v[4]=a,v[5]=i,v[6]=o,v[7]=s,v[8]=u,v[9]=l,v[10]=d,v[11]=f,v[12]=p,v[13]=g,v[14]=m,v[15]=h,v}function J(e,t,n,r,a,i,o,s,u,l,c,d,f,p,g,m,h){return e[0]=t,e[1]=n,e[2]=r,e[3]=a,e[4]=i,e[5]=o,e[6]=s,e[7]=u,e[8]=l,e[9]=c,e[10]=d,e[11]=f,e[12]=p,e[13]=g,e[14]=m,e[15]=h,e}function $(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ee(e,t){if(e===t){var n=t[1],r=t[2],a=t[3],i=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=a,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function te(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8],d=t[9],f=t[10],p=t[11],g=t[12],m=t[13],h=t[14],v=t[15],y=n*s-r*o,M=n*u-a*o,A=n*l-i*o,b=r*u-a*s,w=r*l-i*s,D=a*l-i*u,T=c*m-d*g,C=c*h-f*g,I=c*v-p*g,x=d*h-f*m,S=d*v-p*m,N=f*v-p*h,E=y*N-M*S+A*x+b*I-w*C+D*T;return E?(E=1/E,e[0]=(s*N-u*S+l*x)*E,e[1]=(a*S-r*N-i*x)*E,e[2]=(m*D-h*w+v*b)*E,e[3]=(f*w-d*D-p*b)*E,e[4]=(u*I-o*N-l*C)*E,e[5]=(n*N-a*I+i*C)*E,e[6]=(h*A-g*D-v*M)*E,e[7]=(c*D-f*A+p*M)*E,e[8]=(o*S-s*I+l*T)*E,e[9]=(r*I-n*S-i*T)*E,e[10]=(g*w-m*A+v*y)*E,e[11]=(d*A-c*w-p*y)*E,e[12]=(s*C-o*x-u*T)*E,e[13]=(n*x-r*C+a*T)*E,e[14]=(m*M-g*b-h*y)*E,e[15]=(c*b-d*M+f*y)*E,e):null}function ne(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8],d=t[9],f=t[10],p=t[11],g=t[12],m=t[13],h=t[14],v=t[15];return e[0]=s*(f*v-p*h)-d*(u*v-l*h)+m*(u*p-l*f),e[1]=-(r*(f*v-p*h)-d*(a*v-i*h)+m*(a*p-i*f)),e[2]=r*(u*v-l*h)-s*(a*v-i*h)+m*(a*l-i*u),e[3]=-(r*(u*p-l*f)-s*(a*p-i*f)+d*(a*l-i*u)),e[4]=-(o*(f*v-p*h)-c*(u*v-l*h)+g*(u*p-l*f)),e[5]=n*(f*v-p*h)-c*(a*v-i*h)+g*(a*p-i*f),e[6]=-(n*(u*v-l*h)-o*(a*v-i*h)+g*(a*l-i*u)),e[7]=n*(u*p-l*f)-o*(a*p-i*f)+c*(a*l-i*u),e[8]=o*(d*v-p*m)-c*(s*v-l*m)+g*(s*p-l*d),e[9]=-(n*(d*v-p*m)-c*(r*v-i*m)+g*(r*p-i*d)),e[10]=n*(s*v-l*m)-o*(r*v-i*m)+g*(r*l-i*s),e[11]=-(n*(s*p-l*d)-o*(r*p-i*d)+c*(r*l-i*s)),e[12]=-(o*(d*h-f*m)-c*(s*h-u*m)+g*(s*f-u*d)),e[13]=n*(d*h-f*m)-c*(r*h-a*m)+g*(r*f-a*d),e[14]=-(n*(s*h-u*m)-o*(r*h-a*m)+g*(r*u-a*s)),e[15]=n*(s*f-u*d)-o*(r*f-a*d)+c*(r*u-a*s),e}function re(e){var t=e[0],n=e[1],r=e[2],a=e[3],i=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],h=e[15];return(t*o-n*i)*(d*h-f*m)-(t*s-r*i)*(c*h-f*g)+(t*u-a*i)*(c*m-d*g)+(n*s-r*o)*(l*h-f*p)-(n*u-a*o)*(l*m-d*p)+(r*u-a*s)*(l*g-c*p)}function ae(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],f=t[9],p=t[10],g=t[11],m=t[12],h=t[13],v=t[14],y=t[15],M=n[0],A=n[1],b=n[2],w=n[3];return e[0]=M*r+A*s+b*d+w*m,e[1]=M*a+A*u+b*f+w*h,e[2]=M*i+A*l+b*p+w*v,e[3]=M*o+A*c+b*g+w*y,M=n[4],A=n[5],b=n[6],w=n[7],e[4]=M*r+A*s+b*d+w*m,e[5]=M*a+A*u+b*f+w*h,e[6]=M*i+A*l+b*p+w*v,e[7]=M*o+A*c+b*g+w*y,M=n[8],A=n[9],b=n[10],w=n[11],e[8]=M*r+A*s+b*d+w*m,e[9]=M*a+A*u+b*f+w*h,e[10]=M*i+A*l+b*p+w*v,e[11]=M*o+A*c+b*g+w*y,M=n[12],A=n[13],b=n[14],w=n[15],e[12]=M*r+A*s+b*d+w*m,e[13]=M*a+A*u+b*f+w*h,e[14]=M*i+A*l+b*p+w*v,e[15]=M*o+A*c+b*g+w*y,e}function ie(e,t,n){var r,a,i,o,s,u,l,c,d,f,p,g,m=n[0],h=n[1],v=n[2];return t===e?(e[12]=t[0]*m+t[4]*h+t[8]*v+t[12],e[13]=t[1]*m+t[5]*h+t[9]*v+t[13],e[14]=t[2]*m+t[6]*h+t[10]*v+t[14],e[15]=t[3]*m+t[7]*h+t[11]*v+t[15]):(r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],d=t[8],f=t[9],p=t[10],g=t[11],e[0]=r,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=u,e[6]=l,e[7]=c,e[8]=d,e[9]=f,e[10]=p,e[11]=g,e[12]=r*m+s*h+d*v+t[12],e[13]=a*m+u*h+f*v+t[13],e[14]=i*m+l*h+p*v+t[14],e[15]=o*m+c*h+g*v+t[15]),e}function oe(e,t,n){var r=n[0],a=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function se(e,t,n,r){var a,i,o,s,u,c,d,f,p,g,m,h,v,y,M,A,b,w,D,T,C,I,x,S,N=r[0],E=r[1],O=r[2],L=Math.sqrt(N*N+E*E+O*O);return L0?(n[0]=2*(s*o+d*r+u*i-l*a)/f,n[1]=2*(u*o+d*a+l*r-s*i)/f,n[2]=2*(l*o+d*i+s*a-u*r)/f):(n[0]=2*(s*o+d*r+u*i-l*a),n[1]=2*(u*o+d*a+l*r-s*i),n[2]=2*(l*o+d*i+s*a-u*r)),ve(e,t,n),e}function Me(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Ae(e,t){var n=t[0],r=t[1],a=t[2],i=t[4],o=t[5],s=t[6],u=t[8],l=t[9],c=t[10];return e[0]=Math.sqrt(n*n+r*r+a*a),e[1]=Math.sqrt(i*i+o*o+s*s),e[2]=Math.sqrt(u*u+l*l+c*c),e}function be(e,t){var n=t[0]+t[5]+t[10],r=0;return n>0?(r=2*Math.sqrt(n+1),e[3]=.25*r,e[0]=(t[6]-t[9])/r,e[1]=(t[8]-t[2])/r,e[2]=(t[1]-t[4])/r):t[0]>t[5]&&t[0]>t[10]?(r=2*Math.sqrt(1+t[0]-t[5]-t[10]),e[3]=(t[6]-t[9])/r,e[0]=.25*r,e[1]=(t[1]+t[4])/r,e[2]=(t[8]+t[2])/r):t[5]>t[10]?(r=2*Math.sqrt(1+t[5]-t[0]-t[10]),e[3]=(t[8]-t[2])/r,e[0]=(t[1]+t[4])/r,e[1]=.25*r,e[2]=(t[6]+t[9])/r):(r=2*Math.sqrt(1+t[10]-t[0]-t[5]),e[3]=(t[1]-t[4])/r,e[0]=(t[8]+t[2])/r,e[1]=(t[6]+t[9])/r,e[2]=.25*r),e}function we(e,t,n,r){var a=t[0],i=t[1],o=t[2],s=t[3],u=a+a,l=i+i,c=o+o,d=a*u,f=a*l,p=a*c,g=i*l,m=i*c,h=o*c,v=s*u,y=s*l,M=s*c,A=r[0],b=r[1],w=r[2];return e[0]=(1-(g+h))*A,e[1]=(f+M)*A,e[2]=(p-y)*A,e[3]=0,e[4]=(f-M)*b,e[5]=(1-(d+h))*b,e[6]=(m+v)*b,e[7]=0,e[8]=(p+y)*w,e[9]=(m-v)*w,e[10]=(1-(d+g))*w,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function De(e,t,n,r,a){var i=t[0],o=t[1],s=t[2],u=t[3],l=i+i,c=o+o,d=s+s,f=i*l,p=i*c,g=i*d,m=o*c,h=o*d,v=s*d,y=u*l,M=u*c,A=u*d,b=r[0],w=r[1],D=r[2],T=a[0],C=a[1],I=a[2],x=(1-(m+v))*b,S=(p+A)*b,N=(g-M)*b,E=(p-A)*w,O=(1-(f+v))*w,L=(h+y)*w,P=(g+M)*D,k=(h-y)*D,R=(1-(f+m))*D;return e[0]=x,e[1]=S,e[2]=N,e[3]=0,e[4]=E,e[5]=O,e[6]=L,e[7]=0,e[8]=P,e[9]=k,e[10]=R,e[11]=0,e[12]=n[0]+T-(x*T+E*C+P*I),e[13]=n[1]+C-(S*T+O*C+k*I),e[14]=n[2]+I-(N*T+L*C+R*I),e[15]=1,e}function Te(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=n+n,s=r+r,u=a+a,l=n*o,c=r*o,d=r*s,f=a*o,p=a*s,g=a*u,m=i*o,h=i*s,v=i*u;return e[0]=1-d-g,e[1]=c+v,e[2]=f-h,e[3]=0,e[4]=c-v,e[5]=1-l-g,e[6]=p+m,e[7]=0,e[8]=f+h,e[9]=p-m,e[10]=1-l-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ce(e,t,n,r,a,i,o){var s=1/(n-t),u=1/(a-r),l=1/(i-o);return e[0]=2*i*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*i*u,e[6]=0,e[7]=0,e[8]=(n+t)*s,e[9]=(a+r)*u,e[10]=(o+i)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*l,e[15]=0,e}function Ie(e,t,n,r,a){var i,o=1/Math.tan(t/2);return e[0]=o/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(i=1/(r-a),e[10]=(a+r)*i,e[14]=2*a*r*i):(e[10]=-1,e[14]=-2*r),e}function xe(e,t,n,r){var a=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),u=2/(o+s),l=2/(a+i);return e[0]=u,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-(o-s)*u*.5,e[9]=(a-i)*l*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function Se(e,t,n,r,a,i,o){var s=1/(t-n),u=1/(r-a),l=1/(i-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(a+r)*u,e[14]=(o+i)*l,e[15]=1,e}function Ne(e,t,n,r){var a,i,o,s,u,c,d,f,p,g,m=t[0],h=t[1],v=t[2],y=r[0],M=r[1],A=r[2],b=n[0],w=n[1],D=n[2];return Math.abs(m-b)0&&(c*=p=1/Math.sqrt(p),d*=p,f*=p);var g=u*f-l*d,m=l*c-s*f,h=s*d-u*c;return(p=g*g+m*m+h*h)>0&&(g*=p=1/Math.sqrt(p),m*=p,h*=p),e[0]=g,e[1]=m,e[2]=h,e[3]=0,e[4]=d*h-f*m,e[5]=f*g-c*h,e[6]=c*m-d*g,e[7]=0,e[8]=c,e[9]=d,e[10]=f,e[11]=0,e[12]=a,e[13]=i,e[14]=o,e[15]=1,e}function Oe(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Le(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2)+Math.pow(e[9],2)+Math.pow(e[10],2)+Math.pow(e[11],2)+Math.pow(e[12],2)+Math.pow(e[13],2)+Math.pow(e[14],2)+Math.pow(e[15],2))}function Pe(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function ke(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Re(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function je(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function Be(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function ze(e,t){var n=e[0],r=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],c=e[7],d=e[8],f=e[9],p=e[10],g=e[11],m=e[12],h=e[13],v=e[14],y=e[15],M=t[0],A=t[1],b=t[2],w=t[3],D=t[4],T=t[5],C=t[6],I=t[7],x=t[8],S=t[9],N=t[10],E=t[11],O=t[12],L=t[13],P=t[14],k=t[15];return Math.abs(n-M)<=l*Math.max(1,Math.abs(n),Math.abs(M))&&Math.abs(r-A)<=l*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(a-b)<=l*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(i-w)<=l*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(o-D)<=l*Math.max(1,Math.abs(o),Math.abs(D))&&Math.abs(s-T)<=l*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(u-C)<=l*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-I)<=l*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(d-x)<=l*Math.max(1,Math.abs(d),Math.abs(x))&&Math.abs(f-S)<=l*Math.max(1,Math.abs(f),Math.abs(S))&&Math.abs(p-N)<=l*Math.max(1,Math.abs(p),Math.abs(N))&&Math.abs(g-E)<=l*Math.max(1,Math.abs(g),Math.abs(E))&&Math.abs(m-O)<=l*Math.max(1,Math.abs(m),Math.abs(O))&&Math.abs(h-L)<=l*Math.max(1,Math.abs(h),Math.abs(L))&&Math.abs(v-P)<=l*Math.max(1,Math.abs(v),Math.abs(P))&&Math.abs(y-k)<=l*Math.max(1,Math.abs(y),Math.abs(k))}var _e=ae,Ve=ke;function Fe(){var e=new c(3);return c!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Ue(e){var t=new c(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ge(e){var t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function We(e,t,n){var r=new c(3);return r[0]=e,r[1]=t,r[2]=n,r}function Qe(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Ye(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function He(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function Ke(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Xe(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function qe(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function Ze(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function Je(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function $e(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function et(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function tt(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function nt(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function rt(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function at(e,t){var n=t[0]-e[0],r=t[1]-e[1],a=t[2]-e[2];return Math.sqrt(n*n+r*r+a*a)}function it(e,t){var n=t[0]-e[0],r=t[1]-e[1],a=t[2]-e[2];return n*n+r*r+a*a}function ot(e){var t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function st(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function ut(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function lt(e,t){var n=t[0],r=t[1],a=t[2],i=n*n+r*r+a*a;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function ct(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function dt(e,t,n){var r=t[0],a=t[1],i=t[2],o=n[0],s=n[1],u=n[2];return e[0]=a*u-i*s,e[1]=i*o-r*u,e[2]=r*s-a*o,e}function ft(e,t,n,r){var a=t[0],i=t[1],o=t[2];return e[0]=a+r*(n[0]-a),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function pt(e,t,n,r,a,i){var o=i*i,s=o*(2*i-3)+1,u=o*(i-2)+i,l=o*(i-1),c=o*(3-2*i);return e[0]=t[0]*s+n[0]*u+r[0]*l+a[0]*c,e[1]=t[1]*s+n[1]*u+r[1]*l+a[1]*c,e[2]=t[2]*s+n[2]*u+r[2]*l+a[2]*c,e}function gt(e,t,n,r,a,i){var o=1-i,s=o*o,u=i*i,l=s*o,c=3*i*s,d=3*u*o,f=u*i;return e[0]=t[0]*l+n[0]*c+r[0]*d+a[0]*f,e[1]=t[1]*l+n[1]*c+r[1]*d+a[1]*f,e[2]=t[2]*l+n[2]*c+r[2]*d+a[2]*f,e}function mt(e,t){t=t||1;var n=2*d()*Math.PI,r=2*d()-1,a=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*a,e[1]=Math.sin(n)*a,e[2]=r*t,e}function ht(e,t,n){var r=t[0],a=t[1],i=t[2],o=n[3]*r+n[7]*a+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*a+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*a+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*a+n[10]*i+n[14])/o,e}function vt(e,t,n){var r=t[0],a=t[1],i=t[2];return e[0]=r*n[0]+a*n[3]+i*n[6],e[1]=r*n[1]+a*n[4]+i*n[7],e[2]=r*n[2]+a*n[5]+i*n[8],e}function yt(e,t,n){var r=n[0],a=n[1],i=n[2],o=n[3],s=t[0],u=t[1],l=t[2],c=a*l-i*u,d=i*s-r*l,f=r*u-a*s,p=a*f-i*d,g=i*c-r*f,m=r*d-a*c,h=2*o;return c*=h,d*=h,f*=h,p*=2,g*=2,m*=2,e[0]=s+c+p,e[1]=u+d+g,e[2]=l+f+m,e}function Mt(e,t,n,r){var a=[],i=[];return a[0]=t[0]-n[0],a[1]=t[1]-n[1],a[2]=t[2]-n[2],i[0]=a[0],i[1]=a[1]*Math.cos(r)-a[2]*Math.sin(r),i[2]=a[1]*Math.sin(r)+a[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function At(e,t,n,r){var a=[],i=[];return a[0]=t[0]-n[0],a[1]=t[1]-n[1],a[2]=t[2]-n[2],i[0]=a[2]*Math.sin(r)+a[0]*Math.cos(r),i[1]=a[1],i[2]=a[2]*Math.cos(r)-a[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function bt(e,t,n,r){var a=[],i=[];return a[0]=t[0]-n[0],a[1]=t[1]-n[1],a[2]=t[2]-n[2],i[0]=a[0]*Math.cos(r)-a[1]*Math.sin(r),i[1]=a[0]*Math.sin(r)+a[1]*Math.cos(r),i[2]=a[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function wt(e,t){var n=We(e[0],e[1],e[2]),r=We(t[0],t[1],t[2]);lt(n,n),lt(r,r);var a=ct(n,r);return a>1?0:a<-1?Math.PI:Math.acos(a)}function Dt(e){return e[0]=0,e[1]=0,e[2]=0,e}function Tt(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function Ct(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function It(e,t){var n=e[0],r=e[1],a=e[2],i=t[0],o=t[1],s=t[2];return Math.abs(n-i)<=l*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=l*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(a-s)<=l*Math.max(1,Math.abs(a),Math.abs(s))}var xt,St=Ke,Nt=Xe,Et=qe,Ot=at,Lt=it,Pt=Ge,kt=ot,Rt=(xt=Fe(),function(e,t,n,r,a,i){var o,s;for(t||(t=3),n||(n=0),s=r?Math.min(r*t+n,e.length):e.length,o=n;o0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=a*o,e[3]=i*o,e}function on(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function sn(e,t,n,r){var a=n[0]*r[1]-n[1]*r[0],i=n[0]*r[2]-n[2]*r[0],o=n[0]*r[3]-n[3]*r[0],s=n[1]*r[2]-n[2]*r[1],u=n[1]*r[3]-n[3]*r[1],l=n[2]*r[3]-n[3]*r[2],c=t[0],d=t[1],f=t[2],p=t[3];return e[0]=d*l-f*u+p*s,e[1]=-c*l+f*o-p*i,e[2]=c*u-d*o+p*a,e[3]=-c*s+d*i-f*a,e}function un(e,t,n,r){var a=t[0],i=t[1],o=t[2],s=t[3];return e[0]=a+r*(n[0]-a),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=s+r*(n[3]-s),e}function ln(e,t){var n,r,a,i,o,s;t=t||1;do{o=(n=2*d()-1)*n+(r=2*d()-1)*r}while(o>=1);do{s=(a=2*d()-1)*a+(i=2*d()-1)*i}while(s>=1);var u=Math.sqrt((1-o)/s);return e[0]=t*n,e[1]=t*r,e[2]=t*a*u,e[3]=t*i*u,e}function cn(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*a+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*a+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*a+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*a+n[11]*i+n[15]*o,e}function dn(e,t,n){var r=t[0],a=t[1],i=t[2],o=n[0],s=n[1],u=n[2],l=n[3],c=l*r+s*i-u*a,d=l*a+u*r-o*i,f=l*i+o*a-s*r,p=-o*r-s*a-u*i;return e[0]=c*l+p*-o+d*-u-f*-s,e[1]=d*l+p*-s+f*-o-c*-u,e[2]=f*l+p*-u+c*-s-d*-o,e[3]=t[3],e}function fn(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function pn(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function gn(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function mn(e,t){var n=e[0],r=e[1],a=e[2],i=e[3],o=t[0],s=t[1],u=t[2],c=t[3];return Math.abs(n-o)<=l*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-s)<=l*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(a-u)<=l*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(i-c)<=l*Math.max(1,Math.abs(i),Math.abs(c))}var hn=Ut,vn=Gt,yn=Wt,Mn=Jt,An=$t,bn=en,wn=tn,Dn=function(){var e=jt();return function(t,n,r,a,i,o){var s,u;for(n||(n=4),r||(r=0),u=a?Math.min(a*n+r,t.length):t.length,s=r;sl?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}function Sn(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=n[0],u=n[1],l=n[2],c=n[3];return e[0]=r*c+o*s+a*l-i*u,e[1]=a*c+o*u+i*s-r*l,e[2]=i*c+o*l+r*u-a*s,e[3]=o*c-r*s-a*u-i*l,e}function Nn(e,t,n){n*=.5;var r=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(n),u=Math.cos(n);return e[0]=r*u+o*s,e[1]=a*u+i*s,e[2]=i*u-a*s,e[3]=o*u-r*s,e}function En(e,t,n){n*=.5;var r=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(n),u=Math.cos(n);return e[0]=r*u-i*s,e[1]=a*u+o*s,e[2]=i*u+r*s,e[3]=o*u-a*s,e}function On(e,t,n){n*=.5;var r=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(n),u=Math.cos(n);return e[0]=r*u+a*s,e[1]=a*u-r*s,e[2]=i*u+o*s,e[3]=o*u-i*s,e}function Ln(e,t){var n=t[0],r=t[1],a=t[2];return e[0]=n,e[1]=r,e[2]=a,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-a*a)),e}function Pn(e,t,n,r){var a,i,o,s,u,c=t[0],d=t[1],f=t[2],p=t[3],g=n[0],m=n[1],h=n[2],v=n[3];return(i=c*g+d*m+f*h+p*v)<0&&(i=-i,g=-g,m=-m,h=-h,v=-v),1-i>l?(a=Math.acos(i),o=Math.sin(a),s=Math.sin((1-r)*a)/o,u=Math.sin(r*a)/o):(s=1-r,u=r),e[0]=s*c+u*g,e[1]=s*d+u*m,e[2]=s*f+u*h,e[3]=s*p+u*v,e}function kn(e){var t=d(),n=d(),r=d(),a=Math.sqrt(1-t),i=Math.sqrt(t);return e[0]=a*Math.sin(2*Math.PI*n),e[1]=a*Math.cos(2*Math.PI*n),e[2]=i*Math.sin(2*Math.PI*r),e[3]=i*Math.cos(2*Math.PI*r),e}function Rn(e,t){var n=t[0],r=t[1],a=t[2],i=t[3],o=n*n+r*r+a*a+i*i,s=o?1/o:0;return e[0]=-n*s,e[1]=-r*s,e[2]=-a*s,e[3]=i*s,e}function jn(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Bn(e,t){var n,r=t[0]+t[4]+t[8];if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var a=0;t[4]>t[0]&&(a=1),t[8]>t[3*a+a]&&(a=2);var i=(a+1)%3,o=(a+2)%3;n=Math.sqrt(t[3*a+a]-t[3*i+i]-t[3*o+o]+1),e[a]=.5*n,n=.5/n,e[3]=(t[3*i+o]-t[3*o+i])*n,e[i]=(t[3*i+a]+t[3*a+i])*n,e[o]=(t[3*o+a]+t[3*a+o])*n}return e}function zn(e,t,n,r){var a=.5*Math.PI/180;t*=a,n*=a,r*=a;var i=Math.sin(t),o=Math.cos(t),s=Math.sin(n),u=Math.cos(n),l=Math.sin(r),c=Math.cos(r);return e[0]=i*u*c-o*s*l,e[1]=o*s*c+i*u*l,e[2]=o*u*l-i*s*c,e[3]=o*u*c+i*s*l,e}function _n(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var Vn,Fn,Un,Gn,Wn,Qn,Yn=Bt,Hn=zt,Kn=_t,Xn=Vt,qn=Ft,Zn=Sn,Jn=qt,$n=on,er=un,tr=en,nr=tr,rr=tn,ar=rr,ir=an,or=gn,sr=mn,ur=(Vn=Fe(),Fn=We(1,0,0),Un=We(0,1,0),function(e,t,n){var r=ct(t,n);return r<-.999999?(dt(Vn,Fn,t),Pt(Vn)<1e-6&&dt(Vn,Un,t),lt(Vn,Vn),In(e,Vn,Math.PI),e):r>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(dt(Vn,t,n),e[0]=Vn[0],e[1]=Vn[1],e[2]=Vn[2],e[3]=1+r,ir(e,e))}),lr=(Gn=Tn(),Wn=Tn(),function(e,t,n,r,a,i){return Pn(Gn,t,a,i),Pn(Wn,n,r,i),Pn(e,Gn,Wn,2*i*(1-i)),e}),cr=(Qn=h(),function(e,t,n,r){return Qn[0]=n[0],Qn[3]=n[1],Qn[6]=n[2],Qn[1]=r[0],Qn[4]=r[1],Qn[7]=r[2],Qn[2]=-t[0],Qn[5]=-t[1],Qn[8]=-t[2],ir(e,Bn(e,Qn))});n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a}),n.d(t,"c",function(){return i}),n.d(t,"d",function(){return u}),n.d(t,"e",function(){return o}),n.d(t,"f",function(){return s})},function(e,t,n){"use strict";var r=n(127),a=n.n(r),i=n(0);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var s=i.a.vtkErrorMacro,u=i.a.vtkWarningMacro,l=0,c=20,d=1e-12;function f(e){return function(){return s("vtkMath::".concat(e," - NOT IMPLEMENTED"))}}function p(e,t){for(var n=0;n<3;n++){var r=e[n];e[n]=t[n],t[n]=r}}function g(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=[];t.length1&&void 0!==arguments[1]?arguments[1]:3;switch(t){case 1:return Math.abs(e);case 2:return Math.sqrt(e[0]*e[0]+e[1]*e[1]);case 3:return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);default:for(var n=0,r=0;r3&&Math.abs(n[l])+A===Math.abs(n[l])&&Math.abs(n[s])+A===Math.abs(n[s]))e[l][s]=0;else if(Math.abs(e[l][s])>f){for(M=n[s]-n[l],Math.abs(M)+A===Math.abs(M)?m=e[l][s]/M:(p=.5*M/e[l][s],m=1/(Math.abs(p)+Math.sqrt(1+p*p)),p<0&&(m=-m)),b=1/Math.sqrt(1+m*m),h=(y=m*b)/(1+b),M=m*e[l][s],T[l]-=M,T[s]+=M,n[l]-=M,n[s]+=M,e[l][s]=0,i=0;i<=l-1;i++)C(e,i,l,i,s);for(i=l+1;i<=s-1;i++)C(e,l,i,i,s);for(i=s+1;i=c)return u("vtkMath::Jacobi: Error extracting eigenfunctions"),0;for(i=0;i=w&&(w=n[o=a]);if(o!==i)for(n[o]=n[i],n[i]=w,a=0;a>1)+(1&t);for(i=0;i=0&&d++;if(d(r=u>s?u:s)?l:r,a[o]=1,0!==r&&(a[o]/=r)}var c=Math.abs(t[0][0])*a[0],d=Math.abs(t[1][0])*a[1],f=Math.abs(t[2][0])*a[2];i[0]=0,d>=(r=c)&&(r=d,i[0]=1),f>=r&&(i[0]=2),0!==i[0]&&(p(t[i[0]],t[0]),a[i[0]]=a[0]);var m=Math.abs(t[1][1])*a[1],h=Math.abs(t[2][1])*a[2];i[1]=1,h>=(r=m)&&(i[1]=2,p(t[2],t[1])),i[2]=2;var v=0;if(j(t)<0){v=1;for(var y=0;y<3;y++)t[0][y]=-t[0][y],t[1][y]=-t[1][y],t[2][y]=-t[2][y]}var M=g(4);if(_(t,M),B(M,t),v)for(var A=0;A<3;A++)t[0][A]=-t[0][A],t[1][A]=-t[1][A],t[2][A]=-t[2][A];1!==i[1]&&p(t[i[1]],t[1]),0!==i[0]&&p(t[i[0]],t[0])}function F(e,t,n){var r,a,i,o,s,u,l=[g(3),g(3),g(3)],c=g(3),d=g(3);for(r=0;r<3;r++)l[r][0]=e[r][0],l[r][1]=e[r][1],l[r][2]=e[r][2],c[r]=l[r],d[r]=n[r];if(z(c,3,t,d),t[0]!==t[1]||t[0]!==t[2]){for(k(n,n),r=0;r<3;r++)if(t[(r+1)%3]===t[(r+2)%3]){for(u=Math.abs(n[r][0]),o=0,a=1;a<3;a++)u<(s=Math.abs(n[r][a]))&&(u=s,o=a);return o!==r&&(s=t[o],t[o]=t[r],t[r]=s,p(n[r],n[o])),n[o][o]<0&&(n[o][0]=-n[o][0],n[o][1]=-n[o][1],n[o][2]=-n[o][2]),i=(o+2)%3,n[a=(o+1)%3][0]=0,n[a][1]=0,n[a][2]=0,n[a][a]=1,x(n[o],n[a],n[i]),N(n[i]),x(n[i],n[o],n[a]),void k(n,n)}for(u=Math.abs(n[0][0]),o=0,r=1;r<3;r++)u<(s=Math.abs(n[r][0]))&&(u=s,o=r);for(0!==o&&(s=t[o],t[o]=t[0],t[0]=s,p(n[o],n[0])),Math.abs(n[1][1])o&&(o=c);if(0===o)return u("Unable to factor linear system"),0;p[r]=1/o}for(a=0;a=o&&(o=l,f=r)}if(a!==f){for(i=0;i=0)for(i=o;i<=a-1;i++)u-=e[a][i]*n[i];else 0!==u&&(o=a);n[a]=u}for(a=r-1;a>=0;a--){for(u=n[a],i=a+1;i3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,i=r||g(n),o=a||g(n);if(0===U(e,i,n))return 0;for(var s=0;s.008856?Math.pow(r,3):(r-16/116)/7.787,a=Math.pow(a,3)>.008856?Math.pow(a,3):(a-16/116)/7.787,i=Math.pow(i,3)>.008856?Math.pow(i,3):(i-16/116)/7.787;t[0]=.9505*a,t[1]=1*r,t[2]=1.089*i}function H(e,t){var n=o(e,3),r=n[0]/.9505,a=n[1]/1,i=n[2]/1.089;r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,t[0]=116*a-16,t[1]=500*(r-a),t[2]=200*(a-i)}function K(e,t){var n=o(e,3),r=n[0],a=n[1],i=n[2],s=3.2406*r+-1.5372*a+-.4986*i,u=-.9689*r+1.8758*a+.0415*i,l=.0557*r+-.204*a+1.057*i;s>.0031308?s=1.055*Math.pow(s,1/2.4)-.055:s*=12.92,u>.0031308?u=1.055*Math.pow(u,1/2.4)-.055:u*=12.92,l>.0031308?l=1.055*Math.pow(l,1/2.4)-.055:l*=12.92;var c=s;c1&&(s/=c,u/=c,l/=c),s<0&&(s=0),u<0&&(u=0),l<0&&(l=0),t[0]=s,t[1]=u,t[2]=l}function X(e,t){var n=o(e,3),r=n[0],a=n[1],i=n[2];r>.04045?r=Math.pow((r+.055)/1.055,2.4):r/=12.92,a>.04045?a=Math.pow((a+.055)/1.055,2.4):a/=12.92,i>.04045?i=Math.pow((i+.055)/1.055,2.4):i/=12.92,t[0]=.4124*r+.3576*a+.1805*i,t[1]=.2126*r+.7152*a+.0722*i,t[2]=.0193*r+.1192*a+.9505*i}var q=f("GetScalarTypeFittingRange"),Z=f("GetAdjustedScalarRange");var J=Number.isFinite,$=Number.isNaN;function ee(e){var t=Math.floor(255*e);return t>15?t.toString(16):"0".concat(t.toString(16))}function te(e){return Math.round(255*e)}t.a={Pi:function(){return Math.PI},radiansFromDegrees:function(e){return e/180*Math.PI},degreesFromRadians:function(e){return 180*e/Math.PI},round:m,floor:h,ceil:v,ceilLog2:A,min:y,max:M,arrayMin:function(e){for(var t=1/0,n=0,r=e.length;n=0;--a)if(n[a]0&&void 0!==arguments[0]?arguments[0]:0;return e+((arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)-e)*Math.random()},gaussian:D,add:function(e,t,n){n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2]},subtract:function(e,t,n){n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2]},multiplyScalar:T,multiplyScalar2D:C,dot:I,outer:function(e,t,n){for(var r=0;r<3;r++)for(var a=0;a<3;a++)n[r][a]=e[r]*t[a]},cross:x,norm:S,normalize:N,perpendiculars:function(e,t,n,r){var a,i,o,s=e[0]*e[0],u=e[1]*e[1],l=e[2]*e[2],c=Math.sqrt(s+u+l);s>u&&s>l?(a=0,i=1,o=2):u>l?(a=1,i=2,o=0):(a=2,i=0,o=1);var d=e[a]/c,f=e[i]/c,p=e[o]/c,g=Math.sqrt(d*d+p*p);if(0!==r){var m=Math.sin(r),h=Math.cos(r);t&&(t[a]=(p*h-d*f*m)/g,t[i]=m*g,t[o]=(-d*h-f*p*m)/g),n&&(n[a]=(-p*m-d*f*h)/g,n[i]=h*g,n[o]=(d*m-f*p*h)/g)}else t&&(t[a]=p/g,t[i]=0,t[o]=-d/g),n&&(n[a]=-d*f/g,n[i]=g,n[o]=-f*p/g)},projectVector:function(e,t,n){var r=I(t,t);if(0===r)return n[0]=0,n[1]=0,n[2]=0,!1;for(var a=I(e,t)/r,i=0;i<3;i++)n[i]=t[i];return T(n,a),!0},projectVector2D:function(e,t,n){var r=E(t,t);if(0===r)return n[0]=0,n[1]=0,!1;for(var a=E(e,t)/r,i=0;i<2;i++)n[i]=t[i];return C(n,a),!0},distance2BetweenPoints:function(e,t){return(e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])+(e[2]-t[2])*(e[2]-t[2])},angleBetweenVectors:function(e,t){var n=[0,0,0];return x(e,t,n),Math.atan2(S(n),I(e,t))},gaussianAmplitude:function(e,t,n){var r=Math.abs(e-n);return 1/Math.sqrt(2*Math.PI*t)*Math.exp(-Math.pow(r,2)/(2*t))},gaussianWeight:function(e,t,n){var r=Math.abs(e-n);return Math.exp(-Math.pow(r,2)/(2*t))},dot2D:E,outer2D:function(e,t,n){for(var r=0;r<2;r++)for(var a=0;a<2;a++)n[r][a]=e[r]*t[a]},norm2D:O,normalize2D:function(e){var t=O(e);return 0!==t&&(e[0]/=t,e[1]/=t),t},determinant2x2:L,LUFactor3x3:function(e,t){for(var n,r,a,i=[0,0,0],o=0;o<3;o++)a=Math.abs(e[o][0]),(r=Math.abs(e[o][1]))>a&&(a=r),(r=Math.abs(e[o][2]))>a&&(a=r),i[o]=1/a;a=i[0]*Math.abs(e[0][0]),n=0,(r=i[1]*Math.abs(e[1][0]))>=a&&(a=r,n=1),(r=i[2]*Math.abs(e[2][0]))>=a&&(n=2),0!==n&&(p(e[n],e[0]),i[n]=i[0]),t[0]=n,e[1][0]/=e[0][0],e[2][0]/=e[0][0],e[1][1]-=e[1][0]*e[0][1],e[2][1]-=e[2][0]*e[0][1],a=i[1]*Math.abs(e[1][1]),n=1,(r=i[2]*Math.abs(e[2][1]))>=a&&(n=2,p(e[2],e[1]),i[2]=i[1]),t[1]=n,e[2][1]/=e[1][1],e[1][2]-=e[1][0]*e[0][2],e[2][2]-=e[2][0]*e[0][2]+e[2][1]*e[1][2],t[2]=2},LUSolve3x3:function(e,t,n){var r=n[t[0]];n[t[0]]=n[0],n[0]=r,r=n[t[1]],n[t[1]]=n[1],n[1]=r-e[1][0]*n[0],r=n[t[2]],n[t[2]]=n[2],n[2]=r-e[2][0]*n[0]-e[2][1]*n[1],n[2]/=e[2][2],n[1]=(n[1]-e[1][2]*n[2])/e[1][1],n[0]=(n[0]-e[0][1]*n[1]-e[0][2]*n[2])/e[0][0]},linearSolve3x3:function(e,t,n){var r=e[0][0],a=e[0][1],i=e[0][2],o=e[1][0],s=e[1][1],u=e[1][2],l=e[2][0],c=e[2][1],d=e[2][2],f=+L(s,c,u,d),p=-L(o,l,u,d),g=+L(o,l,s,c),m=-L(a,c,i,d),h=+L(r,l,i,d),v=-L(r,l,a,c),y=+L(a,s,i,u),M=-L(r,o,i,u),A=+L(r,o,a,s),b=r*f+a*p+i*g,w=f*t[0]+m*t[1]+y*t[2],D=p*t[0]+h*t[1]+M*t[2],T=g*t[0]+v*t[1]+A*t[2];n[0]=w/b,n[1]=D/b,n[2]=T/b},multiply3x3_vect3:function(e,t,n){var r=e[0][0]*t[0]+e[0][1]*t[1]+e[0][2]*t[2],a=e[1][0]*t[0]+e[1][1]*t[1]+e[1][2]*t[2],i=e[2][0]*t[0]+e[2][1]*t[1]+e[2][2]*t[2];n[0]=r,n[1]=a,n[2]=i},multiply3x3_mat3:P,multiplyMatrix:function(e,t,n,r,a,i,o){r!==a&&s("Number of columns of A must match number of rows of B.");for(var u=0;uM&&(r=Math.abs(e[a][i]));for(var o=0;o6&&void 0!==arguments[6])||arguments[6];if(ed&&(m=0,p[c]=0);if(m&&1===a)return u("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"),Q(e,t,n,i);if(m)v=1;else for(c=0;c1&&void 0!==arguments[1]?arguments[1]:[0,.5,1];switch(e.length){case 3:return t[0]=17*parseInt(e[0],16)/255,t[1]=17*parseInt(e[1],16)/255,t[2]=17*parseInt(e[2],16)/255,t;case 4:return t[0]=17*parseInt(e[1],16)/255,t[1]=17*parseInt(e[2],16)/255,t[2]=17*parseInt(e[3],16)/255,t;case 6:return t[0]=parseInt(e.substr(0,2),16)/255,t[1]=parseInt(e.substr(2,2),16)/255,t[2]=parseInt(e.substr(4,2),16)/255,t;case 7:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t;case 9:return t[0]=parseInt(e.substr(1,2),16)/255,t[1]=parseInt(e.substr(3,2),16)/255,t[2]=parseInt(e.substr(5,2),16)/255,t[3]=parseInt(e.substr(7,2),16)/255,t;default:return t}},rgb2hsv:function(e,t){var n,r,a=o(e,3),i=a[0],s=a[1],u=a[2],l=i,c=i;s>l?l=s:sl?l=u:u0?(l-c)/l:0)>0?(n=i===l?1/6*(s-u)/(l-c):s===l?1/3+1/6*(u-i)/(l-c):2/3+1/6*(i-s)/(l-c))<0&&(n+=1):n=0,t[0]=n,t[1]=r,t[2]=d},hsv2rgb:function(e,t){var n,r,a,i=o(e,3),s=i[0],u=i[1],l=i[2];s>1/6&&s<=1/3?(r=1,n=(1/3-s)/(1/6),a=0):s>1/3&&s<=.5?(r=1,a=(s-1/3)/(1/6),n=0):s>.5&&s<=2/3?(a=1,r=(2/3-s)/(1/6),n=0):s>2/3&&s<=5/6?(a=1,n=(s-2/3)/(1/6),r=0):s>5/6&&s<=1?(n=1,a=(1-s)/(1/6),r=0):(n=1,r=s/(1/6),a=0),n=u*n+(1-u),r=u*r+(1-u),a=u*a+(1-u),n*=l,r*=l,a*=l,t[0]=n,t[1]=r,t[2]=a},lab2xyz:Y,xyz2lab:H,xyz2rgb:K,rgb2xyz:X,rgb2lab:function(e,t){var n=[0,0,0];X(e,n),H(n,t)},lab2rgb:function(e,t){var n=[0,0,0];Y(e,n),K(n,t)},uninitializeBounds:function(e){e[0]=1,e[1]=-1,e[2]=1,e[3]=-1,e[4]=1,e[5]=-1},areBoundsInitialized:function(e){return!(e[1]-e[0]<0)},clampValue:function(e,t,n){return en?n:e},clampAndNormalizeValue:function(e,t){var n=0;return t[0]!==t[1]&&(n=((n=et[1]?t[1]:e)-t[0])/(t[1]-t[0])),n},getScalarTypeFittingRange:q,getAdjustedScalarRange:Z,extentIsWithinOtherExtent:function(e,t){if(!e||!t)return 0;for(var n=0;n<6;n+=2)if(e[n]t[n+1]||e[n+1]t[n+1])return 0;return 1},boundsIsWithinOtherBounds:function(e,t,n){if(!e||!t)return 0;for(var r=0;r<6;r+=2)if(e[r]+n[r/2]t[r+1]||e[r+1]+n[r/2]t[r+1])return 0;return 1},pointIsWithinBounds:function(e,t,n){if(!e||!t||!n)return 0;for(var r=0;r<3;r++)if(e[r]+n[r]t[2*r+1])return 0;return 1},solve3PointCircle:function(e,t,n,r){for(var a=g(3),i=g(3),o=g(3),s=g(3),u=g(3),l=g(3),c=0;c<3;++c)a[c]=e[c]-t[c],i[c]=t[c]-n[c],o[c]=n[c]-e[c],s[c]=-a[c],u[c]=-i[c],l[c]=-o[c];var d=S(s),f=S(u),p=S(o),m=g(3);x(a,i,m);for(var h=S(m),v=d*f*p/(2*h),y=2*h*h,M=f*f*I(a,l)/y,A=p*p*I(s,i)/y,b=d*d*I(o,u)/y,w=0;w<3;++w)r[w]=M*e[w]+A*t[w]+b*n[w];return v},inf:1/0,negInf:-1/0,isInf:function(e){return!Number.isFinite(e)},isNan:$,isNaN:$,isFinite:J,createUninitializedBounds:function(){return[].concat([Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE])},getMajorAxisIndex:function(e){for(var t=-1,n=-1,r=0;rt&&(n=r,t=a)}return n},floatToHex2:ee,floatRGB2HexCode:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#";return"".concat(t).concat(e.map(ee).join(""))},float2CssRGBA:function(e){return 3===e.length?"rgb(".concat(e.map(te).join(", "),")"):"rgba(".concat(te(e[0]||0),", ").concat(te(e[1]||0),", ").concat(te(e[2]||0),", ").concat(e[3]||0,")")}}},function(e,t,n){"use strict";var r=n(7),a=n(0),i=n(2),o=r.c.DefaultDataType,s=[];function u(){var e=Number.MAX_VALUE,t=-Number.MAX_VALUE,n=0,r=0;return{add:function(a){e>a&&(e=a),t1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=u(),a=e.length,i=0;if(t<0&&n>1){for(var o=0;on&&(n=a)}return n}};var f={name:"",numberOfComponents:1,size:0,dataType:o,rangeTuple:[0,0]};function p(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,f,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=window[t.dataType].from(t.values)):t.values=new window[t.dataType](t.size),t.values&&(t.size=t.values.length,t.dataType=c(t.values)),a.a.obj(e,t),a.a.set(e,t,["name","numberOfComponents"]),function(e,t){function n(){t.ranges=null,e.modified()}t.classHierarchy.push("vtkDataArray"),e.getElementComponentSize=function(){return t.values.BYTES_PER_ELEMENT},e.getComponent=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=function(e,r,a){a!==t.values[e*t.numberOfComponents+r]&&(t.values[e*t.numberOfComponents+r]=a,n())},e.getData=function(){return t.values},e.getRange=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,n=e<0?t.numberOfComponents:e,r=null;return t.ranges||(t.ranges=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e||[];n.length<=t;)n.push(null);return n}(t.ranges,t.numberOfComponents)),(r=t.ranges[n])?(t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple):(r=l(t.values,e,t.numberOfComponents),t.ranges[n]=r,t.rangeTuple[0]=r.min,t.rangeTuple[1]=r.max,t.rangeTuple)},e.setTuple=function(e,n){for(var r=e*t.numberOfComponents,a=0;a1&&void 0!==arguments[1]?arguments[1]:s,r=t.numberOfComponents||1;n.length!==r&&(n.length=r);var a=e*r;if(1===r)n[0]=t.values[a];else if(2===r)n[0]=t.values[a],n[1]=t.values[a+1];else if(3===r)n[0]=t.values[a],n[1]=t.values[a+1],n[2]=t.values[a+2];else if(4===r)n[0]=t.values[a],n[1]=t.values[a+1],n[2]=t.values[a+2],n[3]=t.values[a+3];else for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:1)*t.numberOfComponents},e.getNumberOfComponents=function(){return t.numberOfComponents},e.getNumberOfValues=function(){return t.values.length},e.getNumberOfTuples=function(){return t.values.length/t.numberOfComponents},e.getDataType=function(){return t.dataType},e.newClone=function(){return g({empty:!0,name:t.name,dataType:t.dataType,numberOfComponents:t.numberOfComponents})},e.getName=function(){return t.name||(e.modified(),t.name="vtkDataArray".concat(e.getMTime())),t.name},e.setData=function(e,r){t.values=e,t.size=e.length,t.dataType=c(e),r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),n()},e.getState=function(){var n=Object.assign({},t,{vtkClass:e.getClassName()});n.values=Array.from(n.values),delete n.buffer,Object.keys(n).forEach(function(e){n[e]||delete n[e]});var r={};return Object.keys(n).sort().forEach(function(e){r[e]=n[e]}),r.mtime&&delete r.mtime,r}}(e,t)}var g=a.a.newInstance(p,"vtkDataArray");t.a=Object.assign({newInstance:g,extend:p},d,r.c)},function(e,t,n){"use strict";var r=n(0),a=n(8),i=n(24),o=n(80),s=n(53);var u={};function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,u,n),o.a.extend(e,t,n),r.a.setGet(e,t,["verts","lines","polys","strips"]),function(e,t){t.classHierarchy.push("vtkPolyData"),s.a.forEach(function(n){var r;e["getNumberOf".concat((r=n,r.replace(/(?:^\w|[A-Z]|\b\w)/g,function(e){return e.toUpperCase()}).replace(/\s+/g,"")))]=function(){return t[n].getNumberOfCells()},t[n]?t[n]=Object(a.a)(t[n]):t[n]=i.a.newInstance()}),e.getNumberOfCells=function(){return s.a.reduce(function(e,n){return e+t[n].getNumberOfCells()},0)};var n=e.shallowCopy;e.shallowCopy=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),s.a.forEach(function(n){t[n]=i.a.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))})}}(e,t)}var c=r.a.newInstance(l,"vtkPolyData");t.a={newInstance:c,extend:l}},function(e,t,n){"use strict";var r=n(1),a=n(0),i=n(43),o=n(16),s=a.a.vtkDebugMacro;var u={mapper:null,property:null,backfaceProperty:null,forceOpaque:!1,forceTranslucent:!1,bounds:[1,-1,1,-1,1,-1]};function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,u,n),i.a.extend(e,t,n),t.boundsMTime={},a.a.obj(t.boundsMTime),a.a.set(e,t,["property"]),a.a.setGet(e,t,["backfaceProperty","forceOpaque","forceTranslucent","mapper"]),function(e,t){t.classHierarchy.push("vtkActor");var n=Object.assign({},e);e.getActors=function(){return e},e.getIsOpaque=function(){if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();var n=t.property.getOpacity()>=1;return n=(n=n&&(!t.texture||!t.texture.isTranslucent()))&&(!t.mapper||t.mapper.getIsOpaque())},e.hasTranslucentPolygonalGeometry=function(){return null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque())},e.makeProperty=o.a.newInstance,e.getProperty=function(){return null===t.property&&(t.property=e.makeProperty()),t.property},e.getBounds=function(){if(null===t.mapper)return t.bounds;var n=t.mapper.getBounds();if(!n||6!==n.length)return n;if(n[0]>n[1])return t.mapperBounds=n.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),n;if(!t.mapperBounds||n[0]!==t.mapperBounds[0]||n[1]!==t.mapperBounds[1]||n[2]!==t.mapperBounds[2]||n[3]!==t.mapperBounds[3]||n[4]!==t.mapperBounds[4]||n[5]!==t.mapperBounds[5]||e.getMTime()>t.boundsMTime.getMTime()){s("Recomputing bounds..."),t.mapperBounds=n.concat();var a=[r.e.fromValues(n[1],n[3],n[5]),r.e.fromValues(n[1],n[2],n[5]),r.e.fromValues(n[0],n[2],n[5]),r.e.fromValues(n[0],n[3],n[5]),r.e.fromValues(n[1],n[3],n[4]),r.e.fromValues(n[1],n[2],n[4]),r.e.fromValues(n[0],n[2],n[4]),r.e.fromValues(n[0],n[3],n[4])];e.computeMatrix();var i=r.c.create();r.c.transpose(i,t.matrix),a.forEach(function(e){return r.e.transformMat4(e,e,i)}),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(function(e,t){return t%2==0?a.reduce(function(e,n){return e>n[t/2]?n[t/2]:e},e):a.reduce(function(e,n){return ee?r:e}if(null!==t.backfaceProperty){var a=t.backfaceProperty.getMTime();e=a>e?a:e}return e},e.getRedrawMTime=function(){var e=t.mtime;if(null!==t.mapper){var n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),e=(n=t.mapper.getInput().getMTime())>e?n:e)}return e},e.getSupportsSelection=function(){return!!t.mapper&&t.mapper.getSupportsSelection()}}(e,t)}var c=a.a.newInstance(l,"vtkActor");t.a={newInstance:c,extend:l}},function(e,t,n){"use strict";var r=n(0),a=n(84),i=n(3),o=n(10),s=n(37),u=n(2),l=n(38);var c={addCoincidentTopologyMethods:function(e,t,n){n.forEach(function(n){e["get".concat(n.method)]=function(){return t[n.key]},e["set".concat(n.method)]=function(e,r){t[n.key]={factor:e,unit:r}}})},CATEGORIES:["Polygon","Line","Point"]},d=1,f=0,p=["VTK_RESOLVE_OFF","VTK_RESOLVE_POLYGON_OFFSET"];function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;f=e}var m={getResolveCoincidentTopologyAsString:function(){return p[f]},getResolveCoincidentTopologyPolygonOffsetFaces:function(){return d},getResolveCoincidentTopology:function(){return f},setResolveCoincidentTopology:g,setResolveCoincidentTopologyPolygonOffsetFaces:function(e){d=e},setResolveCoincidentTopologyToDefault:function(){g(0)},setResolveCoincidentTopologyToOff:function(){g(0)},setResolveCoincidentTopologyToPolygonOffset:function(){g(1)}},h=n(25),v=h.b.ColorMode,y=h.b.ScalarMode,M=h.b.GetArray,A=l.b.VectorMode,b=i.a.VtkDataTypes;function w(e){return function(){return r.a.vtkErrorMacro("vtkMapper::".concat(e," - NOT IMPLEMENTED"))}}var D={};c.addCoincidentTopologyMethods(D,{Polygon:{factor:2,offset:0},Line:{factor:1,offset:-1},Point:{factor:0,offset:-2}},c.CATEGORIES.map(function(e){return{key:e,method:"ResolveCoincidentTopology".concat(e,"OffsetParameters")}}));var T={colorMapColors:null,static:!1,lookupTable:null,scalarVisibility:!0,scalarRange:[0,1],useLookupTableScalarRange:!1,colorMode:0,scalarMode:0,arrayAccessMode:1,renderTime:0,colorByArrayName:null,fieldDataTupleId:-1,interpolateScalarsBeforeMapping:!1,colorCoordinates:null,colorTextureMap:null,forceCompileOnly:0,useInvertibleColors:!1,invertibleScalars:null,resolveCoincidentTopology:!1,viewSpecificProperties:null};function C(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,T,n),a.a.extend(e,t,n),r.a.get(e,t,["colorCoordinates","colorMapColors","colorTextureMap"]),r.a.setGet(e,t,["colorByArrayName","arrayAccessMode","colorMode","fieldDataTupleId","interpolateScalarsBeforeMapping","lookupTable","renderTime","resolveCoincidentTopology","scalarMode","scalarVisibility","static","useLookupTableScalarRange","viewSpecificProperties"]),r.a.setGetArray(e,t,["scalarRange"],2),t.viewSpecificProperties||(t.viewSpecificProperties={}),function(e,t){t.classHierarchy.push("vtkMapper"),e.getBounds=function(){var n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=u.a.createUninitializedBounds(),t.bounds},e.setForceCompileOnly=function(e){t.forceCompileOnly=e},e.createDefaultLookupTable=function(){t.lookupTable=s.a.newInstance()},e.getColorModeAsString=function(){return r.a.enumToString(v,t.colorMode)},e.setColorModeToDefault=function(){return e.setColorMode(0)},e.setColorModeToMapScalars=function(){return e.setColorMode(1)},e.setColorModeToDirectScalars=function(){return e.setColorMode(2)},e.getScalarModeAsString=function(){return r.a.enumToString(y,t.scalarMode)},e.setScalarModeToDefault=function(){return e.setScalarMode(0)},e.setScalarModeToUsePointData=function(){return e.setScalarMode(1)},e.setScalarModeToUseCellData=function(){return e.setScalarMode(2)},e.setScalarModeToUsePointFieldData=function(){return e.setScalarMode(3)},e.setScalarModeToUseCellFieldData=function(){return e.setScalarMode(4)},e.setScalarModeToUseFieldData=function(){return e.setScalarMode(5)},Object.keys(m).forEach(function(t){e[t]=m[t]}),Object.keys(D).forEach(function(t){e[t]=D[t]}),t.topologyOffset={Polygon:{factor:0,offset:0},Line:{factor:0,offset:0},Point:{factor:0,offset:0}},c.addCoincidentTopologyMethods(e,t.topologyOffset,c.CATEGORIES.map(function(e){return{key:e,method:"RelativeCoincidentTopology".concat(e,"OffsetParameters")}})),e.getCoincidentTopologyPolygonOffsetParameters=function(){var t=D.getResolveCoincidentTopologyPolygonOffsetParameters(),n=e.getRelativeCoincidentTopologyPolygonOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyLineOffsetParameters=function(){var t=D.getResolveCoincidentTopologyLineOffsetParameters(),n=e.getRelativeCoincidentTopologyLineOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getCoincidentTopologyPointOffsetParameter=function(){var t=D.getResolveCoincidentTopologyPointOffsetParameters(),n=e.getRelativeCoincidentTopologyPointOffsetParameters();return{factor:t.factor+n.factor,offset:t.offset+n.offset}},e.getAbstractScalars=function(e,n,r,a,i){if(!e||!t.scalarVisibility)return{scalars:null,cellFLag:!1};var o=null,s=!1;if(n===y.DEFAULT)(o=e.getPointData().getScalars())||(o=e.getCellData().getScalars(),s=!0);else if(n===y.USE_POINT_DATA)o=e.getPointData().getScalars();else if(n===y.USE_CELL_DATA)o=e.getCellData().getScalars(),s=!0;else if(n===y.USE_POINT_FIELD_DATA){var u=e.getPointData();o=r===M.BY_ID?u.getArrayByIndex(a):u.getArrayByName(i)}else if(n===y.USE_CELL_FIELD_DATA){var l=e.getCellData();s=!0,o=r===M.BY_ID?l.getArrayByIndex(a):l.getArrayByName(i)}else if(n===y.USE_FIELD_DATA){var c=e.getFieldData();o=r===M.BY_ID?c.getArrayByIndex(a):c.getArrayByName(i)}return{scalars:o,cellFlag:s}},e.mapScalars=function(n,r){var a=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;if(!a)return t.colorCoordinates=null,t.colorTextureMap=null,void(t.colorMapColors=null);if(t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),e.canUseTextureMapForColoring(n))e.mapScalarsToTexture(a,r);else{t.colorCoordinates=null,t.colorTextureMap=null;var i=e.getLookupTable();i&&(i.build(),t.colorMapColors=i.mapScalars(a,t.colorMode,-1))}},e.scalarToTextureCoordinate=function(e,t,n){var r=.5,a=1;return u.a.isNan(e)||(a=.49,(r=(e-t)*n)>1e3?r=1e3:r<-1e3&&(r=-1e3)),{texCoordS:r,texCoordT:a}},e.createColorTextureCoordinates=function(t,n,r,a,i,o,u,l,c){var d=(o[1]-o[0])/l,f=[];f[0]=o[0]-d,f[1]=o[1]+d;var p=1/(f[1]-f[0]),g=n.getData(),m=t.getData(),h=0,v=0;if(i<0||i>=a)for(var y=0;yt.colorTextureMap.getMTime()||t.lookupTable.getMTime()>t.colorTextureMap.getMTime()||t.lookupTable.getAlpha()!==r){t.lookupTable.setAlpha(r),t.colorTextureMap=null,t.lookupTable.build();var c=t.lookupTable.getNumberOfAvailableColors();c>4094&&(c=4094),c+=2;for(var d=(a[1]-a[0])/(c-1-2),f=new Float64Array(2*c),p=0;pt.colorCoordinates.getMTime()||e.getInputData(0).getMTime()>t.colorCoordinates.getMTime()||t.lookupTable.getMTime()>t.colorCoordinates.getMTime()){t.colorCoordinates=null;var h=n.getNumberOfComponents(),v=n.getNumberOfTuples();t.colorCoordinates=i.a.newInstance({numberOfComponents:2,values:new Float32Array(2*v)});var y=t.lookupTable.getVectorComponent();t.lookupTable.getVectorMode()===A.MAGNITUDE&&n.getNumberOfComponents()>1&&(y=-1),e.createColorTextureCoordinates(n,t.colorCoordinates,v,h,y,a,t.lookupTable.getRange(),t.colorTextureMap.getPointData().getScalars().getNumberOfTuples()/2-2,u)}},e.getIsOpaque=function(){var t=e.getLookupTable();return!t||(t.build(),t.isOpaque())},e.canUseTextureMapForColoring=function(n){if(!t.interpolateScalarsBeforeMapping)return!1;if(t.lookupTable&&t.lookupTable.getIndexedLookup())return!1;var r=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName),a=r.scalars;return!(!a||r.cellFlag||t.colorMode===v.DEFAULT&&a.getDataType()===b.UNSIGNED_CHAR||t.colorMode===v.DIRECT_SCALARS)},e.clearColorArrays=function(){t.colorMapColors=null,t.colorCoordinates=null,t.colorTextureMap=null},e.getLookupTable=function(){return t.lookupTable||e.createDefaultLookupTable(),t.lookupTable},e.getMTime=function(){var e=t.mtime;if(null!==t.lookupTable){var n=t.lookupTable.getMTime();e=n>e?n:e}return e},e.getPrimitiveCount=function(){var t=e.getInputData();return{points:t.getPoints().getNumberOfValues()/3,verts:t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells(),lines:t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells(),triangles:t.getPolys().getNumberOfValues()-3*t.getLines().getNumberOfCells()}},e.acquireInvertibleLookupTable=w("AcquireInvertibleLookupTable"),e.valueToColor=w("ValueToColor"),e.colorToValue=w("ColorToValue"),e.useInvertibleColorFor=w("UseInvertibleColorFor"),e.clearInvertibleColor=w("ClearInvertibleColor")}(e,t)}var I=r.a.newInstance(C,"vtkMapper");t.a=Object.assign({newInstance:I,extend:C},D,m,h.b)},function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a});var r={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},a={VOID:"",CHAR:"Int8Array",SIGNED_CHAR:"Int8Array",UNSIGNED_CHAR:"Uint8Array",SHORT:"Int16Array",UNSIGNED_SHORT:"Uint16Array",INT:"Int32Array",UNSIGNED_INT:"Uint32Array",FLOAT:"Float32Array",DOUBLE:"Float64Array"},i=a.FLOAT;t.c={DefaultDataType:i,DataTypeByteSize:r,VtkDataTypes:a}},function(e,t,n){"use strict";(function(e){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",function(){return i});var a={vtkObject:function(){return null}};function i(t){if(null==t)return t;if(t.isA)return t;if(!t.vtkClass)return e.console&&e.console.error&&e.console.error("Invalid VTK object"),null;var n=a[t.vtkClass];if(!n)return e.console&&e.console.error&&e.console.error("No vtk class found for Object of type ".concat(t.vtkClass)),null;var o=Object.assign({},t);Object.keys(o).forEach(function(e){o[e]&&"object"===r(o[e])&&o[e].vtkClass&&(o[e]=i(o[e]))});var s=n(o);return s&&s.modified&&s.modified(),s}i.register=function(e,t){a[e]=t}}).call(this,n(33))},function(e,t,n){"use strict";var r=n(1);function a(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t0&&void 0!==arguments[0]&&arguments[0];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.matrix=new Float64Array(16),r.c.identity(this.matrix),this.tmp=new Float64Array(3),this.angleConv=t?r.a.toRadian:o}var t,n,u;return t=e,(n=[{key:"rotateFromDirections",value:function(e,t){var n=new Float64Array(3),a=new Float64Array(3),i=new Float64Array(16);r.e.set(n,e[0],e[1],e[2]),r.e.set(a,t[0],t[1],t[2]),r.e.normalize(n,n),r.e.normalize(a,a);var o=r.e.dot(n,a);return o>=1?this:(r.e.cross(this.tmp,n,a),r.e.length(this.tmp,this.tmp)<1e-6&&(0===e[0]&&0===e[1]?r.e.set(this.tmp,0,1,0):r.e.set(this.tmp,0,-e[2],-e[1])),r.c.fromRotation(i,Math.acos(o),this.tmp),r.c.multiply(this.matrix,this.matrix,i),this)}},{key:"rotate",value:function(e,t){return r.e.set.apply(r.e,[this.tmp].concat(a(t))),r.e.normalize(this.tmp,this.tmp),r.c.rotate(this.matrix,this.matrix,this.angleConv(e),this.tmp),this}},{key:"rotateX",value:function(e){return r.c.rotateX(this.matrix,this.matrix,this.angleConv(e)),this}},{key:"rotateY",value:function(e){return r.c.rotateY(this.matrix,this.matrix,this.angleConv(e)),this}},{key:"rotateZ",value:function(e){return r.c.rotateZ(this.matrix,this.matrix,this.angleConv(e)),this}},{key:"translate",value:function(e,t,n){return r.e.set(this.tmp,e,t,n),r.c.translate(this.matrix,this.matrix,this.tmp),this}},{key:"scale",value:function(e,t,n){return r.e.set(this.tmp,e,t,n),r.c.scale(this.matrix,this.matrix,this.tmp),this}},{key:"apply",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(s[0]===this.matrix[0]&&s[1]===this.matrix[1]&&s[2]===this.matrix[2]&&s[3]===this.matrix[3]&&s[4]===this.matrix[4]&&s[5]===this.matrix[5]&&s[6]===this.matrix[6]&&s[7]===this.matrix[7]&&s[8]===this.matrix[8]&&s[9]===this.matrix[9]&&s[10]===this.matrix[10]&&s[11]===this.matrix[11]&&s[12]===this.matrix[12]&&s[13]===this.matrix[13]&&s[14]===this.matrix[14]&&s[15]===this.matrix[15])return this;for(var a=-1===n?e.length:t+3*n,i=t;i2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,l,n),a.a.extend(e,t,n),t.direction){if(Array.isArray(t.direction)){var c=t.direction.slice(0);t.direction=s.b.create();for(var d=0;d<9;++d)t.direction[d]=c[d]}}else t.direction=s.b.create();t.indexToWorld=s.c.create(),t.worldToIndex=s.c.create(),r.a.get(e,t,["direction","indexToWorld","worldToIndex"]),r.a.setGetArray(e,t,["origin","spacing"],3),r.a.getArray(e,t,["extent"],6),function(e,t){t.classHierarchy.push("vtkImageData"),e.setExtent=function(){for(var n=arguments.length,r=new Array(n),a=0;a1&&(n*=t[r]-1)}return n},e.getNumberOfPoints=function(){var t=e.getDimensions();return t[0]*t[1]*t[2]},e.getPoint=function(n){var r=e.getDimensions(),a=s.e.fromValues(0,0,0),i=[0,0,0];if(0===r[0]||0===r[1]||0===r[2])return u("Requesting a point from an empty image."),null;switch(t.dataDescription){case o.a.EMPTY:return null;case o.a.SINGLE_POINT:break;case o.a.X_LINE:a[0]=n;break;case o.a.Y_LINE:a[1]=n;break;case o.a.Z_LINE:a[2]=n;break;case o.a.XY_PLANE:a[0]=n%r[0],a[1]=n/r[0];break;case o.a.YZ_PLANE:a[1]=n%r[1],a[2]=n/r[1];break;case o.a.XZ_PLANE:a[0]=n%r[0],a[2]=n/r[0];break;case o.a.XYZ_GRID:a[0]=n%r[0],a[1]=n/r[0]%r[1],a[2]=n/(r[0]*r[1]);break;default:u("Invalid dataDescription")}var l=s.e.create();return e.indexToWorldVec3(a,l),s.e.copy(i,l),i},e.getBounds=function(){return e.extentToBounds(t.extent)},e.extentToBounds=function(t){var n=[t[0],t[2],t[4],t[1],t[2],t[4],t[0],t[3],t[4],t[1],t[3],t[4],t[0],t[2],t[5],t[1],t[2],t[5],t[0],t[3],t[5],t[1],t[3],t[5]],r=s.e.fromValues(n[0],n[1],n[2]),a=s.e.create();e.indexToWorldVec3(r,a);for(var i=[a[0],a[0],a[1],a[1],a[2],a[2]],o=3;o<24;o+=3)s.e.set(r,n[o],n[o+1],n[o+2]),e.indexToWorldVec3(r,a),a[0]i[1]&&(i[1]=a[0]),a[1]>i[3]&&(i[3]=a[1]),a[2]>i[5]&&(i[5]=a[2]);return i},e.computeTransforms=function(){var e=s.e.fromValues(t.origin[0],t.origin[1],t.origin[2]);s.c.fromTranslation(t.indexToWorld,e),t.indexToWorld[0]=t.direction[0],t.indexToWorld[1]=t.direction[1],t.indexToWorld[2]=t.direction[2],t.indexToWorld[4]=t.direction[3],t.indexToWorld[5]=t.direction[4],t.indexToWorld[6]=t.direction[5],t.indexToWorld[8]=t.direction[6],t.indexToWorld[9]=t.direction[7],t.indexToWorld[10]=t.direction[8];var n=s.e.fromValues(t.spacing[0],t.spacing[1],t.spacing[2]);s.c.scale(t.indexToWorld,t.indexToWorld,n),s.c.invert(t.worldToIndex,t.indexToWorld)},e.setDirection=function(){if(t.deleted)return u("instance deleted - cannot call any method"),!1;for(var n=arguments.length,r=new Array(n),a=0;at[1]?t[0]>t[2]?t[0]:t[2]:t[1]>t[2]?t[1]:t[2]}function p(e){if(u(e)){var t=d(e);return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])}return null}function g(e,t){return e<=0&&t>=0||e>=0&&t<=0}function m(e,t){for(var n=0,r=0;r<2;r++)for(var a=2;a<4;a++)for(var i=4;i<6;i++)t[n]=[e[r],e[a],e[i]],n++}var h={isValid:u,getCenter:l,getLength:c,getLengths:d,getMaxLength:f,getDiagonalLength:p,getXRange:function(e){return e.slice(0,2)},getYRange:function(e){return e.slice(2,4)},getZRange:function(e){return e.slice(4,6)},getCorners:m,INIT_BOUNDS:s};var v={type:"vtkBoundingBox",bounds:[].concat(s),corners:[]};function y(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,v,n),r.a.obj(e,t),r.a.setGet(e,t,["bounds"]),function(e,t){t.classHierarchy.push("vtkBoundingBox"),e.clone=function(){var e=[].concat(t.bounds);return M({bounds:e})},e.equals=function(e){var n=t.bounds,r=e.getBounds();return n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]&&n[4]===r[4]&&n[5]===r[5]},e.setMinPoint=function(e,n,r){var a=o(t.bounds,6),i=a[0],s=a[1],u=a[2],l=a[3],c=a[4],d=a[5];return t.bounds=[e,e>s?e:s,n,n>l?n:l,r,r>d?r:d],i!==e||u!==n||c!==r},e.setMaxPoint=function(e,n,r){var a=o(t.bounds,6),i=a[0],s=a[1],u=a[2],l=a[3],c=a[4],d=a[5];return t.bounds=[en[a]?e:n[a]})},e.addBounds=function(e,n,r,a,i,s){var u=o(t.bounds,6),l=u[0],c=u[1],d=u[2],f=u[3],p=u[4],g=u[5];t.bounds=[Math.min(e,l),Math.max(n,c),Math.min(r,d),Math.max(a,f),Math.min(i,p),Math.max(s,g)]},e.addBox=function(t){e.addBounds.apply(e,i(t.getBounds()))},e.isValid=function(){return u(t.bounds)},e.intersect=function(n){if(!e.isValid()||!n.isValid())return!1;for(var r,a=[0,0,0,0,0,0],i=n.getBounds(),o=0;o<3;o++)if(r=!1,i[2*o]>=t.bounds[2*o]&&i[2*o]<=t.bounds[2*o+1]?(r=!0,a[2*o]=i[2*o]):t.bounds[2*o]>=i[2*o]&&t.bounds[2*o]<=i[2*o+1]&&(r=!0,a[2*o]=t.bounds[2*o]),i[2*o+1]>=t.bounds[2*o]&&i[2*o+1]<=t.bounds[2*o+1]?(r=!0,a[2*o+1]=n.MaxPnt[o]):t.bounds[2*o+1]>=n.MinPnt[2*o]&&t.bounds[2*o+1]<=n.MaxPnt[2*o+1]&&(r=!0,a[2*o+1]=t.bounds[2*o+1]),!r)return!1;return t.bounds=a,!0},e.intersects=function(n){if(!e.isValid()||!n.isValid())return!1;for(var r=n.getBounds(),a=0;a<3;a++)if(!(r[2*a]>=t.bounds[2*a]&&r[2*a]<=t.bounds[2*a+1]||t.bounds[2*a]>=r[2*a]&&t.bounds[2*a]<=r[2*a+1]||r[2*a+1]>=t.bounds[2*a]&&r[2*a+1]<=t.bounds[2*a+1]||t.bounds[2*a+1]>=n.MinPnt[2*a]&&t.bounds[2*a+1]<=n.MaxPnt[2*a+1]))return!1;return!0},e.intersectPlane=function(e,n){for(var r=[[0,1,2,3,4,5,6,7],[0,1,4,5,2,3,6,7],[0,2,4,6,1,3,5,7]],i=[0,0,0,0,0,0,0,0],o=0,s=0;s<2;s++)for(var u=2;u<4;u++)for(var l=4;l<6;l++){var c=[t.bounds[s],t.bounds[u],t.bounds[l]];i[o++]=a.a.evaluate(n,e,c)}for(var d=2;d--&&!(g(i[r[d][0]],i[r[d][4]])&&g(i[r[d][1]],i[r[d][5]])&&g(i[r[d][2]],i[r[d][6]])&&g(i[r[d][3]],i[r[d][7]])););if(d<0)return!1;for(var f=Math.sign(n[d]),p=Math.abs((t.bounds[2*d+1]-t.bounds[2*d])*n[d]),m=f>0?1:0,h=0;h<4;h++)if(0!==p){var v=Math.abs(i[r[d][h]])/p;f>0&&vm&&(m=v)}var y=(1-m)*t.bounds[2*d]+m*t.bounds[2*d+1];return f>0?t.bounds[2*d]=y:t.bounds[2*d+1]=y,!0},e.containsPoint=function(e,n,r){return!(et.bounds[1]||nt.bounds[3]||rt.bounds[5])},e.getMinPoint=function(){return[t.bounds[0],t.bounds[2],t.bounds[4]]},e.getMaxPoint=function(){return[t.bounds[1],t.bounds[3],t.bounds[5]]},e.getBound=function(e){return t.bound[e]},e.contains=function(t){return!!e.intersects(t)&&!!e.containsPoint.apply(e,i(t.getMinPoint()))&&(!!e.containsPoint.apply(e,i(t.getMaxPoint()))||0)},e.getCenter=function(){return l(t.bounds)},e.getLength=function(e){return c(t.bounds,e)},e.getLengths=function(){return d(t.bounds)},e.getMaxLength=function(){return f(t.bounds)},e.getDiagonalLength=function(){return p(t.bounds)},e.reset=function(){return e.setBounds([].concat(s))},e.inflate=function(e){t.bounds=t.bounds.map(function(t,n){return n%2==0?t-e:t+e})},e.getCorners=function(){return m(t.bounds,t.corners),t.corners},e.scale=function(n,r,a){if(e.isValid()){var i=[].concat(t.bounds);return n>=0?(i[0]*=n,i[1]*=n):(i[0]=n*t.bounds[1],i[1]=n*t.bounds[0]),r>=0?(i[2]*=r,i[3]*=r):(i[2]=r*t.bounds[3],i[3]=r*t.bounds[2]),a>=0?(i[4]*=a,i[5]*=a):(i[4]=a*t.bounds[5],i[5]=a*t.bounds[4]),t.bounds=i,!0}return!1}}(e,t)}var M=r.a.newInstance(y,"vtkBoundingBox");t.a=Object.assign({newInstance:M,extend:y},h)},function(e,t,n){"use strict";n.d(t,"b",function(){return r}),n.d(t,"a",function(){return a});var r={UNIFORM:0,DATA_OBJECT_FIELD:0,COORDINATE:1,POINT_DATA:1,POINT:2,POINT_FIELD_DATA:2,CELL:3,CELL_FIELD_DATA:3,VERTEX:4,VERTEX_FIELD_DATA:4,EDGE:5,EDGE_FIELD_DATA:5,ROW:6,ROW_DATA:6},a={FIELD_ASSOCIATION_POINTS:0,FIELD_ASSOCIATION_CELLS:1,FIELD_ASSOCIATION_NONE:2,FIELD_ASSOCIATION_POINTS_THEN_CELLS:3,FIELD_ASSOCIATION_VERTICES:4,FIELD_ASSOCIATION_EDGES:5,FIELD_ASSOCIATION_ROWS:6,NUMBER_OF_ASSOCIATIONS:7};t.c={FieldDataTypes:r,FieldAssociations:a}},function(e,t,n){"use strict";var r=n(40),a=n(108),i=n(64),o=n(184),s=n(57);function u(e){return e}function l(e,t){for(var n=0;n1;)try{return c.stringifyByChunk(e,r,n)}catch(e){n=Math.floor(n/2)}return c.stringifyByChar(e)}function f(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,u,n),a.a.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkPoints"),e.getNumberOfPoints=e.getNumberOfTuples,e.setNumberOfPoints=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;e.getNumberOfPoints()!==n&&(t.size=n*r,t.values=new window[t.dataType](t.size),e.setNumberOfComponents(r),e.modified())},e.setPoint=function(e){for(var n=e*t.numberOfComponents,r=0;r0&&void 0!==arguments[0]&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;return arguments.length>2&&void 0!==arguments[2]&&arguments[2],new Promise(function(t,n){var r=f(p(e));null===r?n(new Error("No such JSON ".concat(e))):t(JSON.parse(r))})},fetchText:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e=arguments.length>1?arguments[1]:void 0;return arguments.length>2&&void 0!==arguments[2]&&arguments[2],new Promise(function(t,n){var r=f(e);null===r?n(new Error("No such text ".concat(e))):t(r)})},fetchArray:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(function(o,g){var m=p([t,n.ref.basepath,a.compression?"".concat(n.ref.id,".gz"):n.ref.id].join("/")),h=f(m);if(null===h)g(new Error("No such array ".concat(m)));else{if("string"===n.dataType){var v=atob(h);a.compression&&(v=i.a.inflate(v,{to:"string"})),n.values=JSON.parse(v)}else{var y=Object(r.toByteArray)(h);n.buffer=new ArrayBuffer(y.length),new Uint8Array(n.buffer).set(y),a.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=i.a.inflate(new Uint8Array(n.buffer),{to:"string"}):n.buffer=i.a.inflate(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(s.a.ENDIANNESS!==n.ref.encode&&s.a.ENDIANNESS&&(c("Swap bytes of ".concat(n.name)),s.a.swapBytes(n.buffer,u.a[n.dataType])),n.values=new window[n.dataType](n.buffer)),n.values.length!==n.size&&l("Error in FetchArray: ".concat(n.name," does not have the proper array size. Got ").concat(n.values.length,", instead of ").concat(n.size))}delete n.ref,0==--d&&e.invokeBusy&&e.invokeBusy(!1),e.modified&&e.modified(),o(n)}})}},m=o.a.vtkErrorMacro,h=o.a.vtkDebugMacro,v=0;var y={fetchArray:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.ref&&!n.ref.pending?new Promise(function(a,o){var l=new XMLHttpRequest,c=[t,n.ref.basepath,r.compression?"".concat(n.ref.id,".gz"):n.ref.id].join("/");l.onreadystatechange=function(t){1===l.readyState&&(n.ref.pending=!0,1==++v&&e.invokeBusy&&e.invokeBusy(!0)),4===l.readyState&&(n.ref.pending=!1,200===l.status||0===l.status?(n.buffer=l.response,r.compression&&("string"===n.dataType||"JSON"===n.dataType?n.buffer=i.a.inflate(new Uint8Array(n.buffer),{to:"string"}):n.buffer=i.a.inflate(new Uint8Array(n.buffer)).buffer),"JSON"===n.ref.encode?n.values=JSON.parse(n.buffer):(s.a.ENDIANNESS!==n.ref.encode&&s.a.ENDIANNESS&&(h("Swap bytes of ".concat(n.name)),s.a.swapBytes(n.buffer,u.a[n.dataType])),n.values=new window[n.dataType](n.buffer)),n.values.length!==n.size&&m("Error in FetchArray: ".concat(n.name,", does not have the proper array size. Got ").concat(n.values.length,", instead of ").concat(n.size)),delete n.ref,0==--v&&e.invokeBusy&&e.invokeBusy(!1),e.modified&&e.modified(),a(n)):o({xhr:l,e:t}))},r&&r.progressCallback&&l.addEventListener("progress",r.progressCallback),l.open("GET",c,!0),l.responseType=r.compression||"string"!==n.dataType?"arraybuffer":"text",l.send()}):Promise.resolve(n)},fetchJSON:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(r,a){var o=new XMLHttpRequest;o.onreadystatechange=function(t){1===o.readyState&&1==++v&&e.invokeBusy&&e.invokeBusy(!0),4===o.readyState&&(0==--v&&e.invokeBusy&&e.invokeBusy(!1),200===o.status||0===o.status?n.compression?r(JSON.parse(i.a.inflate(new Uint8Array(o.response),{to:"string"}))):r(JSON.parse(o.responseText)):a({xhr:o,e:t}))},n&&n.progressCallback&&o.addEventListener("progress",n.progressCallback),o.open("GET",t,!0),o.responseType=n.compression?"arraybuffer":"text",o.send()})},fetchText:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n&&n.compression&&"gz"!==n.compression&&(m("Supported algorithms are: [gz]"),m("Unkown compression algorithm: ".concat(n.compression))),new Promise(function(r,a){var o=new XMLHttpRequest;o.onreadystatechange=function(t){1===o.readyState&&1==++v&&e.invokeBusy&&e.invokeBusy(!0),4===o.readyState&&(0==--v&&e.invokeBusy&&e.invokeBusy(!1),200===o.status||0===o.status?n.compression?r(i.a.inflate(new Uint8Array(o.response),{to:"string"})):r(o.responseText):a({xhr:o,e:t}))},n.progressCallback&&o.addEventListener("progress",n.progressCallback),o.open("GET",t,!0),o.responseType=n.compression?"arraybuffer":"text",o.send()})},fetchBinary:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){var a=new XMLHttpRequest;a.onreadystatechange=function(e){4===a.readyState&&(200===a.status||0===a.status?n(a.response):r({xhr:a,e:e}))},t&&t.progressCallback&&a.addEventListener("progress",t.progressCallback),a.open("GET",e,!0),a.responseType="arraybuffer",a.send()})}},M=n(85),A=n.n(M),b=o.a.vtkErrorMacro,w=o.a.vtkDebugMacro;var D={uint8array:function(e,t,n){return function(r){e.buffer=new ArrayBuffer(r.length),new Uint8Array(e.buffer).set(r),t&&("string"===e.dataType||"JSON"===e.dataType?e.buffer=i.a.inflate(new Uint8Array(e.buffer),{to:"string"}):e.buffer=i.a.inflate(new Uint8Array(e.buffer)).buffer),"JSON"===e.ref.encode?e.values=JSON.parse(e.buffer):(s.a.ENDIANNESS!==e.ref.encode&&s.a.ENDIANNESS&&(w("Swap bytes of ".concat(e.name)),s.a.swapBytes(e.buffer,u.a[e.dataType])),e.values=new window[e.dataType](e.buffer)),e.values.length!==e.size&&b("Error in FetchArray: ".concat(e.name," does not have the proper array size. Got ").concat(e.values.length,", instead of ").concat(e.size)),n()}},string:function(e,t,n){return function(r){e.values=t?JSON.parse(i.a.inflate(r,{to:"string"})):JSON.parse(r),n()}}};function T(e){return"/"===e[0]?e.substr(1):e}var C={create:function(e){var t=!1,n=0,r=new A.a,a=r;return r.loadAsync(e.zipContent).then(function(){t=!0;var n=[];r.forEach(function(e,t){-1!==e.indexOf("index.json")&&n.push(e)}),n.sort(function(e,t){return e.length-t.length});for(var i=n[0].split("/");i.length>1;){var o=i.shift();a=a.folder(o)}e.callback&&e.callback(r)}),{fetchArray:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(function(s,u){t||b("ERROR!!! zip not ready...");var l=T([r,i.ref.basepath,o.compression?"".concat(i.ref.id,".gz"):i.ref.id].join("/"));1==++n&&e.invokeBusy&&e.invokeBusy(!0);var c="string"!==i.dataType||o.compression?"uint8array":"string",d=D[c](i,o.compression,function(){delete i.ref,0==--n&&e.invokeBusy&&e.invokeBusy(!1),e.modified&&e.modified(),s(i)});a.file(l).async(c).then(d)})},fetchJSON:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=T(e);return t||b("ERROR!!! zip not ready..."),n.compression?"gz"===n.compression?a.file(r).async("uint8array").then(function(e){var t=i.a.inflate(e,{to:"string"});return Promise.resolve(JSON.parse(t))}):Promise.reject(new Error("Invalid compression")):a.file(r).async("string").then(function(e){return Promise.resolve(JSON.parse(e))})},fetchText:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=T(e);return t||b("ERROR!!! zip not ready..."),n.compression?"gz"===n.compression?a.file(r).async("uint8array").then(function(e){var t=i.a.inflate(e,{to:"string"});return Promise.resolve(t)}):Promise.reject(new Error("Invalid compression")):a.file(r).async("string").then(function(e){return Promise.resolve(e)})}}}},I={http:function(e){return y},zip:function(e){return C.create(e)},html:function(e){return g}};t.a={get:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"http",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return I[e](t)}}},function(e,t,n){"use strict";var r=n(0),a=n(19),i=a.b.Representation,o=a.b.Interpolation;function s(e){return function(){return r.a.vtkErrorMacro("vtkProperty::".concat(e," - NOT IMPLEMENTED"))}}var u={color:[1,1,1],ambientColor:[1,1,1],diffuseColor:[1,1,1],specularColor:[1,1,1],edgeColor:[0,0,0],ambient:0,diffuse:1,specular:0,specularPower:1,opacity:1,interpolation:o.GOURAUD,representation:i.SURFACE,edgeVisibility:!1,backfaceCulling:!1,frontfaceCulling:!1,pointSize:1,lineWidth:1,lighting:!0,shading:!1,materialName:null};function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,u,n),r.a.obj(e,t),r.a.setGet(e,t,["lighting","interpolation","ambient","diffuse","specular","specularPower","opacity","edgeVisibility","lineWidth","pointSize","backfaceCulling","frontfaceCulling","representation"]),r.a.setGetArray(e,t,["ambientColor","specularColor","diffuseColor","edgeColor"],3),function(e,t){t.classHierarchy.push("vtkProperty"),e.setColor=function(n,r,a){t.color[0]===n&&t.color[1]===r&&t.color[2]===a||(t.color[0]=n,t.color[1]=r,t.color[2]=a,e.modified()),e.setDiffuseColor(t.color),e.setAmbientColor(t.color),e.setSpecularColor(t.color)},e.computeCompositeColor=s("ComputeCompositeColor"),e.getColor=function(){var e=0;t.ambient+t.diffuse+t.specular>0&&(e=1/(t.ambient+t.diffuse+t.specular));for(var n=0;n<3;n++)t.color[n]=e*(t.ambient*t.ambientColor[n]+t.diffuse*t.diffuseColor[n]+t.specular*t.specularColor[n]);return[].concat(t.color)},e.addShaderVariable=s("AddShaderVariable"),e.setInterpolationToFlat=function(){return e.setInterpolation(o.FLAT)},e.setInterpolationToGouraud=function(){return e.setInterpolation(o.GOURAUD)},e.setInterpolationToPhong=function(){return e.setInterpolation(o.PHONG)},e.getInterpolationAsString=function(){return r.a.enumToString(o,t.interpolation)},e.setRepresentationToWireframe=function(){return e.setRepresentation(i.WIREFRAME)},e.setRepresentationToSurface=function(){return e.setRepresentation(i.SURFACE)},e.setRepresentationToPoints=function(){return e.setRepresentation(i.POINTS)},e.getRepresentationAsString=function(){return r.a.enumToString(i,t.representation)}}(e,t)}var c=r.a.newInstance(l,"vtkProperty");t.a=Object.assign({newInstance:c,extend:l},a.b)},function(e,t,n){"use strict";var r={};(0,n(39).assign)(r,n(164),n(167),n(102)),e.exports=r},function(e,t,n){"use strict";var r=n(2),a=n(0),i=1e-6;function o(e,t,n){var r=n[0]*(e[0]-t[0])+n[1]*(e[1]-t[1])+n[2]*(e[2]-t[2]);return Math.abs(r)}function s(e,t,n,a){var i=[];r.a.subtract(e,t,i);var o=r.a.dot(n,i);a[0]=e[0]-o*n[0],a[1]=e[1]-o*n[1],a[2]=e[2]-o*n[2]}function u(e,t,n){var a=r.a.dot(e,t),i=r.a.dot(t,t);0===i&&(i=1),n[0]=e[0]-a*t[0]/i,n[1]=e[1]-a*t[1]/i,n[2]=e[2]-a*t[2]/i}function l(e,t,n,a){var i=[];r.a.subtract(e,t,i);var o=r.a.dot(n,i),s=r.a.dot(n,n);0!==s?(a[0]=e[0]-o*n[0]/s,a[1]=e[1]-o*n[1]/s,a[2]=e[2]-o*n[2]/s):(a[0]=e[0],a[1]=e[1],a[2]=e[2])}function c(e,t,n,a){var o={intersection:!1,t:Number.MAX_VALUE,x:[]},s=[];r.a.subtract(t,e,s);var u=r.a.dot(a,n)-r.a.dot(a,e),l=r.a.dot(a,s);return(l<0?-l:l)<=(u<0?-u*i:u*i)?o:(o.t=u/l,o.x[0]=e[0]+o.t*s[0],o.x[1]=e[1]+o.t*s[1],o.x[2]=e[2]+o.t*s[2],o.intersection=o.t>=0&&o.t<=1,o)}var d={evaluate:function(e,t,n){return e[0]*(n[0]-t[0])+e[1]*(n[1]-t[1])+e[2]*(n[2]-t[2])},distanceToPlane:o,projectPoint:s,projectVector:u,generalizedProjectPoint:l,intersectWithLine:c};var f={normal:[0,0,1],origin:[0,0,0]};function p(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,f,n),a.a.obj(e,t),a.a.setGetArray(e,t,["normal","origin"],3),function(e,t){t.classHierarchy.push("vtkPlane"),e.distanceToPlane=function(e){return o(e,t.origin,t.normal)},e.projectPoint=function(e,n){s(e,t.origin,t.normal,n)},e.projectVector=function(e,n){u(e,t.normal,n)},e.push=function(e){if(0!==e)for(var n=0;n<3;n++)t.origin[n]+=e*t.normal[n]},e.generalizedProjectPoint=function(e,n){l(e,t.origin,t.normal,n)},e.evaluateFunction=function(e,n,r){return Array.isArray(e)?t.normal[0]*(e[0]-t.origin[0])+t.normal[1]*(e[1]-t.origin[1])+t.normal[2]*(e[2]-t.origin[2]):t.normal[0]*(e-t.origin[0])+t.normal[1]*(n-t.origin[1])+t.normal[2]*(r-t.origin[2])},e.evaluateGradient=function(e){return[t.normal[0],t.normal[1],t.normal[2]]},e.intersectWithLine=function(e,n){return c(e,n,t.origin,t.normal)}}(e,t)}var g=a.a.newInstance(p,"vtkPlane");t.a=Object.assign({newInstance:g,extend:p},d)},function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r={FLAT:0,GOURAUD:1,PHONG:2},a={POINTS:0,WIREFRAME:1,SURFACE:2},i=r;t.b={Shading:r,Representation:a,Interpolation:i}},function(e,t,n){"use strict";function r(){var e=new ArrayBuffer(4),t=new Uint8Array(e),n=new Uint32Array(e);return t[0]=161,t[1]=178,t[2]=195,t[3]=212,3569595041===n[0]?"LittleEndian":2712847316===n[0]?"BigEndian":null}var a=r();t.a={ENDIANNESS:a,getEndianness:r,swapBytes:function(e,t){if(!(t<2))for(var n=new Int8Array(e),r=n.length,a=[],i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,s,n),a.a.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkCellArray"),e.getNumberOfCells=function(e){return void 0===t.numberOfCells||e?(t.cellSizes=i(t.values),t.numberOfCells=t.cellSizes.length,t.numberOfCells):t.numberOfCells},e.getCellSizes=function(e){return void 0===t.cellSizes||e?(t.cellSizes=i(t.values),t.cellSizes):t.cellSizes};var n=e.setData;e.setData=function(e){n(e,1),t.numberOfCells=void 0,t.cellSizes=void 0}}(e,t)}var l=r.a.newInstance(u,"vtkCellArray");t.a=Object.assign({newInstance:l,extend:u},o)},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r={DEFAULT:0,USE_POINT_DATA:1,USE_CELL_DATA:2,USE_POINT_FIELD_DATA:3,USE_CELL_FIELD_DATA:4,USE_FIELD_DATA:5};t.b={ColorMode:{DEFAULT:0,MAP_SCALARS:1,DIRECT_SCALARS:2},GetArray:{BY_ID:0,BY_NAME:1},ScalarMode:r}},function(e,t,n){var r=n(159);"string"==typeof r&&(r=[[e.i,r,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n(55)(r,a);r.locals&&(e.exports=r.locals)},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,n){"use strict";function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},e.exports=r},function(e,t,n){"use strict";var r=n(0);function a(e){return function(){return r.a.vtkErrorMacro("vtkProp::".concat(e," - NOT IMPLEMENTED"))}}var i={visibility:!0,pickable:!0,dragable:!0,useBounds:!0,allocatedRenderTime:10,estimatedRenderTime:0,savedEstimatedRenderTime:0,renderTimeMultiplier:1,paths:null,textures:[]};function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,i,n),r.a.obj(e,t),r.a.get(e,t,["estimatedRenderTime","allocatedRenderTime"]),r.a.setGet(e,t,["visibility","pickable","dragable","useBounds","renderTimeMultiplier"]),function(e,t){t.classHierarchy.push("vtkProp"),e.getMTime=function(){for(var e=t.mtime,n=0;ne&&(e=r)}return e},e.getNestedProps=function(){return null},e.getActors=function(){return[]},e.getActors2D=function(){return[]},e.getVolumes=function(){return[]},e.pick=a("pick"),e.hasKey=a("hasKey"),e.getRedrawMTime=function(){return t.mtime},e.setEstimatedRenderTime=function(e){t.estimatedRenderTime=e,t.savedEstimatedRenderTime=e},e.restoreEstimatedRenderTime=function(){t.estimatedRenderTime=t.savedEstimatedRenderTime},e.addEstimatedRenderTime=function(e){t.estimatedRenderTime+=e},e.setAllocatedRenderTime=function(e){t.allocatedRenderTime=e,t.savedEstimatedRenderTime=t.estimatedRenderTime,t.estimatedRenderTime=0},e.getSupportsSelection=function(){return!1},e.getTextures=function(){return t.textures},e.hasTexture=function(e){return-1!==t.textures.indexOf(e)},e.addTexture=function(n){n&&!e.hasTexture(n)&&(t.textures=t.textures.concat(n),e.modified())},e.removeTexture=function(n){var r=t.textures.filter(function(e){return e!==n});t.textures.length!==r.length&&(t.textures=r,e.modified())},e.removeAllTextures=function(){t.textures=[],e.modified()}}(e,t)}var s=r.a.newInstance(o,"vtkProp");t.a={newInstance:s,extend:o}},function(e,t,n){var r=n(161);"string"==typeof r&&(r=[[e.i,r,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n(55)(r,a);r.locals&&(e.exports=r.locals)},function(e,t,n){var r=n(163);"string"==typeof r&&(r=[[e.i,r,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n(55)(r,a);r.locals&&(e.exports=r.locals)},function(e,t,n){"use strict";t.byteLength=function(e){return 3*e.length/4-l(e)},t.toByteArray=function(e){var t,n,r,o,s,u=e.length;o=l(e),s=new i(3*u/4-o),n=o>0?u-4:u;var c=0;for(t=0;t>16&255,s[c++]=r>>8&255,s[c++]=255&r;2===o?(r=a[e.charCodeAt(t)]<<2|a[e.charCodeAt(t+1)]>>4,s[c++]=255&r):1===o&&(r=a[e.charCodeAt(t)]<<10|a[e.charCodeAt(t+1)]<<4|a[e.charCodeAt(t+2)]>>2,s[c++]=r>>8&255,s[c++]=255&r);return s},t.fromByteArray=function(e){for(var t,n=e.length,a=n%3,i="",o=[],s=0,u=n-a;su?u:s+16383));1===a?(t=e[n-1],i+=r[t>>2],i+=r[t<<4&63],i+="=="):2===a&&(t=(e[n-2]<<8)+e[n-1],i+=r[t>>10],i+=r[t>>4&63],i+=r[t<<2&63],i+="=");return o.push(i),o.join("")};for(var r=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function c(e,t,n){for(var a,i,o=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":n(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";var r=n(0);var a={repeat:!1,interpolate:!1,edgeClamp:!1,image:null,imageLoaded:!1};function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,a,n),r.a.obj(e,t),r.a.algo(e,t,6,0),r.a.get(e,t,["imageLoaded"]),r.a.setGet(e,t,["repeat","edgeClamp","interpolate","image"]),function(e,t){t.classHierarchy.push("vtkTexture"),e.imageLoaded=function(){t.image.removeEventListener("load",e.imageLoaded),t.imageLoaded=!0,e.modified()},e.setImage=function(n){t.image!==n&&(null!==n&&(e.setInputData(null),e.setInputConnection(null)),t.image=n,t.imageLoaded=!1,n.complete?e.imageLoaded():n.addEventListener("load",e.imageLoaded),e.modified())}}(e,t)}var o=r.a.newInstance(i,"vtkTexture");t.a={newInstance:o,extend:i}},function(e,t,n){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var r=n(32),a=n(173),i=n(103);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return V(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function h(e,t,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,a);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,a){var i,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){var c=-1;for(i=n;is&&(n=s-u),i=n;i>=0;i--){for(var d=!0,f=0;fa&&(r=a):r=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var o=0;o>8,a=n%256,i.push(a),i.push(r);return i}(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],a=t;a239?4:l>223?3:l>191?2:1;if(a+d<=n)switch(d){case 1:l<128&&(c=l);break;case 2:128==(192&(i=e[a+1]))&&(u=(31&l)<<6|63&i)>127&&(c=u);break;case 3:i=e[a+1],o=e[a+2],128==(192&i)&&128==(192&o)&&(u=(15&l)<<12|(63&i)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:i=e[a+1],o=e[a+2],s=e[a+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&i)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),a+=d}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return S(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,a){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===a&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(a>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(i,o),l=this.slice(r,a),c=e.slice(t,n),d=0;da)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return M(this,e,t,n);case"ascii":return A(this,e,t,n);case"latin1":case"binary":return b(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function x(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;ar)&&(n=r);for(var a="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,a,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function P(e,t,n,r){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-n,2);a>>8*(r?a:1-a)}function k(e,t,n,r){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-n,4);a>>8*(r?a:3-a)&255}function R(e,t,n,r,a,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(e,t,n,r,i){return i||R(e,0,n,4),a.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return i||R(e,0,n,8),a.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)r+=this[e+--t]*a;return r},u.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=this[e],a=1,i=0;++i=(a*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=t,a=1,i=this[e+--r];r>0&&(a*=256);)i+=this[e+--r]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),a.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),a.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),a.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),a.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||L(this,e,t,n,Math.pow(2,8*n)-1,0);var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):k(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):k(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);L(this,e,t,n,a-1,-a)}var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);L(this,e,t,n,a-1,-a)}var i=n-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):k(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):k(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--a)e[a+t]=this[a+n];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&i.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function F(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function U(e,t,n,r){for(var a=0;a=t.length||a>=e.length);++a)t[a+n]=e[a];return a}}).call(this,n(33))},function(e,t,n){"use strict";var r=n(0),a=n(3),i=n(38),o=n(25),s=i.b.ScalarMappingTarget,u=i.b.VectorMode,l=a.a.VtkDataTypes,c=o.b.ColorMode,d=r.a.vtkErrorMacro;function f(e){return e}function p(e){return Math.floor(255*e+.5)}var g={alpha:1,vectorComponent:0,vectorSize:-1,vectorMode:u.COMPONENT,mappingRange:null,annotationArray:null,annotatedValueMap:null,indexedLookup:!1};function m(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,g,n),r.a.obj(e,t),t.mappingRange=[0,255],t.annotationArray=[],t.annotatedValueMap=[],r.a.setGet(e,t,["vectorSize","vectorComponent","vectorMode","alpha","indexedLookup"]),r.a.setArray(e,t,["mappingRange"],2),r.a.getArray(e,t,["mappingRange"]),function(e,t){t.classHierarchy.push("vtkScalarsToColors"),e.setVectorModeToMagnitude=function(){return e.setVectorMode(u.MAGNITUDE)},e.setVectorModeToComponent=function(){return e.setVectorMode(u.COMPONENT)},e.setVectorModeToRGBColors=function(){return e.setVectorMode(u.RGBCOLORS)},e.build=function(){},e.isOpaque=function(){return!0},e.setAnnotations=function(n,r){if(!(n&&!r||!n&&r))if(n&&r&&n.getNumberOfTuples()!==r.getNumberOfTuples())d("Values and annotations do not have the same number of tuples so ignoring");else{if(t.annotationArray=[],r&&n)for(var a=r.getNumberOfTuples(),i=0;i=0?t.annotationArray[a].annotation!==r&&(t.annotationArray[a].annotation=r,i=!0):(t.annotationArray.push({value:n,annotation:r}),a=t.annotationArray.length-1,i=!0),i&&(e.updateAnnotatedValueMap(),e.modified()),a},e.getNumberOfAnnotatedValues=function(){return t.annotationArray.length},e.getAnnotatedValue=function(e){return e<0||e>=t.annotationArray.length?null:t.annotationArray[e].value},e.getAnnotation=function(e){return void 0===t.annotationArray[e]?null:t.annotationArray[e].annotation},e.getAnnotatedValueIndex=function(n){return t.annotationArray.length?e.checkForAnnotatedValue(n):-1},e.removeAnnotation=function(n){var r=e.checkForAnnotatedValue(n),a=r>=0;return a&&(t.annotationArray.splice(r,1),e.updateAnnotatedValueMap(),e.modified()),a},e.resetAnnotations=function(){t.annotationArray=[],t.annotatedValueMap=[],e.modified()},e.getAnnotationColor=function(n,r){if(t.indexedLookup){var a=e.getAnnotatedValueIndex(n);e.getIndexedColor(a,r)}else e.getColor(parseFloat(n),r),r[3]=1},e.checkForAnnotatedValue=function(t){return e.getAnnotatedValueIndexInternal(t)},e.getAnnotatedValueIndexInternal=function(e){if(void 0!==t.annotatedValueMap[e]){var n=t.annotationArray.length;return t.annotatedValueMap[e]%n}return-1},e.getIndexedColor=function(e,t){t[0]=0,t[1]=0,t[2]=0,t[3]=0},e.updateAnnotatedValueMap=function(){t.annotatedValueMap=[];for(var e=t.annotationArray.length,n=0;n1?e.mapVectorsThroughTable(t,o,s.RGBA,-1,-1):(f<0&&(f=0),f>=i&&(f=i-1),e.mapScalarsThroughTable(t,o,s.RGBA,f))}return o},e.mapVectorsToMagnitude=function(e,t,n){for(var r=e.getNumberOfTuples(),a=e.getNumberOfComponents(),i=t.getData(),o=e.getData(),s=0;s=d&&(c=d-1)):(-1===l&&(l=e.getVectorSize()),l<=0?(c=0,l=d):(c<0&&(c=0),c>=d&&(c=d-1),c+l>d&&(l=d-c)),s!==u.MAGNITUDE||1!==d&&1!==l||(s=u.COMPONENT));var f=0;switch(c>0&&(f=c),s){case u.COMPONENT:e.mapScalarsThroughTable(t,n,r,f);break;default:case u.MAGNITUDE:var p=a.a.newInstance({numberOfComponents:1,values:new Float32Array(t.getNumberOfTuples())});e.mapVectorsToMagnitude(t,p,l),e.mapScalarsThroughTable(p,n,r,0);break;case u.RGBCOLORS:}},e.luminanceToRGBA=function(e,t,n,r){for(var a=r(n),i=t.getData(),o=e.getData(),s=i.length,u=0,l=0;l=1&&n.getDataType()===l.UNSIGNED_CHAR)return n;var s=a.a.newInstance({numberOfComponents:4,empty:!0,size:4*i,dataType:l.UNSIGNED_CHAR});if(i<=0)return s;o=(o=o>0?o:0)<1?o:1;var u=f;switch(n.getDataType()!==l.FLOAT&&n.getDataType()!==l.DOUBLE||(u=p),r){case 1:e.luminanceToRGBA(s,n,o,u);break;case 2:e.luminanceAlphaToRGBA(s,n,u);break;case 3:e.rGBToRGBA(s,n,o,u);break;case 4:e.rGBAToRGBA(s,n,o,u);break;default:return d("Cannot convert colors"),null}return s},e.usingLogScale=function(){return!1},e.getNumberOfAvailableColors=function(){return 16777216},e.setRange=function(t,n){return e.setMappingRange(t,n)},e.getRange=function(t,n){return e.getMappingRange()}}(e,t)}var h=r.a.newInstance(m,"vtkScalarsToColors");t.a=Object.assign({newInstance:h,extend:m},i.b)},function(e,t,n){"use strict";var r=n(0),a=n(2),i=n(36),o=n(38),s=0,u=1,l=2;var c={numberOfColors:256,hueRange:[0,.66667],saturationRange:[1,1],valueRange:[1,1],alphaRange:[1,1],nanColor:[.5,0,0,1],belowRangeColor:[0,0,0,1],aboveRangeColor:[1,1,1,1],useAboveRangeColor:!1,useBelowRangeColor:!1,alpha:1};function d(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,c,n),i.a.extend(e,t,n),t.table||(t.table=[]),t.buildTime={},r.a.obj(t.buildTime),t.opaqueFlagBuildTime={},r.a.obj(t.opaqueFlagBuildTime,{mtime:0}),r.a.get(e,t,["buildTime"]),r.a.setGet(e,t,["numberOfColors","useAboveRangeColor","useBelowRangeColor"]),r.a.setArray(e,t,["alphaRange","hueRange","saturationRange","valueRange"],2),r.a.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),r.a.getArray(e,t,["hueRange","saturationRange","valueRange","alphaRange","nanColor","belowRangeColor","aboveRangeColor"]),function(e,t){t.classHierarchy.push("vtkLookupTable"),e.isOpaque=function(){if(t.opaqueFlagBuildTime.getMTime()t.range[1]?t.maxIndex+u+1.5:(n=(e+t.shift)*t.scale)e[0]&&(t.scale=(t.maxIndex+1)/(e[1]-e[0]))},e.mapScalarsThroughTable=function(n,r,a,i){var s=e.linearLookup;t.indexedLookup&&(s=e.indexedLookupFunction);var u=e.getMappingRange(),l={maxIndex:e.getNumberOfColors()-1,range:u,shift:0,scale:0};e.lookupShiftAndScale(u,l);var c=e.getAlpha(),d=n.getNumberOfTuples(),f=n.getNumberOfComponents(),p=r.getData(),g=n.getData();if(c>=1){if(a===o.a.RGBA)for(var m=0;mt.buildTime.getMTime())&&e.forceBuild()}}(e,t)}var f=r.a.newInstance(d,"vtkLookupTable");t.a=Object.assign({newInstance:f,extend:d})},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r={LUMINANCE:1,LUMINANCE_ALPHA:2,RGB:3,RGBA:4};t.b={VectorMode:{MAGNITUDE:0,COMPONENT:1,RGBCOLORS:2},ScalarMappingTarget:r}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(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 n=t.shift();if(n){if("object"!==r(n))throw new TypeError(n+"must be non-object");for(var a in n)i(n,a)&&(e[a]=n[a])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,n,r,a){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),a);else for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,u,n),r.a.obj(e,t),r.a.setGet(e,t,s),function(e,t){t.classHierarchy.push("vtkDataSet"),s.forEach(function(e){t[e]?t[e]=Object(a.a)(t[e]):t[e]=i.a.newInstance()});var n=e.shallowCopy;e.shallowCopy=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),s.forEach(function(n){t[n]=i.a.newInstance(),t[n].shallowCopy(e.getReferenceByName(n))})}}(e,t)}var c=r.a.newInstance(l,"vtkDataSet");t.a=Object.assign({newInstance:c,extend:l},o.c)},function(e,t,n){"use strict";var r=n(1),a=n(0),i=n(11),o=n(2),s=n(29);var u={origin:[0,0,0],position:[0,0,0],rotation:null,scale:[1,1,1],bounds:[1,-1,1,-1,1,-1],userMatrix:null,userMatrixMTime:null,cachedProp3D:null,isIdentity:!0,matrixMTime:null};function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,u,n),s.a.extend(e,t,n),t.matrixMTime={},a.a.obj(t.matrixMTime),a.a.get(e,t,["bounds","isIdentity"]),a.a.setGetArray(e,t,["origin","position","orientation","scale"],3),t.matrix=r.c.create(),t.rotation=r.c.create(),t.userMatrix=r.c.create(),t.transform=null,function(e,t){t.classHierarchy.push("vtkProp3D"),e.addPosition=function(n){t.position=t.position.map(function(e,t){return e+n[t]}),e.modified()},e.getOrientationWXYZ=function(){var e=r.d.create();r.c.getRotation(e,t.rotation);var n=r.e.create(),a=r.d.getAxisAngle(n,e);return[o.a.degreesFromRadians(a),n[0],n[1],n[2]]},e.rotateX=function(n){0!==n&&(r.c.rotateX(t.rotation,t.rotation,o.a.radiansFromDegrees(n)),e.modified())},e.rotateY=function(n){0!==n&&(r.c.rotateY(t.rotation,t.rotation,o.a.radiansFromDegrees(n)),e.modified())},e.rotateZ=function(n){0!==n&&(r.c.rotateZ(t.rotation,t.rotation,o.a.radiansFromDegrees(n)),e.modified())},e.rotateWXYZ=function(n,a,i,s){if(0!==n&&(0!==a||0!==i||0!==s)){var u=o.a.radiansFromDegrees(n),l=r.d.create();r.d.setAxisAngle(l,[a,i,s],u);var c=r.c.create();r.c.fromQuat(c,l),r.c.multiply(t.rotation,t.rotation,c),e.modified()}},e.setUserMatrix=function(n){r.c.copy(t.userMatrix,n),e.modified()},e.getMatrix=function(){return e.computeMatrix(),t.matrix},e.computeMatrix=function(){if(e.getMTime()>t.matrixMTime.getMTime()){r.c.identity(t.matrix),t.userMatrix&&r.c.multiply(t.matrix,t.matrix,t.userMatrix),r.c.translate(t.matrix,t.matrix,t.origin),r.c.translate(t.matrix,t.matrix,t.position),r.c.multiply(t.matrix,t.matrix,t.rotation),r.c.scale(t.matrix,t.matrix,t.scale),r.c.translate(t.matrix,t.matrix,[-t.origin[0],-t.origin[1],-t.origin[2]]),r.c.transpose(t.matrix,t.matrix),t.isIdentity=!0;for(var n=0;n<4;++n)for(var a=0;a<4;++a)(n===a?1:0)!==t.matrix[n+4*a]&&(t.isIdentity=!1);t.matrixMTime.modified()}},e.getCenter=function(){return i.a.getCenter(t.bounds)},e.getLength=function(){return i.a.getLength(t.bounds)},e.getXRange=function(){return i.a.getXRange(t.bounds)},e.getYRange=function(){return i.a.getYRange(t.bounds)},e.getZRange=function(){return i.a.getZRange(t.bounds)},e.getUserMatrix=function(){return t.userMatrix},e.onModified(function(){e.computeMatrix()})}(e,t)}var c=a.a.newInstance(l,"vtkProp3D");t.a={newInstance:c,extend:l}},function(e,t){e.exports="//VTK::System::Dec\n\n/*=========================================================================\n\n Program: Visualization Toolkit\n Module: vtkPolyDataFS.glsl\n\n Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n All rights reserved.\n See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n\n This software is distributed WITHOUT ANY WARRANTY; without even\n the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n PURPOSE. See the above copyright notice for more information.\n\n=========================================================================*/\n// Template for the polydata mappers fragment shader\n\nuniform int PrimitiveIDOffset;\n\n// VC position of this fragment\n//VTK::PositionVC::Dec\n\n// optional color passed in from the vertex shader, vertexColor\n//VTK::Color::Dec\n\n// optional surface normal declaration\n//VTK::Normal::Dec\n\n// extra lighting parameters\n//VTK::Light::Dec\n\n// Texture coordinates\n//VTK::TCoord::Dec\n\n// picking support\n//VTK::Picking::Dec\n\n// Depth Peeling Support\n//VTK::DepthPeeling::Dec\n\n// clipping plane vars\n//VTK::Clip::Dec\n\n// the output of this shader\n//VTK::Output::Dec\n\n// Apple Bug\n//VTK::PrimID::Dec\n\n// handle coincident offsets\n//VTK::Coincident::Dec\n\n//VTK::ZBuffer::Dec\n\nvoid main()\n{\n // VC position of this fragment. This should not branch/return/discard.\n //VTK::PositionVC::Impl\n\n // Place any calls that require uniform flow (e.g. dFdx) here.\n //VTK::UniformFlow::Impl\n\n // Set gl_FragDepth here (gl_FragCoord.z by default)\n //VTK::Depth::Impl\n\n // Early depth peeling abort:\n //VTK::DepthPeeling::PreColor\n\n // Apple Bug\n //VTK::PrimID::Impl\n\n //VTK::Clip::Impl\n\n //VTK::Color::Impl\n\n // Generate the normal if we are not passed in one\n //VTK::Normal::Impl\n\n //VTK::Light::Impl\n\n //VTK::TCoord::Impl\n\n if (gl_FragData[0].a <= 0.0)\n {\n discard;\n }\n\n //VTK::DepthPeeling::Impl\n\n //VTK::Picking::Impl\n\n // handle coincident offsets\n //VTK::Coincident::Impl\n\n //VTK::ZBuffer::Impl\n}\n"},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=d;var a=n(89),i=n(56);i.inherits=n(50);var o=n(105),s=n(90);i.inherits(d,o);for(var u=r(s.prototype),l=0;l2&&void 0!==arguments[2]?arguments[2]:null,a=r(e),i=t.exec(a);if(!i)return{text:a};var o=i.index+i[0].length,s=a.substring(0,o),u=n?n.exec(a):null;return u?{text:s+a.substr(u.index),binaryBuffer:e.slice(o,u.index)}:{text:s,binaryBuffer:e.slice(o)}}}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,n){"use strict";for(var r=n(13),a=n(40),i=n(64),o=n(28),s=new Array(256),u=0;u<256;u++)s[u]=u>=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;s[254]=s[254]=1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function c(){o.call(this,"utf-8 encode")}t.utf8encode=function(e){return a.nodebuffer?i.newBuffer(e,"utf-8"):function(e){var t,n,r,i,o,s=e.length,u=0;for(i=0;i>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t}(e)},t.utf8decode=function(e){return a.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,a,i,o=e.length,u=new Array(2*o);for(n=0,t=0;t4)u[n++]=65533,t+=i-1;else{for(a&=2===i?31:3===i?15:7;i>1&&t1?u[n++]=65533:a<65536?u[n++]=a:(a-=65536,u[n++]=55296|a>>10&1023,u[n++]=56320|1023&a)}return u.length!==n&&(u.subarray?u=u.subarray(0,n):u.length=n),r.applyFromCharCode(u)}(e=r.transformTo(a.uint8array?"uint8array":"array",e))},r.inherits(l,o),l.prototype.processChunk=function(e){var n=r.transformTo(a.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var i=n;(n=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),n.set(i,this.leftOver.length)}else n=this.leftOver.concat(n);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0?t:0===n?t:n+s[e[n]]>t?n:t}(n),u=n;o!==n.length&&(a.uint8array?(u=n.subarray(0,o),this.leftOver=n.subarray(o,n.length)):(u=n.slice(0,o),this.leftOver=n.slice(o,n.length))),this.push({data:t.utf8decode(u),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},t.Utf8DecodeWorker=l,r.inherits(c,o),c.prototype.processChunk=function(e){this.push({data:t.utf8encode(e.data),meta:e.meta})},t.Utf8EncodeWorker=c},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(a)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=arguments[3];return new Promise(function(i,o){var s=n._messageId++;n._messages.set(s,[i,o,a]),n._worker.postMessage([s,t,e],r||[])})}},{key:"postMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2];return new Promise(function(a,i){var o=t._messageId++;t._messages.set(o,[a,i,r]),t._worker.postMessage([o,e],n||[])})}},{key:"emit",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,a,n),r.a.obj(e,t),r.a.algo(e,t,1,0),t.clippingPlanes||(t.clippingPlanes=[]),function(e,t){e.update=function(){e.getInputData()},e.addClippingPlane=function(e){"vtkPlane"===e.getClassName()&&t.clippingPlanes.push(e)},e.getNumberOfClippingPlanes=function(){return t.clippingPlanes.length},e.removeAllClippingPlanes=function(){t.clippingPlanes.length=0},e.removeClippingPlane=function(e){e<0||e>=6||t.clippingPlanes.splice(e,1)},e.getClippingPlanes=function(){return t.clippingPlanes},e.setClippingPlanes=function(t){if(t)if(Array.isArray(t))for(var n=t.length,r=0;r=0&&c.splice(t,1)}function h(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var r=function(){0;return n.nc}();r&&(e.attrs.nonce=r)}return v(t,e.attrs),g(e,t),t}function v(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}function y(e,t){var n,r,a,i;if(t.transform&&e.css){if(!(i="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=i}if(t.singleton){var o=l++;n=u||(u=h(t)),r=b.bind(null,n,o,!1),a=b.bind(null,n,o,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",v(t,e.attrs),g(e,t),t}(t),r=function(e,t,n){var r=n.css,a=n.sourceMap,i=void 0===t.convertToAbsoluteUrls&&a;(t.convertToAbsoluteUrls||i)&&(r=d(r));a&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */");var o=new Blob([r],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(o),s&&URL.revokeObjectURL(s)}.bind(null,n,t),a=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=h(t),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),a=function(){m(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else a()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=o()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return f(n,t),function(e){for(var r=[],a=0;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,p,n),a.a.obj(e,t),a.a.get(e,t,["enableArray","fetchGzip","url","baseURL","dataAccessHelper"]),a.a.set(e,t,["dataAccessHelper","progressCallback"]),a.a.getArray(e,t,["arrays"]),a.a.algo(e,t,0,1),a.a.event(e,t,"busy"),function(e,t){function n(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchArray(e,t.baseURL,n,r)}t.classHierarchy.push("vtkHttpDataSetReader"),t.output[0]=Object(r.a)({vtkClass:"vtkPolyData"}),t.dataAccessHelper||(t.dataAccessHelper=l),e.updateMetadata=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return"zip"===t.compression?new Promise(function(a,o){l.fetchBinary(t.url).then(function(s){t.dataAccessHelper=i.a.get("zip",{zipContent:s,callback:function(i){t.baseURL="",t.dataAccessHelper.fetchJSON(e,"index.json").then(function(i){f(e,t,i,n,a,o,r)},function(e){o(e)})}})},function(e){o(e)})}):new Promise(function(a,i){t.dataAccessHelper.fetchJSON(e,t.url).then(function(o){f(e,t,o,n,a,i,r)},function(e){i(e)})})},e.setUrl=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(-1!==n.indexOf("index.json")||r.fullpath){t.url=n;var a=n.split("/");a.pop(),t.baseURL=a.join("/")}else t.baseURL=n,t.url="".concat(n,"/index.json");return t.compression=r.compression,e.updateMetadata(!!r.loadData)},e.loadData=function(){var r=t.dataset,i=t.arrays.filter(function(e){return e.enable}).filter(function(e){return e.array.ref}).map(function(e){return e.array});return new Promise(function(o,s){var u=function(e){s(e)};!function s(){if(i.length){var l=t.progressCallback,d=t.fetchGzip?"gz":null;n(i.pop(),{compression:d,progressCallback:l}).then(s,u)}else r&&(t.arrays.filter(function(e){return e.registration}).forEach(function(e){var t=c[e.array.vtkClass].newInstance(e.array);r["get".concat(a.a.capitalize(e.location))]()[e.registration](t),delete e.registration}),r.modified(),o(e,r))}()})},e.requestData=function(e,t){},e.enableArray=function(e,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=t.arrays.filter(function(t){return t.name===n&&t.location===e});1===a.length&&(a[0].enable=r)},e.isBusy=function(){return!!t.requestCount}}(e,t),void 0===t.progressCallback&&(t.progressCallback=null)}var m=a.a.newInstance(g,"vtkHttpDataSetReader");t.a={newInstance:m,extend:g}},function(e,t,n){"use strict";var r=n(0),a=n(8),i=n(3);var o={arrays:[],copyFieldFlags:[],doCopyAllOn:!0,doCopyAllOff:!1};function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,o,n),r.a.obj(e,t),function(e,t){t.classHierarchy.push("vtkFieldData");var n=e.getState;t.arrays&&(t.arrays=t.arrays.map(function(e){return{data:Object(a.a)(e.data)}})),e.initialize=function(){e.initializeFields(),e.copyAllOn(),e.clearFieldFlags()},e.initializeFields=function(){t.arrays=[],t.copyFieldFlags={},e.modified()},e.copyStructure=function(n){e.initializeFields(),t.copyFieldFlags=n.getCopyFieldFlags().map(function(e){return e}),t.arrays=n.arrays().map(function(e){return{array:e}})},e.getNumberOfArrays=function(){return t.arrays.length},e.getNumberOfActiveArrays=function(){return t.arrays.length},e.addArray=function(e){return t.arrays=[].concat(t.arrays,{data:e}),t.arrays.length-1},e.removeAllArrays=function(){t.arrays=[]},e.removeArray=function(e){t.arrays=t.arrays.filter(function(t){return e!==t.data.getName()})},e.removeArrayByIndex=function(e){t.arrays=t.arrays.filter(function(t,n){return n!==e})},e.getArrays=function(){return t.arrays.map(function(e){return e.data})},e.getArray=function(t){return"number"==typeof t?e.getArrayByIndex(t):e.getArrayByName(t)},e.getArrayByName=function(e){return t.arrays.reduce(function(t,n,r){return n.data.getName()===e?n.data:t},null)},e.getArrayWithIndex=function(e){return t.arrays.reduce(function(t,n,r){return n.data&&n.data.getName()===e?{array:n.data,index:r}:t},{array:null,index:-1})},e.getArrayByIndex=function(e){return e>=0&&e=0},e.getArrayName=function(e){var n=t.arrays[e];return n?n.data.getName():""},e.getCopyFieldFlags=function(){return t.copyFieldFlags},e.getFlag=function(e){return t.copyFieldFlags[e]},e.passData=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n.getArrays().forEach(function(n){var o=e.getFlag(n.getName());if(!1!==o&&(!t.doCopyAllOff||!0===o)&&n){var s=e.getArrayByName(n.getName());if(s){if(n.getNumberOfComponents()===s.getNumberOfComponents())if(r>-1&&r-1?a:r;s.setTuple(u,n.getTuple(r))}else for(var l=0;ln.getNumberOfTuples())e.addArray(n);else{var c=n.getNumberOfComponents(),d=n.getNumberOfValues(),f=a>-1?a:r;de?t.data.getMTime():e},t.mtime)},e.getNumberOfComponents=function(){return t.arrays.reduce(function(e,t){return e+t.data.getNumberOfComponents()},0)},e.getNumberOfTuples=function(){return t.arrays.length>0?t.arrays[0].getNumberOfTuples():0},e.getState=function(){var e=n();return e.arrays=t.arrays.map(function(e){return{data:e.data.getState()}}),e}}(e,t)}var u={newInstance:r.a.newInstance(s,"vtkFieldData"),extend:s},l=n(21),c=l.c.AttributeTypes,d=l.c.AttributeCopyOperations,f=r.a.vtkWarningMacro;var p={activeScalars:-1,activeVectors:-1,activeTensors:-1,activeNormals:-1,activeTCoords:-1,activeGlobalIds:-1,activePedigreeIds:-1};function g(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,p,n),u.extend(e,t,n),r.a.setGet(e,t,["activeScalars","activeNormals","activeTCoords","activeVectors","activeTensors","activeGlobalIds","activePedigreeIds"]),t.arrays||(t.arrays={}),function(e,t){var n=["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"];function a(e){var t=n.find(function(t){return c[t.toUpperCase()]===e||"number"!=typeof e&&t.toLowerCase()===e.toLowerCase()});return void 0===t&&(t=null),t}t.classHierarchy.push("vtkDataSetAttributes"),e.checkNumberOfComponents=function(e){return!0},e.setAttribute=function(n,r){var i=a(r);if(n&&"PEDIGREEIDS"===i.toUpperCase()&&!n.isA("vtkDataArray"))return f("Cannot set attribute ".concat(i,". The attribute must be a vtkDataArray.")),-1;if(n&&!e.checkNumberOfComponents(n,i))return f("Cannot set attribute ".concat(i,". Incorrect number of components.")),-1;var o=t["active".concat(i)];if(o>=0&&o=0&&n0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!a(t))throw TypeError("listener must be a function");var n=!1;function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!a(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(o=(n=this._events[e]).length,r=-1,n===t||a(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=o;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(a(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(a(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){var n,r,a=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var u,l=[],c=!1,d=-1;function f(){c&&u&&(c=!1,u.length?l=u.concat(l):d=-1,l.length&&p())}function p(){if(!c){var e=s(f);c=!0;for(var t=l.length;t;){for(u=l,l=[];++d1)for(var n=1;ne[1]||e[2]>e[3]||e[4]>e[5]?a.EMPTY:3===t?a.XYZ_GRID:2===t?e[0]===e[1]?a.YZ_PLANE:e[2]===e[3]?a.XZ_PLANE:a.XY_PLANE:1===t?e[0]2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,i,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkStringArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=t.values):t.values=[],t.values&&(t.size=t.values.length),r.a.obj(e,t),r.a.set(e,t,["name"]),function(e,t){t.classHierarchy.push("vtkStringArray"),e.getComponent=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=function(n,r,a){a!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=a,e.modified())},e.getData=function(){return t.values},e.getTuple=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=t.numberOfComponents||1;n.length&&(n.length=r);for(var i=e*r,o=0;o0&&void 0!==arguments[0]?arguments[0]:1)*t.numberOfComponents},e.getNumberOfComponents=function(){return t.numberOfComponents},e.getNumberOfValues=function(){return t.values.length},e.getNumberOfTuples=function(){return t.values.length/t.numberOfComponents},e.getDataType=function(){return t.dataType},e.newClone=function(){return s({name:t.name,numberOfComponents:t.numberOfComponents})},e.getName=function(){return t.name||(e.modified(),t.name="vtkStringArray".concat(e.getMTime())),t.name},e.setData=function(n,r){t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}(e,t)}var s=r.a.newInstance(o,"vtkStringArray");t.a={newInstance:s,extend:o}},function(e,t,n){"use strict";var r=n(8),a=n(0),i=n(42),o=n(14);var s={};function u(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,s,n),i.a.extend(e,t,n),a.a.setGet(e,t,["points"]),function(e,t){t.classHierarchy.push("vtkPointSet"),t.points?t.points=Object(r.a)(t.points):t.points=o.a.newInstance(),e.getBounds=function(){return t.points.getBounds()},e.computeBounds=function(){e.getBounds()};var n=e.shallowCopy;e.shallowCopy=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n(e,r),t.points=o.a.newInstance(),t.points.shallowCopy(e.getPoints())}}(e,t)}var l=a.a.newInstance(u,"vtkPointSet");t.a={newInstance:l,extend:u}},function(e,t){e.exports='\n\n \x3c!-- Generator: Sketch 43.1 (39012) - http://www.bohemiancoding.com/sketch --\x3e\n Contrast\n Created with Sketch.\n \n \n \n \n \n \n \n \n \n \n \n \n \n'},function(e,t){e.exports='\n\n \x3c!-- Generator: Sketch 43.1 (39012) - http://www.bohemiancoding.com/sketch --\x3e\n VTK-js favicon-logo\n Created with Sketch.\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n'},function(e,t){e.exports='\n\n \x3c!-- Generator: Sketch 43.1 (39012) - http://www.bohemiancoding.com/sketch --\x3e\n Spacing\n Created with Sketch.\n \n \n \n \n \n \n \n \n \n'},function(e,t,n){"use strict";var r=n(0),a=n(52),i=n(2);var o={bounds:[1,-1,1,-1,1,-1],center:[0,0,0]};t.a={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,o,n),a.a.extend(e,t,n),t.bounds||i.a.uninitializeBounds(t.bounds),t.center||(t.center=[0,0,0]),function(e,t){e.getBounds=function(){return 0},e.getBounds=function(n){e.getBounds();for(var r=0;r<6;r++)n[r]=t.bounds[r]},e.getCenter=function(){e.getBounds();for(var n=0;n<3;n++)t.center[n]=(t.bounds[2*n+1]+t.bounds[2*n])/2;for(var r=arguments.length,a=new Array(r),i=0;i=0&&n-1?r:a,o=n(35).Buffer;g.WritableState=p;var s=n(56);s.inherits=n(50);var u,l={deprecate:n(178)};!function(){try{u=n(61)}catch(e){}finally{u||(u=n(62).EventEmitter)}}();var c;o=n(35).Buffer;function d(){}function f(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function p(e,t){c=c||n(46),e=e||{},this.objectMode=!!e.objectMode,t instanceof c&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:o,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?a(i,r):i(r);e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,o);else{var s=y(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||v(e,n),r?i(h,e,n,s,o):h(e,n,s,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new b(this),this.corkedRequestsFree.next=new b(this)}function g(e){if(c=c||n(46),!(this instanceof g||this instanceof c))return new g(e);this._writableState=new p(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),u.call(this)}function m(e,t,n,r,a,i,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(a,t.onwrite):e._write(a,i,t.onwrite),t.sync=!1}function h(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),A(e,t)}function v(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,a=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var o=0;n;)a[o]=n,n=n.next,o+=1;m(e,t,!0,t.length,a,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,t.corkedRequestsFree=i.next,i.next=null}else{for(;n;){var s=n.chunk,u=n.encoding,l=n.callback;if(m(e,t,!1,t.objectMode?1:s.length,s,u,l),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function y(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function M(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function A(e,t){var n=y(t);return n&&(0===t.pendingcb?(M(e,t),t.finished=!0,e.emit("finish")):M(e,t)),n}function b(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var a=r.callback;e.pendingcb--,a(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}s.inherits(g,u),p.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(p.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}(),g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},g.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),o.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=d),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),a(t,n)}(this,n):function(e,t,n,r){var i=!0;if(!o.isBuffer(n)&&"string"!=typeof n&&null!=n&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s),a(r,s),i=!1}return i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,a){n=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=new o(t,n)),t}(t,n,r),o.isBuffer(n)&&(r="buffer");var i=t.objectMode?1:n.length;t.length+=i;var s=t.length-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},g.prototype._write=function(e,t,n){n(new Error("not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,A(e,t),n&&(t.finished?a(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)}}).call(this,n(63),n(176).setImmediate)},function(e,t,n){"use strict";e.exports=o;var r=n(46),a=n(56);function i(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var a=r.writecb;if(!a)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n);a(t);var i=e._readableState;i.reading=!1,(i.needReadable||i.length>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var i=a,o=r+n;e^=-1;for(var s=r;s>>8^i[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var i=a,o=r+n;e^=-1;for(var s=r;s>>8^i[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):0}},function(e,t,n){(function(){var t,r,a,i,o,s,u,l,c,d,f,p,g,m={}.hasOwnProperty;u=n(69),l=n(70),t=n(67),r=n(68),c=n(66),f=n(75),p=n(76),d=n(77),a=n(71),i=n(73),o=n(72),s=n(74),g=n(126),e.exports=function(e){function n(e){n.__super__.constructor.call(this,e)}return function(e,t){for(var n in t)m.call(t,n)&&(e[n]=t[n]);function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype}(n,g),n.prototype.document=function(e){var t,n,a,i,o;for(this.textispresent=!1,i="",n=0,a=(o=e.children).length;n"+this.newline},n.prototype.comment=function(e,t){return this.space(t)+"\x3c!-- "+e.text+" --\x3e"+this.newline},n.prototype.declaration=function(e,t){var n;return n=this.space(t),n+='",n+=this.newline},n.prototype.docType=function(e,n){var u,l,c,f,p;if(n||(n=0),f=this.space(n),f+="0){for(f+=" [",f+=this.newline,l=0,c=(p=e.children).length;l",f+=this.newline},n.prototype.element=function(e,n){var a,i,o,s,u,l,g,h,v,y,M,A,b;for(g in n||(n=0),b=!1,this.textispresent?(this.newline="",this.pretty=!1):(this.newline=this.newlinedefault,this.pretty=this.prettydefault),h="",h+=(A=this.space(n))+"<"+e.name,v=e.attributes)m.call(v,g)&&(a=v[g],h+=this.attribute(a));if(0===e.children.length||e.children.every(function(e){return""===e.value}))this.allowEmpty?h+=">"+this.newline:h+=this.spacebeforeslash+"/>"+this.newline;else if(this.pretty&&1===e.children.length&&null!=e.children[0].value)h+=">",h+=e.children[0].value,h+=""+this.newline;else{if(this.dontprettytextnodes)for(o=0,u=(y=e.children).length;o"+this.newline,s=0,l=(M=e.children).length;s"+this.newline}return h},n.prototype.processingInstruction=function(e,t){var n;return n=this.space(t)+""+this.newline},n.prototype.raw=function(e,t){return this.space(t)+e.value+this.newline},n.prototype.text=function(e,t){return this.space(t)+e.value+this.newline},n.prototype.dtdAttList=function(e,t){var n;return n=this.space(t)+""+this.newline},n.prototype.dtdElement=function(e,t){return this.space(t)+""+this.newline},n.prototype.dtdEntity=function(e,t){var n;return n=this.space(t)+""+this.newline},n.prototype.dtdNotation=function(e,t){var n;return n=this.space(t)+""+this.newline},n.prototype.openNode=function(e,t){var n,r,a,i;if(t||(t=0),e instanceof c){for(r in a=this.space(t)+"<"+e.name,i=e.attributes)m.call(i,r)&&(n=i[r],a+=this.attribute(n));return a+=(e.children?">":"/>")+this.newline}return a=this.space(t)+"")+this.newline},n.prototype.closeNode=function(e,t){switch(t||(t=0),!1){case!(e instanceof c):return this.space(t)+""+this.newline;case!(e instanceof l):return this.space(t)+"]>"+this.newline}},n}()}).call(this)},function(e){e.exports={format:1,last_updated:"2018-02-20T22:55:10Z",devices:[{type:"android",rules:[{mdmh:"asus/*/Nexus 7/*"},{ua:"Nexus 7"}],dpi:[320.8,323],bw:3,ac:500},{type:"android",rules:[{mdmh:"asus/*/ASUS_Z00AD/*"},{ua:"ASUS_Z00AD"}],dpi:[403,404.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel XL/*"},{ua:"Pixel XL"}],dpi:[537.9,533],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel/*"},{ua:"Pixel"}],dpi:[432.6,436.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC6435LVW/*"},{ua:"HTC6435LVW"}],dpi:[449.7,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC One XL/*"},{ua:"HTC One XL"}],dpi:[315.3,314.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"htc/*/Nexus 9/*"},{ua:"Nexus 9"}],dpi:289,bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One M9/*"},{ua:"HTC One M9"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One_M8/*"},{ua:"HTC One_M8"}],dpi:[449.7,447.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One/*"},{ua:"HTC One"}],dpi:472.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/Nexus 6P/*"},{ua:"Nexus 6P"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LENOVO/*/Lenovo PB2-690Y/*"},{ua:"Lenovo PB2-690Y"}],dpi:[457.2,454.713],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5X/*"},{ua:"Nexus 5X"}],dpi:[422,419.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS345/*"},{ua:"LGMS345"}],dpi:[221.7,219.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D800/*"},{ua:"LG-D800"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D850/*"},{ua:"LG-D850"}],dpi:[537.9,541.9],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/VS985 4G/*"},{ua:"VS985 4G"}],dpi:[537.9,535.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5/*"},{ua:"Nexus 5 B"}],dpi:[442.4,444.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 4/*"},{ua:"Nexus 4"}],dpi:[319.8,318.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LG-P769/*"},{ua:"LG-P769"}],dpi:[240.6,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS323/*"},{ua:"LGMS323"}],dpi:[206.6,204.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGLS996/*"},{ua:"LGLS996"}],dpi:[403.4,401.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/4560MMX/*"},{ua:"4560MMX"}],dpi:[240,219.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/A250/*"},{ua:"Micromax A250"}],dpi:[480,446.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/Micromax AQ4501/*"},{ua:"Micromax AQ4501"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/G5/*"},{ua:"Moto G (5) Plus"}],dpi:[403.4,403],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/DROID RAZR/*"},{ua:"DROID RAZR"}],dpi:[368.1,256.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT830C/*"},{ua:"XT830C"}],dpi:[254,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1021/*"},{ua:"XT1021"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1023/*"},{ua:"XT1023"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1028/*"},{ua:"XT1028"}],dpi:[326.6,327.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1034/*"},{ua:"XT1034"}],dpi:[326.6,328.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1053/*"},{ua:"XT1053"}],dpi:[315.3,316.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1562/*"},{ua:"XT1562"}],dpi:[403.4,402.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/Nexus 6/*"},{ua:"Nexus 6 B"}],dpi:[494.3,489.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1063/*"},{ua:"XT1063"}],dpi:[295,296.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1064/*"},{ua:"XT1064"}],dpi:[295,295.6],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1092/*"},{ua:"XT1092"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1095/*"},{ua:"XT1095"}],dpi:[422,423.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/G4/*"},{ua:"Moto G (4)"}],dpi:401,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/A0001/*"},{ua:"A0001"}],dpi:[403.4,401],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE E1005/*"},{ua:"ONE E1005"}],dpi:[442.4,441.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A2005/*"},{ua:"ONE A2005"}],dpi:[391.9,405.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONEPLUS A5000/*"},{ua:"ONEPLUS A5000 "}],dpi:[403.411,399.737],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A5010/*"},{ua:"ONEPLUS A5010"}],dpi:[403,400],bw:2,ac:1e3},{type:"android",rules:[{mdmh:"OPPO/*/X909/*"},{ua:"X909"}],dpi:[442.4,444.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9082/*"},{ua:"GT-I9082"}],dpi:[184.7,185.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G360P/*"},{ua:"SM-G360P"}],dpi:[196.7,205.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Nexus S/*"},{ua:"Nexus S"}],dpi:[234.5,229.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[304.8,303.9],bw:5,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-T230NU/*"},{ua:"SM-T230NU"}],dpi:216,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SGH-T399/*"},{ua:"SGH-T399"}],dpi:[217.7,231.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SGH-M919/*"},{ua:"SGH-M919"}],dpi:[440.8,437.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N9005/*"},{ua:"SM-N9005"}],dpi:[386.4,387],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SM-N900A/*"},{ua:"SAMSUNG-SM-N900A"}],dpi:[386.4,387.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9500/*"},{ua:"GT-I9500"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/GT-I9505/*"},{ua:"GT-I9505"}],dpi:439.4,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900F/*"},{ua:"SM-G900F"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900M/*"},{ua:"SM-G900M"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G800F/*"},{ua:"SM-G800F"}],dpi:326.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G906S/*"},{ua:"SM-G906S"}],dpi:[562.7,572.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[306.7,304.8],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-T535/*"},{ua:"SM-T535"}],dpi:[142.6,136.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-N920C/*"},{ua:"SM-N920C"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920P/*"},{ua:"SM-N920P"}],dpi:[386.3655,390.144],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920W8/*"},{ua:"SM-N920W8"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300I/*"},{ua:"GT-I9300I"}],dpi:[304.8,305.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9195/*"},{ua:"GT-I9195"}],dpi:[249.4,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SPH-L520/*"},{ua:"SPH-L520"}],dpi:[249.4,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SGH-I717/*"},{ua:"SAMSUNG-SGH-I717"}],dpi:285.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SPH-D710/*"},{ua:"SPH-D710"}],dpi:[217.7,204.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-N7100/*"},{ua:"GT-N7100"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SCH-I605/*"},{ua:"SCH-I605"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Galaxy Nexus/*"},{ua:"Galaxy Nexus"}],dpi:[315.3,314.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910H/*"},{ua:"SM-N910H"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910C/*"},{ua:"SM-N910C"}],dpi:[515.2,520.2],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G130M/*"},{ua:"SM-G130M"}],dpi:[165.9,164.8],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G928I/*"},{ua:"SM-G928I"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G920F/*"},{ua:"SM-G920F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G920P/*"},{ua:"SM-G920P"}],dpi:[522.5,577],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G925F/*"},{ua:"SM-G925F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G925V/*"},{ua:"SM-G925V"}],dpi:[522.5,576.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G930F/*"},{ua:"SM-G930F"}],dpi:576.6,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G935F/*"},{ua:"SM-G935F"}],dpi:533,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G950F/*"},{ua:"SM-G950F"}],dpi:[562.707,565.293],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G955U/*"},{ua:"SM-G955U"}],dpi:[522.514,525.762],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/C6903/*"},{ua:"C6903"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/D6653/*"},{ua:"D6653"}],dpi:[428.6,427.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6653/*"},{ua:"E6653"}],dpi:[428.6,425.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6853/*"},{ua:"E6853"}],dpi:[403.4,401.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/SGP321/*"},{ua:"SGP321"}],dpi:[224.7,224.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"TCT/*/ALCATEL ONE TOUCH Fierce/*"},{ua:"ALCATEL ONE TOUCH Fierce"}],dpi:[240,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"THL/*/thl 5000/*"},{ua:"thl 5000"}],dpi:[480,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Fly/*/IQ4412/*"},{ua:"IQ4412"}],dpi:307.9,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"ZTE/*/ZTE Blade L2/*"},{ua:"ZTE Blade L2"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"BENEVE/*/VR518/*"},{ua:"VR518"}],dpi:480,bw:3,ac:500},{type:"ios",rules:[{res:[640,960]}],dpi:[325.1,328.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[640,1136]}],dpi:[317.1,320.2],bw:3,ac:1e3},{type:"ios",rules:[{res:[750,1334]}],dpi:326.4,bw:4,ac:1e3},{type:"ios",rules:[{res:[1242,2208]}],dpi:[453.6,458.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2001]}],dpi:[410.9,415.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2436]}],dpi:458,bw:4,ac:1e3}]}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){for(var a=65535&e|0,i=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{i=i+(a=a+t[r++]|0)|0}while(--o);a%=65521,i%=65521}return a|i<<16|0}},function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,a){var i=r,o=a+n;e^=-1;for(var s=a;s>>8^i[255&(e^t[s])];return-1^e}},function(e,t,n){"use strict";var r=n(39),a=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch(e){a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){i=!1}for(var o=new r.Buf8(256),s=0;s<256;s++)o[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function u(e,t){if(t<65537&&(e.subarray&&i||!e.subarray&&a))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return u(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,a=t.length;n4)l[r++]=65533,n+=i-1;else{for(a&=2===i?31:3===i?15:7;i>1&&n1?l[r++]=65533:a<65536?l[r++]=a:(a-=65536,l[r++]=55296|a>>10&1023,l[r++]=56320|1023&a)}return u(l,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0?t:0===n?t:n+o[e[n]]>t?n:t}},function(e,t,n){"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}},function(e,t,n){"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}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){e.exports=n(61)},function(e,t,n){"use strict";(function(t){e.exports=g;var r=n(89),a=n(103),i=n(35).Buffer;g.ReadableState=p;n(62);var o,s=function(e,t){return e.listeners(t).length};!function(){try{o=n(61)}catch(e){}finally{o||(o=n(62).EventEmitter)}}();i=n(35).Buffer;var u=n(56);u.inherits=n(50);var l,c,d=n(175),f=void 0;function p(e,t){c=c||n(46),e=e||{},this.objectMode=!!e.objectMode,t instanceof c&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,a=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:a,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=n(106).StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function g(e){if(c=c||n(46),!(this instanceof g))return new g(e);this._readableState=new p(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),o.call(this)}function m(e,t,n,a,o){var s=function(e,t){var n=null;i.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(s)e.emit("error",s);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,y(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!o){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&o){u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||o||a||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),o||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&y(e))),function(e,t){t.readingMore||(t.readingMore=!0,r(A,e,t))}(e,t)}else o||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=h?e=h:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function y(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(f("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?r(M,e):M(e))}function M(e){f("emit readable"),e.emit("readable"),D(e)}function A(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=a)n=o?r.join(""):1===r.length?r[0]:i.concat(r,a),r.length=0;else{if(e0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,r(I,t,e))}function I(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}g.prototype.read=function(e){f("read",e);var t=this._readableState,n=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return f("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?C(this):y(this),null;if(0===(e=v(e,t))&&t.ended)return 0===t.length&&C(this),null;var r,a=t.needReadable;return f("need readable",a),(0===t.length||t.length-e0?T(e,t):null)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&C(this),null!==r&&this.emit("data",r),r},g.prototype._read=function(e){this.emit("error",new Error("not implemented"))},g.prototype.pipe=function(e,n){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,f("pipe count=%d opts=%j",o.pipesCount,n);var u=(!n||!1!==n.end)&&e!==t.stdout&&e!==t.stderr?c:g;function l(e){f("onunpipe"),e===i&&g()}function c(){f("onend"),e.end()}o.endEmitted?r(u):i.once("end",u),e.on("unpipe",l);var d=function(e){return function(){var t=e._readableState;f("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,D(e))}}(i);e.on("drain",d);var p=!1;function g(){f("cleanup"),e.removeListener("close",v),e.removeListener("finish",y),e.removeListener("drain",d),e.removeListener("error",h),e.removeListener("unpipe",l),i.removeListener("end",c),i.removeListener("end",g),i.removeListener("data",m),p=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||d()}function m(t){f("ondata"),!1===e.write(t)&&(1!==o.pipesCount||o.pipes[0]!==e||1!==i.listenerCount("data")||p||(f("false write response, pause",i._readableState.awaitDrain),i._readableState.awaitDrain++),i.pause())}function h(t){f("onerror",t),M(),e.removeListener("error",h),0===s(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",y),M()}function y(){f("onfinish"),e.removeListener("close",v),M()}function M(){f("unpipe"),i.unpipe(e)}return i.on("data",m),e._events&&e._events.error?a(e._events.error)?e._events.error.unshift(h):e._events.error=[h,e._events.error]:e.on("error",h),e.once("close",v),e.once("finish",y),e.emit("pipe",i),o.flowing||(f("pipe resume"),i.resume()),e},g.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return a>0&&(e.lastNeed=a-1),a;if(--r=0)return a>0&&(e.lastNeed=a-2),a;if(--r=0)return a>0&&(2===a?a=0:e.lastNeed=a-3),a;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=i;var r=n(91),a=n(56);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}a.inherits=n(50),a.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r=n(13),a=n(40),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.encode=function(e){for(var t,n,a,o,s,u,l,c=[],d=0,f=e.length,p=f,g="string"!==r.getTypeOf(e);d>2,s=(3&t)<<4|n>>4,u=p>1?(15&n)<<2|a>>6:64,l=p>2?63&a:64,c.push(i.charAt(o)+i.charAt(s)+i.charAt(u)+i.charAt(l));return c.join("")},t.decode=function(e){var t,n,r,o,s,u,l=0,c=0;if("data:"===e.substr(0,"data:".length))throw new Error("Invalid base64 input, it looks like a data url.");var d,f=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(e.charAt(e.length-1)===i.charAt(64)&&f--,e.charAt(e.length-2)===i.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=a.uint8array?new Uint8Array(0|f):new Array(0|f);l>4,n=(15&o)<<4|(s=i.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(u=i.indexOf(e.charAt(l++))),d[c++]=t,64!==s&&(d[c++]=n),64!==u&&(d[c++]=r);return d}},function(e,t){var n=e.exports={version:"2.3.0"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(187);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,a){return e.call(t,n,r,a)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(92),a=n(65).document,i=r(a)&&r(a.createElement);e.exports=function(e){return i?a.createElement(e):{}}},function(e,t,n){"use strict";(function(t){var r=n(13),a=n(200),i=n(28),o=n(108),s=n(40),u=n(57),l=null;if(s.nodestream)try{l=n(201)}catch(e){}function c(e,n){var r,a=0,i=null,o=0;for(r=0;r=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=i},function(e,t,n){"use strict";var r=n(13),a=n(28);function i(e){a.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(i,a),i.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}a.prototype.processChunk.call(this,e)},e.exports=i},function(e,t,n){"use strict";var r=n(28),a=n(95);function i(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n(13).inherits(i,r),i.prototype.processChunk=function(e){this.streamInfo.crc32=a(e.data,this.streamInfo.crc32||0),this.push(e)},e.exports=i},function(e,t,n){"use strict";var r=n(28);t.STORE={magic:"\0\0",compressWorker:function(e){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},t.DEFLATE=n(204)},function(e,t,n){"use strict";t.LOCAL_FILE_HEADER="PK",t.CENTRAL_FILE_HEADER="PK",t.CENTRAL_DIRECTORY_END="PK",t.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",t.ZIP64_CENTRAL_DIRECTORY_END="PK",t.DATA_DESCRIPTOR="PK\b"},function(e,t,n){"use strict";var r=n(13),a=n(40),i=n(121),o=n(209),s=n(210),u=n(123);e.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||a.uint8array?"nodebuffer"===t?new s(e):a.uint8array?new u(r.transformTo("uint8array",e)):new i(r.transformTo("array",e)):new o(e)}},function(e,t,n){"use strict";var r=n(122);function a(e){r.call(this,e);for(var t=0;t=0;--i)if(this.data[i]===t&&this.data[i+1]===n&&this.data[i+2]===r&&this.data[i+3]===a)return i-this.zero;return-1},a.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),a=e.charCodeAt(3),i=this.readData(4);return t===i[0]&&n===i[1]&&r===i[2]&&a===i[3]},a.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},e.exports=a},function(e,t,n){"use strict";var r=n(13);function a(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},e.exports=a},function(e,t,n){"use strict";var r=n(121);function a(e){r.call(this,e)}n(13).inherits(a,r),a.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},e.exports=a},function(e,t){(function(){e.exports=function(){function e(e,t,n){if(this.options=e.options,this.stringify=e.stringify,null==t)throw new Error("Missing attribute name of element "+e.name);if(null==n)throw new Error("Missing attribute value for attribute "+t+" of element "+e.name);this.name=this.stringify.attName(t),this.value=this.stringify.attValue(n)}return e.prototype.clone=function(){return Object.create(this)},e.prototype.toString=function(e){return this.options.writer.set(e).attribute(this)},e}()}).call(this)},function(e,t){(function(){var t=function(e,t){return function(){return e.apply(t,arguments)}},n={}.hasOwnProperty;e.exports=function(){function e(e){var r,a,i;for(r in this.assertLegalChar=t(this.assertLegalChar,this),e||(e={}),this.noDoubleEncoding=e.noDoubleEncoding,a=e.stringify||{})n.call(a,r)&&(i=a[r],this[r]=i)}return e.prototype.eleName=function(e){return e=""+e||"",this.assertLegalChar(e)},e.prototype.eleText=function(e){return e=""+e||"",this.assertLegalChar(this.elEscape(e))},e.prototype.cdata=function(e){return e=(e=""+e||"").replace("]]>","]]]]>"),this.assertLegalChar(e)},e.prototype.comment=function(e){if((e=""+e||"").match(/--/))throw new Error("Comment text cannot contain double-hypen: "+e);return this.assertLegalChar(e)},e.prototype.raw=function(e){return""+e||""},e.prototype.attName=function(e){return""+e||""},e.prototype.attValue=function(e){return e=""+e||"",this.attEscape(e)},e.prototype.insTarget=function(e){return""+e||""},e.prototype.insValue=function(e){if((e=""+e||"").match(/\?>/))throw new Error("Invalid processing instruction value: "+e);return e},e.prototype.xmlVersion=function(e){if(!(e=""+e||"").match(/1\.[0-9]+/))throw new Error("Invalid version number: "+e);return e},e.prototype.xmlEncoding=function(e){if(!(e=""+e||"").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+e);return e},e.prototype.xmlStandalone=function(e){return e?"yes":"no"},e.prototype.dtdPubID=function(e){return""+e||""},e.prototype.dtdSysID=function(e){return""+e||""},e.prototype.dtdElementValue=function(e){return""+e||""},e.prototype.dtdAttType=function(e){return""+e||""},e.prototype.dtdAttDefault=function(e){return null!=e?""+e||"":e},e.prototype.dtdEntityValue=function(e){return""+e||""},e.prototype.dtdNData=function(e){return""+e||""},e.prototype.convertAttKey="@",e.prototype.convertPIKey="?",e.prototype.convertTextKey="#text",e.prototype.convertCDataKey="#cdata",e.prototype.convertCommentKey="#comment",e.prototype.convertRawKey="#raw",e.prototype.assertLegalChar=function(e){var t;if(t=e.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/))throw new Error("Invalid character in string: "+e+" at index "+t.index);return e},e.prototype.elEscape=function(e){var t;return t=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,e.replace(t,"&").replace(//g,">").replace(/\r/g," ")},e.prototype.attEscape=function(e){var t;return t=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,e.replace(t,"&").replace(/0?new Array(t).join(this.indent):""},e}()}).call(this)},function(e,t,n){var r=n(150),a=n(151),i=n(152),o=n(153),s=n(154),u=n(155),l=n(156);l.alea=r,l.xor128=a,l.xorwow=i,l.xorshift7=o,l.xor4096=s,l.tychei=u,e.exports=l},function(e){e.exports={atoms:[{id:"Xx",atomicNumber:0,mass:0,exactMass:0,radiusCovalent:0,radiusVDW:0,symbol:"Xx",name:"Dummy",elementColor:[.07,.5,.7]},{id:"H",atomicNumber:1,mass:1.00794,exactMass:1.007825032,ionization:13.5984,electronAffinity:.75420375,electronegativityPauling:2.2,nameOrigin:"Greek 'hydro' and 'gennao' for 'forms water'",radiusCovalent:.37,radiusVDW:1.2,boilingpoint:20.28,meltingpoint:14.01,periodTableBlock:"s",discoveryDate:"1766",period:"1",group:"1",electronicConfiguration:"1s1",family:"Non-Metal",symbol:"H",name:"Hydrogen",elementColor:[1,1,1],discoveryCountry:["uk"],discoverers:["C.","Cavendish"]},{id:"He",atomicNumber:2,mass:4.002602,exactMass:4.002603254,ionization:24.5874,electronAffinity:0,nameOrigin:"The Greek word for the sun was 'helios'",radiusCovalent:.32,radiusVDW:1.4,boilingpoint:4.216,meltingpoint:.95,periodTableBlock:"p",discoveryDate:"1895",period:"1",group:"8",electronicConfiguration:"1s2",family:"Noblegas",symbol:"He",name:"Helium",elementColor:[.85,1,1],discoveryCountry:["se","uk"],discoverers:["P. J. Janssen","J. N. Lockyer"]},{id:"Li",atomicNumber:3,mass:6.941,exactMass:7.01600455,ionization:5.3917,electronAffinity:.618049,electronegativityPauling:.98,nameOrigin:"Greek 'lithos' means 'stone'",radiusCovalent:1.34,radiusVDW:2.2,boilingpoint:1615,meltingpoint:453.7,periodTableBlock:"s",discoveryDate:"1817",period:"2",group:"1",electronicConfiguration:"He 2s1",family:"Alkali_Earth",symbol:"Li",name:"Lithium",elementColor:[.8,.5,1],discoveryCountry:["se"],discoverers:["A.","Arfvedson"]},{id:"Be",atomicNumber:4,mass:9.012182,exactMass:9.0121822,ionization:9.3227,electronAffinity:0,electronegativityPauling:1.57,nameOrigin:"Greek 'beryllos' for 'light-green stone'",radiusCovalent:.9,radiusVDW:1.9,boilingpoint:3243,meltingpoint:1560,periodTableBlock:"s",discoveryDate:"1797",period:"2",group:"2",electronicConfiguration:"He 2s2",family:"Alkaline_Earth",symbol:"Be",name:"Beryllium",elementColor:[.76,1,0],discoveryCountry:["fr"],discoverers:["Nicholas","Louis","Vauquelin"]},{id:"B",atomicNumber:5,mass:10.811,exactMass:11.0093054,ionization:8.298,electronAffinity:.279723,electronegativityPauling:2.04,nameOrigin:"Boron means 'Bor(ax) + (carb)on'. It is found in borax and behaves a lot like carbon",radiusCovalent:.82,radiusVDW:1.8,boilingpoint:4275,meltingpoint:2365,periodTableBlock:"p",discoveryDate:"1808",period:"2",group:"3",electronicConfiguration:"He 2s2 2p1",family:"Metalloids",symbol:"B",name:"Boron",elementColor:[1,.71,.71],discoveryCountry:["uk","fr"],discoverers:["Louis Joseph Gay-Lussac","Louis Jacques Thenard"]},{id:"C",atomicNumber:6,mass:12.0107,exactMass:12,ionization:11.2603,electronAffinity:1.262118,electronegativityPauling:2.55,nameOrigin:"Latin 'carboneum' for carbon",radiusCovalent:.77,radiusVDW:1.7,boilingpoint:5100,meltingpoint:3825,periodTableBlock:"p",discoveryDate:"0",period:"2",group:"4",electronicConfiguration:"He 2s2 2p2",family:"Non-Metal",symbol:"C",name:"Carbon",elementColor:[.5,.5,.5],discoveryCountry:["ancient"]},{id:"N",atomicNumber:7,mass:14.0067,exactMass:14.003074,ionization:14.5341,electronAffinity:-.07,electronegativityPauling:3.04,nameOrigin:"Latin 'nitrogenium' ('forms saltpeter')",radiusCovalent:.75,radiusVDW:1.6,boilingpoint:77.344,meltingpoint:63.15,periodTableBlock:"p",discoveryDate:"1772",period:"2",group:"5",electronicConfiguration:"He 2s2 2p3",family:"Non-Metal",symbol:"N",name:"Nitrogen",elementColor:[.05,.05,1],discoveryCountry:["uk"],discoverers:["D.","Rutherford"]},{id:"O",atomicNumber:8,mass:15.9994,exactMass:15.99491462,ionization:13.6181,electronAffinity:1.461112,electronegativityPauling:3.44,nameOrigin:"Latin 'oxygenium' (forms acids)",radiusCovalent:.73,radiusVDW:1.55,boilingpoint:90.188,meltingpoint:54.8,periodTableBlock:"p",discoveryDate:"1774",period:"2",group:"6",electronicConfiguration:"He 2s2 2p4",family:"Non-Metal",symbol:"O",name:"Oxygen",elementColor:[1,.05,.05],discoveryCountry:["se","uk"],discoverers:["J.","Priestley"]},{id:"F",atomicNumber:9,mass:18.9984032,exactMass:18.99840322,ionization:17.4228,electronAffinity:3.4011887,electronegativityPauling:3.98,nameOrigin:"Latin 'fluere' ('floats')",radiusCovalent:.71,radiusVDW:1.5,boilingpoint:85,meltingpoint:53.55,periodTableBlock:"p",discoveryDate:"1886",period:"2",group:"7",electronicConfiguration:"He 2s2 2p5",family:"Halogen",symbol:"F",name:"Fluorine",elementColor:[.7,1,1],discoveryCountry:["fr"],discoverers:["H.","F.","Moissan"]},{id:"Ne",atomicNumber:10,mass:20.1797,exactMass:19.99244018,ionization:21.5645,electronAffinity:0,nameOrigin:"Greek 'neo'. meaning 'new'",radiusCovalent:.69,radiusVDW:1.54,boilingpoint:27.1,meltingpoint:24.55,periodTableBlock:"p",discoveryDate:"1898",period:"2",group:"8",electronicConfiguration:"He 2s2 2p6",family:"Noblegas",symbol:"Ne",name:"Neon",elementColor:[.7,.89,.96],discoveryCountry:["uk"],discoverers:["W. Ramsay","M.W. Travers"]},{id:"Na",atomicNumber:11,mass:22.98976928,exactMass:22.98976928,ionization:5.1391,electronAffinity:.547926,electronegativityPauling:.93,nameOrigin:"Arabic 'natrun' for 'soda'",radiusCovalent:1.54,radiusVDW:2.4,boilingpoint:1156,meltingpoint:371,periodTableBlock:"s",discoveryDate:"1807",period:"3",group:"1",electronicConfiguration:"Ne 3s1",family:"Alkali_Earth",symbol:"Na",name:"Sodium",elementColor:[.67,.36,.95],discoveryCountry:["uk"],discoverers:["Sir","Humphrey","Davy"]},{id:"Mg",atomicNumber:12,mass:24.305,exactMass:23.9850417,ionization:7.6462,electronAffinity:0,electronegativityPauling:1.31,nameOrigin:"Named after the city of Magnesia",radiusCovalent:1.3,radiusVDW:2.2,boilingpoint:1380,meltingpoint:922,periodTableBlock:"s",discoveryDate:"1808",period:"3",group:"2",electronicConfiguration:"Ne 3s2",family:"Alkaline_Earth",symbol:"Mg",name:"Magnesium",elementColor:[.54,1,0],discoveryCountry:["uk"],discoverers:["H.","B.","Davy"]},{id:"Al",atomicNumber:13,mass:26.9815386,exactMass:26.98153863,ionization:5.9858,electronAffinity:.43283,electronegativityPauling:1.61,nameOrigin:"Latin 'alumen'",radiusCovalent:1.18,radiusVDW:2.1,boilingpoint:2740,meltingpoint:933.5,periodTableBlock:"p",discoveryDate:"1825",period:"3",group:"3",electronicConfiguration:"Ne 3s2 3p1",family:"Other_Metal",symbol:"Al",name:"Aluminium",elementColor:[.75,.65,.65],discoveryCountry:["dk"],discoverers:["H.","Ch.","Oersted"]},{id:"Si",atomicNumber:14,mass:28.0855,exactMass:27.97692653,ionization:8.1517,electronAffinity:1.389521,electronegativityPauling:1.9,nameOrigin:"Latin 'silex'",radiusCovalent:1.11,radiusVDW:2.1,boilingpoint:2630,meltingpoint:1683,periodTableBlock:"p",discoveryDate:"1823",period:"3",group:"4",electronicConfiguration:"Ne 3s2 3p2",family:"Metalloids",symbol:"Si",name:"Silicon",elementColor:[.5,.6,.6],discoveryCountry:["se"],discoverers:["J.","J.","Berzelius"]},{id:"P",atomicNumber:15,mass:30.973762,exactMass:30.97376163,ionization:10.4867,electronAffinity:.7465,electronegativityPauling:2.19,nameOrigin:"Greek 'phosphoros' for 'carries light'",radiusCovalent:1.06,radiusVDW:1.95,boilingpoint:553,meltingpoint:317.3,periodTableBlock:"p",discoveryDate:"1669",period:"3",group:"5",electronicConfiguration:"Ne 3s2 3p3",family:"Non-Metal",symbol:"P",name:"Phosphorus",elementColor:[1,.5,0],discoveryCountry:["de"],discoverers:["H.","Brandt"]},{id:"S",atomicNumber:16,mass:32.065,exactMass:31.972071,ionization:10.36,electronAffinity:2.0771029,electronegativityPauling:2.58,nameOrigin:"In sanskrit 'sweb' means 'to sleep'",radiusCovalent:1.02,radiusVDW:1.8,boilingpoint:717.82,meltingpoint:392.2,periodTableBlock:"p",discoveryDate:"0",period:"3",group:"6",electronicConfiguration:"Ne 3s2 3p4",family:"Non-Metal",symbol:"S",name:"Sulfur",elementColor:[1,1,.19],discoveryCountry:["ancient"]},{id:"Cl",atomicNumber:17,mass:35.453,exactMass:34.96885268,ionization:12.9676,electronAffinity:3.612724,electronegativityPauling:3.16,nameOrigin:"Greek 'chloros' for 'yellow-green'",radiusCovalent:.99,radiusVDW:1.8,boilingpoint:239.18,meltingpoint:172.17,periodTableBlock:"p",discoveryDate:"1774",period:"3",group:"7",electronicConfiguration:"Ne 3s2 3p5",family:"Halogen",symbol:"Cl",name:"Chlorine",elementColor:[.12,.94,.12],discoveryCountry:["se"],discoverers:["C.","W.","Scheele"]},{id:"Ar",atomicNumber:18,mass:39.948,exactMass:39.96238312,ionization:15.7596,electronAffinity:0,nameOrigin:"Greek 'aergon' for 'inactive'",radiusCovalent:.97,radiusVDW:1.88,boilingpoint:87.45,meltingpoint:83.95,periodTableBlock:"p",discoveryDate:"1894",period:"3",group:"8",electronicConfiguration:"Ne 3s2 3p6",family:"Noblegas",symbol:"Ar",name:"Argon",elementColor:[.5,.82,.89],discoveryCountry:["uk"],discoverers:["W. Ramsay","J. Rayleigh"]},{id:"K",atomicNumber:19,mass:39.0983,exactMass:38.96370668,ionization:4.3407,electronAffinity:.501459,electronegativityPauling:.82,nameOrigin:"Arabic 'al qaliy' for potash",radiusCovalent:1.96,radiusVDW:2.8,boilingpoint:1033,meltingpoint:336.8,periodTableBlock:"s",discoveryDate:"1807",period:"4",group:"1",electronicConfiguration:"Ar 4s1",family:"Alkali_Earth",symbol:"K",name:"Potassium",elementColor:[.56,.25,.83],discoveryCountry:["uk"],discoverers:["H.","B.","Davy"]},{id:"Ca",atomicNumber:20,mass:40.078,exactMass:39.96259098,ionization:6.1132,electronAffinity:.02455,electronegativityPauling:1,nameOrigin:"Latin 'calx' for 'lime'",radiusCovalent:1.74,radiusVDW:2.4,boilingpoint:1757,meltingpoint:1112,periodTableBlock:"s",discoveryDate:"1808",period:"4",group:"2",electronicConfiguration:"Ar 4s2",family:"Alkaline_Earth",symbol:"Ca",name:"Calcium",elementColor:[.24,1,0],discoveryCountry:["uk"],discoverers:["H.","B.","Davy"]},{id:"Sc",atomicNumber:21,mass:44.955912,exactMass:44.9559119,ionization:6.5615,electronAffinity:.188,electronegativityPauling:1.36,nameOrigin:"Named because it was found in Scandinavia",radiusCovalent:1.44,radiusVDW:2.3,boilingpoint:3109,meltingpoint:1814,periodTableBlock:"d",discoveryDate:"1879",period:"4",group:"3",electronicConfiguration:"Ar 3d1 4s2",family:"Transition",symbol:"Sc",name:"Scandium",elementColor:[.9,.9,.9],discoveryCountry:["se"],discoverers:["L.","Nilson"]},{id:"Ti",atomicNumber:22,mass:47.867,exactMass:47.9479463,ionization:6.8281,electronAffinity:.084,electronegativityPauling:1.54,nameOrigin:"The Titans were giants in Greek mythology",radiusCovalent:1.36,radiusVDW:2.15,boilingpoint:3560,meltingpoint:1935,periodTableBlock:"d",discoveryDate:"1791",period:"4",group:"4",electronicConfiguration:"Ar 3d2 4s2",family:"Transition",symbol:"Ti",name:"Titanium",elementColor:[.75,.76,.78],discoveryCountry:["uk"],discoverers:["W.","Gregor"]},{id:"V",atomicNumber:23,mass:50.9415,exactMass:50.9439595,ionization:6.7462,electronAffinity:.525,electronegativityPauling:1.63,nameOrigin:"'Vanadis' is another name for the Nordic goddess Freyja",radiusCovalent:1.25,radiusVDW:2.05,boilingpoint:3650,meltingpoint:2163,periodTableBlock:"d",discoveryDate:"1830",period:"4",group:"5",electronicConfiguration:"Ar 3d3 4s2",family:"Transition",symbol:"V",name:"Vanadium",elementColor:[.65,.65,.67],discoveryCountry:["se"],discoverers:["N.","Sefström"]},{id:"Cr",atomicNumber:24,mass:51.9961,exactMass:51.9405075,ionization:6.7665,electronAffinity:.67584,electronegativityPauling:1.66,nameOrigin:"Greek 'chroma' means 'color'",radiusCovalent:1.27,radiusVDW:2.05,boilingpoint:2945,meltingpoint:2130,periodTableBlock:"d",discoveryDate:"1797",period:"4",group:"6",electronicConfiguration:"Ar 3d5 4s1",family:"Transition",symbol:"Cr",name:"Chromium",elementColor:[.54,.6,.78],discoveryCountry:["fr"],discoverers:["Nicholas","Louis","Vauquelin"]},{id:"Mn",atomicNumber:25,mass:54.938045,exactMass:54.9380451,ionization:7.434,electronAffinity:0,electronegativityPauling:1.55,nameOrigin:"It was discovered near a town named Magnesia in black earth. Thus, it was named 'magnesia nigra', or for short, Manganese.",radiusCovalent:1.39,radiusVDW:2.05,boilingpoint:2235,meltingpoint:1518,periodTableBlock:"d",discoveryDate:"1774",period:"4",group:"7",electronicConfiguration:"Ar 3d5 4s2",family:"Transition",symbol:"Mn",name:"Manganese",elementColor:[.61,.48,.78],discoveryCountry:["se"],discoverers:["C.","W.","Scheele"]},{id:"Fe",atomicNumber:26,mass:55.845,exactMass:55.9349375,ionization:7.9024,electronAffinity:.151,electronegativityPauling:1.83,nameOrigin:"Latin 'ferrum'",radiusCovalent:1.25,radiusVDW:2.05,boilingpoint:3023,meltingpoint:1808,periodTableBlock:"d",discoveryDate:"0",period:"4",group:"8",electronicConfiguration:"Ar 3d6 4s2",family:"Transition",symbol:"Fe",name:"Iron",elementColor:[.5,.48,.78],discoveryCountry:["ancient"]},{id:"Co",atomicNumber:27,mass:58.933195,exactMass:58.933195,ionization:7.881,electronAffinity:.6633,electronegativityPauling:1.88,nameOrigin:"Named after the German word 'Kobold' for 'goblin'",radiusCovalent:1.26,radiusVDW:2,boilingpoint:3143,meltingpoint:1768,periodTableBlock:"d",discoveryDate:"1737",period:"4",group:"8",electronicConfiguration:"Ar 3d7 4s2",family:"Transition",symbol:"Co",name:"Cobalt",elementColor:[.44,.48,.78],discoveryCountry:["se"],discoverers:["G.","Brandt"]},{id:"Ni",atomicNumber:28,mass:58.6934,exactMass:57.9353429,ionization:7.6398,electronAffinity:1.15716,electronegativityPauling:1.91,nameOrigin:"'Nickel' was the name of a mountain goblin",radiusCovalent:1.21,radiusVDW:2,boilingpoint:3005,meltingpoint:1726,periodTableBlock:"d",discoveryDate:"1751",period:"4",group:"8",electronicConfiguration:"Ar 3d8 4s2",family:"Transition",symbol:"Ni",name:"Nickel",elementColor:[.36,.48,.76],discoveryCountry:["se"],discoverers:["A.","F.","Cronstedt"]},{id:"Cu",atomicNumber:29,mass:63.546,exactMass:62.9295975,ionization:7.7264,electronAffinity:1.23578,electronegativityPauling:1.9,nameOrigin:"Greek 'cuprum' for Cypres",radiusCovalent:1.38,radiusVDW:2,boilingpoint:2840,meltingpoint:1356.6,periodTableBlock:"d",discoveryDate:"0",period:"4",group:"1",electronicConfiguration:"Ar 3d10 4s1",family:"Transition",symbol:"Cu",name:"Copper",elementColor:[1,.48,.38],discoveryCountry:["ancient"]},{id:"Zn",atomicNumber:30,mass:65.38,exactMass:63.9291422,ionization:9.3942,electronAffinity:0,electronegativityPauling:1.65,nameOrigin:"German 'zinking' for 'rough', because zinc ore is very rough",radiusCovalent:1.31,radiusVDW:2.1,boilingpoint:1180,meltingpoint:692.73,periodTableBlock:"d",discoveryDate:"1746",period:"4",group:"2",electronicConfiguration:"Ar 3d10 4s2",family:"Transition",symbol:"Zn",name:"Zinc",elementColor:[.49,.5,.69],discoveryCountry:["de"],discoverers:["Andreas","Marggraf"]},{id:"Ga",atomicNumber:31,mass:69.723,exactMass:68.9255736,ionization:5.9993,electronAffinity:.41,electronegativityPauling:1.81,nameOrigin:"'Gallia' is an old name for France",radiusCovalent:1.26,radiusVDW:2.1,boilingpoint:2478,meltingpoint:302.92,periodTableBlock:"p",discoveryDate:"1875",period:"4",group:"3",electronicConfiguration:"Ar 3d10 4s2 4p1",family:"Other_Metal",symbol:"Ga",name:"Gallium",elementColor:[.76,.56,.56],discoveryCountry:["fr"],discoverers:["P.","E.","Lecoq","de","Boisbaudran"]},{id:"Ge",atomicNumber:32,mass:72.64,exactMass:73.9211778,ionization:7.8994,electronAffinity:1.232712,electronegativityPauling:2.01,nameOrigin:"Latin 'germania' is an old name for Germany",radiusCovalent:1.22,radiusVDW:2.1,boilingpoint:3107,meltingpoint:1211.5,periodTableBlock:"p",discoveryDate:"1886",period:"4",group:"4",electronicConfiguration:"Ar 3d10 4s2 4p2",family:"Metalloids",symbol:"Ge",name:"Germanium",elementColor:[.4,.56,.56],discoveryCountry:["de"],discoverers:["C.","A.","Winkler"]},{id:"As",atomicNumber:33,mass:74.9216,exactMass:74.9215965,ionization:9.7886,electronAffinity:.814,electronegativityPauling:2.18,nameOrigin:"Greek 'arsenikos' for 'male' or 'bold'",radiusCovalent:1.19,radiusVDW:2.05,boilingpoint:876,meltingpoint:1090,periodTableBlock:"p",discoveryDate:"0",period:"4",group:"5",electronicConfiguration:"Ar 3d10 4s2 4p3",family:"Metalloids",symbol:"As",name:"Arsenic",elementColor:[.74,.5,.89],discoveryCountry:["ancient"]},{id:"Se",atomicNumber:34,mass:78.96,exactMass:79.9165213,ionization:9.7524,electronAffinity:2.02067,electronegativityPauling:2.55,nameOrigin:"Greek 'selena' for 'moon'",radiusCovalent:1.16,radiusVDW:1.9,boilingpoint:958,meltingpoint:494,periodTableBlock:"p",discoveryDate:"1817",period:"4",group:"6",electronicConfiguration:"Ar 3d10 4s2 4p4",family:"Non-Metal",symbol:"Se",name:"Selenium",elementColor:[1,.63,0],discoveryCountry:["se"],discoverers:["J.","J.","Berzelius"]},{id:"Br",atomicNumber:35,mass:79.904,exactMass:78.9183371,ionization:11.8138,electronAffinity:3.363588,electronegativityPauling:2.96,nameOrigin:"Greek 'bromos' for 'smells badly'",radiusCovalent:1.14,radiusVDW:1.9,boilingpoint:331.85,meltingpoint:265.95,periodTableBlock:"p",discoveryDate:"1826",period:"4",group:"7",electronicConfiguration:"Ar 3d10 4s2 4p5",family:"Halogen",symbol:"Br",name:"Bromine",elementColor:[.65,.16,.16],discoveryCountry:["fr"],discoverers:["A.","J.","Balard"]},{id:"Kr",atomicNumber:36,mass:83.798,exactMass:83.911507,ionization:13.9996,electronAffinity:0,electronegativityPauling:3,nameOrigin:"Greek 'kryptos' for 'hidden'",radiusCovalent:1.1,radiusVDW:2.02,boilingpoint:120.85,meltingpoint:116,periodTableBlock:"p",discoveryDate:"1898",period:"4",group:"8",electronicConfiguration:"Ar 3d10 4s2 4p6",family:"Noblegas",symbol:"Kr",name:"Krypton",elementColor:[.36,.72,.82],discoveryCountry:["uk"],discoverers:["W. Ramsay","M. W. Travers"]},{id:"Rb",atomicNumber:37,mass:85.4678,exactMass:84.91178974,ionization:4.1771,electronAffinity:.485916,electronegativityPauling:.82,nameOrigin:"Latin 'rubidus' for 'dark red'",radiusCovalent:2.11,radiusVDW:2.9,boilingpoint:961,meltingpoint:312.63,periodTableBlock:"s",discoveryDate:"1861",period:"5",group:"1",electronicConfiguration:"Kr 5s1",family:"Alkali_Earth",symbol:"Rb",name:"Rubidium",elementColor:[.44,.18,.69],discoveryCountry:["de"],discoverers:["Robert W. Bunsen","Gustav R. Kirchhoff"]},{id:"Sr",atomicNumber:38,mass:87.62,exactMass:87.9056121,ionization:5.6949,electronAffinity:.05206,electronegativityPauling:.95,nameOrigin:"Named after the mineral Strontianit",radiusCovalent:1.92,radiusVDW:2.55,boilingpoint:1655,meltingpoint:1042,periodTableBlock:"s",discoveryDate:"1790",period:"5",group:"2",electronicConfiguration:"Kr 5s2",family:"Alkaline_Earth",symbol:"Sr",name:"Strontium",elementColor:[0,1,0],discoveryCountry:["uk"],discoverers:["H.","B.","Davy"]},{id:"Y",atomicNumber:39,mass:88.90585,exactMass:88.9058483,ionization:6.2173,electronAffinity:.307,electronegativityPauling:1.22,nameOrigin:"Named after the small town of Ytterby near Stockholm in Sweden. Terbium. Ytterbium and Gadolinium are also named after this town.",radiusCovalent:1.62,radiusVDW:2.4,boilingpoint:3611,meltingpoint:1795,periodTableBlock:"d",discoveryDate:"1794",period:"5",group:"3",electronicConfiguration:"Kr 4d1 5s2",family:"Transition",symbol:"Y",name:"Yttrium",elementColor:[.58,1,1],discoveryCountry:["fi"],discoverers:["Johann","Gadolin"]},{id:"Zr",atomicNumber:40,mass:91.224,exactMass:89.9047044,ionization:6.6339,electronAffinity:.426,electronegativityPauling:1.33,nameOrigin:"Named after the mineral zircon",radiusCovalent:1.48,radiusVDW:2.3,boilingpoint:4682,meltingpoint:2128,periodTableBlock:"d",discoveryDate:"1789",period:"5",group:"4",electronicConfiguration:"Kr 4d2 5s2",family:"Transition",symbol:"Zr",name:"Zirconium",elementColor:[.58,.88,.88],discoveryCountry:["de"],discoverers:["Martin","Heinrich","Klaproth"]},{id:"Nb",atomicNumber:41,mass:92.90638,exactMass:92.9063781,ionization:6.7589,electronAffinity:.893,electronegativityPauling:1.6,nameOrigin:"Named after Niobe, the daughter of the Greek god Tantalus.",radiusCovalent:1.37,radiusVDW:2.15,boilingpoint:5015,meltingpoint:2742,periodTableBlock:"d",discoveryDate:"1801",period:"5",group:"5",electronicConfiguration:"Kr 4d4",family:"Transition",symbol:"Nb",name:"Niobium",elementColor:[.45,.76,.79],discoveryCountry:["uk"],discoverers:["Ch.","Hatchett"]},{id:"Mo",atomicNumber:42,mass:95.96,exactMass:97.9054082,ionization:7.0924,electronAffinity:.7472,electronegativityPauling:2.16,nameOrigin:"This name has Greek roots. It means 'like Platinum' - it was difficult to distinguish Molybdenum from Platinum.",radiusCovalent:1.45,radiusVDW:2.1,boilingpoint:4912,meltingpoint:2896,periodTableBlock:"d",discoveryDate:"1778",period:"5",group:"6",electronicConfiguration:"Kr 4d5 5s1",family:"Transition",symbol:"Mo",name:"Molybdenum",elementColor:[.33,.71,.71],discoveryCountry:["se"],discoverers:["C.","W.","Scheele"]},{id:"Tc",atomicNumber:43,mass:98,exactMass:97.907216,ionization:7.28,electronAffinity:.55,electronegativityPauling:1.9,nameOrigin:"Greek 'technetos' for artificial",radiusCovalent:1.56,radiusVDW:2.05,boilingpoint:4538,meltingpoint:2477,periodTableBlock:"d",discoveryDate:"1937",period:"5",group:"7",electronicConfiguration:"Kr 4d6 5s1",family:"Transition",symbol:"Tc",name:"Technetium",elementColor:[.23,.62,.62],discoveryCountry:["it"],discoverers:["C. Perrier","E. G. Segre"]},{id:"Ru",atomicNumber:44,mass:101.07,exactMass:101.9043493,ionization:7.3605,electronAffinity:1.04638,electronegativityPauling:2.2,nameOrigin:"Ruthenia is the old name of Russia",radiusCovalent:1.26,radiusVDW:2.05,boilingpoint:4425,meltingpoint:2610,periodTableBlock:"d",discoveryDate:"1844",period:"5",group:"8",electronicConfiguration:"Kr 4d7 5s1",family:"Transition",symbol:"Ru",name:"Ruthenium",elementColor:[.14,.56,.56],discoveryCountry:["ru"],discoverers:["K.","Klaus"]},{id:"Rh",atomicNumber:45,mass:102.9055,exactMass:102.905504,ionization:7.4589,electronAffinity:1.14289,electronegativityPauling:2.28,nameOrigin:"Greek 'rhodeos' means 'red like a rose'",radiusCovalent:1.35,radiusVDW:2,boilingpoint:3970,meltingpoint:2236,periodTableBlock:"d",discoveryDate:"1803",period:"5",group:"8",electronicConfiguration:"Kr 4d8 5s1",family:"Transition",symbol:"Rh",name:"Rhodium",elementColor:[.04,.49,.55],discoveryCountry:["uk"],discoverers:["W.","Wollaston"]},{id:"Pd",atomicNumber:46,mass:106.42,exactMass:105.903486,ionization:8.3369,electronAffinity:.56214,electronegativityPauling:2.2,nameOrigin:"Named after the asteroid Pallas",radiusCovalent:1.31,radiusVDW:2.05,boilingpoint:3240,meltingpoint:1825,periodTableBlock:"d",discoveryDate:"1803",period:"5",group:"8",electronicConfiguration:"Kr 4d10",family:"Transition",symbol:"Pd",name:"Palladium",elementColor:[0,.41,.52],discoveryCountry:["uk"]},{id:"Ag",atomicNumber:47,mass:107.8682,exactMass:106.905097,ionization:7.5762,electronAffinity:1.30447,electronegativityPauling:1.93,nameOrigin:"Latin 'argentum' for silver",radiusCovalent:1.53,radiusVDW:2.1,boilingpoint:2436,meltingpoint:1235.1,periodTableBlock:"d",discoveryDate:"0",period:"5",group:"1",electronicConfiguration:"Kr 4d10 5s1",family:"Transition",symbol:"Ag",name:"Silver",elementColor:[.88,.88,1],discoveryCountry:["ancient"]},{id:"Cd",atomicNumber:48,mass:112.411,exactMass:113.9033585,ionization:8.9938,electronAffinity:0,electronegativityPauling:1.69,nameOrigin:"Greek 'kadmia' ('Galmei' = Zinc carbonate)",radiusCovalent:1.48,radiusVDW:2.2,boilingpoint:1040,meltingpoint:594.26,periodTableBlock:"d",discoveryDate:"1817",period:"5",group:"2",electronicConfiguration:"Kr 4d10 5s2",family:"Transition",symbol:"Cd",name:"Cadmium",elementColor:[1,.85,.56],discoveryCountry:["de"],discoverers:["F.","Stromeyer"]},{id:"In",atomicNumber:49,mass:114.818,exactMass:114.903878,ionization:5.7864,electronAffinity:.404,electronegativityPauling:1.78,nameOrigin:"Named after 'Indigo' because of its blue spectrum",radiusCovalent:1.44,radiusVDW:2.2,boilingpoint:2350,meltingpoint:429.78,periodTableBlock:"p",discoveryDate:"1863",period:"5",group:"3",electronicConfiguration:"Kr 4d10 5s2 5p1",family:"Other_Metal",symbol:"In",name:"Indium",elementColor:[.65,.46,.45],discoveryCountry:["de"],discoverers:["F. Reich","H.T. Richter"]},{id:"Sn",atomicNumber:50,mass:118.71,exactMass:119.9021947,ionization:7.3439,electronAffinity:1.112066,electronegativityPauling:1.96,nameOrigin:"Latin 'stannum' for tin",radiusCovalent:1.41,radiusVDW:2.25,boilingpoint:2876,meltingpoint:505.12,periodTableBlock:"p",discoveryDate:"0",period:"5",group:"4",electronicConfiguration:"Kr 4d10 5s2 5p2",family:"Other_Metal",symbol:"Sn",name:"Tin",elementColor:[.4,.5,.5],discoveryCountry:["ancient"]},{id:"Sb",atomicNumber:51,mass:121.76,exactMass:120.9038157,ionization:8.6084,electronAffinity:1.047401,electronegativityPauling:2.05,nameOrigin:"Arabic 'anthos ammonos' for 'blossom of the god Ammon'",radiusCovalent:1.38,radiusVDW:2.2,boilingpoint:1860,meltingpoint:903.91,periodTableBlock:"p",discoveryDate:"0",period:"5",group:"5",electronicConfiguration:"Kr 4d10 5s2 5p3",family:"Metalloids",symbol:"Sb",name:"Antimony",elementColor:[.62,.39,.71],discoveryCountry:["ancient"]},{id:"Te",atomicNumber:52,mass:127.6,exactMass:129.9062244,ionization:9.0096,electronAffinity:1.970875,electronegativityPauling:2.1,nameOrigin:"Latin 'tellus' or 'telluris' for 'Planet Earth'",radiusCovalent:1.35,radiusVDW:2.1,boilingpoint:1261,meltingpoint:722.72,periodTableBlock:"p",discoveryDate:"1782",period:"5",group:"6",electronicConfiguration:"Kr 4d10 5s2 5p4",family:"Metalloids",symbol:"Te",name:"Tellurium",elementColor:[.83,.48,0],discoveryCountry:["de"],discoverers:["Franz","Joseph","Muller","von","Reichstein"]},{id:"I",atomicNumber:53,mass:126.90447,exactMass:126.904473,ionization:10.4513,electronAffinity:3.059038,electronegativityPauling:2.66,nameOrigin:"Greek 'ioeides' for 'violet'.",radiusCovalent:1.33,radiusVDW:2.1,boilingpoint:457.5,meltingpoint:386.7,periodTableBlock:"p",discoveryDate:"1811",period:"5",group:"7",electronicConfiguration:"Kr 4d10 5s2 5p5",family:"Halogen",symbol:"I",name:"Iodine",elementColor:[.58,0,.58],discoveryCountry:["fr"],discoverers:["Bernard","Courtois"]},{id:"Xe",atomicNumber:54,mass:131.293,exactMass:131.9041535,ionization:12.1298,electronAffinity:0,electronegativityPauling:2.6,nameOrigin:"Greek 'xenos' for 'foreigner'",radiusCovalent:1.3,radiusVDW:2.16,boilingpoint:165.1,meltingpoint:161.39,periodTableBlock:"p",discoveryDate:"1898",period:"5",group:"8",electronicConfiguration:"Kr 4d10 5s2 5p6",family:"Noblegas",symbol:"Xe",name:"Xenon",elementColor:[.26,.62,.69],discoveryCountry:["uk"],discoverers:["W. Ramsay","M. W. Travers"]},{id:"Cs",atomicNumber:55,mass:132.9054519,exactMass:132.9054519,ionization:3.8939,electronAffinity:.471626,electronegativityPauling:.79,nameOrigin:"Latin 'caesius' for 'heaven blue'.",radiusCovalent:2.25,radiusVDW:3,boilingpoint:944,meltingpoint:301.54,periodTableBlock:"s",discoveryDate:"1860",period:"6",group:"1",electronicConfiguration:"Xe 6s1",family:"Alkali_Earth",symbol:"Cs",name:"Caesium",elementColor:[.34,.09,.56],discoveryCountry:["de"],discoverers:["Robert Wilhelm Bunsen","Gustav Robert Kirchhoff"]},{id:"Ba",atomicNumber:56,mass:137.327,exactMass:137.9052472,ionization:5.2117,electronAffinity:.14462,electronegativityPauling:.89,nameOrigin:"Greek 'barys' for 'heavy'",radiusCovalent:1.98,radiusVDW:2.7,boilingpoint:2078,meltingpoint:1002,periodTableBlock:"s",discoveryDate:"1808",period:"6",group:"2",electronicConfiguration:"Xe 6s2",family:"Alkaline_Earth",symbol:"Ba",name:"Barium",elementColor:[0,.79,0],discoveryCountry:["uk"],discoverers:["Humphry","Bartholomew","Davy"]},{id:"La",atomicNumber:57,mass:138.90547,exactMass:138.9063533,ionization:5.5769,electronAffinity:.47,electronegativityPauling:1.1,nameOrigin:"Greek 'lanthanein' for 'hidden'. The Lanthanoids are also called the 'rare earth' elements.",radiusCovalent:1.69,radiusVDW:2.5,boilingpoint:3737,meltingpoint:1191,periodTableBlock:"f",discoveryDate:"1839",period:"6",group:"3",electronicConfiguration:"Xe 5d1 6s2",family:"Rare_Earth",symbol:"La",name:"Lanthanum",elementColor:[.44,.83,1],discoveryCountry:["se"],discoverers:["K.","G.","Mosander"]},{id:"Ce",atomicNumber:58,mass:140.116,exactMass:139.9054387,ionization:5.5387,electronAffinity:.5,electronegativityPauling:1.12,nameOrigin:"Named after the planetoid Ceres",radiusVDW:2.48,boilingpoint:3715,meltingpoint:1071,periodTableBlock:"f",discoveryDate:"1803",period:"6",group:"4",electronicConfiguration:"Xe 4f1 5d1 6s2",family:"Rare_Earth",symbol:"Ce",name:"Cerium",elementColor:[1,1,.78],discoverers:["Jöns Jacob Berzelius","W. Hisinger","M. Klaproth"]},{id:"Pr",atomicNumber:59,mass:140.90765,exactMass:140.9076528,ionization:5.473,electronAffinity:.5,electronegativityPauling:1.13,nameOrigin:"Greek 'prasinos didymos' for 'green twin'",radiusVDW:2.47,boilingpoint:3785,meltingpoint:1204,periodTableBlock:"f",discoveryDate:"1885",period:"6",group:"5",electronicConfiguration:"Xe 4f3 6s2",family:"Rare_Earth",symbol:"Pr",name:"Praseodymium",elementColor:[.85,1,.78],discoverers:["Carl","F.","Auer","von","Welsbach"]},{id:"Nd",atomicNumber:60,mass:144.242,exactMass:141.9077233,ionization:5.525,electronAffinity:.5,electronegativityPauling:1.14,nameOrigin:"Greek 'neos didymos' for 'new twin'",radiusVDW:2.45,boilingpoint:3347,meltingpoint:1294,periodTableBlock:"f",discoveryDate:"1885",period:"6",group:"6",electronicConfiguration:"Xe 4f4 6s2",family:"Rare_Earth",symbol:"Nd",name:"Neodymium",elementColor:[.78,1,.78],discoverers:["Carl","F.","Auer","von","Welsbach"]},{id:"Pm",atomicNumber:61,mass:145,exactMass:144.912749,ionization:5.582,electronAffinity:.5,nameOrigin:"Named after the Greek Prometheus. Prometheus stole the fire from the gods and gave it to mankind.",radiusVDW:2.43,boilingpoint:3273,meltingpoint:1315,periodTableBlock:"f",discoveryDate:"1945",period:"6",group:"7",electronicConfiguration:"Xe 4f5 6s2",family:"Rare_Earth",symbol:"Pm",name:"Promethium",elementColor:[.64,1,.78],discoverers:["J. A. Marinsky","C. D. Coryell","L. E. Glendenin"]},{id:"Sm",atomicNumber:62,mass:150.36,exactMass:151.9197324,ionization:5.6437,electronAffinity:.5,electronegativityPauling:1.17,nameOrigin:"Named after the mineral Samarskit",radiusVDW:2.42,boilingpoint:2067,meltingpoint:1347,periodTableBlock:"f",discoveryDate:"1879",period:"6",group:"8",electronicConfiguration:"Xe 4f6 6s2",family:"Rare_Earth",symbol:"Sm",name:"Samarium",elementColor:[.56,1,.78],discoverers:["P.","Lecoq","de","Boisbaudran"]},{id:"Eu",atomicNumber:63,mass:151.964,exactMass:152.9212303,ionization:5.6704,electronAffinity:.5,nameOrigin:"Named after Europe",radiusVDW:2.4,boilingpoint:1800,meltingpoint:1095,periodTableBlock:"f",discoveryDate:"1901",period:"6",group:"8",electronicConfiguration:"Xe 4f7 6s2",family:"Rare_Earth",symbol:"Eu",name:"Europium",elementColor:[.38,1,.78],discoverers:["E.","A.","Demarcay"]},{id:"Gd",atomicNumber:64,mass:157.25,exactMass:157.9241039,ionization:6.1498,electronAffinity:.5,electronegativityPauling:1.2,nameOrigin:"Named after the Finnish chemist Johan Gadolin",radiusVDW:2.38,boilingpoint:3545,meltingpoint:1585,periodTableBlock:"f",discoveryDate:"1880",period:"6",group:"8",electronicConfiguration:"Xe 4f7 5d1 6s2",family:"Rare_Earth",symbol:"Gd",name:"Gadolinium",elementColor:[.27,1,.78],discoverers:["Jean","de","Marignac"]},{id:"Tb",atomicNumber:65,mass:158.92535,exactMass:158.9253468,ionization:5.8638,electronAffinity:.5,nameOrigin:"Named after the Swedish town of Ytterby",radiusVDW:2.37,boilingpoint:3500,meltingpoint:1629,periodTableBlock:"f",discoveryDate:"1843",period:"6",group:"1",electronicConfiguration:"Xe 4f9 6s2",family:"Rare_Earth",symbol:"Tb",name:"Terbium",elementColor:[.19,1,.78],discoverers:["K.","G.","Mosander"]},{id:"Dy",atomicNumber:66,mass:162.5,exactMass:163.9291748,ionization:5.9389,electronAffinity:.5,electronegativityPauling:1.22,nameOrigin:"Greek 'dysprositor' for 'difficult to reach'",radiusVDW:2.35,boilingpoint:2840,meltingpoint:1685,periodTableBlock:"f",discoveryDate:"1886",period:"6",group:"2",electronicConfiguration:"Xe 4f10 6s2",family:"Rare_Earth",symbol:"Dy",name:"Dysprosium",elementColor:[.12,1,.78],discoverers:["F.","E.","Lecoq","de","Boisbaudran"]},{id:"Ho",atomicNumber:67,mass:164.93032,exactMass:164.9303221,ionization:6.0215,electronAffinity:.5,electronegativityPauling:1.23,nameOrigin:"Latin 'holmia' for the old name of Stockholm",radiusVDW:2.33,boilingpoint:2968,meltingpoint:1747,periodTableBlock:"f",discoveryDate:"1878",period:"6",group:"3",electronicConfiguration:"Xe 4f11 6s2",family:"Rare_Earth",symbol:"Ho",name:"Holmium",elementColor:[0,1,.61],discoverers:["J. L. Soret","P.T. Cleve"]},{id:"Er",atomicNumber:68,mass:167.259,exactMass:165.9302931,ionization:6.1077,electronAffinity:.5,electronegativityPauling:1.24,nameOrigin:"Named ofter the Swedish town of Ytterby. Terbium and Ytterbium are also named after this town.",radiusVDW:2.32,boilingpoint:3140,meltingpoint:1802,periodTableBlock:"f",discoveryDate:"1843",period:"6",group:"4",electronicConfiguration:"Xe 4f12 6s2",family:"Rare_Earth",symbol:"Er",name:"Erbium",elementColor:[0,.9,.46],discoverers:["K.","G.","Mosander"]},{id:"Tm",atomicNumber:69,mass:168.93421,exactMass:168.9342133,ionization:6.1843,electronAffinity:.5,electronegativityPauling:1.25,nameOrigin:"Named after the old name of Scandinavia, 'Thule'.",radiusVDW:2.3,boilingpoint:2223,meltingpoint:1818,periodTableBlock:"f",discoveryDate:"1879",period:"6",group:"5",electronicConfiguration:"Xe 4f13 6s2",family:"Rare_Earth",symbol:"Tm",name:"Thulium",elementColor:[0,.83,.32],discoverers:["P.","T.","Cleve"]},{id:"Yb",atomicNumber:70,mass:173.054,exactMass:173.9388621,ionization:6.2542,electronAffinity:.5,nameOrigin:"Like Terbium and Gadolinium, this is named after the Swedish town of Ytterby.",radiusVDW:2.28,boilingpoint:1469,meltingpoint:1092,periodTableBlock:"f",discoveryDate:"1878",period:"6",group:"6",electronicConfiguration:"Xe 4f14 6s2",family:"Rare_Earth",symbol:"Yb",name:"Ytterbium",elementColor:[0,.75,.22],discoverers:["J.","Ch.","Marignac"]},{id:"Lu",atomicNumber:71,mass:174.9668,exactMass:174.9407718,ionization:5.4259,electronAffinity:.5,electronegativityPauling:1.27,nameOrigin:"Named after the Roman name 'Lutetia' for Paris",radiusCovalent:1.6,radiusVDW:2.27,boilingpoint:3668,meltingpoint:1936,periodTableBlock:"f",discoveryDate:"1907",period:"6",group:"7",electronicConfiguration:"Xe 4f14 5d1 6s2",family:"Rare_Earth",symbol:"Lu",name:"Lutetium",elementColor:[0,.67,.14],discoverers:["Carl F. Auer von Welsbach","G. Urbain"]},{id:"Hf",atomicNumber:72,mass:178.49,exactMass:179.94655,ionization:6.8251,electronAffinity:0,electronegativityPauling:1.3,nameOrigin:"'Hafnia' is the old name of Kopenhagen (Denmark)",radiusCovalent:1.5,radiusVDW:2.25,boilingpoint:4875,meltingpoint:2504,periodTableBlock:"d",discoveryDate:"1923",period:"6",group:"4",electronicConfiguration:"Xe 4f14 5d2 6s2",family:"Transition",symbol:"Hf",name:"Hafnium",elementColor:[.3,.76,1],discoveryCountry:["dk"],discoverers:["D. Coster","G. Hevesy"]},{id:"Ta",atomicNumber:73,mass:180.94788,exactMass:180.9479958,ionization:7.5496,electronAffinity:.322,electronegativityPauling:1.5,nameOrigin:"Named after the Greek myth of Tantalos",radiusCovalent:1.38,radiusVDW:2.2,boilingpoint:5730,meltingpoint:3293,periodTableBlock:"d",discoveryDate:"1802",period:"6",group:"5",electronicConfiguration:"Xe 4f14 5d3 6s2",family:"Transition",symbol:"Ta",name:"Tantalum",elementColor:[.3,.65,1],discoveryCountry:["se"],discoverers:["A.","Ekeberg"]},{id:"W",atomicNumber:74,mass:183.84,exactMass:183.9509312,ionization:7.864,electronAffinity:.815,electronegativityPauling:2.36,nameOrigin:"'tung sten' means 'heavy stone' in Swedish. The old name (and thus the symbol 'W') was Wolfram, named after a mineral.",radiusCovalent:1.46,radiusVDW:2.1,boilingpoint:5825,meltingpoint:3695,periodTableBlock:"d",discoveryDate:"1783",period:"6",group:"6",electronicConfiguration:"Xe 4f14 5d4 6s2",family:"Transition",symbol:"W",name:"Tungsten",elementColor:[.13,.58,.84],discoveryCountry:["es"],discoverers:["C.","W.","Scheele"]},{id:"Re",atomicNumber:75,mass:186.207,exactMass:186.9557531,ionization:7.8335,electronAffinity:.15,electronegativityPauling:1.9,nameOrigin:"Named after the German river Rhine (latin 'Rhenium').",radiusCovalent:1.59,radiusVDW:2.05,boilingpoint:5870,meltingpoint:3455,periodTableBlock:"d",discoveryDate:"1925",period:"6",group:"7",electronicConfiguration:"Xe 4f14 5d5 6s2",family:"Transition",symbol:"Re",name:"Rhenium",elementColor:[.15,.49,.67],discoveryCountry:["de"],discoverers:["Walter Noddack","Ida Tacke-Noddack","Otto Berg"]},{id:"Os",atomicNumber:76,mass:190.23,exactMass:191.9614807,ionization:8.4382,electronAffinity:1.0778,electronegativityPauling:2.2,nameOrigin:"Greek for 'smell'. Its oxides smell strongly like radishes.",radiusCovalent:1.28,radiusVDW:2,boilingpoint:5300,meltingpoint:3300,periodTableBlock:"d",discoveryDate:"1804",period:"6",group:"8",electronicConfiguration:"Xe 4f14 5d6 6s2",family:"Transition",symbol:"Os",name:"Osmium",elementColor:[.15,.4,.59],discoveryCountry:["uk"],discoverers:["S.","Tennant"]},{id:"Ir",atomicNumber:77,mass:192.217,exactMass:192.9629264,ionization:8.967,electronAffinity:1.56436,electronegativityPauling:2.2,nameOrigin:"Greek 'iris' for 'rainbow'",radiusCovalent:1.37,radiusVDW:2,boilingpoint:4700,meltingpoint:2720,periodTableBlock:"d",discoveryDate:"1804",period:"6",group:"8",electronicConfiguration:"Xe 4f14 5d7 6s2",family:"Transition",symbol:"Ir",name:"Iridium",elementColor:[.09,.33,.53],discoveryCountry:["uk"],discoverers:["S.","Tennant"]},{id:"Pt",atomicNumber:78,mass:195.084,exactMass:194.9647911,ionization:8.9588,electronAffinity:2.1251,electronegativityPauling:2.28,nameOrigin:"Spanish 'platina' means 'small silver'",radiusCovalent:1.28,radiusVDW:2.05,boilingpoint:4100,meltingpoint:2042.1,periodTableBlock:"d",discoveryDate:"1735",period:"6",group:"8",electronicConfiguration:"Xe 4f14 5d9 6s1",family:"Transition",symbol:"Pt",name:"Platinum",elementColor:[.96,.93,.82],discoveryCountry:["uk"],discoverers:["A.","de","Ulloa"]},{id:"Au",atomicNumber:79,mass:196.966569,exactMass:196.9665687,ionization:9.2255,electronAffinity:2.30861,electronegativityPauling:2.54,nameOrigin:"Latin 'aurum'. Named after Aurora, the goddess of sunrise",radiusCovalent:1.44,radiusVDW:2.1,boilingpoint:3130,meltingpoint:1337.58,periodTableBlock:"d",discoveryDate:"0",period:"6",group:"1",electronicConfiguration:"Xe 4f14 5d10 6s1",family:"Transition",symbol:"Au",name:"Gold",elementColor:[.8,.82,.12],discoveryCountry:["ancient"]},{id:"Hg",atomicNumber:80,mass:200.59,exactMass:201.970643,ionization:10.4375,electronAffinity:0,electronegativityPauling:2,nameOrigin:"Graeco-Latin 'hydrargyrum' for 'liquid silver'",radiusCovalent:1.49,radiusVDW:2.05,boilingpoint:629.88,meltingpoint:234.31,periodTableBlock:"d",discoveryDate:"0",period:"6",group:"2",electronicConfiguration:"Xe 4f14 5d10 6s2",family:"Transition",symbol:"Hg",name:"Mercury",elementColor:[.71,.71,.76],discoveryCountry:["ancient"]},{id:"Tl",atomicNumber:81,mass:204.3833,exactMass:204.9744275,ionization:6.1082,electronAffinity:.377,electronegativityPauling:1.62,nameOrigin:"Greek 'tallos' for 'young twig'",radiusCovalent:1.48,radiusVDW:2.2,boilingpoint:1746,meltingpoint:577,periodTableBlock:"p",discoveryDate:"1861",period:"6",group:"3",electronicConfiguration:"Xe 4f14 5d10 6s2 6p1",family:"Other_Metal",symbol:"Tl",name:"Thallium",elementColor:[.65,.33,.3],discoveryCountry:["uk"],discoverers:["W.","Crookes"]},{id:"Pb",atomicNumber:82,mass:207.2,exactMass:207.9766521,ionization:7.4167,electronAffinity:.364,electronegativityPauling:2.33,nameOrigin:"Latin 'plumbum' for Lead",radiusCovalent:1.47,radiusVDW:2.3,boilingpoint:2023,meltingpoint:600.65,periodTableBlock:"p",discoveryDate:"0",period:"6",group:"4",electronicConfiguration:"Xe 4f14 5d10 6s2 6p2",family:"Other_Metal",symbol:"Pb",name:"Lead",elementColor:[.34,.35,.38],discoveryCountry:["ancient"]},{id:"Bi",atomicNumber:83,mass:208.9804,exactMass:208.9803987,ionization:7.2855,electronAffinity:.942363,electronegativityPauling:2.02,nameOrigin:"The old name of Bismuth is 'Wismut', which stood for 'white mass'.",radiusCovalent:1.46,radiusVDW:2.3,boilingpoint:1837,meltingpoint:544.59,periodTableBlock:"p",discoveryDate:"0",period:"6",group:"5",electronicConfiguration:"Xe 4f14 5d10 6s2 6p3",family:"Other_Metal",symbol:"Bi",name:"Bismuth",elementColor:[.62,.31,.71],discoveryCountry:["ancient"]},{id:"Po",atomicNumber:84,mass:209,exactMass:208.9824304,ionization:8.414,electronAffinity:1.9,electronegativityPauling:2,nameOrigin:"Named after Poland to honor Marie Curie",radiusVDW:2,meltingpoint:527,periodTableBlock:"p",discoveryDate:"1898",period:"6",group:"6",electronicConfiguration:"Xe 4f14 5d10 6s2 6p4",family:"Metalloids",symbol:"Po",name:"Polonium",elementColor:[.67,.36,0],discoveryCountry:["fr"],discoverers:["M. Sklodowska-Curie","P. Curie"]},{id:"At",atomicNumber:85,mass:210,exactMass:209.987148,ionization:0,electronAffinity:2.8,electronegativityPauling:2.2,nameOrigin:"Greek 'astator' for 'changing'",radiusVDW:2,boilingpoint:610,meltingpoint:575,periodTableBlock:"p",discoveryDate:"1940",period:"6",group:"7",electronicConfiguration:"Xe 4f14 5d10 6s2 6p5",family:"Halogen",symbol:"At",name:"Astatine",elementColor:[.46,.31,.27],discoveryCountry:["us"],discoverers:["D. R. Corson","K. R. McKenzie","E. Segre"]},{id:"Rn",atomicNumber:86,mass:222,exactMass:222.0175777,ionization:10.7485,electronAffinity:0,nameOrigin:"Named after Radium. It ends with 'on' to make it clear that it is a noble gas.",radiusCovalent:1.45,radiusVDW:2,boilingpoint:211.4,meltingpoint:202,periodTableBlock:"p",discoveryDate:"1898",period:"6",group:"8",electronicConfiguration:"Xe 4f14 5d10 6s2 6p6",family:"Noblegas",symbol:"Rn",name:"Radon",elementColor:[.26,.51,.59],discoveryCountry:["de"],discoverers:["E.","Dorn"]},{id:"Fr",atomicNumber:87,mass:223,exactMass:223.0197359,ionization:4.0727,electronegativityPauling:.7,nameOrigin:"Named after France to honor Marguerite Perey",radiusVDW:2,boilingpoint:950,meltingpoint:300,periodTableBlock:"s",discoveryDate:"1939",period:"7",group:"1",electronicConfiguration:"Rn 7s1",family:"Alkali_Earth",symbol:"Fr",name:"Francium",elementColor:[.26,0,.4],discoveryCountry:["fr"],discoverers:["M.","Perey"]},{id:"Ra",atomicNumber:88,mass:226,exactMass:226.0254098,ionization:5.2784,electronegativityPauling:.9,nameOrigin:"Latin 'radius' for 'beam', as it is radioactive",radiusVDW:2,boilingpoint:1413,meltingpoint:973,periodTableBlock:"s",discoveryDate:"1898",period:"7",group:"2",electronicConfiguration:"Rn 7s2",family:"Alkaline_Earth",symbol:"Ra",name:"Radium",elementColor:[0,.49,0],discoveryCountry:["fr"],discoverers:["M. Sklodowska-Curie","P. Curie"]},{id:"Ac",atomicNumber:89,mass:227,exactMass:227.0277521,ionization:5.17,electronegativityPauling:1.1,nameOrigin:"Greek 'aktis' for 'beam' - actinium is radioactive",radiusVDW:2,boilingpoint:3470,meltingpoint:1324,periodTableBlock:"f",discoveryDate:"1899",period:"7",group:"3",electronicConfiguration:"Rn 6d1 7s2",family:"Other_Metal",symbol:"Ac",name:"Actinium",elementColor:[.44,.67,.98],discoveryCountry:["fr"],discoverers:["A.","L.","Debierne"]},{id:"Th",atomicNumber:90,mass:232.03806,exactMass:232.0380553,ionization:6.3067,electronegativityPauling:1.3,nameOrigin:"Named after the German god of thunder: Thor",radiusVDW:2.4,boilingpoint:5060,meltingpoint:2028,periodTableBlock:"f",discoveryDate:"1828",period:"7",group:"4",electronicConfiguration:"Rn 6d2 7s2",family:"Other_Metal",symbol:"Th",name:"Thorium",elementColor:[0,.73,1],discoverers:["J.","J.","Berzelius"]},{id:"Pa",atomicNumber:91,mass:231.03588,exactMass:231.035884,ionization:5.89,electronegativityPauling:1.5,nameOrigin:"Greek 'protos' for 'ancester'. Protactinium is before Actinium in the periodic table.",radiusVDW:2,boilingpoint:4300,meltingpoint:1845,periodTableBlock:"f",discoveryDate:"1917",period:"7",group:"5",electronicConfiguration:"Rn 5f2 6d1 7s2",family:"Other_Metal",symbol:"Pa",name:"Protactinium",elementColor:[0,.63,1],discoverers:["O. Hahn","L. Meitern","W. Wollaston"]},{id:"U",atomicNumber:92,mass:238.02891,exactMass:238.0507882,ionization:6.1941,electronegativityPauling:1.38,nameOrigin:"Greek 'ouranos' for 'heaven'. Named after the planet Uranus.",radiusVDW:2.3,boilingpoint:4407,meltingpoint:1408,periodTableBlock:"f",discoveryDate:"1789",period:"7",group:"6",electronicConfiguration:"Rn 5f3 6d1 7s2",family:"Other_Metal",symbol:"U",name:"Uranium",elementColor:[0,.56,1],discoverers:["M.","M.","Klaproth"]},{id:"Np",atomicNumber:93,mass:237,exactMass:237.0481734,ionization:6.2657,electronegativityPauling:1.36,nameOrigin:"Named after the planet Neptune.",radiusVDW:2,boilingpoint:4175,meltingpoint:912,periodTableBlock:"f",discoveryDate:"1940",period:"7",group:"7",electronicConfiguration:"Rn 5f4 6d1 7s2",family:"Other_Metal",symbol:"Np",name:"Neptunium",elementColor:[0,.5,1],discoverers:["E. M. McMillan","P. Aberson"]},{id:"Pu",atomicNumber:94,mass:244,exactMass:244.064204,ionization:6.026,electronegativityPauling:1.28,nameOrigin:"Named after the planet Pluto.",radiusVDW:2,boilingpoint:3505,meltingpoint:913,periodTableBlock:"f",discoveryDate:"1940",period:"7",group:"8",electronicConfiguration:"Rn 5f6 7s2",family:"Other_Metal",symbol:"Pu",name:"Plutonium",elementColor:[0,.42,1],discoverers:["Glenn T. Seaborg","E. M. McMillan","J. W. Kennedy","A.C. Wahl"]},{id:"Am",atomicNumber:95,mass:243,exactMass:243.0613811,ionization:5.9738,electronegativityPauling:1.3,nameOrigin:"Named after America.",radiusVDW:2,boilingpoint:2880,meltingpoint:1449,periodTableBlock:"f",discoveryDate:"1945",period:"7",group:"8",electronicConfiguration:"Rn 5f7 7s2",family:"Other_Metal",symbol:"Am",name:"Americium",elementColor:[.33,.36,.95],discoverers:["Glenn T. Seaborg","L. O. Morgan","R. A. James","A. Ghiors"]},{id:"Cm",atomicNumber:96,mass:247,exactMass:247.070354,ionization:5.9914,electronegativityPauling:1.3,nameOrigin:"Named after Marie Curie.",radiusVDW:2,boilingpoint:3383,meltingpoint:1620,periodTableBlock:"f",discoveryDate:"1944",period:"7",group:"8",electronicConfiguration:"Rn 5f7 6d1 7s2",family:"Other_Metal",symbol:"Cm",name:"Curium",elementColor:[.47,.36,.89],discoverers:["Glenn T. Seaborg","R. A. James","A. Ghiors"]},{id:"Bk",atomicNumber:97,mass:247,exactMass:247.070307,ionization:6.1979,electronegativityPauling:1.3,nameOrigin:"Named after the town Berkeley where it was discovered.",radiusVDW:2,boilingpoint:983,meltingpoint:1258,periodTableBlock:"f",discoveryDate:"1949",period:"7",group:"1",electronicConfiguration:"Rn 5f9 7s2",family:"Other_Metal",symbol:"Bk",name:"Berkelium",elementColor:[.54,.31,.89],discoverers:["Glenn T. Seaborg","A. Ghiors","S. G. Thompson"]},{id:"Cf",atomicNumber:98,mass:251,exactMass:251.079587,ionization:6.2817,electronegativityPauling:1.3,nameOrigin:"Named after the US-State of California.",radiusVDW:2,boilingpoint:1173,meltingpoint:1172,periodTableBlock:"f",discoveryDate:"1950",period:"7",group:"2",electronicConfiguration:"Rn 5f10 7s2",family:"Other_Metal",symbol:"Cf",name:"Californium",elementColor:[.63,.21,.83],discoverers:["Glenn T. Seaborg","A. Ghiors","S. G. Thompson"]},{id:"Es",atomicNumber:99,mass:252,exactMass:252.08298,ionization:6.42,electronegativityPauling:1.3,nameOrigin:"Named after the scientist Albert Einstein.",radiusVDW:2,meltingpoint:1130,periodTableBlock:"f",discoveryDate:"1952",period:"7",group:"3",electronicConfiguration:"Rn 5f11 7s2",family:"Other_Metal",symbol:"Es",name:"Einsteinium",elementColor:[.7,.12,.83],discoverers:["Glenn T. Seaborg","et al."]},{id:"Fm",atomicNumber:100,mass:257,exactMass:257.095105,ionization:6.5,electronegativityPauling:1.3,nameOrigin:"Named after the scientist Enrico Fermi.",radiusVDW:2,meltingpoint:1800,periodTableBlock:"f",discoveryDate:"1953",period:"7",group:"4",electronicConfiguration:"Rn 5f12 7s2",family:"Other_Metal",symbol:"Fm",name:"Fermium",elementColor:[.7,.12,.73],discoverers:["Glenn T. Seaborg","et al."]},{id:"Md",atomicNumber:101,mass:258,exactMass:258.098431,ionization:6.58,electronegativityPauling:1.3,nameOrigin:"Named after the scientist D.I. Mendeleev.",radiusVDW:2,meltingpoint:1100,periodTableBlock:"f",discoveryDate:"1955",period:"7",group:"5",electronicConfiguration:"Rn 5f13 7s2",family:"Other_Metal",symbol:"Md",name:"Mendelevium",elementColor:[.7,.05,.65],discoverers:["Glenn T. Seaborg","Albert Ghiorso","Bernard Harvey","Gregory Choppin","Stanley G. Thompson"]},{id:"No",atomicNumber:102,mass:259,exactMass:259.10103,ionization:6.65,electronegativityPauling:1.3,nameOrigin:"Named after the scientist Alfred Nobel.",radiusVDW:2,meltingpoint:1100,periodTableBlock:"f",discoveryDate:"1958",period:"7",group:"6",electronicConfiguration:"Rn 5f14 7s2",family:"Other_Metal",symbol:"No",name:"Nobelium",elementColor:[.74,.05,.53]},{id:"Lr",atomicNumber:103,mass:262,exactMass:262.10963,ionization:4.9,nameOrigin:"Named after the scientist Ernest Orlando Lawrence.",radiusVDW:2,meltingpoint:1900,periodTableBlock:"f",discoveryDate:"1961",period:"7",group:"7",electronicConfiguration:"Rn 5f14 7s2 7p1",family:"Other_Metal",symbol:"Lr",name:"Lawrencium",elementColor:[.78,0,.4],discoverers:["Albert Ghiorso","Torbjorn Sikkeland","Almon Larsh","Robert M. Latimer"]},{id:"Rf",atomicNumber:104,mass:267,exactMass:261.10877,ionization:6,nameOrigin:"Named after the scientist Ernest Rutherford",radiusVDW:2,periodTableBlock:"d",discoveryDate:"1964",period:"7",group:"4",electronicConfiguration:"Rn 5f14 6d2 7s2",family:"Transition",symbol:"Rf",name:"Rutherfordium",elementColor:[.8,0,.35],discoveryCountry:["ru","us"]},{id:"Db",atomicNumber:105,mass:268,exactMass:262.11408,nameOrigin:"Named after the science-town Dubna in Russia",radiusVDW:2,periodTableBlock:"d",discoveryDate:"1967",period:"7",group:"5",electronicConfiguration:"Rn 5f14 6d3 7s2",family:"Transition",symbol:"Db",name:"Dubnium",elementColor:[.82,0,.31],discoveryCountry:["ru","us"]},{id:"Sg",atomicNumber:106,mass:271,exactMass:263.11832,nameOrigin:"Named after the scientist G. Theodore Seaborg.",radiusVDW:2,periodTableBlock:"d",discoveryDate:"1974",period:"7",group:"6",family:"Transition",symbol:"Sg",name:"Seaborgium",elementColor:[.85,0,.27],discoveryCountry:["ru","us"],discoverers:["Albert Ghiorso","et al."]},{id:"Bh",atomicNumber:107,mass:272,exactMass:264.1246,nameOrigin:"Named after the scientist Niels Bohr.",radiusVDW:2,periodTableBlock:"d",discoveryDate:"1981",period:"7",group:"7",family:"Transition",symbol:"Bh",name:"Bohrium",elementColor:[.88,0,.22],discoveryCountry:["ru"],discoverers:["Peter Armbruster","Gottfried Münzenber","et al."]},{id:"Hs",atomicNumber:108,mass:270,exactMass:265.13009,nameOrigin:"Latin 'hassia' for the German county Hessen. In Hessen a lot elements have been discovered.",radiusVDW:2,periodTableBlock:"d",discoveryDate:"1984",period:"7",group:"8",family:"Transition",symbol:"Hs",name:"Hassium",elementColor:[.9,0,.18],discoveryCountry:["de"],discoverers:["Peter Armbruster","Gottfried Münzenber","et al."]},{id:"Mt",atomicNumber:109,mass:276,exactMass:268.13873,nameOrigin:"Named after the scientist Lise Meitner.",radiusVDW:2,periodTableBlock:"d",discoveryDate:"1982",period:"7",group:"8",family:"Transition",symbol:"Mt",name:"Meitnerium",elementColor:[.91,0,.15],discoveryCountry:["de"],discoverers:["Peter Armbruster","Gottfried Münzenber","et al."]},{id:"Ds",atomicNumber:110,mass:281,exactMass:271.14606,nameOrigin:"Named after the German city Darmstadt where many elements have been discovered.",periodTableBlock:"d",discoveryDate:"1994",period:"7",group:"8",family:"Transition",symbol:"Ds",name:"Darmstadtium",elementColor:[.92,0,.14],discoveryCountry:["de"],discoverers:["S. Hofmann","V. Ninov","F. P. Hessberger","P. Armbruster","H. Folger","G. Münzenberg","H. J. Schött","et al."]},{id:"Rg",atomicNumber:111,mass:280,exactMass:272.15362,nameOrigin:"Named after Wilhelm Conrad Röntgen.",periodTableBlock:"d",discoveryDate:"1994",period:"7",group:"1",family:"Transition",symbol:"Rg",name:"Roentgenium",elementColor:[.93,0,.13],discoveryCountry:["de"],discoverers:["S. Hofmann","V. Ninov","F. P. Hessberger","P. Armbruster","H. Folger","G. Münzenberg","et al."]},{id:"Cn",atomicNumber:112,mass:285,exactMass:285.17411,nameOrigin:"Historically known as eka-mercury. Ununbium is a temporary IUPAC systematic element name.",periodTableBlock:"d",discoveryDate:"1996",period:"7",family:"Transition",symbol:"Cn",name:"Copernicium",elementColor:[.94,0,.12],discoveryCountry:["de"],discoverers:["First","created","at","the","Gesellschaft","für","Schwerionenforschung"]},{id:"Uut",atomicNumber:113,mass:284,exactMass:284.17808,nameOrigin:"Historically known as eka-thallium. Ununtrium is a temporary IUPAC systematic element name.",periodTableBlock:"p",discoveryDate:"2003",period:"7",family:"Other_Metal",symbol:"Uut",name:"Ununtrium",elementColor:[.95,0,.11],discoveryCountry:["ru","us"],discoverers:["Russian scientists at Dubna (JINR)","American scientists at the Lawrence Livermore National Laboratory."]},{id:"Uuq",atomicNumber:114,mass:289,exactMass:289.18728,nameOrigin:"Historically known as eka-lead. Ununquadium is a temporary IUPAC systematic element name.",periodTableBlock:"p",discoveryDate:"1998",period:"7",family:"Other_Metal",symbol:"Uuq",name:"Ununquadium",elementColor:[.96,0,.1],discoveryCountry:["ru","us"],discoverers:["Joint","Institute","for","Nuclear","Research"]},{id:"Uup",atomicNumber:115,mass:288,exactMass:288.19249,nameOrigin:"Historically known as eka-bismuth. Ununpentium is a temporary IUPAC systematic element name.",periodTableBlock:"p",discoveryDate:"2004",period:"7",family:"Other_Metal",symbol:"Uup",name:"Ununpentium",elementColor:[.97,0,.09],discoveryCountry:["ru","us"],discoverers:["Russian scientists at Dubna (JINR)","American scientists at the Lawrence Livermore National Laboratory."]},{id:"Uuh",atomicNumber:116,mass:293,exactMass:292.19979,nameOrigin:"Historically known as eka-polonium. Ununhexium is a temporary IUPAC systematic element name.",periodTableBlock:"p",discoveryDate:"2000",period:"7",family:"Other_Metal",symbol:"Uuh",name:"Ununhexium",elementColor:[.98,0,.08],discoveryCountry:["ru"],discoverers:["Joint","Institute","for","Nuclear","Research"]},{id:"Uus",atomicNumber:117,nameOrigin:"Temporary symbol and name. Can also be referred to as eka-astatine.",periodTableBlock:"p",discoveryDate:"0",period:"7",family:"Halogen",symbol:"Uus",name:"Ununseptium",elementColor:[.99,0,.07]},{id:"Uuo",atomicNumber:118,mass:294,nameOrigin:"Historically known as eka-radon, eka-emanation before 1960. Ununoctium is a temporary IUPAC systematic element name.",periodTableBlock:"p",discoveryDate:"2002",period:"7",family:"Noblegas",symbol:"Uuo",name:"Ununoctium",elementColor:[1,0,.06],discoveryCountry:["ru","us"],discoverers:["Russian scientists at Dubna (JINR)","American scientists at the Lawrence Livermore National Laboratory."]}]}},function(e,t,n){e.exports=function(){return n(87)('/*!\n * @project vtk.js\n * @build Mon, Apr 22, 2019 9:19 PM ET\n * @copyright Copyright (c) 2019 Kitware, Inc.\n *\n */!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=1)}([function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=function(){function t(t,e){for(var n=0;n1?e-1:0),r=1;r1?r-1:0),a=1;a3&&void 0!==arguments[3]?arguments[3]:[];d([s,t,e,n],r)},w=function(t,e,n){if(!e)throw new Error("eventName is required");if("string"!=typeof e)throw new Error("eventName should be string");d([c,t,e,n])};return self.addEventListener("message",function(t){var e=t.data;Array.isArray(e)?function(t,e,n){var r=function(e){e&&e instanceof h?P(t,y,e.payload,e.transferable):P(t,y,e)},o=function(e){P(t,p,{message:e.message,stack:e.stack})};try{var i=g(t,e,n);b(i)?i.then(r).catch(o):r(i)}catch(t){o(t)}}.apply(void 0,u(e)):e&&e.eventName&&_.emitLocally.apply(_,[e.eventName].concat(u(e.args)))}),_},t.exports.TransferableResponse=h},function(t,e,n){"use strict";n.r(e);var r=n(0),o=n.n(r);const i={buffer:null,dimensions:[0,0,0],prevPoint:null};o()().operation("start",({bufferType:t,dimensions:e})=>{const n=e[0]*e[1]*e[2];i.buffer=new self[t](n),i.dimensions=e,i.prevPoint=null}).operation("paint",function({point:t,radius:e}){const n=i.dimensions,[r,o,a]=t,[u,f,l]=e;i.prevPoint||(i.prevPoint=t);const s=Math.floor(Math.min(n[0]-1,Math.max(0,r-u))),c=Math.floor(Math.min(n[0]-1,Math.max(0,r+u))),p=Math.floor(Math.min(n[1]-1,Math.max(0,o-f))),y=Math.floor(Math.min(n[1]-1,Math.max(0,o+f))),v=Math.floor(Math.min(n[2]-1,Math.max(0,a-l))),b=Math.floor(Math.min(n[2]-1,Math.max(0,a+l))),h=n[0],m=n[0]*n[1],d=[t[0]-i.prevPoint[0],t[1]-i.prevPoint[1],t[2]-i.prevPoint[2]],_=[1,1,1];for(let t=0;t<3;t++)d[t]<0&&(d[t]=-d[t],_[t]=-1);const g=Math.max(...d);for(let t=s;t<=c;t++)for(let e=p;e<=y;e++)for(let s=v;s<=b;s++){const c=[t-r,e-o,s-a],p=c[0]/u,y=c[1]/f,v=c[2]/l;if(p*p+y*y+v*v<=1){const t=[c[0]+i.prevPoint[0],c[1]+i.prevPoint[1],c[2]+i.prevPoint[2]],e=[g,g,g];for(let r=0;r<=g;r++){if(t[0]>=0&&t[0]=0&&t[1]=0&&t[2]new o.a.TransferableResponse(i.buffer.buffer,[i.buffer.buffer]))},function(t,e,n){"use strict";var r=function(){function t(t,e){for(var n=0;n1?e-1:0),r=1;r\n\n \x3c!-- Generator: Sketch 43.1 (39012) - http://www.bohemiancoding.com/sketch --\x3e\n Tint\n Created with Sketch.\n \n \n \n \n \n \n'},function(e,t,n){var r=n(162);"string"==typeof r&&(r=[[e.i,r,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n(55)(r,a);r.locals&&(e.exports=r.locals)},function(e){e.exports=[{Name:"KAAMS",IndexedColors:[1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,0,1,0,1,1,.63,.63,1,.67,.5,.33,1,.5,.75,.53,.35,.7,1,.75,.5],Annotations:[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11]},{ColorSpace:"Diverging",Name:"Cool to Warm",NanColor:[1,1,0],RGBPoints:[0,.23137254902,.298039215686,.752941176471,.5,.865,.865,.865,1,.705882352941,.0156862745098,.149019607843]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Cool to Warm (Extended)",NanColor:[.25,0,0],RGBPoints:[0,0,0,.34902,.03125,.039216,.062745,.380392,.0625,.062745,.117647,.411765,.09375,.090196,.184314,.45098,.125,.12549,.262745,.501961,.15625,.160784,.337255,.541176,.1875,.2,.396078,.568627,.21875,.239216,.454902,.6,.25,.286275,.521569,.65098,.28125,.337255,.592157,.701961,.3125,.388235,.654902,.74902,.34375,.466667,.737255,.819608,.375,.572549,.819608,.878431,.40625,.654902,.866667,.909804,.4375,.752941,.917647,.941176,.46875,.823529,.956863,.968627,.5,.988235,.960784,.901961,.5,.941176,.984314,.988235,.52,.988235,.945098,.85098,.54,.980392,.898039,.784314,.5625,.968627,.835294,.698039,.59375,.94902,.733333,.588235,.625,.929412,.65098,.509804,.65625,.909804,.564706,.435294,.6875,.878431,.458824,.352941,.71875,.839216,.388235,.286275,.75,.760784,.294118,.211765,.78125,.701961,.211765,.168627,.8125,.65098,.156863,.129412,.84375,.6,.094118,.094118,.875,.54902,.066667,.098039,.90625,.501961,.05098,.12549,.9375,.45098,.054902,.172549,.96875,.4,.054902,.192157,1,.34902,.070588,.211765]},{ColorSpace:"Diverging",Name:"Warm to Cool",NanColor:[1,1,0],RGBPoints:[0,.705882352941,.0156862745098,.149019607843,.5,.865,.865,.865,1,.23137254902,.298039215686,.752941176471]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Warm to Cool (Extended)",NanColor:[.250004,0,0],RGBPoints:[0,.34902,0,.129412,.025,.4,.00392157,.101961,.05,.470588,.0156863,.0901961,.075,.54902,.027451,.0705882,.1,.619608,.0627451,.0431373,.125,.690196,.12549,.0627451,.15,.741176,.184314,.0745098,.175,.788235,.266667,.0941176,.2,.811765,.345098,.113725,.225,.831373,.411765,.133333,.25,.85098,.47451,.145098,.275,.870588,.54902,.156863,.3,.878431,.619608,.168627,.325,.890196,.658824,.196078,.35,.909804,.717647,.235294,.375,.929412,.776471,.278431,.395522,.94902,.823529,.321569,.418905,.968627,.87451,.407843,.444278,.980392,.917647,.509804,.470149,.988235,.956863,.643137,.483582,.992157,.964706,.713725,.499,.988235,.980392,.870588,.5,1,1,1,.501,.913725,.988235,.937255,.516418,.827451,.980392,.886275,.531343,.764706,.980392,.866667,.546766,.658824,.980392,.843137,.564179,.572549,.964706,.835294,.587562,.423529,.941176,.87451,.60597,.262745,.901961,.862745,.629851,.0705882,.854902,.870588,.651741,.0509804,.8,.85098,.681592,.0235294,.709804,.831373,.712935,.0313725,.615686,.811765,.75,.0313725,.537255,.788235,.775,.0392157,.466667,.768627,.8,.0509804,.396078,.741176,.825,.054902,.317647,.709804,.85,.054902,.243137,.678431,.875,.0431373,.164706,.639216,.9,.0313725,.0980392,.6,.925,.0392157,.0392157,.560784,.95,.105882,.0509804,.509804,.975,.113725,.0235294,.45098,1,.12549,0,.380392]},{ColorSpace:"RGB",Name:"Rainbow Desaturated",NanColor:[1,1,0],RGBPoints:[0,.278431372549,.278431372549,.858823529412,.143,0,0,.360784313725,.285,0,1,1,.429,0,.501960784314,0,.571,1,1,0,.714,1,.380392156863,0,.857,.419607843137,0,0,1,.878431372549,.301960784314,.301960784314]},{ColorSpace:"RGB",Name:"Cold and Hot",NanColor:[1,1,0],RGBPoints:[0,0,1,1,.45,0,0,1,.5,0,0,.501960784314,.55,1,0,0,1,1,1,0]},{ColorSpace:"RGB",Name:"Black-Body Radiation",NanColor:[0,.498039215686,1],RGBPoints:[0,0,0,0,.4,.901960784314,0,0,.8,.901960784314,.901960784314,0,1,1,1,1]},{ColorSpace:"RGB",Name:"X Ray",NanColor:[1,0,0],RGBPoints:[0,1,1,1,1,0,0,0]},{ColorSpace:"RGB",Name:"Grayscale",NanColor:[1,0,0],RGBPoints:[0,0,0,0,1,1,1,1]},{ColorSpace:"RGB",Name:"Black, Blue and White",NanColor:[1,1,0],RGBPoints:[0,0,0,0,.333,0,0,.501960784314,.666,0,.501960784314,1,1,1,1,1]},{ColorSpace:"RGB",Name:"Black, Orange and White",NanColor:[1,1,0],RGBPoints:[0,0,0,0,.333,.501960784314,0,0,.666,1,.501960784314,0,1,1,1,1]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Linear YGB 1211g",NanColor:[.25,0,0],RGBPoints:[0,1,.988235,.968627,.02,1,.952941,.878431,.05,.968627,.905882,.776471,.1,.94902,.898039,.647059,.15,.901961,.878431,.556863,.2,.847059,.858824,.482353,.25,.690196,.819608,.435294,.3,.513725,.768627,.384314,.35,.337255,.721569,.337255,.4,.278431,.658824,.392157,.45,.231373,.639216,.435294,.5,.203922,.6,.486275,.55,.172549,.568627,.537255,.6,.141176,.517647,.54902,.65,.133333,.458824,.541176,.7,.12549,.396078,.529412,.75,.117647,.321569,.521569,.8,.121569,.258824,.509804,.85,.133333,.227451,.501961,.9,.145098,.192157,.490196,.95,.188235,.164706,.470588,1,.258824,.196078,.439216]},{ColorSpace:"CIELAB",Creator:"Francesca Samsel",Name:"Linear Green (Gr4L)",NanColor:[.25,0,0],RGBPoints:[0,.054902,.109804,.121569,.05,.07451,.172549,.180392,.1,.086275,.231373,.219608,.15,.094118,.278431,.25098,.2,.109804,.34902,.278431,.25,.113725,.4,.278431,.3,.117647,.45098,.270588,.35,.117647,.490196,.243137,.4,.113725,.521569,.203922,.45,.109804,.54902,.152941,.5,.082353,.588235,.082353,.55,.109804,.631373,.05098,.6,.211765,.678431,.082353,.65,.317647,.721569,.113725,.7,.431373,.760784,.160784,.75,.556863,.8,.239216,.8,.666667,.839216,.294118,.85,.784314,.878431,.396078,.9,.886275,.921569,.533333,.95,.960784,.94902,.670588,1,1,.984314,.901961]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Linear Blue (8_31f)",NanColor:[.25,0,0],RGBPoints:[0,.960784,1,.980392,.05,.815686,.960784,.913725,.1,.670588,.929412,.870588,.15,.556863,.901961,.843137,.2,.478431,.870588,.823529,.25,.439216,.831373,.803922,.3,.4,.8,.788235,.35,.376471,.768627,.768627,.4,.34902,.709804,.729412,.45,.32549,.654902,.690196,.5,.301961,.607843,.658824,.55,.247059,.545098,.619608,.6,.239216,.494118,.580392,.65,.227451,.439216,.541176,.7,.227451,.403922,.521569,.75,.231373,.368627,.501961,.8,.227451,.321569,.470588,.85,.219608,.282353,.439216,.9,.192157,.235294,.4,.95,.160784,.184314,.34902,1,.133333,.12549,.301961]},{ColorSpace:"HSV",Name:"Blue to Red Rainbow",NanColor:[.498039215686,.498039215686,.498039215686],RGBPoints:[0,0,0,1,1,1,0,0]},{ColorSpace:"HSV",Name:"Red to Blue Rainbow",NanColor:[.498039215686,.498039215686,.498039215686],RGBPoints:[0,1,0,0,1,0,0,1]},{ColorSpace:"RGB",Name:"Rainbow Blended White",NanColor:[1,1,0],RGBPoints:[0,1,1,1,.17,0,0,1,.34,0,1,1,.5,0,1,0,.67,1,1,0,.84,1,0,0,1,.878431372549,0,1]},{ColorSpace:"RGB",Name:"Rainbow Blended Grey",NanColor:[1,1,0],RGBPoints:[0,.317647058824,.341176470588,.43137254902,.17,0,0,1,.34,0,1,1,.5,0,1,0,.67,1,1,0,.84,1,0,0,1,.878431372549,0,1]},{ColorSpace:"RGB",Name:"Rainbow Blended Black",NanColor:[1,1,0],RGBPoints:[0,0,0,0,.17,0,0,1,.34,0,1,1,.5,0,1,0,.67,1,1,0,.84,1,0,0,1,.878431372549,0,1]},{ColorSpace:"RGB",Name:"Blue to Yellow",NanColor:[1,0,0],RGBPoints:[0,.0392156862745,.0392156862745,.949019607843,1,.949019607843,.949019607843,.0392156862745]},{ColorSpace:"HSV",Name:"blot",RGBPoints:[0,0,0,1,.166,0,0,1,.167,1,0,1,.332,1,0,1,.333,0,1,1,.5,0,1,1,.501,0,1,0,.666,0,1,0,.667,1,1,0,.832,1,1,0,.833,1,0,0,1,1,0,0]},{ColorSpace:"Lab",Name:"CIELab Blue to Red",NanColor:[1,1,0],RGBPoints:[0,0,.6,.749019607843,1,.76862745098,.466666666667,.341176470588]},{ColorSpace:"RGB",Name:"jet",RGBPoints:[-1,0,0,.5625,-.777778,0,0,1,-.269841,0,1,1,-.015873,.5,1,.5,.238095,1,1,0,.746032,1,0,0,1,.5,0,0]},{ColorSpace:"RGB",Name:"rainbow",RGBPoints:[-1,0,0,1,-.5,0,1,1,0,0,1,0,.5,1,1,0,1,1,0,0]},{ColorSpace:"Lab",Name:"erdc_rainbow_bright",RGBPoints:[-1,.32549,.14902,.960784,-.866221,.297047,.375586,.963836,-.732441,.180302,.536818,.964627,-.598662,.1302,.649207,.929647,-.464883,.0445143,.749654,.855998,-.331104,.0271325,.830713,.721527,-.197324,.259504,.866145,.543555,-.0635452,.428364,.890725,.329819,.0702341,.568503,.898508,.187623,.204013,.738259,.890317,.0825461,.337793,.84546,.86136,.0147555,.471572,.912191,.808018,0,.605351,.962848,.710445,0,.73913,.999469,.600258,.0176284,.87291,.994156,.445975,.193912,1,.980407,.247105,.262699]},{ColorSpace:"Lab",Name:"erdc_rainbow_dark",RGBPoints:[-1,0,0,.423499,-.866221,0,.119346,.529237,-.732441,0,.238691,.634976,-.598662,0,.346852,.68788,-.464883,0,.45022,.718141,-.331104,0,.553554,.664839,-.197324,0,.651082,.519303,-.0635452,.115841,.72479,.352857,.0702341,.326771,.781195,.140187,.204013,.522765,.798524,.0284624,.337793,.703162,.788685,.00885756,.471572,.845118,.751133,0,.605351,.955734,.690825,0,.73913,.995402,.567916,.0618524,.87291,.987712,.403398,.164851,1,.980407,.247105,.262699]},{ColorSpace:"Lab",Name:"nic_CubicL",RGBPoints:[-1,.479965,.0118108,.5307,-.87451,.522213,.0551282,.706919,-.74902,.50839,.237278,.867764,-.623529,.451617,.373834,.987255,-.498039,.39365,.497255,.97506,-.372549,.328631,.599639,.891843,-.247059,.250043,.690286,.778553,-.121569,.249656,.764905,.645857,.00392157,.297954,.821466,.50449,.129412,.337509,.872595,.358447,.254902,.430011,.913789,.297079,.380392,.587191,.931381,.333353,.505882,.727937,.93591,.353742,.631373,.826403,.921081,.365066,.756863,.893201,.846317,.372662,.882353,.965347,.73884,.378506,1,.983235,.597451,.366856]},{ColorSpace:"Lab",Name:"nic_CubicYF",RGBPoints:[-1,.5151,.0482,.6697,-.87451,.520711,.168955,.800574,-.74902,.493694,.278596,.911824,-.623529,.440026,.369475,.984978,-.498039,.398932,.457593,.987053,-.372549,.350651,.540644,.929608,-.247059,.298827,.615625,.857729,-.121569,.239928,.685061,.769531,.00392157,.228832,.739349,.673287,.129412,.263297,.78608,.569988,.254902,.298107,.828337,.460214,.380392,.33092,.864071,.352674,.505882,.38306,.898169,.287309,.631373,.49023,.917481,.307961,.756863,.62372,.926026,.332309,.882353,.717458,.92527,.342476,1,.8,.9255,.3529]},{ColorSpace:"Lab",Name:"gist_earth",RGBPoints:[-1,0,0,0,-.87451,.239216,.027451,.415686,-.74902,.0901961,.254902,.556863,-.623529,.0941176,.352941,.54902,-.498039,.105882,.435294,.533333,-.372549,.12549,.52549,.501961,-.247059,.156863,.596078,.443137,-.121569,.196078,.65098,.380392,.00392157,.282353,.717647,.301961,.129412,.466667,.772549,.27451,.254902,.678431,.784314,.309804,.380392,.901961,.756863,.376471,.505882,.992157,.705882,.521569,.631373,1,.721569,.701961,.756863,1,.784314,.784314,.882353,1,.866667,.866667,1,1,1,1]},{ColorSpace:"Lab",Name:"2hot",RGBPoints:[-1,.0416667,0,0,-.873016,.208333,0,0,-.746032,.375,0,0,-.619048,.541667,0,0,-.492063,.708333,0,0,-.365079,.854137,0,0,-.238095,.937488,.039062,0,-.111111,1,.208333,0,.015873,1,.375,0,.142857,1,.541667,0,.269841,1,.708333,0,.396825,1,.858805,.03125,.52381,1,.947392,.15625,.650794,1,1,.3125,.777778,1,1,.5625,.904762,1,1,.8125,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_red2yellow_BW",RGBPoints:[-1,7.54296e-7,0,109827e-10,-.87451,.18285,.0264094,0,-.74902,.3066,0,0,-.623529,.422841,0,0,-.498039,.522945,0,0,-.372549,.605721,0,0,-.247059,.672502,.14168,0,-.121569,.728167,.244025,0,.00392157,.781215,.333454,0,.129412,.825,.423586,0,.254902,.855893,.516793,0,.380392,.880491,.608846,0,.505882,.910305,.695505,0,.631373,.94109,.779067,.223528,.756863,.967873,.858572,.473521,.882353,.986815,.933211,.751583,1,1,1,.999997]},{ColorSpace:"Lab",Name:"erdc_marine2gold_BW",RGBPoints:[-1,1.11641e-7,0,162551e-11,-.87451,.0413146,.0619808,.209857,-.74902,.0185557,.101341,.350684,-.623529,.00486405,.149847,.461054,-.498039,.0836345,.210845,.517906,-.372549,.173222,.276134,.541793,-.247059,.259857,.343877,.535869,-.121569,.362299,.408124,.504293,.00392157,.468266,.468276,.468257,.129412,.582781,.527545,.374914,.254902,.691591,.585251,.274266,.380392,.784454,.645091,.247332,.505882,.862299,.710383,.27518,.631373,.920863,.782923,.351563,.756863,.955792,.859699,.533541,.882353,.976162,.93433,.780671,1,1,1,.999983]},{ColorSpace:"Lab",Name:"erdc_blue2gold_BW",RGBPoints:[-1,0,0,0,-.87451,.0742735,.0440331,.230013,-.74902,.125276,.0258685,.415826,-.623529,.143879,.0163031,.591346,-.498039,.212261,.0627855,.705239,-.372549,.306048,.141178,.763636,-.247059,.391537,.232286,.773263,-.121569,.461734,.336633,.708321,.00392157,.54209,.427581,.590007,.129412,.61704,.508623,.460978,.254902,.702703,.579586,.309117,.380392,.790336,.644811,.170397,.505882,.870173,.710733,.117134,.631373,.93656,.781991,.157144,.756863,.965672,.862068,.409836,.882353,.985751,.936296,.714162,1,1,1,.999999]},{ColorSpace:"Lab",Name:"erdc_sapphire2gold_BW",RGBPoints:[-1,.107704,.107708,.107694,-.87451,.1851,.112354,.308554,-.74902,.236782,.114233,.48788,-.623529,.28296,.126187,.639464,-.498039,.344787,.171643,.739713,-.372549,.413325,.242371,.76913,-.247059,.481863,.3131,.719841,-.121569,.550402,.383829,.612222,.00392157,.61894,.454558,.51126,.129412,.687478,.525287,.39993,.254902,.756017,.596016,.289923,.380392,.824555,.666745,.255498,.505882,.892979,.736822,.27696,.631373,.938851,.804966,.351734,.756863,.966491,.874853,.53572,.882353,.982105,.94153,.782579,1,1,1,.999986]},{ColorSpace:"Lab",Name:"erdc_red2purple_BW",RGBPoints:[-1,0,0,0,-.87451,.167793,.0166271,.0431278,-.74902,.262608,.0107595,.0791181,-.623529,.351902,.0101858,.100926,-.498039,.441257,.0160835,.131919,-.372549,.5221,.0555972,.195625,-.247059,.593852,.104294,.310234,-.121569,.654628,.158115,.448486,.00392157,.707443,.220914,.570253,.129412,.749504,.293268,.67897,.254902,.781587,.370517,.779269,.380392,.809951,.451099,.855831,.505882,.84424,.531462,.900451,.631373,.865174,.620901,.91606,.756863,.875041,.714054,.910284,.882353,.880764,.80554,.896276,1,.887572,.887591,.887556]},{ColorSpace:"Lab",Name:"erdc_purple2pink_BW",RGBPoints:[-1,0,0,0,-.87451,.117562,.0291202,.175876,-.74902,.178368,.0458476,.285454,-.623529,.237731,.0680173,.387717,-.498039,.300877,.0956291,.484802,-.372549,.370929,.136858,.554985,-.247059,.449033,.189273,.58863,-.121569,.529971,.245796,.598587,.00392157,.609914,.300643,.610244,.129412,.697079,.351286,.616371,.254902,.785858,.401991,.617376,.380392,.862517,.45745,.64463,.505882,.91359,.525462,.705336,.631373,.932583,.61064,.767412,.756863,.922478,.706966,.817522,.882353,.901302,.803071,.856311,1,.887571,.887591,.887549]},{ColorSpace:"Lab",Name:"erdc_pbj_lin",RGBPoints:[-1,0,0,0,-.87451,.091821,.0611476,.10617,-.74902,.160311,.0900022,.192713,-.623529,.22484,.12126,.272128,-.498039,.291263,.157469,.340828,-.372549,.360015,.200388,.388903,-.247059,.437497,.250058,.387201,-.121569,.512636,.304969,.355955,.00392157,.582603,.360874,.33488,.129412,.655126,.416374,.306351,.254902,.725889,.473329,.279051,.380392,.778125,.537928,.302697,.505882,.815894,.606931,.382431,.631373,.839159,.679308,.497608,.756863,.854748,.751666,.631792,.882353,.869483,.822508,.768592,1,.887572,.887589,.887565]},{ColorSpace:"Lab",Name:"erdc_blue2green_muted",RGBPoints:[-1,.107704,.107708,.107695,-.87451,.141522,.13066,.270741,-.74902,.180123,.146119,.42308,-.623529,.210161,.169674,.551795,-.498039,.239701,.212939,.634969,-.372549,.253916,.282947,.653641,-.247059,.242791,.366933,.608521,-.121569,.226302,.446776,.52693,.00392157,.236237,.514689,.458798,.129412,.274641,.577589,.376069,.254902,.349625,.633993,.288131,.380392,.4437,.683677,.260497,.505882,.536247,.731214,.285424,.631373,.628472,.777128,.349151,.756863,.718259,.819287,.496825,.882353,.804768,.856164,.703299,1,.887571,.887591,.887548]},{ColorSpace:"Lab",Name:"erdc_blue2green_BW",RGBPoints:[-1,3.63578e-7,0,529374e-11,-.87451,.0539915,.0577948,.212806,-.74902,.0620393,.0758942,.388959,-.623529,.0697499,.102032,.54177,-.498039,.113295,.156156,.64334,-.372549,.152047,.243196,.670283,-.247059,.158096,.344084,.622864,-.121569,.151142,.43922,.532767,.00392157,.17155,.521588,.457719,.129412,.225861,.599141,.363997,.254902,.32328,.67007,.259083,.380392,.442344,.733697,.223754,.505882,.558409,.794941,.257411,.631373,.673875,.854344,.340822,.756863,.787244,.909326,.524717,.882353,.896483,.958063,.775914,1,1,1,.999982]},{ColorSpace:"Lab",Name:"GREEN-WHITE_LINEAR",RGBPoints:[-1,0,0,0,-.87451,0,.062745,0,-.74902,0,.12549,0,-.623529,0,.188235,0,-.498039,0,.25098,0,-.372549,0,.313725,0,-.247059,0,.376471,0,-.121569,.094118,.439216,0,.00392157,.196078,.501961,0,.129412,.294118,.564706,0,.254902,.396078,.627451,0,.380392,.498039,.690196,0,.505882,.6,.752941,.145098,.631373,.701961,.815686,.364706,.756863,.8,.878431,.580392,.882353,.901961,.941176,.796078,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_green2yellow_BW",RGBPoints:[-1,0,0,0,-.87451,0,.105542,.0603919,-.74902,0,.159454,.104148,-.623529,0,.219502,.15542,-.498039,0,.282276,.203811,-.372549,0,.346331,.235652,-.247059,0,.411765,.235428,-.121569,0,.477177,.217977,.00392157,.0593644,.541635,.21361,.129412,.233081,.604722,.210591,.254902,.369803,.664942,.226536,.380392,.498446,.722367,.288237,.505882,.601929,.782244,.380815,.631373,.703207,.840497,.512134,.756863,.803186,.896433,.674462,.882353,.903834,.950266,.846715,1,1,1,.999981]},{ColorSpace:"Lab",Name:"blue2cyan",RGBPoints:[-1,0,0,0,-.87451,0,.152941,.364706,-.74902,0,.254902,.470588,-.623529,0,.34902,.572549,-.498039,0,.443137,.670588,-.372549,0,.537255,.772549,-.247059,0,.627451,.870588,-.121569,0,.717647,.964706,.00392157,.0784314,.772549,1,.129412,.207843,.858824,1,.254902,.32549,.941176,1,.380392,.45098,1,1,.505882,.560784,1,1,.631373,.662745,1,1,.756863,.760784,1,1,.882353,.870588,1,1,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_blue2cyan_BW",RGBPoints:[-1,4.05298e-7,0,59012e-10,-.87451,.0207526,.0740933,.18093,-.74902,0,.121033,.30343,-.623529,0,.166892,.416095,-.498039,0,.216768,.524796,-.372549,.0164769,.275471,.608585,-.247059,.0544527,.344824,.659267,-.121569,.0880643,.419118,.688675,.00392157,.127938,.492556,.720256,.129412,.149476,.566946,.756918,.254902,.188961,.641333,.792122,.380392,.245482,.715336,.827609,.505882,.329216,.786235,.874761,.631373,.453558,.852803,.918466,.756863,.626281,.910493,.954,.882353,.82257,.958709,.980146,1,1,1,.999989]},{ColorSpace:"Lab",Name:"erdc_blue_BW",RGBPoints:[-1,0,0,0,-.87451,.0425591,.0763529,.150682,-.74902,.0569472,.119154,.275403,-.623529,.0635978,.164772,.395427,-.498039,.0774342,.213851,.510014,-.372549,.106815,.267034,.615102,-.247059,.122093,.324649,.720068,-.121569,.160851,.387068,.806956,.00392157,.213754,.453516,.878012,.129412,.26722,.524656,.932436,.254902,.326844,.599279,.968038,.380392,.403403,.674712,.984784,.505882,.499703,.745519,1,.631373,.615055,.813983,1,.756863,.74405,.879228,1,.882353,.877909,.941913,1,1,1,1,.999996]},{ColorSpace:"Lab",Name:"BLUE-WHITE",RGBPoints:[-1,0,0,0,-.87451,0,0,.082353,-.74902,0,0,.168627,-.623529,0,0,.254902,-.498039,0,0,.337255,-.372549,0,0,.423529,-.247059,0,0,.509804,-.121569,0,.101961,.592157,.00392157,0,.203922,.678431,.129412,0,.301961,.764706,.254902,0,.403922,.85098,.380392,0,.505882,.933333,.505882,0,.603922,1,.631373,.254902,.705882,1,.756863,.509804,.807843,1,.882353,.764706,.905882,1,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_purple_BW",RGBPoints:[-1,4.264e-8,0,6.20844e-7,-.87451,.100579,.0593111,.145666,-.74902,.167794,.0889224,.254953,-.623529,.231446,.123339,.360511,-.498039,.296699,.163027,.461278,-.372549,.363211,.209286,.55306,-.247059,.431136,.260776,.637195,-.121569,.498202,.320012,.705799,.00392157,.567456,.380459,.778091,.129412,.629381,.445284,.8448,.254902,.688373,.517374,.895694,.380392,.74891,.590906,.93976,.505882,.805017,.667956,.977626,.631373,.850914,.752618,.992396,.756863,.89724,.838454,.994093,.882353,.948461,.922603,.994449,1,1,1,.999967]},{ColorSpace:"Lab",Name:"erdc_magenta_BW",RGBPoints:[-1,0,0,254023e-10,-.87451,.128696,.0456782,.11635,-.74902,.228133,.0476299,.201452,-.623529,.327273,.0374065,.282107,-.498039,.420953,.0408166,.35709,-.372549,.511562,.0642203,.430511,-.247059,.599552,.102686,.504257,-.121569,.684646,.150536,.579429,.00392157,.765817,.205978,.656062,.129412,.839176,.27229,.731807,.254902,.89536,.357594,.797309,.380392,.930238,.457825,.846984,.505882,.945921,.564536,.880571,.631373,.948995,.670753,.902279,.756863,.947124,.772819,.918171,.882353,.947265,.869424,.934352,1,.954719,.95475,.954726]},{ColorSpace:"Lab",Name:"magenta",RGBPoints:[-1,0,0,0,-.87451,.364706,0,.152941,-.74902,.470588,0,.254902,-.623529,.572549,0,.34902,-.498039,.670588,0,.443137,-.372549,.772549,0,.537255,-.247059,.870588,0,.627451,-.121569,.964706,0,.717647,.00392157,1,.0784314,.772549,.129412,1,.207843,.858824,.254902,1,.32549,.941176,.380392,1,.45098,1,.505882,1,.560784,1,.631373,1,.662745,1,.756863,1,.760784,1,.882353,1,.870588,1,1,1,1,1]},{ColorSpace:"Lab",Name:"RED-PURPLE",RGBPoints:[-1,0,0,0,-.87451,.188235,0,.007843,-.74902,.345098,0,.035294,-.623529,.439216,0,.098039,-.498039,.533333,0,.152941,-.372549,.627451,.015686,.211765,-.247059,.721569,.031373,.266667,-.121569,.8,.047059,.329412,.00392157,.862745,.047059,.403922,.129412,.941176,.062745,.466667,.254902,.988235,.078431,.54902,.380392,.988235,.141176,.643137,.505882,.988235,.25098,.729412,.631373,.988235,.376471,.811765,.756863,.988235,.54902,.886275,.882353,.988235,.752941,.952941,1,.996078,.996078,.996078]},{ColorSpace:"Lab",Name:"erdc_red_BW",RGBPoints:[-1,0,0,0,-.87451,.147204,.0480135,.0401815,-.74902,.253411,.0617478,.0301333,-.623529,.356059,.0746331,.0446897,-.498039,.457731,.0934935,.0636931,-.372549,.557199,.122714,.0860013,-.247059,.665179,.144238,.105585,-.121569,.763833,.187056,.138326,.00392157,.847035,.254558,.189407,.129412,.905663,.345937,.258215,.254902,.941431,.447111,.346277,.380392,.962608,.546927,.457571,.505882,.987833,.637276,.569944,.631373,.994202,.732176,.687958,.756863,.993304,.826268,.800567,.882353,.994413,.917205,.906393,1,1,1,.999979]},{ColorSpace:"Lab",Name:"RED_TEMPERATURE",RGBPoints:[-1,0,0,0,-.87451,.090196,0,0,-.74902,.180392,0,0,-.623529,.270588,0,0,-.498039,.360784,0,0,-.372549,.45098,0,0,-.247059,.545098,0,0,-.121569,.635294,0,0,.00392157,.72549,.058824,0,.129412,.815686,.176471,0,.254902,.905882,.294118,0,.380392,1,.411765,0,.505882,1,.533333,.027451,.631373,1,.65098,.27451,.756863,1,.768627,.521569,.882353,1,.886275,.768627,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_orange_BW",RGBPoints:[-1,0,0,253806e-10,-.87451,.135871,.0593824,0,-.74902,.224328,.0907216,0,-.623529,.318083,.119647,0,-.498039,.414443,.150246,0,-.372549,.511077,.184884,0,-.247059,.605501,.226033,0,-.121569,.695274,.275491,0,.00392157,.777826,.334445,0,.129412,.851498,.402441,0,.254902,.915899,.47759,602975e-9,.380392,.971984,.557882,.0361443,.505882,1,.641287,.135967,.631373,1,.725198,.27997,.756863,1,.808205,.438135,.882353,1,.89306,.587036,1,1,.977928,.721599]},{ColorSpace:"Lab",Name:"heated_object",RGBPoints:[-1,0,0,0,-.87451,.34902,.0862745,0,-.74902,.45098,.172549,0,-.623529,.52549,.231373,0,-.498039,.580392,.278431,0,-.372549,.623529,.313725,0,-.247059,.670588,.352941,0,-.121569,.717647,.392157,0,.00392157,.772549,.439216,0,.129412,.839216,.494118,0,.254902,.901961,.541176,0,.380392,.968627,.6,0,.505882,1,.658824,0,.631373,1,.721569,0,.756863,1,.827451,.298039,.882353,1,.976471,.72549,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_gold_BW",RGBPoints:[-1,0,0,190933e-10,-.87451,.128363,.0636265,0,-.74902,.193795,.111057,0,-.623529,.25976,.15987,0,-.498039,.328546,.210589,0,-.372549,.399726,.26332,0,-.247059,.472969,.318261,0,-.121569,.546245,.375827,0,.00392157,.61745,.436719,0,.129412,.685545,.501113,0,.254902,.749578,.568799,0,.380392,.80962,.6394,0,.505882,.865572,.712699,.10257,.631373,.917709,.787569,.233665,.756863,.966914,.863138,.369608,.882353,1,.939405,.496104,1,.999225,1,.612275]},{ColorSpace:"Lab",Name:"erdc_brown_BW",RGBPoints:[-1,3.3216e-7,0,483629e-11,-.87451,.14693,.0518172,0,-.74902,.225806,.0814996,0,-.623529,.301681,.111452,0,-.498039,.370487,.150664,0,-.372549,.43108,.199477,0,-.247059,.4849,.255107,0,-.121569,.536798,.313486,0,.00392157,.59286,.371167,0,.129412,.653119,.428135,0,.254902,.714589,.485917,.0379541,.380392,.774667,.54565,.116634,.505882,.831222,.608047,.183895,.631373,.880305,.674199,.260298,.756863,.922314,.742472,.367086,.882353,.959408,.811222,.497258,1,.993548,.875183,.622093]},{ColorSpace:"Lab",Name:"copper_Matlab",RGBPoints:[-1,0,0,0,-.87451,.0784314,.0501961,.0313725,-.74902,.156863,.100392,.0627451,-.623529,.235294,.150588,.0941176,-.498039,.313725,.200784,.12549,-.372549,.392157,.25098,.156863,-.247059,.470588,.301176,.188235,-.121569,.54902,.351373,.219608,.00392157,.627451,.401569,.25098,.129412,.705882,.451765,.282353,.254902,.784314,.501961,.313725,.380392,.862745,.552157,.345098,.505882,.941176,.602353,.376471,.631373,1,.652549,.407843,.756863,1,.702745,.439216,.882353,1,.752941,.470588,1,1,.8,.5]},{ColorSpace:"Lab",Name:"pink_Matlab",RGBPoints:[-1,0,0,0,-.87451,.312416,.204524,.204524,-.74902,.441822,.289241,.289241,-.623529,.54112,.354246,.354246,-.498039,.624831,.409048,.409048,-.372549,.698582,.45733,.45733,-.247059,.764404,.502282,.500979,-.121569,.791292,.591516,.54112,.00392157,.817297,.66895,.578481,.129412,.842499,.738308,.613572,.254902,.866968,.801687,.646762,.380392,.890766,.86041,.678329,.505882,.913944,.913944,.711254,.631373,.936549,.936549,.79459,.756863,.958621,.958621,.869979,.882353,.980196,.980196,.939336,1,1,1,1]},{ColorSpace:"Lab",Name:"bone_Matlab",RGBPoints:[-1,0,0,0,-.87451,.054902,.054902,.075817,-.74902,.109804,.109804,.151634,-.623529,.164706,.164706,.227451,-.498039,.219608,.219608,.303268,-.372549,.27451,.27451,.379085,-.247059,.329412,.329902,.454412,-.121569,.384314,.405719,.509314,.00392157,.439216,.481536,.564216,.129412,.494118,.557353,.619118,.254902,.54902,.63317,.67402,.380392,.603922,.708987,.728922,.505882,.660294,.783824,.783824,.631373,.746569,.838725,.838725,.756863,.832843,.893627,.893627,.882353,.919118,.948529,.948529,1,1,1,1]},{ColorSpace:"Lab",Name:"gray_Matlab",RGBPoints:[-1,0,0,0,-.87451,.0627451,.0627451,.0627451,-.74902,.12549,.12549,.12549,-.623529,.188235,.188235,.188235,-.498039,.25098,.25098,.25098,-.372549,.313725,.313725,.313725,-.247059,.376471,.376471,.376471,-.121569,.439216,.439216,.439216,.00392157,.501961,.501961,.501961,.129412,.564706,.564706,.564706,.254902,.627451,.627451,.627451,.380392,.690196,.690196,.690196,.505882,.752941,.752941,.752941,.631373,.815686,.815686,.815686,.756863,.878431,.878431,.878431,.882353,.941176,.941176,.941176,1,1,1,1]},{ColorSpace:"Lab",Name:"Purples",RGBPoints:[-1,.247059,0,.490196,-.87451,.288397,.07677,.525629,-.74902,.32975,.153587,.561092,-.623529,.373057,.236263,.600461,-.498039,.416363,.319,.639923,-.372549,.459669,.405613,.685198,-.247059,.503345,.491534,.730058,-.121569,.562399,.54862,.757616,.00392157,.621453,.606075,.785544,.129412,.680508,.674971,.824914,.254902,.739562,.743406,.863899,.380392,.798616,.800492,.893426,.505882,.85684,.856655,.922491,.631373,.898178,.894056,.942176,.756863,.938654,.930919,.961646,.882353,.964245,.958478,.977393,1,.988235,.984314,.992157]},{ColorSpace:"Lab",Name:"Blues",RGBPoints:[-1,.031373,.188235,.419608,-.87451,.031373,.253195,.516063,-.74902,.031757,.318139,.612149,-.623529,.080969,.38113,.661361,-.498039,.130427,.444152,.710327,-.372549,.195386,.509112,.743791,-.247059,.260715,.573841,.777209,-.121569,.341423,.628958,.808704,.00392157,.422745,.684075,.839892,.129412,.523137,.739193,.861546,.254902,.622684,.793464,.883429,.380392,.701423,.826928,.910988,.505882,.778685,.8603,.937993,.631373,.825928,.891795,.953741,.756863,.87328,.923291,.969489,.882353,.922491,.954787,.985236,1,.968627,.984314,1]},{ColorSpace:"Lab",Name:"Greens",RGBPoints:[-1,0,.266667,.105882,-.87451,0,.347374,.139346,-.74902,538e-6,.427912,.172933,-.623529,.069435,.486967,.222145,-.498039,.138178,.546082,.271326,-.372549,.197232,.609073,.31857,-.247059,.257255,.671742,.365859,-.121569,.357647,.720953,.415071,.00392157,.45767,.769919,.465021,.129412,.546251,.811257,.537855,.254902,.634295,.852211,.610688,.380392,.709097,.883706,.683522,.505882,.78316,.914833,.755894,.631373,.842215,.938454,.818885,.756863,.899977,.961538,.880692,.882353,.935409,.975317,.92203,1,.968627,.988235,.960784]},{ColorSpace:"Lab",Name:"PuBu",RGBPoints:[-1,.301961,0,.294118,-.87451,.404321,.029527,.390573,-.74902,.50599,.059592,.486782,-.623529,.519769,.158016,.551742,-.498039,.533456,.256194,.616301,-.372549,.54133,.33887,.655671,-.247059,.54902,.421592,.695087,-.121569,.54902,.506236,.736424,.00392157,.550127,.590573,.777701,.129412,.585559,.665375,.81707,.254902,.622145,.739023,.855825,.380392,.687105,.784298,.879446,.505882,.752065,.829758,.903253,.631373,.817024,.87897,.930811,.756863,.880907,.927213,.957832,.882353,.926182,.958708,.975548,1,.968627,.988235,.992157]},{ColorSpace:"Lab",Name:"BuPu",RGBPoints:[-1,.007843,.219608,.345098,-.87451,.01178,.286536,.449427,-.74902,.015702,.35328,.553479,-.623529,.01767,.396586,.622376,-.498039,.021115,.4402,.690688,-.372549,.11757,.503191,.722184,-.247059,.214625,.565859,.753633,-.121569,.336671,.615071,.78316,.00392157,.457978,.663975,.812503,.129412,.556401,.703345,.836125,.254902,.65421,.742714,.859669,.380392,.736886,.782084,.881323,.505882,.81827,.821638,.903068,.631373,.873387,.864944,.92669,.756863,.927536,.907605,.949988,.882353,.964937,.9391,.967705,1,1,.968627,.984314]},{ColorSpace:"Lab",Name:"BuGn",RGBPoints:[-1,.031373,.25098,.505882,-.87451,.031373,.329719,.590527,-.74902,.031911,.408397,.674787,-.623529,.100807,.479262,.710219,-.498039,.169704,.550219,.745744,-.372549,.238601,.62699,.787082,-.247059,.307958,.703114,.826759,-.121569,.39654,.752326,.797232,.00392157,.485121,.801046,.767705,.129412,.573702,.83451,.738178,.254902,.661592,.867743,.711034,.380392,.732457,.895302,.74253,.505882,.801845,.922307,.774579,.631373,.841215,.938055,.817885,.756863,.880907,.95391,.861084,.882353,.926182,.971626,.902422,1,.968627,.988235,.941176]},{ColorSpace:"Lab",Name:"GnBu",RGBPoints:[-1,0,.266667,.105882,-.87451,0,.347374,.139346,-.74902,538e-6,.427912,.172933,-.623529,.069435,.486967,.222145,-.498039,.138178,.546175,.272095,-.372549,.197232,.615071,.368551,-.247059,.256609,.683276,.464867,-.121569,.329443,.722645,.555417,.00392157,.403137,.762138,.645413,.129412,.503529,.805444,.718247,.254902,.603922,.848597,.790465,.380392,.704314,.887966,.847551,.505882,.802307,.926321,.903714,.631373,.851519,.944037,.941115,.756863,.899977,.961538,.976901,.882353,.935409,.975317,.984775,1,.968627,.988235,.992157]},{ColorSpace:"Lab",Name:"GnBuPu",RGBPoints:[-1,.003922,.27451,.211765,-.87451,.003922,.349312,.280661,-.74902,.003937,.423852,.349773,-.623529,.005905,.46519,.446228,-.498039,.009443,.506344,.542837,-.372549,.111803,.535871,.649135,-.247059,.214025,.565859,.753633,-.121569,.310481,.615071,.78316,.00392157,.407797,.663975,.812503,.129412,.531811,.703345,.836125,.254902,.65421,.742714,.859669,.380392,.736886,.782084,.881323,.505882,.81827,.821176,.902884,.631373,.873387,.854641,.922568,.756863,.927536,.888535,.942361,.882353,.964937,.929873,.964014,1,1,.968627,.984314]},{ColorSpace:"Lab",Name:"BuGnYl",RGBPoints:[-1,.031373,.113725,.345098,-.87451,.088458,.159,.463206,-.74902,.145052,.204567,.5807,-.623529,.139146,.287243,.620069,-.498039,.13318,.370196,.659562,-.372549,.123337,.470588,.706805,-.247059,.115386,.570335,.753126,-.121569,.186251,.643168,.761,.00392157,.258716,.71514,.768074,.129412,.380761,.760415,.750358,.254902,.503576,.806075,.732795,.380392,.645306,.861192,.719016,.505882,.783899,.91511,.705606,.631373,.858701,.944637,.6997,.756863,.931349,.973303,.698424,.882353,.966782,.987082,.777163,1,1,1,.85098]},{ColorSpace:"Lab",Name:"PuRd",RGBPoints:[-1,.286275,0,.415686,-.87451,.38273,.001968,.441276,-.74902,.479231,.003922,.466774,-.623529,.581592,.003922,.480554,-.498039,.683799,.00549,.494887,-.372549,.776317,.105882,.544098,-.247059,.867866,.206321,.592618,-.121569,.919047,.308681,.612303,.00392157,.968812,.411226,.632603,.129412,.974717,.519493,.671972,.254902,.980546,.626451,.71065,.380392,.984483,.701253,.732303,.505882,.988328,.77504,.755617,.631373,.990296,.828189,.812703,.756863,.992372,.880907,.869035,.882353,.996309,.926182,.912341,1,1,.968627,.952941]},{ColorSpace:"Lab",Name:"RdPu",RGBPoints:[-1,.403922,0,.121569,-.87451,.500377,0,.192434,-.74902,.596909,277e-6,.263037,-.623529,.703206,.035709,.300438,-.498039,.808612,.071296,.338854,-.372549,.857824,.116571,.441215,-.247059,.905513,.163552,.54293,-.121569,.889765,.281661,.617732,.00392157,.873156,.39897,.691611,.129412,.82985,.491488,.736886,.254902,.789081,.583237,.781853,.380392,.810734,.656071,.819254,.505882,.833126,.729181,.85684,.631373,.870527,.80792,.898178,.756863,.907605,.884398,.938331,.882353,.9391,.921799,.958016,1,.968627,.956863,.976471]},{ColorSpace:"Lab",Name:"Oranges",RGBPoints:[-1,.498039,.152941,.015686,-.87451,.57481,.182468,.013718,-.74902,.651765,.212042,.011734,-.623529,.752157,.247474,.007797,-.498039,.851719,.283368,.004475,-.372549,.898962,.348328,.039908,-.247059,.945652,.413426,.076401,-.121569,.969273,.484291,.157109,.00392157,.992157,.554971,.238185,.129412,.992157,.619931,.330704,.254902,.992157,.684967,.423837,.380392,.992157,.751895,.532103,.505882,.992249,.817716,.639354,.631373,.994218,.861023,.725967,.756863,.996186,.903576,.810965,.882353,.998155,.933103,.868051,1,1,.960784,.921569]},{ColorSpace:"Lab",Name:"Reds",RGBPoints:[-1,.403922,0,.05098,-.87451,.525967,.029527,.066728,-.74902,.647643,.058962,.082476,-.623529,.722445,.076678,.098224,-.498039,.797186,.095194,.114187,-.372549,.868051,.164091,.143714,-.247059,.937809,.233541,.173933,-.121569,.96143,.326059,.232987,.00392157,.984375,.418147,.292657,.129412,.986344,.496886,.371396,.254902,.988235,.575702,.450673,.380392,.988235,.656409,.543191,.505882,.98842,.736747,.635894,.631373,.992357,.809581,.732349,.756863,.996186,.880692,.826759,.882353,.998155,.92203,.885813,1,1,.960784,.941176]},{ColorSpace:"Lab",Name:"RdOr",RGBPoints:[-1,.498039,0,0,-.87451,.6004,0,0,-.74902,.702514,738e-6,477e-6,-.623529,.773379,.095225,.061499,-.498039,.843875,.189865,.12283,-.372549,.891119,.294195,.203537,-.247059,.937855,.397924,.283137,-.121569,.963445,.476663,.316601,.00392157,.988297,.555771,.351665,.129412,.990265,.646321,.436309,.254902,.992157,.735256,.519646,.380392,.992157,.784468,.570827,.505882,.992249,.833218,.623483,.631373,.994218,.872587,.706159,.756863,.996186,.911419,.788189,.882353,.998155,.940946,.859054,1,1,.968627,.92549]},{ColorSpace:"Lab",Name:"BrOrYl",RGBPoints:[-1,.4,.145098,.023529,-.87451,.500392,.174625,.019592,-.74902,.600784,.204291,.015656,-.623529,.701176,.251534,.011719,-.498039,.800984,.299146,.008397,-.372549,.863975,.370012,.043829,-.247059,.926321,.441107,.0794,-.121569,.961753,.521815,.120738,.00392157,.996078,.602645,.163122,.129412,.996078,.68729,.237924,.254902,.996078,.771011,.314879,.380392,.996078,.832034,.444798,.505882,.996171,.892042,.572595,.631373,.998139,.931411,.65724,.756863,1,.969489,.741669,.882353,1,.985236,.822376,1,1,1,.898039]},{ColorSpace:"Lab",Name:"RdOrYl",RGBPoints:[-1,.501961,0,.14902,-.87451,.622038,0,.14902,-.74902,.741761,4e-4,.148866,-.623529,.816563,.05158,.129181,-.498039,.890965,.10356,.110235,-.372549,.940177,.205921,.137793,-.247059,.988281,.308789,.165536,-.121569,.99025,.432803,.200969,.00392157,.992218,.555217,.236278,.129412,.994187,.628051,.267774,.254902,.996078,.701038,.301269,.380392,.996078,.777809,.383945,.505882,.996171,.852826,.466621,.631373,.998139,.892195,.549296,.756863,1,.931349,.632188,.882353,1,.966782,.7188,1,1,1,.8]},{ColorSpace:"Lab",Name:"CIELab_blue2red",RGBPoints:[-1,0,.6,.74902,1,.76863,.46667,.34118]},{ColorSpace:"Lab",Name:"blue2yellow",RGBPoints:[-1,0,0,1,0,.5,.5,.5,1,1,1,0]},{ColorSpace:"Lab",Name:"erdc_blue2gold",RGBPoints:[-1,.175119,.0438468,1,-.874016,.22383,.159771,.94557,-.748031,.27254,.233611,.891216,-.622047,.321251,.296526,.836857,-.496063,.369962,.354296,.782359,-.370079,.418672,.409139,.72754,-.244094,.467383,.462152,.672148,-.11811,.51609,.51396,.615825,.00787402,.572863,.55452,.559172,.133858,.630269,.593822,.517729,.259843,.689588,.624668,.47446,.385827,.745394,.656113,.428638,.511811,.798624,.688104,.379105,.637795,.849926,.720593,.323834,.76378,.899765,.753543,.258657,.889764,.948487,.78692,.171778,1,.990413,.816451,.00729848]},{ColorSpace:"Lab",Name:"erdc_blue2yellow",RGBPoints:[-1,.0830122,0,.495617,-.87451,.141973,.0551288,.57363,-.74902,.193048,.110258,.604561,-.623529,.234231,.165386,.57643,-.498039,.275413,.220515,.548299,-.372549,.316596,.275644,.520169,-.247059,.357778,.330773,.492038,-.121569,.398961,.385901,.463908,.00392157,.449929,.438487,.426815,.129412,.511572,.488299,.379944,.254902,.581222,.53603,.325741,.380392,.650871,.583761,.271538,.505882,.720521,.631493,.217335,.631373,.79017,.679224,.163132,.756863,.85982,.726955,.108929,.882353,.910254,.774159,.14112,1,.927513,.81759,.306289]},{ColorSpace:"Lab",Name:"erdc_cyan2orange",RGBPoints:[-1,.0471513,.213874,.414329,-.87451,.0674702,.256648,.439027,-.74902,.0959957,.299331,.462089,-.623529,.132428,.341872,.483212,-.498039,.188743,.38277,.500597,-.372549,.268511,.420229,.512179,-.247059,.352945,.455602,.519101,-.121569,.43893,.489368,.521538,.00392157,.522445,.522495,.522436,.129412,.600089,.555682,.53205,.254902,.67988,.587981,.539163,.380392,.761011,.619586,.544439,.505882,.84278,.650741,.548567,.631373,.910713,.687347,.557822,.756863,.952232,.734972,.577775,.882353,.975642,.789858,.604868,1,.990752,.843643,.632857]},{ColorSpace:"Lab",Name:"erdc_purple2green",RGBPoints:[-1,.235006,.0483128,.530899,-.87451,.302968,.108419,.552391,-.74902,.360241,.166059,.569502,-.623529,.406746,.226782,.579373,-.498039,.444073,.28964,.582094,-.372549,.473648,.353774,.577947,-.247059,.497636,.418154,.567911,-.121569,.519086,.481741,.553968,.00392157,.542884,.542914,.542875,.129412,.566303,.603989,.527499,.254902,.595218,.662965,.516857,.380392,.628641,.720701,.510673,.505882,.665373,.777849,.508165,.631373,.704182,.834921,.508303,.756863,.743846,.892328,.50999,.882353,.783158,.950422,.512181,1,.818617,1,.513888]},{ColorSpace:"Lab",Name:"erdc_purple2green_dark",RGBPoints:[-1,.107656,0,.428682,-.87451,.1924,0,.449799,-.74902,.255118,.0648939,.466726,-.623529,.304256,.133066,.476703,-.498039,.343202,.19716,.479793,-.372549,.373876,.260353,.476241,-.247059,.398497,.322872,.466953,-.121569,.420016,.384252,.453785,.00392157,.44319,.443216,.443186,.129412,.465553,.502139,.428233,.254902,.492959,.559151,.417591,.380392,.524654,.615092,.411016,.505882,.55959,.670583,.40779,.631373,.596614,.726102,.406948,.756863,.634544,.782032,.407439,.882353,.672183,.838703,.408237,1,.706131,.892759,.408452]},{ColorSpace:"Lab",Name:"coolwarm",RGBPoints:[-1,.229806,.298718,.753683,-.875,.303869,.406535,.844959,-.75,.383013,.509419,.917388,-.625,.466667,.604563,.968155,-.5,.552953,.688929,.995376,-.375,.639176,.7596,.998151,-.25,.722193,.813953,.976575,-.125,.798692,.849786,.931689,0,.865395,.86541,.865396,.125,.924128,.827385,.774508,.25,.958853,.769768,.678008,.375,.969954,.694267,.579375,.5,.958003,.602842,.481776,.625,.923945,.497309,.38797,.75,.869187,.378313,.300267,.875,.795632,.241284,.220526,1,.705673,.0155562,.150233]},{ColorSpace:"Lab",Name:"BuRd",RGBPoints:[-1,.019608,.188235,.380392,-.87451,.088504,.321107,.564937,-.74902,.163399,.444983,.697501,-.623529,.247059,.555709,.754095,-.498039,.420684,.676432,.818685,-.372549,.606459,.789773,.880277,-.247059,.761476,.868512,.924567,-.121569,.878047,.925721,.951942,.00392157,.969089,.966474,.964937,.129412,.983852,.897578,.846828,.254902,.982468,.800692,.706113,.380392,.960323,.66782,.536332,.505882,.894579,.503806,.399769,.631373,.81707,.33218,.281046,.756863,.728489,.155017,.197386,.882353,.576932,.055363,.14925,1,.403922,0,.121569]},{ColorSpace:"Lab",Name:"Spectral_lowBlue",RGBPoints:[-1,.368627,.309804,.635294,-.87451,.260361,.450058,.70173,-.74902,.248058,.591311,.717186,-.623529,.376009,.734025,.658132,-.498039,.537947,.814764,.64506,-.372549,.702345,.879585,.636678,-.247059,.84752,.938639,.607151,-.121569,.940408,.976163,.656055,.00392157,.999923,.997616,.745021,.129412,.997463,.921338,.61707,.254902,.995002,.824606,.499885,.380392,.992541,.701576,.39654,.505882,.973472,.547405,.318108,.631373,.937793,.398539,.270127,.756863,.861515,.282891,.299654,.882353,.746482,.144637,.288812,1,.619608,.003922,.258824]},{ColorSpace:"Lab",Name:"GnRP",RGBPoints:[-1,0,.266667,.105882,-.87451,.066436,.394617,.174779,-.74902,.168858,.524567,.25767,-.623529,.323875,.657439,.361015,-.498039,.504883,.772318,.506344,-.372549,.678431,.870127,.654902,-.247059,.803922,.921799,.780392,-.121569,.897116,.951942,.882814,.00392157,.967397,.965936,.967474,.129412,.928028,.879815,.930565,.254902,.866052,.780777,.882891,.380392,.77501,.665129,.821376,.505882,.675663,.537024,.737024,.631373,.57847,.396155,.645982,.756863,.492349,.223914,.547559,.882353,.375548,.096886,.423299,1,.25098,0,.294118]},{ColorSpace:"Lab",Name:"GYPi",RGBPoints:[-1,.152941,.392157,.098039,-.87451,.246444,.505344,.117724,-.74902,.351942,.614533,.161399,-.623529,.474971,.717878,.240138,-.498039,.611995,.811226,.392849,-.372549,.746328,.893118,.565321,-.247059,.859516,.94233,.747405,-.121569,.928105,.96386,.875663,.00392157,.969089,.966859,.968012,.129412,.983852,.910265,.948328,.254902,.979239,.833218,.914648,.380392,.949712,.729873,.862976,.505882,.905652,.58293,.763552,.631373,.85521,.410073,.652211,.756863,.793695,.183699,.531642,.882353,.683737,.063899,.420761,1,.556863,.003922,.321569]},{ColorSpace:"Lab",Name:"GnYlRd",RGBPoints:[-1,0,.407843,.215686,-.87451,.063975,.525952,.277201,-.74902,.177932,.633064,.332718,-.623529,.364937,.724106,.379469,-.498039,.527951,.797155,.40223,-.372549,.678431,.862822,.433449,-.247059,.803922,.916955,.514648,-.121569,.909419,.961861,.625067,.00392157,.999923,.997616,.745021,.129412,.997463,.921338,.61707,.254902,.995002,.824606,.499885,.380392,.992541,.701576,.39654,.505882,.973472,.547405,.318108,.631373,.939023,.389927,.245521,.756863,.867666,.239831,.176624,.882353,.762399,.110727,.151326,1,.647059,0,.14902]},{ColorSpace:"Lab",Name:"GBBr",RGBPoints:[-1,0,.235294,.188235,-.87451,.002461,.338639,.301423,-.74902,.055902,.448981,.417609,-.623529,.183852,.56955,.538178,-.498039,.357785,.700115,.660746,-.372549,.540177,.819531,.77624,-.247059,.714879,.890888,.864821,-.121569,.851134,.934564,.922645,.00392157,.960861,.959785,.95694,.129412,.963322,.927797,.83391,.254902,.939946,.868897,.68935,.380392,.883353,.775394,.517109,.505882,.808074,.625836,.324106,.631373,.717647,.476355,.15494,.756863,.592157,.358247,.06882,.882353,.458593,.26436,.031142,1,.329412,.188235,.019608]},{ColorSpace:"Lab",Name:"PuOr",RGBPoints:[-1,.498039,.231373,.031373,-.87451,.62599,.30273,.026451,-.74902,.746943,.387082,.037524,-.623529,.85767,.490427,.071972,-.498039,.936409,.617762,.236371,-.372549,.992695,.743099,.43291,-.247059,.995156,.841523,.63714,-.121569,.985313,.913802,.813687,.00392157,.966244,.966398,.967705,.129412,.889965,.89504,.938178,.254902,.806151,.804306,.894656,.380392,.712649,.688658,.833141,.505882,.594233,.554325,.744637,.631373,.474894,.404229,.652364,.756863,.366628,.217224,.563783,.882353,.266436,.089965,.434833,1,.176471,0,.294118]},{ColorSpace:"Lab",Name:"PRGn",RGBPoints:[-1,.25098,0,.294118,-.87451,.383852,.103345,.431911,-.74902,.497732,.234679,.55371,-.623529,.583852,.40692,.652134,-.498039,.681968,.545175,.742561,-.372549,.7807,.672357,.825221,-.247059,.871742,.788005,.886736,-.121569,.930488,.885198,.932872,.00392157,.966321,.968089,.965859,.129412,.892503,.950865,.877278,.254902,.796078,.91857,.772549,.380392,.670588,.866897,.647059,.505882,.493195,.765398,.496655,.631373,.314187,.649135,.354556,.756863,.15917,.516263,.251211,.882353,.062284,.386621,.170473,1,0,.266667,.105882]},{ColorSpace:"Lab",Name:"PiYG",RGBPoints:[-1,.556863,.003922,.321569,-.87451,.692195,.067897,.427374,-.74902,.797539,.197847,.539177,-.623529,.859054,.424221,.659746,-.498039,.908574,.592618,.770319,-.372549,.951557,.736332,.866205,-.247059,.981084,.839677,.917878,-.121569,.98293,.913802,.949558,.00392157,.96732,.968474,.965629,.129412,.92549,.963552,.869666,.254902,.852441,.939254,.736025,.380392,.739254,.890042,.553941,.505882,.60323,.805536,.382238,.631373,.467282,.711419,.235217,.756863,.344252,.608074,.156478,.882353,.2406,.49827,.116494,1,.152941,.392157,.098039]},{ColorSpace:"Lab",Name:"OrPu",RGBPoints:[-1,.176471,0,.294118,-.87451,.272434,.095963,.444214,-.74902,.373395,.228912,.56932,-.623529,.481661,.415917,.657901,-.498039,.601922,.562937,.750481,-.372549,.718493,.695886,.836986,-.247059,.811995,.811534,.898501,-.121569,.894733,.8995,.940023,.00392157,.969166,.966859,.963629,.129412,.98639,.910265,.803691,.254902,.995002,.835371,.624375,.380392,.992541,.736947,.420146,.505882,.931949,.609458,.224221,.631373,.85075,.483968,.069819,.756863,.740023,.380623,.035371,.882353,.617993,.29827,.026759,1,.498039,.231373,.031373]},{ColorSpace:"Lab",Name:"BrBG",RGBPoints:[-1,.329412,.188235,.019608,-.87451,.467205,.269435,.031911,-.74902,.6,.365629,.074202,-.623529,.72549,.483737,.160323,-.498039,.812995,.635832,.336409,-.372549,.88689,.781238,.527874,-.247059,.943483,.87474,.700115,-.121569,.963168,.929796,.841599,.00392157,.957247,.959938,.959554,.129412,.84406,.932872,.920185,.254902,.70396,.886428,.859285,.380392,.529258,.815071,.770704,.505882,.346251,.691811,.653057,.631373,.175855,.562015,.530642,.756863,.047905,.441446,.410073,.882353,.002307,.33218,.294348,1,0,.235294,.188235]},{ColorSpace:"Lab",Name:"GyRd",RGBPoints:[-1,.101961,.101961,.101961,-.87451,.227451,.227451,.227451,-.74902,.359939,.359939,.359939,-.623529,.502653,.502653,.502653,-.498039,.631373,.631373,.631373,-.372549,.749865,.749865,.749865,-.247059,.843368,.843368,.843368,-.121569,.926105,.926105,.926105,.00392157,.999846,.997232,.995694,.129412,.994925,.908651,.857901,.254902,.982468,.800692,.706113,.380392,.960323,.66782,.536332,.505882,.894579,.503806,.399769,.631373,.81707,.33218,.281046,.756863,.728489,.155017,.197386,.882353,.576932,.055363,.14925,1,.403922,0,.121569]},{ColorSpace:"Lab",Name:"erdc_divHi_purpleGreen",RGBPoints:[-1,.297553,0,.489074,-.87451,.40259,.151146,.567754,-.74902,.516038,.284843,.658231,-.623529,.629783,.423646,.750938,-.498039,.735198,.563697,.835956,-.372549,.82408,.695541,.903582,-.247059,.889091,.807454,.944862,-.121569,.92334,.886917,.951839,.00392157,.921045,.921084,.921003,.129412,.877324,.907455,.845381,.254902,.797649,.849713,.734695,.380392,.691646,.75964,.600532,.505882,.568981,.649159,.453807,.631373,.438945,.529756,.304259,.756863,.30973,.412001,.158303,.882353,.187078,.305111,.00251458,1,.101655,.220836,0]},{ColorSpace:"Lab",Name:"erdc_divHi_purpleGreen_dim",RGBPoints:[-1,.404088,.131038,.592767,-.87451,.486469,.230957,.651243,-.74902,.575165,.339335,.717723,-.623529,.662741,.454332,.784263,-.498039,.742071,.570213,.842918,-.372549,.806935,.678992,.886227,-.247059,.852219,.771315,.90763,-.121569,.873345,.837327,.901572,.00392157,.866783,.86682,.866745,.129412,.82839,.858225,.796812,.254902,.762578,.814287,.700202,.380392,.676429,.744229,.585735,.505882,.577033,.65732,.461526,.631373,.47128,.562476,.33476,.756863,.365461,.467957,.21076,.882353,.264758,.381138,.0878313,1,.182591,.312249,0]},{ColorSpace:"Lab",Name:"erdc_divLow_icePeach",RGBPoints:[-1,.480048,.817441,.998056,-.87451,.425898,.726921,.883187,-.74902,.366682,.629445,.761936,-.623529,.308756,.531002,.640217,-.498039,.258021,.43705,.523433,-.372549,.219244,.352381,.416348,-.247059,.195127,.281032,.322979,-.121569,.186286,.22627,.246525,.00392157,.192352,.19236,.192364,.129412,.255927,.214469,.191756,.254902,.340459,.254426,.206666,.380392,.444655,.309315,.234029,.505882,.565353,.376004,.270969,.631373,.697917,.450748,.314293,.756863,.836657,.529064,.360227,.882353,.972695,.614884,.413123,1,1,.705904,.472699]},{ColorSpace:"Lab",Name:"erdc_divLow_purpleGreen",RGBPoints:[-1,.956034,.666487,.952663,-.87451,.874457,.572698,.936352,-.74902,.753465,.488253,.909063,-.623529,.63309,.413507,.763833,-.498039,.514491,.345878,.620015,-.372549,.405008,.288141,.484376,-.247059,.311388,.241986,.363556,-.121569,.238722,.209044,.263449,.00392157,.192352,.192366,.192362,.129412,.200379,.233201,.168618,.254902,.230151,.291737,.165227,.380392,.279481,.366076,.178607,.505882,.344927,.453267,.205703,.631373,.421554,.549449,.242643,.756863,.503334,.649999,.284377,.882353,.583497,.749672,.324969,1,.650705,.837228,.356264]},{ColorSpace:"Lab",Name:"Haze_green",RGBPoints:[-1,1,.835294,.886275,-.87451,.937255,.756863,.870443,-.74902,.875817,.666376,.857807,-.623529,.778359,.583007,.808134,-.498039,.676253,.494118,.745098,-.372549,.561365,.390123,.682353,-.247059,.438344,.262745,.621496,-.121569,.321133,.141031,.558751,.00392157,.203922,.0217865,.495861,.129412,.265505,.129412,.433261,.254902,.311692,.255338,.37008,.380392,.356282,.377342,.310821,.505882,.39971,.488889,.258243,.631373,.442556,.604357,.205519,.756863,.48671,.71968,.152941,.882353,.529847,.830356,.100944,1,.572549,.933333,.054902]},{ColorSpace:"Lab",Name:"Haze_lime",RGBPoints:[-1,.704034,.784196,1,-.87451,.633111,.691418,.956078,-.74902,.564021,.600606,.912157,-.623529,.496827,.51189,.868235,-.498039,.43157,.425416,.824314,-.372549,.368248,.341347,.780392,-.247059,.306767,.259855,.736471,-.121569,.246862,.181069,.692549,.00392157,.191619,.109542,.648627,.129412,.257404,.194031,.604706,.254902,.321794,.278775,.560784,.380392,.387909,.364617,.516863,.505882,.456569,.451881,.472941,.631373,.527424,.540773,.42902,.756863,.599759,.631427,.385098,.882353,.673065,.723898,.341176,1,.742751,.812252,.3]},{ColorSpace:"RGB",Name:"Haze",RGBPoints:[-1,1,.835294,.996078,-.00392157,.023529,.141176,.498039,.00392157,.015686,.137255,.494118,1,.984314,.764706,0]},{ColorSpace:"Lab",Name:"Haze_cyan",RGBPoints:[-1,.956863,1,.835294,-.87451,.933188,.921714,.760784,-.74902,.870588,.803486,.671605,-.623529,.807843,.684096,.583297,-.498039,.745098,.569208,.494118,-.372549,.682353,.437763,.390123,-.247059,.621496,.288163,.262745,-.121569,.558751,.144517,.141031,.00392157,.495861,.0217865,.0413943,.129412,.433261,.137255,.129412,.254902,.37008,.263181,.255338,.380392,.306318,.381845,.372694,.505882,.243137,.503994,.494263,.631373,.180392,.629484,.619753,.756863,.117647,.754975,.747131,.882353,.054902,.876398,.866812,1,0,.988235,.976471]},{ColorSpace:"Lab",Name:"nic_Edge",RGBPoints:[-1,.191208,.191208,.191208,-.87451,.239484,.00545035,.614821,-.74902,.220593,.0617459,.863547,-.623529,.17509,.278988,.97794,-.498039,.143526,.576069,.998553,-.372549,.166456,.871883,.96594,-.247059,.376202,.993555,.981833,-.121569,.681996,.991297,.999239,.00392157,.954172,.952734,.94374,.129412,.999735,.99301,.662896,.254902,.979399,.991466,.357973,.380392,.968771,.854967,.162659,.505882,.999245,.556697,.144323,.631373,.973959,.26223,.177946,.756863,.852358,.0526707,.222974,.882353,.593889,.00912724,.238855,1,.191208,.191208,.191208]},{ColorSpace:"Lab",Name:"erdc_iceFire_H",RGBPoints:[-1,4.05432e-7,0,590122e-11,-.87451,0,.120401,.302675,-.74902,0,.216583,.524574,-.623529,.0552475,.345025,.6595,-.498039,.128047,.492588,.720288,-.372549,.188955,.641309,.792092,-.247059,.327673,.784935,.873434,-.121569,.60824,.892164,.935547,.00392157,.881371,.912178,.818099,.129412,.951407,.835621,.449279,.254902,.904481,.690489,0,.380392,.85407,.510864,0,.505882,.777093,.33018,88199e-8,.631373,.672862,.139087,.00269398,.756863,.508815,0,0,.882353,.299417,366289e-9,547829e-9,1,.0157519,.00332021,4.55569e-8]},{ColorSpace:"Lab",Name:"erdc_iceFire_L",RGBPoints:[-1,.870485,.913768,.832905,-.87451,.586919,.887865,.934003,-.74902,.31583,.776442,.867858,-.623529,.18302,.632034,.787722,-.498039,.117909,.484134,.713825,-.372549,.0507239,.335979,.654741,-.247059,0,.209874,.511832,-.121569,0,.114689,.28935,.00392157,.0157519,.00332021,4.55569e-8,.129412,.312914,0,0,.254902,.520865,0,0,.380392,.680105,.15255,.0025996,.505882,.785109,.339479,797922e-9,.631373,.857354,.522494,0,.756863,.910974,.699774,0,.882353,.951921,.842817,.478545,1,.881371,.912178,.818099]},{ColorSpace:"RGB",Name:"hsv",RGBPoints:[-1,1,0,0,-.666666,1,0,1,-.333333,0,0,1,0,0,1,1,.33333,0,1,0,.66666,1,1,0,1,1,0,0]},{ColorSpace:"Lab",Name:"hue_L60",RGBPoints:[-1,.964784,.400592,.349549,-.87451,.964915,.372498,.53785,-.74902,.892353,.401039,.759569,-.623529,.79263,.446956,.903017,-.498039,.682208,.49954,.966673,-.372549,.56392,.553082,.968836,-.247059,.442031,.606396,.901601,-.121569,.305499,.65701,.765784,.00392157,.197251,.687914,.620914,.129412,.193882,.701887,.472654,.254902,.249866,.706123,.320005,.380392,.35132,.697417,.202919,.505882,.498097,.669467,.125232,.631373,.637477,.626239,.107431,.756863,.762115,.56872,.155812,.882353,.889434,.481116,.240445,1,.964784,.400592,.349549]},{ColorSpace:"Lab",Name:"erdc_rainbow_bright",RGBPoints:[-1,.32549,.14902,.960784,-.866221,.297047,.375586,.963836,-.732441,.180302,.536818,.964627,-.598662,.1302,.649207,.929647,-.464883,.0445143,.749654,.855998,-.331104,.0271325,.830713,.721527,-.197324,.259504,.866145,.543555,-.0635452,.428364,.890725,.329819,.0702341,.568503,.898508,.187623,.204013,.738259,.890317,.0825461,.337793,.84546,.86136,.0147555,.471572,.912191,.808018,0,.605351,.962848,.710445,0,.73913,.999469,.600258,.0176284,.87291,.994156,.445975,.193912,1,.980407,.247105,.262699]},{ColorSpace:"Lab",Name:"erdc_rainbow_dark",RGBPoints:[-1,0,0,.423499,-.866221,0,.119346,.529237,-.732441,0,.238691,.634976,-.598662,0,.346852,.68788,-.464883,0,.45022,.718141,-.331104,0,.553554,.664839,-.197324,0,.651082,.519303,-.0635452,.115841,.72479,.352857,.0702341,.326771,.781195,.140187,.204013,.522765,.798524,.0284624,.337793,.703162,.788685,.00885756,.471572,.845118,.751133,0,.605351,.955734,.690825,0,.73913,.995402,.567916,.0618524,.87291,.987712,.403398,.164851,1,.980407,.247105,.262699]},{ColorSpace:"Lab",Name:"nic_CubicL",RGBPoints:[-1,.479965,.0118108,.5307,-.87451,.522213,.0551282,.706919,-.74902,.50839,.237278,.867764,-.623529,.451617,.373834,.987255,-.498039,.39365,.497255,.97506,-.372549,.328631,.599639,.891843,-.247059,.250043,.690286,.778553,-.121569,.249656,.764905,.645857,.00392157,.297954,.821466,.50449,.129412,.337509,.872595,.358447,.254902,.430011,.913789,.297079,.380392,.587191,.931381,.333353,.505882,.727937,.93591,.353742,.631373,.826403,.921081,.365066,.756863,.893201,.846317,.372662,.882353,.965347,.73884,.378506,1,.983235,.597451,.366856]},{ColorSpace:"Lab",Name:"gray_Matlab",RGBPoints:[-1,0,0,0,-.87451,.0627451,.0627451,.0627451,-.74902,.12549,.12549,.12549,-.623529,.188235,.188235,.188235,-.498039,.25098,.25098,.25098,-.372549,.313725,.313725,.313725,-.247059,.376471,.376471,.376471,-.121569,.439216,.439216,.439216,.00392157,.501961,.501961,.501961,.129412,.564706,.564706,.564706,.254902,.627451,.627451,.627451,.380392,.690196,.690196,.690196,.505882,.752941,.752941,.752941,.631373,.815686,.815686,.815686,.756863,.878431,.878431,.878431,.882353,.941176,.941176,.941176,1,1,1,1]},{ColorSpace:"Lab",Name:"erdc_red2yellow_BW",RGBPoints:[-1,7.54296e-7,0,109827e-10,-.87451,.18285,.0264094,0,-.74902,.3066,0,0,-.623529,.422841,0,0,-.498039,.522945,0,0,-.372549,.605721,0,0,-.247059,.672502,.14168,0,-.121569,.728167,.244025,0,.00392157,.781215,.333454,0,.129412,.825,.423586,0,.254902,.855893,.516793,0,.380392,.880491,.608846,0,.505882,.910305,.695505,0,.631373,.94109,.779067,.223528,.756863,.967873,.858572,.473521,.882353,.986815,.933211,.751583,1,1,1,.999997]},{ColorSpace:"Lab",Name:"erdc_blue2cyan_BW",RGBPoints:[-1,4.05298e-7,0,59012e-10,-.87451,.0207526,.0740933,.18093,-.74902,0,.121033,.30343,-.623529,0,.166892,.416095,-.498039,0,.216768,.524796,-.372549,.0164769,.275471,.608585,-.247059,.0544527,.344824,.659267,-.121569,.0880643,.419118,.688675,.00392157,.127938,.492556,.720256,.129412,.149476,.566946,.756918,.254902,.188961,.641333,.792122,.380392,.245482,.715336,.827609,.505882,.329216,.786235,.874761,.631373,.453558,.852803,.918466,.756863,.626281,.910493,.954,.882353,.82257,.958709,.980146,1,1,1,.999989]},{ColorSpace:"Lab",Name:"erdc_gold_BW",RGBPoints:[-1,0,0,190933e-10,-.87451,.128363,.0636265,0,-.74902,.193795,.111057,0,-.623529,.25976,.15987,0,-.498039,.328546,.210589,0,-.372549,.399726,.26332,0,-.247059,.472969,.318261,0,-.121569,.546245,.375827,0,.00392157,.61745,.436719,0,.129412,.685545,.501113,0,.254902,.749578,.568799,0,.380392,.80962,.6394,0,.505882,.865572,.712699,.10257,.631373,.917709,.787569,.233665,.756863,.966914,.863138,.369608,.882353,1,.939405,.496104,1,.999225,1,.612275]},{ColorSpace:"Lab",Name:"GREEN-WHITE_LINEAR",RGBPoints:[-1,0,0,0,-.87451,0,.062745,0,-.74902,0,.12549,0,-.623529,0,.188235,0,-.498039,0,.25098,0,-.372549,0,.313725,0,-.247059,0,.376471,0,-.121569,.094118,.439216,0,.00392157,.196078,.501961,0,.129412,.294118,.564706,0,.254902,.396078,.627451,0,.380392,.498039,.690196,0,.505882,.6,.752941,.145098,.631373,.701961,.815686,.364706,.756863,.8,.878431,.580392,.882353,.901961,.941176,.796078,1,1,1,1]},{ColorSpace:"Lab",Name:"Blues",RGBPoints:[-1,.031373,.188235,.419608,-.87451,.031373,.253195,.516063,-.74902,.031757,.318139,.612149,-.623529,.080969,.38113,.661361,-.498039,.130427,.444152,.710327,-.372549,.195386,.509112,.743791,-.247059,.260715,.573841,.777209,-.121569,.341423,.628958,.808704,.00392157,.422745,.684075,.839892,.129412,.523137,.739193,.861546,.254902,.622684,.793464,.883429,.380392,.701423,.826928,.910988,.505882,.778685,.8603,.937993,.631373,.825928,.891795,.953741,.756863,.87328,.923291,.969489,.882353,.922491,.954787,.985236,1,.968627,.984314,1]},{ColorSpace:"Lab",Name:"Greens",RGBPoints:[-1,0,.266667,.105882,-.87451,0,.347374,.139346,-.74902,538e-6,.427912,.172933,-.623529,.069435,.486967,.222145,-.498039,.138178,.546082,.271326,-.372549,.197232,.609073,.31857,-.247059,.257255,.671742,.365859,-.121569,.357647,.720953,.415071,.00392157,.45767,.769919,.465021,.129412,.546251,.811257,.537855,.254902,.634295,.852211,.610688,.380392,.709097,.883706,.683522,.505882,.78316,.914833,.755894,.631373,.842215,.938454,.818885,.756863,.899977,.961538,.880692,.882353,.935409,.975317,.92203,1,.968627,.988235,.960784]},{ColorSpace:"Lab",Name:"Reds",RGBPoints:[-1,.403922,0,.05098,-.87451,.525967,.029527,.066728,-.74902,.647643,.058962,.082476,-.623529,.722445,.076678,.098224,-.498039,.797186,.095194,.114187,-.372549,.868051,.164091,.143714,-.247059,.937809,.233541,.173933,-.121569,.96143,.326059,.232987,.00392157,.984375,.418147,.292657,.129412,.986344,.496886,.371396,.254902,.988235,.575702,.450673,.380392,.988235,.656409,.543191,.505882,.98842,.736747,.635894,.631373,.992357,.809581,.732349,.756863,.996186,.880692,.826759,.882353,.998155,.92203,.885813,1,1,.960784,.941176]},{ColorSpace:"Lab",Name:"BrOrYl",RGBPoints:[-1,.4,.145098,.023529,-.87451,.500392,.174625,.019592,-.74902,.600784,.204291,.015656,-.623529,.701176,.251534,.011719,-.498039,.800984,.299146,.008397,-.372549,.863975,.370012,.043829,-.247059,.926321,.441107,.0794,-.121569,.961753,.521815,.120738,.00392157,.996078,.602645,.163122,.129412,.996078,.68729,.237924,.254902,.996078,.771011,.314879,.380392,.996078,.832034,.444798,.505882,.996171,.892042,.572595,.631373,.998139,.931411,.65724,.756863,1,.969489,.741669,.882353,1,.985236,.822376,1,1,1,.898039]},{ColorSpace:"Lab",Name:"blue2yellow",RGBPoints:[-1,0,0,1,0,.5,.5,.5,1,1,1,0]},{ColorSpace:"Lab",Name:"erdc_cyan2orange",RGBPoints:[-1,.0471513,.213874,.414329,-.87451,.0674702,.256648,.439027,-.74902,.0959957,.299331,.462089,-.623529,.132428,.341872,.483212,-.498039,.188743,.38277,.500597,-.372549,.268511,.420229,.512179,-.247059,.352945,.455602,.519101,-.121569,.43893,.489368,.521538,.00392157,.522445,.522495,.522436,.129412,.600089,.555682,.53205,.254902,.67988,.587981,.539163,.380392,.761011,.619586,.544439,.505882,.84278,.650741,.548567,.631373,.910713,.687347,.557822,.756863,.952232,.734972,.577775,.882353,.975642,.789858,.604868,1,.990752,.843643,.632857]},{ColorSpace:"Lab",Name:"coolwarm",RGBPoints:[-1,.229806,.298718,.753683,-.875,.303869,.406535,.844959,-.75,.383013,.509419,.917388,-.625,.466667,.604563,.968155,-.5,.552953,.688929,.995376,-.375,.639176,.7596,.998151,-.25,.722193,.813953,.976575,-.125,.798692,.849786,.931689,0,.865395,.86541,.865396,.125,.924128,.827385,.774508,.25,.958853,.769768,.678008,.375,.969954,.694267,.579375,.5,.958003,.602842,.481776,.625,.923945,.497309,.38797,.75,.869187,.378313,.300267,.875,.795632,.241284,.220526,1,.705673,.0155562,.150233]},{ColorSpace:"Lab",Name:"BuRd",RGBPoints:[-1,.019608,.188235,.380392,-.87451,.088504,.321107,.564937,-.74902,.163399,.444983,.697501,-.623529,.247059,.555709,.754095,-.498039,.420684,.676432,.818685,-.372549,.606459,.789773,.880277,-.247059,.761476,.868512,.924567,-.121569,.878047,.925721,.951942,.00392157,.969089,.966474,.964937,.129412,.983852,.897578,.846828,.254902,.982468,.800692,.706113,.380392,.960323,.66782,.536332,.505882,.894579,.503806,.399769,.631373,.81707,.33218,.281046,.756863,.728489,.155017,.197386,.882353,.576932,.055363,.14925,1,.403922,0,.121569]},{ColorSpace:"Lab",Name:"GyRd",RGBPoints:[-1,.101961,.101961,.101961,-.87451,.227451,.227451,.227451,-.74902,.359939,.359939,.359939,-.623529,.502653,.502653,.502653,-.498039,.631373,.631373,.631373,-.372549,.749865,.749865,.749865,-.247059,.843368,.843368,.843368,-.121569,.926105,.926105,.926105,.00392157,.999846,.997232,.995694,.129412,.994925,.908651,.857901,.254902,.982468,.800692,.706113,.380392,.960323,.66782,.536332,.505882,.894579,.503806,.399769,.631373,.81707,.33218,.281046,.756863,.728489,.155017,.197386,.882353,.576932,.055363,.14925,1,.403922,0,.121569]},{ColorSpace:"Lab",Name:"GBBr",RGBPoints:[-1,0,.235294,.188235,-.87451,.002461,.338639,.301423,-.74902,.055902,.448981,.417609,-.623529,.183852,.56955,.538178,-.498039,.357785,.700115,.660746,-.372549,.540177,.819531,.77624,-.247059,.714879,.890888,.864821,-.121569,.851134,.934564,.922645,.00392157,.960861,.959785,.95694,.129412,.963322,.927797,.83391,.254902,.939946,.868897,.68935,.380392,.883353,.775394,.517109,.505882,.808074,.625836,.324106,.631373,.717647,.476355,.15494,.756863,.592157,.358247,.06882,.882353,.458593,.26436,.031142,1,.329412,.188235,.019608]},{ColorSpace:"Lab",Name:"erdc_divLow_icePeach",RGBPoints:[-1,.480048,.817441,.998056,-.87451,.425898,.726921,.883187,-.74902,.366682,.629445,.761936,-.623529,.308756,.531002,.640217,-.498039,.258021,.43705,.523433,-.372549,.219244,.352381,.416348,-.247059,.195127,.281032,.322979,-.121569,.186286,.22627,.246525,.00392157,.192352,.19236,.192364,.129412,.255927,.214469,.191756,.254902,.340459,.254426,.206666,.380392,.444655,.309315,.234029,.505882,.565353,.376004,.270969,.631373,.697917,.450748,.314293,.756863,.836657,.529064,.360227,.882353,.972695,.614884,.413123,1,1,.705904,.472699]},{ColorSpace:"RGB",Name:"Haze",RGBPoints:[-1,1,.835294,.996078,-.00392157,.023529,.141176,.498039,.00392157,.015686,.137255,.494118,1,.984314,.764706,0]},{ColorSpace:"Lab",Name:"erdc_iceFire_L",RGBPoints:[-1,.870485,.913768,.832905,-.87451,.586919,.887865,.934003,-.74902,.31583,.776442,.867858,-.623529,.18302,.632034,.787722,-.498039,.117909,.484134,.713825,-.372549,.0507239,.335979,.654741,-.247059,0,.209874,.511832,-.121569,0,.114689,.28935,.00392157,.0157519,.00332021,4.55569e-8,.129412,.312914,0,0,.254902,.520865,0,0,.380392,.680105,.15255,.0025996,.505882,.785109,.339479,797922e-9,.631373,.857354,.522494,0,.756863,.910974,.699774,0,.882353,.951921,.842817,.478545,1,.881371,.912178,.818099]},{IndexedColors:[0,0,0,.8941176470588236,.1019607843137255,.1098039215686274,.2156862745098039,.4941176470588236,.7215686274509804,.3019607843137255,.6862745098039216,.2901960784313726,.596078431372549,.3058823529411765,.6392156862745098,1,.4980392156862745,0,.6509803921568628,.3372549019607843,.1568627450980392],Name:"Spectrum",NanColor:[.6509803921568628,.3372549019607843,.1568627450980392]},{IndexedColors:[.4745098039215686,.09019607843137255,.09019607843137255,.7098039215686275,.00392156862745098,.00392156862745098,.9372549019607843,.2784313725490196,.09803921568627451,.9764705882352941,.5137254901960784,.1411764705882353,1,.7058823529411765,0,1,.8980392156862745,.02352941176470588],Name:"Warm",NanColor:[1,.8980392156862745,.02352941176470588]},{IndexedColors:[.4588235294117647,.6941176470588235,.00392156862745098,.3450980392156863,.5019607843137255,.1607843137254902,.3137254901960784,.8431372549019608,.7490196078431373,.1098039215686274,.5843137254901961,.803921568627451,.2313725490196079,.407843137254902,.6705882352941176,.6039215686274509,.407843137254902,1,.3725490196078431,.2,.5019607843137255],Name:"Cool",NanColor:[.3725490196078431,.2,.5019607843137255]},{IndexedColors:[.2313725490196079,.407843137254902,.6705882352941176,.1098039215686274,.5843137254901961,.803921568627451,.3058823529411765,.8509803921568627,.9176470588235294,.4509803921568628,.6039215686274509,.8352941176470589,.2588235294117647,.2392156862745098,.6627450980392157,.3137254901960784,.3294117647058823,.5294117647058824,.06274509803921569,.1647058823529412,.3215686274509804],Name:"Blues",NanColor:[.06274509803921569,.1647058823529412,.3215686274509804]},{IndexedColors:[.1098039215686274,.5843137254901961,.803921568627451,.2313725490196079,.407843137254902,.6705882352941176,.4,.2431372549019608,.7176470588235294,.6352941176470588,.3294117647058823,.8117647058823529,.8705882352941177,.3803921568627451,.807843137254902,.8627450980392157,.3803921568627451,.5843137254901961,.2392156862745098,.06274509803921569,.3215686274509804],Name:"Wild Flower",NanColor:[.2392156862745098,.06274509803921569,.3215686274509804]},{IndexedColors:[.396078431372549,.4862745098039216,.2156862745098039,.4588235294117647,.6941176470588235,.00392156862745098,.6980392156862745,.7294117647058823,.1882352941176471,1,.8980392156862745,.02352941176470588,1,.7058823529411765,0,.9764705882352941,.5137254901960784,.1411764705882353],Name:"Citrus",NanColor:[.9764705882352941,.5137254901960784,.1411764705882353]},{IndexedColors:[.4980392156862745,.2313725490196079,.03137254901960784,.7019607843137254,.3450980392156863,.02352941176470588,.8784313725490196,.5098039215686274,.0784313725490196,.9921568627450981,.7215686274509804,.3882352941176471,.996078431372549,.8784313725490196,.7137254901960784,.9686274509803922,.9686274509803922,.9686274509803922,.8470588235294118,.8549019607843137,.9215686274509803,.6980392156862745,.6705882352941176,.8235294117647058,.5019607843137255,.4509803921568628,.6745098039215687,.3294117647058823,.1529411764705882,.5333333333333333,.1764705882352941,0,.2941176470588235],Name:"Brewer Diverging Purple-Orange (11)",NanColor:[.1764705882352941,0,.2941176470588235]},{IndexedColors:[.4980392156862745,.2313725490196079,.03137254901960784,.7019607843137254,.3450980392156863,.02352941176470588,.8784313725490196,.5098039215686274,.0784313725490196,.9921568627450981,.7215686274509804,.3882352941176471,.996078431372549,.8784313725490196,.7137254901960784,.8470588235294118,.8549019607843137,.9215686274509803,.6980392156862745,.6705882352941176,.8235294117647058,.5019607843137255,.4509803921568628,.6745098039215687,.3294117647058823,.1529411764705882,.5333333333333333,.1764705882352941,0,.2941176470588235],Name:"Brewer Diverging Purple-Orange (10)",NanColor:[.1764705882352941,0,.2941176470588235]},{IndexedColors:[.7019607843137254,.3450980392156863,.02352941176470588,.8784313725490196,.5098039215686274,.0784313725490196,.9921568627450981,.7215686274509804,.3882352941176471,.996078431372549,.8784313725490196,.7137254901960784,.9686274509803922,.9686274509803922,.9686274509803922,.8470588235294118,.8549019607843137,.9215686274509803,.6980392156862745,.6705882352941176,.8235294117647058,.5019607843137255,.4509803921568628,.6745098039215687,.3294117647058823,.1529411764705882,.5333333333333333],Name:"Brewer Diverging Purple-Orange (9)",NanColor:[.3294117647058823,.1529411764705882,.5333333333333333]},{IndexedColors:[.7019607843137254,.3450980392156863,.02352941176470588,.8784313725490196,.5098039215686274,.0784313725490196,.9921568627450981,.7215686274509804,.3882352941176471,.996078431372549,.8784313725490196,.7137254901960784,.8470588235294118,.8549019607843137,.9215686274509803,.6980392156862745,.6705882352941176,.8235294117647058,.5019607843137255,.4509803921568628,.6745098039215687,.3294117647058823,.1529411764705882,.5333333333333333],Name:"Brewer Diverging Purple-Orange (8)",NanColor:[.3294117647058823,.1529411764705882,.5333333333333333]},{IndexedColors:[.7019607843137254,.3450980392156863,.02352941176470588,.9450980392156862,.6392156862745098,.2509803921568627,.996078431372549,.8784313725490196,.7137254901960784,.9686274509803922,.9686274509803922,.9686274509803922,.8470588235294118,.8549019607843137,.9215686274509803,.6,.5568627450980392,.7647058823529411,.3294117647058823,.1529411764705882,.5333333333333333],Name:"Brewer Diverging Purple-Orange (7)",NanColor:[.3294117647058823,.1529411764705882,.5333333333333333]},{IndexedColors:[.7019607843137254,.3450980392156863,.02352941176470588,.9450980392156862,.6392156862745098,.2509803921568627,.996078431372549,.8784313725490196,.7137254901960784,.8470588235294118,.8549019607843137,.9215686274509803,.6,.5568627450980392,.7647058823529411,.3294117647058823,.1529411764705882,.5333333333333333],Name:"Brewer Diverging Purple-Orange (6)",NanColor:[.3294117647058823,.1529411764705882,.5333333333333333]},{IndexedColors:[.9019607843137255,.3803921568627451,.00392156862745098,.9921568627450981,.7215686274509804,.3882352941176471,.9686274509803922,.9686274509803922,.9686274509803922,.6980392156862745,.6705882352941176,.8235294117647058,.3686274509803922,.2352941176470588,.6],Name:"Brewer Diverging Purple-Orange (5)",NanColor:[.3686274509803922,.2352941176470588,.6]},{IndexedColors:[.9019607843137255,.3803921568627451,.00392156862745098,.9921568627450981,.7215686274509804,.3882352941176471,.6980392156862745,.6705882352941176,.8235294117647058,.3686274509803922,.2352941176470588,.6],Name:"Brewer Diverging Purple-Orange (4)",NanColor:[.3686274509803922,.2352941176470588,.6]},{IndexedColors:[.9450980392156862,.6392156862745098,.2509803921568627,.9686274509803922,.9686274509803922,.9686274509803922,.6,.5568627450980392,.7647058823529411],Name:"Brewer Diverging Purple-Orange (3)",NanColor:[.6,.5568627450980392,.7647058823529411]},{IndexedColors:[.6196078431372549,.00392156862745098,.2588235294117647,.8352941176470589,.2431372549019608,.3098039215686275,.9568627450980393,.4274509803921568,.2627450980392157,.9921568627450981,.6823529411764706,.3803921568627451,.996078431372549,.8784313725490196,.5450980392156862,1,1,.7490196078431373,.9019607843137255,.9607843137254902,.596078431372549,.6705882352941176,.8666666666666667,.6431372549019608,.4,.7607843137254902,.6470588235294118,.196078431372549,.5333333333333333,.7411764705882353,.3686274509803922,.3098039215686275,.6352941176470588],Name:"Brewer Diverging Spectral (11)",NanColor:[.3686274509803922,.3098039215686275,.6352941176470588]},{IndexedColors:[.6196078431372549,.00392156862745098,.2588235294117647,.8352941176470589,.2431372549019608,.3098039215686275,.9568627450980393,.4274509803921568,.2627450980392157,.9921568627450981,.6823529411764706,.3803921568627451,.996078431372549,.8784313725490196,.5450980392156862,.9019607843137255,.9607843137254902,.596078431372549,.6705882352941176,.8666666666666667,.6431372549019608,.4,.7607843137254902,.6470588235294118,.196078431372549,.5333333333333333,.7411764705882353,.3686274509803922,.3098039215686275,.6352941176470588],Name:"Brewer Diverging Spectral (10)",NanColor:[.3686274509803922,.3098039215686275,.6352941176470588]},{IndexedColors:[.8352941176470589,.2431372549019608,.3098039215686275,.9568627450980393,.4274509803921568,.2627450980392157,.9921568627450981,.6823529411764706,.3803921568627451,.996078431372549,.8784313725490196,.5450980392156862,1,1,.7490196078431373,.9019607843137255,.9607843137254902,.596078431372549,.6705882352941176,.8666666666666667,.6431372549019608,.4,.7607843137254902,.6470588235294118,.196078431372549,.5333333333333333,.7411764705882353],Name:"Brewer Diverging Spectral (9)",NanColor:[.196078431372549,.5333333333333333,.7411764705882353]},{IndexedColors:[.8352941176470589,.2431372549019608,.3098039215686275,.9568627450980393,.4274509803921568,.2627450980392157,.9921568627450981,.6823529411764706,.3803921568627451,.996078431372549,.8784313725490196,.5450980392156862,.9019607843137255,.9607843137254902,.596078431372549,.6705882352941176,.8666666666666667,.6431372549019608,.4,.7607843137254902,.6470588235294118,.196078431372549,.5333333333333333,.7411764705882353],Name:"Brewer Diverging Spectral (8)",NanColor:[.196078431372549,.5333333333333333,.7411764705882353]},{IndexedColors:[.8352941176470589,.2431372549019608,.3098039215686275,.9882352941176471,.5529411764705883,.3490196078431372,.996078431372549,.8784313725490196,.5450980392156862,1,1,.7490196078431373,.9019607843137255,.9607843137254902,.596078431372549,.6,.8352941176470589,.5803921568627451,.196078431372549,.5333333333333333,.7411764705882353],Name:"Brewer Diverging Spectral (7)",NanColor:[.196078431372549,.5333333333333333,.7411764705882353]},{IndexedColors:[.8352941176470589,.2431372549019608,.3098039215686275,.9882352941176471,.5529411764705883,.3490196078431372,.996078431372549,.8784313725490196,.5450980392156862,.9019607843137255,.9607843137254902,.596078431372549,.6,.8352941176470589,.5803921568627451,.196078431372549,.5333333333333333,.7411764705882353],Name:"Brewer Diverging Spectral (6)",NanColor:[.196078431372549,.5333333333333333,.7411764705882353]},{IndexedColors:[.8431372549019608,.09803921568627451,.1098039215686274,.9921568627450981,.6823529411764706,.3803921568627451,1,1,.7490196078431373,.6705882352941176,.8666666666666667,.6431372549019608,.1686274509803922,.5137254901960784,.7294117647058823],Name:"Brewer Diverging Spectral (5)",NanColor:[.1686274509803922,.5137254901960784,.7294117647058823]},{IndexedColors:[.8431372549019608,.09803921568627451,.1098039215686274,.9921568627450981,.6823529411764706,.3803921568627451,.6705882352941176,.8666666666666667,.6431372549019608,.1686274509803922,.5137254901960784,.7294117647058823],Name:"Brewer Diverging Spectral (4)",NanColor:[.1686274509803922,.5137254901960784,.7294117647058823]},{IndexedColors:[.9882352941176471,.5529411764705883,.3490196078431372,1,1,.7490196078431373,.6,.8352941176470589,.5803921568627451],Name:"Brewer Diverging Spectral (3)",NanColor:[.6,.8352941176470589,.5803921568627451]},{IndexedColors:[.3294117647058823,.1882352941176471,.0196078431372549,.5490196078431373,.3176470588235294,.0392156862745098,.7490196078431373,.5058823529411764,.1764705882352941,.8745098039215686,.7607843137254902,.4901960784313725,.9647058823529412,.9098039215686274,.7647058823529411,.9607843137254902,.9607843137254902,.9607843137254902,.7803921568627451,.9176470588235294,.8980392156862745,.5019607843137255,.803921568627451,.7568627450980392,.207843137254902,.592156862745098,.5607843137254902,.00392156862745098,.4,.3686274509803922,0,.2352941176470588,.1882352941176471],Name:"Brewer Diverging Brown-Blue-Green (11)",NanColor:[0,.2352941176470588,.1882352941176471]},{IndexedColors:[.3294117647058823,.1882352941176471,.0196078431372549,.5490196078431373,.3176470588235294,.0392156862745098,.7490196078431373,.5058823529411764,.1764705882352941,.8745098039215686,.7607843137254902,.4901960784313725,.9647058823529412,.9098039215686274,.7647058823529411,.7803921568627451,.9176470588235294,.8980392156862745,.5019607843137255,.803921568627451,.7568627450980392,.207843137254902,.592156862745098,.5607843137254902,.00392156862745098,.4,.3686274509803922,0,.2352941176470588,.1882352941176471],Name:"Brewer Diverging Brown-Blue-Green (10)",NanColor:[0,.2352941176470588,.1882352941176471]},{IndexedColors:[.5490196078431373,.3176470588235294,.0392156862745098,.7490196078431373,.5058823529411764,.1764705882352941,.8745098039215686,.7607843137254902,.4901960784313725,.9647058823529412,.9098039215686274,.7647058823529411,.9607843137254902,.9607843137254902,.9607843137254902,.7803921568627451,.9176470588235294,.8980392156862745,.5019607843137255,.803921568627451,.7568627450980392,.207843137254902,.592156862745098,.5607843137254902,.00392156862745098,.4,.3686274509803922],Name:"Brewer Diverging Brown-Blue-Green (9)",NanColor:[.00392156862745098,.4,.3686274509803922]},{IndexedColors:[.5490196078431373,.3176470588235294,.0392156862745098,.7490196078431373,.5058823529411764,.1764705882352941,.8745098039215686,.7607843137254902,.4901960784313725,.9647058823529412,.9098039215686274,.7647058823529411,.7803921568627451,.9176470588235294,.8980392156862745,.5019607843137255,.803921568627451,.7568627450980392,.207843137254902,.592156862745098,.5607843137254902,.00392156862745098,.4,.3686274509803922],Name:"Brewer Diverging Brown-Blue-Green (8)",NanColor:[.00392156862745098,.4,.3686274509803922]},{IndexedColors:[.5490196078431373,.3176470588235294,.0392156862745098,.8470588235294118,.7019607843137254,.396078431372549,.9647058823529412,.9098039215686274,.7647058823529411,.9607843137254902,.9607843137254902,.9607843137254902,.7803921568627451,.9176470588235294,.8980392156862745,.3529411764705883,.7058823529411765,.6745098039215687,.00392156862745098,.4,.3686274509803922],Name:"Brewer Diverging Brown-Blue-Green (7)",NanColor:[.00392156862745098,.4,.3686274509803922]},{IndexedColors:[.5490196078431373,.3176470588235294,.0392156862745098,.8470588235294118,.7019607843137254,.396078431372549,.9647058823529412,.9098039215686274,.7647058823529411,.7803921568627451,.9176470588235294,.8980392156862745,.3529411764705883,.7058823529411765,.6745098039215687,.00392156862745098,.4,.3686274509803922],Name:"Brewer Diverging Brown-Blue-Green (6)",NanColor:[.00392156862745098,.4,.3686274509803922]},{IndexedColors:[.6509803921568628,.3803921568627451,.1019607843137255,.8745098039215686,.7607843137254902,.4901960784313725,.9607843137254902,.9607843137254902,.9607843137254902,.5019607843137255,.803921568627451,.7568627450980392,.00392156862745098,.5215686274509804,.4431372549019608],Name:"Brewer Diverging Brown-Blue-Green (5)",NanColor:[.00392156862745098,.5215686274509804,.4431372549019608]},{IndexedColors:[.6509803921568628,.3803921568627451,.1019607843137255,.8745098039215686,.7607843137254902,.4901960784313725,.5019607843137255,.803921568627451,.7568627450980392,.00392156862745098,.5215686274509804,.4431372549019608],Name:"Brewer Diverging Brown-Blue-Green (4)",NanColor:[.00392156862745098,.5215686274509804,.4431372549019608]},{IndexedColors:[.8470588235294118,.7019607843137254,.396078431372549,.9607843137254902,.9607843137254902,.9607843137254902,.3529411764705883,.7058823529411765,.6745098039215687],Name:"Brewer Diverging Brown-Blue-Green (3)",NanColor:[.3529411764705883,.7058823529411765,.6745098039215687]},{IndexedColors:[.9686274509803922,.9882352941176471,.9921568627450981,.8980392156862745,.9607843137254902,.9764705882352941,.8,.9254901960784314,.9019607843137255,.6,.8470588235294118,.788235294117647,.4,.7607843137254902,.6431372549019608,.2549019607843137,.6823529411764706,.4627450980392157,.1372549019607843,.5450980392156862,.2705882352941176,0,.4274509803921568,.1725490196078431,0,.2666666666666667,.1058823529411765],Name:"Brewer Sequential Blue-Green (9)",NanColor:[0,.2666666666666667,.1058823529411765]},{IndexedColors:[.9686274509803922,.9882352941176471,.9921568627450981,.8980392156862745,.9607843137254902,.9764705882352941,.8,.9254901960784314,.9019607843137255,.6,.8470588235294118,.788235294117647,.4,.7607843137254902,.6431372549019608,.2549019607843137,.6823529411764706,.4627450980392157,.1372549019607843,.5450980392156862,.2705882352941176,0,.3450980392156863,.1411764705882353],Name:"Brewer Sequential Blue-Green (8)",NanColor:[0,.3450980392156863,.1411764705882353]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.8,.9254901960784314,.9019607843137255,.8,.9254901960784314,.9019607843137255,.4,.7607843137254902,.6431372549019608,.2549019607843137,.6823529411764706,.4627450980392157,.1372549019607843,.5450980392156862,.2705882352941176,0,.3450980392156863,.1411764705882353],Name:"Brewer Sequential Blue-Green (7)",NanColor:[0,.3450980392156863,.1411764705882353]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.8,.9254901960784314,.9019607843137255,.6,.8470588235294118,.788235294117647,.4,.7607843137254902,.6431372549019608,.1725490196078431,.6352941176470588,.3725490196078431,0,.4274509803921568,.1725490196078431],Name:"Brewer Sequential Blue-Green (6)",NanColor:[0,.4274509803921568,.1725490196078431]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.6980392156862745,.8862745098039215,.8862745098039215,.4,.7607843137254902,.6431372549019608,.1725490196078431,.6352941176470588,.3725490196078431,0,.4274509803921568,.1725490196078431],Name:"Brewer Sequential Blue-Green (5)",NanColor:[0,.4274509803921568,.1725490196078431]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.6980392156862745,.8862745098039215,.8862745098039215,.4,.7607843137254902,.6431372549019608,.1372549019607843,.5450980392156862,.2705882352941176],Name:"Brewer Sequential Blue-Green (4)",NanColor:[.1372549019607843,.5450980392156862,.2705882352941176]},{IndexedColors:[.8980392156862745,.9607843137254902,.9764705882352941,.6,.8470588235294118,.788235294117647,.1725490196078431,.6352941176470588,.3725490196078431],Name:"Brewer Sequential Blue-Green (3)",NanColor:[.1725490196078431,.6352941176470588,.3725490196078431]},{IndexedColors:[1,1,.8980392156862745,1,.9686274509803922,.7372549019607844,.996078431372549,.8901960784313725,.5686274509803921,.996078431372549,.7686274509803922,.3098039215686275,.996078431372549,.6,.1607843137254902,.9254901960784314,.4392156862745098,.0784313725490196,.8,.2980392156862745,.00784313725490196,.6,.203921568627451,.01568627450980392,.4,.1450980392156863,.02352941176470588],Name:"Brewer Sequential Yellow-Orange-Brown (9)",NanColor:[.4,.1450980392156863,.02352941176470588]},{IndexedColors:[1,1,.8980392156862745,1,.9686274509803922,.7372549019607844,.996078431372549,.8901960784313725,.5686274509803921,.996078431372549,.7686274509803922,.3098039215686275,.996078431372549,.6,.1607843137254902,.9254901960784314,.4392156862745098,.0784313725490196,.8,.2980392156862745,.00784313725490196,.5490196078431373,.1764705882352941,.01568627450980392],Name:"Brewer Sequential Yellow-Orange-Brown (8)",NanColor:[.5490196078431373,.1764705882352941,.01568627450980392]},{IndexedColors:[1,1,.8313725490196079,.996078431372549,.8901960784313725,.5686274509803921,.996078431372549,.7686274509803922,.3098039215686275,.996078431372549,.6,.1607843137254902,.9254901960784314,.4392156862745098,.0784313725490196,.8,.2980392156862745,.00784313725490196,.5490196078431373,.1764705882352941,.01568627450980392],Name:"Brewer Sequential Yellow-Orange-Brown (7)",NanColor:[.5490196078431373,.1764705882352941,.01568627450980392]},{IndexedColors:[1,1,.8313725490196079,.996078431372549,.8901960784313725,.5686274509803921,.996078431372549,.7686274509803922,.3098039215686275,.996078431372549,.6,.1607843137254902,.8509803921568627,.3725490196078431,.05490196078431372,.6,.203921568627451,.01568627450980392],Name:"Brewer Sequential Yellow-Orange-Brown (6)",NanColor:[.6,.203921568627451,.01568627450980392]},{IndexedColors:[1,1,.8313725490196079,.996078431372549,.8509803921568627,.5568627450980392,.996078431372549,.6,.1607843137254902,.8509803921568627,.3725490196078431,.05490196078431372,.6,.203921568627451,.01568627450980392],Name:"Brewer Sequential Yellow-Orange-Brown (5)",NanColor:[.6,.203921568627451,.01568627450980392]},{IndexedColors:[1,1,.8313725490196079,.996078431372549,.8509803921568627,.5568627450980392,.996078431372549,.6,.1607843137254902,.8,.2980392156862745,.00784313725490196],Name:"Brewer Sequential Yellow-Orange-Brown (4)",NanColor:[.8,.2980392156862745,.00784313725490196]},{IndexedColors:[1,.9686274509803922,.7372549019607844,.996078431372549,.7686274509803922,.3098039215686275,.8509803921568627,.3725490196078431,.05490196078431372],Name:"Brewer Sequential Yellow-Orange-Brown (3)",NanColor:[.8509803921568627,.3725490196078431,.05490196078431372]},{IndexedColors:[.9686274509803922,.9882352941176471,.9921568627450981,.8784313725490196,.9254901960784314,.9568627450980393,.7490196078431373,.8274509803921568,.9019607843137255,.6196078431372549,.7372549019607844,.8549019607843137,.5490196078431373,.5882352941176471,.7764705882352941,.5490196078431373,.4196078431372549,.6941176470588235,.5333333333333333,.2549019607843137,.615686274509804,.5058823529411764,.05882352941176471,.4862745098039216,.3019607843137255,0,.2941176470588235],Name:"Brewer Sequential Blue-Purple (9)",NanColor:[.3019607843137255,0,.2941176470588235]},{IndexedColors:[.9686274509803922,.9882352941176471,.9921568627450981,.8784313725490196,.9254901960784314,.9568627450980393,.7490196078431373,.8274509803921568,.9019607843137255,.6196078431372549,.7372549019607844,.8549019607843137,.5490196078431373,.5882352941176471,.7764705882352941,.5490196078431373,.4196078431372549,.6941176470588235,.5333333333333333,.2549019607843137,.615686274509804,.4313725490196079,.00392156862745098,.4196078431372549],Name:"Brewer Sequential Blue-Purple (8)",NanColor:[.4313725490196079,.00392156862745098,.4196078431372549]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.7490196078431373,.8274509803921568,.9019607843137255,.6196078431372549,.7372549019607844,.8549019607843137,.5490196078431373,.5882352941176471,.7764705882352941,.5490196078431373,.4196078431372549,.6941176470588235,.5333333333333333,.2549019607843137,.615686274509804,.4313725490196079,.00392156862745098,.4196078431372549],Name:"Brewer Sequential Blue-Purple (7)",NanColor:[.4313725490196079,.00392156862745098,.4196078431372549]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.7490196078431373,.8274509803921568,.9019607843137255,.6196078431372549,.7372549019607844,.8549019607843137,.5490196078431373,.5882352941176471,.7764705882352941,.5333333333333333,.3372549019607843,.6549019607843137,.5058823529411764,.05882352941176471,.4862745098039216],Name:"Brewer Sequential Blue-Purple (6)",NanColor:[.5058823529411764,.05882352941176471,.4862745098039216]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.7019607843137254,.803921568627451,.8901960784313725,.5490196078431373,.5882352941176471,.7764705882352941,.5333333333333333,.3372549019607843,.6549019607843137,.5058823529411764,.05882352941176471,.4862745098039216],Name:"Brewer Sequential Blue-Purple (5)",NanColor:[.5058823529411764,.05882352941176471,.4862745098039216]},{IndexedColors:[.9294117647058824,.9725490196078431,.984313725490196,.7019607843137254,.803921568627451,.8901960784313725,.5490196078431373,.5882352941176471,.7764705882352941,.5333333333333333,.2549019607843137,.615686274509804],Name:"Brewer Sequential Blue-Purple (4)",NanColor:[.5333333333333333,.2549019607843137,.615686274509804]},{IndexedColors:[.8784313725490196,.9254901960784314,.9568627450980393,.6196078431372549,.7372549019607844,.8549019607843137,.5333333333333333,.3372549019607843,.6549019607843137],Name:"Brewer Sequential Blue-Purple (3)",NanColor:[.5333333333333333,.3372549019607843,.6549019607843137]},{IndexedColors:[.4980392156862745,.788235294117647,.4980392156862745,.7450980392156863,.6823529411764706,.8313725490196079,.9921568627450981,.7529411764705882,.5254901960784314,1,1,.6,.2196078431372549,.4235294117647059,.6901960784313725,.9411764705882353,.00784313725490196,.4980392156862745,.7490196078431373,.3568627450980392,.09019607843137255,.4,.4,.4],Name:"Brewer Qualitative Accent",NanColor:[.4,.4,.4]},{IndexedColors:[.1058823529411765,.6196078431372549,.4666666666666667,.8509803921568627,.3725490196078431,.00784313725490196,.4588235294117647,.4392156862745098,.7019607843137254,.9058823529411765,.1607843137254902,.5411764705882353,.4,.6509803921568628,.1176470588235294,.9019607843137255,.6705882352941176,.00784313725490196,.6509803921568628,.4627450980392157,.1137254901960784,.4,.4,.4],Name:"Brewer Qualitative Dark2",NanColor:[.4,.4,.4]},{IndexedColors:[.4,.7607843137254902,.6470588235294118,.9882352941176471,.5529411764705883,.3843137254901961,.5529411764705883,.6274509803921569,.796078431372549,.9058823529411765,.5411764705882353,.7647058823529411,.6509803921568628,.8470588235294118,.3294117647058823,1,.8509803921568627,.1843137254901961,.8980392156862745,.7686274509803922,.5803921568627451,.7019607843137254,.7019607843137254,.7019607843137254],Name:"Brewer Qualitative Set2",NanColor:[.7019607843137254,.7019607843137254,.7019607843137254]},{IndexedColors:[.7019607843137254,.8862745098039215,.803921568627451,.9921568627450981,.803921568627451,.6745098039215687,.796078431372549,.8352941176470589,.9098039215686274,.9568627450980393,.792156862745098,.8941176470588236,.9019607843137255,.9607843137254902,.788235294117647,1,.9490196078431372,.6823529411764706,.9450980392156862,.8862745098039215,.8,.8,.8,.8],Name:"Brewer Qualitative Pastel2",NanColor:[.8,.8,.8]},{IndexedColors:[.984313725490196,.7058823529411765,.6823529411764706,.7019607843137254,.803921568627451,.8901960784313725,.8,.9215686274509803,.7725490196078432,.8705882352941177,.796078431372549,.8941176470588236,.996078431372549,.8509803921568627,.6509803921568628,1,1,.8,.8980392156862745,.8470588235294118,.7411764705882353,.9921568627450981,.8549019607843137,.9254901960784314,.9490196078431372,.9490196078431372,.9490196078431372],Name:"Brewer Qualitative Pastel1",NanColor:[.9490196078431372,.9490196078431372,.9490196078431372]},{IndexedColors:[.8941176470588236,.1019607843137255,.1098039215686274,.2156862745098039,.4941176470588236,.7215686274509804,.3019607843137255,.6862745098039216,.2901960784313726,.596078431372549,.3058823529411765,.6392156862745098,1,.4980392156862745,0,1,1,.2,.6509803921568628,.3372549019607843,.1568627450980392,.9686274509803922,.5058823529411764,.7490196078431373,.6,.6,.6],Name:"Brewer Qualitative Set1",NanColor:[.6,.6,.6]},{IndexedColors:[.6509803921568628,.807843137254902,.8901960784313725,.1215686274509804,.4705882352941176,.7058823529411765,.6980392156862745,.8745098039215686,.5411764705882353,.2,.6274509803921569,.1725490196078431,.984313725490196,.6039215686274509,.6,.8901960784313725,.1019607843137255,.1098039215686274,.9921568627450981,.7490196078431373,.4352941176470588,1,.4980392156862745,0,.792156862745098,.6980392156862745,.8392156862745098,.4156862745098039,.2392156862745098,.6039215686274509,1,1,.6],Name:"Brewer Qualitative Paired",NanColor:[1,1,.6]},{IndexedColors:[.5529411764705883,.8274509803921568,.7803921568627451,1,1,.7019607843137254,.7450980392156863,.7294117647058823,.8549019607843137,.984313725490196,.5019607843137255,.4470588235294118,.5019607843137255,.6941176470588235,.8274509803921568,.9921568627450981,.7058823529411765,.3843137254901961,.7019607843137254,.8705882352941177,.4117647058823529,.9882352941176471,.803921568627451,.8980392156862745,.8509803921568627,.8509803921568627,.8509803921568627,.7372549019607844,.5019607843137255,.7411764705882353,.8,.9215686274509803,.7725490196078432,1,.9294117647058824,.4352941176470588],Name:"Brewer Qualitative Set3",NanColor:[1,.9294117647058824,.4352941176470588]},{IndexedColors:[1,0,0,1,.862745,0,0,.695201,0],Name:"Traffic Lights",NanColor:[.803922,0,.803922]},{IndexedColors:[.908659,.604013,.581857,1,.862745,0,0,.695201,0],Name:"Traffic Lights For Deuteranopes",NanColor:[.803922,0,.803922]},{IndexedColors:[.4196078431372549,0,.07058823529411765,.9019607843137255,.9411764705882353,.0196078431372549,.01568627450980392,.6196078431372549,.00784313725490196],Name:"Traffic Lights For Deuteranopes 2",NanColor:[.803922,0,.803922]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Muted Blue-Green",NanColor:[.25,0,0],RGBPoints:[0,.109804,.27451,.301961,.02,.129412,.309804,.341176,.05,.14902,.341176,.380392,.1,.188235,.403922,.458824,.15,.227451,.447059,.521569,.2,.290196,.494118,.588235,.25,.368627,.552941,.670588,.3,.458824,.619608,.74902,.35,.588235,.713725,.85098,.4,.72549,.815686,.941176,.45,.831373,.882353,.980392,.475,.909804,.933333,1,.5,.980392,.984314,1,.5,.996078,1,.94902,.5,1,1,.980392,.5,.980392,.984314,1,.525,.972549,.988235,.890196,.55,.917647,.960784,.835294,.6,.835294,.921569,.772549,.65,.768627,.901961,.737255,.7,.670588,.831373,.654902,.75,.576471,.760784,.584314,.8,.498039,.678431,.521569,.85,.392157,.560784,.427451,.9,.294118,.45098,.333333,.95,.211765,.34902,.254902,1,.152941,.278431,.196078]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Green-Blue Asymmetric Divergent (62Blbc)",NanColor:[.25,0,0],RGBPoints:[0,.121569,.2,.145098,.05,.196078,.301961,.223529,.1,.258824,.4,.278431,.2,.341176,.54902,.341176,.25,.419608,.619608,.376471,.3,.545098,.701961,.392157,.35,.643137,.780392,.403922,.4,.729412,.819608,.45098,.45,.811765,.870588,.521569,.5,.898039,.909804,.564706,.55,.941176,.92549,.686275,.6,.960784,.94902,.776471,.64,1,1,1,.65,.890196,.988235,.972549,.7,.721569,.894118,.901961,.75,.631373,.823529,.839216,.8,.517647,.662745,.701961,.85,.384314,.494118,.54902,.9,.298039,.360784,.45098,.95,.223529,.25098,.34902,.99,.156863,.172549,.25098,1,.137255,.137255,.188235]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Asymmtrical Earth Tones (6_21b)",NanColor:[.25,0,0],RGBPoints:[0,.141176,.14902,.2,.05,.215686,.258824,.321569,.1,.243137,.368627,.380392,.15,.27451,.439216,.4,.2,.32549,.501961,.384314,.25,.403922,.6,.419608,.3,.486275,.701961,.454902,.35,.556863,.74902,.494118,.4,.670588,.8,.545098,.5,.854902,.901961,.631373,.55,.92549,.941176,.694118,.6,.960784,.94902,.776471,.65,.988235,.968627,.909804,.7,.839216,.815686,.772549,.75,.701961,.662745,.615686,.8,.6,.529412,.478431,.85,.501961,.403922,.360784,.9,.439216,.313725,.290196,1,.301961,.164706,.176471]},{ColorSpace:"Lab",Creator:"Francesca Samsel",Name:"Yellow 15",NanColor:[.25,0,0],RGBPoints:[0,1,1,.988235,.002,1,1,.988235,.05,.984314,.988235,.843137,.1,.988235,.988235,.741176,.15,.980392,.968627,.654902,.2,.980392,.945098,.576471,.25,.968627,.905882,.486275,.3,.968627,.862745,.388235,.35,.960784,.803922,.286275,.4,.94902,.741176,.219608,.45,.941176,.678431,.14902,.5,.929412,.607843,.094118,.55,.921569,.545098,.054902,.6,.909804,.486275,.035294,.65,.890196,.411765,.019608,.7,.8,.305882,0,.75,.760784,.239216,0,.8,.678431,.180392,.011765,.85,.6,.121569,.023529,.9,.501961,.054902,.031373,.95,.4,.039216,.058824,1,.301961,.047059,.090196]},{ColorSpace:"Diverging",Name:"Magma (matplotlib)",NanColor:[0,1,0],Source:"https://github.com/BIDS/colormap/blob/master/colormaps.py",License:"CC0",Creator:"Nathaniel J. Smith & Stefan van der Walt",RGBPoints:[0,.001462,466e-6,.013866,.003922,.002258,.001295,.018331,.007843,.003279,.002305,.023708,.011765,.004512,.00349,.029965,.015686,.00595,.004843,.03713,.019608,.007588,.006356,.044973,.023529,.009426,.008022,.052844,.027451,.011465,.009828,.06075,.031373,.013708,.011771,.068667,.035294,.016156,.01384,.076603,.039216,.018815,.016026,.084584,.043137,.021692,.01832,.09261,.047059,.024792,.020715,.100676,.05098,.028123,.023201,.108787,.054902,.031696,.025765,.116965,.058824,.03552,.028397,.125209,.062745,.039608,.03109,.133515,.066667,.04383,.03383,.141886,.070588,.048062,.036607,.150327,.07451,.05232,.039407,.158841,.078431,.056615,.04216,.167446,.082353,.060949,.044794,.176129,.086275,.06533,.047318,.184892,.090196,.069764,.049726,.193735,.094118,.074257,.052017,.20266,.098039,.078815,.054184,.211667,.101961,.083446,.056225,.220755,.105882,.088155,.058133,.229922,.109804,.092949,.059904,.239164,.113725,.097833,.061531,.248477,.117647,.102815,.06301,.257854,.121569,.107899,.064335,.267289,.12549,.113094,.065492,.276784,.129412,.118405,.066479,.286321,.133333,.123833,.067295,.295879,.137255,.12938,.067935,.305443,.141176,.135053,.068391,.315,.145098,.140858,.068654,.324538,.14902,.146785,.068738,.334011,.152941,.152839,.068637,.343404,.156863,.159018,.068354,.352688,.160784,.165308,.067911,.361816,.164706,.171713,.067305,.370771,.168627,.178212,.066576,.379497,.172549,.184801,.065732,.387973,.176471,.19146,.064818,.396152,.180392,.198177,.063862,.404009,.184314,.204935,.062907,.411514,.188235,.211718,.061992,.418647,.192157,.218512,.061158,.425392,.196078,.225302,.060445,.431742,.2,.232077,.059889,.437695,.203922,.238826,.059517,.443256,.207843,.245543,.059352,.448436,.211765,.25222,.059415,.453248,.215686,.258857,.059706,.45771,.219608,.265447,.060237,.46184,.223529,.271994,.060994,.46566,.227451,.278493,.061978,.46919,.231373,.284951,.063168,.472451,.235294,.291366,.064553,.475462,.239216,.29774,.066117,.478243,.243137,.304081,.067835,.480812,.247059,.310382,.069702,.483186,.25098,.316654,.07169,.48538,.254902,.322899,.073782,.487408,.258824,.329114,.075972,.489287,.262745,.335308,.078236,.491024,.266667,.341482,.080564,.492631,.270588,.347636,.082946,.494121,.27451,.353773,.085373,.495501,.278431,.359898,.087831,.496778,.282353,.366012,.090314,.49796,.286275,.372116,.092816,.499053,.290196,.378211,.095332,.500067,.294118,.384299,.097855,.501002,.298039,.390384,.100379,.501864,.301961,.396467,.102902,.502658,.305882,.402548,.10542,.503386,.309804,.408629,.10793,.504052,.313725,.414709,.110431,.504662,.317647,.420791,.11292,.505215,.321569,.426877,.115395,.505714,.32549,.432967,.117855,.50616,.329412,.439062,.120298,.506555,.333333,.445163,.122724,.506901,.337255,.451271,.125132,.507198,.341176,.457386,.127522,.507448,.345098,.463508,.129893,.507652,.34902,.46964,.132245,.507809,.352941,.47578,.134577,.507921,.356863,.481929,.136891,.507989,.360784,.488088,.139186,.508011,.364706,.494258,.141462,.507988,.368627,.500438,.143719,.50792,.372549,.506629,.145958,.507806,.376471,.512831,.148179,.507648,.380392,.519045,.150383,.507443,.384314,.52527,.152569,.507192,.388235,.531507,.154739,.506895,.392157,.537755,.156894,.506551,.396078,.544015,.159033,.506159,.4,.550287,.161158,.505719,.403922,.556571,.163269,.50523,.407843,.562866,.165368,.504692,.411765,.569172,.167454,.504105,.415686,.57549,.16953,.503466,.419608,.581819,.171596,.502777,.423529,.588158,.173652,.502035,.427451,.594508,.175701,.501241,.431373,.600868,.177743,.500394,.435294,.607238,.179779,.499492,.439216,.613617,.181811,.498536,.443137,.620005,.18384,.497524,.447059,.626401,.185867,.496456,.45098,.632805,.187893,.495332,.454902,.639216,.189921,.49415,.458824,.645633,.191952,.49291,.462745,.652056,.193986,.491611,.466667,.658483,.196027,.490253,.470588,.664915,.198075,.488836,.47451,.671349,.200133,.487358,.478431,.677786,.202203,.485819,.482353,.684224,.204286,.484219,.486275,.690661,.206384,.482558,.490196,.697098,.208501,.480835,.494118,.703532,.210638,.479049,.498039,.709962,.212797,.477201,.501961,.716387,.214982,.47529,.505882,.722805,.217194,.473316,.509804,.729216,.219437,.471279,.513725,.735616,.221713,.46918,.517647,.742004,.224025,.467018,.521569,.748378,.226377,.464794,.52549,.754737,.228772,.462509,.529412,.761077,.231214,.460162,.533333,.767398,.233705,.457755,.537255,.773695,.236249,.455289,.541176,.779968,.238851,.452765,.545098,.786212,.241514,.450184,.54902,.792427,.244242,.447543,.552941,.798608,.24704,.444848,.556863,.804752,.249911,.442102,.560784,.810855,.252861,.439305,.564706,.816914,.255895,.436461,.568627,.822926,.259016,.433573,.572549,.828886,.262229,.430644,.576471,.834791,.26554,.427671,.580392,.840636,.268953,.424666,.584314,.846416,.272473,.421631,.588235,.852126,.276106,.418573,.592157,.857763,.279857,.415496,.596078,.86332,.283729,.412403,.6,.868793,.287728,.409303,.603922,.874176,.291859,.406205,.607843,.879464,.296125,.403118,.611765,.884651,.30053,.400047,.615686,.889731,.305079,.397002,.619608,.8947,.309773,.393995,.623529,.899552,.314616,.391037,.627451,.904281,.31961,.388137,.631373,.908884,.324755,.385308,.635294,.913354,.330052,.382563,.639216,.917689,.3355,.379915,.643137,.921884,.341098,.377376,.647059,.925937,.346844,.374959,.65098,.929845,.352734,.372677,.654902,.933606,.358764,.370541,.658824,.937221,.364929,.368567,.662745,.940687,.371224,.366762,.666667,.944006,.377643,.365136,.670588,.94718,.384178,.363701,.67451,.95021,.39082,.362468,.678431,.953099,.397563,.361438,.682353,.955849,.4044,.360619,.686275,.958464,.411324,.360014,.690196,.960949,.418323,.35963,.694118,.96331,.42539,.359469,.698039,.965549,.432519,.359529,.701961,.967671,.439703,.35981,.705882,.96968,.446936,.360311,.709804,.971582,.45421,.36103,.713725,.973381,.46152,.361965,.717647,.975082,.468861,.363111,.721569,.97669,.476226,.364466,.72549,.97821,.483612,.366025,.729412,.979645,.491014,.367783,.733333,.981,.498428,.369734,.737255,.982279,.505851,.371874,.741176,.983485,.51328,.374198,.745098,.984622,.520713,.376698,.74902,.985693,.528148,.379371,.752941,.9867,.535582,.38221,.756863,.987646,.543015,.38521,.760784,.988533,.550446,.388365,.764706,.989363,.557873,.391671,.768627,.990138,.565296,.395122,.772549,.990871,.572706,.398714,.776471,.991558,.580107,.402441,.780392,.992196,.587502,.406299,.784314,.992785,.594891,.410283,.788235,.993326,.602275,.41439,.792157,.993834,.609644,.418613,.796078,.994309,.616999,.42295,.8,.994738,.62435,.427397,.803922,.995122,.631696,.431951,.807843,.99548,.639027,.436607,.811765,.99581,.646344,.441361,.815686,.996096,.653659,.446213,.819608,.996341,.660969,.45116,.823529,.99658,.668256,.456192,.827451,.996775,.675541,.461314,.831373,.996925,.682828,.466526,.835294,.997077,.690088,.471811,.839216,.997186,.697349,.477182,.843137,.997254,.704611,.482635,.847059,.997325,.711848,.488154,.85098,.997351,.719089,.493755,.854902,.997351,.726324,.499428,.858824,.997341,.733545,.505167,.862745,.997285,.740772,.510983,.866667,.997228,.747981,.516859,.870588,.997138,.75519,.522806,.87451,.997019,.762398,.528821,.878431,.996898,.769591,.534892,.882353,.996727,.776795,.541039,.886275,.996571,.783977,.547233,.890196,.996369,.791167,.553499,.894118,.996162,.798348,.55982,.898039,.995932,.805527,.566202,.901961,.99568,.812706,.572645,.905882,.995424,.819875,.57914,.909804,.995131,.827052,.585701,.913725,.994851,.834213,.592307,.917647,.994524,.841387,.598983,.921569,.994222,.84854,.605696,.92549,.993866,.855711,.612482,.929412,.993545,.862859,.619299,.933333,.99317,.870024,.626189,.937255,.992831,.877168,.633109,.941176,.99244,.88433,.640099,.945098,.992089,.89147,.647116,.94902,.991688,.898627,.654202,.952941,.991332,.905763,.661309,.956863,.99093,.912915,.668481,.960784,.99057,.920049,.675675,.964706,.990175,.927196,.682926,.968627,.989815,.934329,.690198,.972549,.989434,.94147,.697519,.976471,.989077,.948604,.704863,.980392,.988717,.955742,.712242,.984314,.988367,.962878,.719649,.988235,.988033,.970012,.727077,.992157,.987691,.977154,.734536,.996078,.987387,.984288,.742002,1,.987053,.991438,.749504]},{ColorSpace:"Diverging",Name:"Inferno (matplotlib)",NanColor:[0,1,0],Source:"https://github.com/BIDS/colormap/blob/master/colormaps.py",License:"CC0",Creator:"Nathaniel J. Smith & Stefan van der Walt",RGBPoints:[0,.001462,466e-6,.013866,.003922,.002267,.00127,.01857,.007843,.003299,.002249,.024239,.011765,.004547,.003392,.030909,.015686,.006006,.004692,.038558,.019608,.007676,.006136,.046836,.023529,.009561,.007713,.055143,.027451,.011663,.009417,.06346,.031373,.013995,.011225,.071862,.035294,.016561,.013136,.080282,.039216,.019373,.015133,.088767,.043137,.022447,.017199,.097327,.047059,.025793,.019331,.10593,.05098,.029432,.021503,.114621,.054902,.033385,.023702,.123397,.058824,.037668,.025921,.132232,.062745,.042253,.028139,.141141,.066667,.046915,.030324,.150164,.070588,.051644,.032474,.159254,.07451,.056449,.034569,.168414,.078431,.06134,.03659,.177642,.082353,.066331,.038504,.186962,.086275,.071429,.040294,.196354,.090196,.076637,.041905,.205799,.094118,.081962,.043328,.215289,.098039,.087411,.044556,.224813,.101961,.09299,.045583,.234358,.105882,.098702,.046402,.243904,.109804,.104551,.047008,.25343,.113725,.110536,.047399,.262912,.117647,.116656,.047574,.272321,.121569,.122908,.047536,.281624,.12549,.129285,.047293,.290788,.129412,.135778,.046856,.299776,.133333,.142378,.046242,.308553,.137255,.149073,.045468,.317085,.141176,.15585,.044559,.325338,.145098,.162689,.043554,.333277,.14902,.169575,.042489,.340874,.152941,.176493,.041402,.348111,.156863,.183429,.040329,.354971,.160784,.190367,.039309,.361447,.164706,.197297,.0384,.367535,.168627,.204209,.037632,.373238,.172549,.211095,.03703,.378563,.176471,.217949,.036615,.383522,.180392,.224763,.036405,.388129,.184314,.231538,.036405,.3924,.188235,.238273,.036621,.396353,.192157,.244967,.037055,.400007,.196078,.25162,.037705,.403378,.2,.258234,.038571,.406485,.203922,.26481,.039647,.409345,.207843,.271347,.040922,.411976,.211765,.27785,.042353,.414392,.215686,.284321,.043933,.416608,.219608,.290763,.045644,.418637,.223529,.297178,.04747,.420491,.227451,.303568,.049396,.422182,.231373,.309935,.051407,.423721,.235294,.316282,.05349,.425116,.239216,.32261,.055634,.426377,.243137,.328921,.057827,.427511,.247059,.335217,.06006,.428524,.25098,.3415,.062325,.429425,.254902,.347771,.064616,.430217,.258824,.354032,.066925,.430906,.262745,.360284,.069247,.431497,.266667,.366529,.071579,.431994,.270588,.372768,.073915,.4324,.27451,.379001,.076253,.432719,.278431,.385228,.078591,.432955,.282353,.391453,.080927,.433109,.286275,.397674,.083257,.433183,.290196,.403894,.08558,.433179,.294118,.410113,.087896,.433098,.298039,.416331,.090203,.432943,.301961,.422549,.092501,.432714,.305882,.428768,.09479,.432412,.309804,.434987,.097069,.432039,.313725,.441207,.099338,.431594,.317647,.447428,.101597,.43108,.321569,.453651,.103848,.430498,.32549,.459875,.106089,.429846,.329412,.4661,.108322,.429125,.333333,.472328,.110547,.428334,.337255,.478558,.112764,.427475,.341176,.484789,.114974,.426548,.345098,.491022,.117179,.425552,.34902,.497257,.119379,.424488,.352941,.503493,.121575,.423356,.356863,.50973,.123769,.422156,.360784,.515967,.12596,.420887,.364706,.522206,.12815,.419549,.368627,.528444,.130341,.418142,.372549,.534683,.132534,.416667,.376471,.54092,.134729,.415123,.380392,.547157,.136929,.413511,.384314,.553392,.139134,.411829,.388235,.559624,.141346,.410078,.392157,.565854,.143567,.408258,.396078,.572081,.145797,.406369,.4,.578304,.148039,.404411,.403922,.584521,.150294,.402385,.407843,.590734,.152563,.40029,.411765,.59694,.154848,.398125,.415686,.603139,.157151,.395891,.419608,.60933,.159474,.393589,.423529,.615513,.161817,.391219,.427451,.621685,.164184,.388781,.431373,.627847,.166575,.386276,.435294,.633998,.168992,.383704,.439216,.640135,.171438,.381065,.443137,.64626,.173914,.378359,.447059,.652369,.176421,.375586,.45098,.658463,.178962,.372748,.454902,.66454,.181539,.369846,.458824,.670599,.184153,.366879,.462745,.676638,.186807,.363849,.466667,.682656,.189501,.360757,.470588,.688653,.192239,.357603,.47451,.694627,.195021,.354388,.478431,.700576,.197851,.351113,.482353,.7065,.200728,.347777,.486275,.712396,.203656,.344383,.490196,.718264,.206636,.340931,.494118,.724103,.20967,.337424,.498039,.729909,.212759,.333861,.501961,.735683,.215906,.330245,.505882,.741423,.219112,.326576,.509804,.747127,.222378,.322856,.513725,.752794,.225706,.319085,.517647,.758422,.229097,.315266,.521569,.76401,.232554,.311399,.52549,.769556,.236077,.307485,.529412,.775059,.239667,.303526,.533333,.780517,.243327,.299523,.537255,.785929,.247056,.295477,.541176,.791293,.250856,.29139,.545098,.796607,.254728,.287264,.54902,.801871,.258674,.283099,.552941,.807082,.262692,.278898,.556863,.812239,.266786,.274661,.560784,.817341,.270954,.27039,.564706,.822386,.275197,.266085,.568627,.827372,.279517,.26175,.572549,.832299,.283913,.257383,.576471,.837165,.288385,.252988,.580392,.841969,.292933,.248564,.584314,.846709,.297559,.244113,.588235,.851384,.30226,.239636,.592157,.855992,.307038,.235133,.596078,.860533,.311892,.230606,.6,.865006,.316822,.226055,.603922,.869409,.321827,.221482,.607843,.873741,.326906,.216886,.611765,.878001,.33206,.212268,.615686,.882188,.337287,.207628,.619608,.886302,.342586,.202968,.623529,.890341,.347957,.198286,.627451,.894305,.353399,.193584,.631373,.898192,.358911,.18886,.635294,.902003,.364492,.184116,.639216,.905735,.37014,.17935,.643137,.90939,.375856,.174563,.647059,.912966,.381636,.169755,.65098,.916462,.387481,.164924,.654902,.919879,.393389,.16007,.658824,.923215,.399359,.155193,.662745,.92647,.405389,.150292,.666667,.929644,.411479,.145367,.670588,.932737,.417627,.140417,.67451,.935747,.423831,.13544,.678431,.938675,.430091,.130438,.682353,.941521,.436405,.125409,.686275,.944285,.442772,.120354,.690196,.946965,.449191,.115272,.694118,.949562,.45566,.110164,.698039,.952075,.462178,.105031,.701961,.954506,.468744,.099874,.705882,.956852,.475356,.094695,.709804,.959114,.482014,.089499,.713725,.961293,.488716,.084289,.717647,.963387,.495462,.079073,.721569,.965397,.502249,.073859,.72549,.967322,.509078,.068659,.729412,.969163,.515946,.063488,.733333,.970919,.522853,.058367,.737255,.97259,.529798,.053324,.741176,.974176,.53678,.048392,.745098,.975677,.543798,.043618,.74902,.977092,.55085,.03905,.752941,.978422,.557937,.034931,.756863,.979666,.565057,.031409,.760784,.980824,.572209,.028508,.764706,.981895,.579392,.02625,.768627,.982881,.586606,.024661,.772549,.983779,.593849,.02377,.776471,.984591,.601122,.023606,.780392,.985315,.608422,.024202,.784314,.985952,.61575,.025592,.788235,.986502,.623105,.027814,.792157,.986964,.630485,.030908,.796078,.987337,.63789,.034916,.8,.987622,.64532,.039886,.803922,.987819,.652773,.045581,.807843,.987926,.66025,.05175,.811765,.987945,.667748,.058329,.815686,.987874,.675267,.065257,.819608,.987714,.682807,.072489,.823529,.987464,.690366,.07999,.827451,.987124,.697944,.087731,.831373,.986694,.70554,.095694,.835294,.986175,.713153,.103863,.839216,.985566,.720782,.112229,.843137,.984865,.728427,.120785,.847059,.984075,.736087,.129527,.85098,.983196,.743758,.138453,.854902,.982228,.751442,.147565,.858824,.981173,.759135,.156863,.862745,.980032,.766837,.166353,.866667,.978806,.774545,.176037,.870588,.977497,.782258,.185923,.87451,.976108,.789974,.196018,.878431,.974638,.797692,.206332,.882353,.973088,.805409,.216877,.886275,.971468,.813122,.227658,.890196,.969783,.820825,.238686,.894118,.968041,.828515,.249972,.898039,.966243,.836191,.261534,.901961,.964394,.843848,.273391,.905882,.962517,.851476,.285546,.909804,.960626,.859069,.29801,.913725,.95872,.866624,.31082,.917647,.956834,.874129,.323974,.921569,.954997,.881569,.337475,.92549,.953215,.888942,.351369,.929412,.951546,.896226,.365627,.933333,.950018,.903409,.380271,.937255,.948683,.910473,.395289,.941176,.947594,.917399,.410665,.945098,.946809,.924168,.426373,.94902,.946392,.930761,.442367,.952941,.946403,.937159,.458592,.956863,.946903,.943348,.47497,.960784,.947937,.949318,.491426,.964706,.949545,.955063,.50786,.968627,.95174,.960587,.524203,.972549,.954529,.965896,.540361,.976471,.957896,.971003,.556275,.980392,.961812,.975924,.571925,.984314,.966249,.980678,.587206,.988235,.971162,.985282,.602154,.992157,.976511,.989753,.61676,.996078,.982257,.994109,.631017,1,.988362,.998364,.644924]},{ColorSpace:"Diverging",Name:"Plasma (matplotlib)",NanColor:[0,1,0],Source:"https://github.com/BIDS/colormap/blob/master/colormaps.py",License:"CC0",Creator:"Nathaniel J. Smith & Stefan van der Walt",RGBPoints:[0,.050383,.029803,.527975,.003922,.063536,.028426,.533124,.007843,.075353,.027206,.538007,.011765,.086222,.026125,.542658,.015686,.096379,.025165,.547103,.019608,.10598,.024309,.551368,.023529,.115124,.023556,.555468,.027451,.123903,.022878,.559423,.031373,.132381,.022258,.56325,.035294,.140603,.021687,.566959,.039216,.148607,.021154,.570562,.043137,.156421,.020651,.574065,.047059,.16407,.020171,.577478,.05098,.171574,.019706,.580806,.054902,.17895,.019252,.584054,.058824,.186213,.018803,.587228,.062745,.193374,.018354,.59033,.066667,.200445,.017902,.593364,.070588,.207435,.017442,.596333,.07451,.21435,.016973,.599239,.078431,.221197,.016497,.602083,.082353,.227983,.016007,.604867,.086275,.234715,.015502,.607592,.090196,.241396,.014979,.610259,.094118,.248032,.014439,.612868,.098039,.254627,.013882,.615419,.101961,.261183,.013308,.617911,.105882,.267703,.012716,.620346,.109804,.274191,.012109,.622722,.113725,.280648,.011488,.625038,.117647,.287076,.010855,.627295,.121569,.293478,.010213,.62949,.12549,.299855,.009561,.631624,.129412,.30621,.008902,.633694,.133333,.312543,.008239,.6357,.137255,.318856,.007576,.63764,.141176,.32515,.006915,.639512,.145098,.331426,.006261,.641316,.14902,.337683,.005618,.643049,.152941,.343925,.004991,.64471,.156863,.35015,.004382,.646298,.160784,.356359,.003798,.64781,.164706,.362553,.003243,.649245,.168627,.368733,.002724,.650601,.172549,.374897,.002245,.651876,.176471,.381047,.001814,.653068,.180392,.387183,.001434,.654177,.184314,.393304,.001114,.655199,.188235,.399411,859e-6,.656133,.192157,.405503,678e-6,.656977,.196078,.41158,577e-6,.65773,.2,.417642,564e-6,.65839,.203922,.423689,646e-6,.658956,.207843,.429719,831e-6,.659425,.211765,.435734,.001127,.659797,.215686,.441732,.00154,.660069,.219608,.447714,.00208,.66024,.223529,.453677,.002755,.66031,.227451,.459623,.003574,.660277,.231373,.46555,.004545,.660139,.235294,.471457,.005678,.659897,.239216,.477344,.00698,.659549,.243137,.48321,.00846,.659095,.247059,.489055,.010127,.658534,.25098,.494877,.01199,.657865,.254902,.500678,.014055,.657088,.258824,.506454,.016333,.656202,.262745,.512206,.018833,.655209,.266667,.517933,.021563,.654109,.270588,.523633,.024532,.652901,.27451,.529306,.027747,.651586,.278431,.534952,.031217,.650165,.282353,.54057,.03495,.64864,.286275,.546157,.038954,.64701,.290196,.551715,.043136,.645277,.294118,.557243,.047331,.643443,.298039,.562738,.051545,.641509,.301961,.568201,.055778,.639477,.305882,.573632,.060028,.637349,.309804,.579029,.064296,.635126,.313725,.584391,.068579,.632812,.317647,.589719,.072878,.630408,.321569,.595011,.07719,.627917,.32549,.600266,.081516,.625342,.329412,.605485,.085854,.622686,.333333,.610667,.090204,.619951,.337255,.615812,.094564,.61714,.341176,.620919,.098934,.614257,.345098,.625987,.103312,.611305,.34902,.631017,.107699,.608287,.352941,.636008,.112092,.605205,.356863,.640959,.116492,.602065,.360784,.645872,.120898,.598867,.364706,.650746,.125309,.595617,.368627,.65558,.129725,.592317,.372549,.660374,.134144,.588971,.376471,.665129,.138566,.585582,.380392,.669845,.142992,.582154,.384314,.674522,.147419,.578688,.388235,.67916,.151848,.575189,.392157,.683758,.156278,.57166,.396078,.688318,.160709,.568103,.4,.69284,.165141,.564522,.403922,.697324,.169573,.560919,.407843,.701769,.174005,.557296,.411765,.706178,.178437,.553657,.415686,.710549,.182868,.550004,.419608,.714883,.187299,.546338,.423529,.719181,.191729,.542663,.427451,.723444,.196158,.538981,.431373,.72767,.200586,.535293,.435294,.731862,.205013,.531601,.439216,.736019,.209439,.527908,.443137,.740143,.213864,.524216,.447059,.744232,.218288,.520524,.45098,.748289,.222711,.516834,.454902,.752312,.227133,.513149,.458824,.756304,.231555,.509468,.462745,.760264,.235976,.505794,.466667,.764193,.240396,.502126,.470588,.76809,.244817,.498465,.47451,.771958,.249237,.494813,.478431,.775796,.253658,.491171,.482353,.779604,.258078,.487539,.486275,.783383,.2625,.483918,.490196,.787133,.266922,.480307,.494118,.790855,.271345,.476706,.498039,.794549,.27577,.473117,.501961,.798216,.280197,.469538,.505882,.801855,.284626,.465971,.509804,.805467,.289057,.462415,.513725,.809052,.293491,.45887,.517647,.812612,.297928,.455338,.521569,.816144,.302368,.451816,.52549,.819651,.306812,.448306,.529412,.823132,.311261,.444806,.533333,.826588,.315714,.441316,.537255,.830018,.320172,.437836,.541176,.833422,.324635,.434366,.545098,.836801,.329105,.430905,.54902,.840155,.33358,.427455,.552941,.843484,.338062,.424013,.556863,.846788,.342551,.420579,.560784,.850066,.347048,.417153,.564706,.853319,.351553,.413734,.568627,.856547,.356066,.410322,.572549,.85975,.360588,.406917,.576471,.862927,.365119,.403519,.580392,.866078,.36966,.400126,.584314,.869203,.374212,.396738,.588235,.872303,.378774,.393355,.592157,.875376,.383347,.389976,.596078,.878423,.387932,.3866,.6,.881443,.392529,.383229,.603922,.884436,.397139,.37986,.607843,.887402,.401762,.376494,.611765,.89034,.406398,.37313,.615686,.89325,.411048,.369768,.619608,.896131,.415712,.366407,.623529,.898984,.420392,.363047,.627451,.901807,.425087,.359688,.631373,.904601,.429797,.356329,.635294,.907365,.434524,.35297,.639216,.910098,.439268,.34961,.643137,.9128,.444029,.346251,.647059,.915471,.448807,.34289,.65098,.918109,.453603,.339529,.654902,.920714,.458417,.336166,.658824,.923287,.463251,.332801,.662745,.925825,.468103,.329435,.666667,.928329,.472975,.326067,.670588,.930798,.477867,.322697,.67451,.933232,.48278,.319325,.678431,.93563,.487712,.315952,.682353,.93799,.492667,.312575,.686275,.940313,.497642,.309197,.690196,.942598,.502639,.305816,.694118,.944844,.507658,.302433,.698039,.947051,.512699,.299049,.701961,.949217,.517763,.295662,.705882,.951344,.52285,.292275,.709804,.953428,.52796,.288883,.713725,.95547,.533093,.28549,.717647,.957469,.53825,.282096,.721569,.959424,.543431,.278701,.72549,.961336,.548636,.275305,.729412,.963203,.553865,.271909,.733333,.965024,.559118,.268513,.737255,.966798,.564396,.265118,.741176,.968526,.5697,.261721,.745098,.970205,.575028,.258325,.74902,.971835,.580382,.254931,.752941,.973416,.585761,.25154,.756863,.974947,.591165,.248151,.760784,.976428,.596595,.244767,.764706,.977856,.602051,.241387,.768627,.979233,.607532,.238013,.772549,.980556,.613039,.234646,.776471,.981826,.618572,.231287,.780392,.983041,.624131,.227937,.784314,.984199,.629718,.224595,.788235,.985301,.63533,.221265,.792157,.986345,.640969,.217948,.796078,.987332,.646633,.214648,.8,.98826,.652325,.211364,.803922,.989128,.658043,.2081,.807843,.989935,.663787,.204859,.811765,.990681,.669558,.201642,.815686,.991365,.675355,.198453,.819608,.991985,.681179,.195295,.823529,.992541,.68703,.19217,.827451,.993032,.692907,.189084,.831373,.993456,.69881,.186041,.835294,.993814,.704741,.183043,.839216,.994103,.710698,.180097,.843137,.994324,.716681,.177208,.847059,.994474,.722691,.174381,.85098,.994553,.728728,.171622,.854902,.994561,.734791,.168938,.858824,.994495,.74088,.166335,.862745,.994355,.746995,.163821,.866667,.994141,.753137,.161404,.870588,.993851,.759304,.159092,.87451,.993482,.765499,.156891,.878431,.993033,.77172,.154808,.882353,.992505,.777967,.152855,.886275,.991897,.784239,.151042,.890196,.991209,.790537,.149377,.894118,.990439,.796859,.14787,.898039,.989587,.803205,.146529,.901961,.988648,.809579,.145357,.905882,.987621,.815978,.144363,.909804,.986509,.822401,.143557,.913725,.985314,.828846,.142945,.917647,.984031,.835315,.142528,.921569,.982653,.841812,.142303,.92549,.98119,.848329,.142279,.929412,.979644,.854866,.142453,.933333,.977995,.861432,.142808,.937255,.976265,.868016,.143351,.941176,.974443,.874622,.144061,.945098,.97253,.88125,.144923,.94902,.970533,.887896,.145919,.952941,.968443,.894564,.147014,.956863,.966271,.901249,.14818,.960784,.964021,.90795,.14937,.964706,.961681,.914672,.15052,.968627,.959276,.921407,.151566,.972549,.956808,.928152,.152409,.976471,.954287,.934908,.152921,.980392,.951726,.941671,.152925,.984314,.949151,.948435,.152178,.988235,.946602,.95519,.150328,.992157,.944152,.961916,.146861,.996078,.941896,.96859,.140956,1,.940015,.975158,.131326]},{ColorSpace:"Diverging",Name:"Viridis (matplotlib)",NanColor:[1,0,0],Source:"https://github.com/BIDS/colormap/blob/master/colormaps.py",License:"CC0",Creator:"Eric Firing",RGBPoints:[0,.267004,.004874,.329415,.003922,.26851,.009605,.335427,.007843,.269944,.014625,.341379,.011765,.271305,.019942,.347269,.015686,.272594,.025563,.353093,.019608,.273809,.031497,.358853,.023529,.274952,.037752,.364543,.027451,.276022,.044167,.370164,.031373,.277018,.050344,.375715,.035294,.277941,.056324,.381191,.039216,.278791,.062145,.386592,.043137,.279566,.067836,.391917,.047059,.280267,.073417,.397163,.05098,.280894,.078907,.402329,.054902,.281446,.08432,.407414,.058824,.281924,.089666,.412415,.062745,.282327,.094955,.417331,.066667,.282656,.100196,.42216,.070588,.28291,.105393,.426902,.07451,.283091,.110553,.431554,.078431,.283197,.11568,.436115,.082353,.283229,.120777,.440584,.086275,.283187,.125848,.44496,.090196,.283072,.130895,.449241,.094118,.282884,.13592,.453427,.098039,.282623,.140926,.457517,.101961,.28229,.145912,.46151,.105882,.281887,.150881,.465405,.109804,.281412,.155834,.469201,.113725,.280868,.160771,.472899,.117647,.280255,.165693,.476498,.121569,.279574,.170599,.479997,.12549,.278826,.17549,.483397,.129412,.278012,.180367,.486697,.133333,.277134,.185228,.489898,.137255,.276194,.190074,.493001,.141176,.275191,.194905,.496005,.145098,.274128,.199721,.498911,.14902,.273006,.20452,.501721,.152941,.271828,.209303,.504434,.156863,.270595,.214069,.507052,.160784,.269308,.218818,.509577,.164706,.267968,.223549,.512008,.168627,.26658,.228262,.514349,.172549,.265145,.232956,.516599,.176471,.263663,.237631,.518762,.180392,.262138,.242286,.520837,.184314,.260571,.246922,.522828,.188235,.258965,.251537,.524736,.192157,.257322,.25613,.526563,.196078,.255645,.260703,.528312,.2,.253935,.265254,.529983,.203922,.252194,.269783,.531579,.207843,.250425,.27429,.533103,.211765,.248629,.278775,.534556,.215686,.246811,.283237,.535941,.219608,.244972,.287675,.53726,.223529,.243113,.292092,.538516,.227451,.241237,.296485,.539709,.231373,.239346,.300855,.540844,.235294,.237441,.305202,.541921,.239216,.235526,.309527,.542944,.243137,.233603,.313828,.543914,.247059,.231674,.318106,.544834,.25098,.229739,.322361,.545706,.254902,.227802,.326594,.546532,.258824,.225863,.330805,.547314,.262745,.223925,.334994,.548053,.266667,.221989,.339161,.548752,.270588,.220057,.343307,.549413,.27451,.21813,.347432,.550038,.278431,.21621,.351535,.550627,.282353,.214298,.355619,.551184,.286275,.212395,.359683,.55171,.290196,.210503,.363727,.552206,.294118,.208623,.367752,.552675,.298039,.206756,.371758,.553117,.301961,.204903,.375746,.553533,.305882,.203063,.379716,.553925,.309804,.201239,.38367,.554294,.313725,.19943,.387607,.554642,.317647,.197636,.391528,.554969,.321569,.19586,.395433,.555276,.32549,.1941,.399323,.555565,.329412,.192357,.403199,.555836,.333333,.190631,.407061,.556089,.337255,.188923,.41091,.556326,.341176,.187231,.414746,.556547,.345098,.185556,.41857,.556753,.34902,.183898,.422383,.556944,.352941,.182256,.426184,.55712,.356863,.180629,.429975,.557282,.360784,.179019,.433756,.55743,.364706,.177423,.437527,.557565,.368627,.175841,.44129,.557685,.372549,.174274,.445044,.557792,.376471,.172719,.448791,.557885,.380392,.171176,.45253,.557965,.384314,.169646,.456262,.55803,.388235,.168126,.459988,.558082,.392157,.166617,.463708,.558119,.396078,.165117,.467423,.558141,.4,.163625,.471133,.558148,.403922,.162142,.474838,.55814,.407843,.160665,.47854,.558115,.411765,.159194,.482237,.558073,.415686,.157729,.485932,.558013,.419608,.15627,.489624,.557936,.423529,.154815,.493313,.55784,.427451,.153364,.497,.557724,.431373,.151918,.500685,.557587,.435294,.150476,.504369,.55743,.439216,.149039,.508051,.55725,.443137,.147607,.511733,.557049,.447059,.14618,.515413,.556823,.45098,.144759,.519093,.556572,.454902,.143343,.522773,.556295,.458824,.141935,.526453,.555991,.462745,.140536,.530132,.555659,.466667,.139147,.533812,.555298,.470588,.13777,.537492,.554906,.47451,.136408,.541173,.554483,.478431,.135066,.544853,.554029,.482353,.133743,.548535,.553541,.486275,.132444,.552216,.553018,.490196,.131172,.555899,.552459,.494118,.129933,.559582,.551864,.498039,.128729,.563265,.551229,.501961,.127568,.566949,.550556,.505882,.126453,.570633,.549841,.509804,.125394,.574318,.549086,.513725,.124395,.578002,.548287,.517647,.123463,.581687,.547445,.521569,.122606,.585371,.546557,.52549,.121831,.589055,.545623,.529412,.121148,.592739,.544641,.533333,.120565,.596422,.543611,.537255,.120092,.600104,.54253,.541176,.119738,.603785,.5414,.545098,.119512,.607464,.540218,.54902,.119423,.611141,.538982,.552941,.119483,.614817,.537692,.556863,.119699,.61849,.536347,.560784,.120081,.622161,.534946,.564706,.120638,.625828,.533488,.568627,.12138,.629492,.531973,.572549,.122312,.633153,.530398,.576471,.123444,.636809,.528763,.580392,.12478,.640461,.527068,.584314,.126326,.644107,.525311,.588235,.128087,.647749,.523491,.592157,.130067,.651384,.521608,.596078,.132268,.655014,.519661,.6,.134692,.658636,.517649,.603922,.137339,.662252,.515571,.607843,.14021,.665859,.513427,.611765,.143303,.669459,.511215,.615686,.146616,.67305,.508936,.619608,.150148,.676631,.506589,.623529,.153894,.680203,.504172,.627451,.157851,.683765,.501686,.631373,.162016,.687316,.499129,.635294,.166383,.690856,.496502,.639216,.170948,.694384,.493803,.643137,.175707,.6979,.491033,.647059,.180653,.701402,.488189,.65098,.185783,.704891,.485273,.654902,.19109,.708366,.482284,.658824,.196571,.711827,.479221,.662745,.202219,.715272,.476084,.666667,.20803,.718701,.472873,.670588,.214,.722114,.469588,.67451,.220124,.725509,.466226,.678431,.226397,.728888,.462789,.682353,.232815,.732247,.459277,.686275,.239374,.735588,.455688,.690196,.24607,.73891,.452024,.694118,.252899,.742211,.448284,.698039,.259857,.745492,.444467,.701961,.266941,.748751,.440573,.705882,.274149,.751988,.436601,.709804,.281477,.755203,.432552,.713725,.288921,.758394,.428426,.717647,.296479,.761561,.424223,.721569,.304148,.764704,.419943,.72549,.311925,.767822,.415586,.729412,.319809,.770914,.411152,.733333,.327796,.77398,.40664,.737255,.335885,.777018,.402049,.741176,.344074,.780029,.397381,.745098,.35236,.783011,.392636,.74902,.360741,.785964,.387814,.752941,.369214,.788888,.382914,.756863,.377779,.791781,.377939,.760784,.386433,.794644,.372886,.764706,.395174,.797475,.367757,.768627,.404001,.800275,.362552,.772549,.412913,.803041,.357269,.776471,.421908,.805774,.35191,.780392,.430983,.808473,.346476,.784314,.440137,.811138,.340967,.788235,.449368,.813768,.335384,.792157,.458674,.816363,.329727,.796078,.468053,.818921,.323998,.8,.477504,.821444,.318195,.803922,.487026,.823929,.312321,.807843,.496615,.826376,.306377,.811765,.506271,.828786,.300362,.815686,.515992,.831158,.294279,.819608,.525776,.833491,.288127,.823529,.535621,.835785,.281908,.827451,.545524,.838039,.275626,.831373,.555484,.840254,.269281,.835294,.565498,.84243,.262877,.839216,.575563,.844566,.256415,.843137,.585678,.846661,.249897,.847059,.595839,.848717,.243329,.85098,.606045,.850733,.236712,.854902,.616293,.852709,.230052,.858824,.626579,.854645,.223353,.862745,.636902,.856542,.21662,.866667,.647257,.8584,.209861,.870588,.657642,.860219,.203082,.87451,.668054,.861999,.196293,.878431,.678489,.863742,.189503,.882353,.688944,.865448,.182725,.886275,.699415,.867117,.175971,.890196,.709898,.868751,.169257,.894118,.720391,.87035,.162603,.898039,.730889,.871916,.156029,.901961,.741388,.873449,.149561,.905882,.751884,.874951,.143228,.909804,.762373,.876424,.137064,.913725,.772852,.877868,.131109,.917647,.783315,.879285,.125405,.921569,.79376,.880678,.120005,.92549,.804182,.882046,.114965,.929412,.814576,.883393,.110347,.933333,.82494,.88472,.106217,.937255,.83527,.886029,.102646,.941176,.845561,.887322,.099702,.945098,.85581,.888601,.097452,.94902,.866013,.889868,.095953,.952941,.876168,.891125,.09525,.956863,.886271,.892374,.095374,.960784,.89632,.893616,.096335,.964706,.906311,.894855,.098125,.968627,.916242,.896091,.100717,.972549,.926106,.89733,.104071,.976471,.935904,.89857,.108131,.980392,.945636,.899815,.112838,.984314,.9553,.901065,.118128,.988235,.964894,.902323,.123941,.992157,.974417,.90359,.130215,.996078,.983868,.904867,.136897,1,.993248,.906157,.143936]},{ShowIndexedColorActiveValues:1,IndexedColors:[.07,.5,.7,1,1,1,.85,1,1,.8,.5,1,.76,1,0,1,.71,.71,.5,.5,.5,.05,.05,1,1,.05,.05,.7,1,1,.7,.89,.96,.67,.36,.95,.54,1,0,.75,.65,.65,.5,.6,.6,1,.5,0,1,1,.19,.12,.94,.12,.5,.82,.89,.56,.25,.83,.24,1,0,.9,.9,.9,.75,.76,.78,.65,.65,.67,.54,.6,.78,.61,.48,.78,.5,.48,.78,.44,.48,.78,.36,.48,.76,1,.48,.38,.49,.5,.69,.76,.56,.56,.4,.56,.56,.74,.5,.89,1,.63,0,.65,.16,.16,.36,.72,.82,.44,.18,.69,0,1,0,.58,1,1,.58,.88,.88,.45,.76,.79,.33,.71,.71,.23,.62,.62,.14,.56,.56,.04,.49,.55,0,.41,.52,.88,.88,1,1,.85,.56,.65,.46,.45,.4,.5,.5,.62,.39,.71,.83,.48,0,.58,0,.58,.26,.62,.69,.34,.09,.56,0,.79,0,.44,.83,1,1,1,.78,.85,1,.78,.78,1,.78,.64,1,.78,.56,1,.78,.38,1,.78,.27,1,.78,.19,1,.78,.12,1,.78,0,1,.61,0,.9,.46,0,.83,.32,0,.75,.22,0,.67,.14,.3,.76,1,.3,.65,1,.13,.58,.84,.15,.49,.67,.15,.4,.59,.09,.33,.53,.96,.93,.82,.8,.82,.12,.71,.71,.76,.65,.33,.3,.34,.35,.38,.62,.31,.71,.67,.36,0,.46,.31,.27,.26,.51,.59,.26,0,.4,0,.49,0,.44,.67,.98,0,.73,1,0,.63,1,0,.56,1,0,.5,1,0,.42,1,.33,.36,.95,.47,.36,.89,.54,.31,.89,.63,.21,.83,.7,.12,.83,.7,.12,.73,.7,.05,.65,.74,.05,.53,.78,0,.4,.8,0,.35,.82,0,.31,.85,0,.27,.88,0,.22,.9,0,.18,.91,0,.15,.92,0,.14,.93,0,.13,.94,0,.12,.95,0,.11,.96,0,.1,.97,0,.09,.98,0,.08,.99,0,.07,1,0,.06],Annotations:[0,"Xx",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",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",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",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",103,"Lr",104,"Rf",105,"Db",106,"Sg",107,"Bh",108,"Hs",109,"Mt",110,"Ds",111,"Rg",112,"Cn",113,"Uut",114,"Uuq",115,"Uup",116,"Uuh",117,"Uus",118,"Uuo"],Name:"BlueObeliskElements"}]},function(e,t,n){e.exports=function(){return n(87)('/*!\n * @project vtk.js\n * @build Mon, Apr 22, 2019 9:19 PM ET\n * @copyright Copyright (c) 2019 Kitware, Inc.\n *\n */!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/dist/",r(r.s=1)}([function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=function(){function e(e,t){for(var r=0;r1?t-1:0),n=1;n1?n-1:0),u=1;u3&&void 0!==arguments[3]?arguments[3]:[];d([c,e,t,r],n)},O=function(e,t,r){if(!t)throw new Error("eventName is required");if("string"!=typeof t)throw new Error("eventName should be string");d([s,e,t,r])};return self.addEventListener("message",function(e){var t=e.data;Array.isArray(t)?function(e,t,r){var n=function(t){t&&t instanceof h?w(e,p,t.payload,t.transferable):w(e,p,t)},o=function(t){w(e,y,{message:t.message,stack:t.stack})};try{var i=g(e,t,r);v(i)?i.then(n).catch(o):n(i)}catch(e){o(e)}}.apply(void 0,a(t)):t&&t.eventName&&_.emitLocally.apply(_,[t.eventName].concat(a(t.args)))}),_},e.exports.TransferableResponse=h},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n);o()(function(e,t){var r=e.array,n=e.min,i=e.max,u=e.numberOfBins,a=i-n,f=new Float32Array(u);f.fill(0);for(var l=r.length,c=0;c1?t-1:0),n=1;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(n,g,a),r.a.obj(t,n),r.a.get(t,n,["fetchGzip","url","baseURL","scene","metadata"]),r.a.setGet(t,n,["renderer"]),r.a.event(t,n,"ready"),function(t,n){var r={};function a(e){if(n.renderer){var t=n.renderer.getActiveCamera();t?t.set(e):c("No active camera to update")}}n.classHierarchy.push("vtkHttpSceneLoader"),n.scene||(n.scene=[]),n.dataAccessHelper||(n.dataAccessHelper=u.a.get("http")),t.update=function(){n.dataAccessHelper.fetchJSON(t,n.url).then(function(i){var o;void 0!==i.fetchGzip&&(n.fetchGzip=i.fetchGzip),i.background&&n.renderer&&(o=n.renderer).setBackground.apply(o,l(i.background)),i.camera&&(r.camera=i.camera,a(i.camera)),i.scene&&(i.scene.forEach(function(e){var r=p[e.type];r&&r(e,n,t)}),e.scene=n.scene),n.metadata=i},function(e){c("Error fetching scene ".concat(e))})},t.resetScene=function(){r.camera&&a(r.camera)},t.setUrl=function(e){if(-1===e.indexOf("index.json"))n.baseURL=e,n.url="".concat(e,"/index.json");else{n.url=e;var r=e.split("/");r.pop(),n.baseURL=r.join("/")}return t.update()}}(t,n)}var h=r.a.newInstance(m,"vtkHttpSceneLoader");t.a={newInstance:h,extend:m,applySettings:f,updateDatasetTypeMapping:function(e,t){p[e]=t}}}).call(this,n(33))},function(e,t,n){"use strict";(function(e){var r=n(47),a=n(15),i=n(0),o=n(3),s=n(9),u=n(4),l=i.a.vtkErrorMacro;function c(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{binary:!0};n.url=e;var a=e.split("/");return a.pop(),n.baseURL=a.join("/"),n.compression=r.compression,t.loadData({progressCallback:r.progressCallback,binary:!!r.binary})},t.loadData=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.compression,i=n.progressCallback;return r.binary?n.dataAccessHelper.fetchBinary(e,{compression:a,progressCallback:i}):n.dataAccessHelper.fetchText(t,e,{compression:a,progressCallback:i})}(n.url,e);return r.then(t.parse),r},t.parse=function(e){"string"==typeof e?t.parseAsText(e):t.parseAsArrayBuffer(e)},t.parseAsArrayBuffer=function(a){if(a&&a!==n.parseData){t.modified(),n.parseData=a;var i=a.slice(0,80),c=r.a.arrayBufferToString(i),d=function(e){for(var t=e.split(" ").filter(function(e){return e.indexOf("=")>-1}),n={},r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,p,n),i.a.obj(e,t),i.a.get(e,t,["url","baseURL"]),i.a.setGet(e,t,["dataAccessHelper"]),i.a.algo(e,t,0,1),f(e,t),t.compression||(t.compression=null),t.progressCallback||(t.progressCallback=null)}var m=i.a.newInstance(g,"vtkSTLReader");t.a={extend:g,newInstance:m}}).call(this,n(33))},function(e){e.exports={H:[1],He:[2],Li:[3],Be:[4],B:[5],C:[6],N:[7],O:[8],F:[9],Ne:[10],Na:[11],Mg:[12],Al:[13],Si:[14],P:[15],S:[16],Cl:[17],Ar:[18],K:[19],Ca:[20],Sc:[21],Ti:[22],V:[23],Cr:[24],Mn:[25],Fe:[26],Co:[27],Ni:[28],Cu:[29],Zn:[30],Ga:[31],Ge:[32],As:[33],Se:[34],Br:[35],Kr:[36],Rb:[37],Sr:[38],Y:[39],Zr:[40],Nb:[41],Mo:[42],Tc:[43],Ru:[44],Rh:[45],Pd:[46],Ag:[47],Cd:[48],In:[49],Sn:[50],Sb:[51],Te:[52],I:[53],Xe:[54],Cs:[55],Ba:[56],La:[57],Ce:[58],Pr:[59],Nd:[60],Pm:[61],Sm:[62],Eu:[63],Gd:[64],Tb:[65],Dy:[66],Ho:[67],Er:[68],Tm:[69],Yb:[70],Lu:[71],Hf:[72],Ta:[73],W:[74],Re:[75],Os:[76],Ir:[77],Pt:[78],Au:[79],Hg:[80],Tl:[81],Pb:[82],Bi:[83],Po:[84],At:[85],Rn:[86],Fr:[87],Ra:[88],Ac:[89],Th:[90],Pa:[91],U:[92],Np:[93],Pu:[94],Am:[95],Cm:[96],Bk:[97],Cf:[98],Es:[99],Fm:[100],Md:[101],No:[102],Lr:[103],Rf:[104],Db:[105],Sg:[106],Bh:[107],Hs:[108],Mt:[109],Ds:[110],Rg:[111],Cn:[112],Uut:[113],Uuq:[114],Uup:[115],Uuh:[116],Uus:[117],Uuo:[118]}},function(e,t,n){(function(){var t,r,a,i,o,s,u;u=n(41),o=u.assign,s=u.isFunction,t=n(212),r=n(213),i=n(96),a=n(214),e.exports.create=function(e,n,r,a){var i,s;if(null==e)throw new Error("Root element needs a name");return a=o({},n,r,a),s=(i=new t(a)).element(e),a.headless||(i.declaration(a),null==a.pubID&&null==a.sysID||i.doctype(a)),s},e.exports.begin=function(e,n,a){var i;return s(e)&&(n=(i=[e,n])[0],a=i[1],e={}),n?new r(e,n,a):new t(e)},e.exports.stringWriter=function(e){return new i(e)},e.exports.streamWriter=function(e,t){return new a(e,t)}}).call(this)},function(e,t,n){e.exports=function(){return n(87)('/*!\n * @project vtk.js\n * @build Mon, Apr 22, 2019 9:19 PM ET\n * @copyright Copyright (c) 2019 Kitware, Inc.\n *\n */!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/dist/",r(r.s=1)}([function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=function(){function t(t,e){for(var r=0;r1?e-1:0),n=1;n1?n-1:0),a=1;a3&&void 0!==arguments[3]?arguments[3]:[];m([s,t,e,r],n)},O=function(t,e,r){if(!e)throw new Error("eventName is required");if("string"!=typeof e)throw new Error("eventName should be string");m([c,t,e,r])};return self.addEventListener("message",function(t){var e=t.data;Array.isArray(e)?function(t,e,r){var n=function(e){e&&e instanceof h?w(t,p,e.payload,e.transferable):w(t,p,e)},o=function(e){w(t,y,{message:e.message,stack:e.stack})};try{var i=_(t,e,r);v(i)?i.then(n).catch(o):n(i)}catch(t){o(t)}}.apply(void 0,u(e)):e&&e.eventName&&g.emitLocally.apply(g,[e.eventName].concat(u(e.args)))}),g},t.exports.TransferableResponse=h},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n);function i(t){const e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function a(t,e){const r=e[0],n=e[1],o=e[2];let i=r*r+n*n+o*o;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i),t}o()(function(t,e){var r=t.width,n=t.height,u=t.depth,f=t.spacing,l=t.data,s=(t.haveWebgl2,t.depthStart),c=t.depthEnd;c!==u-1&&c--;var y=c-s+1,p=new Uint8Array(r*n*y*3),b=new Float32Array(r*n*y),v=r*n,h=0,d=0,m=new Float64Array(3);m[0]=(l[h+1]-l[h])/f[0],m[1]=(l[h+r]-l[h])/f[1],m[2]=(l[h+v]-l[h])/f[2];for(var g=i(m),_=-1,w=s;w<=c;++w){var O=0;w===u-1&&(O=-v);for(var j=0;j1?e-1:0),n=1;n>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,r,a,o){return i((s=i(i(t,e),i(r,o)))<<(u=a)|s>>>32-u,n);var s,u}function s(e,t,n,r,a,i,s){return o(t&n|~t&r,e,t,a,i,s)}function u(e,t,n,r,a,i,s){return o(t&r|n&~r,e,t,a,i,s)}function l(e,t,n,r,a,i,s){return o(t^n^r,e,t,a,i,s)}function c(e,t,n,r,a,i,s){return o(n^(t|~r),e,t,a,i,s)}function d(e,t){var n,r,a,o,d;e[t>>5]|=128<>>9<<4)]=t;var f=1732584193,p=-271733879,g=-1732584194,m=271733878;for(n=0;n>5]>>>t%32&255);return n}function p(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+"0123456789abcdef".charAt(15&t);return r}function m(e){return unescape(encodeURIComponent(e))}function h(e){return function(e){return f(d(p(e),8*e.length))}(m(e))}function v(e,t){return function(e,t){var n,r,a=p(e),i=[],o=[];for(i[15]=o[15]=void 0,a.length>16&&(a=d(a,8*e.length)),n=0;n<16;n+=1)i[n]=909522486^a[n],o[n]=1549556828^a[n];return r=d(i.concat(p(t)),512+8*t.length),f(d(o.concat(r),640))}(m(e),m(t))}function y(e,t,n){return t?n?v(t,e):g(v(t,e)):n?h(e):g(h(e))}void 0===(r=function(){return y}.call(t,n,t,e))||(e.exports=r)}()},function(e,t,n){(function(r){var a,i,o;function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)} +/** + * @license + * webvr-polyfill + * Copyright (c) 2015-2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * cardboard-vr-display + * Copyright (c) 2015-2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * webvr-polyfill-dpdb + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * wglu-preserve-state + * Copyright (c) 2016, Brandon Jones. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +/** + * @license + * nosleep.js + * Copyright (c) 2017, Rich Tibbett + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +/** + * @license + * webvr-polyfill + * Copyright (c) 2015-2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * cardboard-vr-display + * Copyright (c) 2015-2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * webvr-polyfill-dpdb + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * wglu-preserve-state + * Copyright (c) 2016, Brandon Jones. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +/** + * @license + * nosleep.js + * Copyright (c) 2017, Rich Tibbett + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +o=function(){"use strict";var e="undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{};var t,n,a=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},i=function(e,t){for(var n=0,r=e.length;ne.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),r.push(null,null);break}a||(a=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(s),r.push(e.getParameter(o),null);break;case e.ACTIVE_TEXTURE:a=e.getParameter(e.ACTIVE_TEXTURE),r.push(null);break;default:r.push(e.getParameter(o))}}n(e);for(var i=0;ie.TEXTURE31)break;e.activeTexture(s),e.bindTexture(e.TEXTURE_2D,u);break;case e.TEXTURE_BINDING_CUBE_MAP:var s=t[++i];if(se.TEXTURE31)break;e.activeTexture(s),e.bindTexture(e.TEXTURE_CUBE_MAP,u);break;case e.VIEWPORT:e.viewport(u[0],u[1],u[2],u[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:u?e.enable(o):e.disable(o);break;default:console.log("No GL restore behavior for 0x"+o.toString(16))}a&&e.activeTexture(a)}}else n(e)},S=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),N=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");function E(e,t,n,r){this.gl=e,this.cardboardUI=t,this.bufferScale=n,this.dirtySubmitFrameBindings=r,this.ctxAttribs=e.getContextAttributes(),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,u()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=y(e,S,N,this.attribs),this.uniforms=M(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize()}E.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},E.prototype.onResize=function(){var e=this.gl,t=this,n=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];x(e,n,function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.framebuffer),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.texImage2D(e.TEXTURE_2D,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,t.bufferWidth,t.bufferHeight,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.renderTarget,0),t.ctxAttribs.depth&&t.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t.depthStencilBuffer)):t.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t.depthBuffer)):t.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,t.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,t.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),t.realClearColor.apply(e,t.clearColor)}),this.cardboardUI&&this.cardboardUI.onResize()},E.prototype.patch=function(){if(!this.isPatched){var e=this,t=this.gl.canvas,n=this.gl;u()||(t.width=m()*this.bufferScale,t.height=h()*this.bufferScale,Object.defineProperty(t,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(n){e.bufferWidth=n,e.realCanvasWidth.set.call(t,n),e.onResize()}}),Object.defineProperty(t,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(n){e.bufferHeight=n,e.realCanvasHeight.set.call(t,n),e.onResize()}})),this.lastBoundFramebuffer=n.getParameter(n.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(t,r){e.lastBoundFramebuffer=r||e.framebuffer,e.realBindFramebuffer.call(n,t,e.lastBoundFramebuffer)},this.cullFace=n.getParameter(n.CULL_FACE),this.depthTest=n.getParameter(n.DEPTH_TEST),this.blend=n.getParameter(n.BLEND),this.scissorTest=n.getParameter(n.SCISSOR_TEST),this.stencilTest=n.getParameter(n.STENCIL_TEST),n.enable=function(t){switch(t){case n.CULL_FACE:e.cullFace=!0;break;case n.DEPTH_TEST:e.depthTest=!0;break;case n.BLEND:e.blend=!0;break;case n.SCISSOR_TEST:e.scissorTest=!0;break;case n.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(n,t)},n.disable=function(t){switch(t){case n.CULL_FACE:e.cullFace=!1;break;case n.DEPTH_TEST:e.depthTest=!1;break;case n.BLEND:e.blend=!1;break;case n.SCISSOR_TEST:e.scissorTest=!1;break;case n.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(n,t)},this.colorMask=n.getParameter(n.COLOR_WRITEMASK),n.colorMask=function(t,r,a,i){e.colorMask[0]=t,e.colorMask[1]=r,e.colorMask[2]=a,e.colorMask[3]=i,e.realColorMask.call(n,t,r,a,i)},this.clearColor=n.getParameter(n.COLOR_CLEAR_VALUE),n.clearColor=function(t,r,a,i){e.clearColor[0]=t,e.clearColor[1]=r,e.clearColor[2]=a,e.clearColor[3]=i,e.realClearColor.call(n,t,r,a,i)},this.viewport=n.getParameter(n.VIEWPORT),n.viewport=function(t,r,a,i){e.viewport[0]=t,e.viewport[1]=r,e.viewport[2]=a,e.viewport[3]=i,e.realViewport.call(n,t,r,a,i)},this.isPatched=!0,w(t)}},E.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,t=this.gl.canvas;u()||(Object.defineProperty(t,"width",this.realCanvasWidth),Object.defineProperty(t,"height",this.realCanvasHeight)),t.width=this.bufferWidth,t.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout(function(){w(t)},1)}},E.prototype.setTextureBounds=function(e,t){e||(e=[0,0,.5,1]),t||(t=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=t[0],this.viewportOffsetScale[5]=t[1],this.viewportOffsetScale[6]=t[2],this.viewportOffsetScale[7]=t[3]},E.prototype.submitFrame=function(){var e=this.gl,t=this,n=[];if(this.dirtySubmitFrameBindings||n.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),x(e,n,function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.cullFace&&t.realDisable.call(e,e.CULL_FACE),t.depthTest&&t.realDisable.call(e,e.DEPTH_TEST),t.blend&&t.realDisable.call(e,e.BLEND),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realDisable.call(e,e.STENCIL_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(t.ctxAttribs.alpha||u())&&(t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(t.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.enableVertexAttribArray(t.attribs.position),e.enableVertexAttribArray(t.attribs.texCoord),e.vertexAttribPointer(t.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(t.attribs.texCoord,3,e.FLOAT,!1,20,8),e.activeTexture(e.TEXTURE0),e.uniform1i(t.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.uniform4fv(t.uniforms.viewportOffsetScale,t.viewportOffsetScale),e.drawElements(e.TRIANGLES,t.indexCount,e.UNSIGNED_SHORT,0),t.cardboardUI&&t.cardboardUI.renderNoState(),t.realBindFramebuffer.call(t.gl,e.FRAMEBUFFER,t.framebuffer),t.ctxAttribs.preserveDrawingBuffer||(t.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),t.dirtySubmitFrameBindings||t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.cullFace&&t.realEnable.call(e,e.CULL_FACE),t.depthTest&&t.realEnable.call(e,e.DEPTH_TEST),t.blend&&t.realEnable.call(e,e.BLEND),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realEnable.call(e,e.STENCIL_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),!t.ctxAttribs.alpha&&t.ctxAttribs.preserveDrawingBuffer||t.realClearColor.apply(e,t.clearColor)}),u()){var r=e.canvas;r.width==t.bufferWidth&&r.height==t.bufferHeight||(t.bufferWidth=r.width,t.bufferHeight=r.height,t.onResize())}},E.prototype.updateDeviceInfo=function(e){var t=this.gl,n=this,r=[t.ARRAY_BUFFER_BINDING,t.ELEMENT_ARRAY_BUFFER_BINDING];x(t,r,function(t){var r=n.computeMeshVertices_(n.meshWidth,n.meshHeight,e);if(t.bindBuffer(t.ARRAY_BUFFER,n.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW),!n.indexCount){var a=n.computeMeshIndices_(n.meshWidth,n.meshHeight);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,a,t.STATIC_DRAW),n.indexCount=a.length}})},E.prototype.computeMeshVertices_=function(e,t,n){for(var r=new Float32Array(2*e*t*5),a=n.getLeftEyeVisibleTanAngles(),i=n.getLeftEyeNoLensTanAngles(),o=n.getLeftEyeVisibleScreenRect(i),u=0,l=0;l<2;l++){for(var c=0;ca-42&&r.clientXn.clientHeight-42?e(r):r.clientX<42&&r.clientY<42&&t(r)},n.addEventListener("click",this.listener,!1)},R.prototype.onResize=function(){var e=this.gl,t=this,n=[e.ARRAY_BUFFER_BINDING];x(e,n,function(e){var n=[],r=e.drawingBufferWidth/2,a=Math.max(screen.width,screen.height)*window.devicePixelRatio,i=e.drawingBufferWidth/a,o=i*window.devicePixelRatio,s=4*o/2,u=42*o,l=28*o/2,c=14*o;function d(e,t){var a=(90-e)*P,i=Math.cos(a),o=Math.sin(a);n.push(k*i*l+r,k*o*l+l),n.push(t*i*l+r,t*o*l+l)}n.push(r-s,u),n.push(r-s,e.drawingBufferHeight),n.push(r+s,u),n.push(r+s,e.drawingBufferHeight),t.gearOffset=n.length/2;for(var f=0;f<=6;f++){var p=60*f;d(p,1),d(p+12,1),d(p+20,.75),d(p+40,.75),d(p+48,1)}function g(t,r){n.push(c+t,e.drawingBufferHeight-c-r)}t.gearVertexCount=n.length/2-t.gearOffset,t.arrowOffset=n.length/2;var m=s/Math.sin(45*P);g(0,l),g(l,0),g(l+m,m),g(m,l+m),g(m,l-m),g(0,l),g(l,2*l),g(l+m,2*l-m),g(m,l-m),g(0,l),g(m,l-s),g(28*o,l-s),g(m,l+s),g(28*o,l+s),t.arrowVertexCount=n.length/2-t.arrowOffset,e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(n),e.STATIC_DRAW)})},R.prototype.render=function(){var e=this.gl,t=this,n=[e.CULL_FACE,e.DEPTH_TEST,e.BLEND,e.SCISSOR_TEST,e.STENCIL_TEST,e.COLOR_WRITEMASK,e.VIEWPORT,e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING];x(e,n,function(e){e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.BLEND),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.colorMask(!0,!0,!0,!0),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.renderNoState()})},R.prototype.renderNoState=function(){var e,t,n,r,a,i,o,s,u,l,c=this.gl;c.useProgram(this.program),c.bindBuffer(c.ARRAY_BUFFER,this.vertexBuffer),c.enableVertexAttribArray(this.attribs.position),c.vertexAttribPointer(this.attribs.position,2,c.FLOAT,!1,8,0),c.uniform4f(this.uniforms.color,1,1,1,1),e=this.projMat,t=0,n=c.drawingBufferWidth,r=0,a=c.drawingBufferHeight,s=1/(t-n),u=1/(r-a),l=1/((i=.1)-(o=1024)),e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(a+r)*u,e[14]=(o+i)*l,e[15]=1,c.uniformMatrix4fv(this.uniforms.projectionMat,!1,this.projMat),c.drawArrays(c.TRIANGLE_STRIP,0,4),c.drawArrays(c.TRIANGLE_STRIP,this.gearOffset,this.gearVertexCount),c.drawArrays(c.TRIANGLE_STRIP,this.arrowOffset,this.arrowVertexCount)},j.prototype.distortInverse=function(e){for(var t=0,n=1,r=e-this.distort(t);Math.abs(n-t)>1e-4;){var a=e-this.distort(n),i=n-a*((n-t)/(a-r));t=n,n=i,r=a}return n},j.prototype.distort=function(e){for(var t=e*e,n=0,r=0;r=1)return this.w=i,this.x=n,this.y=r,this.z=a,this;var s=Math.acos(o),u=Math.sqrt(1-o*o);if(Math.abs(u)<.001)return this.w=.5*(i+this.w),this.x=.5*(n+this.x),this.y=.5*(r+this.y),this.z=.5*(a+this.z),this;var l=Math.sin((1-t)*s)/u,c=Math.sin(t*s)/u;return this.w=i*l+this.w*c,this.x=n*l+this.x*c,this.y=r*l+this.y*c,this.z=a*l+this.z*c,this},setFromUnitVectors:function(e,t){return void 0===V&&(V=new _),(F=e.dot(t)+1)<1e-6?(F=0,Math.abs(e.x)>Math.abs(e.z)?V.set(-e.y,e.x,0):V.set(0,-e.z,e.y)):V.crossVectors(e,t),this.x=V.x,this.y=V.y,this.z=V.z,this.w=F,this.normalize(),this}};var W=new G({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),Q=new G({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),Y={CardboardV1:new K({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new K({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};function H(e,t){this.viewer=Y.CardboardV2,this.updateDeviceParams(e),this.distortion=new j(this.viewer.distortionCoefficients);for(var n=0;n=200&&n.status<=299?(r.dpdb=JSON.parse(n.response),r.recalculateDeviceParams_()):console.error("Error loading online DPDB!")}),n.send()}}function Z(e){this.xdpi=e.xdpi,this.ydpi=e.ydpi,this.bevelMm=e.bevelMm}function J(e,t){this.set(e,t)}function $(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new J,this.currentGyroMeasurement=new J,this.previousGyroMeasurement=new J,u()?this.filterQ=new U(-1,0,0,1):this.filterQ=new U(1,0,0,1),this.previousFilterQ=new U,this.previousFilterQ.copy(this.filterQ),this.accelQ=new U,this.isOrientationInitialized=!1,this.estimatedGravity=new _,this.measuredGravity=new _,this.gyroIntegralQ=new U}function ee(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new U,this.previousTimestampS=null,this.deltaQ=new U,this.outQ=new U}function te(e,t,n,r){this.yawOnly=n,this.accelerometer=new _,this.gyroscope=new _,this.filter=new $(e,r),this.posePredictor=new ee(t,r),this.isFirefoxAndroid=c(),this.isIOS=u();var a=d();this.isDeviceMotionInRadians=!this.isIOS&&a&&a<66,this.isWithoutDeviceMotion=f(),this.filterToWorldQ=new U,u()?this.filterToWorldQ.setFromAxisAngle(new _(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new _(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new U,this.worldToScreenQ=new U,this.originalPoseAdjustQ=new U,this.originalPoseAdjustQ.setFromAxisAngle(new _(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),g()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new U,this.orientationOut_=new Float32Array(4),this.start()}q.prototype.getDeviceParams=function(){return this.deviceParams},q.prototype.recalculateDeviceParams_=function(){var e=this.calcDeviceParams_();e?(this.deviceParams=e,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},q.prototype.calcDeviceParams_=function(){var e=this.dpdb;if(!e)return console.error("DPDB not available."),null;if(1!=e.format)return console.error("DPDB has unexpected format version."),null;if(!e.devices||!e.devices.length)return console.error("DPDB does not have a devices section."),null;var t=navigator.userAgent||navigator.vendor||window.opera,n=m(),r=h();if(!e.devices)return console.error("DPDB has no devices section."),null;for(var a=0;a1)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},$.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var n=new U;n.copy(this.filterQ),n.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(n),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var r,a=new U;a.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),a.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",z*((r=a).w>1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(r.w)),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var i=new U;i.copy(this.filterQ),i.multiply(a),this.filterQ.slerp(i,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},$.prototype.getOrientation=function(){return this.filterQ},$.prototype.accelToQuaternion_=function(e){var t=new _;t.copy(e),t.normalize();var n=new U;return n.setFromUnitVectors(new _(0,0,-1),t),n.inverse(),n},$.prototype.gyroToQuaternionDelta_=function(e,t){var n=new U,r=new _;return r.copy(e),r.normalize(),n.setFromAxisAngle(r,e.length()*t),n},ee.prototype.getPrediction=function(e,t,n){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=n,e;var r=new _;r.copy(t),r.normalize();var a=t.length();if(a<20*B)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(z*a).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var i=a*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(r,i),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=n,this.outQ},te.prototype.getPosition=function(){return null},te.prototype.getOrientation=function(){var e=void 0;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(r=(new U).setFromAxisAngle(new _(0,0,-1),0),a=new U,-90===window.orientation?a.setFromAxisAngle(new _(0,1,0),Math.PI/-2):a.setFromAxisAngle(new _(0,1,0),Math.PI/2),r.multiply(a)),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((n=new U).setFromAxisAngle(new _(1,0,0),-Math.PI/2),n),e=this._deviceOrientationQ;var t=new U;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}var n,r,a,i=this.filter.getOrientation();e=this.posePredictor.getPrediction(i,this.gyroscope,this.previousTimestampS);var t=new U;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),t.multiply(e),t.multiply(this.worldToScreenQ),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_},te.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),g()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},te.prototype.onDeviceOrientation_=function(e){this._deviceOrientationQ=this._deviceOrientationQ||new U;var t=e.alpha,n=e.beta,r=e.gamma;t=(t||0)*Math.PI/180,n=(n||0)*Math.PI/180,r=(r||0)*Math.PI/180,this._deviceOrientationQ.setFromEulerYXZ(n,t,-r)},te.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},te.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,n=e.rotationRate,r=e.timeStamp/1e3,a=r-this.previousTimestampS;return a<0?(C("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=r)):a<=.001||a>1?(C("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=r)):(this.accelerometer.set(-t.x,-t.y,-t.z),p()?this.gyroscope.set(-n.beta,n.alpha,n.gamma):this.gyroscope.set(n.alpha,n.beta,n.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addAccelMeasurement(this.accelerometer,r),this.filter.addGyroMeasurement(this.gyroscope,r),void(this.previousTimestampS=r))},te.prototype.onOrientationChange_=function(e){this.setScreenTransform_()},te.prototype.onMessage_=function(e){var t=e.data;if(t&&t.type){var n=t.type.toLowerCase();"devicemotion"===n&&this.updateDeviceMotion_(t.deviceMotionEvent)}},te.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new _(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new _(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},te.prototype.start=function(){var e,t,n;this.onDeviceMotionCallback_=this.onDeviceMotion_.bind(this),this.onOrientationChangeCallback_=this.onOrientationChange_.bind(this),this.onMessageCallback_=this.onMessage_.bind(this),this.onDeviceOrientationCallback_=this.onDeviceOrientation_.bind(this),u()&&(e=window.self!==window.top,t=T(document.referrer),n=T(window.location.href),e&&t!==n)&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},te.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var ne=new _(1,0,0),re=new _(0,0,1),ae=new U;ae.setFromAxisAngle(ne,-Math.PI/2),ae.multiply((new U).setFromAxisAngle(re,Math.PI/2));var ie=function(){function e(t){a(this,e),this.config=t,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new U,this._outQ=new U,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this.init()}return i(e,[{key:"init",value:function(){var e=null;try{(e=new RelativeOrientationSensor({frequency:60,referenceFrame:"screen"})).addEventListener("error",this._onSensorError)}catch(e){this.errors.push(e),"SecurityError"===e.name?(console.error("Cannot construct sensors due to the Feature Policy"),console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'),this.useDeviceMotion()):"ReferenceError"===e.name?this.useDeviceMotion():console.error(e)}e&&(this.api="sensor",this.sensor=e,this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start())}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new te(this.config.K_FILTER,this.config.PREDICTION_TIME_S,this.config.YAW_ONLY,this.config.DEBUG),this.sensor&&(this.sensor.removeEventListener("reading",this._onSensorRead),this.sensor.removeEventListener("error",this._onSensorError),this.sensor=null)}},{key:"getOrientation",value:function(){if(this.fusionSensor)return this.fusionSensor.getOrientation();if(!this.sensor||!this.sensor.quaternion)return this._out[0]=this._out[1]=this._out[2]=0,this._out[3]=1,this._out;var e=this.sensor.quaternion;this._sensorQ.set(e[0],e[1],e[2],e[3]);var t=this._outQ;return t.copy(ae),t.multiply(this._sensorQ),this.config.YAW_ONLY&&(t.x=t.z=0,t.normalize()),this._out[0]=t.x,this._out[1]=t.y,this._out[2]=t.z,this._out[3]=t.w,this._out}},{key:"_onSensorError",value:function(e){this.errors.push(e.error),"NotAllowedError"===e.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===e.error.name?console.error("Sensor could not be read"):console.error(e.error),this.useDeviceMotion()}},{key:"_onSensorRead",value:function(){}}]),e}();function oe(){this.loadIcon_();var e=document.createElement("div"),t=e.style;t.position="fixed",t.top=0,t.right=0,t.bottom=0,t.left=0,t.backgroundColor="gray",t.fontFamily="sans-serif",t.zIndex=1e6;var n=document.createElement("img");n.src=this.icon;var t=n.style;t.marginLeft="25%",t.marginTop="25%",t.width="50%",e.appendChild(n);var r=document.createElement("div"),t=r.style;t.textAlign="center",t.fontSize="16px",t.lineHeight="24px",t.margin="24px 25%",t.width="50%",r.innerHTML="Place your phone into your Cardboard viewer.",e.appendChild(r);var a=document.createElement("div"),t=a.style;t.backgroundColor="#CFD8DC",t.position="fixed",t.bottom=0,t.width="100%",t.height="48px",t.padding="14px 24px",t.boxSizing="border-box",t.color="#656A6B",e.appendChild(a);var i=document.createElement("div");i.style.float="left",i.innerHTML="No Cardboard viewer?";var o=document.createElement("a");o.href="https://www.google.com/get/cardboard/get-cardboard/",o.innerHTML="get one",o.target="_blank";var t=o.style;t.float="right",t.fontWeight=600,t.textTransform="uppercase",t.borderLeft="1px solid gray",t.paddingLeft="24px",t.textDecoration="none",t.color="#656A6B",a.appendChild(i),a.appendChild(o),this.overlay=e,this.text=r,this.hide()}oe.prototype.show=function(e){e||this.overlay.parentElement?e&&(this.overlay.parentElement&&this.overlay.parentElement!=e&&this.overlay.parentElement.removeChild(this.overlay),e.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var t=this.overlay.querySelector("img"),n=t.style;g()?(n.width="20%",n.marginLeft="40%",n.marginTop="3%"):(n.width="50%",n.marginLeft="25%",n.marginTop="25%")},oe.prototype.hide=function(){this.overlay.style.display="none"},oe.prototype.showTemporarily=function(e,t){this.show(t),this.timer=setTimeout(this.hide.bind(this),e)},oe.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},oe.prototype.update=function(){this.disableShowTemporarily(),!g()&&A()?this.show():this.hide()},oe.prototype.loadIcon_=function(){this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjE5OHB4IiBoZWlnaHQ9IjI0MHB4IiB2aWV3Qm94PSIwIDAgMTk4IDI0MCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWxuczpza2V0Y2g9Imh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaC9ucyI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDMuMy4zICgxMjA4MSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dHJhbnNpdGlvbjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJ0cmFuc2l0aW9uIiBza2V0Y2g6dHlwZT0iTVNBcnRib2FyZEdyb3VwIj4KICAgICAgICAgICAgPGcgaWQ9IkltcG9ydGVkLUxheWVycy1Db3B5LTQtKy1JbXBvcnRlZC1MYXllcnMtQ29weS0rLUltcG9ydGVkLUxheWVycy1Db3B5LTItQ29weSIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCI+CiAgICAgICAgICAgICAgICA8ZyBpZD0iSW1wb3J0ZWQtTGF5ZXJzLUNvcHktNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsIDEwNy4wMDAwMDApIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTQ5LjYyNSwyLjUyNyBDMTQ5LjYyNSwyLjUyNyAxNTUuODA1LDYuMDk2IDE1Ni4zNjIsNi40MTggTDE1Ni4zNjIsNy4zMDQgQzE1Ni4zNjIsNy40ODEgMTU2LjM3NSw3LjY2NCAxNTYuNCw3Ljg1MyBDMTU2LjQxLDcuOTM0IDE1Ni40Miw4LjAxNSAxNTYuNDI3LDguMDk1IEMxNTYuNTY3LDkuNTEgMTU3LjQwMSwxMS4wOTMgMTU4LjUzMiwxMi4wOTQgTDE2NC4yNTIsMTcuMTU2IEwxNjQuMzMzLDE3LjA2NiBDMTY0LjMzMywxNy4wNjYgMTY4LjcxNSwxNC41MzYgMTY5LjU2OCwxNC4wNDIgQzE3MS4wMjUsMTQuODgzIDE5NS41MzgsMjkuMDM1IDE5NS41MzgsMjkuMDM1IEwxOTUuNTM4LDgzLjAzNiBDMTk1LjUzOCw4My44MDcgMTk1LjE1Miw4NC4yNTMgMTk0LjU5LDg0LjI1MyBDMTk0LjM1Nyw4NC4yNTMgMTk0LjA5NSw4NC4xNzcgMTkzLjgxOCw4NC4wMTcgTDE2OS44NTEsNzAuMTc5IEwxNjkuODM3LDcwLjIwMyBMMTQyLjUxNSw4NS45NzggTDE0MS42NjUsODQuNjU1IEMxMzYuOTM0LDgzLjEyNiAxMzEuOTE3LDgxLjkxNSAxMjYuNzE0LDgxLjA0NSBDMTI2LjcwOSw4MS4wNiAxMjYuNzA3LDgxLjA2OSAxMjYuNzA3LDgxLjA2OSBMMTIxLjY0LDk4LjAzIEwxMTMuNzQ5LDEwMi41ODYgTDExMy43MTIsMTAyLjUyMyBMMTEzLjcxMiwxMzAuMTEzIEMxMTMuNzEyLDEzMC44ODUgMTEzLjMyNiwxMzEuMzMgMTEyLjc2NCwxMzEuMzMgQzExMi41MzIsMTMxLjMzIDExMi4yNjksMTMxLjI1NCAxMTEuOTkyLDEzMS4wOTQgTDY5LjUxOSwxMDYuNTcyIEM2OC41NjksMTA2LjAyMyA2Ny43OTksMTA0LjY5NSA2Ny43OTksMTAzLjYwNSBMNjcuNzk5LDEwMi41NyBMNjcuNzc4LDEwMi42MTcgQzY3LjI3LDEwMi4zOTMgNjYuNjQ4LDEwMi4yNDkgNjUuOTYyLDEwMi4yMTggQzY1Ljg3NSwxMDIuMjE0IDY1Ljc4OCwxMDIuMjEyIDY1LjcwMSwxMDIuMjEyIEM2NS42MDYsMTAyLjIxMiA2NS41MTEsMTAyLjIxNSA2NS40MTYsMTAyLjIxOSBDNjUuMTk1LDEwMi4yMjkgNjQuOTc0LDEwMi4yMzUgNjQuNzU0LDEwMi4yMzUgQzY0LjMzMSwxMDIuMjM1IDYzLjkxMSwxMDIuMjE2IDYzLjQ5OCwxMDIuMTc4IEM2MS44NDMsMTAyLjAyNSA2MC4yOTgsMTAxLjU3OCA1OS4wOTQsMTAwLjg4MiBMMTIuNTE4LDczLjk5MiBMMTIuNTIzLDc0LjAwNCBMMi4yNDUsNTUuMjU0IEMxLjI0NCw1My40MjcgMi4wMDQsNTEuMDM4IDMuOTQzLDQ5LjkxOCBMNTkuOTU0LDE3LjU3MyBDNjAuNjI2LDE3LjE4NSA2MS4zNSwxNy4wMDEgNjIuMDUzLDE3LjAwMSBDNjMuMzc5LDE3LjAwMSA2NC42MjUsMTcuNjYgNjUuMjgsMTguODU0IEw2NS4yODUsMTguODUxIEw2NS41MTIsMTkuMjY0IEw2NS41MDYsMTkuMjY4IEM2NS45MDksMjAuMDAzIDY2LjQwNSwyMC42OCA2Ni45ODMsMjEuMjg2IEw2Ny4yNiwyMS41NTYgQzY5LjE3NCwyMy40MDYgNzEuNzI4LDI0LjM1NyA3NC4zNzMsMjQuMzU3IEM3Ni4zMjIsMjQuMzU3IDc4LjMyMSwyMy44NCA4MC4xNDgsMjIuNzg1IEM4MC4xNjEsMjIuNzg1IDg3LjQ2NywxOC41NjYgODcuNDY3LDE4LjU2NiBDODguMTM5LDE4LjE3OCA4OC44NjMsMTcuOTk0IDg5LjU2NiwxNy45OTQgQzkwLjg5MiwxNy45OTQgOTIuMTM4LDE4LjY1MiA5Mi43OTIsMTkuODQ3IEw5Ni4wNDIsMjUuNzc1IEw5Ni4wNjQsMjUuNzU3IEwxMDIuODQ5LDI5LjY3NCBMMTAyLjc0NCwyOS40OTIgTDE0OS42MjUsMi41MjcgTTE0OS42MjUsMC44OTIgQzE0OS4zNDMsMC44OTIgMTQ5LjA2MiwwLjk2NSAxNDguODEsMS4xMSBMMTAyLjY0MSwyNy42NjYgTDk3LjIzMSwyNC41NDIgTDk0LjIyNiwxOS4wNjEgQzkzLjMxMywxNy4zOTQgOTEuNTI3LDE2LjM1OSA4OS41NjYsMTYuMzU4IEM4OC41NTUsMTYuMzU4IDg3LjU0NiwxNi42MzIgODYuNjQ5LDE3LjE1IEM4My44NzgsMTguNzUgNzkuNjg3LDIxLjE2OSA3OS4zNzQsMjEuMzQ1IEM3OS4zNTksMjEuMzUzIDc5LjM0NSwyMS4zNjEgNzkuMzMsMjEuMzY5IEM3Ny43OTgsMjIuMjU0IDc2LjA4NCwyMi43MjIgNzQuMzczLDIyLjcyMiBDNzIuMDgxLDIyLjcyMiA2OS45NTksMjEuODkgNjguMzk3LDIwLjM4IEw2OC4xNDUsMjAuMTM1IEM2Ny43MDYsMTkuNjcyIDY3LjMyMywxOS4xNTYgNjcuMDA2LDE4LjYwMSBDNjYuOTg4LDE4LjU1OSA2Ni45NjgsMTguNTE5IDY2Ljk0NiwxOC40NzkgTDY2LjcxOSwxOC4wNjUgQzY2LjY5LDE4LjAxMiA2Ni42NTgsMTcuOTYgNjYuNjI0LDE3LjkxMSBDNjUuNjg2LDE2LjMzNyA2My45NTEsMTUuMzY2IDYyLjA1MywxNS4zNjYgQzYxLjA0MiwxNS4zNjYgNjAuMDMzLDE1LjY0IDU5LjEzNiwxNi4xNTggTDMuMTI1LDQ4LjUwMiBDMC40MjYsNTAuMDYxIC0wLjYxMyw1My40NDIgMC44MTEsNTYuMDQgTDExLjA4OSw3NC43OSBDMTEuMjY2LDc1LjExMyAxMS41MzcsNzUuMzUzIDExLjg1LDc1LjQ5NCBMNTguMjc2LDEwMi4yOTggQzU5LjY3OSwxMDMuMTA4IDYxLjQzMywxMDMuNjMgNjMuMzQ4LDEwMy44MDYgQzYzLjgxMiwxMDMuODQ4IDY0LjI4NSwxMDMuODcgNjQuNzU0LDEwMy44NyBDNjUsMTAzLjg3IDY1LjI0OSwxMDMuODY0IDY1LjQ5NCwxMDMuODUyIEM2NS41NjMsMTAzLjg0OSA2NS42MzIsMTAzLjg0NyA2NS43MDEsMTAzLjg0NyBDNjUuNzY0LDEwMy44NDcgNjUuODI4LDEwMy44NDkgNjUuODksMTAzLjg1MiBDNjUuOTg2LDEwMy44NTYgNjYuMDgsMTAzLjg2MyA2Ni4xNzMsMTAzLjg3NCBDNjYuMjgyLDEwNS40NjcgNjcuMzMyLDEwNy4xOTcgNjguNzAyLDEwNy45ODggTDExMS4xNzQsMTMyLjUxIEMxMTEuNjk4LDEzMi44MTIgMTEyLjIzMiwxMzIuOTY1IDExMi43NjQsMTMyLjk2NSBDMTE0LjI2MSwxMzIuOTY1IDExNS4zNDcsMTMxLjc2NSAxMTUuMzQ3LDEzMC4xMTMgTDExNS4zNDcsMTAzLjU1MSBMMTIyLjQ1OCw5OS40NDYgQzEyMi44MTksOTkuMjM3IDEyMy4wODcsOTguODk4IDEyMy4yMDcsOTguNDk4IEwxMjcuODY1LDgyLjkwNSBDMTMyLjI3OSw4My43MDIgMTM2LjU1Nyw4NC43NTMgMTQwLjYwNyw4Ni4wMzMgTDE0MS4xNCw4Ni44NjIgQzE0MS40NTEsODcuMzQ2IDE0MS45NzcsODcuNjEzIDE0Mi41MTYsODcuNjEzIEMxNDIuNzk0LDg3LjYxMyAxNDMuMDc2LDg3LjU0MiAxNDMuMzMzLDg3LjM5MyBMMTY5Ljg2NSw3Mi4wNzYgTDE5Myw4NS40MzMgQzE5My41MjMsODUuNzM1IDE5NC4wNTgsODUuODg4IDE5NC41OSw4NS44ODggQzE5Ni4wODcsODUuODg4IDE5Ny4xNzMsODQuNjg5IDE5Ny4xNzMsODMuMDM2IEwxOTcuMTczLDI5LjAzNSBDMTk3LjE3MywyOC40NTEgMTk2Ljg2MSwyNy45MTEgMTk2LjM1NSwyNy42MTkgQzE5Ni4zNTUsMjcuNjE5IDE3MS44NDMsMTMuNDY3IDE3MC4zODUsMTIuNjI2IEMxNzAuMTMyLDEyLjQ4IDE2OS44NSwxMi40MDcgMTY5LjU2OCwxMi40MDcgQzE2OS4yODUsMTIuNDA3IDE2OS4wMDIsMTIuNDgxIDE2OC43NDksMTIuNjI3IEMxNjguMTQzLDEyLjk3OCAxNjUuNzU2LDE0LjM1NyAxNjQuNDI0LDE1LjEyNSBMMTU5LjYxNSwxMC44NyBDMTU4Ljc5NiwxMC4xNDUgMTU4LjE1NCw4LjkzNyAxNTguMDU0LDcuOTM0IEMxNTguMDQ1LDcuODM3IDE1OC4wMzQsNy43MzkgMTU4LjAyMSw3LjY0IEMxNTguMDA1LDcuNTIzIDE1Ny45OTgsNy40MSAxNTcuOTk4LDcuMzA0IEwxNTcuOTk4LDYuNDE4IEMxNTcuOTk4LDUuODM0IDE1Ny42ODYsNS4yOTUgMTU3LjE4MSw1LjAwMiBDMTU2LjYyNCw0LjY4IDE1MC40NDIsMS4xMTEgMTUwLjQ0MiwxLjExMSBDMTUwLjE4OSwwLjk2NSAxNDkuOTA3LDAuODkyIDE0OS42MjUsMC44OTIiIGlkPSJGaWxsLTEiIGZpbGw9IiM0NTVBNjQiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNOTYuMDI3LDI1LjYzNiBMMTQyLjYwMyw1Mi41MjcgQzE0My44MDcsNTMuMjIyIDE0NC41ODIsNTQuMTE0IDE0NC44NDUsNTUuMDY4IEwxNDQuODM1LDU1LjA3NSBMNjMuNDYxLDEwMi4wNTcgTDYzLjQ2LDEwMi4wNTcgQzYxLjgwNiwxMDEuOTA1IDYwLjI2MSwxMDEuNDU3IDU5LjA1NywxMDAuNzYyIEwxMi40ODEsNzMuODcxIEw5Ni4wMjcsMjUuNjM2IiBpZD0iRmlsbC0yIiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYzLjQ2MSwxMDIuMTc0IEM2My40NTMsMTAyLjE3NCA2My40NDYsMTAyLjE3NCA2My40MzksMTAyLjE3MiBDNjEuNzQ2LDEwMi4wMTYgNjAuMjExLDEwMS41NjMgNTguOTk4LDEwMC44NjMgTDEyLjQyMiw3My45NzMgQzEyLjM4Niw3My45NTIgMTIuMzY0LDczLjkxNCAxMi4zNjQsNzMuODcxIEMxMi4zNjQsNzMuODMgMTIuMzg2LDczLjc5MSAxMi40MjIsNzMuNzcgTDk1Ljk2OCwyNS41MzUgQzk2LjAwNCwyNS41MTQgOTYuMDQ5LDI1LjUxNCA5Ni4wODUsMjUuNTM1IEwxNDIuNjYxLDUyLjQyNiBDMTQzLjg4OCw1My4xMzQgMTQ0LjY4Miw1NC4wMzggMTQ0Ljk1Nyw1NS4wMzcgQzE0NC45Nyw1NS4wODMgMTQ0Ljk1Myw1NS4xMzMgMTQ0LjkxNSw1NS4xNjEgQzE0NC45MTEsNTUuMTY1IDE0NC44OTgsNTUuMTc0IDE0NC44OTQsNTUuMTc3IEw2My41MTksMTAyLjE1OCBDNjMuNTAxLDEwMi4xNjkgNjMuNDgxLDEwMi4xNzQgNjMuNDYxLDEwMi4xNzQgTDYzLjQ2MSwxMDIuMTc0IFogTTEyLjcxNCw3My44NzEgTDU5LjExNSwxMDAuNjYxIEM2MC4yOTMsMTAxLjM0MSA2MS43ODYsMTAxLjc4MiA2My40MzUsMTAxLjkzNyBMMTQ0LjcwNyw1NS4wMTUgQzE0NC40MjgsNTQuMTA4IDE0My42ODIsNTMuMjg1IDE0Mi41NDQsNTIuNjI4IEw5Ni4wMjcsMjUuNzcxIEwxMi43MTQsNzMuODcxIEwxMi43MTQsNzMuODcxIFoiIGlkPSJGaWxsLTMiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTQ4LjMyNyw1OC40NzEgQzE0OC4xNDUsNTguNDggMTQ3Ljk2Miw1OC40OCAxNDcuNzgxLDU4LjQ3MiBDMTQ1Ljg4Nyw1OC4zODkgMTQ0LjQ3OSw1Ny40MzQgMTQ0LjYzNiw1Ni4zNCBDMTQ0LjY4OSw1NS45NjcgMTQ0LjY2NCw1NS41OTcgMTQ0LjU2NCw1NS4yMzUgTDYzLjQ2MSwxMDIuMDU3IEM2NC4wODksMTAyLjExNSA2NC43MzMsMTAyLjEzIDY1LjM3OSwxMDIuMDk5IEM2NS41NjEsMTAyLjA5IDY1Ljc0MywxMDIuMDkgNjUuOTI1LDEwMi4wOTggQzY3LjgxOSwxMDIuMTgxIDY5LjIyNywxMDMuMTM2IDY5LjA3LDEwNC4yMyBMMTQ4LjMyNyw1OC40NzEiIGlkPSJGaWxsLTQiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNjkuMDcsMTA0LjM0NyBDNjkuMDQ4LDEwNC4zNDcgNjkuMDI1LDEwNC4zNCA2OS4wMDUsMTA0LjMyNyBDNjguOTY4LDEwNC4zMDEgNjguOTQ4LDEwNC4yNTcgNjguOTU1LDEwNC4yMTMgQzY5LDEwMy44OTYgNjguODk4LDEwMy41NzYgNjguNjU4LDEwMy4yODggQzY4LjE1MywxMDIuNjc4IDY3LjEwMywxMDIuMjY2IDY1LjkyLDEwMi4yMTQgQzY1Ljc0MiwxMDIuMjA2IDY1LjU2MywxMDIuMjA3IDY1LjM4NSwxMDIuMjE1IEM2NC43NDIsMTAyLjI0NiA2NC4wODcsMTAyLjIzMiA2My40NSwxMDIuMTc0IEM2My4zOTksMTAyLjE2OSA2My4zNTgsMTAyLjEzMiA2My4zNDcsMTAyLjA4MiBDNjMuMzM2LDEwMi4wMzMgNjMuMzU4LDEwMS45ODEgNjMuNDAyLDEwMS45NTYgTDE0NC41MDYsNTUuMTM0IEMxNDQuNTM3LDU1LjExNiAxNDQuNTc1LDU1LjExMyAxNDQuNjA5LDU1LjEyNyBDMTQ0LjY0Miw1NS4xNDEgMTQ0LjY2OCw1NS4xNyAxNDQuNjc3LDU1LjIwNCBDMTQ0Ljc4MSw1NS41ODUgMTQ0LjgwNiw1NS45NzIgMTQ0Ljc1MSw1Ni4zNTcgQzE0NC43MDYsNTYuNjczIDE0NC44MDgsNTYuOTk0IDE0NS4wNDcsNTcuMjgyIEMxNDUuNTUzLDU3Ljg5MiAxNDYuNjAyLDU4LjMwMyAxNDcuNzg2LDU4LjM1NSBDMTQ3Ljk2NCw1OC4zNjMgMTQ4LjE0Myw1OC4zNjMgMTQ4LjMyMSw1OC4zNTQgQzE0OC4zNzcsNTguMzUyIDE0OC40MjQsNTguMzg3IDE0OC40MzksNTguNDM4IEMxNDguNDU0LDU4LjQ5IDE0OC40MzIsNTguNTQ1IDE0OC4zODUsNTguNTcyIEw2OS4xMjksMTA0LjMzMSBDNjkuMTExLDEwNC4zNDIgNjkuMDksMTA0LjM0NyA2OS4wNywxMDQuMzQ3IEw2OS4wNywxMDQuMzQ3IFogTTY1LjY2NSwxMDEuOTc1IEM2NS43NTQsMTAxLjk3NSA2NS44NDIsMTAxLjk3NyA2NS45MywxMDEuOTgxIEM2Ny4xOTYsMTAyLjAzNyA2OC4yODMsMTAyLjQ2OSA2OC44MzgsMTAzLjEzOSBDNjkuMDY1LDEwMy40MTMgNjkuMTg4LDEwMy43MTQgNjkuMTk4LDEwNC4wMjEgTDE0Ny44ODMsNTguNTkyIEMxNDcuODQ3LDU4LjU5MiAxNDcuODExLDU4LjU5MSAxNDcuNzc2LDU4LjU4OSBDMTQ2LjUwOSw1OC41MzMgMTQ1LjQyMiw1OC4xIDE0NC44NjcsNTcuNDMxIEMxNDQuNTg1LDU3LjA5MSAxNDQuNDY1LDU2LjcwNyAxNDQuNTIsNTYuMzI0IEMxNDQuNTYzLDU2LjAyMSAxNDQuNTUyLDU1LjcxNiAxNDQuNDg4LDU1LjQxNCBMNjMuODQ2LDEwMS45NyBDNjQuMzUzLDEwMi4wMDIgNjQuODY3LDEwMi4wMDYgNjUuMzc0LDEwMS45ODIgQzY1LjQ3MSwxMDEuOTc3IDY1LjU2OCwxMDEuOTc1IDY1LjY2NSwxMDEuOTc1IEw2NS42NjUsMTAxLjk3NSBaIiBpZD0iRmlsbC01IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTIuMjA4LDU1LjEzNCBDMS4yMDcsNTMuMzA3IDEuOTY3LDUwLjkxNyAzLjkwNiw0OS43OTcgTDU5LjkxNywxNy40NTMgQzYxLjg1NiwxNi4zMzMgNjQuMjQxLDE2LjkwNyA2NS4yNDMsMTguNzM0IEw2NS40NzUsMTkuMTQ0IEM2NS44NzIsMTkuODgyIDY2LjM2OCwyMC41NiA2Ni45NDUsMjEuMTY1IEw2Ny4yMjMsMjEuNDM1IEM3MC41NDgsMjQuNjQ5IDc1LjgwNiwyNS4xNTEgODAuMTExLDIyLjY2NSBMODcuNDMsMTguNDQ1IEM4OS4zNywxNy4zMjYgOTEuNzU0LDE3Ljg5OSA5Mi43NTUsMTkuNzI3IEw5Ni4wMDUsMjUuNjU1IEwxMi40ODYsNzMuODg0IEwyLjIwOCw1NS4xMzQgWiIgaWQ9IkZpbGwtNiIgZmlsbD0iI0ZBRkFGQSI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMi40ODYsNzQuMDAxIEMxMi40NzYsNzQuMDAxIDEyLjQ2NSw3My45OTkgMTIuNDU1LDczLjk5NiBDMTIuNDI0LDczLjk4OCAxMi4zOTksNzMuOTY3IDEyLjM4NCw3My45NCBMMi4xMDYsNTUuMTkgQzEuMDc1LDUzLjMxIDEuODU3LDUwLjg0NSAzLjg0OCw0OS42OTYgTDU5Ljg1OCwxNy4zNTIgQzYwLjUyNSwxNi45NjcgNjEuMjcxLDE2Ljc2NCA2Mi4wMTYsMTYuNzY0IEM2My40MzEsMTYuNzY0IDY0LjY2NiwxNy40NjYgNjUuMzI3LDE4LjY0NiBDNjUuMzM3LDE4LjY1NCA2NS4zNDUsMTguNjYzIDY1LjM1MSwxOC42NzQgTDY1LjU3OCwxOS4wODggQzY1LjU4NCwxOS4xIDY1LjU4OSwxOS4xMTIgNjUuNTkxLDE5LjEyNiBDNjUuOTg1LDE5LjgzOCA2Ni40NjksMjAuNDk3IDY3LjAzLDIxLjA4NSBMNjcuMzA1LDIxLjM1MSBDNjkuMTUxLDIzLjEzNyA3MS42NDksMjQuMTIgNzQuMzM2LDI0LjEyIEM3Ni4zMTMsMjQuMTIgNzguMjksMjMuNTgyIDgwLjA1MywyMi41NjMgQzgwLjA2NCwyMi41NTcgODAuMDc2LDIyLjU1MyA4MC4wODgsMjIuNTUgTDg3LjM3MiwxOC4zNDQgQzg4LjAzOCwxNy45NTkgODguNzg0LDE3Ljc1NiA4OS41MjksMTcuNzU2IEM5MC45NTYsMTcuNzU2IDkyLjIwMSwxOC40NzIgOTIuODU4LDE5LjY3IEw5Ni4xMDcsMjUuNTk5IEM5Ni4xMzgsMjUuNjU0IDk2LjExOCwyNS43MjQgOTYuMDYzLDI1Ljc1NiBMMTIuNTQ1LDczLjk4NSBDMTIuNTI2LDczLjk5NiAxMi41MDYsNzQuMDAxIDEyLjQ4Niw3NC4wMDEgTDEyLjQ4Niw3NC4wMDEgWiBNNjIuMDE2LDE2Ljk5NyBDNjEuMzEyLDE2Ljk5NyA2MC42MDYsMTcuMTkgNTkuOTc1LDE3LjU1NCBMMy45NjUsNDkuODk5IEMyLjA4Myw1MC45ODUgMS4zNDEsNTMuMzA4IDIuMzEsNTUuMDc4IEwxMi41MzEsNzMuNzIzIEw5NS44NDgsMjUuNjExIEw5Mi42NTMsMTkuNzgyIEM5Mi4wMzgsMTguNjYgOTAuODcsMTcuOTkgODkuNTI5LDE3Ljk5IEM4OC44MjUsMTcuOTkgODguMTE5LDE4LjE4MiA4Ny40ODksMTguNTQ3IEw4MC4xNzIsMjIuNzcyIEM4MC4xNjEsMjIuNzc4IDgwLjE0OSwyMi43ODIgODAuMTM3LDIyLjc4NSBDNzguMzQ2LDIzLjgxMSA3Ni4zNDEsMjQuMzU0IDc0LjMzNiwyNC4zNTQgQzcxLjU4OCwyNC4zNTQgNjkuMDMzLDIzLjM0NyA2Ny4xNDIsMjEuNTE5IEw2Ni44NjQsMjEuMjQ5IEM2Ni4yNzcsMjAuNjM0IDY1Ljc3NCwxOS45NDcgNjUuMzY3LDE5LjIwMyBDNjUuMzYsMTkuMTkyIDY1LjM1NiwxOS4xNzkgNjUuMzU0LDE5LjE2NiBMNjUuMTYzLDE4LjgxOSBDNjUuMTU0LDE4LjgxMSA2NS4xNDYsMTguODAxIDY1LjE0LDE4Ljc5IEM2NC41MjUsMTcuNjY3IDYzLjM1NywxNi45OTcgNjIuMDE2LDE2Ljk5NyBMNjIuMDE2LDE2Ljk5NyBaIiBpZD0iRmlsbC03IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTQyLjQzNCw0OC44MDggTDQyLjQzNCw0OC44MDggQzM5LjkyNCw0OC44MDcgMzcuNzM3LDQ3LjU1IDM2LjU4Miw0NS40NDMgQzM0Ljc3MSw0Mi4xMzkgMzYuMTQ0LDM3LjgwOSAzOS42NDEsMzUuNzg5IEw1MS45MzIsMjguNjkxIEM1My4xMDMsMjguMDE1IDU0LjQxMywyNy42NTggNTUuNzIxLDI3LjY1OCBDNTguMjMxLDI3LjY1OCA2MC40MTgsMjguOTE2IDYxLjU3MywzMS4wMjMgQzYzLjM4NCwzNC4zMjcgNjIuMDEyLDM4LjY1NyA1OC41MTQsNDAuNjc3IEw0Ni4yMjMsNDcuNzc1IEM0NS4wNTMsNDguNDUgNDMuNzQyLDQ4LjgwOCA0Mi40MzQsNDguODA4IEw0Mi40MzQsNDguODA4IFogTTU1LjcyMSwyOC4xMjUgQzU0LjQ5NSwyOC4xMjUgNTMuMjY1LDI4LjQ2MSA1Mi4xNjYsMjkuMDk2IEwzOS44NzUsMzYuMTk0IEMzNi41OTYsMzguMDg3IDM1LjMwMiw0Mi4xMzYgMzYuOTkyLDQ1LjIxOCBDMzguMDYzLDQ3LjE3MyA0MC4wOTgsNDguMzQgNDIuNDM0LDQ4LjM0IEM0My42NjEsNDguMzQgNDQuODksNDguMDA1IDQ1Ljk5LDQ3LjM3IEw1OC4yODEsNDAuMjcyIEM2MS41NiwzOC4zNzkgNjIuODUzLDM0LjMzIDYxLjE2NCwzMS4yNDggQzYwLjA5MiwyOS4yOTMgNTguMDU4LDI4LjEyNSA1NS43MjEsMjguMTI1IEw1NS43MjEsMjguMTI1IFoiIGlkPSJGaWxsLTgiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTQ5LjU4OCwyLjQwNyBDMTQ5LjU4OCwyLjQwNyAxNTUuNzY4LDUuOTc1IDE1Ni4zMjUsNi4yOTcgTDE1Ni4zMjUsNy4xODQgQzE1Ni4zMjUsNy4zNiAxNTYuMzM4LDcuNTQ0IDE1Ni4zNjIsNy43MzMgQzE1Ni4zNzMsNy44MTQgMTU2LjM4Miw3Ljg5NCAxNTYuMzksNy45NzUgQzE1Ni41Myw5LjM5IDE1Ny4zNjMsMTAuOTczIDE1OC40OTUsMTEuOTc0IEwxNjUuODkxLDE4LjUxOSBDMTY2LjA2OCwxOC42NzUgMTY2LjI0OSwxOC44MTQgMTY2LjQzMiwxOC45MzQgQzE2OC4wMTEsMTkuOTc0IDE2OS4zODIsMTkuNCAxNjkuNDk0LDE3LjY1MiBDMTY5LjU0MywxNi44NjggMTY5LjU1MSwxNi4wNTcgMTY5LjUxNywxNS4yMjMgTDE2OS41MTQsMTUuMDYzIEwxNjkuNTE0LDEzLjkxMiBDMTcwLjc4LDE0LjY0MiAxOTUuNTAxLDI4LjkxNSAxOTUuNTAxLDI4LjkxNSBMMTk1LjUwMSw4Mi45MTUgQzE5NS41MDEsODQuMDA1IDE5NC43MzEsODQuNDQ1IDE5My43ODEsODMuODk3IEwxNTEuMzA4LDU5LjM3NCBDMTUwLjM1OCw1OC44MjYgMTQ5LjU4OCw1Ny40OTcgMTQ5LjU4OCw1Ni40MDggTDE0OS41ODgsMjIuMzc1IiBpZD0iRmlsbC05IiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE5NC41NTMsODQuMjUgQzE5NC4yOTYsODQuMjUgMTk0LjAxMyw4NC4xNjUgMTkzLjcyMiw4My45OTcgTDE1MS4yNSw1OS40NzYgQzE1MC4yNjksNTguOTA5IDE0OS40NzEsNTcuNTMzIDE0OS40NzEsNTYuNDA4IEwxNDkuNDcxLDIyLjM3NSBMMTQ5LjcwNSwyMi4zNzUgTDE0OS43MDUsNTYuNDA4IEMxNDkuNzA1LDU3LjQ1OSAxNTAuNDUsNTguNzQ0IDE1MS4zNjYsNTkuMjc0IEwxOTMuODM5LDgzLjc5NSBDMTk0LjI2Myw4NC4wNCAxOTQuNjU1LDg0LjA4MyAxOTQuOTQyLDgzLjkxNyBDMTk1LjIyNyw4My43NTMgMTk1LjM4NCw4My4zOTcgMTk1LjM4NCw4Mi45MTUgTDE5NS4zODQsMjguOTgyIEMxOTQuMTAyLDI4LjI0MiAxNzIuMTA0LDE1LjU0MiAxNjkuNjMxLDE0LjExNCBMMTY5LjYzNCwxNS4yMiBDMTY5LjY2OCwxNi4wNTIgMTY5LjY2LDE2Ljg3NCAxNjkuNjEsMTcuNjU5IEMxNjkuNTU2LDE4LjUwMyAxNjkuMjE0LDE5LjEyMyAxNjguNjQ3LDE5LjQwNSBDMTY4LjAyOCwxOS43MTQgMTY3LjE5NywxOS41NzggMTY2LjM2NywxOS4wMzIgQzE2Ni4xODEsMTguOTA5IDE2NS45OTUsMTguNzY2IDE2NS44MTQsMTguNjA2IEwxNTguNDE3LDEyLjA2MiBDMTU3LjI1OSwxMS4wMzYgMTU2LjQxOCw5LjQzNyAxNTYuMjc0LDcuOTg2IEMxNTYuMjY2LDcuOTA3IDE1Ni4yNTcsNy44MjcgMTU2LjI0Nyw3Ljc0OCBDMTU2LjIyMSw3LjU1NSAxNTYuMjA5LDcuMzY1IDE1Ni4yMDksNy4xODQgTDE1Ni4yMDksNi4zNjQgQzE1NS4zNzUsNS44ODMgMTQ5LjUyOSwyLjUwOCAxNDkuNTI5LDIuNTA4IEwxNDkuNjQ2LDIuMzA2IEMxNDkuNjQ2LDIuMzA2IDE1NS44MjcsNS44NzQgMTU2LjM4NCw2LjE5NiBMMTU2LjQ0Miw2LjIzIEwxNTYuNDQyLDcuMTg0IEMxNTYuNDQyLDcuMzU1IDE1Ni40NTQsNy41MzUgMTU2LjQ3OCw3LjcxNyBDMTU2LjQ4OSw3LjggMTU2LjQ5OSw3Ljg4MiAxNTYuNTA3LDcuOTYzIEMxNTYuNjQ1LDkuMzU4IDE1Ny40NTUsMTAuODk4IDE1OC41NzIsMTEuODg2IEwxNjUuOTY5LDE4LjQzMSBDMTY2LjE0MiwxOC41ODQgMTY2LjMxOSwxOC43MiAxNjYuNDk2LDE4LjgzNyBDMTY3LjI1NCwxOS4zMzYgMTY4LDE5LjQ2NyAxNjguNTQzLDE5LjE5NiBDMTY5LjAzMywxOC45NTMgMTY5LjMyOSwxOC40MDEgMTY5LjM3NywxNy42NDUgQzE2OS40MjcsMTYuODY3IDE2OS40MzQsMTYuMDU0IDE2OS40MDEsMTUuMjI4IEwxNjkuMzk3LDE1LjA2NSBMMTY5LjM5NywxMy43MSBMMTY5LjU3MiwxMy44MSBDMTcwLjgzOSwxNC41NDEgMTk1LjU1OSwyOC44MTQgMTk1LjU1OSwyOC44MTQgTDE5NS42MTgsMjguODQ3IEwxOTUuNjE4LDgyLjkxNSBDMTk1LjYxOCw4My40ODQgMTk1LjQyLDgzLjkxMSAxOTUuMDU5LDg0LjExOSBDMTk0LjkwOCw4NC4yMDYgMTk0LjczNyw4NC4yNSAxOTQuNTUzLDg0LjI1IiBpZD0iRmlsbC0xMCIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNDUuNjg1LDU2LjE2MSBMMTY5LjgsNzAuMDgzIEwxNDMuODIyLDg1LjA4MSBMMTQyLjM2LDg0Ljc3NCBDMTM1LjgyNiw4Mi42MDQgMTI4LjczMiw4MS4wNDYgMTIxLjM0MSw4MC4xNTggQzExNi45NzYsNzkuNjM0IDExMi42NzgsODEuMjU0IDExMS43NDMsODMuNzc4IEMxMTEuNTA2LDg0LjQxNCAxMTEuNTAzLDg1LjA3MSAxMTEuNzMyLDg1LjcwNiBDMTEzLjI3LDg5Ljk3MyAxMTUuOTY4LDk0LjA2OSAxMTkuNzI3LDk3Ljg0MSBMMTIwLjI1OSw5OC42ODYgQzEyMC4yNiw5OC42ODUgOTQuMjgyLDExMy42ODMgOTQuMjgyLDExMy42ODMgTDcwLjE2Nyw5OS43NjEgTDE0NS42ODUsNTYuMTYxIiBpZD0iRmlsbC0xMSIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik05NC4yODIsMTEzLjgxOCBMOTQuMjIzLDExMy43ODUgTDY5LjkzMyw5OS43NjEgTDcwLjEwOCw5OS42NiBMMTQ1LjY4NSw1Ni4wMjYgTDE0NS43NDMsNTYuMDU5IEwxNzAuMDMzLDcwLjA4MyBMMTQzLjg0Miw4NS4yMDUgTDE0My43OTcsODUuMTk1IEMxNDMuNzcyLDg1LjE5IDE0Mi4zMzYsODQuODg4IDE0Mi4zMzYsODQuODg4IEMxMzUuNzg3LDgyLjcxNCAxMjguNzIzLDgxLjE2MyAxMjEuMzI3LDgwLjI3NCBDMTIwLjc4OCw4MC4yMDkgMTIwLjIzNiw4MC4xNzcgMTE5LjY4OSw4MC4xNzcgQzExNS45MzEsODAuMTc3IDExMi42MzUsODEuNzA4IDExMS44NTIsODMuODE5IEMxMTEuNjI0LDg0LjQzMiAxMTEuNjIxLDg1LjA1MyAxMTEuODQyLDg1LjY2NyBDMTEzLjM3Nyw4OS45MjUgMTE2LjA1OCw5My45OTMgMTE5LjgxLDk3Ljc1OCBMMTE5LjgyNiw5Ny43NzkgTDEyMC4zNTIsOTguNjE0IEMxMjAuMzU0LDk4LjYxNyAxMjAuMzU2LDk4LjYyIDEyMC4zNTgsOTguNjI0IEwxMjAuNDIyLDk4LjcyNiBMMTIwLjMxNyw5OC43ODcgQzEyMC4yNjQsOTguODE4IDk0LjU5OSwxMTMuNjM1IDk0LjM0LDExMy43ODUgTDk0LjI4MiwxMTMuODE4IEw5NC4yODIsMTEzLjgxOCBaIE03MC40MDEsOTkuNzYxIEw5NC4yODIsMTEzLjU0OSBMMTE5LjA4NCw5OS4yMjkgQzExOS42Myw5OC45MTQgMTE5LjkzLDk4Ljc0IDEyMC4xMDEsOTguNjU0IEwxMTkuNjM1LDk3LjkxNCBDMTE1Ljg2NCw5NC4xMjcgMTEzLjE2OCw5MC4wMzMgMTExLjYyMiw4NS43NDYgQzExMS4zODIsODUuMDc5IDExMS4zODYsODQuNDA0IDExMS42MzMsODMuNzM4IEMxMTIuNDQ4LDgxLjUzOSAxMTUuODM2LDc5Ljk0MyAxMTkuNjg5LDc5Ljk0MyBDMTIwLjI0Niw3OS45NDMgMTIwLjgwNiw3OS45NzYgMTIxLjM1NSw4MC4wNDIgQzEyOC43NjcsODAuOTMzIDEzNS44NDYsODIuNDg3IDE0Mi4zOTYsODQuNjYzIEMxNDMuMjMyLDg0LjgzOCAxNDMuNjExLDg0LjkxNyAxNDMuNzg2LDg0Ljk2NyBMMTY5LjU2Niw3MC4wODMgTDE0NS42ODUsNTYuMjk1IEw3MC40MDEsOTkuNzYxIEw3MC40MDEsOTkuNzYxIFoiIGlkPSJGaWxsLTEyIiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE2Ny4yMywxOC45NzkgTDE2Ny4yMyw2OS44NSBMMTM5LjkwOSw4NS42MjMgTDEzMy40NDgsNzEuNDU2IEMxMzIuNTM4LDY5LjQ2IDEzMC4wMiw2OS43MTggMTI3LjgyNCw3Mi4wMyBDMTI2Ljc2OSw3My4xNCAxMjUuOTMxLDc0LjU4NSAxMjUuNDk0LDc2LjA0OCBMMTE5LjAzNCw5Ny42NzYgTDkxLjcxMiwxMTMuNDUgTDkxLjcxMiw2Mi41NzkgTDE2Ny4yMywxOC45NzkiIGlkPSJGaWxsLTEzIiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTkxLjcxMiwxMTMuNTY3IEM5MS42OTIsMTEzLjU2NyA5MS42NzIsMTEzLjU2MSA5MS42NTMsMTEzLjU1MSBDOTEuNjE4LDExMy41MyA5MS41OTUsMTEzLjQ5MiA5MS41OTUsMTEzLjQ1IEw5MS41OTUsNjIuNTc5IEM5MS41OTUsNjIuNTM3IDkxLjYxOCw2Mi40OTkgOTEuNjUzLDYyLjQ3OCBMMTY3LjE3MiwxOC44NzggQzE2Ny4yMDgsMTguODU3IDE2Ny4yNTIsMTguODU3IDE2Ny4yODgsMTguODc4IEMxNjcuMzI0LDE4Ljg5OSAxNjcuMzQ3LDE4LjkzNyAxNjcuMzQ3LDE4Ljk3OSBMMTY3LjM0Nyw2OS44NSBDMTY3LjM0Nyw2OS44OTEgMTY3LjMyNCw2OS45MyAxNjcuMjg4LDY5Ljk1IEwxMzkuOTY3LDg1LjcyNSBDMTM5LjkzOSw4NS43NDEgMTM5LjkwNSw4NS43NDUgMTM5Ljg3Myw4NS43MzUgQzEzOS44NDIsODUuNzI1IDEzOS44MTYsODUuNzAyIDEzOS44MDIsODUuNjcyIEwxMzMuMzQyLDcxLjUwNCBDMTMyLjk2Nyw3MC42ODIgMTMyLjI4LDcwLjIyOSAxMzEuNDA4LDcwLjIyOSBDMTMwLjMxOSw3MC4yMjkgMTI5LjA0NCw3MC45MTUgMTI3LjkwOCw3Mi4xMSBDMTI2Ljg3NCw3My4yIDEyNi4wMzQsNzQuNjQ3IDEyNS42MDYsNzYuMDgyIEwxMTkuMTQ2LDk3LjcwOSBDMTE5LjEzNyw5Ny43MzggMTE5LjExOCw5Ny43NjIgMTE5LjA5Miw5Ny43NzcgTDkxLjc3LDExMy41NTEgQzkxLjc1MiwxMTMuNTYxIDkxLjczMiwxMTMuNTY3IDkxLjcxMiwxMTMuNTY3IEw5MS43MTIsMTEzLjU2NyBaIE05MS44MjksNjIuNjQ3IEw5MS44MjksMTEzLjI0OCBMMTE4LjkzNSw5Ny41OTggTDEyNS4zODIsNzYuMDE1IEMxMjUuODI3LDc0LjUyNSAxMjYuNjY0LDczLjA4MSAxMjcuNzM5LDcxLjk1IEMxMjguOTE5LDcwLjcwOCAxMzAuMjU2LDY5Ljk5NiAxMzEuNDA4LDY5Ljk5NiBDMTMyLjM3Nyw2OS45OTYgMTMzLjEzOSw3MC40OTcgMTMzLjU1NCw3MS40MDcgTDEzOS45NjEsODUuNDU4IEwxNjcuMTEzLDY5Ljc4MiBMMTY3LjExMywxOS4xODEgTDkxLjgyOSw2Mi42NDcgTDkxLjgyOSw2Mi42NDcgWiIgaWQ9IkZpbGwtMTQiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTY4LjU0MywxOS4yMTMgTDE2OC41NDMsNzAuMDgzIEwxNDEuMjIxLDg1Ljg1NyBMMTM0Ljc2MSw3MS42ODkgQzEzMy44NTEsNjkuNjk0IDEzMS4zMzMsNjkuOTUxIDEyOS4xMzcsNzIuMjYzIEMxMjguMDgyLDczLjM3NCAxMjcuMjQ0LDc0LjgxOSAxMjYuODA3LDc2LjI4MiBMMTIwLjM0Niw5Ny45MDkgTDkzLjAyNSwxMTMuNjgzIEw5My4wMjUsNjIuODEzIEwxNjguNTQzLDE5LjIxMyIgaWQ9IkZpbGwtMTUiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNOTMuMDI1LDExMy44IEM5My4wMDUsMTEzLjggOTIuOTg0LDExMy43OTUgOTIuOTY2LDExMy43ODUgQzkyLjkzMSwxMTMuNzY0IDkyLjkwOCwxMTMuNzI1IDkyLjkwOCwxMTMuNjg0IEw5Mi45MDgsNjIuODEzIEM5Mi45MDgsNjIuNzcxIDkyLjkzMSw2Mi43MzMgOTIuOTY2LDYyLjcxMiBMMTY4LjQ4NCwxOS4xMTIgQzE2OC41MiwxOS4wOSAxNjguNTY1LDE5LjA5IDE2OC42MDEsMTkuMTEyIEMxNjguNjM3LDE5LjEzMiAxNjguNjYsMTkuMTcxIDE2OC42NiwxOS4yMTIgTDE2OC42Niw3MC4wODMgQzE2OC42Niw3MC4xMjUgMTY4LjYzNyw3MC4xNjQgMTY4LjYwMSw3MC4xODQgTDE0MS4yOCw4NS45NTggQzE0MS4yNTEsODUuOTc1IDE0MS4yMTcsODUuOTc5IDE0MS4xODYsODUuOTY4IEMxNDEuMTU0LDg1Ljk1OCAxNDEuMTI5LDg1LjkzNiAxNDEuMTE1LDg1LjkwNiBMMTM0LjY1NSw3MS43MzggQzEzNC4yOCw3MC45MTUgMTMzLjU5Myw3MC40NjMgMTMyLjcyLDcwLjQ2MyBDMTMxLjYzMiw3MC40NjMgMTMwLjM1Nyw3MS4xNDggMTI5LjIyMSw3Mi4zNDQgQzEyOC4xODYsNzMuNDMzIDEyNy4zNDcsNzQuODgxIDEyNi45MTksNzYuMzE1IEwxMjAuNDU4LDk3Ljk0MyBDMTIwLjQ1LDk3Ljk3MiAxMjAuNDMxLDk3Ljk5NiAxMjAuNDA1LDk4LjAxIEw5My4wODMsMTEzLjc4NSBDOTMuMDY1LDExMy43OTUgOTMuMDQ1LDExMy44IDkzLjAyNSwxMTMuOCBMOTMuMDI1LDExMy44IFogTTkzLjE0Miw2Mi44ODEgTDkzLjE0MiwxMTMuNDgxIEwxMjAuMjQ4LDk3LjgzMiBMMTI2LjY5NSw3Ni4yNDggQzEyNy4xNCw3NC43NTggMTI3Ljk3Nyw3My4zMTUgMTI5LjA1Miw3Mi4xODMgQzEzMC4yMzEsNzAuOTQyIDEzMS41NjgsNzAuMjI5IDEzMi43Miw3MC4yMjkgQzEzMy42ODksNzAuMjI5IDEzNC40NTIsNzAuNzMxIDEzNC44NjcsNzEuNjQxIEwxNDEuMjc0LDg1LjY5MiBMMTY4LjQyNiw3MC4wMTYgTDE2OC40MjYsMTkuNDE1IEw5My4xNDIsNjIuODgxIEw5My4xNDIsNjIuODgxIFoiIGlkPSJGaWxsLTE2IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE2OS44LDcwLjA4MyBMMTQyLjQ3OCw4NS44NTcgTDEzNi4wMTgsNzEuNjg5IEMxMzUuMTA4LDY5LjY5NCAxMzIuNTksNjkuOTUxIDEzMC4zOTMsNzIuMjYzIEMxMjkuMzM5LDczLjM3NCAxMjguNSw3NC44MTkgMTI4LjA2NCw3Ni4yODIgTDEyMS42MDMsOTcuOTA5IEw5NC4yODIsMTEzLjY4MyBMOTQuMjgyLDYyLjgxMyBMMTY5LjgsMTkuMjEzIEwxNjkuOCw3MC4wODMgWiIgaWQ9IkZpbGwtMTciIGZpbGw9IiNGQUZBRkEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNOTQuMjgyLDExMy45MTcgQzk0LjI0MSwxMTMuOTE3IDk0LjIwMSwxMTMuOTA3IDk0LjE2NSwxMTMuODg2IEM5NC4wOTMsMTEzLjg0NSA5NC4wNDgsMTEzLjc2NyA5NC4wNDgsMTEzLjY4NCBMOTQuMDQ4LDYyLjgxMyBDOTQuMDQ4LDYyLjczIDk0LjA5Myw2Mi42NTIgOTQuMTY1LDYyLjYxMSBMMTY5LjY4MywxOS4wMSBDMTY5Ljc1NSwxOC45NjkgMTY5Ljg0NCwxOC45NjkgMTY5LjkxNywxOS4wMSBDMTY5Ljk4OSwxOS4wNTIgMTcwLjAzMywxOS4xMjkgMTcwLjAzMywxOS4yMTIgTDE3MC4wMzMsNzAuMDgzIEMxNzAuMDMzLDcwLjE2NiAxNjkuOTg5LDcwLjI0NCAxNjkuOTE3LDcwLjI4NSBMMTQyLjU5NSw4Ni4wNiBDMTQyLjUzOCw4Ni4wOTIgMTQyLjQ2OSw4Ni4xIDE0Mi40MDcsODYuMDggQzE0Mi4zNDQsODYuMDYgMTQyLjI5Myw4Ni4wMTQgMTQyLjI2Niw4NS45NTQgTDEzNS44MDUsNzEuNzg2IEMxMzUuNDQ1LDcwLjk5NyAxMzQuODEzLDcwLjU4IDEzMy45NzcsNzAuNTggQzEzMi45MjEsNzAuNTggMTMxLjY3Niw3MS4yNTIgMTMwLjU2Miw3Mi40MjQgQzEyOS41NCw3My41MDEgMTI4LjcxMSw3NC45MzEgMTI4LjI4Nyw3Ni4zNDggTDEyMS44MjcsOTcuOTc2IEMxMjEuODEsOTguMDM0IDEyMS43NzEsOTguMDgyIDEyMS43Miw5OC4xMTIgTDk0LjM5OCwxMTMuODg2IEM5NC4zNjIsMTEzLjkwNyA5NC4zMjIsMTEzLjkxNyA5NC4yODIsMTEzLjkxNyBMOTQuMjgyLDExMy45MTcgWiBNOTQuNTE1LDYyLjk0OCBMOTQuNTE1LDExMy4yNzkgTDEyMS40MDYsOTcuNzU0IEwxMjcuODQsNzYuMjE1IEMxMjguMjksNzQuNzA4IDEyOS4xMzcsNzMuMjQ3IDEzMC4yMjQsNzIuMTAzIEMxMzEuNDI1LDcwLjgzOCAxMzIuNzkzLDcwLjExMiAxMzMuOTc3LDcwLjExMiBDMTM0Ljk5NSw3MC4xMTIgMTM1Ljc5NSw3MC42MzggMTM2LjIzLDcxLjU5MiBMMTQyLjU4NCw4NS41MjYgTDE2OS41NjYsNjkuOTQ4IEwxNjkuNTY2LDE5LjYxNyBMOTQuNTE1LDYyLjk0OCBMOTQuNTE1LDYyLjk0OCBaIiBpZD0iRmlsbC0xOCIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMDkuODk0LDkyLjk0MyBMMTA5Ljg5NCw5Mi45NDMgQzEwOC4xMiw5Mi45NDMgMTA2LjY1Myw5Mi4yMTggMTA1LjY1LDkwLjgyMyBDMTA1LjU4Myw5MC43MzEgMTA1LjU5Myw5MC42MSAxMDUuNjczLDkwLjUyOSBDMTA1Ljc1Myw5MC40NDggMTA1Ljg4LDkwLjQ0IDEwNS45NzQsOTAuNTA2IEMxMDYuNzU0LDkxLjA1MyAxMDcuNjc5LDkxLjMzMyAxMDguNzI0LDkxLjMzMyBDMTEwLjA0Nyw5MS4zMzMgMTExLjQ3OCw5MC44OTQgMTEyLjk4LDkwLjAyNyBDMTE4LjI5MSw4Ni45NiAxMjIuNjExLDc5LjUwOSAxMjIuNjExLDczLjQxNiBDMTIyLjYxMSw3MS40ODkgMTIyLjE2OSw2OS44NTYgMTIxLjMzMyw2OC42OTIgQzEyMS4yNjYsNjguNiAxMjEuMjc2LDY4LjQ3MyAxMjEuMzU2LDY4LjM5MiBDMTIxLjQzNiw2OC4zMTEgMTIxLjU2Myw2OC4yOTkgMTIxLjY1Niw2OC4zNjUgQzEyMy4zMjcsNjkuNTM3IDEyNC4yNDcsNzEuNzQ2IDEyNC4yNDcsNzQuNTg0IEMxMjQuMjQ3LDgwLjgyNiAxMTkuODIxLDg4LjQ0NyAxMTQuMzgyLDkxLjU4NyBDMTEyLjgwOCw5Mi40OTUgMTExLjI5OCw5Mi45NDMgMTA5Ljg5NCw5Mi45NDMgTDEwOS44OTQsOTIuOTQzIFogTTEwNi45MjUsOTEuNDAxIEMxMDcuNzM4LDkyLjA1MiAxMDguNzQ1LDkyLjI3OCAxMDkuODkzLDkyLjI3OCBMMTA5Ljg5NCw5Mi4yNzggQzExMS4yMTUsOTIuMjc4IDExMi42NDcsOTEuOTUxIDExNC4xNDgsOTEuMDg0IEMxMTkuNDU5LDg4LjAxNyAxMjMuNzgsODAuNjIxIDEyMy43OCw3NC41MjggQzEyMy43OCw3Mi41NDkgMTIzLjMxNyw3MC45MjkgMTIyLjQ1NCw2OS43NjcgQzEyMi44NjUsNzAuODAyIDEyMy4wNzksNzIuMDQyIDEyMy4wNzksNzMuNDAyIEMxMjMuMDc5LDc5LjY0NSAxMTguNjUzLDg3LjI4NSAxMTMuMjE0LDkwLjQyNSBDMTExLjY0LDkxLjMzNCAxMTAuMTMsOTEuNzQyIDEwOC43MjQsOTEuNzQyIEMxMDguMDgzLDkxLjc0MiAxMDcuNDgxLDkxLjU5MyAxMDYuOTI1LDkxLjQwMSBMMTA2LjkyNSw5MS40MDEgWiIgaWQ9IkZpbGwtMTkiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEzLjA5Nyw5MC4yMyBDMTE4LjQ4MSw4Ny4xMjIgMTIyLjg0NSw3OS41OTQgMTIyLjg0NSw3My40MTYgQzEyMi44NDUsNzEuMzY1IDEyMi4zNjIsNjkuNzI0IDEyMS41MjIsNjguNTU2IEMxMTkuNzM4LDY3LjMwNCAxMTcuMTQ4LDY3LjM2MiAxMTQuMjY1LDY5LjAyNiBDMTA4Ljg4MSw3Mi4xMzQgMTA0LjUxNyw3OS42NjIgMTA0LjUxNyw4NS44NCBDMTA0LjUxNyw4Ny44OTEgMTA1LDg5LjUzMiAxMDUuODQsOTAuNyBDMTA3LjYyNCw5MS45NTIgMTEwLjIxNCw5MS44OTQgMTEzLjA5Nyw5MC4yMyIgaWQ9IkZpbGwtMjAiIGZpbGw9IiNGQUZBRkEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTA4LjcyNCw5MS42MTQgTDEwOC43MjQsOTEuNjE0IEMxMDcuNTgyLDkxLjYxNCAxMDYuNTY2LDkxLjQwMSAxMDUuNzA1LDkwLjc5NyBDMTA1LjY4NCw5MC43ODMgMTA1LjY2NSw5MC44MTEgMTA1LjY1LDkwLjc5IEMxMDQuNzU2LDg5LjU0NiAxMDQuMjgzLDg3Ljg0MiAxMDQuMjgzLDg1LjgxNyBDMTA0LjI4Myw3OS41NzUgMTA4LjcwOSw3MS45NTMgMTE0LjE0OCw2OC44MTIgQzExNS43MjIsNjcuOTA0IDExNy4yMzIsNjcuNDQ5IDExOC42MzgsNjcuNDQ5IEMxMTkuNzgsNjcuNDQ5IDEyMC43OTYsNjcuNzU4IDEyMS42NTYsNjguMzYyIEMxMjEuNjc4LDY4LjM3NyAxMjEuNjk3LDY4LjM5NyAxMjEuNzEyLDY4LjQxOCBDMTIyLjYwNiw2OS42NjIgMTIzLjA3OSw3MS4zOSAxMjMuMDc5LDczLjQxNSBDMTIzLjA3OSw3OS42NTggMTE4LjY1Myw4Ny4xOTggMTEzLjIxNCw5MC4zMzggQzExMS42NCw5MS4yNDcgMTEwLjEzLDkxLjYxNCAxMDguNzI0LDkxLjYxNCBMMTA4LjcyNCw5MS42MTQgWiBNMTA2LjAwNiw5MC41MDUgQzEwNi43OCw5MS4wMzcgMTA3LjY5NCw5MS4yODEgMTA4LjcyNCw5MS4yODEgQzExMC4wNDcsOTEuMjgxIDExMS40NzgsOTAuODY4IDExMi45OCw5MC4wMDEgQzExOC4yOTEsODYuOTM1IDEyMi42MTEsNzkuNDk2IDEyMi42MTEsNzMuNDAzIEMxMjIuNjExLDcxLjQ5NCAxMjIuMTc3LDY5Ljg4IDEyMS4zNTYsNjguNzE4IEMxMjAuNTgyLDY4LjE4NSAxMTkuNjY4LDY3LjkxOSAxMTguNjM4LDY3LjkxOSBDMTE3LjMxNSw2Ny45MTkgMTE1Ljg4Myw2OC4zNiAxMTQuMzgyLDY5LjIyNyBDMTA5LjA3MSw3Mi4yOTMgMTA0Ljc1MSw3OS43MzMgMTA0Ljc1MSw4NS44MjYgQzEwNC43NTEsODcuNzM1IDEwNS4xODUsODkuMzQzIDEwNi4wMDYsOTAuNTA1IEwxMDYuMDA2LDkwLjUwNSBaIiBpZD0iRmlsbC0yMSIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNDkuMzE4LDcuMjYyIEwxMzkuMzM0LDE2LjE0IEwxNTUuMjI3LDI3LjE3MSBMMTYwLjgxNiwyMS4wNTkgTDE0OS4zMTgsNy4yNjIiIGlkPSJGaWxsLTIyIiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE2OS42NzYsMTMuODQgTDE1OS45MjgsMTkuNDY3IEMxNTYuMjg2LDIxLjU3IDE1MC40LDIxLjU4IDE0Ni43ODEsMTkuNDkxIEMxNDMuMTYxLDE3LjQwMiAxNDMuMTgsMTQuMDAzIDE0Ni44MjIsMTEuOSBMMTU2LjMxNyw2LjI5MiBMMTQ5LjU4OCwyLjQwNyBMNjcuNzUyLDQ5LjQ3OCBMMTEzLjY3NSw3NS45OTIgTDExNi43NTYsNzQuMjEzIEMxMTcuMzg3LDczLjg0OCAxMTcuNjI1LDczLjMxNSAxMTcuMzc0LDcyLjgyMyBDMTE1LjAxNyw2OC4xOTEgMTE0Ljc4MSw2My4yNzcgMTE2LjY5MSw1OC41NjEgQzEyMi4zMjksNDQuNjQxIDE0MS4yLDMzLjc0NiAxNjUuMzA5LDMwLjQ5MSBDMTczLjQ3OCwyOS4zODggMTgxLjk4OSwyOS41MjQgMTkwLjAxMywzMC44ODUgQzE5MC44NjUsMzEuMDMgMTkxLjc4OSwzMC44OTMgMTkyLjQyLDMwLjUyOCBMMTk1LjUwMSwyOC43NSBMMTY5LjY3NiwxMy44NCIgaWQ9IkZpbGwtMjMiIGZpbGw9IiNGQUZBRkEiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEzLjY3NSw3Ni40NTkgQzExMy41OTQsNzYuNDU5IDExMy41MTQsNzYuNDM4IDExMy40NDIsNzYuMzk3IEw2Ny41MTgsNDkuODgyIEM2Ny4zNzQsNDkuNzk5IDY3LjI4NCw0OS42NDUgNjcuMjg1LDQ5LjQ3OCBDNjcuMjg1LDQ5LjMxMSA2Ny4zNzQsNDkuMTU3IDY3LjUxOSw0OS4wNzMgTDE0OS4zNTUsMi4wMDIgQzE0OS40OTksMS45MTkgMTQ5LjY3NywxLjkxOSAxNDkuODIxLDIuMDAyIEwxNTYuNTUsNS44ODcgQzE1Ni43NzQsNi4wMTcgMTU2Ljg1LDYuMzAyIDE1Ni43MjIsNi41MjYgQzE1Ni41OTIsNi43NDkgMTU2LjMwNyw2LjgyNiAxNTYuMDgzLDYuNjk2IEwxNDkuNTg3LDIuOTQ2IEw2OC42ODcsNDkuNDc5IEwxMTMuNjc1LDc1LjQ1MiBMMTE2LjUyMyw3My44MDggQzExNi43MTUsNzMuNjk3IDExNy4xNDMsNzMuMzk5IDExNi45NTgsNzMuMDM1IEMxMTQuNTQyLDY4LjI4NyAxMTQuMyw2My4yMjEgMTE2LjI1OCw1OC4zODUgQzExOS4wNjQsNTEuNDU4IDEyNS4xNDMsNDUuMTQzIDEzMy44NCw0MC4xMjIgQzE0Mi40OTcsMzUuMTI0IDE1My4zNTgsMzEuNjMzIDE2NS4yNDcsMzAuMDI4IEMxNzMuNDQ1LDI4LjkyMSAxODIuMDM3LDI5LjA1OCAxOTAuMDkxLDMwLjQyNSBDMTkwLjgzLDMwLjU1IDE5MS42NTIsMzAuNDMyIDE5Mi4xODYsMzAuMTI0IEwxOTQuNTY3LDI4Ljc1IEwxNjkuNDQyLDE0LjI0NCBDMTY5LjIxOSwxNC4xMTUgMTY5LjE0MiwxMy44MjkgMTY5LjI3MSwxMy42MDYgQzE2OS40LDEzLjM4MiAxNjkuNjg1LDEzLjMwNiAxNjkuOTA5LDEzLjQzNSBMMTk1LjczNCwyOC4zNDUgQzE5NS44NzksMjguNDI4IDE5NS45NjgsMjguNTgzIDE5NS45NjgsMjguNzUgQzE5NS45NjgsMjguOTE2IDE5NS44NzksMjkuMDcxIDE5NS43MzQsMjkuMTU0IEwxOTIuNjUzLDMwLjkzMyBDMTkxLjkzMiwzMS4zNSAxOTAuODksMzEuNTA4IDE4OS45MzUsMzEuMzQ2IEMxODEuOTcyLDI5Ljk5NSAxNzMuNDc4LDI5Ljg2IDE2NS4zNzIsMzAuOTU0IEMxNTMuNjAyLDMyLjU0MyAxNDIuODYsMzUuOTkzIDEzNC4zMDcsNDAuOTMxIEMxMjUuNzkzLDQ1Ljg0NyAxMTkuODUxLDUyLjAwNCAxMTcuMTI0LDU4LjczNiBDMTE1LjI3LDYzLjMxNCAxMTUuNTAxLDY4LjExMiAxMTcuNzksNzIuNjExIEMxMTguMTYsNzMuMzM2IDExNy44NDUsNzQuMTI0IDExNi45OSw3NC42MTcgTDExMy45MDksNzYuMzk3IEMxMTMuODM2LDc2LjQzOCAxMTMuNzU2LDc2LjQ1OSAxMTMuNjc1LDc2LjQ1OSIgaWQ9IkZpbGwtMjQiIGZpbGw9IiM0NTVBNjQiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTUzLjMxNiwyMS4yNzkgQzE1MC45MDMsMjEuMjc5IDE0OC40OTUsMjAuNzUxIDE0Ni42NjQsMTkuNjkzIEMxNDQuODQ2LDE4LjY0NCAxNDMuODQ0LDE3LjIzMiAxNDMuODQ0LDE1LjcxOCBDMTQzLjg0NCwxNC4xOTEgMTQ0Ljg2LDEyLjc2MyAxNDYuNzA1LDExLjY5OCBMMTU2LjE5OCw2LjA5MSBDMTU2LjMwOSw2LjAyNSAxNTYuNDUyLDYuMDYyIDE1Ni41MTgsNi4xNzMgQzE1Ni41ODMsNi4yODQgMTU2LjU0Nyw2LjQyNyAxNTYuNDM2LDYuNDkzIEwxNDYuOTQsMTIuMTAyIEMxNDUuMjQ0LDEzLjA4MSAxNDQuMzEyLDE0LjM2NSAxNDQuMzEyLDE1LjcxOCBDMTQ0LjMxMiwxNy4wNTggMTQ1LjIzLDE4LjMyNiAxNDYuODk3LDE5LjI4OSBDMTUwLjQ0NiwyMS4zMzggMTU2LjI0LDIxLjMyNyAxNTkuODExLDE5LjI2NSBMMTY5LjU1OSwxMy42MzcgQzE2OS42NywxMy41NzMgMTY5LjgxMywxMy42MTEgMTY5Ljg3OCwxMy43MjMgQzE2OS45NDMsMTMuODM0IDE2OS45MDQsMTMuOTc3IDE2OS43OTMsMTQuMDQyIEwxNjAuMDQ1LDE5LjY3IEMxNTguMTg3LDIwLjc0MiAxNTUuNzQ5LDIxLjI3OSAxNTMuMzE2LDIxLjI3OSIgaWQ9IkZpbGwtMjUiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEzLjY3NSw3NS45OTIgTDY3Ljc2Miw0OS40ODQiIGlkPSJGaWxsLTI2IiBmaWxsPSIjNDU1QTY0Ij48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTExMy42NzUsNzYuMzQyIEMxMTMuNjE1LDc2LjM0MiAxMTMuNTU1LDc2LjMyNyAxMTMuNSw3Ni4yOTUgTDY3LjU4Nyw0OS43ODcgQzY3LjQxOSw0OS42OSA2Ny4zNjIsNDkuNDc2IDY3LjQ1OSw0OS4zMDkgQzY3LjU1Niw0OS4xNDEgNjcuNzcsNDkuMDgzIDY3LjkzNyw0OS4xOCBMMTEzLjg1LDc1LjY4OCBDMTE0LjAxOCw3NS43ODUgMTE0LjA3NSw3NiAxMTMuOTc4LDc2LjE2NyBDMTEzLjkxNCw3Ni4yNzkgMTEzLjc5Niw3Ni4zNDIgMTEzLjY3NSw3Ni4zNDIiIGlkPSJGaWxsLTI3IiBmaWxsPSIjNDU1QTY0Ij48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTY3Ljc2Miw0OS40ODQgTDY3Ljc2MiwxMDMuNDg1IEM2Ny43NjIsMTA0LjU3NSA2OC41MzIsMTA1LjkwMyA2OS40ODIsMTA2LjQ1MiBMMTExLjk1NSwxMzAuOTczIEMxMTIuOTA1LDEzMS41MjIgMTEzLjY3NSwxMzEuMDgzIDExMy42NzUsMTI5Ljk5MyBMMTEzLjY3NSw3NS45OTIiIGlkPSJGaWxsLTI4IiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTExMi43MjcsMTMxLjU2MSBDMTEyLjQzLDEzMS41NjEgMTEyLjEwNywxMzEuNDY2IDExMS43OCwxMzEuMjc2IEw2OS4zMDcsMTA2Ljc1NSBDNjguMjQ0LDEwNi4xNDIgNjcuNDEyLDEwNC43MDUgNjcuNDEyLDEwMy40ODUgTDY3LjQxMiw0OS40ODQgQzY3LjQxMiw0OS4yOSA2Ny41NjksNDkuMTM0IDY3Ljc2Miw0OS4xMzQgQzY3Ljk1Niw0OS4xMzQgNjguMTEzLDQ5LjI5IDY4LjExMyw0OS40ODQgTDY4LjExMywxMDMuNDg1IEM2OC4xMTMsMTA0LjQ0NSA2OC44MiwxMDUuNjY1IDY5LjY1NywxMDYuMTQ4IEwxMTIuMTMsMTMwLjY3IEMxMTIuNDc0LDEzMC44NjggMTEyLjc5MSwxMzAuOTEzIDExMywxMzAuNzkyIEMxMTMuMjA2LDEzMC42NzMgMTEzLjMyNSwxMzAuMzgxIDExMy4zMjUsMTI5Ljk5MyBMMTEzLjMyNSw3NS45OTIgQzExMy4zMjUsNzUuNzk4IDExMy40ODIsNzUuNjQxIDExMy42NzUsNzUuNjQxIEMxMTMuODY5LDc1LjY0MSAxMTQuMDI1LDc1Ljc5OCAxMTQuMDI1LDc1Ljk5MiBMMTE0LjAyNSwxMjkuOTkzIEMxMTQuMDI1LDEzMC42NDggMTEzLjc4NiwxMzEuMTQ3IDExMy4zNSwxMzEuMzk5IEMxMTMuMTYyLDEzMS41MDcgMTEyLjk1MiwxMzEuNTYxIDExMi43MjcsMTMxLjU2MSIgaWQ9IkZpbGwtMjkiIGZpbGw9IiM0NTVBNjQiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEyLjg2LDQwLjUxMiBDMTEyLjg2LDQwLjUxMiAxMTIuODYsNDAuNTEyIDExMi44NTksNDAuNTEyIEMxMTAuNTQxLDQwLjUxMiAxMDguMzYsMzkuOTkgMTA2LjcxNywzOS4wNDEgQzEwNS4wMTIsMzguMDU3IDEwNC4wNzQsMzYuNzI2IDEwNC4wNzQsMzUuMjkyIEMxMDQuMDc0LDMzLjg0NyAxMDUuMDI2LDMyLjUwMSAxMDYuNzU0LDMxLjUwNCBMMTE4Ljc5NSwyNC41NTEgQzEyMC40NjMsMjMuNTg5IDEyMi42NjksMjMuMDU4IDEyNS4wMDcsMjMuMDU4IEMxMjcuMzI1LDIzLjA1OCAxMjkuNTA2LDIzLjU4MSAxMzEuMTUsMjQuNTMgQzEzMi44NTQsMjUuNTE0IDEzMy43OTMsMjYuODQ1IDEzMy43OTMsMjguMjc4IEMxMzMuNzkzLDI5LjcyNCAxMzIuODQxLDMxLjA2OSAxMzEuMTEzLDMyLjA2NyBMMTE5LjA3MSwzOS4wMTkgQzExNy40MDMsMzkuOTgyIDExNS4xOTcsNDAuNTEyIDExMi44Niw0MC41MTIgTDExMi44Niw0MC41MTIgWiBNMTI1LjAwNywyMy43NTkgQzEyMi43OSwyMy43NTkgMTIwLjcwOSwyNC4yNTYgMTE5LjE0NiwyNS4xNTggTDEwNy4xMDQsMzIuMTEgQzEwNS42MDIsMzIuOTc4IDEwNC43NzQsMzQuMTA4IDEwNC43NzQsMzUuMjkyIEMxMDQuNzc0LDM2LjQ2NSAxMDUuNTg5LDM3LjU4MSAxMDcuMDY3LDM4LjQzNCBDMTA4LjYwNSwzOS4zMjMgMTEwLjY2MywzOS44MTIgMTEyLjg1OSwzOS44MTIgTDExMi44NiwzOS44MTIgQzExNS4wNzYsMzkuODEyIDExNy4xNTgsMzkuMzE1IDExOC43MjEsMzguNDEzIEwxMzAuNzYyLDMxLjQ2IEMxMzIuMjY0LDMwLjU5MyAxMzMuMDkyLDI5LjQ2MyAxMzMuMDkyLDI4LjI3OCBDMTMzLjA5MiwyNy4xMDYgMTMyLjI3OCwyNS45OSAxMzAuOCwyNS4xMzYgQzEyOS4yNjEsMjQuMjQ4IDEyNy4yMDQsMjMuNzU5IDEyNS4wMDcsMjMuNzU5IEwxMjUuMDA3LDIzLjc1OSBaIiBpZD0iRmlsbC0zMCIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNjUuNjMsMTYuMjE5IEwxNTkuODk2LDE5LjUzIEMxNTYuNzI5LDIxLjM1OCAxNTEuNjEsMjEuMzY3IDE0OC40NjMsMTkuNTUgQzE0NS4zMTYsMTcuNzMzIDE0NS4zMzIsMTQuNzc4IDE0OC40OTksMTIuOTQ5IEwxNTQuMjMzLDkuNjM5IEwxNjUuNjMsMTYuMjE5IiBpZD0iRmlsbC0zMSIgZmlsbD0iI0ZBRkFGQSI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNTQuMjMzLDEwLjQ0OCBMMTY0LjIyOCwxNi4yMTkgTDE1OS41NDYsMTguOTIzIEMxNTguMTEyLDE5Ljc1IDE1Ni4xOTQsMjAuMjA2IDE1NC4xNDcsMjAuMjA2IEMxNTIuMTE4LDIwLjIwNiAxNTAuMjI0LDE5Ljc1NyAxNDguODE0LDE4Ljk0MyBDMTQ3LjUyNCwxOC4xOTkgMTQ2LjgxNCwxNy4yNDkgMTQ2LjgxNCwxNi4yNjkgQzE0Ni44MTQsMTUuMjc4IDE0Ny41MzcsMTQuMzE0IDE0OC44NSwxMy41NTYgTDE1NC4yMzMsMTAuNDQ4IE0xNTQuMjMzLDkuNjM5IEwxNDguNDk5LDEyLjk0OSBDMTQ1LjMzMiwxNC43NzggMTQ1LjMxNiwxNy43MzMgMTQ4LjQ2MywxOS41NSBDMTUwLjAzMSwyMC40NTUgMTUyLjA4NiwyMC45MDcgMTU0LjE0NywyMC45MDcgQzE1Ni4yMjQsMjAuOTA3IDE1OC4zMDYsMjAuNDQ3IDE1OS44OTYsMTkuNTMgTDE2NS42MywxNi4yMTkgTDE1NC4yMzMsOS42MzkiIGlkPSJGaWxsLTMyIiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE0NS40NDUsNzIuNjY3IEwxNDUuNDQ1LDcyLjY2NyBDMTQzLjY3Miw3Mi42NjcgMTQyLjIwNCw3MS44MTcgMTQxLjIwMiw3MC40MjIgQzE0MS4xMzUsNzAuMzMgMTQxLjE0NSw3MC4xNDcgMTQxLjIyNSw3MC4wNjYgQzE0MS4zMDUsNjkuOTg1IDE0MS40MzIsNjkuOTQ2IDE0MS41MjUsNzAuMDExIEMxNDIuMzA2LDcwLjU1OSAxNDMuMjMxLDcwLjgyMyAxNDQuMjc2LDcwLjgyMiBDMTQ1LjU5OCw3MC44MjIgMTQ3LjAzLDcwLjM3NiAxNDguNTMyLDY5LjUwOSBDMTUzLjg0Miw2Ni40NDMgMTU4LjE2Myw1OC45ODcgMTU4LjE2Myw1Mi44OTQgQzE1OC4xNjMsNTAuOTY3IDE1Ny43MjEsNDkuMzMyIDE1Ni44ODQsNDguMTY4IEMxNTYuODE4LDQ4LjA3NiAxNTYuODI4LDQ3Ljk0OCAxNTYuOTA4LDQ3Ljg2NyBDMTU2Ljk4OCw0Ny43ODYgMTU3LjExNCw0Ny43NzQgMTU3LjIwOCw0Ny44NCBDMTU4Ljg3OCw0OS4wMTIgMTU5Ljc5OCw1MS4yMiAxNTkuNzk4LDU0LjA1OSBDMTU5Ljc5OCw2MC4zMDEgMTU1LjM3Myw2OC4wNDYgMTQ5LjkzMyw3MS4xODYgQzE0OC4zNiw3Mi4wOTQgMTQ2Ljg1LDcyLjY2NyAxNDUuNDQ1LDcyLjY2NyBMMTQ1LjQ0NSw3Mi42NjcgWiBNMTQyLjQ3Niw3MSBDMTQzLjI5LDcxLjY1MSAxNDQuMjk2LDcyLjAwMiAxNDUuNDQ1LDcyLjAwMiBDMTQ2Ljc2Nyw3Mi4wMDIgMTQ4LjE5OCw3MS41NSAxNDkuNyw3MC42ODIgQzE1NS4wMSw2Ny42MTcgMTU5LjMzMSw2MC4xNTkgMTU5LjMzMSw1NC4wNjUgQzE1OS4zMzEsNTIuMDg1IDE1OC44NjgsNTAuNDM1IDE1OC4wMDYsNDkuMjcyIEMxNTguNDE3LDUwLjMwNyAxNTguNjMsNTEuNTMyIDE1OC42Myw1Mi44OTIgQzE1OC42Myw1OS4xMzQgMTU0LjIwNSw2Ni43NjcgMTQ4Ljc2NSw2OS45MDcgQzE0Ny4xOTIsNzAuODE2IDE0NS42ODEsNzEuMjgzIDE0NC4yNzYsNzEuMjgzIEMxNDMuNjM0LDcxLjI4MyAxNDMuMDMzLDcxLjE5MiAxNDIuNDc2LDcxIEwxNDIuNDc2LDcxIFoiIGlkPSJGaWxsLTMzIiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE0OC42NDgsNjkuNzA0IEMxNTQuMDMyLDY2LjU5NiAxNTguMzk2LDU5LjA2OCAxNTguMzk2LDUyLjg5MSBDMTU4LjM5Niw1MC44MzkgMTU3LjkxMyw0OS4xOTggMTU3LjA3NCw0OC4wMyBDMTU1LjI4OSw0Ni43NzggMTUyLjY5OSw0Ni44MzYgMTQ5LjgxNiw0OC41MDEgQzE0NC40MzMsNTEuNjA5IDE0MC4wNjgsNTkuMTM3IDE0MC4wNjgsNjUuMzE0IEMxNDAuMDY4LDY3LjM2NSAxNDAuNTUyLDY5LjAwNiAxNDEuMzkxLDcwLjE3NCBDMTQzLjE3Niw3MS40MjcgMTQ1Ljc2NSw3MS4zNjkgMTQ4LjY0OCw2OS43MDQiIGlkPSJGaWxsLTM0IiBmaWxsPSIjRkFGQUZBIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE0NC4yNzYsNzEuMjc2IEwxNDQuMjc2LDcxLjI3NiBDMTQzLjEzMyw3MS4yNzYgMTQyLjExOCw3MC45NjkgMTQxLjI1Nyw3MC4zNjUgQzE0MS4yMzYsNzAuMzUxIDE0MS4yMTcsNzAuMzMyIDE0MS4yMDIsNzAuMzExIEMxNDAuMzA3LDY5LjA2NyAxMzkuODM1LDY3LjMzOSAxMzkuODM1LDY1LjMxNCBDMTM5LjgzNSw1OS4wNzMgMTQ0LjI2LDUxLjQzOSAxNDkuNyw0OC4yOTggQzE1MS4yNzMsNDcuMzkgMTUyLjc4NCw0Ni45MjkgMTU0LjE4OSw0Ni45MjkgQzE1NS4zMzIsNDYuOTI5IDE1Ni4zNDcsNDcuMjM2IDE1Ny4yMDgsNDcuODM5IEMxNTcuMjI5LDQ3Ljg1NCAxNTcuMjQ4LDQ3Ljg3MyAxNTcuMjYzLDQ3Ljg5NCBDMTU4LjE1Nyw0OS4xMzggMTU4LjYzLDUwLjg2NSAxNTguNjMsNTIuODkxIEMxNTguNjMsNTkuMTMyIDE1NC4yMDUsNjYuNzY2IDE0OC43NjUsNjkuOTA3IEMxNDcuMTkyLDcwLjgxNSAxNDUuNjgxLDcxLjI3NiAxNDQuMjc2LDcxLjI3NiBMMTQ0LjI3Niw3MS4yNzYgWiBNMTQxLjU1OCw3MC4xMDQgQzE0Mi4zMzEsNzAuNjM3IDE0My4yNDUsNzEuMDA1IDE0NC4yNzYsNzEuMDA1IEMxNDUuNTk4LDcxLjAwNSAxNDcuMDMsNzAuNDY3IDE0OC41MzIsNjkuNiBDMTUzLjg0Miw2Ni41MzQgMTU4LjE2Myw1OS4wMzMgMTU4LjE2Myw1Mi45MzkgQzE1OC4xNjMsNTEuMDMxIDE1Ny43MjksNDkuMzg1IDE1Ni45MDcsNDguMjIzIEMxNTYuMTMzLDQ3LjY5MSAxNTUuMjE5LDQ3LjQwOSAxNTQuMTg5LDQ3LjQwOSBDMTUyLjg2Nyw0Ny40MDkgMTUxLjQzNSw0Ny44NDIgMTQ5LjkzMyw0OC43MDkgQzE0NC42MjMsNTEuNzc1IDE0MC4zMDIsNTkuMjczIDE0MC4zMDIsNjUuMzY2IEMxNDAuMzAyLDY3LjI3NiAxNDAuNzM2LDY4Ljk0MiAxNDEuNTU4LDcwLjEwNCBMMTQxLjU1OCw3MC4xMDQgWiIgaWQ9IkZpbGwtMzUiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTUwLjcyLDY1LjM2MSBMMTUwLjM1Nyw2NS4wNjYgQzE1MS4xNDcsNjQuMDkyIDE1MS44NjksNjMuMDQgMTUyLjUwNSw2MS45MzggQzE1My4zMTMsNjAuNTM5IDE1My45NzgsNTkuMDY3IDE1NC40ODIsNTcuNTYzIEwxNTQuOTI1LDU3LjcxMiBDMTU0LjQxMiw1OS4yNDUgMTUzLjczMyw2MC43NDUgMTUyLjkxLDYyLjE3MiBDMTUyLjI2Miw2My4yOTUgMTUxLjUyNSw2NC4zNjggMTUwLjcyLDY1LjM2MSIgaWQ9IkZpbGwtMzYiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTE1LjkxNyw4NC41MTQgTDExNS41NTQsODQuMjIgQzExNi4zNDQsODMuMjQ1IDExNy4wNjYsODIuMTk0IDExNy43MDIsODEuMDkyIEMxMTguNTEsNzkuNjkyIDExOS4xNzUsNzguMjIgMTE5LjY3OCw3Ni43MTcgTDEyMC4xMjEsNzYuODY1IEMxMTkuNjA4LDc4LjM5OCAxMTguOTMsNzkuODk5IDExOC4xMDYsODEuMzI2IEMxMTcuNDU4LDgyLjQ0OCAxMTYuNzIyLDgzLjUyMSAxMTUuOTE3LDg0LjUxNCIgaWQ9IkZpbGwtMzciIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTE0LDEzMC40NzYgTDExNCwxMzAuMDA4IEwxMTQsNzYuMDUyIEwxMTQsNzUuNTg0IEwxMTQsNzYuMDUyIEwxMTQsMTMwLjAwOCBMMTE0LDEzMC40NzYiIGlkPSJGaWxsLTM4IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgICAgICA8ZyBpZD0iSW1wb3J0ZWQtTGF5ZXJzLUNvcHkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYyLjAwMDAwMCwgMC4wMDAwMDApIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTkuODIyLDM3LjQ3NCBDMTkuODM5LDM3LjMzOSAxOS43NDcsMzcuMTk0IDE5LjU1NSwzNy4wODIgQzE5LjIyOCwzNi44OTQgMTguNzI5LDM2Ljg3MiAxOC40NDYsMzcuMDM3IEwxMi40MzQsNDAuNTA4IEMxMi4zMDMsNDAuNTg0IDEyLjI0LDQwLjY4NiAxMi4yNDMsNDAuNzkzIEMxMi4yNDUsNDAuOTI1IDEyLjI0NSw0MS4yNTQgMTIuMjQ1LDQxLjM3MSBMMTIuMjQ1LDQxLjQxNCBMMTIuMjM4LDQxLjU0MiBDOC4xNDgsNDMuODg3IDUuNjQ3LDQ1LjMyMSA1LjY0Nyw0NS4zMjEgQzUuNjQ2LDQ1LjMyMSAzLjU3LDQ2LjM2NyAyLjg2LDUwLjUxMyBDMi44Niw1MC41MTMgMS45NDgsNTcuNDc0IDEuOTYyLDcwLjI1OCBDMS45NzcsODIuODI4IDIuNTY4LDg3LjMyOCAzLjEyOSw5MS42MDkgQzMuMzQ5LDkzLjI5MyA2LjEzLDkzLjczNCA2LjEzLDkzLjczNCBDNi40NjEsOTMuNzc0IDYuODI4LDkzLjcwNyA3LjIxLDkzLjQ4NiBMODIuNDgzLDQ5LjkzNSBDODQuMjkxLDQ4Ljg2NiA4NS4xNSw0Ni4yMTYgODUuNTM5LDQzLjY1MSBDODYuNzUyLDM1LjY2MSA4Ny4yMTQsMTAuNjczIDg1LjI2NCwzLjc3MyBDODUuMDY4LDMuMDggODQuNzU0LDIuNjkgODQuMzk2LDIuNDkxIEw4Mi4zMSwxLjcwMSBDODEuNTgzLDEuNzI5IDgwLjg5NCwyLjE2OCA4MC43NzYsMi4yMzYgQzgwLjYzNiwyLjMxNyA0MS44MDcsMjQuNTg1IDIwLjAzMiwzNy4wNzIgTDE5LjgyMiwzNy40NzQiIGlkPSJGaWxsLTEiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNODIuMzExLDEuNzAxIEw4NC4zOTYsMi40OTEgQzg0Ljc1NCwyLjY5IDg1LjA2OCwzLjA4IDg1LjI2NCwzLjc3MyBDODcuMjEzLDEwLjY3MyA4Ni43NTEsMzUuNjYgODUuNTM5LDQzLjY1MSBDODUuMTQ5LDQ2LjIxNiA4NC4yOSw0OC44NjYgODIuNDgzLDQ5LjkzNSBMNy4yMSw5My40ODYgQzYuODk3LDkzLjY2NyA2LjU5NSw5My43NDQgNi4zMTQsOTMuNzQ0IEw2LjEzMSw5My43MzMgQzYuMTMxLDkzLjczNCAzLjM0OSw5My4yOTMgMy4xMjgsOTEuNjA5IEMyLjU2OCw4Ny4zMjcgMS45NzcsODIuODI4IDEuOTYzLDcwLjI1OCBDMS45NDgsNTcuNDc0IDIuODYsNTAuNTEzIDIuODYsNTAuNTEzIEMzLjU3LDQ2LjM2NyA1LjY0Nyw0NS4zMjEgNS42NDcsNDUuMzIxIEM1LjY0Nyw0NS4zMjEgOC4xNDgsNDMuODg3IDEyLjIzOCw0MS41NDIgTDEyLjI0NSw0MS40MTQgTDEyLjI0NSw0MS4zNzEgQzEyLjI0NSw0MS4yNTQgMTIuMjQ1LDQwLjkyNSAxMi4yNDMsNDAuNzkzIEMxMi4yNCw0MC42ODYgMTIuMzAyLDQwLjU4MyAxMi40MzQsNDAuNTA4IEwxOC40NDYsMzcuMDM2IEMxOC41NzQsMzYuOTYyIDE4Ljc0NiwzNi45MjYgMTguOTI3LDM2LjkyNiBDMTkuMTQ1LDM2LjkyNiAxOS4zNzYsMzYuOTc5IDE5LjU1NCwzNy4wODIgQzE5Ljc0NywzNy4xOTQgMTkuODM5LDM3LjM0IDE5LjgyMiwzNy40NzQgTDIwLjAzMywzNy4wNzIgQzQxLjgwNiwyNC41ODUgODAuNjM2LDIuMzE4IDgwLjc3NywyLjIzNiBDODAuODk0LDIuMTY4IDgxLjU4MywxLjcyOSA4Mi4zMTEsMS43MDEgTTgyLjMxMSwwLjcwNCBMODIuMjcyLDAuNzA1IEM4MS42NTQsMC43MjggODAuOTg5LDAuOTQ5IDgwLjI5OCwxLjM2MSBMODAuMjc3LDEuMzczIEM4MC4xMjksMS40NTggNTkuNzY4LDEzLjEzNSAxOS43NTgsMzYuMDc5IEMxOS41LDM1Ljk4MSAxOS4yMTQsMzUuOTI5IDE4LjkyNywzNS45MjkgQzE4LjU2MiwzNS45MjkgMTguMjIzLDM2LjAxMyAxNy45NDcsMzYuMTczIEwxMS45MzUsMzkuNjQ0IEMxMS40OTMsMzkuODk5IDExLjIzNiw0MC4zMzQgMTEuMjQ2LDQwLjgxIEwxMS4yNDcsNDAuOTYgTDUuMTY3LDQ0LjQ0NyBDNC43OTQsNDQuNjQ2IDIuNjI1LDQ1Ljk3OCAxLjg3Nyw1MC4zNDUgTDEuODcxLDUwLjM4NCBDMS44NjIsNTAuNDU0IDAuOTUxLDU3LjU1NyAwLjk2NSw3MC4yNTkgQzAuOTc5LDgyLjg3OSAxLjU2OCw4Ny4zNzUgMi4xMzcsOTEuNzI0IEwyLjEzOSw5MS43MzkgQzIuNDQ3LDk0LjA5NCA1LjYxNCw5NC42NjIgNS45NzUsOTQuNzE5IEw2LjAwOSw5NC43MjMgQzYuMTEsOTQuNzM2IDYuMjEzLDk0Ljc0MiA2LjMxNCw5NC43NDIgQzYuNzksOTQuNzQyIDcuMjYsOTQuNjEgNy43MSw5NC4zNSBMODIuOTgzLDUwLjc5OCBDODQuNzk0LDQ5LjcyNyA4NS45ODIsNDcuMzc1IDg2LjUyNSw0My44MDEgQzg3LjcxMSwzNS45ODcgODguMjU5LDEwLjcwNSA4Ni4yMjQsMy41MDIgQzg1Ljk3MSwyLjYwOSA4NS41MiwxLjk3NSA4NC44ODEsMS42MiBMODQuNzQ5LDEuNTU4IEw4Mi42NjQsMC43NjkgQzgyLjU1MSwwLjcyNSA4Mi40MzEsMC43MDQgODIuMzExLDAuNzA0IiBpZD0iRmlsbC0yIiBmaWxsPSIjNDU1QTY0Ij48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTY2LjI2NywxMS41NjUgTDY3Ljc2MiwxMS45OTkgTDExLjQyMyw0NC4zMjUiIGlkPSJGaWxsLTMiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTIuMjAyLDkwLjU0NSBDMTIuMDI5LDkwLjU0NSAxMS44NjIsOTAuNDU1IDExLjc2OSw5MC4yOTUgQzExLjYzMiw5MC4wNTcgMTEuNzEzLDg5Ljc1MiAxMS45NTIsODkuNjE0IEwzMC4zODksNzguOTY5IEMzMC42MjgsNzguODMxIDMwLjkzMyw3OC45MTMgMzEuMDcxLDc5LjE1MiBDMzEuMjA4LDc5LjM5IDMxLjEyNyw3OS42OTYgMzAuODg4LDc5LjgzMyBMMTIuNDUxLDkwLjQ3OCBMMTIuMjAyLDkwLjU0NSIgaWQ9IkZpbGwtNCIgZmlsbD0iIzYwN0Q4QiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMy43NjQsNDIuNjU0IEwxMy42NTYsNDIuNTkyIEwxMy43MDIsNDIuNDIxIEwxOC44MzcsMzkuNDU3IEwxOS4wMDcsMzkuNTAyIEwxOC45NjIsMzkuNjczIEwxMy44MjcsNDIuNjM3IEwxMy43NjQsNDIuNjU0IiBpZD0iRmlsbC01IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTguNTIsOTAuMzc1IEw4LjUyLDQ2LjQyMSBMOC41ODMsNDYuMzg1IEw3NS44NCw3LjU1NCBMNzUuODQsNTEuNTA4IEw3NS43NzgsNTEuNTQ0IEw4LjUyLDkwLjM3NSBMOC41Miw5MC4zNzUgWiBNOC43Nyw0Ni41NjQgTDguNzcsODkuOTQ0IEw3NS41OTEsNTEuMzY1IEw3NS41OTEsNy45ODUgTDguNzcsNDYuNTY0IEw4Ljc3LDQ2LjU2NCBaIiBpZD0iRmlsbC02IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTI0Ljk4Niw4My4xODIgQzI0Ljc1Niw4My4zMzEgMjQuMzc0LDgzLjU2NiAyNC4xMzcsODMuNzA1IEwxMi42MzIsOTAuNDA2IEMxMi4zOTUsOTAuNTQ1IDEyLjQyNiw5MC42NTggMTIuNyw5MC42NTggTDEzLjI2NSw5MC42NTggQzEzLjU0LDkwLjY1OCAxMy45NTgsOTAuNTQ1IDE0LjE5NSw5MC40MDYgTDI1LjcsODMuNzA1IEMyNS45MzcsODMuNTY2IDI2LjEyOCw4My40NTIgMjYuMTI1LDgzLjQ0OSBDMjYuMTIyLDgzLjQ0NyAyNi4xMTksODMuMjIgMjYuMTE5LDgyLjk0NiBDMjYuMTE5LDgyLjY3MiAyNS45MzEsODIuNTY5IDI1LjcwMSw4Mi43MTkgTDI0Ljk4Niw4My4xODIiIGlkPSJGaWxsLTciIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTMuMjY2LDkwLjc4MiBMMTIuNyw5MC43ODIgQzEyLjUsOTAuNzgyIDEyLjM4NCw5MC43MjYgMTIuMzU0LDkwLjYxNiBDMTIuMzI0LDkwLjUwNiAxMi4zOTcsOTAuMzk5IDEyLjU2OSw5MC4yOTkgTDI0LjA3NCw4My41OTcgQzI0LjMxLDgzLjQ1OSAyNC42ODksODMuMjI2IDI0LjkxOCw4My4wNzggTDI1LjYzMyw4Mi42MTQgQzI1LjcyMyw4Mi41NTUgMjUuODEzLDgyLjUyNSAyNS44OTksODIuNTI1IEMyNi4wNzEsODIuNTI1IDI2LjI0NCw4Mi42NTUgMjYuMjQ0LDgyLjk0NiBDMjYuMjQ0LDgzLjE2IDI2LjI0NSw4My4zMDkgMjYuMjQ3LDgzLjM4MyBMMjYuMjUzLDgzLjM4NyBMMjYuMjQ5LDgzLjQ1NiBDMjYuMjQ2LDgzLjUzMSAyNi4yNDYsODMuNTMxIDI1Ljc2Myw4My44MTIgTDE0LjI1OCw5MC41MTQgQzE0LDkwLjY2NSAxMy41NjQsOTAuNzgyIDEzLjI2Niw5MC43ODIgTDEzLjI2Niw5MC43ODIgWiBNMTIuNjY2LDkwLjUzMiBMMTIuNyw5MC41MzMgTDEzLjI2Niw5MC41MzMgQzEzLjUxOCw5MC41MzMgMTMuOTE1LDkwLjQyNSAxNC4xMzIsOTAuMjk5IEwyNS42MzcsODMuNTk3IEMyNS44MDUsODMuNDk5IDI1LjkzMSw4My40MjQgMjUuOTk4LDgzLjM4MyBDMjUuOTk0LDgzLjI5OSAyNS45OTQsODMuMTY1IDI1Ljk5NCw4Mi45NDYgTDI1Ljg5OSw4Mi43NzUgTDI1Ljc2OCw4Mi44MjQgTDI1LjA1NCw4My4yODcgQzI0LjgyMiw4My40MzcgMjQuNDM4LDgzLjY3MyAyNC4yLDgzLjgxMiBMMTIuNjk1LDkwLjUxNCBMMTIuNjY2LDkwLjUzMiBMMTIuNjY2LDkwLjUzMiBaIiBpZD0iRmlsbC04IiBmaWxsPSIjNjA3RDhCIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTEzLjI2Niw4OS44NzEgTDEyLjcsODkuODcxIEMxMi41LDg5Ljg3MSAxMi4zODQsODkuODE1IDEyLjM1NCw4OS43MDUgQzEyLjMyNCw4OS41OTUgMTIuMzk3LDg5LjQ4OCAxMi41NjksODkuMzg4IEwyNC4wNzQsODIuNjg2IEMyNC4zMzIsODIuNTM1IDI0Ljc2OCw4Mi40MTggMjUuMDY3LDgyLjQxOCBMMjUuNjMyLDgyLjQxOCBDMjUuODMyLDgyLjQxOCAyNS45NDgsODIuNDc0IDI1Ljk3OCw4Mi41ODQgQzI2LjAwOCw4Mi42OTQgMjUuOTM1LDgyLjgwMSAyNS43NjMsODIuOTAxIEwxNC4yNTgsODkuNjAzIEMxNCw4OS43NTQgMTMuNTY0LDg5Ljg3MSAxMy4yNjYsODkuODcxIEwxMy4yNjYsODkuODcxIFogTTEyLjY2Niw4OS42MjEgTDEyLjcsODkuNjIyIEwxMy4yNjYsODkuNjIyIEMxMy41MTgsODkuNjIyIDEzLjkxNSw4OS41MTUgMTQuMTMyLDg5LjM4OCBMMjUuNjM3LDgyLjY4NiBMMjUuNjY3LDgyLjY2OCBMMjUuNjMyLDgyLjY2NyBMMjUuMDY3LDgyLjY2NyBDMjQuODE1LDgyLjY2NyAyNC40MTgsODIuNzc1IDI0LjIsODIuOTAxIEwxMi42OTUsODkuNjAzIEwxMi42NjYsODkuNjIxIEwxMi42NjYsODkuNjIxIFoiIGlkPSJGaWxsLTkiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTIuMzcsOTAuODAxIEwxMi4zNyw4OS41NTQgTDEyLjM3LDkwLjgwMSIgaWQ9IkZpbGwtMTAiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNi4xMyw5My45MDEgQzUuMzc5LDkzLjgwOCA0LjgxNiw5My4xNjQgNC42OTEsOTIuNTI1IEMzLjg2LDg4LjI4NyAzLjU0LDgzLjc0MyAzLjUyNiw3MS4xNzMgQzMuNTExLDU4LjM4OSA0LjQyMyw1MS40MjggNC40MjMsNTEuNDI4IEM1LjEzNCw0Ny4yODIgNy4yMSw0Ni4yMzYgNy4yMSw0Ni4yMzYgQzcuMjEsNDYuMjM2IDgxLjY2NywzLjI1IDgyLjA2OSwzLjAxNyBDODIuMjkyLDIuODg4IDg0LjU1NiwxLjQzMyA4NS4yNjQsMy45NCBDODcuMjE0LDEwLjg0IDg2Ljc1MiwzNS44MjcgODUuNTM5LDQzLjgxOCBDODUuMTUsNDYuMzgzIDg0LjI5MSw0OS4wMzMgODIuNDgzLDUwLjEwMSBMNy4yMSw5My42NTMgQzYuODI4LDkzLjg3NCA2LjQ2MSw5My45NDEgNi4xMyw5My45MDEgQzYuMTMsOTMuOTAxIDMuMzQ5LDkzLjQ2IDMuMTI5LDkxLjc3NiBDMi41NjgsODcuNDk1IDEuOTc3LDgyLjk5NSAxLjk2Miw3MC40MjUgQzEuOTQ4LDU3LjY0MSAyLjg2LDUwLjY4IDIuODYsNTAuNjggQzMuNTcsNDYuNTM0IDUuNjQ3LDQ1LjQ4OSA1LjY0Nyw0NS40ODkgQzUuNjQ2LDQ1LjQ4OSA4LjA2NSw0NC4wOTIgMTIuMjQ1LDQxLjY3OSBMMTMuMTE2LDQxLjU2IEwxOS43MTUsMzcuNzMgTDE5Ljc2MSwzNy4yNjkgTDYuMTMsOTMuOTAxIiBpZD0iRmlsbC0xMSIgZmlsbD0iI0ZBRkFGQSI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik02LjMxNyw5NC4xNjEgTDYuMTAyLDk0LjE0OCBMNi4xMDEsOTQuMTQ4IEw1Ljg1Nyw5NC4xMDEgQzUuMTM4LDkzLjk0NSAzLjA4NSw5My4zNjUgMi44ODEsOTEuODA5IEMyLjMxMyw4Ny40NjkgMS43MjcsODIuOTk2IDEuNzEzLDcwLjQyNSBDMS42OTksNTcuNzcxIDIuNjA0LDUwLjcxOCAyLjYxMyw1MC42NDggQzMuMzM4LDQ2LjQxNyA1LjQ0NSw0NS4zMSA1LjUzNSw0NS4yNjYgTDEyLjE2Myw0MS40MzkgTDEzLjAzMyw0MS4zMiBMMTkuNDc5LDM3LjU3OCBMMTkuNTEzLDM3LjI0NCBDMTkuNTI2LDM3LjEwNyAxOS42NDcsMzcuMDA4IDE5Ljc4NiwzNy4wMjEgQzE5LjkyMiwzNy4wMzQgMjAuMDIzLDM3LjE1NiAyMC4wMDksMzcuMjkzIEwxOS45NSwzNy44ODIgTDEzLjE5OCw0MS44MDEgTDEyLjMyOCw0MS45MTkgTDUuNzcyLDQ1LjcwNCBDNS43NDEsNDUuNzIgMy43ODIsNDYuNzcyIDMuMTA2LDUwLjcyMiBDMy4wOTksNTAuNzgyIDIuMTk4LDU3LjgwOCAyLjIxMiw3MC40MjQgQzIuMjI2LDgyLjk2MyAyLjgwOSw4Ny40MiAzLjM3Myw5MS43MjkgQzMuNDY0LDkyLjQyIDQuMDYyLDkyLjg4MyA0LjY4Miw5My4xODEgQzQuNTY2LDkyLjk4NCA0LjQ4Niw5Mi43NzYgNC40NDYsOTIuNTcyIEMzLjY2NSw4OC41ODggMy4yOTEsODQuMzcgMy4yNzYsNzEuMTczIEMzLjI2Miw1OC41MiA0LjE2Nyw1MS40NjYgNC4xNzYsNTEuMzk2IEM0LjkwMSw0Ny4xNjUgNy4wMDgsNDYuMDU5IDcuMDk4LDQ2LjAxNCBDNy4wOTQsNDYuMDE1IDgxLjU0MiwzLjAzNCA4MS45NDQsMi44MDIgTDgxLjk3MiwyLjc4NSBDODIuODc2LDIuMjQ3IDgzLjY5MiwyLjA5NyA4NC4zMzIsMi4zNTIgQzg0Ljg4NywyLjU3MyA4NS4yODEsMy4wODUgODUuNTA0LDMuODcyIEM4Ny41MTgsMTEgODYuOTY0LDM2LjA5MSA4NS43ODUsNDMuODU1IEM4NS4yNzgsNDcuMTk2IDg0LjIxLDQ5LjM3IDgyLjYxLDUwLjMxNyBMNy4zMzUsOTMuODY5IEM2Ljk5OSw5NC4wNjMgNi42NTgsOTQuMTYxIDYuMzE3LDk0LjE2MSBMNi4zMTcsOTQuMTYxIFogTTYuMTcsOTMuNjU0IEM2LjQ2Myw5My42OSA2Ljc3NCw5My42MTcgNy4wODUsOTMuNDM3IEw4Mi4zNTgsNDkuODg2IEM4NC4xODEsNDguODA4IDg0Ljk2LDQ1Ljk3MSA4NS4yOTIsNDMuNzggQzg2LjQ2NiwzNi4wNDkgODcuMDIzLDExLjA4NSA4NS4wMjQsNC4wMDggQzg0Ljg0NiwzLjM3NyA4NC41NTEsMi45NzYgODQuMTQ4LDIuODE2IEM4My42NjQsMi42MjMgODIuOTgyLDIuNzY0IDgyLjIyNywzLjIxMyBMODIuMTkzLDMuMjM0IEM4MS43OTEsMy40NjYgNy4zMzUsNDYuNDUyIDcuMzM1LDQ2LjQ1MiBDNy4zMDQsNDYuNDY5IDUuMzQ2LDQ3LjUyMSA0LjY2OSw1MS40NzEgQzQuNjYyLDUxLjUzIDMuNzYxLDU4LjU1NiAzLjc3NSw3MS4xNzMgQzMuNzksODQuMzI4IDQuMTYxLDg4LjUyNCA0LjkzNiw5Mi40NzYgQzUuMDI2LDkyLjkzNyA1LjQxMiw5My40NTkgNS45NzMsOTMuNjE1IEM2LjA4Nyw5My42NCA2LjE1OCw5My42NTIgNi4xNjksOTMuNjU0IEw2LjE3LDkzLjY1NCBMNi4xNyw5My42NTQgWiIgaWQ9IkZpbGwtMTIiIGZpbGw9IiM0NTVBNjQiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNy4zMTcsNjguOTgyIEM3LjgwNiw2OC43MDEgOC4yMDIsNjguOTI2IDguMjAyLDY5LjQ4NyBDOC4yMDIsNzAuMDQ3IDcuODA2LDcwLjczIDcuMzE3LDcxLjAxMiBDNi44MjksNzEuMjk0IDYuNDMzLDcxLjA2OSA2LjQzMyw3MC41MDggQzYuNDMzLDY5Ljk0OCA2LjgyOSw2OS4yNjUgNy4zMTcsNjguOTgyIiBpZD0iRmlsbC0xMyIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik02LjkyLDcxLjEzMyBDNi42MzEsNzEuMTMzIDYuNDMzLDcwLjkwNSA2LjQzMyw3MC41MDggQzYuNDMzLDY5Ljk0OCA2LjgyOSw2OS4yNjUgNy4zMTcsNjguOTgyIEM3LjQ2LDY4LjkgNy41OTUsNjguODYxIDcuNzE0LDY4Ljg2MSBDOC4wMDMsNjguODYxIDguMjAyLDY5LjA5IDguMjAyLDY5LjQ4NyBDOC4yMDIsNzAuMDQ3IDcuODA2LDcwLjczIDcuMzE3LDcxLjAxMiBDNy4xNzQsNzEuMDk0IDcuMDM5LDcxLjEzMyA2LjkyLDcxLjEzMyBNNy43MTQsNjguNjc0IEM3LjU1Nyw2OC42NzQgNy4zOTIsNjguNzIzIDcuMjI0LDY4LjgyMSBDNi42NzYsNjkuMTM4IDYuMjQ2LDY5Ljg3OSA2LjI0Niw3MC41MDggQzYuMjQ2LDcwLjk5NCA2LjUxNyw3MS4zMiA2LjkyLDcxLjMyIEM3LjA3OCw3MS4zMiA3LjI0Myw3MS4yNzEgNy40MTEsNzEuMTc0IEM3Ljk1OSw3MC44NTcgOC4zODksNzAuMTE3IDguMzg5LDY5LjQ4NyBDOC4zODksNjkuMDAxIDguMTE3LDY4LjY3NCA3LjcxNCw2OC42NzQiIGlkPSJGaWxsLTE0IiBmaWxsPSIjODA5N0EyIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTYuOTIsNzAuOTQ3IEM2LjY0OSw3MC45NDcgNi42MjEsNzAuNjQgNi42MjEsNzAuNTA4IEM2LjYyMSw3MC4wMTcgNi45ODIsNjkuMzkyIDcuNDExLDY5LjE0NSBDNy41MjEsNjkuMDgyIDcuNjI1LDY5LjA0OSA3LjcxNCw2OS4wNDkgQzcuOTg2LDY5LjA0OSA4LjAxNSw2OS4zNTUgOC4wMTUsNjkuNDg3IEM4LjAxNSw2OS45NzggNy42NTIsNzAuNjAzIDcuMjI0LDcwLjg1MSBDNy4xMTUsNzAuOTE0IDcuMDEsNzAuOTQ3IDYuOTIsNzAuOTQ3IE03LjcxNCw2OC44NjEgQzcuNTk1LDY4Ljg2MSA3LjQ2LDY4LjkgNy4zMTcsNjguOTgyIEM2LjgyOSw2OS4yNjUgNi40MzMsNjkuOTQ4IDYuNDMzLDcwLjUwOCBDNi40MzMsNzAuOTA1IDYuNjMxLDcxLjEzMyA2LjkyLDcxLjEzMyBDNy4wMzksNzEuMTMzIDcuMTc0LDcxLjA5NCA3LjMxNyw3MS4wMTIgQzcuODA2LDcwLjczIDguMjAyLDcwLjA0NyA4LjIwMiw2OS40ODcgQzguMjAyLDY5LjA5IDguMDAzLDY4Ljg2MSA3LjcxNCw2OC44NjEiIGlkPSJGaWxsLTE1IiBmaWxsPSIjODA5N0EyIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTcuNDQ0LDg1LjM1IEM3LjcwOCw4NS4xOTggNy45MjEsODUuMzE5IDcuOTIxLDg1LjYyMiBDNy45MjEsODUuOTI1IDcuNzA4LDg2LjI5MiA3LjQ0NCw4Ni40NDQgQzcuMTgxLDg2LjU5NyA2Ljk2Nyw4Ni40NzUgNi45NjcsODYuMTczIEM2Ljk2Nyw4NS44NzEgNy4xODEsODUuNTAyIDcuNDQ0LDg1LjM1IiBpZD0iRmlsbC0xNiIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik03LjIzLDg2LjUxIEM3LjA3NCw4Ni41MSA2Ljk2Nyw4Ni4zODcgNi45NjcsODYuMTczIEM2Ljk2Nyw4NS44NzEgNy4xODEsODUuNTAyIDcuNDQ0LDg1LjM1IEM3LjUyMSw4NS4zMDUgNy41OTQsODUuMjg0IDcuNjU4LDg1LjI4NCBDNy44MTQsODUuMjg0IDcuOTIxLDg1LjQwOCA3LjkyMSw4NS42MjIgQzcuOTIxLDg1LjkyNSA3LjcwOCw4Ni4yOTIgNy40NDQsODYuNDQ0IEM3LjM2Nyw4Ni40ODkgNy4yOTQsODYuNTEgNy4yMyw4Ni41MSBNNy42NTgsODUuMDk4IEM3LjU1OCw4NS4wOTggNy40NTUsODUuMTI3IDcuMzUxLDg1LjE4OCBDNy4wMzEsODUuMzczIDYuNzgxLDg1LjgwNiA2Ljc4MSw4Ni4xNzMgQzYuNzgxLDg2LjQ4MiA2Ljk2Niw4Ni42OTcgNy4yMyw4Ni42OTcgQzcuMzMsODYuNjk3IDcuNDMzLDg2LjY2NiA3LjUzOCw4Ni42MDcgQzcuODU4LDg2LjQyMiA4LjEwOCw4NS45ODkgOC4xMDgsODUuNjIyIEM4LjEwOCw4NS4zMTMgNy45MjMsODUuMDk4IDcuNjU4LDg1LjA5OCIgaWQ9IkZpbGwtMTciIGZpbGw9IiM4MDk3QTIiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNy4yMyw4Ni4zMjIgTDcuMTU0LDg2LjE3MyBDNy4xNTQsODUuOTM4IDcuMzMzLDg1LjYyOSA3LjUzOCw4NS41MTIgTDcuNjU4LDg1LjQ3MSBMNy43MzQsODUuNjIyIEM3LjczNCw4NS44NTYgNy41NTUsODYuMTY0IDcuMzUxLDg2LjI4MiBMNy4yMyw4Ni4zMjIgTTcuNjU4LDg1LjI4NCBDNy41OTQsODUuMjg0IDcuNTIxLDg1LjMwNSA3LjQ0NCw4NS4zNSBDNy4xODEsODUuNTAyIDYuOTY3LDg1Ljg3MSA2Ljk2Nyw4Ni4xNzMgQzYuOTY3LDg2LjM4NyA3LjA3NCw4Ni41MSA3LjIzLDg2LjUxIEM3LjI5NCw4Ni41MSA3LjM2Nyw4Ni40ODkgNy40NDQsODYuNDQ0IEM3LjcwOCw4Ni4yOTIgNy45MjEsODUuOTI1IDcuOTIxLDg1LjYyMiBDNy45MjEsODUuNDA4IDcuODE0LDg1LjI4NCA3LjY1OCw4NS4yODQiIGlkPSJGaWxsLTE4IiBmaWxsPSIjODA5N0EyIj48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTc3LjI3OCw3Ljc2OSBMNzcuMjc4LDUxLjQzNiBMMTAuMjA4LDkwLjE2IEwxMC4yMDgsNDYuNDkzIEw3Ny4yNzgsNy43NjkiIGlkPSJGaWxsLTE5IiBmaWxsPSIjNDU1QTY0Ij48L3BhdGg+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTEwLjA4Myw5MC4zNzUgTDEwLjA4Myw0Ni40MjEgTDEwLjE0Niw0Ni4zODUgTDc3LjQwMyw3LjU1NCBMNzcuNDAzLDUxLjUwOCBMNzcuMzQxLDUxLjU0NCBMMTAuMDgzLDkwLjM3NSBMMTAuMDgzLDkwLjM3NSBaIE0xMC4zMzMsNDYuNTY0IEwxMC4zMzMsODkuOTQ0IEw3Ny4xNTQsNTEuMzY1IEw3Ny4xNTQsNy45ODUgTDEwLjMzMyw0Ni41NjQgTDEwLjMzMyw0Ni41NjQgWiIgaWQ9IkZpbGwtMjAiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMjUuNzM3LDg4LjY0NyBMMTE4LjA5OCw5MS45ODEgTDExOC4wOTgsODQgTDEwNi42MzksODguNzEzIEwxMDYuNjM5LDk2Ljk4MiBMOTksMTAwLjMxNSBMMTEyLjM2OSwxMDMuOTYxIEwxMjUuNzM3LDg4LjY0NyIgaWQ9IkltcG9ydGVkLUxheWVycy1Db3B5LTIiIGZpbGw9IiM0NTVBNjQiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"};var se="CardboardV1",ue="WEBVR_CARDBOARD_VIEWER";function le(e){try{this.selectedKey=localStorage.getItem(ue)}catch(e){console.error("Failed to load viewer profile: %s",e)}this.selectedKey||(this.selectedKey=e||se),this.dialog=this.createDialog_(H.Viewers),this.root=null,this.onChangeCallbacks_=[]}le.prototype.show=function(e){this.root=e,e.appendChild(this.dialog);var t=this.dialog.querySelector("#"+this.selectedKey);t.checked=!0,this.dialog.style.display="block"},le.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},le.prototype.getCurrentViewer=function(){return H.Viewers[this.selectedKey]},le.prototype.getSelectedKey_=function(){var e=this.dialog.querySelector("input[name=field]:checked");return e?e.id:null},le.prototype.onChange=function(e){this.onChangeCallbacks_.push(e)},le.prototype.fireOnChange_=function(e){for(var t=0;t.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return r(e,[{key:"enable",value:function(){i?(this.disable(),this.noSleepTimer=window.setInterval(function(){window.location.href="/",window.setTimeout(window.stop,0)},15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){i?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),e}();e.exports=o},function(e,t,n){e.exports="data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}])},e.exports=n()}(de={exports:{}},de.exports),(ce=de.exports)&&ce.__esModule&&Object.prototype.hasOwnProperty.call(ce,"default")?ce.default:ce),pe=1e3,ge=[0,0,.5,1],me=[.5,0,.5,1],he=window.requestAnimationFrame,ve=window.cancelAnimationFrame;function ye(e){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:e.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:e.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:e.canPresent},maxLayers:{writable:!1,enumerable:!0,value:e.maxLayers},hasOrientation:{enumerable:!0,get:function(){return I("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),e.hasOrientation}}})}function Me(e){var t=!("wakelock"in(e=e||{}))||e.wakelock;this.isPolyfilled=!0,this.displayId=pe++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return I("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new ye({hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1}),this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.originalParent_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,t&&A()&&(this.wakelock_=new fe)}Me.prototype.getFrameData=function(e){return D(e,this._getPose(),this)},Me.prototype.getPose=function(){return I("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},Me.prototype.resetPose=function(){return I("VRDisplay.prototype.resetPose"),this._resetPose()},Me.prototype.getImmediatePose=function(){return I("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},Me.prototype.requestAnimationFrame=function(e){return he(e)},Me.prototype.cancelAnimationFrame=function(e){return ve(e)},Me.prototype.wrapForFullscreen=function(e){if(u())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var t=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",t.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=e,this.originalParent_=e.parentElement,this.originalParent_||document.body.appendChild(e),!this.fullscreenWrapper_.parentElement){var n=this.fullscreenElement_.parentElement;n.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),n.removeChild(this.fullscreenElement_)}this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var r=this;return function(){if(r.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];r.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}(),this.fullscreenWrapper_},Me.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var t=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),this.originalParent_===t?t.insertBefore(e,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(e),t.removeChild(this.fullscreenWrapper_),e}},Me.prototype.requestPresent=function(e){var t=this.isPresenting,n=this;return e instanceof Array||(I("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),e=[e]),new Promise(function(r,a){if(n.capabilities.canPresent)if(0==e.length||e.length>n.capabilities.maxLayers)a(new Error("Invalid number of layers."));else{var i=e[0];if(i.source){var o=i.leftBounds||ge,s=i.rightBounds||me;if(t){var c=n.layer_;c.source!==i.source&&(c.source=i.source);for(var d=0;d<4;d++)c.leftBounds[d]=o[d],c.rightBounds[d]=s[d];return n.wrapForFullscreen(n.layer_.source),n.updatePresent_(),void r()}if(n.layer_={predistorted:i.predistorted,source:i.source,leftBounds:o.slice(0),rightBounds:s.slice(0)},n.waitingForPresent_=!1,n.layer_&&n.layer_.source){var f=n.wrapForFullscreen(n.layer_.source);n.addFullscreenListeners_(f,function(){var e=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;n.isPresenting=f===e,n.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch(function(e){console.error("screen.orientation.lock() failed due to",e.message)}),n.waitingForPresent_=!1,n.beginPresent_(),r()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),n.removeFullscreenWrapper(),n.disableWakeLock(),n.endPresent_(),n.removeFullscreenListeners_()),n.fireVRDisplayPresentChange_()},function(){n.waitingForPresent_&&(n.removeFullscreenWrapper(),n.removeFullscreenListeners_(),n.disableWakeLock(),n.waitingForPresent_=!1,n.isPresenting=!1,a(new Error("Unable to present.")))}),function(e){if(l())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0}(f)?(n.enableWakeLock(),n.waitingForPresent_=!0):(u()||l())&&(n.enableWakeLock(),n.isPresenting=!0,n.beginPresent_(),n.fireVRDisplayPresentChange_(),r())}n.waitingForPresent_||u()||(v(),a(new Error("Unable to present.")))}else r()}else a(new Error("VRDisplay is not capable of presenting."))})},Me.prototype.exitPresent=function(){var e=this.isPresenting,t=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise(function(n,r){e?(!v()&&u()&&(t.endPresent_(),t.fireVRDisplayPresentChange_()),l()&&(t.removeFullscreenWrapper(),t.removeFullscreenListeners_(),t.endPresent_(),t.fireVRDisplayPresentChange_()),n()):r(new Error("Was not presenting to VRDisplay."))})},Me.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},Me.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},Me.prototype.fireVRDisplayConnect_=function(){var e=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(e)},Me.prototype.addFullscreenListeners_=function(e,t,n){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=t,this.fullscreenErrorHandler_=n,t&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",t,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",t,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",t,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",t,!1)),n&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",n,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",n,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",n,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",n,!1))},Me.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var t=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",t,!1),e.removeEventListener("webkitfullscreenchange",t,!1),document.removeEventListener("mozfullscreenchange",t,!1),e.removeEventListener("msfullscreenchange",t,!1)}if(this.fullscreenErrorHandler_){var n=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",n,!1),e.removeEventListener("webkitfullscreenerror",n,!1),document.removeEventListener("mozfullscreenerror",n,!1),e.removeEventListener("msfullscreenerror",n,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},Me.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},Me.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},Me.prototype.beginPresent_=function(){},Me.prototype.endPresent_=function(){},Me.prototype.submitFrame=function(e){},Me.prototype.getEyeParameters=function(e){return null};var Ae={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1},be={LEFT:"left",RIGHT:"right"};function we(e){var t=b({},Ae);e=b(t,e||{}),Me.call(this,{wakelock:e.MOBILE_WAKE_LOCK}),this.config=e,this.displayName="Cardboard VRDisplay",this.capabilities=new ye({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new ie(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new q(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new H(this.dpdb_.getDeviceParams(),e.ADDITIONAL_VIEWERS),this.viewerSelector_=new le(e.DEFAULT_VIEWER),this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new oe),u()&&window.addEventListener("resize",this.onResize_.bind(this))}return we.prototype=Object.create(Me.prototype),we.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},we.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},we.prototype._getFieldOfView=function(e){var t;if(e==be.LEFT)t=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=be.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=this.deviceInfo_.getFieldOfViewRightEye()}return t},we.prototype._getEyeOffset=function(e){var t;if(e==be.LEFT)t=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0];else{if(e!=be.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=[.5*this.deviceInfo_.viewer.interLensDistance,0,0]}return t},we.prototype.getEyeParameters=function(e){var t=this._getEyeOffset(e),n=this._getFieldOfView(e),r={offset:t,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_};return Object.defineProperty(r,"fieldOfView",{enumerable:!0,get:function(){return I("VRFieldOfView","VRFrameData's projection matrices"),n}}),r},we.prototype.onDeviceParamsUpdated_=function(e){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},we.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},we.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(e.canvas.width=m()*this.bufferScale_,e.canvas.height=h()*this.bufferScale_,this.cardboardUI_=new R(e)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new R(e)),this.distorter_=new E(e,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(g()&&A()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},we.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},we.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},we.prototype.submitFrame=function(e){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var t=this.layer_.source.getContext("webgl").canvas;t.width==this.lastWidth&&t.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=t.width,this.lastHeight=t.height,this.cardboardUI_.render()}},we.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},we.prototype.onResize_=function(e){if(this.layer_){var t=this.layer_.source.getContext("webgl");t.canvas.setAttribute("style",["position: absolute","top: 0","left: 0","width: 100vw","height: 100vh","border: 0","margin: 0","padding: 0px","box-sizing: content-box"].join("; ")+";"),w(t.canvas)}},we.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},we.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},we.VRFrameData=function(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null},we.VRDisplay=Me,we}()}(t={exports:{}},t.exports),t.exports),u=(n=s)&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,l={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",PROVIDE_MOBILE_VRDISPLAY:!0,GET_VR_DISPLAYS_TIMEOUT:1e3,MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1};function c(e){this.config=o(o({},l),e),this.polyfillDisplays=[],this.enabled=!1,this.hasNative="getVRDisplays"in navigator,this.native={},this.native.getVRDisplays=navigator.getVRDisplays,this.native.VRFrameData=window.VRFrameData,this.native.VRDisplay=window.VRDisplay,(!this.hasNative||this.config.PROVIDE_MOBILE_VRDISPLAY&&a())&&(this.enable(),this.getVRDisplays().then(function(e){e&&e[0]&&e[0].fireVRDisplayConnect_&&e[0].fireVRDisplayConnect_()}))}c.prototype.getPolyfillDisplays=function(){if(this._polyfillDisplaysPopulated)return this.polyfillDisplays;if(a()){var e=new u({ADDITIONAL_VIEWERS:this.config.ADDITIONAL_VIEWERS,DEFAULT_VIEWER:this.config.DEFAULT_VIEWER,MOBILE_WAKE_LOCK:this.config.MOBILE_WAKE_LOCK,DEBUG:this.config.DEBUG,DPDB_URL:this.config.DPDB_URL,CARDBOARD_UI_DISABLED:this.config.CARDBOARD_UI_DISABLED,K_FILTER:this.config.K_FILTER,PREDICTION_TIME_S:this.config.PREDICTION_TIME_S,ROTATE_INSTRUCTIONS_DISABLED:this.config.ROTATE_INSTRUCTIONS_DISABLED,YAW_ONLY:this.config.YAW_ONLY,BUFFER_SCALE:this.config.BUFFER_SCALE,DIRTY_SUBMIT_FRAME_BINDINGS:this.config.DIRTY_SUBMIT_FRAME_BINDINGS});this.polyfillDisplays.push(e)}return this._polyfillDisplaysPopulated=!0,this.polyfillDisplays},c.prototype.enable=function(){if(this.enabled=!0,this.hasNative&&this.native.VRFrameData){var e=this.native.VRFrameData,t=new this.native.VRFrameData,n=this.native.VRDisplay.prototype.getFrameData;window.VRDisplay.prototype.getFrameData=function(r){r instanceof e?n.call(this,r):(n.call(this,t),r.pose=t.pose,i(t.leftProjectionMatrix,r.leftProjectionMatrix),i(t.rightProjectionMatrix,r.rightProjectionMatrix),i(t.leftViewMatrix,r.leftViewMatrix),i(t.rightViewMatrix,r.rightViewMatrix))}}navigator.getVRDisplays=this.getVRDisplays.bind(this),window.VRDisplay=u.VRDisplay,window.VRFrameData=u.VRFrameData},c.prototype.getVRDisplays=function(){var e,t=this,n=this.config;if(!this.hasNative)return Promise.resolve(this.getPolyfillDisplays());var r,a=this.native.getVRDisplays.call(navigator),i=new Promise(function(t){e=setTimeout(function(){console.warn("Native WebVR implementation detected, but `getVRDisplays()` failed to resolve. Falling back to polyfill."),t([])},n.GET_VR_DISPLAYS_TIMEOUT)});return(r=[a,i],Promise.race?Promise.race(r):new Promise(function(e,t){for(var n=0;n0?n:t.getPolyfillDisplays()})},c.version="0.10.8",c.VRFrameData=u.VRFrameData,c.VRDisplay=u.VRDisplay;var d=Object.freeze({default:c}),f=d&&c||d;return void 0!==e&&e.window&&(e.document||(e.document=e.window.document),e.navigator||(e.navigator=e.window.navigator)),f},"object"===s(t)&&void 0!==e?e.exports=o():void 0===(i="function"==typeof(a=o)?a.call(t,n,t,e):a)||(e.exports=i)}).call(this,n(33))},,,,,function(e,t,n){(function(e){var r;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,i,o){function s(e){var t,n=this,r=(t=4022871197,function(e){e=e.toString();for(var n=0;n>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function u(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function l(e,t){var n=new s(e),r=t&&t.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+1.1102230246251565e-16*(2097152*i()|0)},i.quick=i,r&&("object"==a(r)&&u(r,n),i.state=function(){return u(n,{})}),i}i&&i.exports?i.exports=l:n(27)&&n(48)?void 0===(r=function(){return l}.call(t,n,t,i))||(i.exports=r):this.alea=l}(0,"object"==a(e)&&e,n(27))}).call(this,n(45)(e))},function(e,t,n){(function(e){var r;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,i,o){function s(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==a(r)&&u(r,n),i.state=function(){return u(n,{})}),i}i&&i.exports?i.exports=l:n(27)&&n(48)?void 0===(r=function(){return l}.call(t,n,t,i))||(i.exports=r):this.xor128=l}(0,"object"==a(e)&&e,n(27))}).call(this,n(45)(e))},function(e,t,n){(function(e){var r;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,i,o){function s(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r>>4),t.next()}function u(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function l(e,t){var n=new s(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==a(r)&&u(r,n),i.state=function(){return u(n,{})}),i}i&&i.exports?i.exports=l:n(27)&&n(48)?void 0===(r=function(){return l}.call(t,n,t,i))||(i.exports=r):this.xorwow=l}(0,"object"==a(e)&&e,n(27))}).call(this,n(45)(e))},function(e,t,n){(function(e){var r;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,a,i){function o(e){var t=this;t.next=function(){var e,n,r=t.x,a=t.i;return e=r[a],n=(e^=e>>>7)^e<<24,n^=(e=r[a+1&7])^e>>>10,n^=(e=r[a+3&7])^e>>>3,n^=(e=r[a+4&7])^e<<7,e=r[a+7&7],n^=(e^=e<<13)^e<<9,r[a]=n,t.i=a+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n0;--n)e.next()}(t,e)}function s(e,t){return t.x=e.x.slice(),t.i=e.i,t}function u(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&(r.x&&s(r,n),a.state=function(){return s(n,{})}),a}a&&a.exports?a.exports=u:n(27)&&n(48)?void 0===(r=function(){return u}.call(t,n,t,a))||(a.exports=r):this.xorshift7=u}(0,"object"==a(e)&&e,n(27))}).call(this,n(45)(e))},function(e,t,n){(function(e){var r;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,a,i){function o(e){var t=this;t.next=function(){var e,n,r=t.w,a=t.X,i=t.i;return t.w=r=r+1640531527|0,n=a[i+34&127],e=a[i=i+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=a[i]=n^e,t.i=i,n+(r^r>>>16)|0},function(e,t){var n,r,a,i,o,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),a=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(o=o+1640531527|0,a=0==(n=s[127&i]^=r+o)?a+1:0);for(a>=128&&(s[127&(t&&t.length||0)]=-1),a=127,i=512;i>0;--i)r=s[a+34&127],n=s[a=a+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[a]=r^n;e.w=o,e.X=s,e.i=a}(t,e)}function s(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function u(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},a.int32=n.next,a.quick=a,r&&(r.X&&s(r,n),a.state=function(){return s(n,{})}),a}a&&a.exports?a.exports=u:n(27)&&n(48)?void 0===(r=function(){return u}.call(t,n,t,a))||(a.exports=r):this.xor4096=u}(0,"object"==a(e)&&e,n(27))}).call(this,n(45)(e))},function(e,t,n){(function(e){var r;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,i,o){function s(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,a=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^a,a=a-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^a,t.a=a-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==a(r)&&u(r,n),i.state=function(){return u(n,{})}),i}i&&i.exports?i.exports=l:n(27)&&n(48)?void 0===(r=function(){return l}.call(t,n,t,i))||(i.exports=r):this.tychei=l}(0,"object"==a(e)&&e,n(27))}).call(this,n(45)(e))},function(e,t,n){(function(e){var r;function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(i,o){var s,u=this,l=256,c=6,d="random",f=o.pow(l,c),p=o.pow(2,52),g=2*p,m=l-1;function h(e,t,n){var r=[],m=M(function e(t,n){var r,i=[],o=a(t);if(n&&"object"==o)for(r in t)try{i.push(e(t[r],n-1))}catch(e){}return i.length?i:"string"==o?t:t+"\0"}((t=1==t?{entropy:!0}:t||{}).entropy?[e,A(i)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(l):(e=new Uint8Array(l),(u.crypto||u.msCrypto).getRandomValues(e)),A(e)}catch(e){var t=u.navigator,n=t&&t.plugins;return[+new Date,u,n,u.screen,A(i)]}}():e,3),r),h=new v(r),b=function(){for(var e=h.g(c),t=f,n=0;e=g;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|h.g(4)},b.quick=function(){return h.g(4)/4294967296},b.double=b,M(A(h.S),i),(t.pass||n||function(e,t,n,r){return r&&(r.S&&y(r,h),e.state=function(){return y(h,{})}),n?(o[d]=e,t):e})(b,m,"global"in t?t.global:this==o,t.state)}function v(e){var t,n=e.length,r=this,a=0,i=r.i=r.j=0,o=r.S=[];for(n||(e=[n++]);a1?t-1:0),r=1;r0?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 s,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==l)throw new Error(o[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var g;if(g="string"==typeof t.dictionary?i.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(n=r.deflateSetDictionary(this.strm,g))!==l)throw new Error(o[n]);this._dict_set=!0}}function g(e,t){var n=new p(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}p.prototype.push=function(e,t){var n,o,s=this.strm,c=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?s.input=i.string2buf(e):"[object ArrayBuffer]"===u.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new a.Buf8(c),s.next_out=0,s.avail_out=c),1!==(n=r.deflate(s,o))&&n!==l)return this.onEnd(n),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(i.buf2binstring(a.shrinkBuf(s.output,s.next_out))):this.onData(a.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&1!==n);return 4===o?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===l):2!==o||(this.onEnd(l),s.avail_out=0,!0)},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=p,t.deflate=g,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,g(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,g(e,t)}},function(e,t,n){"use strict";var r,a=n(39),i=n(166),o=n(98),s=n(99),u=n(88),l=0,c=1,d=3,f=4,p=5,g=0,m=1,h=-2,v=-3,y=-5,M=-1,A=1,b=2,w=3,D=4,T=0,C=2,I=8,x=9,S=15,N=8,E=286,O=30,L=19,P=2*E+1,k=15,R=3,j=258,B=j+R+1,z=32,_=42,V=69,F=73,U=91,G=103,W=113,Q=666,Y=1,H=2,K=3,X=4,q=3;function Z(e,t){return e.msg=u[t],t}function J(e){return(e<<1)-(e>4?9:0)}function $(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(a.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function te(e,t){i._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function ne(e,t){e.pending_buf[e.pending++]=t}function re(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ae(e,t){var n,r,a=e.max_chain_length,i=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-B?e.strstart-(e.w_size-B):0,l=e.window,c=e.w_mask,d=e.prev,f=e.strstart+j,p=l[i+o-1],g=l[i+o];e.prev_length>=e.good_match&&(a>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(n=t)+o]===g&&l[n+o-1]===p&&l[n]===l[i]&&l[++n]===l[i+1]){i+=2,n++;do{}while(l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&io){if(e.match_start=t,o=r,r>=s)break;p=l[i+o-1],g=l[i+o]}}}while((t=d[t&c])>u&&0!=--a);return o<=e.lookahead?o:e.lookahead}function ie(e){var t,n,r,i,u,l,c,d,f,p,g=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=g+(g-B)){a.arraySet(e.window,e.window,g,g,0),e.match_start-=g,e.strstart-=g,e.block_start-=g,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=g?r-g:0}while(--n);t=n=g;do{r=e.prev[--t],e.prev[t]=r>=g?r-g:0}while(--n);i+=g}if(0===e.strm.avail_in)break;if(l=e.strm,c=e.window,d=e.strstart+e.lookahead,f=i,p=void 0,(p=l.avail_in)>f&&(p=f),n=0===p?0:(l.avail_in-=p,a.arraySet(c,l.input,l.next_in,p,d),1===l.state.wrap?l.adler=o(l.adler,c,p,d):2===l.state.wrap&&(l.adler=s(l.adler,c,p,d)),l.next_in+=p,l.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=R)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=R&&(e.ins_h=(e.ins_h<=R)if(r=i._tr_tally(e,e.strstart-e.match_start,e.match_length-R),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=R){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=R&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=R-1)),e.prev_length>=R&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-R,r=i._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-R),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=(e.ins_h<15&&(s=2,r-=16),i<1||i>x||n!==I||r<8||r>15||t<0||t>9||o<0||o>D)return Z(e,h);8===r&&(r=9);var u=new le;return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=r,u.w_size=1<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ie(e),0===e.lookahead&&t===l)return Y;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,te(e,!1),0===e.strm.avail_out))return Y;if(e.strstart-e.block_start>=e.w_size-B&&(te(e,!1),0===e.strm.avail_out))return Y}return e.insert=0,t===f?(te(e,!0),0===e.strm.avail_out?K:X):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),Y)}),new ue(4,4,8,4,oe),new ue(4,5,16,8,oe),new ue(4,6,32,32,oe),new ue(4,4,16,16,se),new ue(8,16,32,32,se),new ue(8,16,128,128,se),new ue(8,32,128,256,se),new ue(32,128,258,1024,se),new ue(32,258,258,4096,se)],t.deflateInit=function(e,t){return fe(e,t,I,S,N,T)},t.deflateInit2=fe,t.deflateReset=de,t.deflateResetKeep=ce,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?h:(e.state.gzhead=t,g):h},t.deflate=function(e,t){var n,a,o,u;if(!e||!e.state||t>p||t<0)return e?Z(e,h):h;if(a=e.state,!e.output||!e.input&&0!==e.avail_in||a.status===Q&&t!==f)return Z(e,0===e.avail_out?y:h);if(a.strm=e,n=a.last_flush,a.last_flush=t,a.status===_)if(2===a.wrap)e.adler=0,ne(a,31),ne(a,139),ne(a,8),a.gzhead?(ne(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),ne(a,255&a.gzhead.time),ne(a,a.gzhead.time>>8&255),ne(a,a.gzhead.time>>16&255),ne(a,a.gzhead.time>>24&255),ne(a,9===a.level?2:a.strategy>=b||a.level<2?4:0),ne(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(ne(a,255&a.gzhead.extra.length),ne(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=s(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=V):(ne(a,0),ne(a,0),ne(a,0),ne(a,0),ne(a,0),ne(a,9===a.level?2:a.strategy>=b||a.level<2?4:0),ne(a,q),a.status=W);else{var v=I+(a.w_bits-8<<4)<<8;v|=(a.strategy>=b||a.level<2?0:a.level<6?1:6===a.level?2:3)<<6,0!==a.strstart&&(v|=z),v+=31-v%31,a.status=W,re(a,v),0!==a.strstart&&(re(a,e.adler>>>16),re(a,65535&e.adler)),e.adler=1}if(a.status===V)if(a.gzhead.extra){for(o=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>o&&(e.adler=s(e.adler,a.pending_buf,a.pending-o,o)),ee(e),o=a.pending,a.pending!==a.pending_buf_size));)ne(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>o&&(e.adler=s(e.adler,a.pending_buf,a.pending-o,o)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=F)}else a.status=F;if(a.status===F)if(a.gzhead.name){o=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>o&&(e.adler=s(e.adler,a.pending_buf,a.pending-o,o)),ee(e),o=a.pending,a.pending===a.pending_buf_size)){u=1;break}u=a.gzindexo&&(e.adler=s(e.adler,a.pending_buf,a.pending-o,o)),0===u&&(a.gzindex=0,a.status=U)}else a.status=U;if(a.status===U)if(a.gzhead.comment){o=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>o&&(e.adler=s(e.adler,a.pending_buf,a.pending-o,o)),ee(e),o=a.pending,a.pending===a.pending_buf_size)){u=1;break}u=a.gzindexo&&(e.adler=s(e.adler,a.pending_buf,a.pending-o,o)),0===u&&(a.status=G)}else a.status=G;if(a.status===G&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&ee(e),a.pending+2<=a.pending_buf_size&&(ne(a,255&e.adler),ne(a,e.adler>>8&255),e.adler=0,a.status=W)):a.status=W),0!==a.pending){if(ee(e),0===e.avail_out)return a.last_flush=-1,g}else if(0===e.avail_in&&J(t)<=J(n)&&t!==f)return Z(e,y);if(a.status===Q&&0!==e.avail_in)return Z(e,y);if(0!==e.avail_in||0!==a.lookahead||t!==l&&a.status!==Q){var M=a.strategy===b?function(e,t){for(var n;;){if(0===e.lookahead&&(ie(e),0===e.lookahead)){if(t===l)return Y;break}if(e.match_length=0,n=i._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(te(e,!1),0===e.strm.avail_out))return Y}return e.insert=0,t===f?(te(e,!0),0===e.strm.avail_out?K:X):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?Y:H}(a,t):a.strategy===w?function(e,t){for(var n,r,a,o,s=e.window;;){if(e.lookahead<=j){if(ie(e),e.lookahead<=j&&t===l)return Y;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=R&&e.strstart>0&&(r=s[a=e.strstart-1])===s[++a]&&r===s[++a]&&r===s[++a]){o=e.strstart+j;do{}while(r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&ae.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=R?(n=i._tr_tally(e,1,e.match_length-R),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=i._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(te(e,!1),0===e.strm.avail_out))return Y}return e.insert=0,t===f?(te(e,!0),0===e.strm.avail_out?K:X):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?Y:H}(a,t):r[a.level].func(a,t);if(M!==K&&M!==X||(a.status=Q),M===Y||M===K)return 0===e.avail_out&&(a.last_flush=-1),g;if(M===H&&(t===c?i._tr_align(a):t!==p&&(i._tr_stored_block(a,0,0,!1),t===d&&($(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),ee(e),0===e.avail_out))return a.last_flush=-1,g}return t!==f?g:a.wrap<=0?m:(2===a.wrap?(ne(a,255&e.adler),ne(a,e.adler>>8&255),ne(a,e.adler>>16&255),ne(a,e.adler>>24&255),ne(a,255&e.total_in),ne(a,e.total_in>>8&255),ne(a,e.total_in>>16&255),ne(a,e.total_in>>24&255)):(re(a,e.adler>>>16),re(a,65535&e.adler)),ee(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?g:m)},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==_&&t!==V&&t!==F&&t!==U&&t!==G&&t!==W&&t!==Q?Z(e,h):(e.state=null,t===W?Z(e,v):g):h},t.deflateSetDictionary=function(e,t){var n,r,i,s,u,l,c,d,f=t.length;if(!e||!e.state)return h;if(2===(s=(n=e.state).wrap)||1===s&&n.status!==_||n.lookahead)return h;for(1===s&&(e.adler=o(e.adler,t,f,0)),n.wrap=0,f>=n.w_size&&(0===s&&($(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new a.Buf8(n.w_size),a.arraySet(d,t,f-n.w_size,n.w_size,0),t=d,f=n.w_size),u=e.avail_in,l=e.next_in,c=e.input,e.avail_in=f,e.next_in=0,e.input=t,ie(n);n.lookahead>=R;){r=n.strstart,i=n.lookahead-(R-1);do{n.ins_h=(n.ins_h<=0;)e[t]=0}var l=0,c=1,d=2,f=29,p=256,g=p+1+f,m=30,h=19,v=2*g+1,y=15,M=16,A=7,b=256,w=16,D=17,T=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],I=[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],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],N=new Array(2*(g+2));u(N);var E=new Array(2*m);u(E);var O=new Array(512);u(O);var L=new Array(256);u(L);var P=new Array(f);u(P);var k,R,j,B=new Array(m);function z(e,t,n,r,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=a,this.has_stree=e&&e.length}function _(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function V(e){return e<256?O[e]:O[256+(e>>>7)]}function F(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function U(e,t,n){e.bi_valid>M-n?(e.bi_buf|=t<>M-e.bi_valid,e.bi_valid+=n-M):(e.bi_buf|=t<>>=1,n<<=1}while(--t>0);return n>>>1}function Q(e,t,n){var r,a,i=new Array(y+1),o=0;for(r=1;r<=y;r++)i[r]=o=o+n[r-1]<<1;for(a=0;a<=t;a++){var s=e[2*a+1];0!==s&&(e[2*a]=W(i[s]++,s))}}function Y(e){var t;for(t=0;t8?F(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 K(e,t,n,r){var a=2*t,i=2*n;return e[a]>1;n>=1;n--)X(e,i,n);a=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],X(e,i,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,i[2*a]=i[2*n]+i[2*r],e.depth[a]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,i[2*n+1]=i[2*r+1]=a,e.heap[1]=a++,X(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,a,i,o,s,u=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,g=t.stat_desc.max_length,m=0;for(i=0;i<=y;i++)e.bl_count[i]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;ng&&(i=g,m++),u[2*r+1]=i,r>l||(e.bl_count[i]++,o=0,r>=p&&(o=f[r-p]),s=u[2*r],e.opt_len+=s*(i+o),d&&(e.static_len+=s*(c[2*r+1]+o)));if(0!==m){do{for(i=g-1;0===e.bl_count[i];)i--;e.bl_count[i]--,e.bl_count[i+1]+=2,e.bl_count[g]--,m-=2}while(m>0);for(i=g;0!==i;i--)for(r=e.bl_count[i];0!==r;)(a=e.heap[--n])>l||(u[2*a+1]!==i&&(e.opt_len+=(i-u[2*a+1])*u[2*a],u[2*a+1]=i),r--)}}(e,t),Q(i,l,e.bl_count)}function J(e,t,n){var r,a,i=-1,o=t[1],s=0,u=7,l=4;for(0===o&&(u=138,l=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)a=o,o=t[2*(r+1)+1],++s>=7;r0?(e.strm.data_type===s&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return i;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return o;for(t=32;t=3&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),u=e.opt_len+3+7>>>3,(l=e.static_len+3+7>>>3)<=u&&(u=l)):u=l=n+5,n+4<=u&&-1!==t?te(e,t,n,r):e.strategy===a||l===u?(U(e,(c<<1)+(r?1:0),3),q(e,N,E)):(U(e,(d<<1)+(r?1:0),3),function(e,t,n,r){var a;for(U(e,t-257,5),U(e,n-1,5),U(e,r-4,4),a=0;a>>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&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(L[n]+p+1)]++,e.dyn_dtree[2*V(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){U(e,c<<1,3),G(e,b,N),function(e){16===e.bi_valid?(F(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)}},function(e,t,n){"use strict";var r=n(168),a=n(39),i=n(100),o=n(102),s=n(88),u=n(101),l=n(171),c=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=a.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 u,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(s[n]);this.header=new l,r.inflateGetHeader(this.strm,this.header)}function f(e,t){var n=new d(t);if(n.push(e,!0),n.err)throw n.msg||s[n.err];return n.result}d.prototype.push=function(e,t){var n,s,u,l,d,f,p=this.strm,g=this.options.chunkSize,m=this.options.dictionary,h=!1;if(this.ended)return!1;s=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?p.input=i.binstring2buf(e):"[object ArrayBuffer]"===c.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 a.Buf8(g),p.next_out=0,p.avail_out=g),(n=r.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(f="string"==typeof m?i.string2buf(m):"[object ArrayBuffer]"===c.call(m)?new Uint8Array(m):m,n=r.inflateSetDictionary(this.strm,f)),n===o.Z_BUF_ERROR&&!0===h&&(n=o.Z_OK,h=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&n!==o.Z_STREAM_END&&(0!==p.avail_in||s!==o.Z_FINISH&&s!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(u=i.utf8border(p.output,p.next_out),l=p.next_out-u,d=i.buf2string(p.output,u),p.next_out=l,p.avail_out=g-l,l&&a.arraySet(p.output,p.output,u,l,0),this.onData(d)):this.onData(a.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(h=!0)}while((p.avail_in>0||0===p.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(s=o.Z_FINISH),s===o.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):s!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),p.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=d,t.inflate=f,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},t.ungzip=f},function(e,t,n){"use strict";var r=n(39),a=n(98),i=n(99),o=n(169),s=n(170),u=0,l=1,c=2,d=4,f=5,p=6,g=0,m=1,h=2,v=-2,y=-3,M=-4,A=-5,b=8,w=1,D=2,T=3,C=4,I=5,x=6,S=7,N=8,E=9,O=10,L=11,P=12,k=13,R=14,j=15,B=16,z=17,_=18,V=19,F=20,U=21,G=22,W=23,Q=24,Y=25,H=26,K=27,X=28,q=29,Z=30,J=31,$=32,ee=852,te=592,ne=15;function re(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ae(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ie(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=w,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(ee),t.distcode=t.distdyn=new r.Buf32(te),t.sane=1,t.back=-1,g):v}function oe(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):v}function se(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?v:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,oe(e))):v}function ue(e,t){var n,r;return e?(r=new ae,e.state=r,r.window=null,(n=se(e,t))!==g&&(e.state=null),n):v}var le,ce,de=!0;function fe(e){if(de){var t;for(le=new r.Buf32(512),ce=new r.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(s(l,e.lens,0,288,le,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(c,e.lens,0,32,ce,0,e.work,{bits:5}),de=!1}e.lencode=le,e.lenbits=9,e.distcode=ce,e.distbits=5}function pe(e,t,n,a){var i,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>a&&(i=a),r.arraySet(o.window,t,n-a,i,o.wnext),(a-=i)?(r.arraySet(o.window,t,n-a,a,0),o.wnext=a,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=i(n.check,xe,2,0),se=0,ue=0,n.mode=D;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&se)<<8)+(se>>8))%31){e.msg="incorrect header check",n.mode=Z;break}if((15&se)!==b){e.msg="unknown compression method",n.mode=Z;break}if(ue-=4,we=8+(15&(se>>>=4)),0===n.wbits)n.wbits=we;else if(we>n.wbits){e.msg="invalid window size",n.mode=Z;break}n.dmax=1<>8&1),512&n.flags&&(xe[0]=255&se,xe[1]=se>>>8&255,n.check=i(n.check,xe,2,0)),se=0,ue=0,n.mode=T;case T:for(;ue<32;){if(0===ie)break e;ie--,se+=ee[ne++]<>>8&255,xe[2]=se>>>16&255,xe[3]=se>>>24&255,n.check=i(n.check,xe,4,0)),se=0,ue=0,n.mode=C;case C:for(;ue<16;){if(0===ie)break e;ie--,se+=ee[ne++]<>8),512&n.flags&&(xe[0]=255&se,xe[1]=se>>>8&255,n.check=i(n.check,xe,2,0)),se=0,ue=0,n.mode=I;case I:if(1024&n.flags){for(;ue<16;){if(0===ie)break e;ie--,se+=ee[ne++]<>>8&255,n.check=i(n.check,xe,2,0)),se=0,ue=0}else n.head&&(n.head.extra=null);n.mode=x;case x:if(1024&n.flags&&((de=n.length)>ie&&(de=ie),de&&(n.head&&(we=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,ee,ne,de,we)),512&n.flags&&(n.check=i(n.check,ee,de,ne)),ie-=de,ne+=de,n.length-=de),n.length))break e;n.length=0,n.mode=S;case S:if(2048&n.flags){if(0===ie)break e;de=0;do{we=ee[ne+de++],n.head&&we&&n.length<65536&&(n.head.name+=String.fromCharCode(we))}while(we&&de>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=P;break;case O:for(;ue<32;){if(0===ie)break e;ie--,se+=ee[ne++]<>>=7&ue,ue-=7&ue,n.mode=K;break}for(;ue<3;){if(0===ie)break e;ie--,se+=ee[ne++]<>>=1)){case 0:n.mode=R;break;case 1:if(fe(n),n.mode=F,t===p){se>>>=2,ue-=2;break e}break;case 2:n.mode=z;break;case 3:e.msg="invalid block type",n.mode=Z}se>>>=2,ue-=2;break;case R:for(se>>>=7&ue,ue-=7&ue;ue<32;){if(0===ie)break e;ie--,se+=ee[ne++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Z;break}if(n.length=65535&se,se=0,ue=0,n.mode=j,t===p)break e;case j:n.mode=B;case B:if(de=n.length){if(de>ie&&(de=ie),de>oe&&(de=oe),0===de)break e;r.arraySet(te,ee,ne,de,ae),ie-=de,ne+=de,oe-=de,ae+=de,n.length-=de;break}n.mode=P;break;case z:for(;ue<14;){if(0===ie)break e;ie--,se+=ee[ne++]<>>=5,ue-=5,n.ndist=1+(31&se),se>>>=5,ue-=5,n.ncode=4+(15&se),se>>>=4,ue-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Z;break}n.have=0,n.mode=_;case _:for(;n.have>>=3,ue-=3}for(;n.have<19;)n.lens[Se[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Te={bits:n.lenbits},De=s(u,n.lens,0,19,n.lencode,0,n.work,Te),n.lenbits=Te.bits,De){e.msg="invalid code lengths set",n.mode=Z;break}n.have=0,n.mode=V;case V:for(;n.have>>16&255,ye=65535&Ie,!((he=Ie>>>24)<=ue);){if(0===ie)break e;ie--,se+=ee[ne++]<>>=he,ue-=he,n.lens[n.have++]=ye;else{if(16===ye){for(Ce=he+2;ue>>=he,ue-=he,0===n.have){e.msg="invalid bit length repeat",n.mode=Z;break}we=n.lens[n.have-1],de=3+(3&se),se>>>=2,ue-=2}else if(17===ye){for(Ce=he+3;ue>>=he)),se>>>=3,ue-=3}else{for(Ce=he+7;ue>>=he)),se>>>=7,ue-=7}if(n.have+de>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Z;break}for(;de--;)n.lens[n.have++]=we}}if(n.mode===Z)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Z;break}if(n.lenbits=9,Te={bits:n.lenbits},De=s(l,n.lens,0,n.nlen,n.lencode,0,n.work,Te),n.lenbits=Te.bits,De){e.msg="invalid literal/lengths set",n.mode=Z;break}if(n.distbits=6,n.distcode=n.distdyn,Te={bits:n.distbits},De=s(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Te),n.distbits=Te.bits,De){e.msg="invalid distances set",n.mode=Z;break}if(n.mode=F,t===p)break e;case F:n.mode=U;case U:if(ie>=6&&oe>=258){e.next_out=ae,e.avail_out=oe,e.next_in=ne,e.avail_in=ie,n.hold=se,n.bits=ue,o(e,ce),ae=e.next_out,te=e.output,oe=e.avail_out,ne=e.next_in,ee=e.input,ie=e.avail_in,se=n.hold,ue=n.bits,n.mode===P&&(n.back=-1);break}for(n.back=0;ve=(Ie=n.lencode[se&(1<>>16&255,ye=65535&Ie,!((he=Ie>>>24)<=ue);){if(0===ie)break e;ie--,se+=ee[ne++]<>Me)])>>>16&255,ye=65535&Ie,!(Me+(he=Ie>>>24)<=ue);){if(0===ie)break e;ie--,se+=ee[ne++]<>>=Me,ue-=Me,n.back+=Me}if(se>>>=he,ue-=he,n.back+=he,n.length=ye,0===ve){n.mode=H;break}if(32&ve){n.back=-1,n.mode=P;break}if(64&ve){e.msg="invalid literal/length code",n.mode=Z;break}n.extra=15&ve,n.mode=G;case G:if(n.extra){for(Ce=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=W;case W:for(;ve=(Ie=n.distcode[se&(1<>>16&255,ye=65535&Ie,!((he=Ie>>>24)<=ue);){if(0===ie)break e;ie--,se+=ee[ne++]<>Me)])>>>16&255,ye=65535&Ie,!(Me+(he=Ie>>>24)<=ue);){if(0===ie)break e;ie--,se+=ee[ne++]<>>=Me,ue-=Me,n.back+=Me}if(se>>>=he,ue-=he,n.back+=he,64&ve){e.msg="invalid distance code",n.mode=Z;break}n.offset=ye,n.extra=15&ve,n.mode=Q;case Q:if(n.extra){for(Ce=n.extra;ue>>=n.extra,ue-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Z;break}n.mode=Y;case Y:if(0===oe)break e;if(de=ce-oe,n.offset>de){if((de=n.offset-de)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Z;break}de>n.wnext?(de-=n.wnext,ge=n.wsize-de):ge=n.wnext-de,de>n.length&&(de=n.length),me=n.window}else me=te,ge=ae-n.offset,de=n.length;de>oe&&(de=oe),oe-=de,n.length-=de;do{te[ae++]=me[ge++]}while(--de);0===n.length&&(n.mode=U);break;case H:if(0===oe)break e;te[ae++]=n.length,oe--,n.mode=U;break;case K:if(n.wrap){for(;ue<32;){if(0===ie)break e;ie--,se|=ee[ne++]<>>=A=M>>>24,g-=A,0===(A=M>>>16&255))I[i++]=65535&M;else{if(!(16&A)){if(0==(64&A)){M=m[(65535&M)+(p&(1<>>=A,g-=A),g<15&&(p+=C[r++]<>>=A=M>>>24,g-=A,!(16&(A=M>>>16&255))){if(0==(64&A)){M=h[(65535&M)+(p&(1<u){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=A,g-=A,w>(A=i-o)){if((A=w-A)>c&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(D=0,T=f,0===d){if(D+=l-A,A2;)I[i++]=T[D++],I[i++]=T[D++],I[i++]=T[D++],b-=3;b&&(I[i++]=T[D++],b>1&&(I[i++]=T[D++]))}else{D=i-w;do{I[i++]=I[D++],I[i++]=I[D++],I[i++]=I[D++],b-=3}while(b>2);b&&(I[i++]=I[D++],b>1&&(I[i++]=I[D++]))}break}}break}}while(r>3,p&=(1<<(g-=b<<3))-1,e.next_in=r,e.next_out=i,e.avail_in=r=1&&0===R[I];I--);if(x>I&&(x=I),0===I)return l[c++]=20971520,l[c++]=20971520,f.bits=1,0;for(C=1;C0&&(0===e||1!==I))return-1;for(j[1]=0,D=1;D<15;D++)j[D+1]=j[D]+R[D];for(T=0;T852||2===e&&O>592)return 1;for(;;){M=D-N,d[T]y?(A=B[z+d[T]],b=P[k+d[T]]):(A=96,b=0),p=1<>N)+(g-=p)]=M<<24|A<<16|b|0}while(0!==g);for(p=1<>=1;if(0!==p?(L&=p-1,L+=p):L=0,T++,0==--R[D]){if(D===I)break;D=t[n+d[T]]}if(D>x&&(L&h)!==m){for(0===N&&(N=x),v+=C,E=1<<(S=D-N);S+N852||2===e&&O>592)return 1;l[m=L&h]=x<<24|S<<16|v-c|0}}return 0!==L&&(l[v+L]=D-N<<24|64<<16|0),f.bits=x,0}},function(e,t,n){"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}},function(e,t,n){"use strict";var r=n(49),a=n(13),i=n(28),o=n(113),s=n(114),u=n(94),l=n(202),c=n(203),d=n(64),f=n(206),p=function(e,t,n){var r,o=a.getTypeOf(t),c=a.extend(n||{},s);c.date=c.date||new Date,null!==c.compression&&(c.compression=c.compression.toUpperCase()),"string"==typeof c.unixPermissions&&(c.unixPermissions=parseInt(c.unixPermissions,8)),c.unixPermissions&&16384&c.unixPermissions&&(c.dir=!0),c.dosPermissions&&16&c.dosPermissions&&(c.dir=!0),c.dir&&(e=m(e)),c.createFolders&&(r=g(e))&&h.call(this,r,!0);var p="string"===o&&!1===c.binary&&!1===c.base64;n&&void 0!==n.binary||(c.binary=!p),(t instanceof u&&0===t.uncompressedSize||c.dir||!t||0===t.length)&&(c.base64=!1,c.binary=!0,t="",c.compression="STORE",o="string");var v=null;v=t instanceof u||t instanceof i?t:d.isNode&&d.isStream(t)?new f(e,t):a.prepareContent(e,t,c.binary,c.optimizedBinaryString,c.base64);var y=new l(e,v,c);this.files[e]=y},g=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},h=function(e,t){return t=void 0!==t?t:s.createFolders,e=m(e),this.files[e]||p.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function v(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,r;for(t in this.files)this.files.hasOwnProperty(t)&&(r=this.files[t],(n=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(n,r))},filter:function(e){var t=[];return this.forEach(function(n,r){e(n,r)&&t.push(r)}),t},file:function(e,t,n){if(1===arguments.length){if(v(e)){var r=e;return this.filter(function(e,t){return!t.dir&&r.test(e)})}var a=this.files[this.root+e];return a&&!a.dir?a:null}return e=this.root+e,p.call(this,e,t,n),this},folder:function(e){if(!e)return this;if(v(e))return this.filter(function(t,n){return n.dir&&e.test(t)});var t=this.root+e,n=h.call(this,t),r=this.clone();return r.root=n.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter(function(t,n){return n.name.slice(0,e.length)===e}),r=0;r>1,c=-7,d=n?a-1:0,f=n?-1:1,p=e[t+d];for(d+=f,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=f,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=r;c>0;o=256*o+e[t+d],d+=f,c-=8);if(0===i)i=1-l;else{if(i===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),i-=l}return(p?-1:1)*o*Math.pow(2,i-r)},t.write=function(e,t,n,r,a,i){var o,s,u,l=8*i-a-1,c=(1<>1,f=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,g=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(o++,u/=2),o+d>=c?(s=0,o=c):o+d>=1?(s=(t*u-1)*Math.pow(2,a),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,a),o=0));a>=8;e[n+p]=255&s,p+=g,s/=256,a-=8);for(o=o<0;e[n+p]=255&o,p+=g,o/=256,l-=8);e[n+p-g]|=128*m}},function(e,t,n){var r=function(){try{return n(61)}catch(e){}}();(t=e.exports=n(105)).Stream=r||t,t.Readable=t,t.Writable=n(90),t.Duplex=n(46),t.Transform=n(91),t.PassThrough=n(107)},function(e,t){},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,a=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(a.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(a.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(177),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(33))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,a,i,o,s,u=1,l={},c=!1,d=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){g(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){g(e.data)},r=function(e){i.port2.postMessage(e)}):d&&"onreadystatechange"in d.createElement("script")?(a=d.documentElement,r=function(e){var t=d.createElement("script");t.onreadystatechange=function(){g(e),t.onreadystatechange=null,a.removeChild(t),t=null},a.appendChild(t)}):r=function(e){setTimeout(g,0,e)}:(o="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&g(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(o+t,"*")}),f.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;nn;)t.push(arguments[n++]);return h[++m]=function(){s("function"==typeof e?e:Function(e),t)},r(m),m},p=function(e){delete h[e]},"process"==n(197)(d)?r=function(e){d.nextTick(o(v,e,1))}:g?(i=(a=new g).port2,a.port1.onmessage=y,r=o(i.postMessage,i,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(r=function(e){c.postMessage(e+"","*")},c.addEventListener("message",y,!1)):r="onreadystatechange"in l("script")?function(e){u.appendChild(l("script")).onreadystatechange=function(){u.removeChild(this),v.call(e)}}:function(e){setTimeout(o(v,e,1),0)}),e.exports={set:f,clear:p}},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){e.exports=n(65).document&&document.documentElement},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=n(199);function i(){}var o={},s=["REJECTED"],u=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==i&&g(this,e)}function d(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function f(e,t,n){a(function(){var r;try{r=t(n)}catch(t){return o.reject(e,t)}r===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,r)})}function p(e){var t=e&&e.then;if(e&&("object"===r(e)||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function g(e,t){var n=!1;function r(t){n||(n=!0,o.reject(e,t))}function a(t){n||(n=!0,o.resolve(e,t))}var i=m(function(){t(a,r)});"error"===i.status&&r(i.value)}function m(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}e.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===s)return this;var n=new this.constructor(i);this.state!==l?f(n,this.state===u?e:t,this.outcome):this.queue.push(new d(n,e,t));return n},d.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){f(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){o.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){f(this.promise,this.onRejected,e)},o.resolve=function(e,t){var n=m(p,t);if("error"===n.status)return o.reject(e,n.value);var r=n.value;if(r)g(e,r);else{e.state=u,e.outcome=t;for(var a=-1,i=e.queue.length;++a>>=8;return r},l=function(e,t,n,a,l,c){var d,f,p=e.file,g=e.compression,m=c!==i.utf8encode,h=r.transformTo("string",c(p.name)),v=r.transformTo("string",i.utf8encode(p.name)),y=p.comment,M=r.transformTo("string",c(y)),A=r.transformTo("string",i.utf8encode(y)),b=v.length!==p.name.length,w=A.length!==y.length,D="",T="",C="",I=p.dir,x=p.date,S={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(S.crc32=e.crc32,S.compressedSize=e.compressedSize,S.uncompressedSize=e.uncompressedSize);var N=0;t&&(N|=8),m||!b&&!w||(N|=2048);var E,O,L,P=0,k=0;I&&(P|=16),"UNIX"===l?(k=798,P|=(E=p.unixPermissions,O=I,L=E,E||(L=O?16893:33204),(65535&L)<<16)):(k=20,P|=63&(p.dosPermissions||0)),d=x.getUTCHours(),d<<=6,d|=x.getUTCMinutes(),d<<=5,d|=x.getUTCSeconds()/2,f=x.getUTCFullYear()-1980,f<<=4,f|=x.getUTCMonth()+1,f<<=5,f|=x.getUTCDate(),b&&(T=u(1,1)+u(o(h),4)+v,D+="up"+u(T.length,2)+T),w&&(C=u(1,1)+u(o(M),4)+A,D+="uc"+u(C.length,2)+C);var R="";return R+="\n\0",R+=u(N,2),R+=g.magic,R+=u(d,2),R+=u(f,2),R+=u(S.crc32,4),R+=u(S.compressedSize,4),R+=u(S.uncompressedSize,4),R+=u(h.length,2),R+=u(D.length,2),{fileRecord:s.LOCAL_FILE_HEADER+R+h+D,dirRecord:s.CENTRAL_FILE_HEADER+u(k,2)+R+u(M.length,2)+"\0\0\0\0"+u(P,4)+u(a,4)+h+D+M}};function c(e,t,n,r){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(c,a),c.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,a.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=l(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=l(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return s.DATA_DESCRIPTOR+u(e.crc32,4)+u(e.compressedSize,4)+u(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e0)this.isSignature(t,i.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=u},function(e,t,n){"use strict";var r=n(122);function a(e){r.call(this,e)}n(13).inherits(a,r),a.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},a.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},a.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},a.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},e.exports=a},function(e,t,n){"use strict";var r=n(123);function a(e){r.call(this,e)}n(13).inherits(a,r),a.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},e.exports=a},function(e,t,n){"use strict";var r=n(120),a=n(13),i=n(94),o=n(95),s=n(49),u=n(118),l=n(40);function c(e,t){this.options=e,this.loadOptions=t}c.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in u)if(u.hasOwnProperty(t)&&u[t].magic===e)return u[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0===e&&(this.dosPermissions=63&this.externalFileAttributes),3===e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=r(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,n,r,a=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index=0;)this.up();return this.onEnd()},e.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},e.prototype.openNode=function(e){if(!e.isOpen)return!this.root&&0===this.currentLevel&&e instanceof d&&(this.root=e),this.onData(this.writer.openNode(e,this.currentLevel)),e.isOpen=!0},e.prototype.closeNode=function(e){if(!e.isClosed)return this.onData(this.writer.closeNode(e,this.currentLevel)),e.isClosed=!0},e.prototype.onData=function(e){return this.documentStarted=!0,this.onDataCallback(e)},e.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},e.prototype.ele=function(){return this.element.apply(this,arguments)},e.prototype.nod=function(e,t,n){return this.node(e,t,n)},e.prototype.txt=function(e){return this.text(e)},e.prototype.dat=function(e){return this.cdata(e)},e.prototype.com=function(e){return this.comment(e)},e.prototype.ins=function(e,t){return this.instruction(e,t)},e.prototype.dec=function(e,t,n){return this.declaration(e,t,n)},e.prototype.dtd=function(e,t,n){return this.doctype(e,t,n)},e.prototype.e=function(e,t,n){return this.element(e,t,n)},e.prototype.n=function(e,t,n){return this.node(e,t,n)},e.prototype.t=function(e){return this.text(e)},e.prototype.d=function(e){return this.cdata(e)},e.prototype.c=function(e){return this.comment(e)},e.prototype.r=function(e){return this.raw(e)},e.prototype.i=function(e,t){return this.instruction(e,t)},e.prototype.att=function(){return this.currentNode&&this.currentNode instanceof c?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},e.prototype.a=function(){return this.currentNode&&this.currentNode instanceof c?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},e.prototype.ent=function(e,t){return this.entity(e,t)},e.prototype.pent=function(e,t){return this.pEntity(e,t)},e.prototype.not=function(e,t){return this.notation(e,t)},e}()}).call(this)},function(e,t,n){(function(){var t,r,a,i,o,s,u,l,c,d,f,p,g,m={}.hasOwnProperty;u=n(69),l=n(70),t=n(67),r=n(68),c=n(66),f=n(75),p=n(76),d=n(77),a=n(71),i=n(73),o=n(72),s=n(74),g=n(126),e.exports=function(e){function n(e,t){n.__super__.constructor.call(this,t),this.stream=e}return function(e,t){for(var n in t)m.call(t,n)&&(e[n]=t[n]);function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype}(n,g),n.prototype.document=function(e){var t,n,a,i,o,s,c,f;for(n=0,i=(s=e.children).length;n"+this.endline(e))},n.prototype.comment=function(e,t){return this.stream.write(this.space(t)+"\x3c!-- "+e.text+" --\x3e"+this.endline(e))},n.prototype.declaration=function(e,t){return this.stream.write(this.space(t)),this.stream.write('"),this.stream.write(this.endline(e))},n.prototype.docType=function(e,n){var u,l,c,f;if(n||(n=0),this.stream.write(this.space(n)),this.stream.write("0){for(this.stream.write(" ["),this.stream.write(this.endline(e)),l=0,c=(f=e.children).length;l"),this.stream.write(this.endline(e))},n.prototype.element=function(e,n){var a,i,o,s,u,l,g,h;for(u in n||(n=0),h=this.space(n),this.stream.write(h+"<"+e.name),l=e.attributes)m.call(l,u)&&(a=l[u],this.attribute(a));if(0===e.children.length||e.children.every(function(e){return""===e.value}))this.allowEmpty?this.stream.write(">"):this.stream.write(this.spacebeforeslash+"/>");else if(this.pretty&&1===e.children.length&&null!=e.children[0].value)this.stream.write(">"),this.stream.write(e.children[0].value),this.stream.write("");else{for(this.stream.write(">"+this.newline),o=0,s=(g=e.children).length;o")}return this.stream.write(this.endline(e))},n.prototype.processingInstruction=function(e,t){return this.stream.write(this.space(t)+""+this.endline(e))},n.prototype.raw=function(e,t){return this.stream.write(this.space(t)+e.value+this.endline(e))},n.prototype.text=function(e,t){return this.stream.write(this.space(t)+e.value+this.endline(e))},n.prototype.dtdAttList=function(e,t){return this.stream.write(this.space(t)+""+this.endline(e))},n.prototype.dtdElement=function(e,t){return this.stream.write(this.space(t)+""+this.endline(e))},n.prototype.dtdEntity=function(e,t){return this.stream.write(this.space(t)+""+this.endline(e))},n.prototype.dtdNotation=function(e,t){return this.stream.write(this.space(t)+""+this.endline(e))},n.prototype.endline=function(e){return e.isLastRootNode?"":this.newline},n}()}).call(this)},function(e,t,n){(t=e.exports=n(54)(!1)).push([e.i,".RenderWindowWithControlBar-module-rootContainer_1lck8 {\n position: relative;\n}\n\n.RenderWindowWithControlBar-module-renderWindow_FOOWk {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n}\n\n.RenderWindowWithControlBar-module-control_1muSX {\n z-index: 1;\n position: absolute;\n}\n",""]),t.locals={rootContainer:"RenderWindowWithControlBar-module-rootContainer_1lck8",renderWindow:"RenderWindowWithControlBar-module-renderWindow_FOOWk",control:"RenderWindowWithControlBar-module-control_1muSX"}},function(e,t,n){"use strict";n.r(t);var r=n(24),a=n(3),i=n(20),o=n(10);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(e){var t=s(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0],4),n=t[0],r=t[1],i=t[2],u=t[3],l=e.getContext("2d").getImageData(n,r,i||e.width,u||e.height),c=o.a.newInstance({type:"vtkImageData"});c.setOrigin(0,0,0),c.setSpacing(1,1,1),c.setExtent(0,(i||e.width)-1,0,(u||e.height)-1,0,0);var d=a.a.newInstance({numberOfComponents:4,values:new Uint8Array(l.data.buffer)});return d.setName("scalars"),c.getPointData().setScalars(d),c}var l={canvasToImageData:u,imageToImageData:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{flipX:!1,flipY:!1,rotate:0},n=document.createElement("canvas");n.width=e.width,n.height=e.height;var r=n.getContext("2d"),a=t.flipX,i=t.flipY,o=t.rotate;return r.translate(n.width/2,n.height/2),r.scale(a?-1:1,i?-1:1),r.rotate(o*Math.PI/180),r.drawImage(e,-e.width/2,-e.width/2),u(n)}},c=n(37),d=n(2),f=n(9),p=n(14),g=n(0);var m={workCount:0};function h(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,m,n),g.a.obj(e,t),g.a.event(e,t,"change"),g.a.get(e,t,["workCount"]),function(e,t){t.classHierarchy.push("vtkProgressHandler"),e.startWork=function(){t.workCount+=1,1===t.workCount&&e.invokeChange(!0)},e.stopWork=function(){t.workCount-=1,0===t.workCount&&e.invokeChange(!1)},e.isWorking=function(){return!!t.workCount},e.wrapPromise=function(t){return e.startWork(),new Promise(function(n,r){t.then(function(){e.stopWork(),n.apply(void 0,arguments)},function(t){e.stopWork(),r(t)})})},e.wrapPromiseFunction=function(t){return function(){return e.wrapPromise(t.apply(void 0,arguments))}}}(e,t)}var v={newInstance:g.a.newInstance(h,"vtkProgressHandler"),extend:h},y=n(36),M=n(79);function A(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function b(e){return e}function w(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0!==e&&"undefined"!==e?"["===e[0]&&"]"===e[e.length-1]?e.substring(1,e.length-1).split(",").map(function(e){return w(e.trim())}):""===e||Number.isNaN(Number(e))?e:Number(e):void 0)}var D={toNativeType:w,extractURLParameters:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.search,n={},r=e?w:b;return(t||"").replace(/#.*/,"").replace("?","").split("&").forEach(function(e){var t=A(e.split("=").map(function(e){return decodeURIComponent(e)}),2),a=t[0],i=t[1];a&&(n[a]=!i||r(i))}),n}},T=[];var C={name:"",numberOfComponents:1,size:0,dataType:"JSON"};function I(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,C,n),!t.empty&&!t.values&&!t.size)throw new TypeError("Cannot create vtkVariantArray object without: size > 0, values");t.values?Array.isArray(t.values)&&(t.values=t.values):t.values=[],t.values&&(t.size=t.values.length),g.a.obj(e,t),g.a.set(e,t,["name"]),function(e,t){t.classHierarchy.push("vtkVariantArray"),e.getComponent=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.values[e*t.numberOfComponents+n]},e.setComponent=function(n,r,a){a!==t.values[n*t.numberOfComponents+r]&&(t.values[n*t.numberOfComponents+r]=a,e.modified())},e.getData=function(){return t.values},e.getTuple=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T,r=t.numberOfComponents||1;n.length&&(n.length=r);for(var a=e*r,i=0;i0&&void 0!==arguments[0]?arguments[0]:1)*t.numberOfComponents},e.getNumberOfComponents=function(){return t.numberOfComponents},e.getNumberOfValues=function(){return t.values.length},e.getNumberOfTuples=function(){return t.values.length/t.numberOfComponents},e.getDataType=function(){return t.dataType},e.newClone=function(){return x({name:t.name,numberOfComponents:t.numberOfComponents})},e.getName=function(){return t.name||(e.modified(),t.name="vtkVariantArray".concat(e.getMTime())),t.name},e.setData=function(n,r){t.values=n,t.size=n.length,r&&(t.numberOfComponents=r),t.size%t.numberOfComponents!=0&&(t.numberOfComponents=1),e.modified()}}(e,t)}var x=g.a.newInstance(I,"vtkVariantArray"),S={newInstance:x,extend:I},N={vtkCellArray:r.a,vtkDataArray:a.a,vtkEndian:i.a,vtkImageHelper:l,vtkLookupTable:c.a,vtkMath:d.a,vtkMatrixBuilder:f.a,vtkPoints:p.a,vtkProgressHandler:v,vtkScalarsToColors:y.a,vtkStringArray:M.a,vtkURLExtract:D,vtkVariantArray:S},E=n(11);function O(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);te[2*c+1]?(o[c]=0,l[c]=e[2*c+1],i=!1):o[c]=2;if(i)return r[0]=t[0],r[1]=t[1],r[2]=t[2],a[0]=0,1;for(var d=0;d<3;d++)2!==o[d]&&0!==n[d]?u[d]=(l[d]-t[d])/n[d]:u[d]=-1;for(var f=0;f<3;f++)u[s]1||u[s]<0)return 0;a[0]=u[s];for(var p=0;p<3;p++)if(s!==p){if(r[p]=t[p]+u[s]*n[p],r[p]e[2*p+1])return 0}else r[p]=l[p];return 1}};var P={};function k(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,P,n),g.a.obj(e,t),t.bbox||(t.bbox=E.a.newInstance()),function(e,t){t.classHierarchy.push("vtkBox"),e.setBounds=function(){var e=[];if(Array.isArray(arguments.length<=0?void 0:arguments[0]))e=arguments.length<=0?void 0:arguments[0];else for(var n=0;n1?(f=0,i=s[p]-d[p]):(i=o<=.5?c[p]-s[p]:s[p]-d[p])>u&&(u=i):(i=Math.abs(s[p]-c[p]))>0&&(f=0),i>0&&(l+=i*i);return l=Math.sqrt(l),f?u:l},e.addBounds=function(){var e,n=[];if(Array.isArray(arguments.length<=0?void 0:arguments[0]))n=arguments.length<=0?void 0:arguments[0];else for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,B,n),g.a.obj(e,t),t.points=p.a.newInstance(),g.a.get(e,t,["points","pointsIds"]),function(e,t){t.classHierarchy.push("vtkCell"),e.initialize=function(e,n,r){t.pointsIds=n,t.points.setNumberOfPoints(e),t.points.setData(r.getData())},e.getBounds=function(){var e=t.points.getNumberOfPoints(),n=[];if(e){t.points.getPoint(0,n),t.bounds[0]=n[0],t.bounds[1]=n[0],t.bounds[2]=n[1],t.bounds[3]=n[1],t.bounds[4]=n[2],t.bounds[5]=n[2];for(var r=1;rt.bounds[1]?n[0]:t.bounds[1],t.bounds[2]=n[1]t.bounds[3]?n[1]:t.bounds[3],t.bounds[4]=n[2]t.bounds[5]?n[2]:t.bounds[5]}else d.a.uninitializeBounds(t.bounds);return t.bounds},e.getLength2=function(){e.getBounds();for(var n=0,r=0,a=0;a<3;a++)n+=(r=t.bounds[2*a+1]-t.bounds[2*a])*r;return n},e.getParametricDistance=function(e){for(var t,n=0,r=0;r<3;r++)(t=e[r]<0?-e[r]:e[r]>1?e[r]-1:0)>n&&(n=t);return n},e.getNumberOfPoints=function(){return t.points.getNumberOfPoints()},e.deepCopy=function(e){e.initialize(t.points.getNumberOfPoints(),t.pointsIds,t.points)},e.getCellDimension=function(){},e.intersectWithLine=function(e,t,n,r,a,i,o){},e.evaluatePosition=function(e,t,n,r,a,i){}}(e,t)}var _=g.a.newInstance(z,"vtkCell"),V=Object.assign({newInstance:_,extend:z});var F={angle:15};function U(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,F,n),g.a.obj(e,t),g.a.setGet(e,t,["angle"]),function(e,t){t.classHierarchy.push("vtkCone"),e.evaluateFunction=function(e){var n=Math.tan(d.a.radiansFromDegrees(t.angle));return e[1]*e[1]+e[2]*e[2]-e[0]*e[0]*n*n},e.evaluateGradient=function(e){var n=Math.tan(d.a.radiansFromDegrees(t.angle));return[-2*e[0]*n*n,2*e[1],2*e[2]]}}(e,t)}var G=g.a.newInstance(U,"vtkCone"),W=Object.assign({newInstance:G,extend:U});var Q={evaluate:function(e,t,n,r){var a=new Float32Array(3);a[0]=r[0]-t[0],a[1]=r[1]-t[1],a[2]=r[2]-t[2];var i=d.a.dot(n,a);return d.a.dot(a,a)-i*i-e*e}};var Y={radius:.5,center:[0,0,0],axis:[0,1,0]};function H(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Y,n),g.a.obj(e,t),g.a.setGet(e,t,["radius"]),g.a.setGetArray(e,t,["center","axis"],3),function(e,t){t.classHierarchy.push("vtkCylinder"),e.evaluateFunction=function(e){var n=[e[0]-t.center[0],e[1]-t.center[1],e[2]-t.center[2]],r=d.a.dot(t.axis,n);return d.a.dot(n,n)-r*r-t.radius*t.radius},e.evaluateGradient=function(e){var n=t.axis[0]*(e[0]-t.center[0])+t.axis[1]*(e[1]-t.center[1])+t.axis[2]*(e[2]-t.center[2]),r=[t.center[0]+n*t.axis[0],t.center[1]+n*t.axis[1],t.center[2]+n*t.axis[2]];return[2*(e[0]-r[0]),2*(e[1]-r[1]),2*(e[2]-r[2])]}}(e,t)}var K=g.a.newInstance(H,"vtkCylinder"),X=Object.assign({newInstance:K,extend:H},Q),q=n(42),Z=n(59),J=g.a.vtkErrorMacro;var $={convertItkToVtkImage:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(e.imageType.pixelType){case 1:case 2:case 3:break;default:return J("Cannot handle ITK.js pixel type ".concat(e.imageType.pixelType)),null}for(var n={origin:[0,0,0],spacing:[1,1,1]},r=[1,1,1],i=[1,0,0,0,1,0,0,0,1],s=0;s2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ne,n),g.a.obj(e,t),g.a.setGet(e,t,["operation"]),function(e,t){t.classHierarchy.push("vtkImplicitBoolean");var n=Object.assign({},e);e.getMTime=function(){var e=n.getMTime();if(!t.functions||t.functions.length<=0)return e;for(var r=0;rn&&(n=o)}}else{n=t.functions[0].evaluateFunction(e);for(var s=1;sn&&(n=u)}}return n},e.evaluateGradient=function(e){var n=t.axis[0]*(e[0]-t.center[0])+t.axis[1]*(e[1]-t.center[1])+t.axis[2]*(e[2]-t.center[2]),r=new Float32Array(3);return r[0]=t.center[0]+n*t.axis[0],r[1]=t.center[1]+n*t.axis[1],r[2]=t.center[2]+n*t.axis[2],[2*(e[0]-r[0]),2*(e[1]-r[1]),2*(e[2]-r[2])]}}(e,t)}var ae=g.a.newInstance(re,"vtkImplicitBoolean"),ie=Object.assign({newInstance:ae,extend:re},ee),oe={IntersectionState:{NO_INTERSECTION:0,YES_INTERSECTION:1,ON_LINE:2}},se=oe.IntersectionState;function ue(e,t,n){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i={t:Number.MIN_VALUE,distance:0},o=[];o[0]=n[0]-t[0],o[1]=n[1]-t[1],o[2]=n[2]-t[2];var s=o[0]*(e[0]-t[0])+o[1]*(e[1]-t[1])+o[2]*(e[2]-t[2]),u=d.a.dot(o,o),l=1e-5*s;return 0!==u&&(i.t=s/u),l<0&&(l=-l),-l1?r=n:(r=o,o[0]=t[0]+i.t*o[0],o[1]=t[1]+i.t*o[1],o[2]=t[2]+i.t*o[2]),a&&(a[0]=r[0],a[1]=r[1],a[2]=r[2]),i.distance=d.a.distance2BetweenPoints(r,e),i}function le(e,t,n,r,a,i){var o=[],s=[],u=[];a[0]=0,i[0]=0,o[0]=t[0]-e[0],o[1]=t[1]-e[1],o[2]=t[2]-e[2],s[0]=r[0]-n[0],s[1]=r[1]-n[1],s[2]=r[2]-n[2],u[0]=n[0]-e[0],u[1]=n[1]-e[1],u[2]=n[2]-e[2];var l=[];l[0]=[d.a.dot(o,o),-d.a.dot(o,s)],l[1]=[l[0][1],d.a.dot(s,s)];var c=[];if(c[0]=d.a.dot(o,u),c[1]=-d.a.dot(s,u),0===d.a.solveLinearSystem(l,c,2)){for(var f,p=Number.MAX_VALUE,g=[e,t,n,r],m=[n,n,e,e],h=[r,r,t,t],v=[i[0],i[0],a[0],a[0]],y=[a[0],a[0],i[0],i[0]],M=0;M<4;M++)(f=ue(g[M],m[M],h[M])).distance=0&&a[0]<=1&&i[0]>=0&&i[0]<=1?se.YES_INTERSECTION:se.NO_INTERSECTION}var ce={distanceToLine:ue,intersection:le};var de={};function fe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,de,n),V.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkLine"),e.getCellDimension=function(){},e.intersectWithLine=function(e,n,r,a,i){var o={intersect:0,t:Number.MIN_VALUE,subId:0};i[1]=0,i[2]=0;var s=[],u=[],l=[];t.points.getPoint(0,u),t.points.getPoint(1,l);var c=[],f=[],p=le(e,n,u,l,c,f);if(o.t=c[0],i[0]=f[0],p===se.YES_INTERSECTION){for(var g=0;g<3;g++)a[g]=u[g]+i[0]*(l[g]-u[g]),s[g]=e[g]+o.t*(n[g]-e[g]);if(d.a.distance2BetweenPoints(a,s)<=r*r)return o.intersect=1,o}else{var m;if(o.t<0)return o.t=0,m=ue(e,u,l,a),i[0]=m.t,m.distance<=r*r?(o.intersect=1,o):o;if(o.t>1)return o.t=1,m=ue(n,u,l,a),i[0]=m.t,m.distance<=r*r?(o.intersect=1,o):o;if(i[0]<0)return i[0]=0,m=ue(u,e,n,a),o.t=m.t,m.distance<=r*r?(o.intersect=1,o):o;if(i[1]>1)return i[1]=1,m=ue(l,e,n,a),o.t=m.t,m.distance<=r*r?(o.intersect=1,o):o}return o},e.evaluatePosition=function(e,t,n,r,a,i){}}(e,t)}var pe=g.a.newInstance(fe,"vtkLine"),ge=Object.assign({newInstance:pe,extend:fe},ce,oe),me=["chemical json","name","inchi","formula","atoms","bonds","properties"];var he={"chemical json":0,name:"",inchi:"",formula:"",atoms:null,bonds:null,properties:null};function ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,he,n),g.a.obj(e,t),t.atoms||(t.atoms={}),t.bonds||(t.bonds={}),t.properties||(t.properties={}),g.a.setGet(e,t,me),function(e,t){t.classHierarchy.push("vtkMolecule")}(0,t)}var ye={newInstance:g.a.newInstance(ve,"vtkMolecule"),extend:ve},Me=g.a.vtkErrorMacro;var Ae={range:[0,0],clamping:!0,allowDuplicateScalars:!1};function be(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ae,n),g.a.obj(e,t),t.nodes=[],g.a.setGet(e,t,["allowDuplicateScalars","clamping"]),g.a.setArray(e,t,["range"],2),g.a.getArray(e,t,["range"]),function(e,t){t.classHierarchy.push("vtkPiecewiseFunction"),e.getSize=function(){return t.nodes.length},e.getType=function(){var e,n=0,r=0;t.nodes.length>0&&(n=t.nodes[0].y);for(var a=1;an)switch(r){case 0:case 1:r=1;break;default:case 2:r=3}else switch(r){case 0:case 2:r=2;break;default:case 1:r=3}if(n=e,3===r)break}switch(r){case 0:return"Constant";case 1:return"NonDecreasing";case 2:return"NonIncreasing";default:case 3:return"Varied"}},e.getDataPointer=function(){var e=t.nodes.length;if(t.function=null,e>0){t.function=[];for(var n=0;n0?t.nodes[n-1].x:t.clamping?-Number.MAX_VALUE:t.nodes[0].x},e.getNodeValue=function(e,n){var r=t.nodes.length;return e<0||e>=r?(Me("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].y,n[2]=t.nodes[e].midpoint,n[3]=t.nodes[e].sharpness,1)},e.setNodeValue=function(n,r){var a=t.nodes.length;if(n<0||n>=a)return Me("Index out of range!"),-1;var i=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].y=r[1],t.nodes[n].midpoint=r[2],t.nodes[n].sharpness=r[3],i!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.addPoint=function(t,n){return e.addPointLong(t,n,.5,0)},e.addPointLong=function(n,r,a,i){if(a<0||a>1)return Me("Midpoint outside range [0.0, 1.0]"),-1;if(i<0||i>1)return Me("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);var o,s={x:n,y:r,midpoint:a,sharpness:i};for(t.nodes.push(s),e.sortAndUpdateRange(),o=0;o=t.nodes.length)return-1;var a=r,i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),a},e.removeAllPoints=function(){t.nodes=[],e.sortAndUpdateRange()},e.addSegment=function(n,r,a,i){e.sortAndUpdateRange();for(var o=0;o=n&&t.nodes[o].x<=a?t.nodes.splice(o,1):o++;e.addPoint(n,r,.5,0),e.addPoint(a,i,.5,0)},e.getValue=function(t){var n=[];return e.getTable(t,t,1,n),n[0]},e.adjustRange=function(n){if(n.length<2)return 0;var r=e.getRange();r[0]n[1]?e.addPoint(n[1],e.getValue(n[1])):e.addPoint(n[1],e.getValue(r[1])),e.sortAndUpdateRange();for(var a=0;a=n[0]&&t.nodes[a].x<=n[1]?t.nodes.splice(a,1):++a;return e.sortAndUpdateRange(),1},e.estimateMinNumberOfSamples=function(t,n){var r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=function(){var e=t.nodes.length;if(e<2)return-1;for(var n=t.nodes[1].x-t.nodes[0].x,r=0;r4&&void 0!==arguments[4]?arguments[4]:1,s=0,u=t.nodes.length,l=0;0!==u&&(l=t.nodes[u-1].y);var c=0,d=0,f=0,p=0,g=0,m=0,h=0;for(i=0;i1?e+i/(r-1)*(n-e):.5*(e+n);st.nodes[s].x;)++s.99999&&(m=.99999));if(s>=u)a[v]=t.clamping?l:0;else if(0===s)a[v]=t.clamping?t.nodes[0].y:0;else{var y=(c-d)/(f-d);if(y=y.99){if(y<.5){a[v]=p;continue}a[v]=g;continue}if(h<.01){a[v]=(1-y)*p+y*g;continue}y<.5?y=.5*Math.pow(2*y,1+10*h):y>.5&&(y=1-.5*Math.pow(2*(1-y),1+10*h));var M=y*y,A=M*y,b=2*A-3*M+1,w=-2*A+3*M,D=A-2*M+y,T=A-M,C=(1-h)*(g-p);a[v]=b*p+w*g+D*C+T*C;var I=pg?p:g;a[v]=a[v]x?x:a[v]}}}}(e,t)}var we=g.a.newInstance(be,"vtkPiecewiseFunction"),De=Object.assign({newInstance:we,extend:be}),Te=n(18),Ce=n(80),Ie=n(4),xe={SelectionContent:{GLOBALIDS:0,PEDIGREEIDS:1,VALUES:2,INDICES:3,FRUSTUM:4,LOCATIONS:5,THRESHOLDS:6,BLOCKS:7,QUERY:8},SelectionField:{CELL:0,POINT:1,FIELD:2,VERTEX:3,EDGE:4,ROW:5}};var Se={contentType:-1,fieldType:-1,properties:null,selectionList:[]};function Ne(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Se,n),g.a.obj(e,t),t.properties={},g.a.setGet(e,t,["contentType","fieldType","properties","selectionList"]),function(e,t){t.classHierarchy.push("vtkSelectionNode"),e.getBounds=function(){return t.points.getBounds()}}(e,t)}var Ee=g.a.newInstance(Ne,"vtkSelectionNode"),Oe=Object.assign({newInstance:Ee,extend:Ne},xe);var Le={evaluate:function(e,t,n){return(n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])+(n[2]-t[2])*(n[2]-t[2])-e*e}};var Pe={radius:.5,center:[0,0,0]};function ke(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pe,n),g.a.obj(e,t),g.a.setGet(e,t,["radius"]),g.a.setGetArray(e,t,["center"],3),function(e,t){t.classHierarchy.push("vtkSphere"),e.evaluateFunction=function(e){return(e[0]-t.center[0])*(e[0]-t.center[0])+(e[1]-t.center[1])*(e[1]-t.center[1])+(e[2]-t.center[2])*(e[2]-t.center[2])-t.radius*t.radius},e.evaluateGradient=function(e){return[2-(e[0]-t.center[0]),2-(e[1]-t.center[1]),2-(e[2]-t.center[2])]}}(e,t)}var Re=g.a.newInstance(ke,"vtkSphere"),je=Object.assign({newInstance:Re,extend:ke},Le),Be=n(78);function ze(e,t,n,r){var a=n[0]-t[0],i=n[1]-t[1],o=n[2]-t[2],s=e[0]-t[0],u=e[1]-t[1],l=e[2]-t[2];r[0]=i*l-o*u,r[1]=o*s-a*l,r[2]=a*u-i*s}function _e(e,t,n,r){ze(e,t,n,r);var a=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);0!==a&&(r[0]/=a,r[1]/=a,r[2]/=a)}var Ve={computeNormalDirection:ze,computeNormal:_e};var Fe={};function Ue(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fe,n),V.extend(e,t,n),t.line=ge.newInstance(),function(e,t){t.classHierarchy.push("vtkTriangle"),e.getCellDimension=function(){},e.intersectWithLine=function(n,r,a,i,o){var s={subId:0,t:0,intersect:-1};o[2]=0;var u=a*a,l=[],c=[],f=[];t.points.getPoint(0,l),t.points.getPoint(1,c),t.points.getPoint(2,f);var p=[];if(_e(l,c,f,p),0!==p[0]||0!==p[1]||0!==p[2]){var g=Te.a.intersectWithLine(n,r,l,p);if(s.t=g.t,i[0]=g.x[0],i[1]=g.x[1],i[2]=g.x[2],!g.intersection)return o[0]=0,o[1]=0,s.intersect=0,s;var m=e.evaluatePosition(i,[],o,[]);if(m.evaluation>=0)return m.dist2<=u?(s.intersect=1,s):(s.intersect=m.evaluation,s)}var h=d.a.distance2BetweenPoints(l,c),v=d.a.distance2BetweenPoints(c,f),y=d.a.distance2BetweenPoints(f,l);if(h>v&&h>y?(t.line.getPoints().setPoint(0,l),t.line.getPoints().setPoint(1,c)):v>y&&v>h?(t.line.getPoints().setPoint(0,c),t.line.getPoints().setPoint(1,f)):(t.line.getPoints().setPoint(0,f),t.line.getPoints().setPoint(1,l)),t.line.intersectWithLine(n,r,a,i,o).intersect){for(var M=[],A=[],b=[],w=0;w<3;w++)M[w]=l[w]-f[w],A[w]=c[w]-f[w],b[w]=i[w]-f[w];return o[0]=d.a.dot(b,M)/y,o[1]=d.a.dot(b,A)/v,s.evaluation=1,s}return o[0]=0,o[1]=0,s.evaluation=0,s},e.evaluatePosition=function(e,n,r,a){var i,o,s,u,l,c,f,p={subId:0,dist2:0,evaluation:-1},g=[],m=[],h=[],v=[],y=[],M=[],A=[],b=0,w=[],D=[],T=[],C=[],I=[];p.subId=0,r[2]=0,t.points.getPoint(1,g),t.points.getPoint(2,m),t.points.getPoint(0,h),ze(g,m,h,v),Te.a.generalizedProjectPoint(e,g,v,I);var x=0;for(i=0;i<3;i++)(s=v[i]<0?-v[i]:v[i])>x&&(x=s,b=i);for(o=0,i=0;i<3;i++)i!==b&&(w[o++]=i);for(i=0;i<2;i++)y[i]=I[w[i]]-h[w[i]],M[i]=g[w[i]]-h[w[i]],A[i]=m[w[i]]-h[w[i]];if(0===(u=d.a.determinant2x2(M,A)))return r[0]=0,r[1]=0,p.evaluation=-1,p;if(r[0]=d.a.determinant2x2(y,A)/u,r[1]=d.a.determinant2x2(M,y)/u,a[0]=1-(r[0]+r[1]),a[1]=r[0],a[2]=r[1],a[0]>=0&&a[0]<=1&&a[1]>=0&&a[1]<=1&&a[2]>=0&&a[2]<=1)n&&(p.dist2=d.a.distance2BetweenPoints(I,e),n[0]=I[0],n[1]=I[1],n[2]=I[2]),p.evaluation=1;else{var S;if(n)if(a[1]<0&&a[2]<0)for(l=d.a.distance2BetweenPoints(e,h),c=ge.distanceToLine(e,g,h,S,T),f=ge.distanceToLine(e,h,m,S,C),l1?r[a]-1:0)>n&&(n=t);return n}}(e,t)}var Ge=g.a.newInstance(Ue,"vtkTriangle"),We=Object.assign({newInstance:Ge,extend:Ue},Ve),Qe={vtkBoundingBox:E.a,vtkBox:j,vtkCell:V,vtkCone:W,vtkCylinder:X,vtkDataSet:q.a,vtkDataSetAttributes:Z.a,vtkITKHelper:$,vtkImageData:o.a,vtkImplicitBoolean:ie,vtkLine:ge,vtkMolecule:ye,vtkPiecewiseFunction:De,vtkPlane:Te.a,vtkPointSet:Ce.a,vtkPolyData:Ie.a,vtkSelectionNode:Oe,vtkSphere:je,vtkStructuredData:Be.a,vtkTriangle:We},Ye=n(1),He={Mode:{RIGID_BODY:0,SIMILARITY:1,AFFINE:2}},Ke=He.Mode;var Xe={mode:Ke.SIMILARITY};function qe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xe,n),g.a.obj(e,t),t.matrix=Ye.c.create(),g.a.setGet(e,t,["sourceLandmark","targetLandmark","mode"]),g.a.get(e,t,["matrix"]),function(e,t){t.classHierarchy.push("vtkLandmarkTransform"),e.update=function(){Ye.c.identity(t.matrix);var e=t.sourceLandmark.getNumberOfPoints();if(t.targetLandmark.getNumberOfPoints()!==e||null===t.sourceLandmark||null===t.targetLandmark||0===e)return console.error("Error : Bad inputs of vtkLandmarkTransform"),t.matrix;for(var n=[0,0,0],r=[0,0,0],a=[0,0,0],i=0;i').concat(e.label,"")}).join(""),r.style.zIndex=1e3,r.style.position="absolute",r.style.left="50%",r.style.top="50%",r.style.transform="translate(-50%, -50%)",r.addEventListener("change",function(t){n.removeChild(r),e(et[Number(t.target.value)])}),n.appendChild(r)})}},vtkTimerLog:{getUniversalTime:function(){return+new Date}}}},pt=g.a.vtkErrorMacro;var gt={imageId:"default-image-id",sliceIndex:0};function mt(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gt,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGet(e,t,["imageId","sliceIndex"]),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkImageDataToCornerstoneImage"),e.requestData=function(e,n){var r=e[0];if(r){var a=r.getSpacing(),i=r.getDimensions(),o=r.getPointData().getScalars(),s=o.getRange(0),u=o.getData(),l=null;if(1===i[2])l=o.data;else{var c=t.sliceIndex*i[0]*i[1]*u.BYTES_PER_ELEMENT;l=new(g.a.TYPED_ARRAYS[o.getDataType()])(u.buffer,c,i[0]*i[1])}var d={imageId:t.imageId,color:o.getNumberOfComponents()>1,columnPixelSpacing:a[1],columns:i[1],width:i[1],rowPixelSpacing:a[0],rows:i[0],height:i[0],intercept:0,invert:!1,minPixelValue:s[0],maxPixelValue:s[1],sizeInBytes:l.length*l.BYTES_PER_ELEMENT,slope:1,windowCenter:Math.round((s[0]+s[1])/2),windowWidth:s[1]-s[0],decodeTimeInMS:0,getPixelData:function(){return l}};n[0]=d}else pt("Invalid or missing input")}}(e,t)}var ht={vtkImageDataToCornerstoneImage:{newInstance:g.a.newInstance(mt,"vtkImageDataToCornerstoneImage"),extend:mt}},vt=g.a.vtkErrorMacro;function yt(e,t){t.classHierarchy.push("vtkCutter");var n=Object.assign({},e);e.getMTime=function(){var e=n.getMTime();return t.cutFunction?e=Math.max(e,t.cutFunction.getMTime()):e},e.requestData=function(e,n){var r=e[0];if(r)if(t.cutFunction){var a=Ie.a.newInstance();!function(e,n){var r=e.getNumberOfCells(),a=e.getPoints(),i=a.getData(),o=a.getNumberOfPoints(),s=[],u=[],l=[];(!t.cutScalars||t.cutScalars.length0,D=!0,T=1;T0!==w){D=!1;break}if(!D){for(var C=[],I=M*h+1;I0;if(y[N]>0!==E){var O=S,L=N,P=y[L]-y[O];P<=0&&(O=N,L=S,P*=-1);var k=0;0!==P&&(k=(t.cutValue-y[O])/P);var R=C[O],j=C[L];g[0]=i[3*R],g[1]=i[3*R+1],g[2]=i[3*R+2],m[0]=i[3*j],m[1]=i[3*j+1],m[2]=i[3*j+2];var B=[g[0]+k*(m[0]-g[0]),g[1]+k*(m[1]-g[1]),g[2]+k*(m[2]-g[2])];x.push({pointEdge1:R,pointEdge2:j,intersectedPoint:B,newPointID:-1})}}for(var z=0;z2&&(l.push(Q),x.forEach(function(e){l.push(e.newPointID)}))}}}var Y=n.getPoints();Y.setData(s),3!==Y.getNumberOfComponents&&Y.setNumberOfComponents(3),0!==u.length&&n.getLines().setData(u),0!==l.length&&n.getPolys().setData(l)}(r,a),n[0]=a}else vt("Missing cut function");else vt("Invalid or missing input")}}var Mt={cutFunction:null,cutScalars:null,cutValue:0};function At(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mt,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGet(e,t,["cutFunction","cutValue"]),yt(e,t)}var bt={newInstance:g.a.newInstance(At,"vtkCutter"),extend:At},wt={vtkCutter:bt},Dt=n(21),Tt=n(7),Ct=g.a.vtkErrorMacro;function It(e,t,n,r){var a,i;e.set((a=n,i=0,t.map(function(e,t){return t===i?(i+=e+1,e):e+a})),r)}var xt={outputPointsPrecision:Dt.b.DEFAULT};function St(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xt,n),g.a.setGet(e,t,["outputPointsPrecision"]),g.a.obj(e,t),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkAppendPolyData"),e.requestData=function(n,r){var i=e.getNumberOfInputPorts();if(i)if(1!==i){for(var o=Ie.a.newInstance(),s=0,u=0,l=1,c=1,d=0,f=0,g=0,m=0,h=!0,v=!0,y=!0,M=0;M(l=A.getPoints().getDataType())?u:l);var w=A.getPointData();w?(h=h&&null!==w.getNormals(),v=v&&null!==w.getTCoords(),y=y&&null!==w.getScalars()):(h=!1,v=!1,y=!1)}t.outputPointsPrecision===Dt.b.SINGLE?u=Tt.b.FLOAT:t.outputPointsPrecision===Dt.b.DOUBLE&&(u=Tt.b.DOUBLE);var D=p.a.newInstance({dataType:u});D.setNumberOfPoints(s);var T=D.getData(),C=new Uint32Array(d),I=new Uint32Array(f),x=new Uint32Array(g),S=new Uint32Array(m),N=null,E=null,O=null,L=n[i-1];if(h){var P=L.getPointData().getNormals();N=a.a.newInstance({numberOfComponents:3,numberOfTuples:s,size:3*s,dataType:P.getDataType(),name:P.getName()})}if(v){var k=L.getPointData().getTCoords();E=a.a.newInstance({numberOfComponents:2,numberOfTuples:s,size:2*s,dataType:k.getDataType(),name:k.getName()})}if(y){var R=L.getPointData().getScalars();O=a.a.newInstance({numberOfComponents:R.getNumberOfComponents(),numberOfTuples:s,size:s*R.getNumberOfComponents(),dataType:R.getDataType(),name:R.getName()})}s=0,d=0,f=0,g=0,m=0;for(var j=0;j2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rt,n),g.a.obj(e,t),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkCalculator"),e.setFormula=function(n){return n!==t.formula&&(t.formula=n,e.modified(),!0)},e.getFormula=function(){return t.formula},e.augmentInputArrays=function(e,t){var n=t.slice(0);return e!==Lt.b.POINT&&e!==Lt.b.VERTEX||n.push({location:Lt.b.COORDINATE}),n},e.createSimpleFormulaObject=function(t,n,r,a){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return{getArrays:function(){return{input:e.augmentInputArrays(t,n.map(function(e){return{location:t,name:e}})),output:[{location:t,name:r,attribute:"outputAttributeType"in i?i.outputAttributeType:Dt.a.SCALARS,numberOfComponents:"numberOfOutputComponents"in i?i.numberOfOutputComponents:1}]}},evaluate:function(e,t){var n=new Array(e.length),r=e.map(function(e,t){var r=e.getNumberOfComponents(),a=e.getData();return 1===r?function(e){return a[e]}:function(r){return e.getTuple(r,n[t])}}),i=t[0],o=i.getData(),s=i.getNumberOfComponents(),u=new Array(s);if(1===s)o.forEach(function(e,t){o[t]=a.apply(void 0,Pt(r.map(function(e){return e(t)})).concat([t,u]))});else for(var l=i.getNumberOfTuples(),c=function(e){u=a.apply(void 0,Pt(r.map(function(t){return t(e)})).concat([e,u])),i.setTuple(e,u)},d=0;d4&&void 0!==arguments[4]?arguments[4]:{};return e.setFormula(e.createSimpleFormulaObject(t,n,r,a,i))},e.prepareArrays=function(e,t,n){var r=[],i=[];return e.input.forEach(function(e){if(e.location===Lt.b.COORDINATE)r.push(t.getPoints());else{var n=[[Lt.b.UNIFORM,function(e){return e.getFieldData()}],[Lt.b.POINT,function(e){return e.getPointData()}],[Lt.b.CELL,function(e){return e.getCellData()}],[Lt.b.VERTEX,function(e){return e.getVertexData()}],[Lt.b.EDGE,function(e){return e.getEdgeData()}],[Lt.b.ROW,function(e){return e.getRowData()}]].reduce(function(e,t){return e[t[0]]=t[1],e},{}),a="location"in e&&e.location in n?n[e.location](t):null;a?e.name?r.push(a.getArrayByName(e.name)):"index"in e?r.push(a.getArrayByIndex(e.index)):"attribute"in e&&e.location!==Lt.b.UNIFORM?r.push(a.getActiveAttribute(e.attribute)):(kt('No matching array for specifier "'.concat(JSON.stringify(e),'".')),r.push(null)):(kt('Specifier "'.concat(JSON.stringify(e),'" did not provide a usable location.')),r.push(null))}}),e.output.forEach(function(e){var r=Object.assign({},e),o="numberOfComponents"in r?r.numberOfComponents:1;if(e.location===Lt.b.UNIFORM&&"tuples"in r&&(r.size=o*r.tuples),e.location===Lt.b.COORDINATE){var s=t.getPoints(),u=p.a.newInstance({dataType:s.getDataType()});u.setNumberOfPoints(s.getNumberOfPoints(),s.getNumberOfComponents()),n.setPoints(u),i.push(u)}else{var l=[[Lt.b.UNIFORM,function(e){return e.getFieldData()},function(e,t){return"tuples"in t?t.tuples:0}],[Lt.b.POINT,function(e){return e.getPointData()},function(e){return e.getPoints().getNumberOfPoints()}],[Lt.b.CELL,function(e){return e.getCellData()},function(e){return e.getNumberOfCells()}],[Lt.b.VERTEX,function(e){return e.getVertexData()},function(e){return e.getNumberOfVertices()}],[Lt.b.EDGE,function(e){return e.getEdgeData()},function(e){return e.getNumberOfEdges()}],[Lt.b.ROW,function(e){return e.getRowData()},function(e){return e.getNumberOfRows()}]].reduce(function(e,t){return e[t[0]]={getData:t[1],getSize:t[2]},e},{}),c=null,d=0;if("location"in e&&e.location in l&&(c=l[e.location].getData(n),d=l[e.location].getSize(t,r)),d<=0)kt("Output array size could not be determined for ".concat(JSON.stringify(e),".")),i.push(null);else if(c){r.size=o*d;var f=a.a.newInstance(r),g=c.addArray(f);"attribute"in r&&e.location!==Lt.b.UNIFORM&&c.setActiveAttributeByIndex(g,r.attribute),i.push(f)}else kt('Specifier "'.concat(JSON.stringify(e),'" did not provide a usable location.')),i.push(null)}}),{arraysIn:r,arraysOut:i}},e.requestData=function(n,r){if(!t.formula)return 0;var a=t.formula.getArrays(n),i=Object(Ot.a)({vtkClass:n[0].getClassName()});i.shallowCopy(n[0]),r[0]=i;var o=e.prepareArrays(a,n[0],r[0]);return t.formula.evaluate(o.arraysIn,o.arraysOut),1}}(e,t)}var Bt={newInstance:g.a.newInstance(jt,"vtkCalculator"),extend:jt};function zt(e,t){for(var n=0;n0)for(var s=1;s0){for(var p=this.segments[r],g=1;g0){for(var v=this.segments[a],y=1;y2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ft,n),g.a.obj(e,t),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkClosedPolyLineToSurfaceFilter"),e.requestData=function(e,t){var n=e[0],a=Ie.a.newInstance();if(a.shallowCopy(n),n){for(var i=new Vt,o=n.getLines().getData(),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yt,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGetArray(e,t,["croppingPlanes"],6),function(e,t){t.classHierarchy.push("vtkImageCropFilter"),e.reset=function(){var t=e.getInputData();t&&e.setCroppingPlanes.apply(e,Wt(t.getExtent()))},e.requestData=function(e,n){var r=e[0];if(r){var i=r.getPointData().getScalars();if(i){var s=r.getExtent(),u=6===t.croppingPlanes.length?s.map(function(e,n){return n%2==0?Math.max(e,Math.round(t.croppingPlanes[n])):Math.min(e,Math.round(t.croppingPlanes[n]))}):s.slice();if(u[0]===s[0]&&u[1]===s[1]&&u[2]===s[2]&&u[3]===s[3]&&u[4]===s[4]&&u[5]===s[5]){var l=o.a.newInstance();return l.shallowCopy(r),void(n[0]=l)}for(var c=0;c<3;++c)if(u[2*c]>u[2*c+1]){var d=[u[2*c+1],u[2*c]];u[2*c]=d[0],u[2*c+1]=d[1]}for(var f=0;f<6;f+=2)u[f]=Math.max(u[f],s[f]),u[f+1]=Math.min(u[f+1],s[f+1]);for(var p=i.getNumberOfComponents(),g=(u[1]-u[0]+1)*(u[3]-u[2]+1)*(u[5]-u[4]+1)*p,m=i.getData(),h=r.getDimensions(),v=p*h[0],y=p*h[0]*h[1],M=u[0]*p,A=(u[1]-u[0]+1)*p,b=new m.constructor(g),w=0,D=u[4];D<=u[5];++D)for(var T=u[2];T<=u[3];++T){var C=M+T*v+D*y,I=C+A,x=m.subarray(C,I);b.set(x,w),w+=x.length}var S=o.a.newInstance({extent:u,origin:r.getOrigin(),direction:r.getDirection(),spacing:r.getSpacing()}),N=a.a.newInstance({name:i.getName(),numberOfComponents:p,values:b});S.getPointData().setScalars(N),n[0]=S}else Qt("No scalars from input")}else Qt("Invalid or missing input")},e.isResetAvailable=function(){if(0===t.croppingPlanes.length)return!1;var n=e.getInputData();return!!n&&void 0!==n.getExtent().find(function(e,n){return Math.abs(t.croppingPlanes[n]-e)>Number.EPSILON})}}(e,t)}var Kt={newInstance:g.a.newInstance(Ht,"vtkImageCropFilter"),extend:Ht},Xt=[[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,3,8,1,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[9,11,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[2,3,8,2,8,11,11,8,9,-1,-1,-1,-1,-1,-1,-1],[3,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,2,10,8,0,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,0,9,2,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,2,10,1,10,9,9,10,8,-1,-1,-1,-1,-1,-1,-1],[3,1,11,10,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,1,11,0,11,8,8,11,10,-1,-1,-1,-1,-1,-1,-1],[3,0,9,3,9,10,10,9,11,-1,-1,-1,-1,-1,-1,-1],[9,11,8,11,10,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,9,1,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1],[1,11,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[3,7,4,3,4,0,1,11,2,-1,-1,-1,-1,-1,-1,-1],[9,11,2,9,2,0,8,7,4,-1,-1,-1,-1,-1,-1,-1],[2,9,11,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1],[8,7,4,3,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[10,7,4,10,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1],[9,1,0,8,7,4,2,10,3,-1,-1,-1,-1,-1,-1,-1],[4,10,7,9,10,4,9,2,10,9,1,2,-1,-1,-1,-1],[3,1,11,3,11,10,7,4,8,-1,-1,-1,-1,-1,-1,-1],[1,11,10,1,10,4,1,4,0,7,4,10,-1,-1,-1,-1],[4,8,7,9,10,0,9,11,10,10,3,0,-1,-1,-1,-1],[4,10,7,4,9,10,9,11,10,-1,-1,-1,-1,-1,-1,-1],[9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[9,4,5,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1],[1,11,2,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[3,8,0,1,11,2,4,5,9,-1,-1,-1,-1,-1,-1,-1],[5,11,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1],[2,5,11,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1],[9,4,5,2,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,2,10,0,10,8,4,5,9,-1,-1,-1,-1,-1,-1,-1],[0,4,5,0,5,1,2,10,3,-1,-1,-1,-1,-1,-1,-1],[2,5,1,2,8,5,2,10,8,4,5,8,-1,-1,-1,-1],[11,10,3,11,3,1,9,4,5,-1,-1,-1,-1,-1,-1,-1],[4,5,9,0,1,8,8,1,11,8,11,10,-1,-1,-1,-1],[5,0,4,5,10,0,5,11,10,10,3,0,-1,-1,-1,-1],[5,8,4,5,11,8,11,10,8,-1,-1,-1,-1,-1,-1,-1],[9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1],[0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1],[1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[9,8,7,9,7,5,11,2,1,-1,-1,-1,-1,-1,-1,-1],[11,2,1,9,0,5,5,0,3,5,3,7,-1,-1,-1,-1],[8,2,0,8,5,2,8,7,5,11,2,5,-1,-1,-1,-1],[2,5,11,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1],[7,5,9,7,9,8,3,2,10,-1,-1,-1,-1,-1,-1,-1],[9,7,5,9,2,7,9,0,2,2,10,7,-1,-1,-1,-1],[2,10,3,0,8,1,1,8,7,1,7,5,-1,-1,-1,-1],[10,1,2,10,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1],[9,8,5,8,7,5,11,3,1,11,10,3,-1,-1,-1,-1],[5,0,7,5,9,0,7,0,10,1,11,0,10,0,11,-1],[10,0,11,10,3,0,11,0,5,8,7,0,5,0,7,-1],[10,5,11,7,5,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[11,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,3,8,5,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[9,1,0,5,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,3,8,1,8,9,5,6,11,-1,-1,-1,-1,-1,-1,-1],[1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,5,6,1,6,2,3,8,0,-1,-1,-1,-1,-1,-1,-1],[9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1],[5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1],[2,10,3,11,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[10,8,0,10,0,2,11,5,6,-1,-1,-1,-1,-1,-1,-1],[0,9,1,2,10,3,5,6,11,-1,-1,-1,-1,-1,-1,-1],[5,6,11,1,2,9,9,2,10,9,10,8,-1,-1,-1,-1],[6,10,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1],[0,10,8,0,5,10,0,1,5,5,6,10,-1,-1,-1,-1],[3,6,10,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1],[6,9,5,6,10,9,10,8,9,-1,-1,-1,-1,-1,-1,-1],[5,6,11,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,0,3,4,3,7,6,11,5,-1,-1,-1,-1,-1,-1,-1],[1,0,9,5,6,11,8,7,4,-1,-1,-1,-1,-1,-1,-1],[11,5,6,1,7,9,1,3,7,7,4,9,-1,-1,-1,-1],[6,2,1,6,1,5,4,8,7,-1,-1,-1,-1,-1,-1,-1],[1,5,2,5,6,2,3,4,0,3,7,4,-1,-1,-1,-1],[8,7,4,9,5,0,0,5,6,0,6,2,-1,-1,-1,-1],[7,9,3,7,4,9,3,9,2,5,6,9,2,9,6,-1],[3,2,10,7,4,8,11,5,6,-1,-1,-1,-1,-1,-1,-1],[5,6,11,4,2,7,4,0,2,2,10,7,-1,-1,-1,-1],[0,9,1,4,8,7,2,10,3,5,6,11,-1,-1,-1,-1],[9,1,2,9,2,10,9,10,4,7,4,10,5,6,11,-1],[8,7,4,3,5,10,3,1,5,5,6,10,-1,-1,-1,-1],[5,10,1,5,6,10,1,10,0,7,4,10,0,10,4,-1],[0,9,5,0,5,6,0,6,3,10,3,6,8,7,4,-1],[6,9,5,6,10,9,4,9,7,7,9,10,-1,-1,-1,-1],[11,9,4,6,11,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,6,11,4,11,9,0,3,8,-1,-1,-1,-1,-1,-1,-1],[11,1,0,11,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1],[8,1,3,8,6,1,8,4,6,6,11,1,-1,-1,-1,-1],[1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1],[3,8,0,1,9,2,2,9,4,2,4,6,-1,-1,-1,-1],[0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1],[11,9,4,11,4,6,10,3,2,-1,-1,-1,-1,-1,-1,-1],[0,2,8,2,10,8,4,11,9,4,6,11,-1,-1,-1,-1],[3,2,10,0,6,1,0,4,6,6,11,1,-1,-1,-1,-1],[6,1,4,6,11,1,4,1,8,2,10,1,8,1,10,-1],[9,4,6,9,6,3,9,3,1,10,3,6,-1,-1,-1,-1],[8,1,10,8,0,1,10,1,6,9,4,1,6,1,4,-1],[3,6,10,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1],[6,8,4,10,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[7,6,11,7,11,8,8,11,9,-1,-1,-1,-1,-1,-1,-1],[0,3,7,0,7,11,0,11,9,6,11,7,-1,-1,-1,-1],[11,7,6,1,7,11,1,8,7,1,0,8,-1,-1,-1,-1],[11,7,6,11,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1],[1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1],[2,9,6,2,1,9,6,9,7,0,3,9,7,9,3,-1],[7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1],[7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[2,10,3,11,8,6,11,9,8,8,7,6,-1,-1,-1,-1],[2,7,0,2,10,7,0,7,9,6,11,7,9,7,11,-1],[1,0,8,1,8,7,1,7,11,6,11,7,2,10,3,-1],[10,1,2,10,7,1,11,1,6,6,1,7,-1,-1,-1,-1],[8,6,9,8,7,6,9,6,1,10,3,6,1,6,3,-1],[0,1,9,10,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[7,0,8,7,6,0,3,0,10,10,0,6,-1,-1,-1,-1],[7,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[7,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[3,8,0,10,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,9,1,10,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[8,9,1,8,1,3,10,6,7,-1,-1,-1,-1,-1,-1,-1],[11,2,1,6,7,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,11,2,3,8,0,6,7,10,-1,-1,-1,-1,-1,-1,-1],[2,0,9,2,9,11,6,7,10,-1,-1,-1,-1,-1,-1,-1],[6,7,10,2,3,11,11,3,8,11,8,9,-1,-1,-1,-1],[7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1],[2,6,7,2,7,3,0,9,1,-1,-1,-1,-1,-1,-1,-1],[1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1],[11,6,7,11,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1],[11,6,7,1,11,7,1,7,8,1,8,0,-1,-1,-1,-1],[0,7,3,0,11,7,0,9,11,6,7,11,-1,-1,-1,-1],[7,11,6,7,8,11,8,9,11,-1,-1,-1,-1,-1,-1,-1],[6,4,8,10,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[3,10,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1],[8,10,6,8,6,4,9,1,0,-1,-1,-1,-1,-1,-1,-1],[9,6,4,9,3,6,9,1,3,10,6,3,-1,-1,-1,-1],[6,4,8,6,8,10,2,1,11,-1,-1,-1,-1,-1,-1,-1],[1,11,2,3,10,0,0,10,6,0,6,4,-1,-1,-1,-1],[4,8,10,4,10,6,0,9,2,2,9,11,-1,-1,-1,-1],[11,3,9,11,2,3,9,3,4,10,6,3,4,3,6,-1],[8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1],[0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,0,9,2,4,3,2,6,4,4,8,3,-1,-1,-1,-1],[1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1],[8,3,1,8,1,6,8,6,4,6,1,11,-1,-1,-1,-1],[11,0,1,11,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1],[4,3,6,4,8,3,6,3,11,0,9,3,11,3,9,-1],[11,4,9,6,4,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,5,9,7,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,3,8,4,5,9,10,6,7,-1,-1,-1,-1,-1,-1,-1],[5,1,0,5,0,4,7,10,6,-1,-1,-1,-1,-1,-1,-1],[10,6,7,8,4,3,3,4,5,3,5,1,-1,-1,-1,-1],[9,4,5,11,2,1,7,10,6,-1,-1,-1,-1,-1,-1,-1],[6,7,10,1,11,2,0,3,8,4,5,9,-1,-1,-1,-1],[7,10,6,5,11,4,4,11,2,4,2,0,-1,-1,-1,-1],[3,8,4,3,4,5,3,5,2,11,2,5,10,6,7,-1],[7,3,2,7,2,6,5,9,4,-1,-1,-1,-1,-1,-1,-1],[9,4,5,0,6,8,0,2,6,6,7,8,-1,-1,-1,-1],[3,2,6,3,6,7,1,0,5,5,0,4,-1,-1,-1,-1],[6,8,2,6,7,8,2,8,1,4,5,8,1,8,5,-1],[9,4,5,11,6,1,1,6,7,1,7,3,-1,-1,-1,-1],[1,11,6,1,6,7,1,7,0,8,0,7,9,4,5,-1],[4,11,0,4,5,11,0,11,3,6,7,11,3,11,7,-1],[7,11,6,7,8,11,5,11,4,4,11,8,-1,-1,-1,-1],[6,5,9,6,9,10,10,9,8,-1,-1,-1,-1,-1,-1,-1],[3,10,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1],[0,8,10,0,10,5,0,5,1,5,10,6,-1,-1,-1,-1],[6,3,10,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1],[1,11,2,9,10,5,9,8,10,10,6,5,-1,-1,-1,-1],[0,3,10,0,10,6,0,6,9,5,9,6,1,11,2,-1],[10,5,8,10,6,5,8,5,0,11,2,5,0,5,2,-1],[6,3,10,6,5,3,2,3,11,11,3,5,-1,-1,-1,-1],[5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1],[9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1],[1,8,5,1,0,8,5,8,6,3,2,8,6,8,2,-1],[1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,6,3,1,11,6,3,6,8,5,9,6,8,6,9,-1],[11,0,1,11,6,0,9,0,5,5,0,6,-1,-1,-1,-1],[0,8,3,5,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[11,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[10,11,5,7,10,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[10,11,5,10,5,7,8,0,3,-1,-1,-1,-1,-1,-1,-1],[5,7,10,5,10,11,1,0,9,-1,-1,-1,-1,-1,-1,-1],[11,5,7,11,7,10,9,1,8,8,1,3,-1,-1,-1,-1],[10,2,1,10,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1],[0,3,8,1,7,2,1,5,7,7,10,2,-1,-1,-1,-1],[9,5,7,9,7,2,9,2,0,2,7,10,-1,-1,-1,-1],[7,2,5,7,10,2,5,2,9,3,8,2,9,2,8,-1],[2,11,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1],[8,0,2,8,2,5,8,5,7,11,5,2,-1,-1,-1,-1],[9,1,0,5,3,11,5,7,3,3,2,11,-1,-1,-1,-1],[9,2,8,9,1,2,8,2,7,11,5,2,7,2,5,-1],[1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1],[9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1],[9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[5,4,8,5,8,11,11,8,10,-1,-1,-1,-1,-1,-1,-1],[5,4,0,5,0,10,5,10,11,10,0,3,-1,-1,-1,-1],[0,9,1,8,11,4,8,10,11,11,5,4,-1,-1,-1,-1],[11,4,10,11,5,4,10,4,3,9,1,4,3,4,1,-1],[2,1,5,2,5,8,2,8,10,4,8,5,-1,-1,-1,-1],[0,10,4,0,3,10,4,10,5,2,1,10,5,10,1,-1],[0,5,2,0,9,5,2,5,10,4,8,5,10,5,8,-1],[9,5,4,2,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[2,11,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1],[5,2,11,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1],[3,2,11,3,11,5,3,5,8,4,8,5,0,9,1,-1],[5,2,11,5,4,2,1,2,9,9,2,4,-1,-1,-1,-1],[8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1],[0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[8,5,4,8,3,5,9,5,0,0,5,3,-1,-1,-1,-1],[9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,7,10,4,10,9,9,10,11,-1,-1,-1,-1,-1,-1,-1],[0,3,8,4,7,9,9,7,10,9,10,11,-1,-1,-1,-1],[1,10,11,1,4,10,1,0,4,7,10,4,-1,-1,-1,-1],[3,4,1,3,8,4,1,4,11,7,10,4,11,4,10,-1],[4,7,10,9,4,10,9,10,2,9,2,1,-1,-1,-1,-1],[9,4,7,9,7,10,9,10,1,2,1,10,0,3,8,-1],[10,4,7,10,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1],[10,4,7,10,2,4,8,4,3,3,4,2,-1,-1,-1,-1],[2,11,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1],[9,7,11,9,4,7,11,7,2,8,0,7,2,7,0,-1],[3,11,7,3,2,11,7,11,4,1,0,11,4,11,0,-1],[1,2,11,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1],[4,1,9,4,7,1,0,1,8,8,1,7,-1,-1,-1,-1],[4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[9,8,11,11,8,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[3,9,0,3,10,9,10,11,9,-1,-1,-1,-1,-1,-1,-1],[0,11,1,0,8,11,8,10,11,-1,-1,-1,-1,-1,-1,-1],[3,11,1,10,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,10,2,1,9,10,9,8,10,-1,-1,-1,-1,-1,-1,-1],[3,9,0,3,10,9,1,9,2,2,9,10,-1,-1,-1,-1],[0,10,2,8,10,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[3,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[2,8,3,2,11,8,11,9,8,-1,-1,-1,-1,-1,-1,-1],[9,2,11,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[2,8,3,2,11,8,0,8,1,1,8,11,-1,-1,-1,-1],[1,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]],qt=[[0,1],[1,3],[2,3],[0,2],[4,5],[5,7],[6,7],[4,6],[0,4],[1,5],[2,6],[3,7]];var Zt={getCase:function(e){return Xt[e]},getEdge:function(e){return qt[e]}},Jt=g.a.vtkErrorMacro,$t=g.a.vtkDebugMacro;var en={contourValue:0,computeNormals:!1,mergePoints:!1};function tn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,en,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGet(e,t,["contourValue","computeNormals","mergePoints"]),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkImageMarchingCubes");var n=[],r=[],i=[],o=[],s=new Map;e.getVoxelScalars=function(e,t,a,i,o,s,u,l){n[0]=a*i+t*o[0]+e,n[1]=n[0]+1,n[2]=n[0]+o[0],n[3]=n[2]+1,n[4]=n[0]+i,n[5]=n[4]+1,n[6]=n[4]+o[0],n[7]=n[6]+1;for(var c=0;c<8;++c)r[c]=l[n[c]]},e.getVoxelPoints=function(e,t,n,r,a,i){o[0]=a[0]+e*i[0],o[1]=a[1]+t*i[1],o[2]=a[2]+n*i[2],o[3]=o[0]+i[0],o[4]=o[1],o[5]=o[2],o[6]=o[0],o[7]=o[1]+i[1],o[8]=o[2],o[9]=o[3],o[10]=o[7],o[11]=o[2],o[12]=o[0],o[13]=o[1],o[14]=o[2]+i[2],o[15]=o[3],o[16]=o[1],o[17]=o[14],o[18]=o[0],o[19]=o[7],o[20]=o[14],o[21]=o[3],o[22]=o[7],o[23]=o[14]},e.getPointGradient=function(e,t,n,r,a,i,o,s){var u,l;0===e?(u=o[e+1+t*r[0]+n*a],l=o[e+t*r[0]+n*a],s[0]=(l-u)/i[0]):e===r[0]-1?(u=o[e+t*r[0]+n*a],l=o[e-1+t*r[0]+n*a],s[0]=(l-u)/i[0]):(u=o[e+1+t*r[0]+n*a],l=o[e-1+t*r[0]+n*a],s[0]=.5*(l-u)/i[0]),0===t?(u=o[e+(t+1)*r[0]+n*a],l=o[e+t*r[0]+n*a],s[1]=(l-u)/i[1]):t===r[1]-1?(u=o[e+t*r[0]+n*a],l=o[e+(t-1)*r[0]+n*a],s[1]=(l-u)/i[1]):(u=o[e+(t+1)*r[0]+n*a],l=o[e+(t-1)*r[0]+n*a],s[1]=.5*(l-u)/i[1]),0===n?(u=o[e+t*r[0]+(n+1)*a],l=o[e+t*r[0]+n*a],s[2]=(l-u)/i[2]):n===r[2]-1?(u=o[e+t*r[0]+n*a],l=o[e+t*r[0]+(n-1)*a],s[2]=(l-u)/i[2]):(u=o[e+t*r[0]+(n+1)*a],l=o[e+t*r[0]+(n-1)*a],s[2]=.5*(l-u)/i[2])},e.getVoxelGradients=function(t,n,r,a,o,s,u){var l=[];e.getPointGradient(t,n,r,a,o,s,u,l),i[0]=l[0],i[1]=l[1],i[2]=l[2],e.getPointGradient(t+1,n,r,a,o,s,u,l),i[3]=l[0],i[4]=l[1],i[5]=l[2],e.getPointGradient(t,n+1,r,a,o,s,u,l),i[6]=l[0],i[7]=l[1],i[8]=l[2],e.getPointGradient(t+1,n+1,r,a,o,s,u,l),i[9]=l[0],i[10]=l[1],i[11]=l[2],e.getPointGradient(t,n,r+1,a,o,s,u,l),i[12]=l[0],i[13]=l[1],i[14]=l[2],e.getPointGradient(t+1,n,r+1,a,o,s,u,l),i[15]=l[0],i[16]=l[1],i[17]=l[2],e.getPointGradient(t,n+1,r+1,a,o,s,u,l),i[18]=l[0],i[19]=l[1],i[20]=l[2],e.getPointGradient(t+1,n+1,r+1,a,o,s,u,l),i[21]=l[0],i[22]=l[1],i[23]=l[2]},e.produceTriangles=function(a,u,l,c,f,p,g,m,h,v,y,M){var A,b,w=[1,2,4,8,16,32,64,128],D=[0,1,3,2,4,5,7,6],T=[],C=[],I=[];e.getVoxelScalars(u,l,c,f,p,g,m,h);for(var x=0,S=0;S<8;S++)r[D[S]]>=a&&(x|=w[S]);var N=Zt.getCase(x);if(!(N[0]<0)){e.getVoxelPoints(u,l,c,p,g,m),t.computeNormals&&e.getVoxelGradients(u,l,c,p,f,m,h);for(var E=0;N[E]>=0;E+=3){y.push(3);for(var O=0;O<3;O++){var L=Zt.getEdge(N[E+O]);if(A=void 0,t.mergePoints&&(I[0]=n[L[0]],I[1]=n[L[1]],I[0]>I[1]&&(b=I[0],I[0]=I[1],I[1]=b),A=s.get(I)),void 0===A){var P=(a-r[L[0]])/(r[L[1]]-r[L[0]]),k=o.slice(3*L[0],3*(L[0]+1)),R=o.slice(3*L[1],3*(L[1]+1));if(T[0]=k[0]+P*(R[0]-k[0]),T[1]=k[1]+P*(R[1]-k[1]),T[2]=k[2]+P*(R[2]-k[2]),A=v.length/3,v.push(T[0],T[1],T[2]),t.computeNormals){var j=i.slice(3*L[0],3*(L[0]+1)),B=i.slice(3*L[1],3*(L[1]+1));C[0]=j[0]+P*(B[0]-j[0]),C[1]=j[1]+P*(B[1]-j[1]),C[2]=j[2]+P*(B[2]-j[2]),d.a.normalize(C),M.push(C[0],C[1],C[2])}t.mergePoints&&(I[0]=n[L[0]],I[1]=n[L[1]],I[0]>I[1]&&(b=I[0],I[0]=I[1],I[1]=b),s[I]=A)}y.push(A)}}}},e.requestData=function(n,r){var i=n[0];if(i){console.time("mcubes");for(var o=i.getOrigin(),s=i.getSpacing(),u=i.getDimensions(),l=i.getPointData().getScalars().getData(),c=[],d=[],f=[],p=u[0]*u[1],g=0;g2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ln,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGet(e,t,["slice","mergePoints"]),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkImageMarchingSquares"),e.getContourValues=function(){return t.contourValues},e.setContourValues=function(n){t.contourValues=n,e.modified()};var n=[],r=[],a=[],i=new Map;e.getPixelScalars=function(e,t,a,i,o,s,u,l){n[0]=a*i+t*o[0]+e,n[1]=n[0]+1,n[2]=n[0]+o[0],n[3]=n[2]+1;for(var c=0;c<4;++c)r[c]=l[n[c]]},e.getPixelPoints=function(e,t,n,r,i,o){a[0]=i[0]+e*o[0],a[1]=i[1]+t*o[1],a[2]=a[0]+o[0],a[3]=a[1],a[4]=a[0],a[5]=a[1]+o[1],a[6]=a[2],a[7]=a[5]},e.produceLines=function(o,s,u,l,c,d,f,p,g,m,h){var v,y,M=[1,2,8,4],A=[],b=[];e.getPixelScalars(s,u,l,c,d,f,p,g);for(var w=0,D=0;D<4;D++)r[D]>=o&&(w|=M[D]);var T=on.getCase(w);if(!(T[0]<0)){e.getPixelPoints(s,u,l,d,f,p);for(var C=f[2]+l*p[2],I=0;T[I]>=0;I+=3){h.push(2);for(var x=0;x<2;x++){var S=on.getEdge(T[I+x]);if(v=void 0,t.mergePoints&&(b[0]=n[S[0]],b[1]=n[S[1]],b[0]>b[1]&&(y=b[0],b[0]=b[1],b[1]=y),v=i.get(b)),void 0===v){var N=(o-r[S[0]])/(r[S[1]]-r[S[0]]),E=a.slice(2*S[0],2*(S[0]+1)),O=a.slice(2*S[1],2*(S[1]+1));A[0]=E[0]+N*(O[0]-E[0]),A[1]=E[1]+N*(O[1]-E[1]),v=m.length/3,m.push(A[0],A[1],C),t.mergePoints&&(b[0]=n[S[0]],b[1]=n[S[1]],b[0]>b[1]&&(y=b[0],b[0]=b[1],b[1]=y),i[b]=v)}h.push(v)}}}},e.requestData=function(n,r){var a=n[0];if(a){console.time("msquares");var o=a.getOrigin(),s=a.getSpacing(),u=a.getDimensions(),l=a.getPointData().getScalars().getData(),c=[],d=[],f=u[0]*u[1],p=Math.round(t.slice);p>=u[2]&&(p=0);for(var g=0;g2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pn,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGet(e,t,["sliceIndex","orientation"]),function(e,t){t.classHierarchy.push("vtkImageSliceFilter"),e.requestData=function(e,n){var r=e[0];if(r){var i=r.getPointData().getScalars();if(i){var s=r.get("extent","spacing","origin");s.extent[4]=t.sliceIndex,s.extent[5]=s.extent[4];var u=i.getNumberOfComponents(),l=(s.extent[1]-s.extent[0]+1)*(s.extent[3]-s.extent[2]+1)*u,c=l*t.sliceIndex,d=i.getData().slice(c,c+l),f=a.a.newInstance({name:i.getName(),numberOfComponents:u,values:d}),p=o.a.newInstance(s);p.getPointData().setScalars(f),n[0]=p}else fn("No scalars from input")}else fn("Invalid or missing input")}}(e,t)}var mn={newInstance:g.a.newInstance(gn,"vtkImageSliceFilter"),extend:gn},hn=g.a.vtkErrorMacro;var vn={integrationStep:1,maximumNumberOfSteps:1e3};function yn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vn,n),g.a.obj(e,t),g.a.algo(e,t,2,1),g.a.setGet(e,t,["integrationStep","maximumNumberOfSteps"]),function(e,t){t.classHierarchy.push("vtkImageStreamline");var n=new Int32Array(3),r=new Float32Array(3),a=new Float32Array(8),i=new Uint32Array(8),o=new Uint32Array(3),s=new Float32Array(3),u=new Float32Array(3);e.interpolationFunctions=function(e,t){var n=e[0],r=e[1],a=e[2],i=1-n,o=1-r,s=1-a;t[0]=i*o*s,t[1]=n*o*s,t[2]=i*r*s,t[3]=n*r*s,t[4]=i*o*a,t[5]=n*o*a,t[6]=i*r*a,t[7]=n*r*a},e.computeStructuredCoordinates=function(e,t,n,r,a,i,o){for(var s=!0,u=0;u<3;u++){var l=(e[u]-i[u])/a[u];t[u]=Math.floor(l),n[u]=l-t[u];var c=!1,d=r[2*u],f=r[2*u+1];if(d===f){var p=e[u]-o[2*u];p*p<=a[u]*a[u]*1e-12&&(n[u]=0,t[u]=d,c=!0)}else t[u]=0&&e[u]>=o[2*u]||a[u]<0&&e[u]<=o[2*u+1])&&(n[u]=0,t[u]=d,c=!0):t[u]>=f?(a[u]>=0&&e[u]<=o[2*u+1]||a[u]<0&&e[u]>=o[2*u])&&(n[u]=1,t[u]=f-1,c=!0):c=!0;s=s&&c}return s},e.getVoxelIndices=function(e,t,n){n[0]=e[2]*t[0]*t[1]+e[1]*t[0]+e[0],n[1]=n[0]+1,n[2]=n[0]+t[0],n[3]=n[2]+1,n[4]=n[0]+t[0]*t[1],n[5]=n[4]+1,n[6]=n[4]+t[0],n[7]=n[6]+1},e.vectorAt=function(t,s,u,l){if(!e.computeStructuredCoordinates(t,n,r,u.getExtent(),u.getSpacing(),u.getOrigin(),u.getBounds()))return!1;e.interpolationFunctions(r,a);var c=u.getExtent();o[0]=c[1]-c[0]+1,o[1]=c[3]-c[2]+1,o[2]=c[5]-c[4]+1,e.getVoxelIndices(n,o,i),l[0]=0,l[1]=0,l[2]=0;for(var d=0;d<8;d++)for(var f=s.getTuple(i[d]),p=0;p<3;p++)l[p]+=a[d]*f[p];return!0},e.computeNextStep=function(t,n,r,a){if(!e.vectorAt(a,t,n,s))return!1;for(var i=0;i<3;i++)u[i]=a[i]+r/2*s[i];if(!e.vectorAt(u,t,n,s))return!1;for(var o=0;o<3;o++)a[o]+=r*s[o];return!!e.vectorAt(a,t,n,s)},e.streamIntegrate=function(n,r,a,i){var o=[],s=t.maximumNumberOfSteps,u=t.integrationStep,l=new Float32Array(3);l[0]=a[0],l[1]=a[1],l[2]=a[2];var c=[],d=0;for(d=0;d2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tn,n),g.a.obj(e,t),g.a.setGet(e,t,["atomicRadiusScaleFactor","bondRadius","deltaBondFactor","hideElements","radiusType","sphereScaleArrayName","tolerance"]),g.a.algo(e,t,1,2),function(e,t){var n=[],r=[],i=[],o=[];function s(e,a,s){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1,1,1],l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.bondRadius;r.push(s),r.push(l),i.push(a[0]),i.push(a[1]),i.push(a[2]),n.push(e[0]),n.push(e[1]),n.push(e[2]);for(var c=0;c0&&b.push(D[x]*t.atomicRadiusScaleFactor),C.length>0&&(I=3*x,w.push(255*C[I]),w.push(255*C[I+1]),w.push(255*C[I+2])));if(!y){y=[],M=[];for(var S=0;SE||Math.abs(P[1])>E||Math.abs(P[2])>E)){var k=E*E,R=P[0]*P[0]+P[1]*P[1]+P[2]*P[2];R.1&&(y.push(S),y.push(N),M.push(1))}}m=y.length/2}for(var j=0;j2*W*.6&&(t.bondRadius*=2*W*.6/Q,G=(2+t.deltaBondFactor)*t.bondRadius);for(var Y=M[j]%2,H=Y;H0){var $=Math.sqrt(U)/2;s(J=[h[_]-$*X[0]/2+K*q[0],h[_+1]-$*X[1]/2+K*q[1],h[_+2]-$*X[2]/2+K*q[2]],X,$,C.slice(_,_+3)),s(J=[h[V]+$*X[0]/2+K*q[0],h[V+1]+$*X[1]/2+K*q[1],h[V+2]+$*X[2]/2+K*q[2]],X,$,C.slice(V,V+3))}else{var ee=Math.sqrt(U);J=[h[_]-F[0]/2+K*q[0],h[_+1]-F[1]/2+K*q[1],h[_+2]-F[2]/2+K*q[2]],C.length>0?s(J,X,ee,C.slice(V,V+3)):s(J,X,ee)}}}}if(f.getPoints().setData(A,3),D){var te=a.a.newInstance({numberOfComponents:1,values:b,name:e.getSphereScaleArrayName()});f.getPointData().addArray(te)}if(C.length>0){var ne=a.a.newInstance({numberOfComponents:3,values:Uint8Array.from(w),name:"colors"});f.getPointData().setScalars(ne)}p.getPoints().setData(n,3);var re=a.a.newInstance({numberOfComponents:2,values:r,name:"stickScales"});p.getPointData().addArray(re);var ae=a.a.newInstance({numberOfComponents:3,values:i,name:"orientation"});if(p.getPointData().addArray(ae),C.length>0){var ie=a.a.newInstance({numberOfComponents:3,values:Uint8Array.from(o),name:"colors"});p.getPointData().setScalars(ie)}return l[0]=f,l[1]=p,1}}(e,t)}var In={newInstance:g.a.newInstance(Cn,"vtkMoleculeToRepresentation"),extend:Cn},xn=g.a.vtkErrorMacro,Sn=[0,2,4,1,2,4,0,3,4,1,3,4,0,2,5,1,2,5,0,3,5,1,3,5],Nn=[2,0,1,2,2,3,2,4,5,2,6,7,2,0,2,2,1,3,2,4,6,2,5,7,2,0,4,2,1,5,2,2,6,2,3,7];var En={};function On(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,En,n),g.a.obj(e,t),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkOutlineFilter"),e.requestData=function(e,t){var n=e[0];if(n){var r=n.getBounds(),a=Ie.a.newInstance();a.getPoints().setData(Float32Array.from(Sn.map(function(e){return r[e]})),3),a.getLines().setData(Uint16Array.from(Nn)),t[0]=a}else xn("Invalid or missing input")}}(e,t)}var Ln={newInstance:g.a.newInstance(On,"vtkOutlineFilter"),extend:On},Pn=n(51),kn=n.n(Pn),Rn=n(129),jn=n.n(Rn);function Bn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var zn=g.a.vtkErrorMacro;var _n={backgroundImage:null,labelMap:null,maskWorldToIndex:null,voxelFunc:null,radius:1,label:0};function Vn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_n,n),g.a.obj(e,t),g.a.algo(e,t,0,1),g.a.setGet(e,t,["backgroundImage","labelMap","labelWorldToIndex","voxelFunc","label","radius"]),function(e,t){t.classHierarchy.push("vtkPaintFilter");var n=null,r=null,i={};function s(){i.index=-1,i.snapshots=[],i.labels=[]}e.startStroke=function(){t.labelMap&&(n=new jn.a,(r=new kn.a(n)).exec("start",{bufferType:"Uint8Array",dimensions:t.labelMap.getDimensions()}))},e.endStroke=function(){r&&r.exec("end").then(function(a){for(var o=t.labelMap.getPointData().getScalars(),s=o.getData(),u=new Uint8Array(a),l=0,c=0;c-1){for(var n=t.labelMap.getPointData().getScalars(),r=n.getData(),a=i.snapshots[i.index],o=0;o2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gn,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGet(e,t,["lookupTable","piecewiseFunction"]),function(e,t){t.classHierarchy.push("vtkScalarToRGBA"),e.requestData=function(e,n){var r=e[0];if(r){var i=r.getPointData().getScalars();if(i)if(t.lookupTable)if(t.piecewiseFunction){for(var s=[0,0,0,0],u=i.getData(),l=new Uint8Array(4*u.length),c=0,d=0;d2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zn,n),g.a.setGet(e,t,["outputPointsPrecision","radius","varyRadius","numberOfSides","radiusFactor","defaultNormal","useDefaultNormal","sidesShareVertices","capping","onRatio","offset","generateTCoords","textureLength"]),g.a.obj(e,t),g.a.algo(e,t,1,1),function(e,t){function n(e,n){var r=e;return t.sidesShareVertices?r+=t.numberOfSides*n:r+=2*t.numberOfSides*n,t.capping&&(r+=2*t.numberOfSides),r}function i(e,t,n){for(var r=t[n],a=e.slice(3*r,3*(r+1)),i=n+1;i3&&void 0!==arguments[3]?arguments[3]:null,a=[0,0,1],o=t,s=o[0],u=0;u1){var l=0,c=[0,0,0],f=[0,0,0],p=o.slice(u+1,u+1+s);if((l=i(e,p,0))!==s)!function(){var t=p[l],o=e.slice(3*t,3*(t+1)),u=p[l+1],g=e.slice(3*u,3*(u+1));if(c=g.map(function(e,t){return e-o[t]}),d.a.normalize(c),r)a=r;else{for(;++l.001){a=h,c=f;break}}if(l>=s)for(var v=0;v<3;++v)if(0!==c[v]){a[(v+2)%3]=0,a[(v+1)%3]=1,a[v]=-c[(v+1)%3]/c[v];break}}d.a.normalize(a);for(var y=0;++l0?Math.sqrt(D):0;for(var T=[0,0,0],C=0;C<3;++C)T[C]=f[C]+c[C];d.a.normalize(T),d.a.cross(T,b,A),d.a.cross(c,b,T),d.a.dot(a,T)*d.a.dot(A,T)<0&&(D*=-1);for(var I=y;It.radiusFactor&&(x=t.radiusFactor);else if(l&&t.varyRadius===Yn.VARY_RADIUS_BY_ABSOLUTE_SCALAR&&(x=l.getComponent(r[N],0))<0)return qn("Scalar value less than zero, skipping line"),0;if(t.sidesShareVertices)for(var j=0;j1&&P){var J=C.slice(q,q+I+1);o(g.getData(),J,O)}s(K,I,Z,g.getData(),A.getData(),f.getPointData(),W,w,z,V,F,U,L,H)?(E=u(K,I,X,E,f.getCellData(),G,N),Q&&l(K,I,Z,g.getData(),z,Q.getData())):qn("Could not generate points"),K=n(K,I),X++}d.setPoints(A),d.setStrips(N),d.setPointData(W),W.setNormals(D),c[0]=d}}}}}else Xn("Invalid or missing input")}}(e,t)}var $n=g.a.newInstance(Jn,"vtkTubeFilter"),er=Object.assign({newInstance:$n,extend:Jn}),tr=g.a.vtkDebugMacro,nr=g.a.vtkErrorMacro;var rr={scaleFactor:1,useNormal:!1,normal:[0,0,1],xyPlane:!1};function ar(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rr,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGet(e,t,["scaleFactor","useNormal","xyPlane"]),g.a.setGetArray(e,t,["normal"],3),function(e,t){t.classHierarchy.push("vtkWarpScalar"),e.requestData=function(n,r){var a=n[0];if(!a)return nr("Invalid or missing input"),1;var i=a.getPoints(),o=a.getPointData().getNormals(),s=e.getInputArrayToProcess(0);if(!i||!s)return tr("No data to warp",!!i,!!s),r[0]=n[0],1;var u=i.getNumberOfPoints(),l=null,c=[0,0,1];o&&!t.useNormal?(l=function(e,t){return[t.getData()[3*e],t.getData()[3*e+1],t.getData()[3*e+2]]},tr("Using data normals")):e.getXyPlane()?(l=function(e,t){return c},tr("Using x-y plane normal")):(l=function(e,n){return t.normal},tr("Using Normal instance variable"));for(var d=new Float32Array(3*u),f=i.getData(),g=0,m=[0,0,1],h=1,v=s.getData(),y=s.getNumberOfComponents(),M=0;M2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ur,n),g.a.obj(e,t),g.a.setGet(e,t,["height","radius","resolution","capping"]),g.a.setGetArray(e,t,["center","direction"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkConeSource"),e.requestData=function(e,n){var r;if(!t.deleted){var a=n[0],i=2*Math.PI/t.resolution,o=-t.height/2,s=t.resolution+1,u=4*t.resolution+1+t.resolution,l=0,c=new window[t.pointType](3*s),d=0,p=new Uint32Array(u);c[0]=t.height/2,c[1]=0,c[2]=0,t.capping&&(p[d++]=t.resolution);for(var g=0;gt.resolution?1:m+2;(r=f.a.buildFromRadian()).translate.apply(r,sr(t.center)).rotateFromDirections([1,0,0],t.direction).apply(c),(a=Ie.a.newInstance()).getPoints().setData(c,3),a.getPolys().setData(p,1),n[0]=a}}}(e,t)}var cr={newInstance:g.a.newInstance(lr,"vtkConeSource"),extend:lr};var dr={height:1,radius:1,resolution:6,center:[0,0,0],capping:!0,pointType:"Float32Array"};function fr(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dr,n),g.a.obj(e,t),g.a.setGet(e,t,["height","radius","resolution","capping"]),g.a.setGetArray(e,t,["center"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkCylinderSource"),e.requestData=function(e,n){if(!t.deleted){var r=n[0],i=2*Math.PI/t.resolution,o=2*t.resolution,s=5*t.resolution;t.capping&&(o=4*t.resolution,s=7*t.resolution+2);for(var u=new window[t.pointType](3*o),l=0,c=new Uint32Array(s),d=new Float32Array(3*o),f=a.a.newInstance({numberOfComponents:3,values:d,name:"Normals"}),p=new Float32Array(2*o),g=a.a.newInstance({numberOfComponents:2,values:p,name:"TCoords"}),m=[0,0,0],h=[0,0,0],v=[0,0,0],y=[0,0,0],M=[0,0],A=[0,0],b=0;b2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gr,n),g.a.obj(e,t),g.a.setGet(e,t,["tipResolution","tipRadius","tipLength","shaftResolution","shaftRadius","invert"]),g.a.setGetArray(e,t,["direction"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkArrowSource"),e.requestData=function(e,n){if(!t.deleted){var r=pr.newInstance({capping:!0});r.setResolution(t.shaftResolution),r.setRadius(t.shaftRadius),r.setHeight(1-t.tipLength),r.setCenter(0,.5*(1-t.tipLength),0);var a=r.getOutputData(),i=a.getPoints().getData(),o=a.getPointData().getNormals().getData();f.a.buildFromDegree().rotateZ(-90).apply(i).apply(o);var s=cr.newInstance();s.setResolution(t.tipResolution),s.setHeight(t.tipLength),s.setRadius(t.tipRadius);var u=s.getOutputData(),l=u.getPoints().getData();f.a.buildFromRadian().translate(1-.5*t.tipLength,0,0).apply(l);var c=Et.newInstance();c.setInputData(a),c.addInputData(u);var d=c.getOutputData(),p=d.getPoints().getData();f.a.buildFromRadian().translate(.5*t.tipLength-.5,0,0).apply(p),t.invert?(f.a.buildFromRadian().rotateFromDirections([1,0,0],t.direction).scale(-1,-1,-1).apply(p),n[0]=d):(f.a.buildFromRadian().rotateFromDirections([1,0,0],t.direction).scale(1,1,1).apply(p),n[0]=c.getOutputData())}}}(e,t)}var hr={newInstance:g.a.newInstance(mr,"vtkArrowSource"),extend:mr};var vr={radius:1,resolution:6,center:[0,0,0],pointType:"Float32Array",lines:!1,face:!0};function yr(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vr,n),g.a.obj(e,t),g.a.setGet(e,t,["radius","resolution","lines","face"]),g.a.setGetArray(e,t,["center"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkCircleSource"),e.requestData=function(e,n){if(!t.deleted){var r=n[0],a=new window[t.pointType](3*t.resolution),i=new Uint32Array(t.resolution+2);i[0]=t.resolution+1;for(var o=2*Math.PI/t.resolution,s=0;s2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,br,n),g.a.obj(e,t),g.a.setGet(e,t,["height","resolution","startTheta","endTheta","skipInnerFaces"]),g.a.setGetArray(e,t,["center","direction"],3),g.a.getArray(e,t,["cellFields"]),g.a.algo(e,t,0,1),function(e,t){function n(){for(;t.cellFields.length0&&void 0!==arguments[0]?arguments[0]:0;return t.radius[e]},e.setRadius=function(n,r){t.radius[n]=r,e.modified()},e.setCellField=function(n,r){t.cellFields[n]=r,e.modified()},e.removeMask=function(){t.mask=null,e.modified()},e.setMaskLayer=function(n,r){var a=!1;!t.mask&&r&&(a=!0,t.mask=[]),t.mask&&(!t.mask[n]!=!r&&(a=!0),t.mask[n]=r),a&&e.modified()},e.getMaskLayer=function(e){return void 0===e?t.mask:t.mask[e]},e.requestData=function(e,r){var i;if(!t.deleted&&t.radius.length){n();var o=r[0],s=t.radius.length,u=t.height/2,l=0,c=0,d=t.startThetat.startTheta?t.endTheta:t.startTheta;p*=Math.PI/180;var g=t.resolution,m=!1;p>=d+2*Math.PI?p=d+2*Math.PI:(++g,m=!0);var h=(p-d)/t.resolution,v=g*s*2+2;if(t.skipInnerFaces||t.mask)if(!t.skipInnerFaces&&t.mask){t.mask[0]||(l+=2*(g+1)+5*g+(m?10:0),c+=2+g+(m?2:0));for(var y=1;y2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Cr,n),g.a.obj(e,t),g.a.setGet(e,t,["xLength","yLength","zLength","generate3DTextureCoordinates"]),g.a.setGetArray(e,t,["center","rotations"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkCubeSource"),e.setBounds=function(){var e=[];if(Array.isArray(arguments.length<=0?void 0:arguments[0]))e=arguments.length<=0?void 0:arguments[0];else for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sr,n),g.a.obj(e,t),g.a.get(e,t,["focus"]),g.a.getArray(e,t,["modelBounds"],6),g.a.getArray(e,t,["focalPoint"],3),g.a.setGet(e,t,["outline"]),g.a.setGet(e,t,["axes"]),g.a.setGet(e,t,["xShadows"]),g.a.setGet(e,t,["yShadows"]),g.a.setGet(e,t,["zShadows"]),g.a.setGet(e,t,["wrap"]),g.a.setGet(e,t,["translationMode"]),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkCursor3D"),e.setModelBounds=function(n){if(Array.isArray(n)&&!(n.length<6)&&(t.modelBounds[0]!==n[0]||t.modelBounds[1]!==n[1]||t.modelBounds[2]!==n[2]||t.modelBounds[3]!==n[3]||t.modelBounds[4]!==n[4]||t.modelBounds[5]!==n[5])){e.modified(),t.modelBounds=n.map(function(e){return Number(e)});for(var r=0;r<3;++r)t.modelBounds[2*r]=Math.min(t.modelBounds[2*r],t.modelBounds[2*r+1])}},e.setFocalPoint=function(n){if(Array.isArray(n)&&!(n.length<3)&&(n[0]!==t.focalPoint[0]||n[1]!==t.focalPoint[1]||n[2]!==t.focalPoint[2])){e.modified();for(var r=[],a=0;a<3;a++)r[a]=n[a]-t.focalPoint[a],t.focalPoint[a]=Number(n[a]),t.translationMode?(t.modelBounds[2*a]+=r[a],t.modelBounds[2*a+1]+=r[a]):t.wrap?t.focalPoint[a]=t.modelBounds[2*a]+1*(t.focalPoint[a]-t.modelBounds[2*a])%(1*(t.modelBounds[2*a+1]-t.modelBounds[2*a])):(n[a]t.modelBounds[2*a+1]&&(t.focalPoint[a]=t.modelBounds[2*a+1]))}},e.setAll=function(t){e.setOutline(t),e.setAxes(t),e.setXShadows(t),e.setYShadows(t),e.setZShadows(t)},e.allOn=function(){e.setAll(!0)},e.allOff=function(){e.setAll(!1)},e.requestData=function(e,n){if(!t.deleted){var a=0,i=0;if(t.wrap)for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Or,n),g.a.obj(e,t),g.a.setGet(e,t,["lineValue","fillValue"]),g.a.setGetArray(e,t,["gridOrigin","gridSpacing","dataOrigin","dataSpacing"],3),g.a.setGetArray(e,t,["dataExtent"],6),g.a.setGetArray(e,t,["dataDirection"],9),g.a.algo(e,t,0,1),function(e,t){var n=this;t.classHierarchy.push("vtkImageGridSource"),e.requestData=function(e,r){if(!t.deleted){var i={},s={type:"vtkImageData",mtime:t.mtime,metadata:{source:"vtkImageGridSource",state:i}};["gridSpacing","gridOrigin","dataSpacing","dataOrigin"].forEach(function(e){i[e]=[].concat(t[e])});var u=o.a.newInstance(s);u.setOrigin(t.dataOrigin[0],t.dataOrigin[1],t.dataOrigin[2]),u.setSpacing(t.dataSpacing[0],t.dataSpacing[1],t.dataSpacing[2]),u.setExtent.apply(n,t.dataExtent),u.setDirection(t.dataDirection);var l=[0,0,0];l=l.map(function(e,n){return t.dataExtent[2*n+1]-t.dataExtent[2*n]+1});for(var c=new Uint8Array(l[0]*l[1]*l[2]),d=0,f=0,p=0,g=0,m=t.dataExtent[4];m<=t.dataExtent[5];m++){p=t.gridSpacing[2]?m%t.gridSpacing[2]===t.gridOrigin[2]:0;for(var h=t.dataExtent[2];h<=t.dataExtent[3];h++){f=t.gridSpacing[1]?h%t.gridSpacing[1]===t.gridOrigin[1]:0;for(var v=t.dataExtent[0];v<=t.dataExtent[1];v++)d=t.gridSpacing[0]?v%t.gridSpacing[0]===t.gridOrigin[0]:0,c[g]=p||f||d?t.lineValue:t.fillValue,g++}}var y=a.a.newInstance({numberOfComponents:1,values:c});y.setName("scalars"),u.getPointData().setScalars(y),r[0]=u}}}(e,t)}var Pr={newInstance:g.a.newInstance(Lr,"vtkImageGridSource"),extend:Lr},kr=g.a.vtkWarningMacro;var Rr={resolution:10,point1:[-1,0,0],point2:[1,0,0],pointType:"Float32Array"};function jr(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rr,n),g.a.obj(e,t),g.a.setGet(e,t,["resolution"]),g.a.setGetArray(e,t,["point1","point2"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkLineSource"),e.requestData=function(e,n){if(!t.deleted){var r=n[0],a=r?r.getPoints().getDataType():"Float32Array",i=Ie.a.newInstance(),o=new Float32Array(3);if(d.a.subtract(t.point2,t.point1,o),d.a.norm(o)<=0)kr("Zero-length line definition");else{var s=t.resolution,u=s+1,l=new window[a](3*u);i.getPoints().setData(l,3);var c=new Uint32Array(u+1);i.getLines().setData(c,1);for(var f=0,p=0,g=0;g2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_r,n),g.a.obj(e,t),g.a.setGet(e,t,["xResolution","yResolution"]),g.a.setGetArray(e,t,["origin","point1","point2"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkPlaneSource"),e.requestData=function(e,n){if(!t.deleted){var r=n[0],i=r?r.getPoints().getDataType():"Float32Array",o=Ie.a.newInstance(),s=new Float32Array(3),u=new Float32Array(3),l=new Float32Array(3);if(d.a.subtract(t.point1,t.origin,s),d.a.subtract(t.point2,t.origin,u),d.a.cross(s,u,l),d.a.norm(l)<=0)zr("Bad plane definition");else{var c=t.xResolution,f=t.yResolution,p=(c+1)*(f+1),g=c*f,m=new window[i](3*p);o.getPoints().setData(m,3);var h=new Uint32Array(5*g);o.getPolys().setData(h,1);var v=new Float32Array(2*p),y=a.a.newInstance({numberOfComponents:2,values:v,name:"TextureCoordinates"});o.getPointData().setTCoords(y);for(var M=new Float32Array(2),A=0,b=0;b2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ur,n),g.a.obj(e,t),g.a.setGet(e,t,["numberOfPoints","radius"]),g.a.setGetArray(e,t,["center"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkPointSource"),e.requestData=function(e,n){if(!t.deleted){var r=n[0],a=r?r.getPoints().getDataType():"Float32Array",i=Ie.a.newInstance(),o=t.numberOfPoints,s=new window[a](3*o);i.getPoints().setData(s,3);var u,l,c,f,p,g=new Uint32Array(o+1);i.getVerts().setData(g,1);for(var m=0;m2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Qr,n),g.a.obj(e,t),g.a.setGet(e,t,["offset","maximum","standardDeviation"]),g.a.setGetArray(e,t,["center","frequency","magnitude"],3),g.a.setGetArray(e,t,["wholeExtent"],6),g.a.setGetArray(e,t,["dataDirection"],9),g.a.algo(e,t,0,1),function(e,t){var n=this;t.classHierarchy.push("vtkRTAnalyticSource"),e.requestData=function(e,r){if(!t.deleted){var i={},s={type:"vtkImageData",mtime:t.mtime,metadata:{source:"vtkRTAnalyticSource",state:i}};["standardDeviation","center","frequency","magnitude","maximum"].forEach(function(e){i[e]=[].concat(t[e])});var u=o.a.newInstance(s);u.setSpacing(1,1,1),u.setExtent.apply(n,t.wholeExtent),u.setOrigin(0,0,0),u.setDirection(t.dataDirection);var l=[0,0,0];l=l.map(function(e,n){return t.wholeExtent[2*n+1]-t.wholeExtent[2*n]+1});for(var c=new Uint8Array(l[0]*l[1]*l[2]),d=1/(2*t.standardDeviation*t.standardDeviation),f=0,p=0,g=0,m=[1/(t.wholeExtent[1]-t.wholeExtent[0]),1/(t.wholeExtent[3]-t.wholeExtent[2]),1/(t.wholeExtent[5]-t.wholeExtent[4])],h=0,v=t.wholeExtent[4];v<=t.wholeExtent[5];v++){g=(t.center[2]-v)*m[2];var y=t.magnitude[2]*Math.cos(t.frequency[2]*g);g*=g;for(var M=t.wholeExtent[2];M<=t.wholeExtent[3];M++){p=(t.center[1]-M)*m[1];var A=t.magnitude[1]*Math.sin(t.frequency[1]*p);p*=p;for(var b=t.wholeExtent[0];b<=t.wholeExtent[1];b++){var w=g+p+(f=(t.center[0]-b)*m[0])*f,D=t.magnitude[0]*Math.sin(t.frequency[0]*f);c[h]=t.maximum*Math.exp(-w*d)+D+A+y+t.offset,h++}}}var T=a.a.newInstance({numberOfComponents:1,values:c});T.setName("scalars"),u.getPointData().setScalars(T),r[0]=u}}}(e,t)}var Hr={newInstance:g.a.newInstance(Yr,"vtkRTAnalyticSource"),extend:Yr};function Kr(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qr,n),g.a.obj(e,t),g.a.setGet(e,t,["clusterArrayName","scalarArrayName"]),g.a.setGetArray(e,t,["origin","spacing","dimensions"],3),g.a.algo(e,t,0,1),Xr(e,t)}var Jr={newInstance:g.a.newInstance(Zr,"vtkSLICSource"),extend:Zr};var $r={radius:.5,latLongTessellation:!1,thetaResolution:8,startTheta:0,endTheta:360,phiResolution:8,startPhi:0,endPhi:180,center:[0,0,0],pointType:"Float32Array"};function ea(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$r,n),g.a.obj(e,t),g.a.setGet(e,t,["radius","latLongTessellation","thetaResolution","startTheta","endTheta","phiResolution","startPhi","endPhi"]),g.a.setGetArray(e,t,["center"],3),g.a.algo(e,t,0,1),function(e,t){t.classHierarchy.push("vtkSphereSource"),e.requestData=function(e,n){if(!t.deleted){var r=n[0],i=r?r.getPoints().getDataType():"Float32Array";r=Ie.a.newInstance();var o=0,s=t.thetaResolution,u=t.startThetat.startTheta?t.endTheta:t.startTheta;l*=Math.PI/180;var c=t.startPhit.startPhi?t.endPhi:t.startPhi;d*=Math.PI/180,Math.abs(u-l)<2*Math.PI&&++s;var f=(l-u)/t.thetaResolution,p=t.startPhi<=0?1:0,g=t.phiResolution+(t.endPhi>=180?-1:0),m=t.phiResolution*s+2,h=2*t.phiResolution*t.thetaResolution,v=0,y=new window[i](3*m),M=new Float32Array(3*m),A=0,b=new Uint32Array(5*h);t.startPhi<=0&&(y[3*v+0]=t.center[0],y[3*v+1]=t.center[1],y[3*v+2]=t.center[2]+t.radius,M[3*v+0]=0,M[3*v+1]=0,M[3*v+2]=1,v++,o++),t.endPhi>=180&&(y[3*v+0]=t.center[0],y[3*v+1]=t.center[1],y[3*v+2]=t.center[2]-t.radius,M[3*v+0]=0,M[3*v+1]=0,M[3*v+2]=-1,v++,o++);for(var w=t.phiResolution-o,D=(d-c)/(t.phiResolution-1),T=0;T=180)for(var L=w-1+o,P=0;P2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,aa,n),g.a.obj(e,t),g.a.setGetArray(e,t,["center"]),g.a.setGet(e,t,["automaticSphereGeneration","preventSeam"]),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkTextureMapToSphere"),e.requestData=function(e,n){if(!t.deleted){var r=e[0],i=r.getPoints().getNumberOfPoints();if(i<=1)ra("Can't generate texture coordinates without points");else{var o=Math.PI/2,s=[],u=r.getPoints();if(t.automaticSphereGeneration){t.center=[0,0,0];for(var l=0;lc?(p=0,g[1]=f>0?0:1):(p=Math.acos(f/c),g[1]=p/Math.PI)):g[1]=0,0!=(m=c*Math.sin(p))?(f=s[0]-t.center[0],h=Math.abs(f)>m?f>0?0:Math.PI:Math.acos(f/m),f=s[1]-t.center[1],v=Math.abs(f)>m?f>0?o:-o:Math.asin(f/m)):(h=0,v=0),t.preventSeam?g[0]=h/Math.PI:(g[0]=h/(2*Math.PI),v<0&&(g[0]=1-g[0])),y.push.apply(y,g);var A=a.a.newInstance({name:"Texture Coordinates",numberOfComponents:2,size:i,values:y}),b=Ie.a.newInstance();b.getPoints().setData(new Float32Array(r.getPoints().getData()),3),b.getPolys().setData(new Uint32Array(r.getPolys().getData())),b.getPointData().setTCoords(A),n[0]=b}}}}(e,t)}var oa={newInstance:g.a.newInstance(ia,"vtkTextureMapToSphere"),extend:ia},sa=g.a.vtkErrorMacro;function ua(e,t){t.classHierarchy.push("vtkTextureMapToPlane"),e.requestData=function(e,n){if(!t.deleted){var r=e[0],i=r.getPoints().getNumberOfPoints();if(i<3&&t.automaticPlaneGeneration)sa("Can't generate texture coordinates without points");else{var o=Ie.a.newInstance();o.getPoints().setData(new Float32Array(r.getPoints().getData()),3),o.getPolys().setData(new Uint32Array(r.getPolys().getData()));var s=[],u=0,l=0,c=0,f=0,p=[0,0,0],g=0,m=[0,0,0],h=[0,0,0],v=0,y=0,M=0,A=0,b=[0,0,0];if(t.automaticPlaneGeneration&&0===t.origin[0]&&0===t.origin[1]&&0===t.origin[2]&&0===t.point1[0]&&0===t.point1[1]&&0===t.point2[0]&&0===t.point2[1]){for(t.automaticPlaneGeneration&&function(e){for(var n=e.getPoints().getNumberOfPoints(),r=0,a=[0,0,0,0,0,0,0,0,0],i=[0,0,0],o=[0,0,0],s=e.getBounds(),u=[s[0],s[2],s[4]],l=[s[1],s[3],s[5]],c=Math.sqrt(d.a.distance2BetweenPoints(u,l)),f=c,p=0;p<3;p++)t.normal[p]=0,s[2*p+1]-s[2*p]2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,la,n),g.a.obj(e,t),g.a.setGetArray(e,t,["origin","point1","point2","normal","sRange","tRange"],3),g.a.setGet(e,t,["automaticPlaneGeneration"]),g.a.algo(e,t,1,1),ua(e,t)}var da={Cornerstone:ht,Core:wt,General:or,Sources:na,Texture:{vtkTextureMapToPlane:{newInstance:g.a.newInstance(ca,"vtkTextureMapToPlane"),extend:ca},vtkTextureMapToSphere:oa}},fa={CLAMP:0,REPEAT:1,MIRROR:2},pa={NEAREST:0,LINEAR:1,CUBIC:2},ga={pointer:null,extent:[0,-1,0,-1,0,-1],increments:[0,0,0],scalarType:null,dataTypeSize:1,numberOfComponents:1,borderMode:fa.CLAMP,interpolationMode:pa.LINEAR,extraInfo:null},ma=Object.assign({},ga,{positions:[0,0,0],weights:null,weightExtent:[0,-1,0,-1,0,-1],kernelSize:[1,1,1],workspace:null,lastY:null,lastZ:null});function ha(e){var t=Math.floor(e);return{floored:t,error:e-t}}function va(e){return Math.round(e)}function ya(e,t,n){var r=e<=n?e:n;return r=(r-=t)>=0?r:0}function Ma(e,t,n){var r=n-t+1,a=e-t;return a=(a%=r)>=0?a:a+r}function Aa(e,t,n){var r=n-t,a=2*r+(0===r?1:0),i=e-t;return i=i>=0?i:-i,i=(i%=a)<=r?i:a-i}var ba={outValue:0,tolerance:Number.EPSILON,componentOffset:0,componentCount:-1,borderMode:fa.CLAMP,slidingWindow:!1,scalars:null,interpolationInfo:Object.assign({},ga),interpolationFunc:null,rowInterpolationFunc:null,structuredBounds:[0,-1,0,-1,0,-1],spacing:null,origin:null,extent:null};function wa(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ba,n),g.a.obj(e,t),g.a.setGet(e,t,["outValue","tolerance","componentOffset","componentCount","borderMode","slidingWindow"]),g.a.get(e,t,["origin","spacing"]),function(e,t){t.classHierarchy.push("vtkAbstractImageInterpolator"),e.initialize=function(n){e.releaseData(),t.scalars=n.getPointData().getScalars(),t.spacing=n.getSpacing(),t.origin=n.getOrigin(),t.extent=n.getExtent(),e.update()},e.releaseData=function(){t.scalars=null},e.update=function(){if(!t.scalars)return t.interpolationInfo.pointer=null,void(t.interpolationInfo.numberOfComponents=1);t.interpolationInfo.extent=t.extent.slice();for(var n=e.computeSupportSize(null),r=Math.max(Math.max(n[0],n[1]),n[2]),a=Number.MIN_SAFE_INTEGER+r/2,i=Number.MAX_SAFE_INTEGER-r/2,o=0;o<3;++o){var s=Math.max(.5*(t.extent[2*o]===t.extent[2*o+1]),t.tolerance);t.structuredBounds[2*o]=Math.max(t.extent[2*o]-s,a),t.structuredBounds[2*o+1]=Math.min(t.extent[2*o+1]+s,i)}var u=t.extent[1]-t.extent[0]+1,l=t.extent[3]-t.extent[2]+1,c=t.scalars.getNumberOfComponents();t.interpolationInfo.increments[0]=c,t.interpolationInfo.increments[1]=t.interpolationInfo.increments[0]*u,t.interpolationInfo.increments[2]=t.interpolationInfo.increments[1]*l;var d=t.componentOffset;d=(d=d>0?d:0)0?i:0;d=d0?r:e-n},e.getNumberOfComponents=function(){return t.interpolationInfo.numberOfComponents},e.interpolateIJK=function(n,r){e.interpolatePoint(t.interpolationInfo,n,r)},e.checkBoundsIJK=function(e){return!(e[0]t.structuredBounds[1]||e[1]t.structuredBounds[3]||e[2]t.structuredBounds[5])},e.computeSupportSize=null,e.isSeparable=null,e.precomputeWeightsForExtent=function(e,t,n){},e.FreePrecomputedWeights=function(e){},e.interpolatePoint=function(e,t,n){},e.interpolateRow=function(e,t,n,r,a,i){}}(e,t)}var Da={newInstance:g.a.newInstance(wa,"vtkAbstractImageInterpolator"),extend:wa,ImageBorderMode:fa,InterpolationMode:pa};var Ta={interpolationMode:pa.NEAREST};function Ca(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ta,n),Da.extend(e,t,n),g.a.setGet(e,t,["interpolationMode"]),function(e,t){t.classHierarchy.push("vtkImageInterpolator"),e.computeSupportSize=function(e){var n=1;t.interpolationMode===pa.LINEAR?n=2:t.interpolationMode===pa.CUBIC&&(n=4);var r=[n,n,n];if(null==e)return r;if(0!==e[12]||0!==e[13]||0!==e[14]||1!==e[15])return r;for(var a=0;a<3;++a){for(var i=!0,o=0;o<3;++o)i=i&&Number.isInteger(e[4*a+o]);i&&(r[a]=1)}return r},e.internalUpdate=function(){t.interpolationInfo.interpolationMode=t.interpolationMode},e.isSeparable=function(){return!0},e.interpolateNearest=function(e,t,n){var r=e.extent,a=e.increments,i=e.numberOfComponents,o=va(t[0]),s=va(t[1]),u=va(t[2]);switch(e.borderMode){case fa.REPEAT:o=Ma(o,r[0],r[1]),s=Ma(s,r[2],r[3]),u=Ma(u,r[4],r[5]);break;case fa.MIRROR:o=Aa(o,r[0],r[1]),s=Aa(s,r[2],r[3]),u=Aa(u,r[4],r[5]);break;default:o=ya(o,r[0],r[1]),s=ya(s,r[2],r[3]),u=ya(u,r[4],r[5])}var l=o*a[0]+s*a[1]+u*a[2],c=e.pointer.subarray(l,l+i);n.set(c,0)},e.interpolatePoint=function(n,r,a){switch(t.interpolationMode){case pa.NEAREST:default:e.interpolateNearest(n,r,a);break;case pa.LINEAR:console.log("LINEAR not implemented");break;case pa.CUBIC:console.log("CUBIC not implemented")}},e.interpolateRowNearest=function(e,t,n,r,a,i){for(var o=e.positions[0].subarray(t),s=e.positions[1].subarray(n),u=e.positions[2].subarray(r),l=e.pointer.subarray(s[0]+u[0]),c=e.numberOfComponents,d=0;d1)if(o===pa.LINEAR)v[g*b+1-y]=x[1]*N,M[g*b-y]=1-C,M[g*b+1-y]=C;else if(o===pa.CUBIC){var E=e.vtkTricubicInterpWeights(C);if(4===g)for(var O=0;O<4;O++)v[g*b+O-y]=x[O]*N,M[g*b+O-y]=E[O];else{for(var L=[0,0,0,0],P=0;P<4;P++)L[x[P]-c]+=E[P];for(var k=0;k=f&&w<=p?0===A&&(A=1,a[2*u]=b):1===A&&(A=2,a[2*u+1]=b-1)}(0===A||a[2*u]>a[2*u+1])&&(s=!1)}if(!s)for(var R=0;R<3;R++)a[2*R]=r[2*R],a[2*R+1]=r[2*R]-1}}(e,t)}var Ia={newInstance:g.a.newInstance(Ca,"vtkImageInterpolator"),extend:Ca};var xa={spanState:0,extent:[0,-1,0,-1,0,-1],end:0,spanEnd:0,rowEnd:0,sliceEnd:0,rowIncrement:0,rowEndIncrement:0,sliceIncrement:0,sliceEndIncrement:0,id:0,index:[0,0,0],startY:0,hasStencil:!1,inStencil:!0,spanIndex:0,spanSliceIncrement:0,spanSliceEndIncrement:0,spanCountPointer:null,spanListPointer:null,algorithm:null,target:0,count:0};function Sa(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xa,n),g.a.obj(e,t),g.a.get(e,t,["id","index"]),function(e,t){t.classHierarchy.push("vtkImagePointDataIterator"),e.initialize=function(e,n,r,a){var i=e.getExtent(),o=n;null==o&&(o=i);for(var s,u,l,c=!1,d=0;d<6;d+=2)t.extent[d]=Math.max(o[d],i[d]),t.extent[d+1]=Math.min(o[d+1],i[d+1]),t.extent[d]>t.extent[d+1]&&(c=!0);if(t.rowIncrement=i[1]-i[0]+1,t.sliceIncrement=t.rowIncrement*(i[3]-i[2]+1),c){s=0,u=0,l=0,t.id=0,t.rowEndIncrement=0,t.sliceEndIncrement=0;for(var f=0;f<6;f+=2)t.extent[f]=i[f],t.extent[f+1]=i[f]-1}else s=t.extent[1]-t.extent[0]+1,u=t.extent[3]-t.extent[2]+1,l=t.extent[5]-t.extent[4]+1,t.id=t.extent[0]-i[0]+(t.extent[2]-i[2])*t.rowIncrement+(t.extent[4]-i[4])*t.sliceIncrement,t.rowEndIncrement=t.rowIncrement-s,t.sliceEndIncrement=t.rowEndIncrement+t.sliceIncrement-t.rowIncrement*u;if(t.spanEnd=t.id+s,t.rowEnd=t.id+s,t.sliceEnd=t.id+(t.rowIncrement*u-t.rowEndIncrement),t.end=t.id+(t.sliceIncrement*l-t.sliceEndIncrement),t.index[0]=t.extent[0],t.index[1]=t.extent[2],t.index[2]=t.extent[4],t.startY=t.index[1],r){t.hasStencil=!0,t.inStencil=!1,t.spanIndex=0;var p=r.getExtent();if(t.spanSliceIncrement=0,t.spanSliceEndIncrement=0,p[3]>=p[2]&&p[5]>=p[4]){t.spanSliceIncrement=p[3]-p[2]+1;var g=t.extent[2]-p[2];g>=0&&(t.spanSliceEndIncrement+=g);var m=p[3]-t.extent[3];m>=0&&(t.spanSliceEndIncrement+=m)}var h=0,v=t.extent[2]-p[2];v<0?(t.extent[2]=p[2],h-=1):h+=v,p[3]<=t.extent[3]&&(t.extent[3]=p[3]);var y=t.extent[4]-p[4];y<0?(t.extent[4]=p[4],v>=0&&(h-=1+t.spanSliceEndIncrement)):h+=y*t.spanSliceIncrement,p[5]<=t.extent[5]&&(t.extent[5]=p[5]),t.extent[2]<=t.extent[3]&&t.extent[4]<=t.extent[5]?(t.spanCountPointer=r.extentListLengths.subarray(h),t.spanListPointer=r.extentLists.subarray(h),v>=0&&y>=0&&(t.inStencil=!0,t.setSpanState(t.extent[0]))):(t.spanCountPointer=null,t.spanListPointer=null,t.inStencil=!1)}else t.hasStencil=!1,t.inStencil=!0,t.spanSliceEndIncrement=0,t.spanSliceIncrement=0,t.spanIndex=0,t.spanCountPointer=null,t.spanListPointer=null;if(a){t.algorithm=a;var M=u*l;t.target=M/50+1,t.count=50*t.target-M/t.target*t.target+1}else t.algorithm=null,t.target=0,t.count=0},e.setSpanState=function(e){var n,r=!1,a=t.spanListPointer,i=t.spanCountPointer[0];for(n=0;ne);++n)r=!r;t.spanIndex=n,t.inStencil=r;var o=t.extent[1]+1;n=t.extent[2]&&t.index[1]<=t.extent[3]&&t.index[2]>=t.extent[4]&&t.index[2]<=t.extent[5]?(t.spanCountPointer=t.spanCountPointer.subarray(n),t.spanListPointer=t.spanListPointer.subarray(n),e.setSpanState(t.extent[0])):t.inStencil=!1),t.algorithm&&e.reportProgress()}else{t.id=t.spanEnd;var r=t.spanCountPointer[0],a=t.extent[1]+1;if(t.index[0]=a,t.spanIndex1&&void 0!==arguments[1]?arguments[1]:0;return e.getArray(t.getPointData().getScalars(),n)}}(e,t)}var Na=g.a.newInstance(Sa,"vtkImagePointDataIterator"),Ea=Object.assign({newInstance:Na,extend:Sa}),Oa={SlabMode:{MIN:0,MAX:1,MEAN:2,SUM:3}},La=g.a.vtkErrorMacro,Pa=g.a.vtkDebugMacro;var ka={transformInputSampling:!0,autoCropOutput:!1,outputDimensionality:3,outputSpacing:null,outputOrigin:null,outputExtent:null,outputScalarType:null,wrap:!1,mirror:!1,border:!0,interpolationMode:pa.NEAREST,slabMode:Oa.MIN,slabTrapezoidIntegration:!1,slabNumberOfSlices:1,slabSliceSpacingFraction:1,optimization:!1,scalarShift:0,scalarScale:1,backgroundColor:[0,0,0,0],resliceAxes:null,resliceTransform:null,interpolator:Ia.newInstance(),usePermuteExecute:!1};function Ra(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ka,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGet(e,t,["resliceAxes","outputDimensionality","outputOrigin","outputSpacing","outputExtent","outputScalarType","scalarShift","scalarScale","transformInputSampling","autoCropOutput","wrap","mirror","border","backgroundColor"]),g.a.algo(e,t,1,1),function(e,t){t.classHierarchy.push("vtkImageReslice");var n=null,r=null;e.requestData=function(i,s){var u=i[0];if(u){var l=u.getOrigin(),c=u.getSpacing(),d=u.getDimensions(),f=u.getPointData().getScalars(),p=[0,d[0]-1,0,d[1]-1,0,d[2]-1],g=[0,0,0],m=[1,1,1],h=[0,0,0,0,0,0],v=[0,0,0],y=Ye.c.create();t.resliceAxes&&(y=t.resliceAxes);var M=Ye.c.create();Ye.c.invert(M,y);var A=[l[0]+.5*(p[0]+p[1])*c[0],l[1]+.5*(p[2]+p[3])*c[1],l[2]+.5*(p[4]+p[5])*c[2]],b=null;t.autoCropOutput&&(b=e.getAutoCroppedOutputBounds(u));for(var w=0;w<3;w++){var D=0,T=0,C=0,I=0;if(t.transformInputSampling){for(var x=0,S=0;S<3;S++){I+=M[4*S+w]*(A[S]-y[12+S]);var N=y[4*w+S]*y[4*w+S];D+=N*Math.abs(c[S]),T+=N*(p[2*S+1]-p[2*S])*Math.abs(c[S]),C+=N*p[2*S],x+=N}D/=x,T/=x*Math.sqrt(x),C/=x}else I=A[w],D=c[w],T=(p[2*w+1]-p[2*w])*D,C=p[2*w];null==t.outputSpacing?m[w]=D:m[w]=t.outputSpacing[w],w>=t.outputDimensionality?(h[2*w]=0,h[2*w+1]=0):null==t.outputExtent?(t.autoCropOutput&&(T=b[2*w+1]-b[2*w]),h[2*w]=Math.round(C),h[2*w+1]=Math.round(h[2*w]+Math.abs(T/m[w]))):(h[2*w]=t.outputExtent[2*w],h[2*w+1]=t.outputExtent[2*w+1]),w>=t.outputDimensionality?g[w]=0:null==t.outputOrigin?t.autoCropOutput?g[w]=b[2*w]-h[2*w]*m[w]:g[w]=I-.5*(h[2*w]+h[2*w+1])*m[w]:g[w]=t.outputOrigin[w],v[w]=h[2*w+1]-h[2*w]+1}var E=f.getDataType();t.outputScalarType&&(E=t.outputScalarType);var O=u.getPointData().getScalars().getNumberOfComponents(),L=new window[E](v[0]*v[1]*v[2]),P=a.a.newInstance({name:"Scalars",values:L,numberOfComponents:O}),k=o.a.newInstance();k.setDimensions(v),k.setOrigin(g),k.setSpacing(m),k.getPointData().setScalars(P),e.getIndexMatrix(u,k);var R=t.interpolationMode;t.usePermuteExecute=!1,t.optimization&&null==r&&1===t.slabSliceSpacingFraction&&t.interpolator.isSeparable()&&e.isPermutationMatrix(n)&&(t.usePermuteExecute=!0,e.canUseNearestNeighbor(n,h)&&(R=pa.NEAREST)),t.interpolator.setInterpolationMode(R);var j=fa.CLAMP;j=t.wrap?fa.REPEAT:j,j=t.mirror?fa.MIRROR:j,t.interpolator.setBorderMode(j);var B=.5*t.border;B=(B=j===fa.CLAMP?B:4294967294)>762939453125e-17?B:762939453125e-17,t.interpolator.setTolerance(B),t.interpolator.initialize(u),e.vtkImageResliceExecute(u,k),t.interpolator.releaseData(),s[0]=k,Pa("Produced output")}else La("Invalid or missing input")},e.vtkImageResliceExecute=function(a,i){var o=a.getPointData().getScalars(),s=i.getPointData().getScalars(),u=s.getData(),l=i.getExtent(),c=n,d=Math.min(t.slabNumberOfSlices,1),f=t.slabSliceSpacingFraction,p=e.isPerspectiveMatrix(c),g=o.getData(),m=o.getDataType(),h=o.getNumberOfComponents(),v=t.interpolator.getComponentOffset(),y=t.interpolator.getBorderMode(),M=a.getDimensions(),A=[0,M[0]-1,0,M[1]-1,0,M[2]-1],b=[0,0,0];b[0]=o.getNumberOfComponents(),b[1]=b[0]*M[0],b[2]=b[1]*M[1];var w=M[0]*M[1]*M[2];v>0&&v+hpa.LINEAR||d>1&&t.slabMode===Oa.SUM,_=e.getConversionFunc(m,I,t.scalarShift,t.scalarScale,z),V=e.getSetPixelsFunc(I,1,x,u),F=e.getCompositeFunc(t.slabMode,t.slabTrapezoidIntegration),U=l[2]-1,G=l[4]-1,W=[0,0,0,0],Q=[0,0,0,0],Y=Ea.newInstance();Y.initialize(i,l,t.stencil,null);for(var H=Y.getScalars(i,0);!Y.isAtEnd();Y.nextSpan()){var K=Y.spanEndId()-Y.getId();if(u=H.subarray(1*Y.getId()*x),Y.isInStencil()){var X=Y.getIndex();X[2]>G&&(G=X[2],W[0]=O[0]+G*E[0],W[1]=O[1]+G*E[1],W[2]=O[2]+G*E[2],W[3]=O[3]+G*E[3],U=l[2]-1),X[1]>U&&(U=X[1],Q[0]=W[0]+U*N[0],Q[1]=W[1]+U*N[1],Q[2]=W[2]+U*N[2],Q[3]=W[3]+U*N[3]);var q=X[0],Z=q+K-1;if(C){for(var J=g,$=u,ee=1*b[0],te=1*b[1],ne=1*b[2],re=A[1]-A[0]+1,ae=A[3]-A[2]+1,ie=A[5]-A[4]+1,oe=q-1,se=!1,ue=1*h,le=q;le<=Z;le++){var ce=[Q[0]+le*S[0],Q[1]+le*S[1],Q[2]+le*S[2]],de=va(ce[0])-A[0],fe=va(ce[1])-A[2],pe=va(ce[2])-A[4];if(de>=0&&de=0&&fe=0&&pe1){var xe=Ie-.5*(d-1);xe*=f,we[0]=be[0]+xe*E[0],we[1]=be[1]+xe*E[1],we[2]=be[2]+xe*E[2],we[3]=be[3]+xe*E[3],De=we}if(p){var Se=1/De[3];De[0]*=Se,De[1]*=Se,De[2]*=Se}null!==r&&e.applyTransform(r,De,P,R),t.interpolator.checkBoundsIJK(De)&&(Te++,ve=1,t.interpolator.interpolateIJK(De,Ce),Ce=Ce.subarray(h))}Te>1&&F(Ae,h,Te),Ae=Ae.subarray(h),he=Me>q?he:ve}var Ne=Me-1-(ve!==he),Ee=Ne-ye+1;he?(T&&e.rescaleScalars(j,h,Z-q+1,t.scalarShift,t.scalarScale),u=_(u,j.subarray(ye*h),x,Ee)):u=V(u,B,x,Ee),ye+=Ee,he=ve}}else u=V(u,B,x,K)}},e.getIndexMatrix=function(a,i){null===n&&(n=Ye.c.create());var o=a.getOrigin(),s=a.getSpacing(),u=i.getOrigin(),l=i.getSpacing(),c=Ye.c.create(),d=Ye.c.create(),f=Ye.c.create();r&&(r=null),t.resliceAxes&&Ye.c.copy(c,t.resliceAxes),t.resliceTransform;for(var p=e.isIdentityMatrix(c),g=0;g<3;g++)(null!==r||s[g]===l[g]&&o[g]===u[g])&&(null===r||1===l[g]&&0===u[g])||(p=!1),d[4*g+g]=1/s[g],d[12+g]=-o[g]/s[g],f[4*g+g]=l[g],f[12+g]=u[g];return p||(Ye.c.multiply(c,c,f),null==r&&Ye.c.multiply(c,d,c)),Ye.c.copy(n,c),n},e.getAutoCroppedOutputBounds=function(e){var n=e.getOrigin(),r=e.getSpacing(),a=e.getDimensions(),i=[0,a[0]-1,0,a[1]-1,0,a[2]-1],o=Ye.c.create();t.resliceAxes&&Ye.c.invert(o,t.resliceAxes);for(var s=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],u=[0,0,0,0],l=0;l<8;++l){u[0]=n[0]+i[l%2]*r[0],u[1]=n[1]+i[2+Math.floor(l/2)%2]*r[1],u[2]=n[2]+i[4+Math.floor(l/4)%2]*r[2],u[3]=1,t.resliceTransform,Ye.f.transformMat4(u,u,o);var c=1/u[3];u[0]*=c,u[1]*=c,u[2]*=c;for(var d=0;d<3;++d)u[d]>s[2*d+1]&&(s[2*d+1]=u[d]),u[d]l){var p=l;l=u,u=p}o=uf}if(o&&n!==Tt.b.FLOAT&&n!==Tt.b.DOUBLE){var g=e.getDataTypeMinMax(n);return function(t,n,r,a){return e.clamp(t,n,r,a,g.min,g.max)}}return e.convert},e.set=function(e,t,n,r){for(var a=t.subarray(0,n),i=0;i=3)return 0;var a=e[4*r+n],i=e[12+n];t[2*r]===t[2*r+1]&&(i+=a*t[2*n],a=0);var o=ha(a).error,s=ha(i).error;if(0!==o||0!==s)return 0}return 1}}(e,t)}var ja=g.a.newInstance(Ra,"vtkImageReslice"),Ba={vtkAbstractImageInterpolator:Da,vtkImageInterpolator:Ia,vtkImagePointDataIterator:Ea,vtkImageReslice:{newInstance:ja,extend:Ra}},za=g.a.vtkErrorMacro;var _a={implicitFunction:void 0,sampleDimensions:[50,50,50],modelBounds:[-1,1,-1,1,-1,1],pointType:"Float32Array"};function Va(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_a,n),g.a.obj(e,t),g.a.algo(e,t,1,1),g.a.setGetArray(e,t,["sampleDimensions"],3),g.a.setGetArray(e,t,["modelBounds"],6),function(e,t){t.classHierarchy.push("vtkSampleFunction");var n=Object.assign({},e);e.getMTime=function(){return t.implicitFunction&&t.implicitFunction.getMTime?Math.max(n.getMTime(),t.implicitFunction.getMTime()):n.getMTime()},e.requestData=function(e,n){var r=t.implicitFunction;if(r){var i=[t.sampleDimensions[0],t.sampleDimensions[1],t.sampleDimensions[2]],s=i[0]*i[1]*i[2];if(s<1||i[1]<2||i[1]<2||i[2]<2)za("Bad volume dimensions");else{var u=o.a.newInstance(),l=[t.modelBounds[0],t.modelBounds[2],t.modelBounds[4]],c=[(t.modelBounds[1]-t.modelBounds[0])/(i[0]-1),(t.modelBounds[3]-t.modelBounds[2])/(i[1]-1),(t.modelBounds[5]-t.modelBounds[4])/(i[2]-1)],d=i[0]*i[1];u.setDimensions(i),u.setOrigin(l),u.setSpacing(c);var f=new window[t.pointType](s),p=a.a.newInstance({name:"Scalars",values:f,numberOfComponents:1});u.getPointData().setScalars(p);for(var g=0,m=[0,0,0],h=0;h2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ua,n),g.a.setGet(e,t,["rotationFactor"]),g.a.setGetArray(e,t,["displayCenter"],2),g.a.setGetArray(e,t,["center"],3),function(e,t){t.classHierarchy.push("vtkCompositeCameraManipulator"),e.computeDisplayCenter=function(e,n){var r=e.computeWorldToDisplay(n,t.center[0],t.center[1],t.center[2]);t.displayCenter[0]=r[0],t.displayCenter[1]=r[1]}}(e,t)}};var Wa={pinchEnabled:!0,panEnabled:!0,rotateEnabled:!0};var Qa={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wa,n),g.a.set(e,t,["pinchEnabled","panEnabled","rotateEnabled"]),g.a.setGet(e,t,["interactorStyle"]),function(e,t){t.classHierarchy.push("vtkCompositeGestureManipulator"),e.startInteraction=function(){},e.endInteraction=function(){},e.onStartPinch=function(e,t){},e.onStartRotate=function(e,t){},e.onStartPan=function(e,t){},e.onPinch=function(e,t,n){},e.onRotate=function(e,t,n){},e.onPan=function(e,t,n){},e.onEndPinch=function(e){},e.onEndRotate=function(e){},e.onEndPan=function(e){},e.isPinchEnabled=function(){return t.pinchEnabled},e.isPanEnabled=function(){return t.panEnabled},e.isRotateEnabled=function(){return t.rotateEnabled}}(e,t)}};var Ya={button:1,shift:!1,control:!1,alt:!1,dragEnabled:!0,scrollEnabled:!1};var Ha={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ya,n),g.a.setGet(e,t,["button","shift","control","alt"]),g.a.set(e,t,["dragEnabled","scrollEnabled"]),function(e,t){t.classHierarchy.push("vtkCompositeMouseManipulator"),e.startInteraction=function(){},e.endInteraction=function(){},e.onButtonDown=function(e,t,n){},e.onButtonUp=function(e){},e.onMouseMove=function(e,t,n){},e.onKeyUp=function(e,t){},e.onKeyDown=function(e,t){},e.onStartScroll=function(e,t,n){},e.onScroll=function(e,t,n){},e.onEndScroll=function(e){},e.isDragEnabled=function(){return t.dragEnabled},e.isScrollEnabled=function(){return t.scrollEnabled}}(e,t)}},Ka={Unknown:0,LeftController:1,RightController:2},Xa={Unknown:0,Trigger:1,TrackPad:2,Grip:3,ApplicationMenu:4},qa={Device:Ka,Input:Xa};var Za={};var Ja={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Za,n),g.a.setGet(e,t,["device","input"]),function(e,t){t.classHierarchy.push("vtkCompositeVRManipulator"),e.onButton3D=function(e,t,n,r,a,i){},e.onMove3D=function(e,t,n,r,a,i){}}(e,t)},Device:Ka,Input:Xa},$a=qa.Device,ei=qa.Input,ti=g.a.vtkWarningMacro,ni=g.a.vtkErrorMacro,ri=g.a.normalizeWheel,ai=g.a.vtkOnceErrorMacro,ii={"OpenVR Gamepad":[ei.TrackPad,ei.Trigger,ei.Grip,ei.ApplicationMenu]},oi=["StartAnimation","Animation","EndAnimation","StartMouseMove","MouseMove","EndMouseMove","LeftButtonPress","LeftButtonRelease","MiddleButtonPress","MiddleButtonRelease","RightButtonPress","RightButtonRelease","KeyPress","KeyDown","KeyUp","StartMouseWheel","MouseWheel","EndMouseWheel","StartPinch","Pinch","EndPinch","StartPan","Pan","EndPan","StartRotate","Rotate","EndRotate","Button3D","Move3D","StartInteractionEvent","InteractionEvent","EndInteractionEvent"];function si(e){return e.stopPropagation(),e.preventDefault(),!1}var ui={renderWindow:null,interactorStyle:null,picker:null,pickingManager:null,initialized:!1,enabled:!1,enableRender:!0,currentRenderer:null,lightFollowCamera:!0,desiredUpdateRate:30,stillUpdateRate:2,container:null,view:null,recognizeGestures:!0,currentGesture:"Start",animationRequest:null,lastFrameTime:.1,wheelTimeoutID:0,moveTimeoutID:0,lastGamepadValues:{}};function li(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ui,n),g.a.obj(e,t),g.a.event(e,t,"RenderEvent"),oi.forEach(function(n){return g.a.event(e,t,n)}),g.a.get(e,t,["initialized","container","enabled","enableRender","interactorStyle","lastFrameTime","view"]),g.a.setGet(e,t,["lightFollowCamera","enabled","recognizeGestures","desiredUpdateRate","stillUpdateRate","picker"]),function(e,t){t.classHierarchy.push("vtkRenderWindowInteractor");var n=new Set;function r(n,r){t.currentRenderer=e.findPokedRenderer(n,r)}function a(e){var n=t.container.getBoundingClientRect(),a=t.view.getCanvas(),i=a.width/n.width,o=a.height/n.height,s={x:i*(e.clientX-n.left),y:o*(n.height-e.clientY+n.top),z:0};return r(s.x,s.y),s}function i(e){for(var t={},n=0;n1&&void 0!==arguments[1]&&arguments[1];if(n.has(r))n.delete(r),t.animationRequest&&0===n.size&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null,e.endAnimationEvent(),e.render());else if(!a){var i=r&&r.getClassName?r.getClassName():r;ti("".concat(i," did not request an animation"))}},e.switchToVRAnimation=function(){t.animationRequest&&(cancelAnimationFrame(t.animationRequest),t.animationRequest=null),t.vrAnimation=!0},e.returnFromVRAnimation=function(){t.vrAnimation=!1},e.updateGamepads=function(n){for(var r=navigator.getGamepads(),a=0;a1){var r=i(n.touches);if(2===n.touches.length){var o={position:a(n.touches[0]),shiftKey:!1,altKey:!1,controlKey:!1};e.leftButtonReleaseEvent(o)}e.recognizeGesture("TouchStart",r)}else{var s={position:a(n.touches[0]),shiftKey:!1,altKey:!1,controlKey:!1};e.leftButtonPressEvent(s)}},e.handleTouchMove=function(n){if(n.stopPropagation(),n.preventDefault(),t.recognizeGestures&&n.touches.length>1){var r=i(n.touches);e.recognizeGesture("TouchMove",r)}else{var o={position:a(n.touches[0]),shiftKey:!1,altKey:!1,controlKey:!1};e.mouseMoveEvent(o)}},e.handleTouchEnd=function(n){if(n.stopPropagation(),n.preventDefault(),t.recognizeGestures)if(0===n.touches.length)if(1===n.changedTouches.length){var r={position:a(n.changedTouches[0]),shiftKey:!1,altKey:!1,controlKey:!1};e.leftButtonReleaseEvent(r),u(!1)}else{var o=i(n.changedTouches);e.recognizeGesture("TouchEnd",o),u(!1)}else if(1===n.touches.length){var s=i(n.changedTouches);e.recognizeGesture("TouchEnd",s);var l={position:a(n.touches[0]),shiftKey:!1,altKey:!1,controlKey:!1};e.leftButtonPressEvent(l)}else{var c=i(n.touches);e.recognizeGesture("TouchMove",c)}else{var d={position:a(n.changedTouches[0]),shiftKey:!1,altKey:!1,controlKey:!1};e.leftButtonReleaseEvent(d),u(!1)}},e.setView=function(n){t.view!==n&&(t.view=n,t.view.getRenderable().setInteractor(e),e.modified())},e.findPokedRenderer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!t.view)return null;for(var r=t.view.getRenderable().getRenderersByReference(),a=null,i=null,o=null,s=r.length;s--;){var u=r[s];t.view.isInViewport(e,n,u)&&u.getInteractive()&&(o=u),null===a&&u.getInteractive()&&(a=u),null===i&&t.view.isInViewport(e,n,u)&&(i=u)}return null===o&&(o=a),null===o&&(o=i),null==o&&(o=r[0]),o},e.render=function(){null!==t.animationRequest||t.inRender||l()},oi.forEach(function(n){var r=n.charAt(0).toLowerCase()+n.slice(1);e["".concat(r,"Event")]=function(r){if(t.enabled)if(e.getCurrentRenderer()){var a={type:n,pokedRenderer:t.currentRenderer};Object.assign(a,r),e["invoke".concat(n)](a)}else ai("\n Can not forward events without a current renderer on the interactor.\n ")}}),e.recognizeGesture=function(n,r){if(!(Object.keys(r).length>2)){if(t.startingEventPositions||(t.startingEventPositions={}),"TouchStart"===n)return Object.keys(r).forEach(function(e){t.startingEventPositions[e]=r[e]}),void(t.currentGesture="Start");if("TouchEnd"===n)return"Pinch"===t.currentGesture&&(e.render(),e.endPinchEvent()),"Rotate"===t.currentGesture&&(e.render(),e.endRotateEvent()),"Pan"===t.currentGesture&&(e.render(),e.endPanEvent()),t.currentGesture="Start",void(t.startingEventPositions={});var a=0,i=[],o=[];Object.keys(r).forEach(function(e){i[a]=r[e],o[a]=t.startingEventPositions[e],a++});var s=Math.sqrt((o[0].x-o[1].x)*(o[0].x-o[1].x)+(o[0].y-o[1].y)*(o[0].y-o[1].y)),u=Math.sqrt((i[0].x-i[1].x)*(i[0].x-i[1].x)+(i[0].y-i[1].y)*(i[0].y-i[1].y)),l=d.a.degreesFromRadians(Math.atan2(o[1].y-o[0].y,o[1].x-o[0].x)),c=d.a.degreesFromRadians(Math.atan2(i[1].y-i[0].y,i[1].x-i[0].x)),f=c-l;c=c+180>=360?c-180:c+180,l=l+180>=360?l-180:l+180,Math.abs(c-l)g&&m>h&&m>v){t.currentGesture="Pinch";var y={scale:1,touches:r};e.startPinchEvent(y)}else if(h>g&&h>v){t.currentGesture="Rotate";var M={rotation:0,touches:r};e.startRotateEvent(M)}else if(v>g){t.currentGesture="Pan";var A={translation:[0,0],touches:r};e.startPanEvent(A)}}else{if("Rotate"===t.currentGesture){var b={rotation:f,touches:r};e.rotateEvent(b)}if("Pinch"===t.currentGesture){var w={scale:u/s,touches:r};e.pinchEvent(w)}if("Pan"===t.currentGesture){var D={translation:p,touches:r};e.panEvent(D)}}}}}(e,t)}var ci=g.a.newInstance(li,"vtkRenderWindowInteractor"),di=Object.assign({newInstance:ci,extend:li,handledEvents:oi},qa),fi=g.a.vtkErrorMacro,pi=g.a.VOID;var gi={computeWorldToDisplay:function(e,t,n,r){return e.getRenderWindow().getViews()[0].worldToDisplay(t,n,r,e)},computeDisplayToWorld:function(e,t,n,r){return e.getRenderWindow().getViews()[0].displayToWorld(t,n,r,e)}};var mi={enabled:!0,interactor:null,priority:0,processEvents:!0,subscribedEvents:[]};function hi(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mi,n),g.a.obj(e,t),g.a.event(e,t,"InteractionEvent"),g.a.event(e,t,"StartInteractionEvent"),g.a.event(e,t,"EndInteractionEvent"),g.a.get(e,t,["interactor","enabled"]),g.a.setGet(e,t,["priority","processEvents"]),function(e,t){function n(){for(;t.subscribedEvents.length;)t.subscribedEvents.pop().unsubscribe()}function r(){di.handledEvents.forEach(function(n){e["handle".concat(n)]&&t.subscribedEvents.push(t.interactor["on".concat(n)](function(r){return t.processEvents?e["handle".concat(n)](r):pi},t.priority))})}t.classHierarchy.push("vtkInteractorObserver"),e.setInteractor=function(a){a!==t.interactor&&(n(),t.interactor=a,a&&t.enabled&&r(),e.modified())},e.setEnabled=function(a){a!==t.enabled&&(n(),a&&(t.interactor?r():fi("\n The interactor must be set before subscribing to events\n ")),t.enabled=a,e.modified())},e.computeDisplayToWorld=function(e,n,r,a){return e?t.interactor.getView().displayToWorld(n,r,a,e):null},e.computeWorldToDisplay=function(e,n,r,a){return e?t.interactor.getView().worldToDisplay(n,r,a,e):null}}(e,t)}var vi=g.a.newInstance(hi,"vtkInteractorObserver"),yi=Object.assign({newInstance:vi,extend:hi},gi),Mi={IS_START:0,IS_NONE:0,IS_ROTATE:1,IS_PAN:2,IS_SPIN:3,IS_DOLLY:4,IS_CAMERA_POSE:11,IS_WINDOW_LEVEL:1024,IS_SLICE:1025},Ai={States:Mi},bi=Ai.States,wi={Rotate:bi.IS_ROTATE,Pan:bi.IS_PAN,Spin:bi.IS_SPIN,Dolly:bi.IS_DOLLY,CameraPose:bi.IS_CAMERA_POSE,WindowLevel:bi.IS_WINDOW_LEVEL,Slice:bi.IS_SLICE};var Di={state:bi.IS_NONE,handleObservers:1,autoAdjustCameraClippingRange:1};function Ti(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Di,n),yi.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkInteractorStyle"),Object.keys(wi).forEach(function(n){g.a.event(e,t,"Start".concat(n,"Event")),e["start".concat(n)]=function(){t.state===bi.IS_NONE&&(t.state=wi[n],t.interactor.requestAnimation(e),e.invokeStartInteractionEvent({type:"StartInteractionEvent"}),e["invokeStart".concat(n,"Event")]({type:"Start".concat(n,"Event")}))},g.a.event(e,t,"End".concat(n,"Event")),e["end".concat(n)]=function(){t.state===wi[n]&&(t.state=bi.IS_NONE,t.interactor.cancelAnimation(e),e.invokeEndInteractionEvent({type:"EndInteractionEvent"}),e["invokeEnd".concat(n,"Event")]({type:"End".concat(n,"Event")}),t.interactor.render())}}),e.handleKeyPress=function(e){var n=t.interactor;switch(e.key){case"r":case"R":e.pokedRenderer.resetCamera(),n.render();break;case"w":case"W":e.pokedRenderer.getActors().forEach(function(e){e.getProperty().setRepresentationToWireframe()}),n.render();break;case"s":case"S":e.pokedRenderer.getActors().forEach(function(e){e.getProperty().setRepresentationToSurface()}),n.render();break;case"v":case"V":e.pokedRenderer.getActors().forEach(function(e){e.getProperty().setRepresentationToPoints()}),n.render()}}}(e,t)}var Ci=g.a.newInstance(Ti,"vtkInteractorStyle"),Ii=Object.assign({newInstance:Ci,extend:Ti},Ai),xi=g.a.vtkDebugMacro,Si=Ii.States,Ni={type:"StartInteractionEvent"},Ei={type:"InteractionEvent"},Oi={type:"EndInteractionEvent"};function Li(e,t,n,r,a,i){var o=e.getActiveCamera(),s=o.getFocalPoint(),u=(s=t.getInteractorStyle().computeWorldToDisplay(e,s[0],s[1],s[2]))[2],l=t.getInteractorStyle().computeDisplayToWorld(e,n,r,u),c=t.getInteractorStyle().computeDisplayToWorld(e,a,i,u),d=[c[0]-l[0],c[1]-l[1],c[2]-l[2]];s=o.getFocalPoint();var f=o.getPosition();o.setFocalPoint(d[0]+s[0],d[1]+s[1],d[2]+s[2]),o.setPosition(d[0]+f[0],d[1]+f[1],d[2]+f[2])}var Pi={dollyToPosition:function(e,t,n,r){var a=n.getActiveCamera();if(a.getParallelProjection()){var i=r.getView().getSize(),o=i[0]/2,s=i[1]/2,u=t.x,l=t.y;Li(n,r,o,s,u,l),a.setParallelScale(a.getParallelScale()/e),Li(n,r,u,l,o,s)}else{var c=a.getFocalPoint(),d=a.getViewPlaneNormal();c=r.getInteractorStyle().computeWorldToDisplay(n,c[0],c[1],c[2]);var f=r.getInteractorStyle().computeDisplayToWorld(n,t.x,t.y,c[2]);a.setFocalPoint(f[0],f[1],f[2]),a.dolly(e),n.resetCameraClippingRange();var p=a.getPosition();c=a.getFocalPoint();var g=[0,0,0],m=d[0]*(c[0]-p[0])+d[1]*(c[1]-p[1])+d[2]*(c[2]-p[2]);m/=Math.pow(d[0],2)+Math.pow(d[1],2)+Math.pow(d[2],2),g[0]=p[0]+d[0]*m,g[1]=p[1]+d[1]*m,g[2]=p[2]+d[2]*m,a.setFocalPoint(g[0],g[1],g[2]),n.resetCameraClippingRange()}},translateCamera:Li,dollyByFactor:function(e,t,n){if(!Number.isNaN(n)){var r=t.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.resetCameraClippingRange()),e.getLightFollowCamera()&&t.updateLightsGeometryToFollowCamera()}}};var ki={currentManipulator:null,currentWheelManipulator:null,centerOfRotation:[0,0,0],rotationFactor:1};function Ri(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ki,n),Ii.extend(e,t,n),g.a.setGet(e,t,["rotationFactor"]),g.a.setGetArray(e,t,["centerOfRotation"],3),function(e,t){t.classHierarchy.push("vtkInteractorStyleManipulator"),t.mouseManipulators=[],t.vrManipulators=[],t.gestureManipulators=[],t.currentManipulator=null,t.currentWheelManipulator=null,t.centerOfRotation=[0,0,0],t.rotationFactor=1,e.removeAllManipulators=function(){e.removeAllMouseManipulators(),e.removeAllVRManipulators(),e.removeAllGestureManipulators()},e.removeAllMouseManipulators=function(){t.mouseManipulators=[]},e.removeAllVRManipulators=function(){t.vrManipulators=[]},e.removeAllGestureManipulators=function(){t.gestureManipulators=[]},e.removeMouseManipulator=function(e){t.mouseManipulators.length>e&&(t.mouseManipulators[e]=null)},e.removeVRManipulator=function(e){t.vrManipulators.length>e&&(t.vrManipulators[e]=null)},e.removeGestureManipulator=function(e){t.gestureManipulators.length>e&&(t.gestureManipulators[e]=null)},e.getMouseManipulator=function(e){var n=null;return t.mouseManipulators.length>e&&(n=t.mouseManipulators[e]),n},e.getVRManipulator=function(e){var n=null;return t.vrManipulators.length>e&&(n=t.vrManipulators[e]),n},e.getGestureManipulator=function(e){var n=null;return t.gestureManipulators.length>e&&(n=t.gestureManipulators[e]),n},e.addMouseManipulator=function(e){var n=t.mouseManipulators.length;return t.mouseManipulators.push(e),n},e.addVRManipulator=function(e){var n=t.vrManipulators.length;return t.vrManipulators.push(e),n},e.addGestureManipulator=function(n){var r=t.gestureManipulators.length;return t.gestureManipulators.push(n),n.setInteractorStyle(e),r},e.getNumberOfMouseManipulators=function(){return t.mouseManipulators.length},e.getNumberOfVRManipulators=function(){return t.vrManipulators.length},e.getNumberOfGestureManipulators=function(){return t.gestureManipulators.length},e.resetCurrentManipulator=function(){t.currentManipulator=null,t.currentWheelManipulator=null},e.handleLeftButtonPress=function(n){t.previousPosition=n.position,e.onButtonDown(1,n)},e.handleMiddleButtonPress=function(n){t.previousPosition=n.position,e.onButtonDown(2,n)},e.handleRightButtonPress=function(n){t.previousPosition=n.position,e.onButtonDown(3,n)},e.handleButton3D=function(n){n&&(t.currentManipulator=e.findVRManipulator(n.device,n.input,n.pressed),t.currentManipulator?(t.currentManipulator.onButton3D(e,n.pokedRenderer,t.state,n.device,n.input,n.pressed),n.pressed?e.startCameraPose():e.endCameraPose()):xi("No manipulator found"))},e.handleMove3D=function(n){t.currentManipulator&&t.state===Si.IS_CAMERA_POSE&&t.currentManipulator.onMove3D(e,n.pokedRenderer,t.state,n)},e.onButtonDown=function(n,r){t.currentManipulator||(t.currentManipulator=e.findMouseManipulator(n,r.shiftKey,r.controlKey,r.altKey),t.currentManipulator?(t.currentManipulator.setCenter&&t.currentManipulator.setCenter(t.centerOfRotation),t.currentManipulator.setRotationFactor&&t.currentManipulator.setRotationFactor(t.rotationFactor),t.currentManipulator.startInteraction(),t.currentManipulator.onButtonDown(t.interactor,r.pokedRenderer,r.position),t.interactor.requestAnimation(e.onButtonDown),e.invokeStartInteractionEvent(Ni)):xi("No manipulator found"))},e.findMouseManipulator=function(e,n,r,a){for(var i=null,o=t.mouseManipulators.length;o--;){var s=t.mouseManipulators[o];s&&s.getButton()===e&&s.getShift()===n&&s.getControl()===r&&s.getAlt()===a&&s.isDragEnabled()&&(i=s)}return i},e.findVRManipulator=function(e,n){for(var r=null,a=t.vrManipulators.length;a--;){var i=t.vrManipulators[a];i&&i.getDevice()===e&&i.getInput()===n&&(r=i)}return r},e.handleLeftButtonRelease=function(){e.onButtonUp(1)},e.handleMiddleButtonRelease=function(){e.onButtonUp(2)},e.handleRightButtonRelease=function(){e.onButtonUp(3)},e.onButtonUp=function(n){t.currentManipulator&&t.currentManipulator.getButton&&t.currentManipulator.getButton()===n&&(t.currentManipulator.onButtonUp(t.interactor),t.currentManipulator.endInteraction(),t.currentManipulator=null,t.interactor.cancelAnimation(e.onButtonDown),e.invokeEndInteractionEvent(Oi))},e.handleStartMouseWheel=function(n){if(!t.currentWheelManipulator){for(var r=null,a=t.mouseManipulators.length;a--;){var i=t.mouseManipulators[a];i.isScrollEnabled()&&i.getShift()===n.shiftKey&&i.getControl()===n.controlKey&&i.getAlt()===n.altKey&&(r=i)}r?(t.currentWheelManipulator=r,t.currentWheelManipulator.onStartScroll(t.interactor,n.pokedRenderer,n.spinY),t.currentWheelManipulator.startInteraction(),t.interactor.requestAnimation(e.handleStartMouseWheel),e.invokeStartInteractionEvent(Ni)):xi("No manipulator found")}},e.handleEndMouseWheel=function(){t.currentWheelManipulator&&t.currentWheelManipulator.onEndScroll&&(t.currentWheelManipulator.onEndScroll(t.interactor),t.currentWheelManipulator.endInteraction(),t.currentWheelManipulator=null,t.interactor.cancelAnimation(e.handleStartMouseWheel),e.invokeEndInteractionEvent(Oi))},e.handleMouseWheel=function(n){t.currentWheelManipulator&&t.currentWheelManipulator.onScroll&&(t.currentWheelManipulator.onScroll(t.interactor,n.pokedRenderer,n.spinY),e.invokeInteractionEvent(Ei))},e.handleMouseMove=function(n){t.currentManipulator&&t.currentManipulator.onMouseMove&&(t.currentManipulator.onMouseMove(t.interactor,n.pokedRenderer,n.position),e.invokeInteractionEvent(Ei))},e.handleKeyPress=function(n){t.mouseManipulators.filter(function(e){return e.onKeyDown}).forEach(function(r){r.onKeyDown(t.interactor,n.key),e.invokeInteractionEvent(Ei)})},e.handleKeyUp=function(n){t.mouseManipulators.filter(function(e){return e.onKeyUp}).forEach(function(r){r.onKeyUp(t.interactor,n.key),e.invokeInteractionEvent(Ei)})},e.handleStartPinch=function(n){e.startDolly();for(var r=t.gestureManipulators.length;r--;){var a=t.gestureManipulators[r];a.isPinchEnabled()&&(a.onStartPinch(t.interactor,n.scale),a.startInteraction())}t.interactor.requestAnimation(e.handleStartPinch),e.invokeStartInteractionEvent(Ni)},e.handleEndPinch=function(){e.endDolly();for(var n=t.gestureManipulators.length;n--;){var r=t.gestureManipulators[n];r.isPinchEnabled()&&(r.onEndPinch(t.interactor),r.endInteraction())}t.interactor.cancelAnimation(e.handleStartPinch),e.invokeEndInteractionEvent(Oi)},e.handleStartRotate=function(n){e.startRotate();for(var r=t.gestureManipulators.length;r--;){var a=t.gestureManipulators[r];a.isRotateEnabled()&&(a.onStartRotate(t.interactor,n.rotation),a.startInteraction())}t.interactor.requestAnimation(e.handleStartRotate),e.invokeStartInteractionEvent(Ni)},e.handleEndRotate=function(){e.endRotate();for(var n=t.gestureManipulators.length;n--;){var r=t.gestureManipulators[n];r.isRotateEnabled()&&(r.onEndRotate(t.interactor),r.endInteraction())}t.interactor.cancelAnimation(e.handleStartRotate),e.invokeEndInteractionEvent(Oi)},e.handleStartPan=function(n){e.startPan();for(var r=t.gestureManipulators.length;r--;){var a=t.gestureManipulators[r];a.isPanEnabled()&&(a.onStartPan(t.interactor,n.translation),a.startInteraction())}t.interactor.requestAnimation(e.handleStartPan),e.invokeStartInteractionEvent(Ni)},e.handleEndPan=function(){e.endPan();for(var n=t.gestureManipulators.length;n--;){var r=t.gestureManipulators[n];r.isPanEnabled()&&(r.onEndPan(t.interactor),r.endInteraction())}t.interactor.cancelAnimation(e.handleStartPan),e.invokeEndInteractionEvent(Oi)},e.handlePinch=function(n){for(var r=t.gestureManipulators.length,a=0;r--;){var i=t.gestureManipulators[r];i.isPinchEnabled()&&(i.onPinch(t.interactor,n.pokedRenderer,n.scale),a++)}a&&e.invokeInteractionEvent(Ei)},e.handlePan=function(n){for(var r=t.gestureManipulators.length,a=0;r--;){var i=t.gestureManipulators[r];i.isPanEnabled()&&(i.onPan(t.interactor,n.pokedRenderer,n.translation),a++)}a&&e.invokeInteractionEvent(Ei)},e.handleRotate=function(n){for(var r=t.gestureManipulators.length,a=0;r--;){var i=t.gestureManipulators[r];i.isRotateEnabled()&&(i.onRotate(t.interactor,n.pokedRenderer,n.rotation),a++)}a&&e.invokeInteractionEvent(Ei)}}(e,t)}var ji=g.a.newInstance(Ri,"vtkInteractorStyleManipulator"),Bi=Object.assign({newInstance:ji,extend:Ri},Pi);var zi={};function _i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zi,n),g.a.obj(e,t),Qa.extend(e,t,n),Ga.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkGestureCameraManipulator"),e.onStartPinch=function(e,n){t.previousScale=n},e.onStartRotate=function(e,n){t.previousRotation=n},e.onStartPan=function(e,n){t.previousTranslation=n},e.onPinch=function(e,n,r){Bi.dollyByFactor(e,n,r/t.previousScale),t.previousScale=r},e.onPan=function(e,n,r){var a=n.getActiveCamera(),i=a.getFocalPoint(),o=(i=t.interactorStyle.computeWorldToDisplay(n,i[0],i[1],i[2]))[2],s=r,u=t.previousTranslation,l=t.interactorStyle.computeDisplayToWorld(n,i[0]+s[0]-u[0],i[1]+s[1]-u[1],o),c=t.interactorStyle.computeDisplayToWorld(n,i[0],i[1],o),d=[];d[0]=c[0]-l[0],d[1]=c[1]-l[1],d[2]=c[2]-l[2],i=a.getFocalPoint();var f=a.getPosition();a.setFocalPoint(d[0]+i[0],d[1]+i[1],d[2]+i[2]),a.setPosition(d[0]+f[0],d[1]+f[1],d[2]+f[2]),e.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera(),a.orthogonalizeViewUp(),t.previousTranslation=r},e.onRotate=function(e,n,r){var a=n.getActiveCamera();a.roll(r-t.previousRotation),a.orthogonalizeViewUp(),t.previousRotation=r}}(e,t)}var Vi={newInstance:g.a.newInstance(_i,"vtkGestureCameraManipulator"),extend:_i};var Fi={};function Ui(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fi,n),g.a.obj(e,t),Ga.extend(e,t,n),Ha.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkMouseCameraSliceManipulator"),e.onButtonDown=function(e,n,r){t.previousPosition=r},e.onMouseMove=function(e,n,r){if(r){var a=r.y-t.previousPosition.y,i=n.getActiveCamera(),o=i.getClippingRange(),s=i.getDistance(),u=0;if(i.getParallelProjection())u=i.getParallelScale();else{var l=d.a.radiansFromDegrees(i.getViewAngle());u=2*s*Math.tan(.5*l)}(s+=a*u/e.getView().getViewportSize(n)[1])o[1]&&(s=o[1]-.001*u),i.setDistance(s),t.previousPosition=r}},e.onScroll=function(e,t,n){if(n){var r=1-n;r*=25;var a=t.getActiveCamera(),i=a.getClippingRange(),o=a.getDistance();(o+=r)i[1]&&(o=i[1]),a.setDistance(o)}}}(e,t)}var Gi={newInstance:g.a.newInstance(Ui,"vtkMouseCameraSliceManipulator"),extend:Ui};var Wi={};function Qi(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wi,n),g.a.obj(e,t),Ha.extend(e,t,n),Ga.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkMouseCameraTrackballRotateManipulator");var n=new Float64Array(3),r=new Float64Array(3),a=new Float64Array(3),i=new Float64Array(16),o=new Float64Array(3),s=new Float64Array(3),u=new Float64Array(3);e.onButtonDown=function(e,n,r){t.previousPosition=r},e.onMouseMove=function(e,l,c){if(c){var f=l.getActiveCamera(),p=f.getPosition(),g=f.getFocalPoint();Ye.c.identity(i);var m=t.center,h=t.rotationFactor;Ye.c.translate(i,i,m);var v=t.previousPosition.x-c.x,y=t.previousPosition.y-c.y,M=e.getView().getSize(),A=f.getViewUp();Ye.c.rotate(i,i,d.a.radiansFromDegrees(360*v/M[0]*h),A),d.a.cross(f.getDirectionOfProjection(),A,o),Ye.c.rotate(i,i,d.a.radiansFromDegrees(-360*y/M[1]*h),o),s[0]=-m[0],s[1]=-m[1],s[2]=-m[2],Ye.c.translate(i,i,s),Ye.e.transformMat4(n,p,i),Ye.e.transformMat4(r,g,i),u[0]=A[0]+p[0],u[1]=A[1]+p[1],u[2]=A[2]+p[2],Ye.e.transformMat4(a,u,i),f.setPosition(n[0],n[1],n[2]),f.setFocalPoint(r[0],r[1],r[2]),f.setViewUp(a[0]-n[0],a[1]-n[1],a[2]-n[2]),f.orthogonalizeViewUp(),l.resetCameraClippingRange(),e.getLightFollowCamera()&&l.updateLightsGeometryToFollowCamera(),t.previousPosition=c}}}(e,t)}var Yi={newInstance:g.a.newInstance(Qi,"vtkMouseCameraTrackballRotateManipulator"),extend:Qi};var Hi={};function Ki(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hi,n),g.a.obj(e,t),Ga.extend(e,t,n),Ha.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkMouseCameraTrackballRollManipulator");var n=new Float64Array(3),r=new Float64Array(3),a=new Float64Array(3),i=new Float64Array(16),o=new Float64Array(3),s=new Float64Array(3),u=new Float64Array(3);e.onButtonDown=function(e,n,r){t.previousPosition=r},e.onMouseMove=function(l,c,f){if(f){var p=c.getActiveCamera(),g=p.getPosition(),m=p.getFocalPoint(),h=p.getViewUp();n[0]=m[0]-g[0],n[1]=m[1]-g[1],n[2]=m[2]-g[2],e.computeDisplayCenter(l.getInteractorStyle(),c);var v=t.previousPosition.x-t.displayCenter[0],y=f.x-t.displayCenter[0],M=t.previousPosition.y-t.displayCenter[1],A=f.y-t.displayCenter[1];if(!(0===y&&0===A||0===v&&0===M)){var b=d.a.degreesFromRadians((v*A-M*y)/(Math.sqrt(v*v+M*M)*Math.sqrt(y*y+A*A))),w=t.center;Ye.c.identity(i),a[0]=-w[0],a[1]=-w[1],a[2]=-w[2],Ye.c.translate(i,i,w),Ye.c.rotate(i,i,d.a.radiansFromDegrees(b),n),Ye.c.translate(i,i,a),Ye.e.transformMat4(o,g,i),Ye.e.transformMat4(s,m,i),r[0]=h[0]+g[0],r[1]=h[1]+g[1],r[2]=h[2]+g[2],Ye.e.transformMat4(u,r,i),p.setPosition(o[0],o[1],o[2]),p.setFocalPoint(s[0],s[1],s[2]),p.setViewUp(u[0]-o[0],u[1]-o[1],u[2]-o[2]),p.orthogonalizeViewUp(),c.resetCameraClippingRange(),l.getLightFollowCamera()&&c.updateLightsGeometryToFollowCamera(),t.previousPosition=f}}}}(e,t)}var Xi={newInstance:g.a.newInstance(Ki,"vtkMouseCameraTrackballRollManipulator"),extend:Ki};function qi(e){return e*e}var Zi={};function Ji(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Zi,n),g.a.obj(e,t),Ha.extend(e,t,n),Ga.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkMouseCameraTrackballMultiRotateManipulator");var n=Yi.newInstance(),r=Xi.newInstance(),a=null;e.onButtonDown=function(t,i,o){var s,u,l=t.getView().getSize(),c=[.5*l[0],.5*l[1]],d=.9*((s=c[0])<(u=c[1])?u:s),f=qi(c[0]-o.x)+qi(c[1]-o.y);(a=d*d>f?n:r).setButton(e.getButton()),a.setShift(e.getShift()),a.setControl(e.getControl()),a.setCenter(e.getCenter()),a.onButtonDown(t,o)},e.onButtonUp=function(e){a&&a.onButtonUp(e)},e.onMouseMove=function(e,t,n){a&&a.onMouseMove(e,t,n)}}(e,t)}var $i={newInstance:g.a.newInstance(Ji,"vtkMouseCameraTrackballMultiRotateManipulator"),extend:Ji};var eo={};function to(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eo,n),g.a.obj(e,t),Ga.extend(e,t,n),Ha.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkMouseCameraTrackballPanManipulator"),e.onButtonDown=function(e,n,r){t.previousPosition=r},e.onMouseMove=function(e,n,r){if(r){var a=r,i=t.previousPosition;t.previousPosition=r;var o=n.getActiveCamera(),s=o.getPosition(),u=o.getFocalPoint();if(o.getParallelProjection()){o.orthogonalizeViewUp();var l=o.getViewUp(),c=o.getViewPlaneNormal(),f=[0,0,0];d.a.cross(c,l,f);var p=e.getView().getSize()[1],g=(a.x-i.x)/p,m=(i.y-a.y)/p,h=o.getParallelScale();m*=2*h;var v=f[0]*(g*=2*h)+l[0]*m;s[0]+=v,u[0]+=v,v=f[1]*g+l[1]*m,s[1]+=v,u[1]+=v,v=f[2]*g+l[2]*m,s[2]+=v,u[2]+=v,o.setPosition(s[0],s[1],s[2]),o.setFocalPoint(u[0],u[1],u[2])}else{var y=t.center,M=e.getInteractorStyle(),A=M.computeWorldToDisplay(n,y[0],y[1],y[2])[2],b=M.computeDisplayToWorld(n,a.x,a.y,A),w=M.computeDisplayToWorld(n,i.x,i.y,A),D=[s[0]+(w[0]-b[0]),s[1]+(w[1]-b[1]),s[2]+(w[2]-b[2])],T=[u[0]+(w[0]-b[0]),u[1]+(w[1]-b[1]),u[2]+(w[2]-b[2])];o.setPosition(D[0],D[1],D[2]),o.setFocalPoint(T[0],T[1],T[2])}n.resetCameraClippingRange(),e.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()}}}(e,t)}var no={newInstance:g.a.newInstance(to,"vtkMouseCameraTrackballPanManipulator"),extend:to};var ro={zoomScale:0};function ao(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ro,n),g.a.obj(e,t),Ha.extend(e,t,n),Ga.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkMouseCameraTrackballZoomManipulator"),e.onButtonDown=function(e,n,r){t.previousPosition=r;var a=e.getView().getSize(),i=n.getActiveCamera();if(i.getParallelProjection())t.zoomScale=1.5/a[1];else{var o=i.getClippingRange();t.zoomScale=o[1]/a[1]*1.5}},e.onMouseMove=function(e,n,r){if(r){var a=t.previousPosition.y-r.y,i=n.getActiveCamera();if(i.getParallelProjection()){var o=a*t.zoomScale;i.setParallelScale((1-o)*i.getParallelScale())}else{var s=i.getPosition(),u=i.getFocalPoint(),l=i.getDirectionOfProjection(),c=a*t.zoomScale,d=c*l[0];s[0]+=d,u[0]+=d,d=c*l[1],s[1]+=d,u[1]+=d,d=c*l[2],s[2]+=d,u[2]+=d,i.getFreezeFocalPoint()||i.setFocalPoint(u[0],u[1],u[2]),i.setPosition(s[0],s[1],s[2]),n.resetCameraClippingRange()}e.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera(),t.previousPosition=r}},e.onScroll=function(e,t,n){if(n){var r=t.getActiveCamera(),a=1-n/10;r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/a):(r.dolly(a),t.resetCameraClippingRange()),e.getLightFollowCamera()&&t.updateLightsGeometryToFollowCamera()}}}(e,t)}var io={newInstance:g.a.newInstance(ao,"vtkMouseCameraTrackballZoomManipulator"),extend:ao};var oo={zoomPosition:null};function so(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oo,n),io.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkMouseCameraTrackballZoomToMouseManipulator");var n=e.onButtonDown;e.onButtonDown=function(e,r,a){n(e,r,a),t.zoomPosition=a},e.onMouseMove=function(e,n,r){if(r){var a=(t.previousPosition.y-r.y)*t.zoomScale;Bi.dollyToPosition(1-a,t.zoomPosition,n,e),e.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera(),t.previousPosition=r}}}(e,t)}var uo={newInstance:g.a.newInstance(so,"vtkMouseCameraTrackballZoomToMouseManipulator"),extend:so};var lo={horizontalListener:null,verticalListener:null,scrollListener:null};function co(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lo,n),g.a.obj(e,t),Ha.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkMouseRangeManipulator");var n=new Map;function r(e,t){return t*((e.max-e.min)/(e.step+1))}function a(e,t){var r=e.getValue(),a=r+t+n.get(e),i=a-e.min,o=Math.round(i/e.step);if(a=e.min+e.step*o,a=Math.max(a,e.min),(a=Math.min(a,e.max))!==r)e.setValue(a),n.set(e,0);else{var s=n.get(e);n.set(e,s+t),(a===e.min&&n.get(e)<0||a===e.max&&n.get(e)>0)&&n.set(e,0)}}e.setHorizontalListener=function(r,a,i,o,s){var u=Number.isFinite(o)?function(){return o}:o;t.horizontalListener={min:r,max:a,step:i,getValue:u,setValue:s},n.set(t.horizontalListener,0),e.modified()},e.setVerticalListener=function(r,a,i,o,s){var u=Number.isFinite(o)?function(){return o}:o;t.verticalListener={min:r,max:a,step:i,getValue:u,setValue:s},n.set(t.verticalListener,0),e.modified()},e.setScrollListener=function(r,a,i,o,s){var u=Number.isFinite(o)?function(){return o}:o;t.scrollListener={min:r,max:a,step:i,getValue:u,setValue:s},n.set(t.scrollListener,0),e.modified()},e.removeHorizontalListener=function(){t.verticalListener&&(n.delete(t.verticalListener),delete t.verticalListener,e.modified())},e.removeVerticalListener=function(){t.horizontalListener&&(n.delete(t.horizontalListener),delete t.horizontalListener,e.modified())},e.removeScrollListener=function(){t.scrollListener&&(n.delete(t.scrollListener),delete t.scrollListener,e.modified())},e.removeAllListeners=function(){e.removeHorizontalListener(),e.removeVerticalListener(),e.removeScrollListener()},e.onButtonDown=function(e,n,r){t.previousPosition=r},e.onMouseMove=function(e,n,i){if((t.verticalListener||t.horizontalListener)&&i){var o=e.getView().getViewportSize(n);if(t.horizontalListener){var s=(i.x-t.previousPosition.x)/o[0],u=r(t.horizontalListener,s);a(t.horizontalListener,u)}if(t.verticalListener){var l=(i.y-t.previousPosition.y)/o[1],c=r(t.verticalListener,l);a(t.verticalListener,c)}t.previousPosition=i}},e.onScroll=function(e,n,r){t.scrollListener&&r&&a(t.scrollListener,r*t.scrollListener.step)},e.onStartScroll=e.onScroll}(e,t)}var fo={newInstance:g.a.newInstance(co,"vtkMouseRangeManipulator"),extend:co};var po={device:Ka.RightController,input:Xa.TrackPad};function go(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,po,n),g.a.obj(e,t),Ja.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkVRButtonPanManipulator"),e.onButton3D=function(e,t,n,r,a,i){i?e.startCameraPose():n===Mi.IS_CAMERA_POSE&&e.endCameraPose()},e.onMove3D=function(e,t,n,r){if(n===Mi.IS_CAMERA_POSE){var a=t.getActiveCamera(),i=a.getPhysicalTranslation(),o=.05*r.gamepad.axes[1]/a.getPhysicalScale(),s=a.physicalOrientationToWorldDirection(r.orientation);a.setPhysicalTranslation(i[0]+s[0]*o,i[1]+s[1]*o,i[2]+s[2]*o)}}}(e,t)}var mo=g.a.newInstance(go,"vtkVRButtonPanManipulator"),ho=Object.assign({newInstance:mo,extend:go}),vo={vtkCompositeCameraManipulator:Ga,vtkCompositeGestureManipulator:Qa,vtkCompositeMouseManipulator:Ha,vtkCompositeVRManipulator:Ja,vtkGestureCameraManipulator:Vi,vtkMouseCameraSliceManipulator:Gi,vtkMouseCameraTrackballMultiRotateManipulator:$i,vtkMouseCameraTrackballPanManipulator:no,vtkMouseCameraTrackballRollManipulator:Xi,vtkMouseCameraTrackballRotateManipulator:Yi,vtkMouseCameraTrackballZoomManipulator:io,vtkMouseCameraTrackballZoomToMouseManipulator:uo,vtkMouseRangeManipulator:fo,vtkVRButtonPanManipulator:ho},yo=[],Mo={device:{},screen:window.orientation||0,supported:!!window.DeviceMotionEvent,update:!1},Ao={"landscape-primary":90,"landscape-secondary":-90,"portrait-secondary":180,"portrait-primary":0};function bo(e){Mo.device=e,Number.isFinite(e.alpha)||(Mo.supported=!1)}function wo(){Mo.screen=Ao[window.screen.orientation||window.screen.mozOrientation]||window.orientation||0}var Do={vtkDeviceOrientationToCamera:{addCameraToSynchronize:function(e,t,n){var r={subscription:e.onAnimation(function(){if(Mo.update&&(s=Mo.device,Number.isFinite(s.alpha))){var e=Mo.device,r=e.alpha,a=e.beta,i=e.gamma,o=Mo.screen;t.setDeviceAngles(r,a,i,o),n&&n()}var s}),renderWindowInteractor:e},a=yo.length;return yo.push(r),Mo.update&&r.renderWindowInteractor.requestAnimation(),a},addWindowListeners:function(){window.addEventListener("orientationchange",wo,!1),window.addEventListener("deviceorientation",bo,!1),Mo.update=!0,yo.filter(function(e){return!!e}).forEach(function(e){return e.renderWindowInteractor.requestAnimation(e)})},isDeviceOrientationSupported:function(){return Mo.supported},removeCameraToSynchronize:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=yo[e];n&&(n.subscription.unsubscribe(),t&&n.renderWindowInteractor.cancelAnimation()),yo[e]=null},removeWindowListeners:function(){window.removeEventListener("orientationchange",wo,!1),window.removeEventListener("deviceorientation",bo,!1),Mo.update=!1,yo.filter(function(e){return!!e}).forEach(function(e){return e.renderWindowInteractor.cancelAnimation(e)})}}},To=Ai.States;var Co={motionFactor:10};function Io(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Co,n),Ii.extend(e,t,n),g.a.setGet(e,t,["motionFactor"]),function(e,t){t.classHierarchy.push("vtkInteractorStyleTrackballCamera"),e.handleMouseMove=function(n){var r=n.position,a=n.pokedRenderer;switch(t.state){case To.IS_ROTATE:e.handleMouseRotate(a,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case To.IS_PAN:e.handleMousePan(a,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case To.IS_DOLLY:e.handleMouseDolly(a,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case To.IS_SPIN:e.handleMouseSpin(a,r),e.invokeInteractionEvent({type:"InteractionEvent"})}t.previousPosition=r},e.handleButton3D=function(n){n&&n.pressed&&n.device===Ka.RightController&&n.input===Xa.TrackPad?e.startCameraPose():n&&!n.pressed&&n.device===Ka.RightController&&n.input===Xa.TrackPad&&t.state===To.IS_CAMERA_POSE&&e.endCameraPose()},e.handleMove3D=function(n){switch(t.state){case To.IS_CAMERA_POSE:e.updateCameraPose(n)}},e.updateCameraPose=function(e){var t=e.pokedRenderer.getActiveCamera(),n=t.getPhysicalTranslation(),r=.05*e.gamepad.axes[1]/t.getPhysicalScale(),a=t.physicalOrientationToWorldDirection(e.orientation);t.setPhysicalTranslation(n[0]+a[0]*r,n[1]+a[1]*r,n[2]+a[2]*r)},e.handleLeftButtonPress=function(n){var r=n.position;t.previousPosition=r,n.shiftKey?n.controlKey||n.altKey?e.startDolly():e.startPan():n.controlKey||n.altKey?e.startSpin():e.startRotate()},e.handleLeftButtonRelease=function(){switch(t.state){case To.IS_DOLLY:e.endDolly();break;case To.IS_PAN:e.endPan();break;case To.IS_SPIN:e.endSpin();break;case To.IS_ROTATE:e.endRotate()}},e.handleStartMouseWheel=function(t){e.startDolly(),e.handleMouseWheel(t)},e.handleEndMouseWheel=function(){e.endDolly()},e.handleStartPinch=function(n){t.previousScale=n.scale,e.startDolly()},e.handleEndPinch=function(){e.endDolly()},e.handleStartRotate=function(n){t.previousRotation=n.rotation,e.startRotate()},e.handleEndRotate=function(){e.endRotate()},e.handleStartPan=function(n){t.previousTranslation=n.translation,e.startPan()},e.handleEndPan=function(){e.endPan()},e.handlePinch=function(n){e.dollyByFactor(n.pokedRenderer,n.scale/t.previousScale),t.previousScale=n.scale},e.handlePan=function(n){var r=n.pokedRenderer.getActiveCamera(),a=r.getFocalPoint(),i=(a=e.computeWorldToDisplay(n.pokedRenderer,a[0],a[1],a[2]))[2],o=n.translation,s=t.previousTranslation,u=e.computeDisplayToWorld(n.pokedRenderer,a[0]+o[0]-s[0],a[1]+o[1]-s[1],i),l=e.computeDisplayToWorld(n.pokedRenderer,a[0],a[1],i),c=[];c[0]=l[0]-u[0],c[1]=l[1]-u[1],c[2]=l[2]-u[2],a=r.getFocalPoint();var d=r.getPosition();r.setFocalPoint(c[0]+a[0],c[1]+a[1],c[2]+a[2]),r.setPosition(c[0]+d[0],c[1]+d[1],c[2]+d[2]),t.interactor.getLightFollowCamera()&&n.pokedRenderer.updateLightsGeometryToFollowCamera(),r.orthogonalizeViewUp(),t.previousTranslation=n.translation},e.handleRotate=function(e){var n=e.pokedRenderer.getActiveCamera();n.roll(e.rotation-t.previousRotation),n.orthogonalizeViewUp(),t.previousRotation=e.rotation},e.handleMouseRotate=function(e,n){var r=t.interactor,a=n.x-t.previousPosition.x,i=n.y-t.previousPosition.y,o=r.getView().getViewportSize(e),s=-.1,u=-.1;o[0]&&o[1]&&(s=-20/o[1],u=-20/o[0]);var l=a*u*t.motionFactor,c=i*s*t.motionFactor,d=e.getActiveCamera();Number.isNaN(l)||Number.isNaN(c)||(d.azimuth(l),d.elevation(c),d.orthogonalizeViewUp()),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange(),r.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()},e.handleMouseSpin=function(e,n){var r=t.interactor,a=e.getActiveCamera(),i=r.getView().getViewportCenter(e),o=d.a.degreesFromRadians(Math.atan2(t.previousPosition.y-i[1],t.previousPosition.x-i[0])),s=d.a.degreesFromRadians(Math.atan2(n.y-i[1],n.x-i[0]))-o;Number.isNaN(s)||(a.roll(s),a.orthogonalizeViewUp())},e.handleMousePan=function(n,r){var a=n.getActiveCamera(),i=a.getFocalPoint(),o=(i=e.computeWorldToDisplay(n,i[0],i[1],i[2]))[2],s=e.computeDisplayToWorld(n,r.x,r.y,o),u=e.computeDisplayToWorld(n,t.previousPosition.x,t.previousPosition.y,o),l=[];l[0]=u[0]-s[0],l[1]=u[1]-s[1],l[2]=u[2]-s[2],i=a.getFocalPoint();var c=a.getPosition();a.setFocalPoint(l[0]+i[0],l[1]+i[1],l[2]+i[2]),a.setPosition(l[0]+c[0],l[1]+c[1],l[2]+c[2]),t.interactor.getLightFollowCamera()&&n.updateLightsGeometryToFollowCamera()},e.handleMouseDolly=function(n,r){var a=r.y-t.previousPosition.y,i=t.interactor.getView().getViewportCenter(n),o=t.motionFactor*a/i[1];e.dollyByFactor(n,Math.pow(1.1,o))},e.handleMouseWheel=function(t){var n=1-t.spinY/10;e.dollyByFactor(t.pokedRenderer,n)},e.dollyByFactor=function(e,n){if(!Number.isNaN(n)){var r=e.getActiveCamera();r.getParallelProjection()?r.setParallelScale(r.getParallelScale()/n):(r.dolly(n),t.autoAdjustCameraClippingRange&&e.resetCameraClippingRange()),t.interactor.getLightFollowCamera()&&e.updateLightsGeometryToFollowCamera()}}}(e,t)}var xo=g.a.newInstance(Io,"vtkInteractorStyleTrackballCamera"),So=Object.assign({newInstance:xo,extend:Io});var No={windowLevelStartPosition:[0,0],windowLevelCurrentPosition:[0,0],lastSlicePosition:0,windowLevelInitial:[1,.5],currentImageProperty:0,currentImageNumber:-1,interactionMode:"IMAGE2D",xViewRightVector:[0,1,0],xViewUpVector:[0,0,-1],yViewRightVector:[1,0,0],yViewUpVector:[0,0,-1],zViewRightVector:[1,0,0],zViewUpVector:[0,1,0]};function Eo(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,No,n),So.extend(e,t,n),g.a.setGet(e,t,["interactionMode"]),function(e,t){t.classHierarchy.push("vtkInteractorStyleImage"),e.superHandleMouseMove=e.handleMouseMove,e.handleMouseMove=function(n){var r=n.position,a=n.pokedRenderer;switch(t.state){case Mi.IS_WINDOW_LEVEL:e.windowLevel(a,r),e.invokeInteractionEvent({type:"InteractionEvent"});break;case Mi.IS_SLICE:e.slice(a,r),e.invokeInteractionEvent({type:"InteractionEvent"})}e.superHandleMouseMove(n)},e.superHandleLeftButtonPress=e.handleLeftButtonPress,e.handleLeftButtonPress=function(n){var r=n.position;if(n.shiftKey||n.controlKey)"IMAGE3D"===t.interactionMode&&n.shiftKey?e.startRotate():"IMAGE_SLICING"===t.interactionMode&&n.controlKey?(t.lastSlicePosition=r.y,e.startSlice()):e.superHandleLeftButtonPress(n);else{t.windowLevelStartPosition[0]=r.x,t.windowLevelStartPosition[1]=r.y,e.setCurrentImageNumber(t.currentImageNumber);var a=t.currentImageProperty;a&&(t.windowLevelInitial[0]=a.getColorWindow(),t.windowLevelInitial[1]=a.getColorLevel()),e.startWindowLevel()}},e.superHandleLeftButtonRelease=e.handleLeftButtonRelease,e.handleLeftButtonRelease=function(){switch(t.state){case Mi.IS_WINDOW_LEVEL:e.endWindowLevel();break;case Mi.IS_SLICE:e.endSlice();break;default:e.superHandleLeftButtonRelease()}},e.handleStartMouseWheel=function(t){e.startSlice(),e.handleMouseWheel(t)},e.handleEndMouseWheel=function(){e.endSlice()},e.handleMouseWheel=function(e){var t=e.pokedRenderer.getActiveCamera(),n=t.getDistance();n+=e.spinY;var r=t.getClippingRange();nr[1]&&(n=r[1]),t.setDistance(n)},e.windowLevel=function(e,n){t.windowLevelCurrentPosition[0]=n.x,t.windowLevelCurrentPosition[1]=n.y;var r=t.interactor;if(t.currentImageProperty){var a=r.getView().getViewportSize(e),i=t.windowLevelInitial[0],o=t.windowLevelInitial[1],s=4*(t.windowLevelCurrentPosition[0]-t.windowLevelStartPosition[0])/a[0],u=4*(t.windowLevelStartPosition[1]-t.windowLevelCurrentPosition[1])/a[1];Math.abs(i)>.01?s*=i:s*=i<0?-.01:.01,Math.abs(o)>.01?u*=o:u*=o<0?-.01:.01,i<0&&(s*=-1),o<0&&(u*=-1);var l=s+i,c=o-u;l<.01&&(l=.01),t.currentImageProperty.setColorWindow(l),t.currentImageProperty.setColorLevel(c)}},e.slice=function(e,n){var r=t.interactor,a=n.y-t.lastSlicePosition,i=e.getActiveCamera(),o=i.getClippingRange(),s=i.getDistance(),u=0;if(i.getParallelProjection())u=i.getParallelScale();else{var l=d.a.radiansFromDegrees(i.getViewAngle());u=2*s*Math.tan(.5*l)}(s+=a*u/r.getView().getViewportSize(e)[1])o[1]&&(s=o[1]-.001*u),i.setDistance(s),t.lastSlicePosition=n.y},e.setCurrentImageNumber=function(e){var n=t.interactor.getCurrentRenderer();if(n){t.currentImageNumber=e;var r=n.getViewProps(),a=e;e<0&&(a+=r.length);for(var i=null,o=!1,s=0;s2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ko,n),Bi.extend(e,t,n),g.a.setGet(e,t,["volumeMapper"]),function(e,t){t.classHierarchy.push("vtkInteractorStyleMPRSlice"),t.trackballManipulator=Yi.newInstance({button:1}),t.panManipulator=no.newInstance({button:1,shift:!0}),t.zoomManipulator=io.newInstance({button:3}),t.scrollManipulator=fo.newInstance({scrollEnabled:!0,dragEnabled:!1});var n={sliceNormal:[0,0,0],sliceRange:[0,0]},r=null;function a(){var n=e.getSliceRange();t.scrollManipulator.removeScrollListener(),t.scrollManipulator.setScrollListener(n[0],n[1],1,e.getSlice,e.setSlice)}var i=e.setInteractor;e.setInteractor=function(t){if(i(t),t){var n=t.getCurrentRenderer().getActiveCamera();r&&r.unsubscribe(),r=n.onModified(function(){a(),e.modified()})}},e.handleMouseMove=g.a.chain(e.handleMouseMove,function(){var e=t.interactor.getCurrentRenderer().getActiveCamera(),n=e.getDistance();e.setClippingRange(n,n+1)});var o=e.setVolumeMapper;e.setVolumeMapper=function(n){if(o(n)){var r=t.interactor.getCurrentRenderer().getActiveCamera();n?(r.setFreezeFocalPoint(!0),e.setSliceNormal.apply(e,Po(e.getSliceNormal()))):r.setFreezeFocalPoint(!1)}},e.getSlice=function(){var n=t.interactor.getCurrentRenderer().getActiveCamera(),r=e.getSliceNormal(),a=f.a.buildFromDegree().identity().rotateFromDirections(r,[1,0,0]),i=n.getFocalPoint();return a.apply(i),i[0]},e.setSlice=function(n){var r=t.interactor.getCurrentRenderer().getActiveCamera();if(t.volumeMapper){var a=e.getSliceRange(),i=t.volumeMapper.getBounds(),o=function(e,t,n){return en?n:e}.apply(void 0,[n].concat(Po(a))),s=[(i[0]+i[1])/2,(i[2]+i[3])/2,(i[4]+i[5])/2],u=r.getDistance(),l=r.getDirectionOfProjection();d.a.normalize(l);var c=(a[1]+a[0])/2,f=[s[0]-l[0]*c,s[1]-l[1]*c,s[2]-l[2]*c],p=[f[0]+l[0]*o,f[1]+l[1]*o,f[2]+l[2]*o],g=[p[0]-l[0]*u,p[1]-l[1]*u,p[2]-l[2]*u];r.setPosition.apply(r,g),r.setFocalPoint.apply(r,p)}},e.getSliceRange=function(){if(t.volumeMapper){var r=e.getSliceNormal();if(r[0]===n.sliceNormal[0]&&r[1]===n.sliceNormal[1]&&r[2]===n.sliceNormal[2])return n.sliceRange;var a=function(e){return[[e[0],e[2],e[4]],[e[0],e[2],e[5]],[e[0],e[3],e[4]],[e[0],e[3],e[5]],[e[1],e[2],e[4]],[e[1],e[2],e[5]],[e[1],e[3],e[4]],[e[1],e[3],e[5]]]}(t.volumeMapper.getBounds()),i=f.a.buildFromDegree().identity().rotateFromDirections(r,[1,0,0]);a.forEach(function(e){return i.apply(e)});for(var o=1/0,s=-1/0,u=0;u<8;u++){var l=a[u][0];l>s&&(s=l),l2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uo,n),Ii.extend(e,t,n),g.a.setGet(e,t,["sendMouseMove","remoteEventAddOn","throttleDelay"]),g.a.event(e,t,"RemoteMouseEvent"),g.a.event(e,t,"RemoteWheelEvent"),g.a.event(e,t,"RemoteGestureEvent"),function(e,t){function n(e){var n=t.buttonLeft,r=t.buttonMiddle,a=t.buttonRight,i=e.shiftKey?1:0,o=e.ctrlKey?1:0,s=e.altKey?1:0,u=e.metaKey?1:0,l=n||r||a?"down":"up",c=zo(t.interactor.getView().getSizeByReference(),2),d=c[0],f=c[1],p=e.position,g=p.x,m=p.y;return g/=d,m/=f,Object.assign({action:l,x:g,y:m,buttonLeft:n,buttonMiddle:r,buttonRight:a,shiftKey:i,altKey:s,ctrlKey:o,metaKey:u},t.remoteEventAddOn)}t.classHierarchy.push("vtkInteractorStyleRemoteMouse"),e.handleLeftButtonPress=function(n){t.previousPosition=n.position,t.buttonLeft=1,e.onButtonDown(1,n)},e.handleMiddleButtonPress=function(n){t.previousPosition=n.position,t.buttonMiddle=1,e.onButtonDown(2,n)},e.handleRightButtonPress=function(n){t.previousPosition=n.position,t.buttonRight=1,e.onButtonDown(3,n)},e.handleLeftButtonRelease=function(n){t.buttonLeft=0,e.onButtonUp(1,n)},e.handleMiddleButtonRelease=function(n){t.buttonMiddle=0,e.onButtonUp(2,n)},e.handleRightButtonRelease=function(n){t.buttonRight=0,e.onButtonUp(3,n)},e.onButtonDown=function(r,a){e.invokeRemoteMouseEvent(n(a)),t.interactor.requestAnimation(e.onButtonDown),e.invokeStartInteractionEvent(_o)},e.onButtonUp=function(r,a){e.invokeRemoteMouseEvent(n(a)),t.interactor.cancelAnimation(e.onButtonDown),e.invokeEndInteractionEvent(Fo)},e.handleStartMouseWheel=function(n){var r=n.spinY;e.invokeRemoteWheelEvent({type:"StartMouseWheel",spinY:r}),t.interactor.requestAnimation(e.handleStartMouseWheel),e.invokeStartInteractionEvent(_o)},e.handleEndMouseWheel=function(){e.invokeRemoteWheelEvent({type:"EndMouseWheel"}),t.interactor.cancelAnimation(e.handleStartMouseWheel),e.invokeEndInteractionEvent(Fo)},e.handleMouseWheel=function(t){var n=t.spinY;e.invokeRemoteWheelEvent({type:"MouseWheel",spinY:n}),e.invokeInteractionEvent(Vo)},e.handleMouseMove=function(r){var a=Date.now();t.throttleDelay2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qo,n),g.a.obj(e,t),g.a.get(e,t,["annotationContainer","northWestContainer","northContainer","northEastContainer","westContainer","eastContainer","southWestContainer","southContainer","southEastContainer","metadata"]),function(e,t){function n(){for(var e=Object.keys(t.templates),n=e.length;n--;){var r=t[Xo[e[n]]],a=t.templates[e[n]];r&&a&&(r.innerHTML=a(t.metadata))}}t.classHierarchy.push("vtkCornerAnnotation"),t.templates||(t.templates={}),t.metadata||(t.metadata={}),t.annotationContainer=document.createElement("div"),t.annotationContainer.setAttribute("class",Ho.a.container),t.annotationContainer.innerHTML='\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
'),t.northWestContainer=t.annotationContainer.querySelector(".js-nw"),t.northContainer=t.annotationContainer.querySelector(".js-n"),t.northEastContainer=t.annotationContainer.querySelector(".js-ne"),t.westContainer=t.annotationContainer.querySelector(".js-w"),t.eastContainer=t.annotationContainer.querySelector(".js-e"),t.southWestContainer=t.annotationContainer.querySelector(".js-sw"),t.southContainer=t.annotationContainer.querySelector(".js-s"),t.southEastContainer=t.annotationContainer.querySelector(".js-se"),e.setContainer=function(n){t.container&&t.container!==n&&t.container.removeChild(t.annotationContainer),t.container!==n&&(t.container=n,t.container&&(t.container.appendChild(t.annotationContainer),e.resize()),e.modified())},e.resize=Ko,e.updateTemplates=function(r){t.templates=Object.assign(t.templates,r),n(),e.modified()},e.updateMetadata=function(r){t.metadata=Object.assign(t.metadata,r),n(),e.modified()}}(e,t)}var Jo={newInstance:g.a.newInstance(Zo,"vtkCornerAnnotation"),extend:Zo,applyTemplate:function(e,t,n){return e.replace(/\${([^{]+)}/g,function(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"${".concat(e,"}");return e.split(".").reduce(function(e,t){return void 0!==e[t]?e[t]:n},t)}(e.substr(2,e.length-3).trim(),t,n)})}},$o=n(30),es=n.n($o),ts=Function.prototype;function ns(e){for(var t=[],n=e;n>1e3;)t.push("000".concat(n%1e3).slice(-3)),n=Math.floor(n/1e3);return n>0&&t.push(n),t.reverse(),t.join("'")}var rs={bufferSize:200,graphHeight:120,buffer:[60],subscriptions:[],fpsSum:0,orientationClass:es.a.horizontalContainer,canvasVisibility:!0,titleVisibility:!0,infoVisibility:!0};function as(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rs,n),g.a.obj(e,t),g.a.get(e,t,["fpsMonitorContainer","renderWindow","addOnStats"]),g.a.setGet(e,t,["bufferSize","canvasVisibility","infoVisibility","titleVisibility"]),function(e,t){function n(){if(t.title.style.display=t.titleVisibility?"block":"none",t.titleVisibility){var e=t.buffer[t.buffer.length-1],n="Mean: ".concat(Math.round(t.fpsSum/t.buffer.length)," - Current: ").concat(Math.round(e));n!==t.lastText&&(t.lastText=n,t.title.innerHTML=n)}}function r(){if(t.info.style.display=t.infoVisibility?"grid":"none",t.infoVisibility){var e=[];if(t.renderWindow){var n=t.renderWindow.getViews()[0];n&&n.getSize&&e.push('').concat(n.getSize().join("x"),""));var r=Object.assign({},t.renderWindow.getStatistics(),t.addOnStats),a=Object.keys(r);a.sort();for(var i=0;i').concat(a[i],'').concat(ns(r[a[i]]),""))}t.info.innerHTML=e.join("")}}function a(){if(t.canvas.style.display=t.canvasVisibility?"block":"none",t.canvasVisibility){t.canvas.setAttribute("width",t.bufferSize),t.canvas.setAttribute("height",t.graphHeight);var e=t.canvas.getContext("2d"),n=t.canvas,r=n.width,a=n.height;e.clearRect(0,0,r,a),e.strokeStyle="green",e.beginPath(),e.moveTo(0,a-t.buffer[0]);for(var i=1;it.bufferSize;)t.fpsSum-=t.buffer.shift();n(),a()}}t.classHierarchy.push("vtkFPSMonitor"),t.fpsMonitorContainer=document.createElement("div"),t.fpsMonitorContainer.setAttribute("class",t.orientationClass),t.fpsMonitorContainer.innerHTML='\n
\n
Mean N/A - Current N/A
\n \n
\n
\n
'),t.canvas=t.fpsMonitorContainer.querySelector(".js-graph"),t.title=t.fpsMonitorContainer.querySelector(".js-title"),t.info=t.fpsMonitorContainer.querySelector(".js-info"),e.update=function(){e.render()},e.setRenderWindow=function(e){for(;t.subscriptions.length;)t.subscriptions.pop().unsubscribe();t.renderWindow=e,t.interactor=e?e.getInteractor():null,t.interactor&&t.subscriptions.push(t.interactor.onAnimation(i))},e.setContainer=function(n){t.container&&t.container!==n&&t.container.removeChild(t.fpsMonitorContainer),t.container!==n&&(t.container=n,t.container&&(t.container.appendChild(t.fpsMonitorContainer),e.resize()),e.modified())},e.render=function(){n(),r(),a()},e.resize=ts,e.setOrientationToHorizontal=function(){t.fpsMonitorContainer.classList.remove(t.orientationClass),t.orientationClass=es.a.horizontalContainer,t.fpsMonitorContainer.classList.add(t.orientationClass)},e.setOrientationToVertical=function(){t.fpsMonitorContainer.classList.remove(t.orientationClass),t.orientationClass=es.a.verticalContainer,t.fpsMonitorContainer.classList.add(t.orientationClass)},e.setOrientation=function(){"horizontal"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"horizontal")?e.setOrientationToHorizontal():e.setOrientationToVertical()},e.setAddOnStats=function(e){t.addOnStats||(t.addOnStats={}),Object.assign(t.addOnStats,e),r()},e.setMonitorVisibility=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e.setCanvasVisibility(n),e.setInfoVisibility(r),e.setTitleVisibility(t)};var o=e.delete;e.delete=function(){e.setRenderWindow(null),e.setContainer(null),o()},t.subscriptions.push(e.onModified(e.update))}(e,t)}var is={newInstance:g.a.newInstance(as,"vtkFPSMonitor"),extend:as},os=n(81),ss=n.n(os),us=n(82),ls=n.n(us),cs=n(83),ds=n.n(cs),fs=n(130),ps=n.n(fs),gs={Contrast:ss.a,Logo:ls.a,Spacing:ds.a,Tint:ps.a},ms={SliderOrientation:{VERTICAL:0,HORIZONTAL:1}},hs=n(131),vs=n.n(hs);function ys(e,t){for(var n=Number.MAX_VALUE,r=-1,a=t.length;a--;){var i=Math.abs(t[a]-e);i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,As,n),g.a.obj(e,t),g.a.get(e,t,["orientation","value","values"]),g.a.set(e,t,["orientation"]),g.a.event(e,t,"ValueChange"),Ms(e,t)}var ws=g.a.newInstance(bs,"vtkSlider"),Ds=Object.assign({newInstance:ws,extend:bs},ms),Ts=n(132),Cs=Object.create(null);Ts.filter(function(e){return e.RGBPoints}).filter(function(e){return"CIELAB"!==e.ColorSpace}).forEach(function(e){Cs[e.Name]=e});var Is=Object.keys(Cs);Is.sort();var xs={addPreset:function(e){e.RGBPoints&&"CIELAB"!==e.ColorSpace&&(Cs[e.Name]||(Is.push(e.Name),Is.sort()),Cs[e.Name]=e)},removePresetByName:function(e){var t=Is.indexOf(e);t>-1&&Is.splice(t,1),delete Cs[e]},getPresetByName:function(e){return Cs[e]},rgbPresetNames:Is},Ss=n(133),Ns=n.n(Ss);function Es(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Os(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:256,n=[];n.lengthi+s||di+u?f===u?i:i+f/(f-u)*(d-i-u):-f===u?i:i-f/(f+u)*(d-i-u))-i)/f,g=Math.exp(-4*p*p),m=1-p*p,h=o*(l<1?l*m+(1-l)*g:(2-l)*m+1*(l-1));h>n[c]&&(n[c]=h)}}return n}function Bs(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{lineWidth:1,strokeStyle:"#000"},a=t[3],i=t[2]/(n.length-1),o=e.canvas.height,s=!!r.fillStyle;e.lineWidth=r.lineWidth,e.strokeStyle=r.strokeStyle,e.beginPath(),e.moveTo(t[0],o-t[1]);for(var u=0;u1&&void 0!==arguments[1])||arguments[1];return function(n){var r=n.offsetX,a=n.offsetY;t&&n.preventDefault(),e(r,a)}}function Fs(){ks.filter(function(e){return e.ready}).forEach(function(e){e.callbacks.forEach(function(t){t.touches===e.touches&&t.clicks===e.count&&t.action.apply(t,Os(e.singleTouche))}),e.ts=0,e.count=0,e.touches=0,e.ready=!1})}function Us(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return function(a){var i=a.target.getBoundingClientRect(),o=Array.prototype.map.call(a.touches,function(e){return[e.pageX-i.left,e.pageY-i.top]}).reduce(function(e,t){return[e[0]+t[0],e[1]+t[1]]},[0,0]).map(function(e){return e/a.touches.length});"touchstart"===a.type?(clearTimeout(ks[e].timeout),ks[e].ts=a.timeStamp,ks[e].singleTouche=o,ks[e].touches=a.touches.length):"touchmove"===a.type?(ks[e].ts=0,ks[e].count=0,ks[e].ready=!1):"touchend"===a.type&&(a.timeStamp-ks[e].ts1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.histogram=null,t.histogramArray=n;var i=d.a.arrayMax(n),o=d.a.arrayMin(n);t.dataRange=[o,i];for(var s=Math.floor(n.length/4)||1,u=0,l=[];ui;)o.shift();for(var u=o.reduce(function(e,t){return e+t},0)/i,l=0,c=t.histogram.length;l1){for(var s=t.style.iconSize+t.style.padding,u=s,l=0;r>u;)l+=1,u+=s;switch(l){case 0:var c=e.addGaussian(0,1,.1,0,0),d=t.gaussians[c],f=Object.assign({},d),p=Rs.adjustPosition;t.activeGaussian=c,t.selectedGaussian=c,g.a.setImmediate(function(){e.onDown(n,r),t.dragAction={position:[0,0],action:p,gaussian:d,originalGaussian:f}});break;case 1:-1!==t.selectedGaussian&&e.removeGaussian(t.selectedGaussian);break;default:t.selectedGaussian=-1,t.dragAction=null}}else if(i<0||i>1||o<0||o>1)t.selectedGaussian=-1,t.dragAction=null;else{var m=_s(i,t.gaussians);m!==t.selectedGaussian&&(t.selectedGaussian=m,e.modified())}return!0},e.onHover=function(n,r){var a=Es(zs(n,r,t.graphArea),2),i=a[0],o=a[1],s=i<0?t.selectedGaussian:_s(i,t.gaussians);t.canvas.style.cursor="default";var u=t.gaussians[s];if(u&&i>=0){var l=1-o,c=10/t.canvas.height,d=null;d=l>u.height+c?"adjustPosition":l>u.height-c?Math.abs(i-u.position).5*u.height+c?"adjustPosition":l>.5*u.height-c?Math.abs(i-u.position)c?"adjustPosition":"adjustWidth",t.canvas.style.cursor=Ps[d];var f=Rs[d],p=Object.assign({},u);t.dragAction={position:[i,o],action:f,gaussian:u,originalGaussian:p}}return s!==t.activeGaussian&&(t.activeGaussian=s,e.modified()),!0},e.onDown=function(n,r){t.mouseIsDown||e.invokeAnimation(!0),t.mouseIsDown=!0;var a=zs(n,r,t.graphArea)[0],i=_s(a,t.gaussians);t.gaussianSide=0;var o=t.gaussians[i];return o&&(t.gaussianSide=o.position-a),i!==t.selectedGaussian&&a>0&&(t.selectedGaussian=i,e.modified()),!0},e.onDrag=function(n,r){if(t.dragAction){var a=Es(zs(n,r,t.graphArea),2),i=a[0],o=a[1],s=t.dragAction,u=s.position,l=s.gaussian,c=s.originalGaussian;(0,s.action)(i,o,u,l,c,t.gaussianSide),t.opacities=js(t.gaussians,t.piecewiseSize),e.invokeOpacityChange(e,!0),e.modified()}return!0},e.onUp=function(n,r){return t.mouseIsDown&&e.invokeAnimation(!1),t.mouseIsDown=!1,!0},e.onLeave=function(n,r){return e.onUp(n,r),t.canvas.style.cursor="default",t.activeGaussian=-1,e.modified(),!0},e.onAddGaussian=function(n,r){var a=Es(zs(n,r,t.graphArea),2),i=a[0],o=a[1];return i>=0&&e.addGaussian(i,1-o,.1,0,0),!0},e.onRemoveGaussian=function(n,r){var a=zs(n,r,t.graphArea)[0],i=_s(a,t.gaussians);return a>=0&&-1!==i&&e.removeGaussian(i),!0},e.bindMouseListeners=function(){if(!t.listeners){var n=function(){return!!t.mouseIsDown},r=function(){for(var e=arguments.length,t=new Array(e),n=0;n1){var s=Math.round(t.style.iconSize/2-t.style.strokeWidth),u=Math.round(s+i+t.style.strokeWidth);e.beginPath(),e.lineWidth=t.style.buttonStrokeWidth,e.strokeStyle=t.style.buttonStrokeColor,e.arc(u-i/2,u,s,0,2*Math.PI,!1),e.fillStyle=t.style.buttonFillColor,e.fill(),e.stroke(),e.moveTo(u-s+t.style.strokeWidth+2-i/2,u),e.lineTo(u+s-t.style.strokeWidth-2-i/2,u),e.stroke(),e.moveTo(u-i/2,u-s+t.style.strokeWidth+2),e.lineTo(u-i/2,u+s-t.style.strokeWidth-2),e.stroke(),-1===t.selectedGaussian?(e.fillStyle=t.style.buttonDisableFillColor,e.lineWidth=t.style.buttonDisableStrokeWidth,e.strokeStyle=t.style.buttonDisableStrokeColor):(e.fillStyle=t.style.buttonFillColor,e.lineWidth=t.style.buttonStrokeWidth,e.strokeStyle=t.style.buttonStrokeColor),e.beginPath(),e.arc(u-i/2,u+i/2+t.style.iconSize,s,0,2*Math.PI,!1),e.fill(),e.stroke(),e.moveTo(u-s+t.style.strokeWidth+2-i/2,u+i/2+t.style.iconSize),e.lineTo(u+s-t.style.strokeWidth-2-i/2,u+i/2+t.style.iconSize),e.stroke()}if(t.histogram&&Bs(e,o,t.histogram,{lineWidth:1,strokeStyle:t.style.histogramColor,fillStyle:t.style.histogramColor}),Bs(e,o,t.opacities,{lineWidth:t.style.strokeWidth,strokeStyle:t.style.strokeColor}),t.colorTransferFunction&&t.colorTransferFunction.getSize()){var l=t.dataRange||t.colorTransferFunction.getMappingRange();t.colorCanvas&&t.colorCanvasMTime===t.colorTransferFunction.getMTime()||(t.colorCanvasMTime=t.colorTransferFunction.getMTime(),t.colorCanvas=function(e,t,n,r){var a=r||document.createElement("canvas");a.setAttribute("width",t),a.setAttribute("height",256);for(var i=a.getContext("2d"),o=e.getUint8Table(n[0],n[1],t,4),s=i.getImageData(0,0,t,256),u=0;u<256;u++)s.data.set(o,4*u*t);for(var l=256*t*4,c=4*t,d=3;d0&&(a=Math.min(a,o)),t.opacities[o]>0&&(i=Math.max(i,o));return[n[0]+a*r,n[0]+i*r]},e.onModified(e.render),e.setSize.apply(e,Os(t.size))}var Ys={histogram:[],numberOfBins:256,histogramArray:null,dataRange:[0,1],gaussians:[],opacities:[],size:[600,300],piecewiseSize:256,colorCanvasMTime:0,style:{backgroundColor:"rgba(255, 255, 255, 1)",histogramColor:"rgba(200, 200, 200, 0.5)",strokeColor:"rgb(0, 0, 0)",activeColor:"rgb(0, 0, 150)",buttonDisableFillColor:"rgba(255, 255, 255, 0.5)",buttonDisableStrokeColor:"rgba(0, 0, 0, 0.5)",buttonStrokeColor:"rgba(0, 0, 0, 1)",buttonFillColor:"rgba(255, 255, 255, 1)",handleColor:"rgb(0, 150, 0)",strokeWidth:2,activeStrokeWidth:3,buttonStrokeWidth:1.5,handleWidth:3,iconSize:20,padding:10},activeGaussian:-1,selectedGaussian:-1};function Hs(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ys,n),g.a.obj(e,t),g.a.setGet(e,t,["piecewiseSize","numberOfBins","colorTransferFunction","backgroundImage"]),g.a.get(e,t,["size","canvas","gaussians"]),g.a.event(e,t,"opacityChange"),g.a.event(e,t,"animation"),Qs(e,t)}var Ks=g.a.newInstance(Hs,"vtkPiecewiseGaussianWidget"),Xs=Object.assign({newInstance:Ks,extend:Hs},Ws),qs=n(31),Zs=n.n(qs);function Js(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t').concat(e,"")});var eu={size:[600,300],expanded:!0,rescaleColorMap:!1};function tu(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,eu,n),g.a.obj(e,t),g.a.setGet(e,t,["actor","renderWindow","rescaleColorMap"]),g.a.get(e,t,["widget"]),function(e,t){function n(){var e=!!Number(t.el.querySelector(".js-shadow").value);t.actor.getProperty().setShade(e),t.renderWindow.render()}function r(){var e=t.actor.getMapper().getInputData(),n=e.getPointData().getScalars()||e.getPointData().getArrays()[0],r=t.rescaleColorMap?t.colorDataRange:n.getRange(),a=xs.getPresetByName(t.el.querySelector(".js-color-preset").value),i=t.actor.getProperty().getRGBTransferFunction(0);i.applyColorMap(a),i.setMappingRange.apply(i,Js(r)),i.updateRange(),t.renderWindow.render()}function a(){var e=Number(t.el.querySelector(".js-spacing").value),n=t.actor.getMapper().getInputData(),r=.7*Math.sqrt(n.getSpacing().map(function(e){return e*e}).reduce(function(e,t){return e+t},0));t.actor.getMapper().setSampleDistance(r*Math.pow(2,3*e-1.5)),t.renderWindow.render()}function i(){var e=Number(t.el.querySelector(".js-edge").value);if(0===e)t.actor.getProperty().setUseGradientOpacity(0,!1);else{var n=t.actor.getMapper().getInputData(),r=(n.getPointData().getScalars()||n.getPointData().getArrays()[0]).getRange();t.actor.getProperty().setUseGradientOpacity(0,!0);var a=Math.max(0,e-.3)/.7;t.actor.getProperty().setGradientOpacityMinimumValue(0,.2*(r[1]-r[0])*a*a),t.actor.getProperty().setGradientOpacityMaximumValue(0,1*(r[1]-r[0])*e*e)}t.renderWindow.render()}t.classHierarchy.push("vtkVolumeController"),t.el=document.createElement("div"),t.el.setAttribute("class",Zs.a.container),t.widget=Xs.newInstance({numberOfBins:256,size:t.size}),e.setupContent=function(o,s,u){var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"1",c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"erdc_rainbow_bright";e.setActor(s),e.setRenderWindow(o);var d=t.actor.getMapper().getInputData(),f=d.getPointData().getScalars()||d.getPointData().getArrays()[0],p=t.actor.getProperty().getRGBTransferFunction(0),g=t.actor.getProperty().getScalarOpacity(0),m=u?"DarkBG":"BrightBG",h={};["button","presets","shadow"].forEach(function(e){h[e]=Zs.a["".concat(e).concat(m)]}),t.el.innerHTML='\n
\n
').concat(ls.a,'
\n \n \n
\n
\n
\n
').concat(ds.a,'
\n \n
\n
\n
').concat(ss.a,'
\n \n
\n
\n
\n ');var v=t.el.querySelector(".js-button"),y=t.el.querySelector(".js-shadow"),M=t.el.querySelector(".js-color-preset"),A=t.el.querySelector(".js-spacing"),b=t.el.querySelector(".js-edge"),w=t.el.querySelector(".js-pwf");t.widget.updateStyle({backgroundColor:"rgba(255, 255, 255, 0.6)",histogramColor:"rgba(100, 100, 100, 0.5)",strokeColor:"rgb(0, 0, 0)",activeColor:"rgb(255, 255, 255)",handleColor:"rgb(50, 150, 50)",buttonDisableFillColor:"rgba(255, 255, 255, 0.5)",buttonDisableStrokeColor:"rgba(0, 0, 0, 0.5)",buttonStrokeColor:"rgba(0, 0, 0, 1)",buttonFillColor:"rgba(255, 255, 255, 1)",strokeWidth:2,activeStrokeWidth:3,buttonStrokeWidth:1.5,handleWidth:3,iconSize:0,padding:10}),t.widget.addGaussian(.5,1,.5,.5,.4),t.widget.setDataArray(f.getData()),t.widget.setColorTransferFunction(p),t.widget.applyOpacity(g),t.widget.setContainer(w),t.widget.bindMouseListeners(),t.colorDataRange=t.widget.getOpacityRange(),v.addEventListener("click",e.toggleVisibility),y.addEventListener("change",n),M.addEventListener("change",r),A.addEventListener("input",a),b.addEventListener("input",i),t.widget.onOpacityChange(function(){t.widget.applyOpacity(g),t.colorDataRange=t.widget.getOpacityRange(),t.rescaleColorMap&&r(),t.renderWindow.getInteractor().isAnimating()||t.renderWindow.render()}),t.widget.onAnimation(function(e){e?t.renderWindow.getInteractor().requestAnimation(t.widget):(t.renderWindow.getInteractor().cancelAnimation(t.widget),t.renderWindow.render())}),p.onModified(function(){t.widget.render(),t.renderWindow.getInteractor().isAnimating()||t.renderWindow.render()}),y.value=Number(l)?"1":"0",M.value=c,n(),r(),a(),i()},e.setContainer=function(n){t.container&&t.container!==n&&t.container.removeChild(t.el),t.container!==n&&(t.container=n,t.container&&t.container.appendChild(t.el),e.modified())};var o=e.setRescaleColorMap;e.setRescaleColorMap=function(e){return!!o(e)&&(r(),!0)},e.toggleVisibility=function(){e.setExpanded(!e.getExpanded())},e.setExpanded=function(e){var n=t.el.querySelectorAll(".js-toggle"),r=n.length;if(t.expanded=e,t.expanded)for(;r--;)n[r].style.display="flex";else for(;r--;)n[r].style.display="none"},e.getExpanded=function(){return t.expanded},e.setSize=t.widget.setSize,e.render=t.widget.render,e.onAnimation=t.widget.onAnimation,e.onModified(e.render),e.setSize.apply(e,Js(t.size))}(e,t)}var nu=g.a.newInstance(tu,"vtkVolumeController"),ru={vtkCornerAnnotation:Jo,vtkFPSMonitor:is,vtkIcons:gs,vtkSlider:Ds,vtkVolumeController:{newInstance:nu,extend:tu}};var au={widgetRep:null,parent:null};function iu(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,au,n),yi.extend(e,t,n),e.setEnabled(!1),e.setPriority(.5),g.a.setGet(e,t,["widgetRep","parent"]),function(e,t){t.classHierarchy.push("vtkAbstractWidget");var n=Object.assign({},e);e.createDefaultRepresentation=function(){},e.setEnabled=function(r){if(r!==t.enabled){if(t.interactor){var a=t.interactor.getCurrentRenderer();a&&t.widgetRep&&a.removeViewProp(t.widgetRep)}if(n.setEnabled(r),r){if(!t.interactor)return;var i=t.interactor.getCurrentRenderer();if(!i)return;e.createDefaultRepresentation(),t.widgetRep.setRenderer(i),t.widgetRep.buildRepresentation(),i.addViewProp(t.widgetRep)}}},e.render=function(){!t.parent&&t.interactor&&t.interactor.render()}}(e,t)}var ou={newInstance:g.a.newInstance(iu,"vtkAbstractWidget"),extend:iu},su=n(5),uu=n(6);var lu={callback:null,useZValues:!1};function cu(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lu,n),uu.a.extend(e,t,n),g.a.setGet(e,t,["callback","useZValues"]),function(e,t){t.classHierarchy.push("vtkPixelSpaceCallbackMapper"),t.callback||(t.callback=function(){}),e.invokeCallback=function(e,n,r,a,i){if(t.callback){var o=n.getCompositeProjectionMatrix(r,-1,1);Ye.c.transpose(o,o);for(var s=e.getPoints(),u=Ye.e.fromValues(0,0,0),l=a.usize,c=l/2,d=a.vsize/2,f=[],p=0;p2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yu,n),g.a.obj(e,t),g.a.set(e,t,["property"]),g.a.get(e,t,["value"]),g.a.setGet(e,t,["coordinateSystem","referenceCoordinate","renderer"]),g.a.getArray(e,t,["value"],3),function(e,t){t.classHierarchy.push("vtkCoordinate"),e.setValue=function(){if(t.deleted)return vu("instance deleted - cannot call any method"),!1;for(var n=arguments.length,r=new Array(n),a=0;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wu,n),g.a.obj(e,t),g.a.setGet(e,t,["pixelTolerance","worldTolerance"]),function(e,t){t.classHierarchy.push("vtkPointPlacer"),e.computeWorldPosition=function(e,t,n){if(e){var r=bu.newInstance();return r.setCoordinateSystemToDisplay(),r.setValue(t[0],t[1]),n[0]=r.getComputedWorldValue(e)[0],n[1]=r.getComputedWorldValue(e)[1],n[2]=r.getComputedWorldValue(e)[2],1}return 0}}(e,t)}var Tu={newInstance:g.a.newInstance(Du,"vtkPointPlacer"),extend:Du},Cu=n(29),Iu=g.a.vtkErrorMacro;var xu={renderer:null,interactionState:0,startEventPosition:[0,0,0],lastEventPosition:[0,0,0],placeFactor:.5,placed:0,handleSize:.05,validPick:0,initialBounds:[0,1,0,1,0,1],initialLength:0,needToRender:0};function Su(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xu,n),Cu.a.extend(e,t,n),g.a.setGet(e,t,["renderer","handleSize","placeFactor","needToRender","interactionState"]),function(e,t){t.classHierarchy.push("vtkWidgetRepresentation"),e.getPickedActor=function(e,n,r,a){return a.pick(e,n,r,t.renderer),a.getActors[0]},e.adjustBounds=function(e,n,r){6===e.length?(r[0]=(e[0]+e[1])/2,r[1]=(e[2]+e[3])/2,r[2]=(e[4]+e[5])/2,n[0]=r[0]+t.placeFactor*(e[0]-r[0]),n[1]=r[0]+t.placeFactor*(e[1]-r[0]),n[2]=r[1]+t.placeFactor*(e[2]-r[1]),n[3]=r[1]+t.placeFactor*(e[3]-r[1]),n[4]=r[2]+t.placeFactor*(e[4]-r[2]),n[5]=r[2]+t.placeFactor*(e[5]-r[2])):Iu("vtkWidgetRepresentation::adjustBounds Can't process bounds, not enough values...")},e.sizeHandlesInPixels=function(e,n){var r=t.renderer;if(!t.validPick||!r||!r.getActiveCamera())return t.handleSize*e*t.initialLength;var a=yi.computeWorldToDisplay(r,n[0],n[1],n[2]),i=a[2],o=a[0]-t.handleSize/2,s=a[1]-t.handleSize/2,u=yi.computeDisplayToWorld(r,o,s,i);o=a[0]+t.handleSize/2,s=a[1]+t.handleSize/2;for(var l=yi.computeDisplayToWorld(r,o,s,i),c=0,d=0;d<3;d++)c+=(l[d]-u[d])*(l[d]-u[d]);return e*(Math.sqrt(c)/2)},e.sizeHandlesRelativeToViewport=function(e,n){var r=t.renderer;if(!t.validPick||!r||!r.getActiveCamera())return t.handleSize*e*t.initialLength;var a=r.getViewport(),i=r.getRenderWindow().getViews()[0].getViewportSize(r),o=yi.computeWorldToDisplay(r,n[0],n[1],n[2])[2],s=i[0]*a[0],u=i[1]*a[1],l=yi.computeDisplayToWorld(r,s,u,o);s=i[0]*a[2],u=i[1]*a[3];for(var c=yi.computeDisplayToWorld(r,s,u,o),d=0,f=0;f<3;f++)d+=(c[f]-l[f])*(c[f]-l[f]);return e*(Math.sqrt(d)/2)}}(e,t)}var Nu={newInstance:g.a.newInstance(Su,"vtkWidgetRepresentation"),extend:Su},Eu=pu.InteractionState;var Ou={displayPosition:null,worldPosition:null,tolerance:15,activeRepresentation:0,constrained:0,pointPlacer:null};function Lu(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ou,n),Nu.extend(e,t,n),t.displayPosition=bu.newInstance(),t.displayPosition.setCoordinateSystemToDisplay(),t.worldPosition=bu.newInstance(),t.worldPosition.setCoordinateSystemToWorld(),t.pointPlacer=Tu.newInstance(),t.interactionState=Eu.OUTSIDE,g.a.setGet(e,t,["activeRepresentation","tolerance"]),function(e,t){t.classHierarchy.push("vtkHandleRepresentation"),e.setDisplayPosition=function(e){if(t.renderer&&t.pointPlacer){var n=[];t.pointPlacer.computeWorldPosition(t.renderer,e,n)&&(t.displayPosition.setValue(e),t.worldPosition.setValue(n))}else t.displayPosition.setValue(e)},e.getDisplayPosition=function(e){if(t.renderer){var n=t.worldPosition.getComputedDisplayValue(t.renderer);t.displayPosition.setValue(n[0],n[1],0)}e[0]=t.displayPosition.getValue()[0],e[1]=t.displayPosition.getValue()[1],e[2]=t.displayPosition.getValue()[2]},e.getDisplayPosition=function(){if(t.renderer){var e=t.worldPosition.getComputedDisplayValue(t.renderer);t.displayPosition.setValue(e[0],e[1],0)}return t.displayPosition.getValue()},e.setWorldPosition=function(e){t.worldPosition.setValue(e)},e.getWorldPosition=function(e){t.worldPosition.getValue(e)},e.getWorldPosition=function(){return t.worldPosition.getValue()}}(e,t)}var Pu=g.a.newInstance(Lu,"vtkHandleRepresentation"),ku=Object.assign({newInstance:Pu,extend:Lu},pu);function Ru(e,t){t.classHierarchy.push("vtkLabelRepresentation");var n=Object.assign({},e);e.buildRepresentation=function(){null!==t.labelText&&e.setLabelText(t.labelText),e.modified()},e.getActors=function(){return[t.actor]},e.getNestedProps=function(){return e.getActors()},e.computeInteractionState=function(e){if(t.canvas){var n=t.canvas.height,r=t.canvas.width,a=t.canvas?{left:Number(t.canvas.style.left.split("px")[0]),bottom:Number(t.canvas.style.bottom.split("px")[0])}:null;e[0]>=a.left&&e[0]<=a.left+r&&e[1]>=a.bottom&&e[1]<=a.bottom+n?t.interactionState=fu.SELECTING:t.interactionState=fu.OUTSIDE}return t.interactionState},e.startComplexWidgetInteraction=function(e){t.startEventPosition[0]=e[0],t.startEventPosition[1]=e[1],t.startEventPosition[2]=0,t.lastEventPosition[0]=e[0],t.lastEventPosition[1]=e[1]},e.complexWidgetInteraction=function(n){if(t.interactionState===fu.SELECTING){var r=t.point.getCenter(),a=yi.computeWorldToDisplay(t.renderer,r[0],r[1],r[2])[2],i=yi.computeDisplayToWorld(t.renderer,t.lastEventPosition[0],t.lastEventPosition[1],a),o=yi.computeDisplayToWorld(t.renderer,n[0],n[1],a);e.moveFocus(i,o),t.lastEventPosition[0]=n[0],t.lastEventPosition[1]=n[1],e.modified()}},e.setWorldPosition=function(r){t.point.setCenter(r),n.setWorldPosition(t.point.getCenter()),e.modified()},e.setDisplayPosition=function(r){n.setDisplayPosition(r),e.setWorldPosition(t.worldPosition.getValue())},e.moveFocus=function(n,r){var a=[];d.a.subtract(r,n,a);var i=t.point.getCenter();d.a.add(i,a,i),e.setWorldPosition(i)},e.getBounds=function(){var e=t.point.getCenter(),n=[];return n[0]=t.placeFactor*(e[0]-1),n[1]=t.placeFactor*(e[0]+1),n[2]=t.placeFactor*(e[1]-1),n[3]=t.placeFactor*(e[1]+1),n[4]=t.placeFactor*(e[2]-1),n[5]=t.placeFactor*(e[2]+1),n},e.setContainer=function(n){t.container&&t.container!==n&&t.container.removeChild(t.canvas),t.container!==n&&(t.container=n,t.container&&t.container.appendChild(t.canvas),e.modified())},e.setLabelStyle=function(n){t.labelStyle=Object.assign({},t.labelStyle,n),e.modified()},e.setSelectLabelStyle=function(n){t.selectLabelStyle=Object.assign({},t.selectLabelStyle,n),e.modified()},e.updateLabel=function(){if(t.context&&t.canvas&&(t.context.clearRect(0,0,t.canvas.width,t.canvas.height),t.actor.getVisibility())){var e=t.highlight?t.selectLabelStyle:t.labelStyle,n=t.labelText.split("\n "),r=e.fontSize*(1+e.lineSpace),a=e.fontSize/4,i=2*a+e.fontSize+(n.length-1)*r,o=0;n.forEach(function(e){var n=Math.round(t.context.measureText(e).width);n>o&&(o=n)}),t.canvas.height=Math.round(i),t.canvas.width=o+2*a,t.context.strokeStyle=e.strokeColor,t.context.lineWidth=e.strokeSize,t.context.fillStyle=e.fontColor,t.context.font="".concat(e.fontStyle," ").concat(e.fontSize,"px ").concat(e.fontFamily);var s=a,u=e.fontSize;n.forEach(function(e){t.context.strokeText(e,s,u),t.context.fillText(e,s,u),u+=r})}},e.highlight=function(n){t.highlight=n,e.modified()},e.getCanvasSize=function(){return t.canvas?{height:t.canvas.height,width:t.canvas.width}:null}}var ju={container:null,labelStyle:{fontColor:"white",fontStyle:"normal",fontSize:15,fontFamily:"Arial",strokeColor:"black",strokeSize:1,lineSpace:.2},labelText:"",selectLabelStyle:{fontColor:"rgb(0, 255, 0)",fontStyle:"normal",fontSize:15,fontFamily:"Arial",strokeColor:"black",strokeSize:1,lineSpace:.2}};function Bu(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ju,n),ku.extend(e,t,n),e.setPlaceFactor(1),t.canvas=document.createElement("canvas"),t.canvas.style.position="absolute",t.context=t.canvas.getContext("2d"),t.point=Wr.newInstance(),t.point.setNumberOfPoints(1),t.point.setRadius(0),t.mapper=du.newInstance(),t.mapper.setInputConnection(t.point.getOutputPort()),t.mapper.setCallback(function(n){t.canvas&&(t.canvas.style.left="".concat(Math.round(n[0][0]),"px"),t.canvas.style.bottom="".concat(Math.round(n[0][1]),"px"),e.modified())}),t.actor=su.a.newInstance(),t.actor.setMapper(t.mapper),t.actorVisibility=!0,t.highlight=!1,t.actor.onModified(function(){t.actorVisibility!==t.actor.getVisibility()&&(t.actorVisibility=t.actor.getVisibility(),e.modified())}),e.onModified(function(){e.updateLabel()}),g.a.setGet(e,t,["labelText"]),g.a.get(e,t,["container","labelText","labelStyle"]),Ru(e,t)}var zu={newInstance:g.a.newInstance(Bu,"vtkLabelRepresentation"),extend:Bu},_u={OUTSIDE:0,ONP1:1,ONP2:2,TRANSLATINGP1:3,TRANSLATINGP2:4,ONLINE:5,SCALING:6},Vu=_u,Fu={NONE:0,X:1,Y:2,Z:3},Uu=n(16);var Gu={renderer:null,selectionPoint:[0,0,0],pickPosition:[0,0,0],pickFromList:0,pickList:[]};function Wu(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Gu,n),g.a.obj(e,t),g.a.get(e,t,["renderer"]),g.a.getArray(e,t,["selectionPoint","pickPosition"]),g.a.setGet(e,t,["pickFromList","pickList"]),function(e,t){t.classHierarchy.push("vtkAbstractPicker"),e.initialize=function(){t.renderer=null,t.selectionPoint[0]=0,t.selectionPoint[1]=0,t.selectionPoint[2]=0,t.pickPosition[0]=0,t.pickPosition[1]=0,t.pickPosition[2]=0},e.initializePickList=function(){t.pickList=[]},e.addPickList=function(e){t.pickList.push(e)},e.deletePickList=function(e){var n=t.pickList.indexOf(e);-1!==n&&t.pickList.splice(n,1)}}(e,t)}var Qu={newInstance:g.a.newInstance(Wu,"vtkAbstractPicker"),extend:Wu},Yu=g.a.vtkErrorMacro,Hu=g.a.vtkWarningMacro;function Ku(e,t){t.classHierarchy.push("vtkPicker");var n=Object.assign({},e);e.intersectWithLine=function(e,t,n,r){if(!r)return Number.MAX_VALUE;var a=[];r.getCenter(a);for(var i=[],o=0;o<3;o++)i[o]=t[o]-e[o];var s=d.a.dot(i,i);return 0===s?2:(i[0]*(a[0]-e[0])+i[1]*(a[1]-e[1])+i[2]*(a[2]-e[2]))/s},e.pick=function(r,a){3!==r.length&&Hu("vtkPicker::pick: selectionPt needs three components");var i,o,s,u,l,c,f,p,g,m,h,v=r[0],y=r[1],M=r[2],A=[],b=[],w=[],D=[],T=[],C=[],I=0,x=[],S=!1,N=Ye.f.create(),E=Ye.f.create(),O=[0,0,0,0,0,0],L=[],P=[],k=a.getRenderWindow().getViews()[0];if(n.initialize(),t.actors=[],t.pickedPositions=[],t.mapperPosition[0]=0,t.mapperPosition[1]=0,t.mapperPosition[2]=0,t.mapper=null,t.dataSet=null,t.globalTMin=Number.MAX_VALUE,t.renderer=a,t.selectionPoint[0]=v,t.selectionPoint[1]=y,t.selectionPoint[2]=M,a){var R=a.getActiveCamera();i=R.getPosition(),o=R.getFocalPoint(),A=a.worldToNormalizedDisplay(o[0],o[1],o[2]),M=(A=k.normalizedDisplayToDisplay(A[0],A[1],A[2]))[2];var B=k.displayToNormalizedDisplay(v,y,M),z=k.getViewportSize(a),_=z[0]/z[1];s=a.normalizedDisplayToWorld(B[0],B[1],B[2],_);for(var V=0;V<3;V++)t.pickPosition[V]=s[V];for(var F=0;F<3;F++)b[F]=t.pickPosition[F]-i[F];for(var U=0;U<3;U++)w[U]=o[U]-i[U];d.a.normalize(w);var G=d.a.dot(w,b);if(0!==G){if(u=R.getClippingRange(),R.getParallelProjection()){l=u[0]-G,c=u[1]-G;for(var W=0;W<3;W++)D[W]=t.pickPosition[W]+l*w[W],T[W]=t.pickPosition[W]+c*w[W]}else{l=u[0]/G,c=u[1]/G;for(var Q=0;Q<3;Q++)D[Q]=i[Q]+l*b[Q],T[Q]=i[Q]+c*b[Q]}D[3]=1,T[3]=1,f=a.getViewport(),a.getRenderWindow()&&(C=a.getRenderWindow().getViews()[0].getSize()),p=C[0]*f[0],g=C[1]*f[1];var Y=k.displayToNormalizedDisplay(p,g,M);m=a.normalizedDisplayToWorld(Y[0],Y[1],Y[2],_),p=C[0]*f[2],g=C[1]*f[3];var H=k.displayToNormalizedDisplay(p,g,M);h=a.normalizedDisplayToWorld(H[0],H[1],H[2],_);for(var K=0;K<3;K++)I+=(h[K]-m[K])*(h[K]-m[K]);I=Math.sqrt(I)*t.tolerance,x=t.pickFromList?t.pickList:a.getActors();var X=[];x.forEach(function(n){var r=n.getMapper();if(S=n.getPickable()&&n.getVisibility(),n.getProperty().getOpacity()<=0&&(S=!1),S){t.transformMatrix=n.getMatrix().slice(0),Ye.c.transpose(t.transformMatrix,t.transformMatrix),Ye.c.invert(t.transformMatrix,t.transformMatrix);var a=[t.transformMatrix[0],t.transformMatrix[1],t.transformMatrix[2]],i=[t.transformMatrix[4],t.transformMatrix[5],t.transformMatrix[6]],o=[t.transformMatrix[8],t.transformMatrix[9],t.transformMatrix[10]];X[0]=d.a.norm(a),X[1]=d.a.norm(i),X[2]=d.a.norm(o),Ye.f.transformMat4(N,D,t.transformMatrix),Ye.f.transformMat4(E,T,t.transformMatrix),N[0]/=N[3],N[1]/=N[3],N[2]/=N[3],E[0]/=E[3],E[1]/=E[3],E[2]/=E[3];for(var s=0;s<3;s++)b[s]=E[s]-N[s];if(r&&(O=r.getBounds()),j.intersectBox(O,N,b,P,L)&&(L[0]=e.intersectWithLine(N,E,.333*I*(X[0]+X[1]+X[2]),r),L[0]2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xu,n),Qu.extend(e,t,n),g.a.setGet(e,t,["tolerance"]),g.a.setGetArray(e,t,["mapperPosition"],3),g.a.get(e,t,["mapper","dataSet","actors","pickedPositions"]),g.a.event(e,t,"pickChange"),Ku(e,t)}var Zu={newInstance:g.a.newInstance(qu,"vtkPicker"),extend:qu};function Ju(e,t,n,r){for(var a={planeId:-1,t1:0,t2:1,intersect:0},i=e.getNumberOfClippingPlanes(),o=[],s=0;s=a.t1&&(a.t1=c,a.planeId=s):c<=a.t2&&(a.t2=c),a.t1>a.t2)return a.intersect=0,a}}return a.intersect=1,a}var $u={clipLineWithPlane:Ju};function el(e,t){t.classHierarchy.push("vtkCellPicker");var n=Object.assign({},e);function r(){t.dataSet=null,t.mapper=null,t.cellId=-1,t.pCoords[0]=0,t.pCoords[1]=0,t.pCoords[2]=0,t.cellIJK[0]=0,t.cellIJK[1]=0,t.cellIJK[2]=0,t.mapperNormal[0]=0,t.mapperNormal[1]=0,t.mapperNormal[2]=1,t.pickNormal[0]=0,t.pickNormal[1]=0,t.pickNormal[2]=1}e.initialize=function(){r(),n.initialize()},e.computeSurfaceNormal=function(e,t,n,r){var a=e.getPointData().getNormals();if(!a)return 0;r[0]=0,r[1]=0,r[2]=0;for(var i=[],o=0;o<3;o++)a.getTuple(t.getPointsIds()[o],i),r[0]+=i[0]*n[o],r[1]+=i[1]*n[o],r[2]+=i[2]*n[o];return d.a.normalize(r),1},e.pick=function(r,a){e.initialize();var i=n.pick(r,a);if(i){var o=a.getActiveCamera(),s=[];if(o.getPosition(s),o.getParallelProjection()){var u=[];o.getFocalPoint(u),t.pickNormal[0]=s[0]-u[0],t.pickNormal[1]=s[1]-u[1],t.pickNormal[2]=s[2]-u[2]}else t.pickNormal[0]=s[0]-t.pickPosition[0],t.pickNormal[1]=s[1]-t.pickPosition[1],t.pickNormal[2]=s[2]-t.pickPosition[2];d.a.normalize(t.pickNormal)}return i},e.intersectWithLine=function(n,r,a,i){var o=Number.MAX_VALUE,s=Ju(i,t.transformMatrix,n,r);if(i&&!s.intersect)return Number.MAX_VALUE;if(i.isA("vtkImageMapper")){var u=i.intersectWithLineForCellPicking(n,r);u&&(o=u.t,t.cellIJK=u.ijk,t.pCoords=u.pCoords)}else i.isA("vtkMapper")&&(o=e.intersectActorWithLine(n,r,0,1,a,i));if(o=0){t.mapperPosition[0]=1*n[0]+0*r[0],t.mapperPosition[1]=1*n[1]+0*r[1],t.mapperPosition[2]=1*n[2]+0*r[2];var l=[];i.getClippingPlaneInDataCoords(t.transformMatrix,s.clippingPlaneId,l),d.a.normalize(l),t.mapperNormal[0]=-l[0],t.mapperNormal[1]=-l[1],t.mapperNormal[2]=-l[2]}Ye.e.transformMat4(t.pickPosition,t.mapperPosition,t.transformMatrix);var c=t.transformMatrix;t.mapperNormal[0]=c[0]*t.pickNormal[0]+c[4]*t.pickNormal[1]+c[8]*t.pickNormal[2],t.mapperNormal[1]=c[1]*t.pickNormal[0]+c[5]*t.pickNormal[1]+c[9]*t.pickNormal[2],t.mapperNormal[2]=c[2]*t.pickNormal[0]+c[6]*t.pickNormal[1]+c[10]*t.pickNormal[2]}return o},e.intersectActorWithLine=function(n,a,i,o,s,u){var l=Number.MAX_VALUE,c=[0,0,0],f=Number.MAX_VALUE,g=[0,0,0],m=-1,h=We.newInstance(),v=[],y=u.getInputData(),M=[0,0,0],A=[0,0,0];if(M[0]=n[0],M[1]=n[1],M[2]=n[2],A[0]=a[0],A[1]=a[1],A[2]=a[2],0!==i||1!==o)for(var b=0;b<3;b++)M[b]=n[b]*(1-i)+a[b]*i,A[b]=n[b]*(1-o)+a[b]*o;if(y.getPolys)for(var w=y.getPolys(),D=y.getPoints().getData(),T=w.getData(),C=0,I=[-1,-1,-1],x=We.newInstance(),S=p.a.newInstance(),N=0;N=i&&R.t<=o){var j=x.getParametricDistance(E);if(j=0&&lF&&(U=G,F=_[G]);-1!==U&&(t.pointId=h.getPointsIds()[U]),t.mapperPosition[0]=c[0],t.mapperPosition[1]=c[1],t.mapperPosition[2]=c[2],e.computeSurfaceNormal(y,h,_,t.mapperNormal)||(t.mapperNormal[0]=n[0]-a[0],t.mapperNormal[1]=n[1]-a[1],t.mapperNormal[2]=n[2]-a[2],d.a.normalize(t.mapperNormal))}return l}}var tl={cellId:-1,pCoords:[],cellIJK:[],pickNormal:[],mapperNormal:[]};function nl(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tl,n),Zu.extend(e,t,n),g.a.getArray(e,t,["pickNormal","mapperNormal","pCoords","cellIJK"]),g.a.get(e,t,["cellId"]),el(e,t)}var rl=g.a.newInstance(nl,"vtkCellPicker"),al=Object.assign({newInstance:rl,extend:nl},$u);var il={actor:null,mapper:null,sphere:null,cursorPicker:null,lastPickPosition:[0,0,0],lastEventPosition:[0,0],constraintAxis:-1,translationMode:1,property:null,selectProperty:null,placeFactor:1,waitingForMotion:0,hotSpotSize:.05};function ol(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,il,n),ku.extend(e,t,n),g.a.setGet(e,t,["translationMode","property","selectProperty"]),g.a.get(e,t,["actor"]),t.sphere=ta.newInstance(),t.sphere.setThetaResolution(16),t.sphere.setPhiResolution(8),t.mapper=uu.a.newInstance(),t.mapper.setInputConnection(t.sphere.getOutputPort()),t.actor=su.a.newInstance(),t.actor.setMapper(t.mapper),e.setHandleSize(15),t.currentHandleSize=t.handleSize,t.cursorPicker=al.newInstance(),t.cursorPicker.setPickFromList(1),t.cursorPicker.initializePickList(),t.cursorPicker.addPickList(t.actor),t.property=Uu.a.newInstance(),t.property.setColor(1,1,1),t.selectProperty=Uu.a.newInstance(),t.selectProperty.setColor(0,1,0),t.actor.setProperty(t.property),function(e,t){t.classHierarchy.push("vtkSphereHandleRepresentation");var n=Object.assign({},e);e.getActors=function(){return[t.actor]},e.getNestedProps=function(){return e.getActors()},e.placeWidget=function(){var n=[];if(Array.isArray(arguments.length<=0?void 0:arguments[0]))n=arguments.length<=0?void 0:arguments[0];else for(var r=0;r=0&&e<3)return e;if(!t.waitingForMotion){var r=t.cursorPicker.getPickPosition(),a=d.a.distance2BetweenPoints(r,t.startEventPosition),i=t.hotSpotSize*t.initialLength;return a>i*i?(t.waitingForMotion=0,t.cursorPicker.getCellId()):(t.waitingForMotion=1,t.waitCount=0,-1)}if(t.waitingForMotion&&n){t.waitingForMotion=0;var o=[];return o[0]=Math.abs(n[0]-t.startEventPosition[0]),o[1]=Math.abs(n[1]-t.startEventPosition[1]),o[2]=Math.abs(n[2]-t.startEventPosition[2]),o[0]>o[1]?o[0]>o[2]?0:2:o[1]>o[2]?1:2}return-1},e.startComplexWidgetInteraction=function(n){t.startEventPosition[0]=n[0],t.startEventPosition[1]=n[1],t.startEventPosition[2]=0,t.lastEventPosition[0]=n[0],t.lastEventPosition[1]=n[1];var r=[n[0],n[1],0];t.cursorPicker.pick(r,t.renderer),t.cursorPicker.getDataSet()?(t.interactionState=fu.SELECTING,t.constraintAxis=e.determineConstraintAxis(-1,null),t.lastPickPosition=t.cursorPicker.getPickPosition()):(t.interactionState=fu.OUTSIDE,t.constraintAxis=-1)},e.displayToWorld=function(e,n){return yi.computeDisplayToWorld(t.renderer,e[0],e[1],n)},e.complexWidgetInteraction=function(n){var r=yi.computeWorldToDisplay(t.renderer,t.lastPickPosition[0],t.lastPickPosition[1],t.lastPickPosition[2])[2],a=e.displayToWorld(t.lastEventPosition,r),i=e.displayToWorld(n,r);t.interactionState===fu.SELECTING||t.interactionState===fu.TRANSLATING?(!t.waitingForMotion||t.waitCount++>3)&&(t.constraintAxis=e.determineConstraintAxis(t.constraintAxis,i),t.interactionState!==fu.SELECTING||t.translationMode?e.translate(a,i):e.moveFocus(a,i)):t.interactionState===fu.SCALING&&e.scale(a,i,n),t.lastEventPosition[0]=n[0],t.lastEventPosition[1]=n[1],e.modified()},e.moveFocus=function(n,r){var a=[];a[0]=r[0]-n[0],a[1]=r[1]-n[1],a[2]=r[2]-n[2];var i=t.sphere.getCenter();t.constraintAxis>=0?i[t.constraintAxis]+=a[t.constraintAxis]:(i[0]+=a[0],i[1]+=a[1],i[2]+=a[2]),e.setWorldPosition(i)},e.translate=function(n,r){var a=[];a[0]=r[0]-n[0],a[1]=r[1]-n[1],a[2]=r[2]-n[2];var i=t.sphere.getCenter();if(t.constraintAxis>=0)for(var o=0;o<3;o++)o!==t.constraintAxis&&(a[o]=0);for(var s=[],u=0;u<3;u++)s[u]=i[u]+a[u];e.setWorldPosition(s);var l=e.sizeHandlesInPixels(1,s);l*=t.currentHandleSize/t.handleSize,t.sphere.setRadius(l)},e.sizeBounds=function(){var n=t.sphere.getCenter(),r=e.sizeHandlesInPixels(1,n);r*=t.currentHandleSize/t.handleSize,t.sphere.setRadius(r)},e.scale=function(n,r,a){var i=[];i[0]=r[0]-n[0],i[1]=r[1]-n[1],i[2]=r[2]-n[2];var o=e.getBounds(),s=d.a.norm(i)/Math.sqrt((o[1]-o[0])*(o[1]-o[0])+(o[3]-o[2])*(o[3]-o[2])+(o[5]-o[4])*(o[5]-o[4]));a[1]>t.lastEventPosition[1]?s+=1:s=1-s,t.currentHandleSize*=s,t.currentHandleSize=t.currentHandleSize<.001?.001:t.currentHandleSize,e.sizeBounds()},e.highlight=function(n){n?e.applyProperty(t.selectProperty):e.applyProperty(t.property)},e.buildRepresentation=function(){t.renderer&&(t.placed||(t.validPick=1,t.placed=1),e.sizeBounds(),t.sphere.update(),e.modified())},e.applyProperty=function(e){t.actor.setProperty(e)}}(e,t)}var sl={newInstance:g.a.newInstance(ol,"vtkSphereHandleRepresentation"),extend:ol};function ul(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,dl,n),Nu.extend(e,t,n),g.a.get(e,t,["point1Representation","point2Representation","endPointProperty","selectedEndPointProperty","endPoint2Property","selectedEndPoint2Property","lineProperty","selectedLineProperty"]),e.setHandleSize(5),t.boundingBox=j.newInstance(),t.point1Representation=sl.newInstance(),t.point2Representation=sl.newInstance();t.point1Representation.setHandleSize(10),t.point2Representation.setHandleSize(10),t.lineSource=Br.newInstance({point1:[-.5,0,0],point2:[.5,0,0],resolution:5}),t.lineSource.setResolution(5),t.lineMapper=uu.a.newInstance(),t.lineMapper.setInputConnection(t.lineSource.getOutputPort()),t.lineActor=su.a.newInstance(),t.lineActor.setMapper(t.lineMapper),t.endPointProperty=Uu.a.newInstance(),t.endPointProperty.setColor(1,1,1),t.selectedEndPointProperty=Uu.a.newInstance(),t.selectedEndPointProperty.setColor(0,1,0),t.endPoint2Property=Uu.a.newInstance(),t.endPoint2Property.setColor(1,1,1),t.selectedEndPoint2Property=Uu.a.newInstance(),t.selectedEndPoint2Property.setColor(0,1,0),t.lineProperty=Uu.a.newInstance(),t.lineProperty.setAmbient(1),t.lineProperty.setAmbientColor(1,1,1),t.lineProperty.setLineWidth(2),t.selectedLineProperty=Uu.a.newInstance(),t.selectedLineProperty.setAmbient(1),t.selectedLineProperty.setColor(0,1,0),t.selectedLineProperty.setLineWidth(2),t.point1Representation.applyProperty(t.endPointProperty),t.point2Representation.applyProperty(t.endPoint2Property),t.point1Representation.setWorldPosition(t.lineSource.getPoint1()),t.point2Representation.setWorldPosition(t.lineSource.getPoint2()),t.lineActor.setProperty(t.lineProperty),function(e,t){t.classHierarchy.push("vtkLineRepresentation");var n=Object.assign({},e);e.setResolution=function(e){t.lineSource.setResolution(e)},e.setLineVisibility=function(e){t.lineActor.setVisibility(e)},e.setPoint1Visibility=function(e){t.point1Representation.getActors()[0].setVisibility(e)},e.setPoint2Visibility=function(e){t.point2Representation.getActors()[0].setVisibility(e)},e.getResolution=function(){return t.lineSource.getResolution()},e.getPoint1WorldPosition=function(){return t.point1Representation.getWorldPosition()},e.getPoint2WorldPosition=function(){return t.point2Representation.getWorldPosition()},e.getPoint1DisplayPosition=function(){return t.point1Representation.getDisplayPosition()},e.getPoint2DisplayPosition=function(){return t.point2Representation.getDisplayPosition()},e.setPoint1WorldPosition=function(e){var n;t.point1Representation.setWorldPosition(e),(n=t.lineSource).setPoint1.apply(n,ul(e))},e.setPoint2WorldPosition=function(e){var n;t.point2Representation.setWorldPosition(e),(n=t.lineSource).setPoint2.apply(n,ul(e))},e.setPoint1DisplayPosition=function(e){t.point1Representation.setDisplayPosition(e);var n=t.point1Representation.getWorldPosition();t.point1Representation.setWorldPosition(n)},e.setPoint2DisplayPosition=function(e){t.point2Representation.setDisplayPosition(e);var n=t.point2Representation.getWorldPosition();t.point2Representation.setWorldPosition(n)},e.setRenderer=function(e){t.point1Representation.setRenderer(e),t.point2Representation.setRenderer(e),n.setRenderer(e)},e.startComplexWidgetInteraction=function(e){if(t.startEventPosition[0]=e[0],t.startEventPosition[1]=e[1],t.startEventPosition[2]=0,t.lastEventPosition[0]=e[0],t.lastEventPosition[1]=e[1],t.lastEventPosition[2]=0,t.startP1=t.point1Representation.getWorldPosition(),t.startP2=t.point2Representation.getWorldPosition(),t.interactionState===ll.SCALING){var n=t.point1Representation.getDisplayPosition(),r=t.point2Representation.getDisplayPosition();t.length=Math.sqrt((n[0]-r[0])*(n[0]-r[0])+(n[1]-r[1])*(n[1]-r[1]))}},e.complexWidgetInteraction=function(n){if(t.interactionState===ll.ONP1){if(0!==t.restrictFlag){for(var r=t.point1Representation.getWorldPosition(),a=0;a<3;a++)r[a]=t.restrictFlag===a+1?r[a]:t.startP1[a];t.point1Representation.setWorldPosition(r)}}else if(t.interactionState===ll.ONP2){if(0!==t.restrictFlag){for(var i=t.point2Representation.getWorldPosition(),o=0;o<3;o++)i[o]=t.restrictFlag===o+1?i[o]:t.startP2[o];t.point2Representation.setWorldPosition(i)}}else if(t.interactionState===ll.ONLINE);else if(t.interactionState===ll.SCALING);else if(t.interactionState===ll.TRANSLATINGP1){for(var s=t.point1Representation.getWorldPosition(),u=[],l=0;l<3;l++)u[l]=t.startP2[l]+(s[l]-t.startP1[l]);t.point1Representation.setWorldPosition(u)}else if(t.interactionState===ll.TRANSLATINGP2){for(var c=t.point2Representation.getWorldPosition(),d=[],f=0;f<3;f++)d[f]=t.startP1[f]+(c[f]-t.startP2[f]);t.point2Representation.setWorldPosition(d)}t.lastEventPosition[0]=n[0],t.lastEventPosition[1]=n[1],t.lastEventPosition[2]=0,e.modified()},e.placeWidget=function(){var n=[];if(Array.isArray(arguments.length<=0?void 0:arguments[0]))n=arguments.length<=0?void 0:arguments[0];else for(var r=0;r0?(t.interactionState=ll.ONLINE,e.setRepresentationState(ll.ONLINE),i=e.getPoint1WorldPosition(),o=e.getPoint2WorldPosition()):(t.interactionState=ll.OUTSIDE,e.setRepresentationState(ll.OUTSIDE)),t.interactionState},e.setRepresentationState=function(n){t.representationState!==n&&(t.representationState=n,e.modified(),n===ll.OUTSIDE?(e.highlightPoint(0,0),e.highlightPoint(1,0),e.highlightLine(0)):n===ll.ONP1?(e.highlightPoint(0,1),e.highlightPoint(1,0),e.highlightLine(0)):n===ll.ONP2?(e.highlightPoint(0,0),e.highlightPoint(1,1),e.highlightLine(0)):n===ll.ONLINE?(e.highlightPoint(0,0),e.highlightPoint(1,0),e.highlightLine(1)):(e.highlightPoint(0,1),e.highlightPoint(1,1),e.highlightLine(1)))},e.sizeHandles=function(){},e.buildRepresentation=function(){var n,r;t.point1Representation.buildRepresentation(),t.point2Representation.buildRepresentation(),0===t.initializeDisplayPosition&&t.renderer&&(e.setPoint1WorldPosition(t.lineSource.getPoint1()),e.setPoint2WorldPosition(t.lineSource.getPoint2()),t.validPick=1,t.initializeDisplayPosition=1),t.point1Representation.setTolerance(t.tolerance),t.point2Representation.setTolerance(t.tolerance);var a=e.getPoint1WorldPosition();(n=t.lineSource).setPoint1.apply(n,ul(a)),t.point1Representation.setWorldPosition(a);var i=e.getPoint2WorldPosition();(r=t.lineSource).setPoint2.apply(r,ul(i)),t.point2Representation.setWorldPosition(i),e.sizeHandles(),e.modified()},e.highlightPoint=function(e,n){0===e?n?t.point1Representation.applyProperty(t.selectedEndPointProperty):t.point1Representation.applyProperty(t.endPointProperty):1===e&&(n?t.point2Representation.applyProperty(t.selectedEndPoint2Property):t.point2Representation.applyProperty(t.endPoint2Property))},e.highlightLine=function(e){e?t.lineActor.setProperty(t.selectedLineProperty):t.lineActor.setProperty(t.lineProperty)},e.setLineColor=function(){var e=[];if(Array.isArray(arguments.length<=0?void 0:arguments[0]))e=arguments.length<=0?void 0:arguments[0];else for(var n=0;nt.initialBounds[2*n+1]&&(e[n]=t.initialBounds[2*n+1])},e.getBounds=function(){return t.boundingBox.setBounds(t.lineActor.getBounds()),t.boundingBox.addBounds(t.point1Representation.getBounds()),t.boundingBox.addBounds(t.point2Representation.getBounds()),t.boundingBox.getBounds()},e.getActors=function(){var e=[];return e.push.apply(e,ul(t.point1Representation.getActors())),e.push.apply(e,ul(t.point2Representation.getActors())),e.push(t.lineActor),e},e.getNestedProps=function(){return e.getActors()}}(e,t)}var pl={newInstance:g.a.newInstance(fl,"vtkLineRepresentation"),extend:fl};function gl(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ml,n),pl.extend(e,t,n),t.labelRepresentation=zu.newInstance(),g.a.setGet(e,t,["numberOfDecimals","labelPosition"]),g.a.get(e,t,["labelRepresentation"]),function(e,t){t.classHierarchy.push("vtkDistanceRepresentation");var n=Object.assign({},e);e.setRenderer=function(r){t.labelRepresentation.setRenderer(r),n.setRenderer(r),e.modified()},e.getContainer=function(){return t.labelRepresentation.getContainer()},e.setContainer=function(n){t.labelRepresentation.setContainer(n),e.modified()},e.getLabelStyle=function(){return t.labelRepresentation.getLabelStyle()},e.setLabelStyle=function(n){t.labelRepresentation.setLabelStyle(n),e.modified()},e.getActors=function(){var e=n.getActors();return e=gl(e).concat(gl(t.labelRepresentation.getActors()))},e.getDistance=function(){return Math.sqrt(d.a.distance2BetweenPoints(e.getPoint1WorldPosition(),e.getPoint2WorldPosition())).toFixed(t.numberOfDecimals)},e.setPoint1WorldPosition=function(t){n.setPoint1WorldPosition(t),e.updateLabelRepresentation(),e.modified()},e.setPoint2WorldPosition=function(t){n.setPoint2WorldPosition(t),e.updateLabelRepresentation(),e.modified()},e.updateLabelRepresentation=function(){t.labelRepresentation.setLabelText(e.getDistance());for(var n=t.point1Representation.getWorldPosition(),r=t.point2Representation.getWorldPosition(),a=[],i=0;i<3;i++)a[i]=n[i]+(r[i]-n[i])*t.labelPositionInLine;t.labelRepresentation.setWorldPosition(a)}}(e,t)}var vl={newInstance:g.a.newInstance(hl,"vtkDistanceRepresentation"),extend:hl},yl={WidgetState:{START:0,ACTIVE:1}},Ml=g.a.VOID,Al=g.a.EVENT_ABORT,bl=ku.InteractionState,wl=yl.WidgetState;var Dl={allowHandleResize:1,widgetState:wl.START};function Tl(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Dl,n),ou.extend(e,t,n),g.a.setGet(e,t,["allowHandleResize"]),function(e,t){function n(e){switch(e){case bl.OUTSIDE:t.interactor.getView().setCursor("default");break;default:t.interactor.getView().setCursor("pointer")}}function r(){n(t.widgetRep.getInteractionState()),t.widgetRep.highlight(1),e.invokeStartInteractionEvent(),e.render()}t.classHierarchy.push("vtkHandleWidget"),e.createDefaultRepresentation=function(){t.widgetRep||(t.widgetRep=sl.newInstance())},e.handleMouseMove=function(t){return e.moveAction(t)},e.handleLeftButtonPress=function(t){return e.selectAction(t)},e.handleLeftButtonRelease=function(t){return e.endSelectAction(t)},e.handleMiddleButtonPress=function(t){return e.translateAction(t)},e.handleMiddleButtonRelease=function(t){return e.endSelectAction(t)},e.handleRightButtonPress=function(t){return e.scaleAction(t)},e.handleRightButtonRelease=function(t){return e.endSelectAction(t)},e.selectAction=function(e){var n=[e.position.x,e.position.y];return t.widgetRep.computeInteractionState(n),t.widgetRep.getInteractionState()===bl.OUTSIDE?Ml:(t.widgetRep.startComplexWidgetInteraction(n),t.widgetState=wl.ACTIVE,t.widgetRep.setInteractionState(bl.SELECTING),r(),Al)},e.translateAction=function(e){var n=[e.position.x,e.position.y];return t.widgetRep.computeInteractionState(n),t.widgetRep.getInteractionState()===bl.OUTSIDE?Ml:(t.widgetRep.startComplexWidgetInteraction(n),t.widgetState=wl.ACTIVE,t.widgetRep.setInteractionState(bl.TRANSLATING),r(),Al)},e.scaleAction=function(e){if(!t.allowHandleResize)return Ml;var n=[e.position.x,e.position.y];return t.widgetRep.computeInteractionState(n),t.widgetRep.getInteractionState()===bl.OUTSIDE?Ml:(t.widgetRep.startComplexWidgetInteraction(n),t.widgetState=wl.ACTIVE,t.widgetRep.setInteractionState(bl.SCALING),r(),Al)},e.endSelectAction=function(){return t.widgetState!==wl.ACTIVE?Ml:(t.widgetState=wl.START,t.widgetRep.highlight(0),e.invokeEndInteractionEvent(),e.render(),Al)},e.moveAction=function(r){var a=[r.position.x,r.position.y],i=t.widgetRep.getInteractionState();return t.widgetState===wl.START?(t.widgetRep.computeInteractionState(a),n(i=t.widgetRep.getInteractionState()),t.widgetRep.getActiveRepresentation()&&i!==t.widgetRep.getInteractionState()&&e.render(),i===bl.OUTSIDE?Ml:Al):(n(i),t.widgetRep.complexWidgetInteraction(a),e.invokeInteractionEvent(),e.render(),Al)}}(e,t)}var Cl=g.a.newInstance(Tl,"vtkHandleWidget"),Il=Object.assign({newInstance:Cl,extend:Tl},yl),xl=g.a.VOID;var Sl={};function Nl(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sl,n),Il.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkLabelWidget");var n=Object.assign({},e);e.createDefaultRepresentation=function(){t.widgetRep||(t.widgetRep=zu.newInstance())},e.setEnabled=function(e){if(!e&&t.widgetRep&&t.widgetRep.setContainer(null),n.setEnabled(e),e){var r=t.interactor?t.interactor.getContainer():null;t.widgetRep.setContainer(r)}},e.scaleAction=function(e){return xl}}(e,t)}var El={newInstance:g.a.newInstance(Nl,"vtkLabelWidget"),extend:Nl},Ol={START:0,DEFINE:1,MANIPULATE:2,ACTIVE:3},Ll=pu.InteractionState;function Pl(e,t){t.classHierarchy.push("vtkLineWidget");var n=Object.assign({},e);e.setCurrentHandle=function(e){t.currentHandle=e},e.setInteractor=function(r){n.setInteractor(r),t.point1Widget.setInteractor(t.interactor),t.point2Widget.setInteractor(t.interactor),e.modified()},e.setEnabled=function(e){n.setEnabled(e),t.widgetRep&&(t.point1Widget.setWidgetRep(t.widgetRep.getPoint1Representation()),t.point2Widget.setWidgetRep(t.widgetRep.getPoint2Representation()),t.widgetState===Ol.START?(t.point1Widget.setEnabled(0),t.point2Widget.setEnabled(0),t.widgetRep.setLineVisibility(0),t.widgetRep.setPoint1Visibility(1),t.widgetRep.setPoint2Visibility(0)):(t.point1Widget.setEnabled(e),t.point2Widget.setEnabled(e),t.widgetRep.setLineVisibility(1),t.widgetRep.setPoint1Visibility(1),t.widgetRep.setPoint2Visibility(1)))},e.setWidgetStateToStart=function(){t.widgetState=Ol.START,e.setCurrentHandle(0),e.setEnabled(t.enabled)},e.setWidgetStateToManipulate=function(){t.widgetState=Ol.MANIPULATE,e.setCurrentHandle(-1),e.setEnabled(t.enabled)},e.handleMouseMove=function(t){return e.moveAction(t)},e.handleLeftButtonPress=function(t){return e.selectAction(t)},e.handleLeftButtonRelease=function(t){return e.endSelectAction(t)},e.handleMiddleButtonPress=function(t){return e.translateAction(t)},e.handleMiddleButtonRelease=function(t){return e.endSelectAction(t)},e.handleRightButtonPress=function(t){return e.scaleAction(t)},e.handleRightButtonRelease=function(t){return e.endSelectAction(t)},e.selectAction=function(n){var r=[n.position.x,n.position.y];if(t.widgetState===Ol.START){var a=t.point1Widget.getWidgetRep().displayToWorld(r,0);t.currentHandle<1?(t.widgetRep.setLineVisibility(1),t.widgetRep.setPoint1WorldPosition(a),a[0]+=1e-9,t.widgetRep.setPoint2WorldPosition(a),e.setCurrentHandle(t.currentHandle+1)):(t.widgetRep.setPoint2Visibility(1),t.widgetRep.setPoint2WorldPosition(a),t.widgetState=Ol.MANIPULATE,e.setCurrentHandle(-1))}else{if(t.widgetRep.computeInteractionState(r)===Ll.OUTSIDE)return;t.widgetState=Ol.ACTIVE,e.invokeStartInteractionEvent()}t.widgetRep.startComplexWidgetInteraction(r),e.render()},e.translateAction=function(n){var r=[n.position.x,n.position.y];t.widgetRep.computeInteractionState(r)!==Ll.OUTSIDE&&(t.widgetState=Ol.ACTIVE,t.widgetRep.startComplexWidgetInteraction(r),e.invokeStartInteractionEvent())},e.scaleAction=function(n){var r=[n.position.x,n.position.y];t.widgetRep.computeInteractionState(r)!==Ll.OUTSIDE&&(t.widgetState=Ol.ACTIVE,t.widgetRep.startComplexWidgetInteraction(r),e.invokeStartInteractionEvent())},e.moveAction=function(n){var r=[n.position.x,n.position.y],a=!1;if(t.widgetState===Ol.MANIPULATE){var i=t.widgetRep.computeInteractionState(r);!function(e){switch(e){case _u.OUTSIDE:t.interactor.getView().setCursor("default");break;default:t.interactor.getView().setCursor("pointer")}}(i);var o=i===_u.ONP1,s=i===_u.ONP2;o!==t.point1Widget.getEnabled()&&(t.point1Widget.setEnabled(o),a=!0),s!==t.point2Widget.getEnabled()&&(t.point2Widget.setEnabled(s),a=!0)}else if(t.widgetState===Ol.START){t.widgetRep.complexWidgetInteraction(r);var u=t.point1Widget.getWidgetRep().displayToWorld(r,0);0===t.currentHandle?t.widgetRep.setPoint1WorldPosition(u):t.widgetRep.setPoint2WorldPosition(u),a=!0}else t.widgetState===Ol.ACTIVE&&(t.widgetRep.setPoint1WorldPosition(t.point1Widget.getWidgetRep().getWorldPosition()),t.widgetRep.setPoint2WorldPosition(t.point2Widget.getWidgetRep().getWorldPosition()),a=!0);a&&(e.invokeInteractionEvent(),e.render())},e.endSelectAction=function(n){if(t.widgetState!==Ol.START){var r=[n.position.x,n.position.y];t.widgetRep.complexWidgetInteraction(r),t.widgetRep.setPoint1WorldPosition(t.point1Widget.getWidgetRep().getWorldPosition()),t.widgetRep.setPoint2WorldPosition(t.point2Widget.getWidgetRep().getWorldPosition()),t.widgetState=Ol.MANIPULATE,e.invokeEndInteractionEvent(),e.render()}},e.createDefaultRepresentation=function(){t.widgetRep||(t.widgetRep=pl.newInstance())}}var kl={widgetState:Ol.START,managesCursor:1,currentHandle:0,point1Widget:null,point2Widget:null};function Rl(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kl,n),ou.extend(e,t,n),t.point1Widget=Il.newInstance(),t.point1Widget.setParent(e),t.point1Widget.createDefaultRepresentation(),t.point2Widget=Il.newInstance(),t.point2Widget.setParent(e),t.point2Widget.createDefaultRepresentation(),Pl(e,t)}var jl={newInstance:g.a.newInstance(Rl,"vtkLineWidget"),extend:Rl};var Bl={};function zl(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Bl,n),jl.extend(e,t,n),t.labelWidget=El.newInstance(),t.labelWidget.setProcessEvents(!1),function(e,t){t.classHierarchy.push("vtkDistanceWidget");var n=Object.assign({},e);e.setInteractor=function(r){n.setInteractor(r),t.labelWidget.setInteractor(t.interactor),e.modified()},e.setEnabled=function(r){n.setEnabled(r),t.labelWidget.setEnabled(e.computeLabelWidgetVisibility())},e.createDefaultRepresentation=function(){t.widgetRep||e.setWidgetRep(vl.newInstance())},e.setWidgetRep=function(e){n.setWidgetRep(e),t.widgetRep&&t.labelWidget.setWidgetRep(t.widgetRep.getLabelRepresentation())},e.computeLabelWidgetVisibility=function(){return 0!==t.currentHandle&&t.enabled},e.setCurrentHandle=function(r){n.setCurrentHandle(r),t.labelWidget.setEnabled(e.computeLabelWidgetVisibility())}}(e,t)}var _l={newInstance:g.a.newInstance(zl,"vtkDistanceWidget"),extend:zl},Vl=26,Fl={IDLE:0,CROPPING:1},Ul=["CroppingPlanesChanged"];function Gl(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Yl,n),Nu.extend(e,t,n),g.a.setGet(e,t,["activeHandleIndex"]),g.a.setGetArray(e,t,["edgeColor"],3),g.a.setGetArray(e,t,["handlePositions"],Wl),g.a.setGetArray(e,t,["handleSizes"],Wl),g.a.setGetArray(e,t,["bboxCorners"],8),function(e,t){t.classHierarchy.push("vtkImageCroppingRegionsRepresentation"),t.placeFactor=1,t.picker=al.newInstance(),t.picker.setPickFromList(1),t.picker.initializePickList(),t.handles=Array(Wl).fill(null).map(function(){var e=ta.newInstance(),n=uu.a.newInstance(),r=su.a.newInstance();return n.setInputConnection(e.getOutputPort()),r.setMapper(n),t.picker.addPickList(r),{source:e,mapper:n,actor:r}}),t.outline={polydata:Ie.a.newInstance(),mapper:uu.a.newInstance(),actor:su.a.newInstance()},t.outline.polydata.getPoints().setData(new Float32Array(24),3),t.outline.polydata.getLines().setData(Uint16Array.from(Ql)),t.outline.mapper.setInputData(t.outline.polydata),t.outline.actor.setMapper(t.outline.mapper),e.getActors=function(){for(var e=[t.outline.actor],n=0;n1){var u=t.picker.getPickedPositions().map(function(t){var n=e.pokedRenderer.getActiveCamera().getPosition();return d.a.distance2BetweenPoints(n,t)}),l=1/0;u.forEach(function(e,t){l>e&&(s=t,l=e)})}var c=o[s];return t.handles.findIndex(function(e){return e.actor===c})}return-1},e.placeWidget=function(){for(var n=[],r=0;re[t+1]){var n=e[t+1];e[t+1]=e[t],e[t]=n}}(n);var a=[];e.adjustBounds(n,a,[]);for(var i=0;i<6;i++)t.initialBounds[i]=a[i];t.initialLength=Math.sqrt((a[1]-a[0])*(a[1]-a[0])+(a[3]-a[2])*(a[3]-a[2])+(a[5]-a[4])*(a[5]-a[4])),e.modified()}},e.updateGeometry=function(){for(var e,n=t.outline.polydata.getPoints().getData(),r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rc,n),ou.extend(e,t,rc,n),tc.forEach(function(n){return g.a.event(e,t,n)}),g.a.get(e,t,["volumeMapper","handleSize","faceHandlesEnabled","edgeHandlesEnabled","cornerHandlesEnabled"]),function(e,t){t.classHierarchy.push("vtkImageCroppingRegionsWidget");var n=null;t.indexToWorld=Ye.c.create(),t.worldToIndex=Ye.c.create();var r=null;function a(e){var n=Ye.e.fromValues(e[0],e[1],e[2]),r=Ye.e.create();return Ye.e.transformMat4(r,n,t.worldToIndex),[r[0],r[1],r[2]]}function i(e){var n=Ye.e.fromValues(e[0],e[1],e[2]),r=Ye.e.create();return Ye.e.transformMat4(r,n,t.indexToWorld),[r[0],r[1],r[2]]}t.widgetState={activeHandleIndex:-1,planes:Array(6).fill(0),controlState:ec.IDLE},e.createDefaultRepresentation=function(){t.widgetRep||(t.widgetRep=Kl.newInstance(),e.updateRepresentation())},e.getWidgetState=function(){return Object.assign({},t.widgetState)},e.updateWidgetState=function(n){if(Object.keys(n).reduce(function(e,r){return e||t.widgetState[r]!==n[r]},!1)){var a=t.widgetState;t.widgetState=Object.assign({},a,n),function(e,t){if(e.length===t.length){for(var n=0;n>2&1)],e[2+(d>>1&1)],e[4+(d>>0&1)]];for(var f=0;f-1)return t.activeHandleIndex=r,e.updateWidgetState({activeHandleIndex:r,controlState:ec.CROPPING}),Jl}return Zl},e.moveAction=function(n){var r=t.widgetState,i=r.controlState,o=r.planes,s=r.activeHandleIndex;if(i===ec.IDLE||-1===s)return Zl;var u=e.planesToHandles(o),l=[n.position.x,n.position.y],c=u[s],f=e.getInteractor().getCurrentRenderer().getActiveCamera().getDirectionOfProjection(),p=e.displayToPlane(l,c,f);if(!p)return Jl;var g=o.slice();if(s<6){var m=Math.floor(s/2),h=3*m,v=t.volumeMapper.getInputData().getDirection().slice(h,h+3),y=[0,0,0],M=[0,0,0],A=[0,0,0];d.a.subtract(p,c,M),d.a.projectVector(M,v,A),d.a.add(c,A,y);var b=a(y);g[s]=b[m]}else if(s<18){var w=s-6,D=Math.floor(w/4),T=3*D,C=t.volumeMapper.getInputData().getDirection().slice(T,T+3),I=[0,0,0],x=[0,0,0],S=[0,0,0];d.a.subtract(p,c,x),Te.a.projectVector(x,C,S),d.a.add(c,S,I);for(var N=a(I),E=nc[w%4].slice(),O=[],L=0;L<3;++L)L!==D&&O.push(2*L+E.shift());O.forEach(function(e){g[e]=N[Math.floor(e/2)]})}else{var P=s-18,k=a(p);[0+(P>>2&1),2+(P>>1&1),4+(P>>0&1)].forEach(function(e){g[e]=k[Math.floor(e/2)]})}return e.setCroppingPlanes.apply(e,Xl(g)),Jl},e.endMoveAction=function(){t.widgetState.activeHandleIndex>-1&&e.updateWidgetState({activeHandleIndex:-1,controlState:ec.IDLE})}}(e,t)}var ic={newInstance:g.a.newInstance(ac,"vtkImageCroppingRegionsWidget"),extend:ac},oc=g.a.vtkDebugMacro;var sc={position:[0,0,1],focalPoint:[0,0,0],viewUp:[0,1,0],directionOfProjection:[0,0,-1],parallelProjection:!1,useHorizontalViewAngle:!1,viewAngle:30,parallelScale:1,clippingRange:[.01,1000.01],thickness:1e3,windowCenter:[0,0],viewPlaneNormal:[0,0,1],useOffAxisProjection:!1,screenBottomLeft:[-.5,-.5,-.5],screenBottomRight:[.5,-.5,-.5],screenTopRight:[.5,.5,-.5],freezeFocalPoint:!1,useScissor:!1,projectionMatrix:null,viewMatrix:null,physicalTranslation:[0,0,0],physicalScale:1,physicalViewUp:[0,1,0],physicalViewNorth:[0,0,-1]};function uc(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sc,n),g.a.obj(e,t),g.a.get(e,t,["distance","thickness"]),g.a.setGet(e,t,["parallelProjection","useHorizontalViewAngle","viewAngle","parallelScale","useOffAxisProjection","freezeFocalPoint","useScissor","physicalScale"]),g.a.getArray(e,t,["directionOfProjection","viewPlaneNormal","position","focalPoint"]),g.a.setGetArray(e,t,["clippingRange","windowCenter"],2),g.a.setGetArray(e,t,["viewUp","screenBottomLeft","screenBottomRight","screenTopRight","physicalTranslation","physicalViewUp","physicalViewNorth"],3),function(e,t){t.classHierarchy.push("vtkCamera");var n=Ye.e.create(),r=Ye.e.fromValues(0,0,-1),a=Ye.e.fromValues(0,1,0),i=Ye.c.create(),o=Ye.e.create(),s=Ye.e.create(),u=Ye.e.create(),l=Ye.c.create(),c=Ye.c.create(),f=Ye.e.create(),p=Ye.e.create();e.orthogonalizeViewUp=function(){var n=e.getViewMatrix();t.viewUp[0]=n[4],t.viewUp[1]=n[5],t.viewUp[2]=n[6],e.modified()},e.setPosition=function(n,r,a){n===t.position[0]&&r===t.position[1]&&a===t.position[2]||(t.position[0]=n,t.position[1]=r,t.position[2]=a,e.computeDistance(),e.modified())},e.setFocalPoint=function(n,r,a){n===t.focalPoint[0]&&r===t.focalPoint[1]&&a===t.focalPoint[2]||(t.focalPoint[0]=n,t.focalPoint[1]=r,t.focalPoint[2]=a,e.computeDistance(),e.modified())},e.setDistance=function(n){if(t.distance!==n){t.distance=n,t.distance<1e-20&&(t.distance=1e-20,oc("Distance is set to minimum."));var r=t.directionOfProjection;t.focalPoint[0]=t.position[0]+r[0]*t.distance,t.focalPoint[1]=t.position[1]+r[1]*t.distance,t.focalPoint[2]=t.position[2]+r[2]*t.distance,e.modified()}},e.computeDistance=function(){var n=t.focalPoint[0]-t.position[0],r=t.focalPoint[1]-t.position[1],a=t.focalPoint[2]-t.position[2];if(t.distance=Math.sqrt(n*n+r*r+a*a),t.distance<1e-20){t.distance=1e-20,oc("Distance is set to minimum.");var i=t.directionOfProjection;t.focalPoint[0]=t.position[0]+i[0]*t.distance,t.focalPoint[1]=t.position[1]+i[1]*t.distance,t.focalPoint[2]=t.position[2]+i[2]*t.distance}t.directionOfProjection[0]=n/t.distance,t.directionOfProjection[1]=r/t.distance,t.directionOfProjection[2]=a/t.distance,e.computeViewPlaneNormal()},e.computeViewPlaneNormal=function(){t.viewPlaneNormal[0]=-t.directionOfProjection[0],t.viewPlaneNormal[1]=-t.directionOfProjection[1],t.viewPlaneNormal[2]=-t.directionOfProjection[2]},e.dolly=function(n){if(!(n<=0)){var r=t.distance/n;e.setPosition(t.focalPoint[0]-r*t.directionOfProjection[0],t.focalPoint[1]-r*t.directionOfProjection[1],t.focalPoint[2]-r*t.directionOfProjection[2])}},e.setRoll=function(e){},e.getRoll=function(){},e.roll=function(n){var r=t.position,a=t.focalPoint,i=t.viewUp,o=Ye.f.fromValues(i[0],i[1],i[2],0);Ye.c.identity(l);var s=Ye.e.fromValues(a[0]-r[0],a[1]-r[1],a[2]-r[2]);Ye.c.rotate(l,l,d.a.radiansFromDegrees(n),s),Ye.f.transformMat4(o,o,l),t.viewUp[0]=o[0],t.viewUp[1]=o[1],t.viewUp[2]=o[2],e.modified()},e.azimuth=function(n){var r=t.focalPoint;Ye.c.identity(c),Ye.c.translate(c,c,Ye.e.fromValues(r[0],r[1],r[2])),Ye.c.rotate(c,c,d.a.radiansFromDegrees(n),Ye.e.fromValues(t.viewUp[0],t.viewUp[1],t.viewUp[2])),Ye.c.translate(c,c,Ye.e.fromValues(-r[0],-r[1],-r[2])),Ye.e.transformMat4(f,Ye.e.fromValues(t.position[0],t.position[1],t.position[2]),c),e.setPosition(f[0],f[1],f[2])},e.yaw=function(n){var r=t.position;Ye.c.identity(c),Ye.c.translate(c,c,Ye.e.fromValues(r[0],r[1],r[2])),Ye.c.rotate(c,c,d.a.radiansFromDegrees(n),Ye.e.fromValues(t.viewUp[0],t.viewUp[1],t.viewUp[2])),Ye.c.translate(c,c,Ye.e.fromValues(-r[0],-r[1],-r[2])),Ye.e.transformMat4(p,Ye.e.fromValues(t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),c),e.setFocalPoint(p[0],p[1],p[2])},e.elevation=function(n){var r=t.focalPoint,a=e.getViewMatrix(),i=[-a[0],-a[1],-a[2]];Ye.c.identity(c),Ye.c.translate(c,c,Ye.e.fromValues(r[0],r[1],r[2])),Ye.c.rotate(c,c,d.a.radiansFromDegrees(n),Ye.e.fromValues(i[0],i[1],i[2])),Ye.c.translate(c,c,Ye.e.fromValues(-r[0],-r[1],-r[2])),Ye.e.transformMat4(f,Ye.e.fromValues(t.position[0],t.position[1],t.position[2]),c),e.setPosition(f[0],f[1],f[2])},e.pitch=function(n){var r=t.position,a=e.getViewMatrix(),i=[a[0],a[1],a[2]];Ye.c.identity(c),Ye.c.translate(c,c,Ye.e.fromValues(r[0],r[1],r[2])),Ye.c.rotate(c,c,d.a.radiansFromDegrees(n),Ye.e.fromValues(i[0],i[1],i[2])),Ye.c.translate(c,c,Ye.e.fromValues(-r[0],-r[1],-r[2])),Ye.e.transformMat4(p,Ye.e.fromValues(t.focalPoint[0],t.focalPoint[1],t.focalPoint[2]),c),e.setFocalPoint(p[0],p[1],p[2])},e.zoom=function(n){n<=0||(t.parallelProjection?t.parallelScale/=n:t.viewAngle/=n,e.modified())},e.setThickness=function(e){},e.setObliqueAngles=function(e,t){},e.physicalOrientationToWorldDirection=function(e){var t=Ye.d.fromValues(e[0],e[1],e[2],e[3]),n=Ye.d.create(),r=Ye.d.fromValues(0,0,1,0);return Ye.d.conjugate(n,t),Ye.d.multiply(r,t,r),Ye.d.multiply(r,r,n),[r[0],r[1],r[2]]},e.getPhysicalToWorldMatrix=function(t){e.getWorldToPhysicalMatrix(t),Ye.c.invert(t,t)},e.getWorldToPhysicalMatrix=function(e){Ye.c.identity(e);var n=[3];d.a.cross(t.physicalViewNorth,t.physicalViewUp,n),e[0]=n[0],e[1]=n[1],e[2]=n[2],e[4]=t.physicalViewUp[0],e[5]=t.physicalViewUp[1],e[6]=t.physicalViewUp[2],e[8]=-t.physicalViewNorth[0],e[9]=-t.physicalViewNorth[1],e[10]=-t.physicalViewNorth[2],Ye.c.transpose(e,e),Ye.e.set(o,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),Ye.c.scale(e,e,o),Ye.c.translate(e,e,t.physicalTranslation)},e.computeViewParametersFromViewMatrix=function(l){Ye.c.invert(i,l),Ye.e.transformMat4(o,n,i),e.computeDistance();var c=t.distance;e.setPosition(o[0],o[1],o[2]),Ye.e.transformMat4(s,r,i),Ye.e.subtract(s,s,o),Ye.e.normalize(s,s),e.setDirectionOfProjection(s[0],s[1],s[2]),Ye.e.transformMat4(u,a,i),Ye.e.subtract(u,u,o),Ye.e.normalize(u,u),e.setViewUp(u[0],u[1],u[2]),e.setDistance(c)},e.computeViewParametersFromPhysicalMatrix=function(t){e.getWorldToPhysicalMatrix(i),Ye.c.multiply(i,t,i),e.computeViewParametersFromViewMatrix(i)},e.setViewMatrix=function(n){t.viewMatrix=n,t.viewMatrix&&(Ye.c.copy(i,t.viewMatrix),e.computeViewParametersFromViewMatrix(i),Ye.c.transpose(t.viewMatrix,t.viewMatrix))},e.getViewMatrix=function(){if(t.viewMatrix)return t.viewMatrix;var e=Ye.c.create(),n=t.position,r=t.focalPoint,a=t.viewUp;return Ye.c.lookAt(i,Ye.e.fromValues(n[0],n[1],n[2]),Ye.e.fromValues(r[0],r[1],r[2]),Ye.e.fromValues(a[0],a[1],a[2])),Ye.c.transpose(i,i),Ye.c.copy(e,i),e},e.setProjectionMatrix=function(e){t.projectionMatrix=e},e.getProjectionMatrix=function(e,n,r){var a=Ye.c.create();if(t.projectionMatrix)return Ye.e.set(o,1/t.physicalScale,1/t.physicalScale,1/t.physicalScale),Ye.c.copy(a,t.projectionMatrix),Ye.c.scale(a,a,o),Ye.c.transpose(a,a),a;Ye.c.identity(i);var s=t.clippingRange[1]-t.clippingRange[0],u=[t.clippingRange[0]+(n+1)*s/2,t.clippingRange[0]+(r+1)*s/2];if(t.parallelProjection){var l=t.parallelScale*e,c=t.parallelScale,f=(t.windowCenter[0]-1)*l,p=(t.windowCenter[0]+1)*l,g=(t.windowCenter[1]-1)*c,m=(t.windowCenter[1]+1)*c;Ye.c.ortho(i,f,p,g,m,u[0],u[1]),Ye.c.transpose(i,i)}else{if(t.useOffAxisProjection)throw new Error("Off-Axis projection is not supported at this time");var h,v,y=Math.tan(d.a.radiansFromDegrees(t.viewAngle)/2);!0===t.useHorizontalViewAngle?(h=t.clippingRange[0]*y,v=t.clippingRange[0]*y/e):(h=t.clippingRange[0]*y*e,v=t.clippingRange[0]*y);var M=(t.windowCenter[0]-1)*h,A=(t.windowCenter[0]+1)*h,b=(t.windowCenter[1]-1)*v,w=(t.windowCenter[1]+1)*v,D=u[0],T=u[1];i[0]=2*D/(A-M),i[5]=2*D/(w-b),i[2]=(M+A)/(A-M),i[6]=(b+w)/(w-b),i[10]=-(D+T)/(T-D),i[14]=-1,i[11]=-2*D*T/(T-D),i[15]=0}return Ye.c.copy(a,i),a},e.getCompositeProjectionMatrix=function(t,n,r){var a=e.getViewMatrix(),i=e.getProjectionMatrix(t,n,r),o=Ye.c.create();return Ye.c.multiply(o,a,i),o},e.getFrustumPlanes=function(e){},e.getOrientation=function(){},e.getOrientationWXYZ=function(){},e.setDirectionOfProjection=function(n,r,a){if(t.directionOfProjection[0]!==n||t.directionOfProjection[1]!==r||t.directionOfProjection[2]!==a){t.directionOfProjection[0]=n,t.directionOfProjection[1]=r,t.directionOfProjection[2]=a;var i=t.directionOfProjection;t.focalPoint[0]=t.position[0]+i[0]*t.distance,t.focalPoint[1]=t.position[1]+i[1]*t.distance,t.focalPoint[2]=t.position[2]+i[2]*t.distance,e.computeViewPlaneNormal()}},e.setDeviceAngles=function(n,r,a,i){var o=[3];d.a.cross(t.physicalViewNorth,t.physicalViewUp,o);var s=Ye.c.create();Ye.c.rotate(s,s,d.a.radiansFromDegrees(n),t.physicalViewUp),Ye.c.rotate(s,s,d.a.radiansFromDegrees(r),o),Ye.c.rotate(s,s,d.a.radiansFromDegrees(a),t.physicalViewNorth),Ye.c.rotate(s,s,d.a.radiansFromDegrees(-i),t.physicalViewUp);var u=Ye.e.fromValues(-t.physicalViewUp[0],-t.physicalViewUp[1],-t.physicalViewUp[2]),l=Ye.e.fromValues(t.physicalViewNorth[0],t.physicalViewNorth[1],t.physicalViewNorth[2]);Ye.e.transformMat4(u,u,s),Ye.e.transformMat4(l,l,s),e.setDirectionOfProjection(u[0],u[1],u[2]),e.setViewUp(l[0],l[1],l[2]),e.modified()},e.setOrientationWXYZ=function(t,n,r,a){var i=Ye.c.create();if(0!==t&&(0!==n||0!==r||0!==a)){var o=d.a.radiansFromDegrees(t),s=Ye.d.create();Ye.d.setAxisAngle(s,[n,r,a],o),Ye.d.toMat4(s,i)}var u=Ye.e.fromValues(0,0,-1),l=Ye.e.create();Ye.e.transformMat4(l,u,i);var c=Ye.e.fromValues(0,1,0),f=Ye.e.create();Ye.e.transformMat4(f,c,i),e.setDirectionOfProjection(l[0],l[1],l[2]),e.setViewUp(f[0],f[1],f[2]),e.modified()},e.computeClippingRange=function(e){var n,r;n=t.viewPlaneNormal,r=t.position;for(var a=-n[0],i=-n[1],o=-n[2],s=-(a*r[0]+i*r[1]+o*r[2]),u=[a*e[0]+i*e[2]+o*e[4]+s,1e-18],l=0;l<2;l++)for(var c=0;c<2;c++)for(var d=0;d<2;d++){var f=a*e[d]+i*e[2+c]+o*e[4+l]+s;u[0]=fu[1]?f:u[1]}return u}}(e,t)}var lc={newInstance:g.a.newInstance(uc,"vtkCamera"),extend:uc};var cc={switch:!0,intensity:1,color:[1,1,1],position:[0,0,1],focalPoint:[0,0,0],positional:!1,exponent:1,coneAngle:30,attenuationValues:[1,0,0],transformMatrix:null,lightType:"SceneLight",shadowAttenuation:1,direction:[0,0,0],directionMTime:0};function dc(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cc,n),g.a.obj(e,t),g.a.setGet(e,t,["intensity","switch","positional","exponent","coneAngle","transformMatrix","lightType","shadowAttenuation"]),g.a.setGetArray(e,t,["color","position","focalPoint","attenuationValues"],3),function(e,t){t.classHierarchy.push("vtkLight"),e.getTransformedPosition=function(){return t.transformMatrix?[]:[].concat(t.position)},e.getTransformedFocalPoint=function(){return t.transformMatrix?[]:[].concat(t.focalPoint)},e.getDirection=function(){return t.directionMTime1&&void 0!==arguments[1]?arguments[1]:[];t.push(e);var r=e.getNestedProps();if(r&&r.length)for(var a=0;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mc,n),g.a.obj(e,t),g.a.event(e,t,"event"),g.a.setGetArray(e,t,["viewport"],4),g.a.setGetArray(e,t,["background","background2"],3),gc(e,t)}var vc={newInstance:g.a.newInstance(hc,"vtkViewport"),extend:hc},yc=g.a.vtkDebugMacro,Mc=g.a.vtkErrorMacro,Ac=g.a.vtkWarningMacro;function bc(e){return function(){return Mc("vtkRenderer::".concat(e," - NOT IMPLEMENTED"))}}var wc={pickedProp:null,activeCamera:null,allBounds:[],ambient:[1,1,1],allocatedRenderTime:100,timeFactor:1,createdLight:null,automaticLightCreation:!0,twoSidedLighting:!0,lastRenderTimeInSeconds:-1,renderWindow:null,lights:[],actors:[],volumes:[],lightFollowCamera:!0,numberOfPropsRendered:0,propArray:null,pathArray:null,layer:1,preserveColorBuffer:!1,preserveDepthBuffer:!1,computeVisiblePropBounds:d.a.createUninitializedBounds(),interactive:!0,nearClippingPlaneTolerance:0,clippingRangeExpansion:.05,erase:!0,draw:!0,useShadows:!1,useDepthPeeling:!1,occlusionRatio:0,maximumNumberOfPeels:4,selector:null,delegate:null,texturedBackground:!1,backgroundTexture:null,pass:0};function Dc(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wc,n),vc.extend(e,t,n),g.a.get(e,t,["renderWindow","allocatedRenderTime","timeFactor","lastRenderTimeInSeconds","numberOfPropsRendered","lastRenderingUsedDepthPeeling","selector"]),g.a.setGet(e,t,["twoSidedLighting","lightFollowCamera","automaticLightCreation","erase","draw","nearClippingPlaneTolerance","clippingRangeExpansion","backingStore","interactive","layer","preserveColorBuffer","preserveDepthBuffer","useDepthPeeling","occlusionRatio","maximumNumberOfPeels","delegate","backgroundTexture","texturedBackground","useShadows","pass"]),g.a.getArray(e,t,["actors","volumes","lights"]),g.a.setGetArray(e,t,["background"],4,1),function(e,t){for(t.classHierarchy.push("vtkRenderer"),t.background||(t.background=[0,0,0,1]);t.background.length<3;)t.background.push(0);3===t.background.length&&t.background.push(1);var n={type:"ComputeVisiblePropBoundsEvent",renderer:e},r={type:"ResetCameraClippingRangeEvent",renderer:e},a={type:"ResetCameraEvent",renderer:e};e.updateCamera=function(){return t.activeCamera||(yc("No cameras are on, creating one."),e.getActiveCameraAndResetIfCreated()),t.activeCamera.render(e),!0},e.updateLightsGeometryToFollowCamera=function(){var n=e.getActiveCameraAndResetIfCreated();t.lights.forEach(function(e){e.lightTypeIsSceneLight()||e.lightTypeIsCameraLight()||(e.lightTypeIsHeadLight()?(e.setPositionFrom(n.getPositionByReference()),e.setFocalPointFrom(n.getFocalPointByReference()),e.modified(n.getMTime())):Mc("light has unknown light type",e.get()))})},e.updateLightGeometry=function(){return!t.lightFollowCamera||e.updateLightsGeometryToFollowCamera()},e.allocateTime=bc("allocateTime"),e.updateGeometry=bc("updateGeometry"),e.getVTKWindow=function(){return t.renderWindow},e.setLayer=function(n){yc(e.getClassName(),e,"setting Layer to ",n),t.layer!==n&&(t.layer=n,e.modified()),e.setPreserveColorBuffer(!!n)},e.setActiveCamera=function(n){return t.activeCamera!==n&&(t.activeCamera=n,e.modified(),e.invokeEvent({type:"ActiveCameraEvent",camera:n}),!0)},e.makeCamera=function(){var t=lc.newInstance();return e.invokeEvent({type:"CreateCameraEvent",camera:t}),t},e.getActiveCamera=function(){return t.activeCamera||(t.activeCamera=e.makeCamera()),t.activeCamera},e.getActiveCameraAndResetIfCreated=function(){return t.activeCamera||(e.getActiveCamera(),e.resetCamera()),t.activeCamera},e.addActor=e.addViewProp,e.addVolume=e.addViewProp,e.removeActor=function(n){t.actors=t.actors.filter(function(e){return e!==n}),e.removeViewProp(n)},e.removeVolume=function(n){t.volumes=t.volumes.filter(function(e){return e!==n}),e.removeViewProp(n)},e.addLight=function(n){t.lights=[].concat(t.lights,n),e.modified()},e.getActors=function(){return t.actors=[],t.props.forEach(function(e){t.actors=t.actors.concat(e.getActors())}),t.actors},e.getVolumes=function(){return t.volumes=[],t.props.forEach(function(e){t.volumes=t.volumes.concat(e.getVolumes())}),t.volumes},e.removeLight=function(n){t.lights=t.lights.filter(function(e){return e!==n}),e.modified()},e.removeAllLights=function(){t.lights=[]},e.setLightCollection=function(n){t.lights=n,e.modified()},e.makeLight=fc.newInstance,e.createLight=function(){t.automaticLightCreation&&(t.createdLight&&(e.removeLight(t.createdLight),t.createdLight.delete(),t.createdLight=null),t.createdLight=e.makeLight(),e.addLight(t.createdLight),t.createdLight.setLightTypeToHeadLight(),t.createdLight.setPosition(e.getActiveCamera().getPosition()),t.createdLight.setFocalPoint(e.getActiveCamera().getFocalPoint()))},e.normalizedDisplayToWorld=function(t,n,r,a){var i=e.normalizedDisplayToView(t,n,r);return e.viewToWorld(i[0],i[1],i[2],a)},e.worldToNormalizedDisplay=function(t,n,r,a){var i=e.worldToView(t,n,r);return e.viewToNormalizedDisplay(i[0],i[1],i[2],a)},e.viewToWorld=function(e,n,r,a){if(null===t.activeCamera)return Mc("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];var i=t.activeCamera.getCompositeProjectionMatrix(a,-1,1);Ye.c.invert(i,i),Ye.c.transpose(i,i);var o=Ye.e.fromValues(e,n,r);return Ye.e.transformMat4(o,o,i),[o[0],o[1],o[2]]},e.worldToView=function(e,n,r,a){if(null===t.activeCamera)return Mc("ViewToWorld: no active camera, cannot compute view to world, returning 0,0,0"),[0,0,0];var i=t.activeCamera.getCompositeProjectionMatrix(a,-1,1);Ye.c.transpose(i,i);var o=Ye.e.fromValues(e,n,r);return Ye.e.transformMat4(o,o,i),[o[0],o[1],o[2]]},e.computeVisiblePropBounds=function(){t.allBounds[0]=E.a.INIT_BOUNDS[0],t.allBounds[1]=E.a.INIT_BOUNDS[1],t.allBounds[2]=E.a.INIT_BOUNDS[2],t.allBounds[3]=E.a.INIT_BOUNDS[3],t.allBounds[4]=E.a.INIT_BOUNDS[4],t.allBounds[5]=E.a.INIT_BOUNDS[5];var r=!0;e.invokeEvent(n);for(var a=0;at.allBounds[1]&&(t.allBounds[1]=o[1]),o[2]t.allBounds[3]&&(t.allBounds[3]=o[3]),o[4]t.allBounds[5]&&(t.allBounds[5]=o[5]))}}return r&&(d.a.uninitializeBounds(t.allBounds),yc("Can't compute bounds, no 3D props are visible")),t.allBounds},e.resetCamera=function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||e.computeVisiblePropBounds(),r=[0,0,0];if(!d.a.areBoundsInitialized(n))return yc("Cannot reset camera!"),!1;var i=null;if(!e.getActiveCamera())return Mc("Trying to reset non-existant camera"),!1;i=t.activeCamera.getViewPlaneNormal(),t.activeCamera.setViewAngle(30),r[0]=(n[0]+n[1])/2,r[1]=(n[2]+n[3])/2,r[2]=(n[4]+n[5])/2;var o=n[1]-n[0],s=n[3]-n[2],u=n[5]-n[4],l=(o*=o)+(s*=s)+(u*=u);l=0===l?1:l,l=.5*Math.sqrt(l);var c=d.a.radiansFromDegrees(t.activeCamera.getViewAngle()),f=l,p=l/Math.sin(.5*c),g=t.activeCamera.getViewUp();return Math.abs(d.a.dot(g,i))>.999&&(Ac("Resetting view-up since view plane normal is parallel"),t.activeCamera.setViewUp(-g[2],g[0],g[1])),t.activeCamera.setFocalPoint(r[0],r[1],r[2]),t.activeCamera.setPosition(r[0]+p*i[0],r[1]+p*i[1],r[2]+p*i[2]),e.resetCameraClippingRange(n),t.activeCamera.setParallelScale(f),t.activeCamera.setPhysicalScale(l),t.activeCamera.setPhysicalTranslation(-r[0],-r[1],-r[2]),e.invokeEvent(a),!0},e.resetCameraClippingRange=function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||e.computeVisiblePropBounds();if(!d.a.areBoundsInitialized(n))return yc("Cannot reset camera clipping range!"),!1;if(e.getActiveCameraAndResetIfCreated(),!t.activeCamera)return Mc("Trying to reset clipping range of non-existant camera"),!1;var a=t.activeCamera.computeClippingRange(n),i=0;if(t.activeCamera.getParallelProjection())i=.1*t.activeCamera.getParallelScale();else{var o=d.a.radiansFromDegrees(t.activeCamera.getViewAngle());i=.2*Math.tan(o/2)*a[1]}return a[1]-a[0]=a[1]?.01*a[1]:a[0],t.nearClippingPlaneTolerance||(t.nearClippingPlaneTolerance=.01),a[0]e&&(e=n);var r=t.createdLight?t.createdLight.getMTime():0;return r>e&&(e=r),e},e.getTransparent=function(){return!!t.preserveColorBuffer},e.isActiveCameraCreated=function(){return!!t.activeCamera}}(e,t)}var Tc={newInstance:g.a.newInstance(Dc,"vtkRenderer"),extend:Dc},Cc={Corners:{TOP_LEFT:"TOP_LEFT",TOP_RIGHT:"TOP_RIGHT",BOTTOM_LEFT:"BOTTOM_LEFT",BOTTOM_RIGHT:"BOTTOM_RIGHT"}};function Ic(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ec,n),g.a.obj(e,t),g.a.get(e,t,["enabled","viewportCorner","viewportSize"]),g.a.setGet(e,t,["interactor","minPixelSize","maxPixelSize"]),g.a.get(e,t,["actor"]),function(e,t){t.classHierarchy.push("vtkOrientationMarkerWidget");var n=[],r=Tc.newInstance(),a=null,i=null;e.computeViewport=function(){var e=xc(t.interactor.getView().getSize(),2),n=e[0],r=e[1],a=Math.min(n,r),i=t.viewportSize*a,o=(i=Math.max(Math.min(t.minPixelSize,a),Math.min(t.maxPixelSize,i)))/n,s=i/r;switch(t.viewportCorner){case Nc.TOP_LEFT:return[0,1-s,o,1];case Nc.TOP_RIGHT:return[1-o,1-s,1,1];case Nc.BOTTOM_LEFT:return[0,0,o,s];case Nc.BOTTOM_RIGHT:return[1-o,0,1,s];default:return Sc("Invalid widget corner"),null}},e.updateViewport=function(){r.setViewport.apply(r,Ic(e.computeViewport())),t.interactor.render()},e.updateMarkerOrientation=function(){var e=t.interactor.findPokedRenderer().getActiveCamera();if(e){var a=e.getReferenceByName("position"),i=e.getReferenceByName("focalPoint"),o=e.getReferenceByName("viewUp");if(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==i[0]||n[4]!==i[1]||n[5]!==i[2]||n[6]!==o[0]||n[7]!==o[1]||n[8]!==o[2]){n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=i[0],n[4]=i[1],n[5]=i[2],n[6]=o[0],n[7]=o[1],n[8]=o[2];var s=r.getActiveCamera();s.setPosition(a[0],a[1],a[2]),s.setFocalPoint(i[0],i[1],i[2]),s.setViewUp(o[0],o[1],o[2]),r.resetCamera()}}},e.setEnabled=function(n){if(n){if(t.enabled)return;if(!t.actor)return void Sc("Must set actor before enabling orientation marker.");if(!t.interactor)return void Sc("Must set interactor before enabling orientation marker.");var o=t.interactor.findPokedRenderer().getRenderWindow();o.addRenderer(r),o.getNumberOfLayers()<2&&o.setNumberOfLayers(2),r.setLayer(o.getNumberOfLayers()-1),r.setInteractive(!1),r.addViewProp(t.actor),t.actor.setVisibility(!0);var s=t.interactor.onAnimation(e.updateMarkerOrientation);a=s.unsubscribe;var u=t.interactor.getView().onModified(e.updateViewport);i=u.unsubscribe,e.updateViewport(),e.updateMarkerOrientation(),t.enabled=!0}else{if(!t.enabled)return;t.enabled=!1,i(),i=null,a(),a=null,t.actor.setVisibility(!1),r.removeViewProp(t.actor);var l=t.interactor.findPokedRenderer().getRenderWindow();l&&l.removeRenderer(r)}e.modified()},e.setViewportCorner=function(n){n!==t.viewportCorner&&(t.viewportCorner=n,t.enabled&&e.updateViewport())},e.setViewportSize=function(n){var r=Math.min(1,Math.max(0,n));r!==t.viewportSize&&(t.viewportSize=r,t.enabled&&e.updateViewport())},e.setActor=function(n){var r=t.enabled;e.setEnabled(!1),t.actor=n,e.setEnabled(r)},e.getRenderer=function(){return r}}(e,t)}var Lc=g.a.newInstance(Oc,"vtkOrientationMarkerWidget"),Pc=Object.assign({newInstance:Lc,extend:Oc},Cc),kc={Manipulators:vo,Misc:Do,Style:Qo,UI:ru,Widgets:{vtkAbstractWidget:ou,vtkDistanceRepresentation:vl,vtkDistanceWidget:_l,vtkHandleRepresentation:ku,vtkHandleWidget:Il,vtkImageCroppingRegionsRepresentation:Kl,vtkImageCroppingRegionsWidget:ic,vtkLabelRepresentation:zu,vtkLabelWidget:El,vtkLineRepresentation:pl,vtkLineWidget:jl,vtkOrientationMarkerWidget:Pc,vtkPiecewiseGaussianWidget:Xs,vtkPointPlacer:Tu,vtkSphereHandleRepresentation:sl,vtkWidgetRepresentation:Nu}},Rc=n(47),jc=n(15),Bc=n(58),zc=n(134);function _c(e){return{subscribeToImageStream:function(t){return e.subscribe("viewport.image.push.subscription",t)},unsubscribeToImageStream:function(t){return e.unsubscribe(t)},registerView:function(t){return e.call("viewport.image.push.observer.add",[t])},unregisterView:function(t){return e.call("viewport.image.push.observer.remove",[t])},enableView:function(t,n){return e.call("viewport.image.push.enabled",[t,n])},render:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{size:[400,400],view:-1};return e.call("viewport.image.push",[t])},invalidateCache:function(t){return e.call("viewport.image.push.invalidate.cache",[t])},setQuality:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return e.call("viewport.image.push.quality",[t,n,r])},setSize:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:400;return e.call("viewport.image.push.original.size",[t,n,r])},setServerAnimationFPS:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30;return e.call("viewport.image.animation.fps.max",[t])},getServerAnimationFPS:function(){return e.call("viewport.image.animation.fps.get",[])},startAnimation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;return e.call("viewport.image.animation.start",[t])},stopAnimation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;return e.call("viewport.image.animation.stop",[t])},updateCamera:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return e.call("viewport.camera.update",[t,n,r,a,i])},updateCameraParameters:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e.call("viewport.camera.update.params",[t,n,r])}}}function Vc(e,t){function n(n){var r=Number(this.dataset.id);e.invokeImageReady(t.eventPool[r])}t.classHierarchy.push("vtkViewStream"),t.imageDecodingPool=[new Image,new Image],t.eventPool=[],t.nextPoolImageIndex=0,t.urlToRevoke=[],t.activeURL=null,t.fps=[],t.lastTime=Date.now(),t.lastImageEvent=null,e.pushCamera=function(){var n=t.camera.getReferenceByName("focalPoint"),r=t.camera.getReferenceByName("viewUp"),a=t.camera.getReferenceByName("position"),i=t.camera.getParallelProjection(),o=t.camera.getViewAngle(),s=t.camera.getParallelScale(),u=null;return u=t.useCameraParameters?t.protocol.updateCameraParameters(t.viewId,{focalPoint:n,viewUp:r,position:a,parallelProjection:i,viewAngle:o,parallelScale:s},!1):t.protocol.updateCamera(t.viewId,n,r,a,!1),t.isAnimating&&setTimeout(e.pushCamera,1e3/t.cameraUpdateRate),u},e.invalidateCache=function(){return t.protocol.invalidateCache(t.viewId)},e.render=function(){return t.protocol.render({view:t.viewId,size:t.size})},e.startAnimation=function(){return t.protocol.startAnimation(t.viewId)},e.stopAnimation=function(){return t.protocol.stopAnimation(t.viewId)},e.setSize=function(n,r){var a=!1;return t.size[0]===n&&t.size[1]===r||(t.size=[n,r],a=!0),a?(e.modified(),t.protocol.setSize(t.viewId,n,r)):Promise.resolve(!1)},e.startInteraction=function(){var n=[t.protocol.setQuality(t.viewId,t.interactiveQuality,t.interactiveRatio)];return t.camera&&(n.push(e.startAnimation()),t.isAnimating=!0,n.push(e.pushCamera())),Promise.all(n)},e.endInteraction=function(){var n=[];return n.push(t.protocol.setQuality(t.viewId,t.stillQuality,t.stillRatio)),t.camera&&(n.push(e.stopAnimation()),t.isAnimating=!1,n.push(e.pushCamera())),Promise.all(n)},e.setViewId=function(e){return!(t.viewId===e||!t.protocol)&&(t.viewId&&t.protocol.unregisterView(t.viewId),t.viewId=e,t.viewId&&t.protocol.registerView(t.viewId).then(function(e){var n=e.viewId;t.viewId=n}),!0)},e.processMessage=function(n){if(n.id==t.viewId){var r=new Blob([n.image],{type:t.mimeType});if(t.activeURL)for(t.urlToRevoke.push(t.activeURL),t.activeURL=null;t.urlToRevoke.length>60;){var a=t.urlToRevoke.shift();window.URL.revokeObjectURL(a)}t.activeURL=URL.createObjectURL(r);var i,o=Date.now(),s=Math.floor(1e4/(o-t.lastTime))/10;for(t.fps.push(s),t.lastTime=o,t.lastImageEvent={url:t.activeURL,fps:s,metadata:{size:n.size,id:n.id,memory:n.memsize,workTime:n.workTime}},t.decodeImage?(i=t.lastImageEvent,t.eventPool[t.nextPoolImageIndex]=i,i.image=t.imageDecodingPool[t.nextPoolImageIndex++],t.nextPoolImageIndex%=t.imageDecodingPool.length,i.image.src=i.url):e.invokeImageReady(t.lastImageEvent);t.fps.length>t.fpsWindowSize;)t.fps.shift()}},e.delete=g.a.chain(function(){for(t.unregisterViewStream(e),e.setViewId(null);t.urlToRevoke.length;)window.URL.revokeObjectURL(t.urlToRevoke.pop())},e.delete),function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;t.imageDecodingPool.length2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fc,n),g.a.obj(e,t),g.a.event(e,t,"ImageReady"),g.a.get(e,t,["viewId","size","fps","lastImageEvent"]),g.a.setGet(e,t,["camera","cameraUpdateRate","decodeImage","fpsWindowSize","interactiveQuality","interactiveRatio","stillQuality","stillRatio","useCameraParameters"]),Vc(e,t),Object.assign(e,t.sharedAPI)}var Gc={newInstance:g.a.newInstance(Uc,"vtkViewStream"),extend:Uc};var Wc={viewStreams:[],serverAnimationFPS:-1};function Qc(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wc,n),g.a.obj(e,t),g.a.get(e,t,["serverAnimationFPS","protocol"]),function(e,t){function n(e){var n=e[0];if(n&&n.image)for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:30,r=!1;return t.serverAnimationFPS!==n&&(t.serverAnimationFPS=n,r=!0),t.protocol?(r&&e.modified(),t.protocol.setServerAnimationFPS(n)):Promise.resolve(!0)},e.connect=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;!t.connected&&e&&r&&(t.protocol=r(e),t.protocol.subscribeToImageStream(n).then(function(e){t.renderTopicSubscription=e,t.connected=!0}).catch(function(e){t.connected=!1,console.error(e)}))},e.disconnect=function(){t.protocol&&t.connected&&(t.protocol.unsubscribeToImageStream(t.imageStreamTopicSubscription),t.imageStreamTopicSubscription=null)},e.registerViewStream=function(e){t.viewStreams.push(e)},e.unregisterViewStream=function(e){t.viewStreams=t.viewStreams.filter(function(t){return t!==e})},e.createViewStream=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"-1",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[400,400],a=e.setServerAnimationFPS,i=e.getServerAnimationFPS,o=e.unregisterViewStream,s=Gc.newInstance({protocol:t.protocol,unregisterViewStream:o,sharedAPI:{setServerAnimationFPS:a,getServerAnimationFPS:i}});return s.setViewId(n),s.setSize(r[0],r[1]),e.registerViewStream(s),s},e.delete=g.a.chain(function(){for(;t.viewStreams.length;)t.viewStreams.pop().delete();e.disconnect()},e.delete)}(e,t)}var Yc={newInstance:g.a.newInstance(Qc,"vtkImageStream"),extend:Qc},Hc=null;function Kc(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r={};return Object.keys(e).forEach(function(a){-1===n.indexOf(a)?r[a]=function(e,t){return function(){for(var n=arguments.length,r=new Array(n),a=0;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xc,n),g.a.obj(e,t),g.a.setGet(e,t,["protocols","notBusyList","createImageStream"]),g.a.get(e,t,["connection","config","remote","imageStream"]),g.a.event(e,t,"BusyChange"),g.a.event(e,t,"ConnectionReady"),g.a.event(e,t,"ConnectionError"),g.a.event(e,t,"ConnectionClose"),function(e,t){function n(){e.invokeBusyChange(t.busyCount)}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;t.busyCount+=e,t.timeoutId&&(clearTimeout(t.timeoutId),t.timeoutId=0),t.busyCount?n():t.timeoutId=setTimeout(n,t.notificationTimeout)}t.classHierarchy.push("vtkWSLinkClient"),e.beginBusy=function(){return r(1)},e.endBusy=function(){return r(-1)},e.isBusy=function(){return!!t.busyCount},e.isConnected=function(){return!!t.connection},e.connect=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Hc?t.connection?Promise.reject(new Error("Need to disconnect first")):(t.config=n,new Promise(function(a,i){t.smartConnect=Hc.newInstance({config:n}),t.smartConnect.onConnectionReady(function(n){t.connection=n,t.remote={},t.config=t.smartConnect.getConfig();var i=n.getSession();t.protocols=t.protocols||{},Object.keys(t.protocols).forEach(function(e){t.remote[e]=Kc(t.protocols[e](i),r,t.notBusyList)}),t.createImageStream&&(t.imageStream=Yc.newInstance(),t.imageStream.connect(i)),e.invokeConnectionReady(e),a(e)}),t.smartConnect.onConnectionError(function(t){e.invokeConnectionError(t),i(t)}),t.smartConnect.onConnectionClose(function(t){e.invokeConnectionClose(t),i(t)}),t.smartConnect.connect()})):Promise.reject(new Error("Need to provide SmartConnect"))},e.disconnect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:60;t.connection&&(t.connection.destroy(e),t.connection=null)}}(e,t)}var Zc={newInstance:g.a.newInstance(qc,"vtkWSLinkClient"),extend:qc,setSmartConnectClass:function(e){Hc=e}},Jc={BinaryHelper:Rc.a,DataAccessHelper:jc.a,vtkHttpDataSetReader:Bc.a,vtkHttpSceneLoader:zc.a,vtkImageStream:Yc,vtkWSLinkClient:Zc},$c={vtkSTLReader:n(135).a};function ed(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var td={POINTS:"getPoints",VERTICES:"getVerts",LINES:"getLines",TRIANGLE_STRIPS:"getStrips",POLYGONS:"getPolys",POINT_DATA:"getPointData",CELL_DATA:"getCellData",FIELD:"getFieldData"},nd={bit:Uint8Array,unsigned_char:Uint8Array,char:Int8Array,unsigned_short:Uint16Array,short:Int16Array,unsigned_int:Uint32Array,int:Int32Array,unsigned_long:Uint32Array,long:Int32Array,float:Float32Array,double:Float64Array},rd={SCALARS:"addArray",COLOR_SCALARS:"addArray",VECTORS:"setVectors",NORMALS:"setNormals",TEXTURE_COORDINATES:"setTCoords",TENSORS:"setTensors",FIELD:"addArray"};function ad(e,t,n){var r=0;return function(a){return a.split(" ").forEach(function(t){t.length&&(e[r++]=Number(t))}),r1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=/\r?\n/.exec(e),a=null!==r?r[0]:null;return e.split(a).forEach(function(e,r){if(!(r<2))if(n)n&&!n.parse(e,t)&&(n=null);else{if(!(n=function(e,t){var n=e.split(" ");return od[n[0]]}(e)))return;n=n.init(e,t)?n:null}}),t}};function ud(e,t){t.classHierarchy.push("vtkPolyDataReader"),t.dataAccessHelper||(t.dataAccessHelper=jc.a.get("http")),e.setUrl=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;var a=n.split("/");return a.pop(),t.baseURL=a.join("/"),t.compression=r.compression,e.loadData({progressCallback:r.progressCallback})},e.loadData=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=function(n){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var r=t.compression,a=t.progressCallback;return t.dataAccessHelper.fetchText(e,n,{compression:r,progressCallback:a})}(t.url,n);return r.then(e.parseAsText),r},e.parseAsText=function(n){n&&n!==t.parseData&&(e.modified(),t.parseData=n,t.output[0]=sd.parseLegacyASCII(t.parseData).dataset)},e.requestData=function(n,r){e.parseAsText(t.parseData)}}var ld={};function cd(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ld,n),g.a.obj(e,t),g.a.get(e,t,["url","baseURL"]),g.a.setGet(e,t,["dataAccessHelper"]),g.a.algo(e,t,0,1),ud(e,t),t.compression||(t.compression=null),t.progressCallback||(t.progressCallback=null)}var dd=g.a.newInstance(cd,"vtkPolyDataReader"),fd={vtkLegacyAsciiParser:sd,vtkPolyDataReader:{newInstance:dd,extend:cd}};function pd(e,t){t.classHierarchy.push("vtkElevationReader"),t.dataAccessHelper||(t.dataAccessHelper=jc.a.get("http")),e.setUrl=function(n,r){return t.url=n,e.loadData(r)},e.loadData=function(n){return function(n,r){return t.dataAccessHelper.fetchText(e,n,r)}(t.url,n).then(function(t){return e.parseAsText(t),!0})},e.parseAsText=function(n){t.csv=n,t.elevation=[],t.csv.split("\n").forEach(function(e,n){t.elevation.push(e.split(",").map(function(e){return Number(e)}))}),e.modified()},e.requestData=function(e,n){var i=Ie.a.newInstance();if(i.getPoints().setData(new Float32Array(0,0,0,1,1,1),3),t.elevation){var o=t.elevation.length,s=t.elevation[0].length,u=i.getPoints();u.setNumberOfPoints(s*o,3);var l=u.getData(),c=r.a.newInstance({size:5*(s-1)*(o-1)});i.setPolys(c);var d=c.getData(),f=0,p=new Float32Array(s*o*2),g=a.a.newInstance({numberOfComponents:2,values:p,name:"TextureCoordinates"});i.getPointData().setTCoords(g);for(var m=0;m0&&m>0&&(d[f++]=4,d[f++]=v,d[f++]=v-1,d[f++]=v-1-s,d[f++]=v-s)}}t.output[0]=i},e.isBusy=function(){return!!t.requestCount}}var gd={origin:[0,0,0],xSpacing:1,ySpacing:1,zScaling:1,xDirection:1,yDirection:-1,requestCount:0};function md(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gd,n),g.a.obj(e,t),g.a.get(e,t,["url"]),g.a.setGet(e,t,["dataAccessHelper","xSpacing","ySpacing","zScaling","xDirection","yDirection"]),g.a.algo(e,t,0,1),g.a.event(e,t,"busy"),pd(e,t)}var hd={newInstance:g.a.newInstance(md,"vtkElevationReader"),extend:md},vd=$.convertItkToVtkImage,yd=null,Md=function(e){return e};var Ad={fileName:"",arrayName:null};function bd(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ad,n),g.a.obj(e,t),g.a.algo(e,t,0,1),g.a.setGet(e,t,["fileName","arrayName"]),function(e,t){t.classHierarchy.push("vtkITKImageReader"),e.parseAsArrayBuffer=function(n){return n&&n!==t.rawDataBuffer?(t.rawDataBuffer=n,yd(n,t.fileName).then(Md).then(function(n){var r,a,i,o=vd(n,{scalarArrayName:t.arrayName||(r=t.fileName,a=r.lastIndexOf("."),i=a>-1?r.substring(0,a):r,"Scalars ".concat(i))});t.output[0]=o,e.modified()})):Promise.resolve()},e.requestData=function(n,r){e.parseAsArrayBuffer(t.rawDataBuffer,t.fileName)}}(e,t),yd||console.error("\n // Dependency needs to be added inside your project\n import readImageArrayBuffer from 'itk/readImageArrayBuffer';\n vtkITKImageReader.setReadImageArrayBufferFromITK(readImageArrayBuffer);\n ")}var wd={newInstance:g.a.newInstance(bd,"vtkITKImageReader"),extend:bd,setReadImageArrayBufferFromITK:function(e){4===(yd=e).length&&(yd=function(){for(var t=arguments.length,n=new Array(t),r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Td,n),g.a.obj(e,t),g.a.get(e,t,["url"]),g.a.setGet(e,t,["dataAccessHelper"]),g.a.algo(e,t,0,1),Dd(e,t)}var Id={newInstance:g.a.newInstance(Cd,"vtkJSONNucleoReader"),extend:Cd};function xd(e,t){t.classHierarchy.push("vtkJSONReader"),e.setUrl=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.url=n,e.loadData(r)},e.loadData=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchText(e,n,r)}(t.url,n).then(e.parseAsText)},e.parseAsText=function(n){return!!n&&(t.data=JSON.parse(n),e.modified(),!0)},e.requestData=function(e,n){n[0]=t.data},e.isBusy=function(){return!1},e.getNumberOfOutputPorts=function(){return t.numberOfOutputs}}var Sd={};function Nd(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sd,n),g.a.obj(e,t),g.a.get(e,t,["url"]),g.a.algo(e,t,0,1),g.a.event(e,t,"busy"),xd(e,t)}var Ed={newInstance:g.a.newInstance(Nd,"vtkJSONReader"),extend:Nd},Od=n(34);function Ld(e,t){function n(){t.requestCount--,0===t.requestCount&&e.invokeBusy(!1)}function r(e){if("#"!==e[0]&&0!==e.length){var r=e.split(/[ \t]+/).map(function(e){return e.trim()}).filter(function(e){return e.length});if("newmtl"===r[0])r.shift(),t.currentMaterial=r.join(" ").trim();else if(t.currentMaterial){if(r.length<2)return;if(t.materials[t.currentMaterial]||(t.materials[t.currentMaterial]={}),t.materials[t.currentMaterial][r[0]]=r.slice(1),"map_Kd"===r[0]){var a=new Image;a.onload=function(){return setTimeout(n,0)},a.src=[t.baseURL,r[1]].join("/"),t.materials[t.currentMaterial].image=a,t.requestCount++}}}}t.classHierarchy.push("vtkMTLReader"),t.dataAccessHelper||(t.dataAccessHelper=jc.a.get("http")),e.setUrl=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(-1!==n.indexOf(".mtl")||r.fullpath){t.url=n;var a=n.split("/");a.pop(),t.baseURL=a.join("/")}else t.baseURL=n,t.url="".concat(n,"/index.mtl");return e.loadData(r)},e.loadData=function(n){return new Promise(function(r,a){var i,o;(i=t.url,o=n,t.dataAccessHelper.fetchText(e,i,o)).then(function(t){e.parseAsText(t),r()},function(e){a()})})},e.parseAsText=function(n){e.modified(),t.materials={},n.split("\n").forEach(r)},e.isBusy=function(){return!!t.requestCount},e.getMaterialNames=function(){return Object.keys(t.materials)},e.getMaterial=function(e){return t.materials[e]},e.listImages=function(){return Object.keys(t.materials).map(function(e){return t.materials[e].map_Kd}).filter(function(e){return!!e}).map(function(e){return e[0].trim()})},e.setImageSrc=function(e,n){return new Promise(function(r,a){var i=Object.keys(t.materials).find(function(n){return t.materials[n].map_Kd&&t.materials[n].map_Kd[0].trim()===e.trim()}),o=t.materials[i];o&&o.image?(o.image.src=n,o.image.onload=function(){return setTimeout(r,0)}):r()})},e.applyMaterialToActor=function(e,n){var r=t.materials[e];if(r&&n){var a=[1,1,1],i={ambientColor:r.Ka?r.Ka.map(function(e){return Number(e)}):a,specularColor:r.Ks?r.Ks.map(function(e){return Number(e)}):a,diffuseColor:r.Kd?r.Kd.map(function(e){return Number(e)}):a,opacity:r.d?Number(r.d):1,specularPower:r.Ns?Number(r.Ns):1},o=Number(r.illum||2);if(["ambient","diffuse","specular"].forEach(function(e,t){i[e]=t<=o?1:0}),r.image){var s=Od.a.newInstance({interpolate:t.interpolateTextures});s.setImage(r.image),n.addTexture(s)}n.getProperty().set(i)}}}var Pd={numberOfOutputs:1,requestCount:0,materials:{},interpolateTextures:!0};function kd(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pd,n),g.e(e,t),g.c(e,t,["url","baseURL"]),g.f(e,t,["dataAccessHelper","interpolateTextures","splitGroup"]),g.b(e,t,"busy"),Ld(e,t)}var Rd={newInstance:g.d(kd,"vtkMTLReader"),extend:kd};function jd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Bd={};function zd(e,t,n,r){for(var a=0;a0&&"\r"!==e}),s=o.length;i.push(s);for(var u=0;u1&&void 0!==arguments[1]?arguments[1]:{};if(-1!==n.indexOf(".obj")||r.fullpath){t.url=n;var a=n.split("/");a.pop(),t.baseURL=a.join("/")}else t.baseURL=n,t.url="".concat(n,"/index.obj");return e.loadData(r)},e.loadData=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchText(e,n,r)}(t.url,n).then(e.parseAsText)},e.parseAsText=function(n){return!n||(n!==t.parseData&&e.modified(),t.parseData=n,t.numberOfOutputs=0,r=t.splitMode,Bd.splitOn=r,Bd.pieces=[],Bd.v=[],Bd.vt=[],Bd.vn=[],Bd.f=[[]],Bd.size=0,n.split("\n").forEach(_d),function(e){var t=!!Bd.vt.length,n=!!Bd.vn.length;if(e.splitMode){e.numberOfOutputs=Bd.size;for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fd,n),g.a.obj(e,t),g.a.get(e,t,["url","baseURL"]),g.a.setGet(e,t,["dataAccessHelper","splitMode"]),g.a.algo(e,t,0,1),g.a.event(e,t,"busy"),Vd(e,t)}var Gd={newInstance:g.a.newInstance(Ud,"vtkOBJReader"),extend:Ud},Wd=n(136);function Qd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Yd(e,t){t.classHierarchy.push("vtkPDBReader"),t.dataAccessHelper||(t.dataAccessHelper=jc.a.get("http")),e.setUrl=function(n,r){if(-1===n.indexOf(".pdb"))t.baseURL=n,t.url="".concat(n);else{t.url=n;var a=n.split("/");a.pop(),t.baseURL=a.join("/")}return e.loadData(r)},e.loadData=function(n){return function(n,r){return t.dataAccessHelper.fetchText(e,n,r)}(t.url,n).then(e.parseAsText)},e.parseAsText=function(n){return t.pdb=n,t.molecule=[],t.molecule=t.pdb.split("\n"),e.modified(),!0},e.requestData=function(e,n){var r=ye.newInstance();if(t.molecule){var a=t.molecule.length,i=[],o=[];t.numberOfAtoms=0;for(var s=0;s=78&&(m=l.substr(76,2).replace(/\s+/g,"")),""===m&&(m=d.substr(0,2).replace(/\d/g,"")),i.push(f),i.push(p),i.push(g);var h=Qd(Wd[m],1)[0];o.push(h),t.numberOfAtoms++}s++}r.getAtoms().elements={},r.getAtoms().elements.number=Int8Array.from(o),r.getAtoms().coords={},r.getAtoms().coords["3d"]=Float32Array.from(i)}t.output[0]=r},e.isBusy=function(){return!!t.requestCount}}var Hd={numberOfAtoms:0,requestCount:0};function Kd(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hd,n),g.a.obj(e,t),g.a.get(e,t,["url","baseURL","numberOfAtoms","requestCount"]),g.a.setGet(e,t,["dataAccessHelper"]),g.a.algo(e,t,0,1),g.a.event(e,t,"busy"),Yd(e,t)}var Xd={newInstance:g.a.newInstance(Kd,"vtkPDBReader"),extend:Kd},qd=n(85),Zd=n.n(qd);function Jd(e,t){t.classHierarchy.push("vtkSkyboxReader"),e.setUrl=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.url=n,e.loadData(r)},e.loadData=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var n=t.compression,r=t.progressCallback;return t.dataAccessHelper.fetchBinary(e,{compression:n,progressCallback:r})}(t.url,n).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=function(n){if(!n)return!1;t.textures={},t.busy=!0,e.invokeBusy(t.busy),t.dataMapping={};var r=0,a=!1,i=[];function o(){if(0===--r||a){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$d,n),g.a.obj(e,t),g.a.get(e,t,["url","positions","position"]),g.a.setGet(e,t,["faceMapping"]),g.a.event(e,t,"busy"),g.a.algo(e,t,0,6),Jd(e,t)}var tf={vtkElevationReader:hd,vtkITKImageReader:wd,vtkJSONNucleoReader:Id,vtkJSONReader:Ed,vtkMTLReader:Rd,vtkOBJReader:Gd,vtkPDBReader:Xd,vtkSkyboxReader:{newInstance:g.a.newInstance(ef,"vtkSkyboxReader"),extend:ef}},nf=n(17),rf=n.n(nf),af=n(32);var of={Int8:Int8Array,UInt8:Uint8Array,Int16:Int16Array,UInt16:Uint16Array,Int32:Int32Array,UInt32:Uint32Array,Int64:Int32Array,UInt64:Uint32Array,Float32:Float32Array,Float64:Float64Array},sf={Int8:1,UInt8:1,Int16:2,UInt16:2,Int32:4,UInt32:4,Int64:8,UInt64:8,Float32:4,Float64:8};function uf(e){var t=e.length-1;return e.filter(function(e,n){return n1&&void 0!==arguments[1]?arguments[1]:{};t.url=n;var a=n.split("/");return a.pop(),t.baseURL=a.join("/"),e.loadData(r)},e.loadData=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.dataAccessHelper.fetchBinary(e,n)}(t.url,n).then(e.parseAsArrayBuffer)},e.parseAsArrayBuffer=function(n){if(!n)return!1;if(n===t.rawDataBuffer)return!0;e.modified();var r=function(e){return Rc.a.extractBinary(e,/^\s*\s*_/m,/\n\s*<\/AppendedData>/m)}(n),a=r.text,i=r.binaryBuffer;t.rawDataBuffer=n,t.binaryBuffer=i;var o=function(e){if(window.ActiveXObject){var t=new window.ActiveXObject("Microsoft.XMLDOM");return t.loadXML(e),t}return(new DOMParser).parseFromString(e,"application/xml")}(a).firstChild,s=o.getAttribute("type"),u=o.getAttribute("compressor"),l=o.getAttribute("byte_order"),c=o.getAttribute("header_type")||"UInt32";if(u&&"vtkZLibDataCompressor"!==u)return console.error("Invalid compressor",u),!1;if(l&&"LittleEndian"!==l)return console.error("Only LittleEndian encoding is supported"),!1;if(s!==t.dataType)return console.error("Invalid data type",s,"expecting",t.dataType),!1;if(o.querySelector("AppendedData")){var d=o.querySelector("AppendedData"),f=d.getAttribute("encoding"),p=o.querySelectorAll("Piece DataArray"),g=t.binaryBuffer;"base64"===f&&(g=d.textContent.trim().substr(1));for(var m=[],h=0;h0?0===b[3]?new ArrayBuffer(b[2]*w):new ArrayBuffer(b[2]*(w-1)+b[3]):new ArrayBuffer(0);for(var C=new Uint8Array(T),I={offset:0,uint8:C},x=0;x2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pf,n),g.a.obj(e,t),g.a.get(e,t,["url","baseURL"]),g.a.setGet(e,t,["dataAccessHelper"]),g.a.algo(e,t,0,1),ff(e,t)},processDataArray:df,processFieldData:function(e,t,n,r,i,o,s){if(t){var u={};["Scalars","Vectors","Normals","Tensors","TCoords"].forEach(function(e){var r=t.getAttribute(e);r&&(u[r]=n["set".concat(e)])});for(var l=t.getElementsByTagName("DataArray"),c=l.length,d=0;d2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,mf,n),gf.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkXMLImageDataReader"),e.parseXML=function(e,n,r,a,i){for(var s=e.getElementsByTagName(t.dataType)[0],u=s.getAttribute("Origin").split(" ").map(function(e){return Number(e)}),l=s.getAttribute("Spacing").split(" ").map(function(e){return Number(e)}),c=s.getElementsByTagName("Piece"),d=c.length,f=0;f3&&void 0!==arguments[3]?arguments[3]:"vtkZLibDataCompressor";if(t===Af.ASCII)return e.getData().join(" ");if(t===Af.BINARY){if("vtkZLibDataCompressor"===r){var a=e.getElementComponentSize(),i=e.getNumberOfValues()*a,o=n,s=i%o,u=Math.trunc(i/o)+(s?1:0),l=new Uint32Array(3+u);l[0]=u,l[1]=o,l[2]=s;for(var c=0,d=[],f=0,p=u-1,g=0;g2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tf,n),g.a.obj(e,t),g.a.setGet(e,t,["blockSize","format"]),g.a.get(e,t,["file"]),g.a.algo(e,t,1,0),function(e,t){t.classHierarchy.push("vtkXMLWriter"),e.create=function(e){return Mf.a.create("VTKFile").att("type",t.dataType).att("version","0.1").att("byte_order","LittleEndian").att("header_type","UInt32").att("compressor",t.format===Af.ASCII?"":"vtkZLibDataCompressor")},e.write=function(t){return e.create(t).end({pretty:!0})},e.processDataSetAttributes=function(t,n,r){var a={};["Scalars","Vectors","Normals","TCoords","Tensors","GlobalIds","PedigreeIds"].forEach(function(e){var t=r.getActiveAttribute(e);t&&(a[e]=t.getName())});for(var i=t.ele(n,a),o=0;o2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,If,n),Cf.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkXMLImageDataWriter");var n=Object.assign({},e);e.create=function(t){var r=n.create(t),a=r.ele("ImageData",{WholeExtent:t.getExtent().join(" "),Origin:t.getOrigin().join(" "),Spacing:t.getSpacing().join(" ")}).ele("Piece",{Extent:t.getExtent().join(" ")});return e.processDataSetAttributes(a,"PointData",t.getPointData()),e.processDataSetAttributes(a,"CellData",t.getCellData()),r}}(e,t)}var Sf={newInstance:g.a.newInstance(xf,"vtkXMLImageDataWriter"),extend:xf};function Nf(e,t){t.classHierarchy.push("vtkXMLPolyDataReader"),e.parseXML=function(e,n,r,a,i){for(var o=e.getElementsByTagName(t.dataType)[0].getElementsByTagName("Piece"),s=o.length,u=function(e){var n=Ie.a.newInstance(),s=o[e],u=function(e,t,n,r,a,i,o){var s=Number(n.getAttribute("NumberOf".concat(t)));if(s>0){var u=n.getElementsByTagName(t)[0].getElementsByTagName("DataArray")[0],l=gf.processDataArray(s,u,r,a,i,o),c=l.values,d=l.numberOfComponents;e["get".concat(t)]().setData(c,d)}return s}(n,"Points",s,r,a,i,t.binaryBuffer),l=0;["Verts","Lines","Strips","Polys"].forEach(function(e){l+=function(e,t,n,r,a,i,o){var s=Number(n.getAttribute("NumberOf".concat(t)));if(s>0){var u=gf.processCells(s,n.getElementsByTagName(t)[0],r,a,i,o);e["get".concat(t)]().setData(u)}return s}(n,e,s,r,a,i,t.binaryBuffer)}),gf.processFieldData(u,s.getElementsByTagName("PointData")[0],n.getPointData(),r,a,i,t.binaryBuffer),gf.processFieldData(l,s.getElementsByTagName("CellData")[0],n.getCellData(),r,a,i,t.binaryBuffer),t.output[e]=n},l=0;l2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ef,n),gf.extend(e,t,n),Nf(e,t)}var Lf={newInstance:g.a.newInstance(Of,"vtkXMLPolyDataReader"),extend:Of},Pf=n(53);var kf={dataType:"PolyData"};function Rf(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kf,n),Cf.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkXMLPolyDataWriter");var n=Object.assign({},e);e.create=function(t){var r=n.create(t),i=r.ele("PolyData",{}).ele("Piece",{NumberOfPoints:t.getPoints().getNumberOfPoints(),NumberOfVerts:t.getNumberOfVerts(),NumberOfLines:t.getNumberOfLines(),NumberOfStrips:t.getNumberOfStrips(),NumberOfPolys:t.getNumberOfPolys()});return e.processDataSetAttributes(i,"PointData",t.getPointData()),e.processDataSetAttributes(i,"CellData",t.getCellData()),e.processDataArray(i.ele("Points"),t.getPoints()),Pf.a.forEach(function(n){for(var r=n.replace(/(?:^\w|[A-Z]|\b\w)/g,function(e){return e.toUpperCase()}).replace(/\s+/g,""),o=[],s=[],u=t["get".concat(r)]().getData(),l=u[0],c=0,d=0;d2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_f,n),g.a.obj(e,t),g.a.setGet(e,t,["opacity","lineWidth","pointSize","displayLocation"]),g.a.setGetArray(e,t,["color"],3),function(e,t){t.classHierarchy.push("vtkProperty2D")}(0,t)}var Ff={newInstance:g.a.newInstance(Vf,"vtkProperty2D"),extend:Vf};var Uf={mapper:null,property:null,layerNumber:0,positionCoordinate:null,positionCoordinate2:null};function Gf(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uf,n),Cu.a.extend(e,t,n),t.positionCoordinate=bu.newInstance(),t.positionCoordinate.setCoordinateSystemToViewport(),t.positionCoordinate2=bu.newInstance(),t.positionCoordinate2.setCoordinateSystemToNormalizedViewport(),t.positionCoordinate2.setValue(.5,.5),t.positionCoordinate2.setReferenceCoordinate(t.positionCoordinate),g.a.set(e,t,["property"]),g.a.setGet(e,t,["mapper"]),function(e,t){t.classHierarchy.push("vtkActor2D"),e.getActors2D=function(){return e},e.getIsOpaque=function(){t.property||e.getProperty();var n=t.property.getOpacity()>=1;return n=(n=n&&(!t.texture||!t.texture.isTranslucent()))&&(!t.mapper||t.mapper.getIsOpaque())},e.hasTranslucentPolygonalGeometry=function(){return null!==t.mapper&&(null===t.property&&e.setProperty(e.makeProperty()),!e.getIsOpaque())},e.makeProperty=Ff.newInstance,e.getProperty=function(){return null===t.property&&(t.property=e.makeProperty()),t.property},e.setDisplayPosition=function(e,n){t.positionCoordinate.setCoordinateSystem(gu.DISPLAY),t.positionCoordinate.setValue(e,n,0)},e.setWidth=function(e){var n=t.position2Coordinate.getValue();t.position2Coordinate.setCoordinateSystemToNormalizedViewport(),t.position2Coordinate.setValue(e,n[1])},e.setHeight=function(e){var n=t.position2Coordinate.getValue();t.position2Coordinate.setCoordinateSystemToNormalizedViewport(),t.position2Coordinate.setValue(n[0],e)},e.getWidth=function(){return t.position2Coordinate.getValue()[0]},e.getHeight=function(){return t.position2Coordinate.getValue()[1]},e.getMTime=function(){var e=t.mtime;if(null!==t.property){var n=t.property.getMTime();e=n>e?n:e}return e=t.positionCoordinate.getMTime()>e?t.positionCoordinate.getMTime():e,e=t.positionCoordinate2.getMTime()>e?t.positionCoordinate2.getMTime():e},e.getRedrawMTime=function(){var e=t.mtime;if(null!==t.mapper){var n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),e=(n=t.mapper.getInput().getMTime())>e?n:e)}return e},e.getBounds=function(){return"function"==typeof e.getMapper().getBounds?(t.useBounds=!0,e.getMapper().getBounds()):(t.useBounds=!1,[])},e.getActualPositionCoordinate=function(){return t.positionCoordinate},e.getActualPositionCoordinate2=function(){return t.positionCoordinate2}}(e,t)}var Wf={newInstance:g.a.newInstance(Gf,"vtkActor2D"),extend:Gf},Qf={default:{defaultStyle:{fontStyle:"bold",fontFamily:"Arial",fontColor:"black",fontSizeScale:function(e){return e/2},faceColor:"white",edgeThickness:.1,edgeColor:"black",resolution:400},xMinusFaceProperty:{text:"X-",faceColor:"yellow"},xPlusFaceProperty:{text:"X+",faceColor:"yellow"},yMinusFaceProperty:{text:"Y-",faceColor:"red"},yPlusFaceProperty:{text:"Y+",faceColor:"red"},zMinusFaceProperty:{text:"Z-",faceColor:"#008000"},zPlusFaceProperty:{text:"Z+",faceColor:"#008000"}},lps:{xMinusFaceProperty:{text:"R",faceRotation:-90},xPlusFaceProperty:{text:"L",faceRotation:90},yMinusFaceProperty:{text:"A",faceRotation:0},yPlusFaceProperty:{text:"P",faceRotation:180},zMinusFaceProperty:{text:"I",faceRotation:180},zPlusFaceProperty:{text:"S",faceRotation:0}}};function Yf(e,t){t.set(e)}var Hf={applyDefinitions:Yf,applyPreset:function(e,t){return Yf(Qf[e],t)},registerStylePreset:function(e,t){Qf[e]=t}},Kf={xPlus:0,xMinus:1,yPlus:2,yMinus:3,zPlus:4,zMinus:5};var Xf={defaultStyle:{text:"",faceColor:"white",faceRotation:0,fontFamily:"Arial",fontColor:"black",fontStyle:"normal",fontSizeScale:function(e){return e/1.8},edgeThickness:.1,edgeColor:"black",resolution:200}};function qf(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xf,n),su.a.extend(e,t,n),g.a.get(e,t,["defaultStyle","xPlusFaceProperty","xMinusFaceProperty","yPlusFaceProperty","yMinusFaceProperty","zPlusFaceProperty","zMinusFaceProperty"]),function(e,t){t.classHierarchy.push("vtkAnnotatedCubeActor"),t.xPlusFaceProperty=Object.assign({},t.xPlusFaceProperty),t.xMinusFaceProperty=Object.assign({},t.xMinusFaceProperty),t.yPlusFaceProperty=Object.assign({},t.yPlusFaceProperty),t.yMinusFaceProperty=Object.assign({},t.yMinusFaceProperty),t.zPlusFaceProperty=Object.assign({},t.zPlusFaceProperty),t.zMinusFaceProperty=Object.assign({},t.zMinusFaceProperty);var n=null,r=document.createElement("canvas"),a=uu.a.newInstance(),i=Od.a.newInstance();function o(n){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;a&&Object.assign(t["".concat(n,"FaceProperty")],a);var o=Object.assign({},t.defaultStyle,t["".concat(n,"FaceProperty")]);r.width=o.resolution,r.height=o.resolution;var s=r.getContext("2d");s.fillStyle=o.faceColor,s.fillRect(0,0,r.width,r.height),o.edgeThickness>0&&(s.strokeStyle=o.edgeColor,s.lineWidth=o.edgeThickness*r.width,s.strokeRect(0,0,r.width,r.height)),s.save(),s.translate(0,r.height),s.scale(1,-1),s.translate(r.width/2,r.height/2),s.rotate(-Math.PI*(o.faceRotation/180));var u=o.fontSizeScale(o.resolution);s.fillStyle=o.fontColor,s.textAlign="center",s.textBaseline="middle",s.font="".concat(o.fontStyle," ").concat(u,'px "').concat(o.fontFamily,'"'),s.fillText(o.text,0,0),s.restore();var c=l.canvasToImageData(r);i.setInputData(c,Kf[n]),e.modified()}function s(){n=xr.newInstance({generate3DTextureCoordinates:!0}),a.setInputConnection(n.getOutputPort()),o("xPlus"),o("xMinus"),o("yPlus"),o("yMinus"),o("zPlus"),o("zMinus")}i.setInterpolate(!0),e.setDefaultStyle=function(e){t.defaultStyle=Object.assign({},t.defaultStyle,e),s()},e.setXPlusFaceProperty=function(e){return o("xPlus",e)},e.setXMinusFaceProperty=function(e){return o("xMinus",e)},e.setYPlusFaceProperty=function(e){return o("yPlus",e)},e.setYMinusFaceProperty=function(e){return o("yMinus",e)},e.setZPlusFaceProperty=function(e){return o("zPlus",e)},e.setZMinusFaceProperty=function(e){return o("zMinus",e)},s(),a.setInputConnection(n.getOutputPort()),e.setMapper(a),e.addTexture(i)}(e,t)}var Zf={newInstance:g.a.newInstance(qf,"vtkAnnotatedCubeActor"),extend:qf,Presets:Hf};function Jf(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tp,n),su.a.extend(e,t,n),g.a.setGet(e,t,["config"]),g.a.setGetArray(e,t,["xAxisColor","yAxisColor","zAxisColor"],3,255),function(e,t){t.classHierarchy.push("vtkAxesActor"),e.update=function(){var n=hr.newInstance(Object.assign({direction:[1,0,0]},t.config)).getOutputData();$f(n),ep.apply(void 0,[n].concat(Jf(t.xAxisColor)));var r=hr.newInstance(Object.assign({direction:[0,1,0]},t.config)).getOutputData();$f(r),ep.apply(void 0,[r].concat(Jf(t.yAxisColor)));var a=hr.newInstance(Object.assign({direction:[0,0,1]},t.config)).getOutputData();$f(a),ep.apply(void 0,[a].concat(Jf(t.zAxisColor)));var i=Et.newInstance();i.setInputData(n),i.addInputData(r),i.addInputData(a);var o=uu.a.newInstance();o.setInputConnection(i.getOutputPort()),e.setMapper(o)},e.update()}(e,t)}var rp={newInstance:g.a.newInstance(np,"vtkAxesActor"),extend:np},ap={ColorSpace:{RGB:0,HSV:1,LAB:2,DIVERGING:3},Scale:{LINEAR:0,LOG10:1}},ip=ap.ColorSpace,op=ap.Scale,sp=y.a.ScalarMappingTarget,up=g.a.vtkDebugMacro,lp=g.a.vtkErrorMacro,cp=g.a.vtkWarningMacro;function dp(e,t){var n=e[0],r=e[1],a=e[2],i=Math.sqrt(n*n+r*r+a*a),o=i>.001?Math.acos(n/i):0,s=o>.001?Math.atan2(a,r):0;t[0]=i,t[1]=o,t[2]=s}function fp(e,t){if(e[0]>=t-.1)return e[2];var n=e[1]*Math.sqrt(t*t-e[0]*e[0])/(e[0]*Math.sin(e[1]));return e[2]>-.3*Math.PI?e[2]+n:e[2]-n}function pp(e,t,n,r){var a=[],i=[];d.a.rgb2lab(t,a),d.a.rgb2lab(n,i);var o=[],s=[];dp(a,o),dp(i,s);var u=e;if(o[1]>.05&&s[1]>.05&&function(e,t){var n=e-t;for(n<0&&(n=-n);n>=2*Math.PI;)n-=2*Math.PI;return n>Math.PI&&(n=2*Math.PI-n),n}(o[2],s[2])>.33*Math.PI){var l=Math.max(o[0],s[0]);l=Math.max(88,l),e<.5?(s[0]=l,s[1]=0,s[2]=0,u*=2):(o[0]=l,o[1]=0,o[2]=0,u=2*u-1)}o[1]<.05&&s[1]>.05?o[2]=fp(s,o[0]):s[1]<.05&&o[1]>.05&&(s[2]=fp(o,s[0]));var c=[];c[0]=(1-u)*o[0]+u*s[0],c[1]=(1-u)*o[1]+u*s[1],c[2]=(1-u)*o[2]+u*s[2];var f=[];!function(e,t){var n=e[0],r=e[1],a=e[2];t[0]=n*Math.cos(r),t[1]=n*Math.sin(r)*Math.cos(a),t[2]=n*Math.sin(r)*Math.sin(a)}(c,f),d.a.lab2rgb(f,r)}var gp={clamping:!0,colorSpace:ip.RGB,hSVWrap:!0,scale:op.LINEAR,nanColor:null,belowRangeColor:null,aboveRangeColor:null,useAboveRangeColor:!1,useBelowRangeColor:!1,allowDuplicateScalars:!1,table:null,tableSize:0,buildTime:null,nodes:null};function mp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gp,n),y.a.extend(e,t,n),t.table=[],t.nodes=[],t.nanColor=[.5,0,0,1],t.belowRangeColor=[0,0,0,1],t.aboveRangeColor=[1,1,1,1],t.buildTime={},g.a.obj(t.buildTime),g.a.get(e,t,["buildTime","mappingRange"]),g.a.setGet(e,t,["useAboveRangeColor","useBelowRangeColor","colorSpace"]),g.a.setArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"],4),g.a.getArray(e,t,["nanColor","belowRangeColor","aboveRangeColor"]),function(e,t){t.classHierarchy.push("vtkColorTransferFunction"),e.getSize=function(){return t.nodes.length},e.addRGBPoint=function(t,n,r,a){return e.addRGBPointLong(t,n,r,a,.5,0)},e.addRGBPointLong=function(n,r,a,i,o,s){if(o<0||o>1)return lp("Midpoint outside range [0.0, 1.0]"),-1;if(s<0||s>1)return lp("Sharpness outside range [0.0, 1.0]"),-1;t.allowDuplicateScalars||e.removePoint(n);var u={x:n,r:r,g:a,b:i,midpoint:o,sharpness:s};t.nodes.push(u),e.sortAndUpdateRange();for(var l=0;l=t.nodes.length)return-1;var i=!1;return t.nodes.splice(r,1),0!==r&&r!==t.nodes.length||(i=e.updateRange()),i||e.modified(),a},e.movePoint=function(n,r){if(n!==r){e.removePoint(r);for(var a=0;a=n&&t.nodes[c].x<=o?t.nodes.splice(c,1):c++;e.addRGBPointLong(n,r,a,i,.5,0),e.addRGBPointLong(o,s,u,l,.5,0),e.modified()},e.addHSVSegment=function(t,n,r,a,i,o,s,u){var l=[n,r,a],c=[o,s,u],f=[],p=[];d.a.hsv2rgb(l,f),d.a.hsv2rgb(c,p),e.addRGBSegment(t,f[0],f[1],f[2],i,p[0],p[1],p[2])},e.mapValue=function(t){var n=[];return e.getColor(t,n),[Math.floor(255*n[0]+.5),Math.floor(255*n[1]+.5),Math.floor(255*n[2]+.5),255]},e.getColor=function(n,r){if(t.indexedLookup){var a=e.getSize(),i=e.getAnnotatedValueIndexInternal(n);if(i<0||0===a)e.getNanColor(r);else{var o=[];e.getNodeValue(i%a,o),r[0]=o.r,r[1]=o.g,r[2]=o.b}}else e.getTable(n,n,1,r)},e.getRedValue=function(t){var n=[];return e.getColor(t,n),n[0]},e.getGreenValue=function(t){var n=[];return e.getColor(t,n),n[1]},e.getBlueValue=function(t){var n=[];return e.getColor(t,n),n[2]},e.getTable=function(n,r,a,i){if(d.a.isNan(n)||d.a.isNan(r))for(var o=0;o0);var w=0,D=0,T=0;b&&(w=Math.log10(n),D=Math.log10(r));for(var C=0;C1?b?(T=w+C/(a-1)*(D-w),p=Math.pow(10,T)):p=n+C/(a-1)*(r-n):b?(T=.5*(w+D),p=Math.pow(10,T)):p=.5*(n+r);st.nodes[s].x;)++s.99999&&(y=.99999));if(p>t.mappingRange[1])i[I]=0,i[I+1]=0,i[I+2]=0,t.clamping&&(e.getUseAboveRangeColor()?(i[I]=t.aboveRangeColor[0],i[I+1]=t.aboveRangeColor[1],i[I+2]=t.aboveRangeColor[2]):(i[I]=l,i[I+1]=c,i[I+2]=f));else if(p0&&(i[I]=t.nodes[0].r,i[I+1]=t.nodes[0].g,i[I+2]=t.nodes[0].b));else if(0===s&&Math.abs(p-n)<1e-6)u>0?(i[I]=t.nodes[0].r,i[I+1]=t.nodes[0].g,i[I+2]=t.nodes[0].b):(i[I]=0,i[I+1]=0,i[I+2]=0);else{var x=0;if(x=(x=b?(T-g)/(m-g):(p-g)/(m-g)).99){if(x<.5){i[I]=h[0],i[I+1]=h[1],i[I+2]=h[2];continue}i[I]=v[0],i[I+1]=v[1],i[I+2]=v[2];continue}if(M<.01){if(t.colorSpace===ip.RGB)i[I]=(1-x)*h[0]+x*v[0],i[I+1]=(1-x)*h[1]+x*v[1],i[I+2]=(1-x)*h[2]+x*v[2];else if(t.colorSpace===ip.HSV){var S=[],N=[];d.a.rgb2hsv(h,S),d.a.rgb2hsv(v,N),t.hSVWrap&&(S[0]-N[0]>.5||N[0]-S[0]>.5)&&(S[0]>N[0]?S[0]-=1:N[0]-=1);var E=[];E[0]=(1-x)*S[0]+x*N[0],E[0]<0&&(E[0]+=1),E[1]=(1-x)*S[1]+x*N[1],E[2]=(1-x)*S[2]+x*N[2],d.a.hsv2rgb(E,A),i[I]=A[0],i[I+1]=A[1],i[I+2]=A[2]}else if(t.colorSpace===ip.LAB){var O=[],L=[];d.a.rgb2lab(h,O),d.a.rgb2lab(v,L);var P=[];P[0]=(1-x)*O[0]+x*L[0],P[1]=(1-x)*O[1]+x*L[1],P[2]=(1-x)*O[2]+x*L[2],d.a.lab2rgb(P,A),i[I]=A[0],i[I+1]=A[1],i[I+2]=A[2]}else t.colorSpace===ip.DIVERGING?(pp(x,h,v,A),i[I]=A[0],i[I+1]=A[1],i[I+2]=A[2]):lp("ColorSpace set to invalid value.",t.colorSpace);continue}x<.5?x=.5*Math.pow(2*x,1+10*M):x>.5&&(x=1-.5*Math.pow(2*(1-x),1+10*M));var k=x*x,R=k*x,j=2*R-3*k+1,B=-2*R+3*k,z=R-2*k+x,_=R-k,V=void 0;if(t.colorSpace===ip.RGB)for(var F=0;F<3;F++)V=(1-M)*(v[F]-h[F]),i[I+F]=j*h[F]+B*v[F]+z*V+_*V;else if(t.colorSpace===ip.HSV){var U=[],G=[];d.a.rgb2hsv(h,U),d.a.rgb2hsv(v,G),t.hSVWrap&&(U[0]-G[0]>.5||G[0]-U[0]>.5)&&(U[0]>G[0]?U[0]-=1:G[0]-=1);for(var W=[],Q=0;Q<3;Q++)V=(1-M)*(G[Q]-U[Q]),W[Q]=j*U[Q]+B*G[Q]+z*V+_*V,0===Q&&W[Q]<0&&(W[Q]+=1);d.a.hsv2rgb=A,i[I]=A[0],i[I+1]=A[1],i[I+2]=A[2]}else if(t.colorSpace===ip.LAB){var Y=[],H=[];d.a.rgb2lab(h,Y),d.a.rgb2lab(v,H);for(var K=[],X=0;X<3;X++)V=(1-M)*(H[X]-Y[X]),K[X]=j*Y[X]+B*H[X]+z*V+_*V;d.a.lab2rgb(K,A),i[I]=A[0],i[I+1]=A[1],i[I+2]=A[2]}else t.colorSpace===ip.DIVERGING?(pp(x,h,v,A),i[I]=A[0],i[I+1]=A[1],i[I+2]=A[2]):lp("ColorSpace set to invalid value.");for(var q=0;q<3;q++)i[I+q]=i[I+q]<0?0:i[I+q],i[I+q]=i[I+q]>1?1:i[I+q]}}}},e.getUint8Table=function(n,r,a){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.getMTime()<=t.buildTime&&t.tableSize===a&&t.tableWithAlpha!==i)return t.table;if(0===t.nodes.length)return lp("Attempting to lookup a value with no points in the function"),t.table;var o=i?4:3;t.tableSize===a&&t.tableWithAlpha===i||(t.table=new Uint8Array(a*o),t.tableSize=a,t.tableWithAlpha=i);var s=[];e.getTable(n,r,a,s);for(var u=0;u1&&(o=(r-n)/(a-1));for(var s=0;s=t.nodes.length?(lp("Index out of range!"),-1):(n[0]=t.nodes[e].x,n[1]=t.nodes[e].r,n[2]=t.nodes[e].g,n[3]=t.nodes[e].b,n[4]=t.nodes[e].midpoint,n[5]=t.nodes[e].sharpness,1)},e.setNodeValue=function(n,r){if(n<0||n>=t.nodes.length)return lp("Index out of range!"),-1;var a=t.nodes[n].x;return t.nodes[n].x=r[0],t.nodes[n].r=r[1],t.nodes[n].g=r[2],t.nodes[n].b=r[3],t.nodes[n].midpoint=r[4],t.nodes[n].sharpness=r[5],a!==r[0]?e.sortAndUpdateRange():e.modified(),1},e.getNumberOfAvailableColors=function(){return t.indexedLookup&&e.getSize()?e.getSize():t.tableSize?t.tableSize:16777216},e.getIndexedColor=function(t,n){var r=e.getSize();if(r>0&&t>=0){var a=[];e.getNodeValue(t%r,a);for(var i=0;i<3;++i)n[i]=a[i+1];n[3]=1}else e.getNanColor(n),n[3]=1},e.fillFromDataPointer=function(t,n){if(!(t<=0)&&n){e.removeAllPoints();for(var r=0;rn[1]?(e.getColor(n[1],a),e.addRGBPoint(n[1],a[0],a[1],a[2])):(e.getColor(r[1],a),e.addRGBPoint(n[1],a[0],a[1],a[2])),e.sortAndUpdateRange();for(var i=0;i=n[0]&&t.nodes[i].x<=n[1]?t.nodes.splice(i,1):++i;return 1},e.estimateMinNumberOfSamples=function(t,n){var r=e.findMinimumXDistance();return Math.ceil((n-t)/r)},e.findMinimumXDistance=function(){if(t.nodes.length<2)return-1;for(var e=Number.MAX_VALUE,n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wp,n),uu.a.extend(e,t,n),g.a.algo(e,t,2,0),t.buildTime={},g.a.obj(t.buildTime,{mtime:0}),t.boundsTime={},g.a.obj(t.boundsTime,{mtime:0}),g.a.setGet(e,t,["orient","orientationMode","orientationArray","scaleArray","scaleFactor","scaleMode","scaling"]),g.a.get(e,t,["colorArray","matrixArray","normalArray","buildTime"]),function(e,t){t.classHierarchy.push("vtkGlyph3DMapper"),e.getOrientationModeAsString=function(){return g.a.enumToString(Mp,t.orientationMode)},e.setOrientationModeToDirection=function(){return e.setOrientationMode(Mp.DIRECTION)},e.setOrientationModeToRotation=function(){return e.setOrientationMode(Mp.ROTATION)},e.getOrientationArrayData=function(){var n=e.getInputData(0);return n&&n.getPointData()?t.orientationArray?n.getPointData().getArray(t.orientationArray):n.getPointData().getVectors():null},e.getScaleModeAsString=function(){return g.a.enumToString(Ap,t.scaleMode)},e.setScaleModeToScaleByMagnitude=function(){return e.setScaleMode(Ap.SCALE_BY_MAGNITUDE)},e.setScaleModeToScaleByComponents=function(){return e.setScaleMode(Ap.SCALE_BY_COMPONENTS)},e.setScaleModeToScaleByConstant=function(){return e.setScaleMode(Ap.SCALE_BY_CONSTANT)},e.getScaleArrayData=function(){var n=e.getInputData(0);return n&&n.getPointData()?t.scaleArray?n.getPointData().getArray(t.scaleArray):n.getPointData().getScalars():null},e.getBounds=function(){var n=e.getInputData(0),r=e.getInputData(1);return n&&r?(e.buildArrays(),t.bounds):d.a.createUninitializedBounds()},e.buildArrays=function(){var n=e.getInputData(0),r=e.getInputData(1);if(t.buildTime.getMTime()t.bounds[1]&&(t.bounds[1]=c[0]),c[1]>t.bounds[3]&&(t.bounds[3]=c[1]),c[2]>t.bounds[5]&&(t.bounds[5]=c[2]);var S=new Float32Array(y,36*A,9);Ye.b.fromMat4(S,b),Ye.b.invert(S,S),Ye.b.transpose(S,S)}var N=e.getAbstractScalars(n,t.scalarMode,t.arrayAccessMode,t.arrayId,t.colorByArrayName).scalars;t.useLookupTableScalarRange||e.getLookupTable().setRange(t.scalarRange[0],t.scalarRange[1]),t.colorArray=null;var O=e.getLookupTable();O&&N&&(O.build(),t.colorArray=O.mapScalars(N,t.colorMode,0)),t.buildTime.modified()}},e.getPrimitiveCount=function(){var t=e.getInputData(1),n=e.getInputData().getPoints().getNumberOfValues()/3;return{points:n*t.getPoints().getNumberOfValues()/3,verts:n*(t.getVerts().getNumberOfValues()-t.getVerts().getNumberOfCells()),lines:n*(t.getLines().getNumberOfValues()-2*t.getLines().getNumberOfCells()),triangles:n*(t.getPolys().getNumberOfValues()-3*t.getLines().getNumberOfCells())}}}(e,t)}var Tp=g.a.newInstance(Dp,"vtkGlyph3DMapper"),Cp=Object.assign({newInstance:Tp,extend:Dp},yp),Ip={SlicingMode:{NONE:-1,I:0,J:1,K:2,X:3,Y:4,Z:5}},xp=g.a.vtkWarningMacro,Sp=Ip.SlicingMode;var Np={displayExtent:[0,0,0,0,0,0],customDisplayExtent:[0,0,0,0],useCustomExtents:!1,slice:0,slicingMode:Sp.NONE,closestIJKAxis:{ijkMode:Sp.NONE,flip:!1},renderToRectangle:!1,sliceAtFocalPoint:!1};function Ep(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Np,n),Bf.a.extend(e,t,n),g.a.get(e,t,["slicingMode"]),g.a.setGet(e,t,["slice","closestIJKAxis","useCustomExtents","renderToRectangle","sliceAtFocalPoint"]),g.a.setGetArray(e,t,["customDisplayExtent"],4),function(e,t){function n(){var n;switch(t.slicingMode){case Sp.X:n=[1,0,0];break;case Sp.Y:n=[0,1,0];break;case Sp.Z:n=[0,0,1];break;default:return void(t.closestIJKAxis={ijkMode:t.slicingMode,flip:!1})}var r=[0,0,0],a=e.getInputData().getDirection(),i=[[a[0],a[1],a[2]],[a[3],a[4],a[5]],[a[6],a[7],a[8]]];d.a.multiply3x3_vect3(i,n,r);for(var o=0,s=-1,u=!1,l=0;lo&&(o=c,u=r[l]<0,s=l)}if(1!==o){var f="IJKXYZ"[t.slicingMode],p="IJKXYZ"[s];xp("Unaccurate slicing along ".concat(f," axis which ")+"is not aligned with any IJK axis of the image data. "+"Using ".concat(p," axis as a fallback (").concat(o,"% aligned). ")+"Necessitates slice reformat that is not yet implemented. You can switch the slicing mode on your mapper to do IJK slicing instead.")}t.closestIJKAxis={ijkMode:s,flip:u}}function r(n,r){var a=e.getInputData(),i=a.getExtent(),o=[i[0],i[2],i[4]],s=e.getClosestIJKAxis().ijkMode,u=t.slice;s!==t.slicingMode&&(u=e.getSliceAtPosition(u)),o[s]+=u;var l=[0,0,0];a.indexToWorld(o,l),o[s]+=1;var c=[0,0,0];a.indexToWorld(o,c),c[0]-=l[0],c[1]-=l[1],c[2]-=l[2],Ye.e.normalize(c,c);var d=Te.a.intersectWithLine(n,r,l,c);if(d.intersection){var f=d.x,p=[0,0,0];return a.worldToIndex(f,p),{t:d.t,absoluteIJK:p}}return null}t.classHierarchy.push("vtkImageMapper"),e.getSliceAtPosition=function(n){var r,a=e.getInputData();if(3===n.length)r=n;else if(Number.isFinite(n)){var i=a.getBounds();switch(t.slicingMode){case Sp.X:r=[n,(i[3]+i[2])/2,(i[5]+i[4])/2];break;case Sp.Y:r=[(i[1]+i[0])/2,n,(i[5]+i[4])/2];break;case Sp.Z:r=[(i[1]+i[0])/2,(i[3]+i[2])/2,n]}}var o=[0,0,0];a.worldToIndex(r,o);var s=a.getExtent(),u=0;switch(e.getClosestIJKAxis().ijkMode){case Sp.I:u=d.a.clampValue(o[0],s[0],s[1]),u=Math.round(u);break;case Sp.J:u=d.a.clampValue(o[1],s[2],s[3]),u=Math.round(u);break;case Sp.K:u=d.a.clampValue(o[2],s[4],s[5]),u=Math.round(u);break;default:return 0}return u},e.setSliceFromCamera=function(n){var r=n.getFocalPoint();switch(t.slicingMode){case Sp.I:case Sp.J:case Sp.K:var a=e.getSliceAtPosition(r);e.setSlice(a);break;case Sp.X:e.setSlice(r[0]);break;case Sp.Y:e.setSlice(r[1]);break;case Sp.Z:e.setSlice(r[2])}},e.setXSlice=function(t){e.setSlicingMode(Sp.X),e.setSlice(t)},e.setYSlice=function(t){e.setSlicingMode(Sp.Y),e.setSlice(t)},e.setZSlice=function(t){e.setSlicingMode(Sp.Z),e.setSlice(t)},e.setISlice=function(t){e.setSlicingMode(Sp.I),e.setSlice(t)},e.setJSlice=function(t){e.setSlicingMode(Sp.J),e.setSlice(t)},e.setKSlice=function(t){e.setSlicingMode(Sp.K),e.setSlice(t)},e.getSlicingModeNormal=function(){var n=[0,0,0],r=e.getInputData().getDirection(),a=[[r[0],r[1],r[2]],[r[3],r[4],r[5]],[r[6],r[7],r[8]]];switch(t.slicingMode){case Sp.X:n[0]=1;break;case Sp.Y:n[1]=1;break;case Sp.Z:n[2]=1;break;case Sp.I:d.a.multiply3x3_vect3(a,[1,0,0],n);break;case Sp.J:d.a.multiply3x3_vect3(a,[0,1,0],n);break;case Sp.K:d.a.multiply3x3_vect3(a,[0,0,1],n)}return n},e.setSlicingMode=function(r){t.slicingMode!==r&&(t.slicingMode=r,e.getInputData()&&n(),e.modified())},e.getClosestIJKAxis=function(){return void 0!==t.closestIJKAxis&&t.closestIJKAxis.ijkMode!==Sp.NONE||!e.getInputData()||n(),t.closestIJKAxis},e.getBounds=function(){var n=e.getInputData();if(!n)return d.a.createUninitializedBounds();if(!t.useCustomExtents)return n.getBounds();var r=t.customDisplayExtent.slice(),a=e.getClosestIJKAxis().ijkMode,i=t.slice;switch(a!==t.slicingMode&&(i=e.getSliceAtPosition(t.slice)),a){case Sp.I:r[0]=i,r[1]=i;break;case Sp.J:r[2]=i,r[3]=i;break;case Sp.K:r[4]=i,r[5]=i}return n.extentToBounds(r)},e.getBoundsForSlice=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.slice,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=e.getInputData();if(!a)return d.a.createUninitializedBounds();var i=a.getExtent(),o=e.getClosestIJKAxis().ijkMode,s=n;switch(o!==t.slicingMode&&(s=e.getSliceAtPosition(n)),o){case Sp.I:i[0]=s-r,i[1]=s+r;break;case Sp.J:i[2]=s-r,i[3]=s+r;break;case Sp.K:i[4]=s-r,i[5]=s+r}return a.extentToBounds(i)},e.getIsOpaque=function(){return!0},e.intersectWithLineForPointPicking=function(t,n){var a=r(t,n);if(a){var i=e.getInputData().getExtent(),o=[Math.round(a.absoluteIJK[0]),Math.round(a.absoluteIJK[1]),Math.round(a.absoluteIJK[2])];return o[0]i[1]||o[1]i[3]||o[2]i[5]?null:{t:a.t,ijk:o}}return null},e.intersectWithLineForCellPicking=function(t,n){var a=r(t,n);if(a){var i=e.getInputData().getExtent(),o=a.absoluteIJK,s=[Math.floor(o[0]),Math.floor(o[1]),Math.floor(o[2])];if(s[0]i[1]-1||s[1]i[3]-1||s[2]i[5]-1)return null;var u=[o[0]-s[0],o[1]-s[1],o[2]-s[2]];return{t:a.t,ijk:s,pCoords:u}}return null}}(e,t)}var Op=g.a.newInstance(Ep,"vtkImageMapper"),Lp=Object.assign({newInstance:Op,extend:Ep},Ip),Pp={NEAREST:0,LINEAR:1},kp=Pp;var Rp={interpolationType:kp.LINEAR,colorWindow:255,colorLevel:127.5,ambient:1,diffuse:0,opacity:1,rGBTransferFunction:null,scalarOpacity:null};function jp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rp,n),g.a.obj(e,t),g.a.setGet(e,t,["interpolationType","colorWindow","colorLevel","ambient","diffuse","opacity","rGBTransferFunction","scalarOpacity"]),e.getMTime=function(){var e=t.mtime;if(t.rGBTransferFunction){var n=t.rGBTransferFunction.getMTime();e=n>e?n:e}return e},function(e,t){t.classHierarchy.push("vtkImageProperty"),e.setInterpolationTypeToNearest=function(){e.setInterpolationType(kp.NEAREST)},e.setInterpolationTypeToLinear=function(){e.setInterpolationType(kp.LINEAR)},e.getInterpolationTypeAsString=function(){return g.a.enumToString(kp,t.interpolationType)}}(e,t)}var Bp={newInstance:g.a.newInstance(jp,"vtkImageProperty"),extend:jp},zp=n(43),_p=g.a.vtkDebugMacro;var Vp={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function Fp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vp,n),zp.a.extend(e,t,n),t.boundsMTime={},g.a.obj(t.boundsMTime),g.a.set(e,t,["property"]),g.a.setGet(e,t,["mapper"]),g.a.getArray(e,t,["bounds"],6),function(e,t){t.classHierarchy.push("vtkImageSlice"),e.getActors=function(){return e},e.getImages=function(){return e},e.getIsOpaque=function(){if(t.forceOpaque)return!0;if(t.forceTranslucent)return!1;t.property||e.getProperty();var n=t.property.getOpacity()>=1;return n=n&&(!t.mapper||t.mapper.getIsOpaque())},e.hasTranslucentPolygonalGeometry=function(){return!1},e.makeProperty=Bp.newInstance,e.getProperty=function(){return null===t.property&&(t.property=e.makeProperty()),t.property},e.getBounds=function(){if(null===t.mapper)return t.bounds;var n,r=t.mapper.getBounds();if(!r||6!==r.length)return r;if(r[0]>r[1])return t.mapperBounds=r.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),r;if(!t.mapperBounds||!(n=[r,t.mapperBounds],n[0].map(function(e,t){return n.map(function(e){return e[t]})})).reduce(function(e,t){return e&&t[0]===t[1]},!0)||e.getMTime()>t.boundsMTime.getMTime()){_p("Recomputing bounds..."),t.mapperBounds=r.map(function(e){return e});var a=[Ye.e.fromValues(r[1],r[3],r[5]),Ye.e.fromValues(r[1],r[2],r[5]),Ye.e.fromValues(r[0],r[2],r[5]),Ye.e.fromValues(r[0],r[3],r[5]),Ye.e.fromValues(r[1],r[3],r[4]),Ye.e.fromValues(r[1],r[2],r[4]),Ye.e.fromValues(r[0],r[2],r[4]),Ye.e.fromValues(r[0],r[3],r[4])];e.computeMatrix();var i=Ye.c.create();Ye.c.transpose(i,t.matrix),a.forEach(function(e){return Ye.e.transformMat4(e,e,i)}),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(function(e,t){return t%2==0?a.reduce(function(e,n){return e>n[t/2]?n[t/2]:e},e):a.reduce(function(e,n){return e1&&void 0!==arguments[1]?arguments[1]:0,a=t.mapper.getBoundsForSlice(n,r);if(!a||6!==a.length)return a;if(a[0]>a[1])return a;var i=[Ye.e.fromValues(a[1],a[3],a[5]),Ye.e.fromValues(a[1],a[2],a[5]),Ye.e.fromValues(a[0],a[2],a[5]),Ye.e.fromValues(a[0],a[3],a[5]),Ye.e.fromValues(a[1],a[3],a[4]),Ye.e.fromValues(a[1],a[2],a[4]),Ye.e.fromValues(a[0],a[2],a[4]),Ye.e.fromValues(a[0],a[3],a[4])];e.computeMatrix();var o=Ye.c.create();Ye.c.transpose(o,t.matrix),i.forEach(function(e){return Ye.e.transformMat4(e,e,o)});var s=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];return s=s.map(function(e,t){return t%2==0?i.reduce(function(e,n){return e>n[t/2]?n[t/2]:e},e):i.reduce(function(e,n){return ee?n:e}return e},e.getRedrawMTime=function(){var e=t.mtime;if(null!==t.mapper){var n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),e=(n=t.mapper.getInput().getMTime())>e?n:e)}if(null!==t.property){var r=t.property.getMTime();e=r>e?r:e,null!==t.property.getRGBTransferFunction()&&(e=(r=t.property.getRGBTransferFunction().getMTime())>e?r:e)}return e},e.getSupportsSelection=function(){return!!t.mapper&&t.mapper.getSupportsSelection()}}(e,t)}var Up={newInstance:g.a.newInstance(Fp,"vtkImageSlice"),extend:Fp},Gp=g.a.vtkErrorMacro;var Wp={pointId:-1,pointIJK:[],useCells:!1};function Qp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wp,n),Zu.extend(e,t,n),g.a.getArray(e,t,["pointIJK"]),g.a.get(e,t,["pointId"]),g.a.setGet(e,t,["useCells"]),function(e,t){t.classHierarchy.push("vtkPointPicker"),e.intersectWithLine=function(n,r,a,i){var o=Number.MAX_VALUE;if(i.isA("vtkImageMapper")){var s=i.intersectWithLineForPointPicking(n,r);s&&(o=s.t,t.pointIJK=s.ijk)}else i.isA("vtkMapper")&&(o=e.intersectActorWithLine(n,r,a,i));return o},e.intersectActorWithLine=function(e,n,r,a){var i=a.getInputData(),o=0,s=i.getPoints().getNumberOfPoints();if(s<=o)return 2;for(var u=[],l=0;l<3;l++)u[l]=n[l]-e[l];var c,f=d.a.dot(u,u);if(0===f)return Gp("Cannot process points"),2;var p=-1,g=Number.MAX_VALUE,m=Number.MAX_VALUE,h=[],v=[],y=[],M=i.getPoints();if(t.useCells)for(var A=i.getPolys().getData(),b=A[0],w=i.getPolys().getNumberOfCells(),D=0;D=0&&c<=1&&c<=g+t.tolerance){for(var S=0,N=0;N<3;N++){h[N]=e[N]+c*u[N];var E=Math.abs(y[N]-h[N]);E>S&&(S=E)}S<=r&&S=0&&c<=1&&c<=g+t.tolerance){for(var O=0,L=0;L<3;L++){h[L]=e[L]+c*u[L];var P=Math.abs(y[L]-h[L]);P>O&&(O=P)}O<=r&&O2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hp,n),g.a.obj(e,t),g.a.setGet(e,t,["interactor","numberOfLayers","views"]),g.a.get(e,t,["neverRendered"]),g.a.getArray(e,t,["renderers"]),g.a.event(e,t,"completion"),function(e,t){t.classHierarchy.push("vtkRenderWindow"),e.addRenderer=function(n){e.hasRenderer(n)||(n.setRenderWindow(e),t.renderers.push(n),e.modified())},e.removeRenderer=function(n){t.renderers=t.renderers.filter(function(e){return e!==n}),e.modified()},e.hasRenderer=function(e){return-1!==t.renderers.indexOf(e)},e.addView=function(n){e.hasView(n)||(n.setRenderable(e),t.views.push(n),e.modified())},e.removeView=function(n){t.views=t.views.filter(function(e){return e!==n}),e.modified()},e.hasView=function(e){return-1!==t.views.indexOf(e)},e.render=function(){t.interactor?t.interactor.render():t.views.forEach(function(e){return e.traverseAllPasses()})},e.getStatistics=function(){var e={propCount:0,invisiblePropCount:0};return t.renderers.forEach(function(t){t.getViewProps().forEach(function(t){if(t.getVisibility()){e.propCount+=1;var n=t.getMapper&&t.getMapper();if(n&&n.getPrimitiveCount){var r=n.getPrimitiveCount();Object.keys(r).forEach(function(t){e[t]||(e[t]=0),e[t]+=r[t]})}}else e.invisiblePropCount+=1})}),e.str=Object.keys(e).map(function(t){return"".concat(t,": ").concat(e[t])}).join("\n"),e},e.captureImages=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return g.a.setImmediate(e.render),t.views.map(function(e){return e.captureNextImage?e.captureNextImage(n):void 0}).filter(function(e){return!!e})}}(e,t)}var Xp={newInstance:g.a.newInstance(Kp,"vtkRenderWindow"),extend:Kp};var qp={};function Zp(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qp,n),g.e(e,t),g.c(e,t,["actors"]),g.f(e,t,["input"]),function(e,t){t.classHierarchy.push("vtkRepresentation"),t.actors||(t.actors=[]),e.addActor=function(){for(var n=arguments.length,r=new Array(n),a=0;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$p,n),su.a.extend(e,t,n),g.a.setGet(e,t,["format"]),function(e,t){t.classHierarchy.push("vtkSkybox"),e.getIsOpaque=function(){return!0},e.hasTranslucentPolygonalGeometry=function(){return!1},e.getSupportsSelection=function(){return!1}}(e,t)}var tg={newInstance:g.a.newInstance(eg,"vtkSkybox"),extend:eg};var ng={scaleArray:null,radius:.05};function rg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ng,n),uu.a.extend(e,t,n),g.a.setGet(e,t,["radius","scaleArray"]),function(e,t){t.classHierarchy.push("vtkSphereMapper")}(0,t)}var ag={newInstance:g.a.newInstance(rg,"vtkSphereMapper"),extend:rg};var ig={scaleArray:null,orientationArray:null,radius:.025,length:.1};function og(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ig,n),uu.a.extend(e,t,n),g.a.setGet(e,t,["scaleArray","orientationArray","radius","length"]),function(e,t){t.classHierarchy.push("vtkStickMapper")}(0,t)}var sg={newInstance:g.a.newInstance(og,"vtkStickMapper"),extend:og},ug={NEAREST:0,LINEAR:1,FAST_LINEAR:2},lg={InterpolationType:ug},cg=lg.InterpolationType,dg=g.a.vtkErrorMacro,fg=4;var pg={independentComponents:1,interpolationType:cg.FAST_LINEAR,shade:0,ambient:.1,diffuse:.7,specular:.2,specularPower:10};function gg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(Object.assign(t,pg,n),g.a.obj(e,t),!t.componentData){t.componentData=[];for(var r=0;r(e=t.componentData[r].grayTransferFunction.getMTime())?n:e):3===t.componentData[r].colorChannels&&t.componentData[r].rGBTransferFunction&&(n=n>(e=t.componentData[r].rGBTransferFunction.getMTime())?n:e),t.componentData[r].scalarOpacity&&(n=n>(e=t.componentData[r].scalarOpacity.getMTime())?n:e),t.componentData[r].gradientOpacity&&(t.componentData[r].disableGradientOpacity||(n=n>(e=t.componentData[r].gradientOpacity.getMTime())?n:e));return n},e.getColorChannels=function(e){return e<0||e>3?(dg("Bad index - must be between 0 and 3"),0):t.componentData[e].colorChannels},e.setGrayTransferFunction=function(n,r){t.componentData[n].grayTransferFunction!==r&&(t.componentData[n].grayTransferFunction=r,e.modified()),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1,e.modified())},e.getGrayTransferFunction=function(n){return null===t.componentData[n].grayTransferFunction&&(t.componentData[n].grayTransferFunction=De.newInstance(),t.componentData[n].grayTransferFunction.addPoint(0,0),t.componentData[n].grayTransferFunction.addPoint(1024,1),1!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=1),e.modified()),t.componentData[n].grayTransferFunction},e.setRGBTransferFunction=function(n,r){t.componentData[n].rGBTransferFunction!==r&&(t.componentData[n].rGBTransferFunction=r,e.modified()),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3,e.modified())},e.getRGBTransferFunction=function(n){return null===t.componentData[n].rGBTransferFunction&&(t.componentData[n].rGBTransferFunction=vp.newInstance(),t.componentData[n].rGBTransferFunction.addRGBPoint(0,0,0,0),t.componentData[n].rGBTransferFunction.addRGBPoint(1024,1,1,1),3!==t.componentData[n].colorChannels&&(t.componentData[n].colorChannels=3),e.modified()),t.componentData[n].rGBTransferFunction},e.setScalarOpacity=function(n,r){t.componentData[n].scalarOpacity!==r&&(t.componentData[n].scalarOpacity=r,e.modified())},e.getScalarOpacity=function(n){return null===t.componentData[n].scalarOpacity&&(t.componentData[n].scalarOpacity=De.newInstance(),t.componentData[n].scalarOpacity.addPoint(0,1),t.componentData[n].scalarOpacity.addPoint(1024,1),e.modified()),t.componentData[n].scalarOpacity},e.setComponentWeight=function(n,r){if(n<0||n>=fg)dg("Invalid index");else{var a=Math.min(1,Math.max(0,r));t.componentData[n].componentWeight!==a&&(t.componentData[n].componentWeight=a,e.modified())}},e.getComponentWeight=function(e){return e<0||e>=fg?(dg("Invalid index"),0):t.componentData[e].componentWeight},e.setInterpolationTypeToNearest=function(){e.setInterpolationType(cg.NEAREST)},e.setInterpolationTypeToLinear=function(){e.setInterpolationType(cg.LINEAR)},e.setInterpolationTypeToFastLinear=function(){e.setInterpolationType(cg.FAST_LINEAR)},e.getInterpolationTypeAsString=function(){return g.a.enumToString(cg,t.interpolationType)},["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity"].forEach(function(n){var r=g.a.capitalize(n);e["set".concat(r)]=function(r,a){t.componentData[r]["".concat(n)]!==a&&(t.componentData[r]["".concat(n)]=a,e.modified())}}),["useGradientOpacity","scalarOpacityUnitDistance","gradientOpacityMinimumValue","gradientOpacityMinimumOpacity","gradientOpacityMaximumValue","gradientOpacityMaximumOpacity"].forEach(function(n){var r=g.a.capitalize(n);e["get".concat(r)]=function(e){return t.componentData[e]["".concat(n)]}})}(e,t)}var mg=g.a.newInstance(gg,"vtkVolumeProperty"),hg=Object.assign({newInstance:mg,extend:gg},lg),vg=g.a.vtkDebugMacro;var yg={mapper:null,property:null,bounds:[1,-1,1,-1,1,-1]};function Mg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,yg,n),zp.a.extend(e,t,n),t.boundsMTime={},g.a.obj(t.boundsMTime),g.a.set(e,t,["property"]),g.a.setGet(e,t,["mapper"]),g.a.getArray(e,t,["bounds"],6),function(e,t){t.classHierarchy.push("vtkVolume"),e.getVolumes=function(){return e},e.makeProperty=hg.newInstance,e.getProperty=function(){return null===t.property&&(t.property=e.makeProperty()),t.property},e.getBounds=function(){if(null===t.mapper)return t.bounds;var n,r=t.mapper.getBounds();if(!r||6!==r.length)return r;if(r[0]>r[1])return t.mapperBounds=r.concat(),t.bounds=[1,-1,1,-1,1,-1],t.boundsMTime.modified(),r;if(!t.mapperBounds||!(n=[r,t.mapperBounds],n[0].map(function(e,t){return n.map(function(e){return e[t]})})).reduce(function(e,t){return e&&t[0]===t[1]},!0)||e.getMTime()>t.boundsMTime.getMTime()){vg("Recomputing bounds..."),t.mapperBounds=r.map(function(e){return e});var a=[Ye.e.fromValues(r[1],r[3],r[5]),Ye.e.fromValues(r[1],r[2],r[5]),Ye.e.fromValues(r[0],r[2],r[5]),Ye.e.fromValues(r[0],r[3],r[5]),Ye.e.fromValues(r[1],r[3],r[4]),Ye.e.fromValues(r[1],r[2],r[4]),Ye.e.fromValues(r[0],r[2],r[4]),Ye.e.fromValues(r[0],r[3],r[4])];e.computeMatrix();var i=Ye.c.create();Ye.c.transpose(i,t.matrix),a.forEach(function(e){return Ye.e.transformMat4(e,e,i)}),t.bounds[0]=t.bounds[2]=t.bounds[4]=Number.MAX_VALUE,t.bounds[1]=t.bounds[3]=t.bounds[5]=-Number.MAX_VALUE,t.bounds=t.bounds.map(function(e,t){return t%2==0?a.reduce(function(e,n){return e>n[t/2]?n[t/2]:e},e):a.reduce(function(e,n){return ee?n:e}return e},e.getRedrawMTime=function(){var e=t.mtime;if(null!==t.mapper){var n=t.mapper.getMTime();e=n>e?n:e,null!==t.mapper.getInput()&&(t.mapper.getInputAlgorithm().update(),e=(n=t.mapper.getInput().getMTime())>e?n:e)}return e}}(e,t)}var Ag={newInstance:g.a.newInstance(Mg,"vtkVolume"),extend:Mg};var bg={bounds:[1,-1,1,-1,1,-1],sampleDistance:1,imageSampleDistance:1,maximumSamplesPerRay:1e3,autoAdjustSampleDistances:!0};function wg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bg,n),g.a.obj(e,t),g.a.algo(e,t,1,0),g.a.setGet(e,t,["sampleDistance","imageSampleDistance","maximumSamplesPerRay","autoAdjustSampleDistances"]),g.a.event(e,t,"lightingActivated"),function(e,t){t.classHierarchy.push("vtkVolumeMapper"),e.getBounds=function(){var n=e.getInputData();return n?(t.static||e.update(),t.bounds=n.getBounds()):t.bounds=d.a.createUninitializedBounds(),t.bounds},e.update=function(){e.getInputData()}}(e,t)}var Dg={newInstance:g.a.newInstance(wg,"vtkVolumeMapper"),extend:wg},Tg={vtkAbstractMapper:Bf.a,vtkAbstractMapper3D:zf.a,vtkAbstractPicker:Qu,vtkActor:su.a,vtkActor2D:Wf,vtkAnnotatedCubeActor:Zf,vtkAxesActor:rp,vtkCamera:lc,vtkCellPicker:al,vtkColorTransferFunction:vp,vtkCoordinate:bu,vtkGlyph3DMapper:Cp,vtkImageMapper:Lp,vtkImageProperty:Bp,vtkImageSlice:Up,vtkInteractorObserver:yi,vtkInteractorStyle:Ii,vtkLight:fc,vtkMapper:uu.a,vtkPicker:Zu,vtkPixelSpaceCallbackMapper:du,vtkPointPicker:Yp,vtkProp:Cu.a,vtkProp3D:zp.a,vtkProperty:Uu.a,vtkProperty2D:Ff,vtkRenderer:Tc,vtkRenderWindow:Xp,vtkRenderWindowInteractor:di,vtkRepresentation:Jp,vtkSkybox:tg,vtkSphereMapper:ag,vtkStickMapper:sg,vtkTexture:Od.a,vtkViewport:vc,vtkVolume:Ag,vtkVolumeMapper:Dg,vtkVolumeProperty:hg},Cg=g.a.vtkErrorMacro;var Ig={canvas:null,size:[300,300],cursorVisibility:!0,cursor:"pointer",useOffScreen:!1,useBackgroundImage:!1};function xg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ig,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",g.a.obj(e,t,n),g.a.get(e,t,["useBackgroundImage","renderable"]),g.a.setGet(e,t,["canvas","cursor","useOffScreen","interactor"]),g.a.setGetArray(e,t,["size"],2),g.a.getArray(e,t,["renderers"]),function(e,t){t.classHierarchy.push("vtkCanvasView"),e.onModified(function(){t.renderable&&(t.canvas.setAttribute("width",t.size[0]),t.canvas.setAttribute("height",t.size[1])),t.viewStream&&t.viewStream.setSize(t.size[0],t.size[1]),t.canvas.style.display=t.useOffScreen?"none":"block",t.el&&(t.el.style.cursor=t.cursorVisibility?t.cursor:"none")}),e.setContainer=function(n){t.el&&t.el!==n&&(t.canvas.parentNode!==t.el&&Cg("Error: canvas parent node does not match container"),t.el.removeChild(t.canvas),t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)),t.el!==n&&(t.el=n,t.el&&t.el.appendChild(t.canvas),t.useBackgroundImage&&t.el.appendChild(t.bgImage),e.modified())},e.setBackgroundImage=function(e){t.bgImage.src=e.src},e.setUseBackgroundImage=function(e){t.useBackgroundImage=e,t.useBackgroundImage&&t.el&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.setViewStream=function(n){return t.viewStream!==n&&(t.subscription&&(t.subscription.unsubscribe(),t.subscription=null),t.viewStream=n,t.viewStream&&(e.setUseBackgroundImage(!0),t.subscription=t.viewStream.onImageReady(function(t){return e.setBackgroundImage(t.image)}),t.viewStream.setSize(t.size[0],t.size[1]),t.viewStream.invalidateCache(),t.viewStream.render(),e.modified()),!0)},e.delete=g.a.chain(e.delete,e.setViewStream),t.renderable=e,t.renderers=[e],e.traverseAllPasses=function(){},e.isInViewport=function(){return!0},e.getInteractive=function(){return!0}}(e,t)}var Sg={newInstance:g.a.newInstance(xg,"vtkCanvasView"),extend:xg},Ng={CLAMP_TO_EDGE:0,REPEAT:1,MIRRORED_REPEAT:2},Eg={NEAREST:0,LINEAR:1,NEAREST_MIPMAP_NEAREST:2,NEAREST_MIPMAP_LINEAR:3,LINEAR_MIPMAP_NEAREST:4,LINEAR_MIPMAP_LINEAR:5},Og={Wrap:Ng,Filter:Eg},Lg=g.a.vtkErrorMacro;var Pg={parent:null,renderable:null,myFactory:null,children:[],visited:!1};function kg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pg,n),g.a.obj(e,t),g.a.event(e,t,"event"),t.renderableChildMap=new Map,g.a.get(e,t,["visited"]),g.a.setGet(e,t,["parent","renderable","myFactory"]),g.a.getArray(e,t,["children"]),function(e,t){t.classHierarchy.push("vtkViewNode"),e.build=function(e){},e.render=function(e){},e.traverse=function(n){var r=n.getTraverseOperation(),a=e[r];if(a)a(n);else{e.apply(n,!0);for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wg,n),Rg.extend(e,t,n),t.sendParametersTime={},g.a.obj(t.sendParametersTime,{mtime:0}),t.textureBuildTime={},g.a.obj(t.textureBuildTime,{mtime:0}),t.gradientsBuildTime={},g.a.obj(t.gradientsBuildTime,{mtime:0}),g.a.set(e,t,["format","openGLDataType"]),g.a.setGet(e,t,["keyMatrixTime","minificationFilter","magnificationFilter","wrapS","wrapT","wrapR","generateMipmap"]),g.a.get(e,t,["width","height","volumeInfo","components","handle","target","computedGradients","gradientsBuildTime"]),function(e,t){var n=this;function r(e,n){var r=[];if(e!==Vg.FLOAT&&t.openGLDataType===t.context.FLOAT)for(var a=t.width*t.height*t.components,i=0;i=a&&(y=a-1);var M=h-v,A=1-M;v=v*r*i,y=y*r*i;for(var b=0;b=r&&(C=r-1);var I=D-T;T*=i,C*=i;for(var x=0;x0&&void 0!==arguments[0]?arguments[0]:null;if(n?t.openGLRenderWindow=n:(t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.openGLRenderWindow=t.openGLRenderer.getParent()),t.context=t.openGLRenderWindow.getContext(),t.renderable.getInterpolate()?(t.generateMipmap?e.setMinificationFilter(_g.LINEAR_MIPMAP_LINEAR):e.setMinificationFilter(_g.LINEAR),e.setMagnificationFilter(_g.LINEAR)):(e.setMinificationFilter(_g.NEAREST),e.setMagnificationFilter(_g.NEAREST)),t.renderable.getRepeat()&&(e.setWrapR(zg.REPEAT),e.setWrapS(zg.REPEAT),e.setWrapT(zg.REPEAT)),t.renderable.getInputData()&&t.renderable.setImage(null),!t.handle||t.renderable.getMTime()>t.textureBuildTime.getMTime()){null!==t.renderable.getImage()&&(t.renderable.getInterpolate()&&(t.generateMipmap=!0,e.setMinificationFilter(_g.LINEAR_MIPMAP_LINEAR)),t.renderable.getImage()&&t.renderable.getImageLoaded()&&(e.create2DFromImage(t.renderable.getImage()),e.activate(),e.sendParameters(),t.textureBuildTime.modified()));var r=t.renderable.getInputData(0);if(r&&r.getPointData().getScalars()){for(var a=r.getExtent(),i=r.getPointData().getScalars(),o=[],s=0;st.sendParametersTime.getMTime()&&e.sendParameters()},e.isBound=function(){var e=!1;if(t.context&&t.handle){var n=0;switch(t.target){case t.context.TEXTURE_2D:n=t.context.TEXTURE_BINDING_2D;break;default:Gg("impossible case")}e=t.context.getIntegerv(n)===t.handle}return e},e.sendParameters=function(){t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_S,e.getOpenGLWrapMode(t.wrapS)),t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_T,e.getOpenGLWrapMode(t.wrapT)),t.openGLRenderWindow.getWebgl2()&&t.context.texParameteri(t.target,t.context.TEXTURE_WRAP_R,e.getOpenGLWrapMode(t.wrapR)),t.context.texParameteri(t.target,t.context.TEXTURE_MIN_FILTER,e.getOpenGLFilterMode(t.minificationFilter)),t.context.texParameteri(t.target,t.context.TEXTURE_MAG_FILTER,e.getOpenGLFilterMode(t.magnificationFilter)),t.openGLRenderWindow.getWebgl2()&&(t.context.texParameteri(t.target,t.context.TEXTURE_BASE_LEVEL,t.baseLevel),t.context.texParameteri(t.target,t.context.TEXTURE_MAX_LEVEL,t.maxLevel)),t.sendParametersTime.modified()},e.getInternalFormat=function(n,r){return t.internalFormat?t.internalFormat:(t.internalFormat=e.getDefaultInternalFormat(n,r),t.internalFormat||Fg("Unable to find suitable internal format for T=".concat(n," NC= ").concat(r)),t.internalFormat)},e.getDefaultInternalFormat=function(e,r){var a=0;return(a=t.openGLRenderWindow.getDefaultTextureInternalFormat(e,r,!1))?a:((a=n.openGLRenderWindow.getDefaultTextureInternalFormat(e,r,!0))||(Fg("Unsupported internal texture type!"),Fg("Unable to find suitable internal format for T=".concat(e," NC= ").concat(r))),a)},e.setInternalFormat=function(n){n!==t.context.InternalFormat&&(t.internalFormat=n,e.modified())},e.getFormat=function(n,r){return t.format||(t.format=e.getDefaultFormat(n,r)),t.format},e.getDefaultFormat=function(e,n){if(t.openGLRenderWindow.getWebgl2())switch(n){case 1:return t.context.RED;case 2:return t.context.RG;case 3:return t.context.RGB;case 4:return t.context.RGBA;default:return t.context.RGB}else switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;case 4:return t.context.RGBA;default:return t.context.RGB}},e.resetFormatAndType=function(){t.format=0,t.internalFormat=0,t.openGLDataType=0},e.getDefaultDataType=function(e){if(t.openGLRenderWindow.getWebgl2())switch(e){case Vg.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case Vg.FLOAT:case Vg.VOID:default:return t.context.FLOAT}switch(e){case Vg.UNSIGNED_CHAR:return t.context.UNSIGNED_BYTE;case Vg.FLOAT:case Vg.VOID:default:return t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear")?t.context.FLOAT:t.context.UNSIGNED_BYTE}},e.getOpenGLDataType=function(n){return t.openGLDataType||(t.openGLDataType=e.getDefaultDataType(n)),t.openGLDataType},e.getShiftAndScale=function(){var e=0,n=1;switch(t.openGLDataType){case t.context.BYTE:e=(n=127.5)-128;break;case t.context.UNSIGNED_BYTE:n=255,e=0;break;case t.context.SHORT:e=(n=32767.5)-32768;break;case t.context.UNSIGNED_SHORT:n=65536,e=0;break;case t.context.INT:e=(n=2147483647.5)-2147483648;break;case t.context.UNSIGNED_INT:n=4294967295,e=0;break;case t.context.FLOAT:}return{shift:e,scale:n}},e.getOpenGLFilterMode=function(e){switch(e){case _g.NEAREST:return t.context.NEAREST;case _g.LINEAR:return t.context.LINEAR;case _g.NEAREST_MIPMAP_NEAREST:return t.context.NEAREST_MIPMAP_NEAREST;case _g.NEAREST_MIPMAP_LINEAR:return t.context.NEAREST_MIPMAP_LINEAR;case _g.LINEAR_MIPMAP_NEAREST:return t.context.LINEAR_MIPMAP_NEAREST;case _g.LINEAR_MIPMAP_LINEAR:return t.context.LINEAR_MIPMAP_LINEAR;default:return t.context.NEAREST}},e.getOpenGLWrapMode=function(e){switch(e){case zg.CLAMP_TO_EDGE:return t.context.CLAMP_TO_EDGE;case zg.REPEAT:return t.context.REPEAT;case zg.MIRRORED_REPEAT:return t.context.MIRRORED_REPEAT;default:return t.context.CLAMP_TO_EDGE}},e.create2DFromRaw=function(n,i,o,s,u){if(e.getOpenGLDataType(s),e.getInternalFormat(s,o),e.getFormat(s,o),!t.internalFormat||!t.format||!t.openGLDataType)return Ug("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=o,t.width=n,t.height=i,t.depth=1,t.numberOfDimensions=2,t.openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind();var l=a(r(s,[u]));return t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,l[0]),t.generateMipmap&&t.context.generateMipmap(t.target),e.deactivate(),!0},e.createCubeFromRaw=function(n,i,o,s,u){if(e.getOpenGLDataType(s),e.getInternalFormat(s,o),e.getFormat(s,o),!t.internalFormat||!t.format||!t.openGLDataType)return Ug("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_CUBE_MAP,t.components=o,t.width=n,t.height=i,t.depth=1,t.numberOfDimensions=2,t.openGLRenderWindow.activateTexture(e),t.maxLevel=u.length/6-1,e.createTexture(),e.bind();for(var l=a(r(s,u)),c=[],d=t.width,f=t.height,p=0;p=1&&A>=1;){var b=null;y<=t.maxLevel&&(b=c[6*y+v]),t.context.texImage2D(t.context.TEXTURE_CUBE_MAP_POSITIVE_X+v,y,t.internalFormat,M,A,0,t.format,t.openGLDataType,b),y++,M/=2,A/=2}return e.deactivate(),!0},e.createDepthFromRaw=function(n,r,a,i){return e.getOpenGLDataType(a),t.format=t.context.DEPTH_COMPONENT,t.internalFormat=t.context.DEPTH_COMPONENT,t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_2D,t.components=1,t.width=n,t.height=r,t.depth=1,t.numberOfDimensions=2,t.openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1),t.context.texImage2D(t.target,0,t.internalFormat,t.width,t.height,0,t.format,t.openGLDataType,i),t.generateMipmap&&t.context.generateMipmap(t.target),e.deactivate(),!0):(Ug("Failed to determine texture parameters."),!1)},e.create2DFromImage=function(n){if(e.getOpenGLDataType(Vg.UNSIGNED_CHAR),e.getInternalFormat(Vg.UNSIGNED_CHAR,4),e.getFormat(Vg.UNSIGNED_CHAR,4),!t.internalFormat||!t.format||!t.openGLDataType)return Ug("Failed to determine texture parameters."),!1;t.target=t.context.TEXTURE_2D,t.components=4,t.width=n.width,t.height=n.height,t.depth=1,t.numberOfDimensions=2,t.openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.pixelStorei(t.context.UNPACK_ALIGNMENT,1);var r=!d.a.isPowerOfTwo(n.width)||!d.a.isPowerOfTwo(n.height),a=document.createElement("canvas");a.width=r?d.a.nearestPowerOfTwo(n.width):n.width,a.height=r?d.a.nearestPowerOfTwo(n.height):n.height;var i=a.getContext("2d");i.translate(0,a.height),i.scale(1,-1),i.drawImage(n,0,0,n.width,n.height,0,0,a.width,a.height),i.getImageData(0,0,1,1);var o=a;return t.context.texImage2D(t.target,0,t.internalFormat,t.format,t.openGLDataType,o),t.generateMipmap&&t.context.generateMipmap(t.target),e.deactivate(),!0},e.create3DFromRaw=function(n,r,a,i,o,s){return e.getOpenGLDataType(o),e.getInternalFormat(o,i),e.getFormat(o,i),t.internalFormat&&t.format&&t.openGLDataType?(t.target=t.context.TEXTURE_3D,t.components=i,t.width=n,t.height=r,t.depth=a,t.numberOfDimensions=3,t.openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.context.texImage3D(t.target,0,t.internalFormat,t.width,t.height,t.depth,0,t.format,t.openGLDataType,s),t.generateMipmap&&t.context.generateMipmap(t.target),e.deactivate(),!0):(Ug("Failed to determine texture parameters."),!1)},e.create3DOneComponentFromRaw=function(n,r,a,i,o){var s=n*r*a,u=d.a.arrayMin(o),l=d.a.arrayMax(o);u===l&&(l=u+1),t.volumeInfo={min:u,max:l,width:n,height:r,depth:a};var c=function(e,t,n,r,a){e[t]=n},f=Vg.UNSIGNED_CHAR,p=1,g=!1;if(i===Vg.UNSIGNED_CHAR?(t.volumeInfo.min=0,t.volumeInfo.max=255):t.openGLRenderWindow.getWebgl2()||t.context.getExtension("OES_texture_float")&&t.context.getExtension("OES_texture_float_linear")?(f=Vg.FLOAT,c=function(e,t,n,r,a){e[t]=(n-r)/(a-r)}):(g=!0,f=Vg.UNSIGNED_CHAR,p=4,c=function(e,t,n,r,a){var i=(n-r)/(a-r),o=Math.floor(255*i);i=255*i-o,e[t]=o;var s=Math.floor(255*i);i=255*i-s,e[t+1]=s;var u=Math.floor(255*i);e[t+2]=u}),t.openGLRenderWindow.getWebgl2()){if(i!==Vg.UNSIGNED_CHAR){for(var m=new Float32Array(s),h=0;h4096&&(f===Vg.FLOAT||4===p)&&(v=4096);var y=1,M=1;s>v*v&&(M=y=Math.ceil(Math.sqrt(s/(v*v))));var A=Math.sqrt(s)/y;A=d.a.nearestPowerOfTwo(A);var b,w=Math.floor(A*y/n),D=Math.ceil(a/w),T=d.a.nearestPowerOfTwo(r*D/M);t.width=A,t.height=T,t.openGLRenderWindow.activateTexture(e),e.createTexture(),e.bind(),t.volumeInfo={encodedScalars:g,min:u,max:l,width:n,height:r,depth:a,xreps:w,yreps:D,xstride:y,ystride:M};var C=A*T*p;b=f===Vg.FLOAT?new Float32Array(C):new Uint8Array(C);for(var I=0,x=0;x2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kg,n),g.e(e,t),g.f(e,t,["colorTexture"]),function(e,t){t.classHierarchy.push("vtkFramebuffer"),e.getBothMode=function(){return t.context.FRAMEBUFFER},e.saveCurrentBindingsAndBuffers=function(t){var n=void 0!==t?t:e.getBothMode();e.saveCurrentBindings(n),e.saveCurrentBuffers(n)},e.saveCurrentBindings=function(e){var n=t.context;t.previousDrawBinding=n.getParameter(t.context.FRAMEBUFFER_BINDING),t.previousActiveFramebuffer=t.openGLRenderWindow.getActiveFramebuffer()},e.saveCurrentBuffers=function(e){},e.restorePreviousBindingsAndBuffers=function(t){var n=void 0!==t?t:e.getBothMode();e.restorePreviousBindings(n),e.restorePreviousBuffers(n)},e.restorePreviousBindings=function(e){var n=t.context;n.bindFramebuffer(n.FRAMEBUFFER,t.previousDrawBinding),t.openGLRenderWindow.setActiveFramebuffer(t.previousActiveFramebuffer)},e.restorePreviousBuffers=function(e){},e.bind=function(){t.context.bindFramebuffer(t.context.FRAMEBUFFER,t.glFramebuffer),t.colorTexture&&t.colorTexture.bind(),t.openGLRenderWindow.setActiveFramebuffer(e)},e.create=function(e,n){t.glFramebuffer=t.context.createFramebuffer(),t.glFramebuffer.width=e,t.glFramebuffer.height=n},e.setColorBuffer=function(e,n){var r=t.context;t.colorTexture=e,r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e.getHandle(),0)},e.getGLFramebuffer=function(){return t.glFramebuffer},e.setOpenGLRenderWindow=function(n){t.openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t.openGLRenderWindow=n,t.context=null,n&&(t.context=t.openGLRenderWindow.getContext()))},e.releaseGraphicsResources=function(){t.glFramebuffer&&t.context.deleteFramebuffer(t.glFramebuffer),t.depthTexture&&t.depthTexture.releaseGraphicsResources(),t.colorTexture&&t.colorTexture.releaseGraphicsResources()},e.getSize=function(){var e=[0,0];return null!==t.glFramebuffer&&(e[0]=t.glFramebuffer.width,e[1]=t.glFramebuffer.height),e},e.populateFramebuffer=function(){e.bind();var n=t.context,r=Hg.newInstance();r.setOpenGLRenderWindow(t.openGLRenderWindow),r.setMinificationFilter(Eg.LINEAR),r.setMagnificationFilter(Eg.LINEAR),r.create2DFromRaw(t.glFramebuffer.width,t.glFramebuffer.height,4,Tt.b.UNSIGNED_CHAR,null),e.setColorBuffer(r),t.depthTexture=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,t.depthTexture),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,t.glFramebuffer.width,t.glFramebuffer.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t.depthTexture)}}(e,t)}var qg=g.d(Xg,"vtkFramebuffer"),Zg=Object.assign({newInstance:qg,extend:Xg});var Jg={delegates:[],currentOperation:null,preDelegateOperations:[],postDelegateOperations:[],currentParent:null};function $g(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Jg,n),g.a.obj(e,t),g.a.get(e,t,["currentOperation"]),g.a.setGet(e,t,["delegates","currentParent","preDelegateOperations","postDelegateOperations"]),function(e,t){t.classHierarchy.push("vtkRenderPass"),e.getOperation=function(){return t.currentOperation},e.setCurrentOperation=function(e){t.currentOperation=e,t.currentTraverseOperation="traverse".concat(g.a.capitalize(t.currentOperation))},e.getTraverseOperation=function(){return t.currentTraverseOperation},e.traverse=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.deleted||(t.currentParent=r,t.preDelegateOperations.forEach(function(t){e.setCurrentOperation(t),n.traverse(e)}),t.delegates.forEach(function(t){t.traverse(n,e)}),t.postDelegateOperations.forEach(function(t){e.setCurrentOperation(t),n.traverse(e)}))}}(e,t)}var em={newInstance:g.a.newInstance($g,"vtkRenderPass"),extend:$g};var tm={opaqueActorCount:0,translucentActorCount:0,volumeCount:0,framebuffer:null,depthRequested:!1};function nm(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tm,n),em.extend(e,t,n),g.a.get(e,t,["framebuffer"]),g.a.setGet(e,t,["depthRequested"]),function(e,t){t.classHierarchy.push("vtkForwardPass"),e.traverse=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!t.deleted){t.currentParent=r,e.setCurrentOperation("buildPass"),n.traverse(e);for(var a=n.getChildren(),i=0;i0&&t.volumeCount>0||t.depthRequested){var s=n.getFramebufferSize();null===t.framebuffer&&(t.framebuffer=Zg.newInstance()),t.framebuffer.setOpenGLRenderWindow(n),t.framebuffer.saveCurrentBindingsAndBuffers();var u=t.framebuffer.getSize();null!==u&&u[0]===s[0]&&u[1]===s[1]||(t.framebuffer.create(s[0],s[1]),t.framebuffer.populateFramebuffer()),t.framebuffer.bind(),e.setCurrentOperation("opaqueZBufferPass"),o.traverse(e),t.framebuffer.restorePreviousBindingsAndBuffers()}e.setCurrentOperation("cameraPass"),o.traverse(e),t.opaqueActorCount>0&&(e.setCurrentOperation("opaquePass"),o.traverse(e)),t.translucentActorCount>0&&(e.setCurrentOperation("translucentPass"),o.traverse(e)),t.volumeCount>0&&(e.setCurrentOperation("volumePass"),o.traverse(e))}}},e.getZBufferTexture=function(){return t.framebuffer?t.framebuffer.getColorTexture():null},e.incrementOpaqueActorCount=function(){return t.opaqueActorCount++},e.incrementTranslucentActorCount=function(){return t.translucentActorCount++},e.incrementVolumeCount=function(){return t.volumeCount++}}(e,t)}var rm={newInstance:g.a.newInstance(nm,"vtkForwardPass"),extend:nm};var am={};function im(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,am,n),Rg.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkGenericWidgetRepresentation")}(0,t)}var om={newInstance:g.a.newInstance(im),extend:im};var sm={context:null,keyMatrixTime:null,keyMatrices:null,activeTextures:null};function um(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sm,n),Rg.extend(e,t,n),t.keyMatrixTime={},g.a.obj(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:Ye.b.create(),mcwc:Ye.c.create()},g.a.setGet(e,t,["context"]),g.a.get(e,t,["activeTextures"]),function(e,t){t.classHierarchy.push("vtkOpenGLActor"),e.buildPass=function(n){if(n){t.openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.context=t.openGLRenderWindow.getContext(),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes(),t.ogltextures=null,t.activeTextures=null;for(var r=0;rt.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),Ye.c.copy(t.keyMatrices.mcwc,t.renderable.getMatrix()),Ye.c.transpose(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.renderable.getIsIdentity()?Ye.b.identity(t.keyMatrices.normalMatrix):(Ye.b.fromMat4(t.keyMatrices.normalMatrix,t.keyMatrices.mcwc),Ye.b.invert(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),Ye.b.transpose(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix)),t.keyMatrixTime.modified()),t.keyMatrices}}(e,t)}var lm={newInstance:g.a.newInstance(um),extend:um};var cm={context:null,activeTextures:[]};function dm(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,cm,n),Rg.extend(e,t,n),g.f(e,t,["context"]),g.c(e,t,["activeTextures"]),function(e,t){t.classHierarchy.push("vtkOpenGLActor2D"),e.buildPass=function(n){if(n){if(!t.renderable)return;t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),e.prepareNodes(),e.addMissingNodes(t.renderable.getTextures()),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaquePass=function(n){t.renderable&&t.renderable.getVisibility()&&t.renderable.getIsOpaque()&&(!t.openGLRenderer.getSelector()||t.renderable.getPickable())&&(e.apply(n,!0),t.children.forEach(function(e){e.isA("vtkOpenGLTexture")||e.traverse(n)}),e.apply(n,!1))},e.traverseTranslucentPass=function(n){!t.renderable||!t.renderable.getVisibility()||t.renderable.getIsOpaque()||t.openGLRenderer.getSelector()&&!t.renderable.getPickable()||(e.apply(n,!0),t.children.forEach(function(e){e.isA("vtkOpenGLTexture")||e.traverse(n)}),e.apply(n,!1))},e.activateTextures=function(){t.activeTextures=[],t.children.forEach(function(e){e.isA("vtkOpenGLTexture")&&(e.render(),e.getHandle()&&t.activeTextures.push(e))})},e.opaquePass=function(n,r){n?(t.context=e.getFirstAncestorOfType("vtkOpenGLRenderWindow").getContext(),t.context.depthMask(!0),e.activateTextures()):t.activeTextures.forEach(function(e){e.deactivate()})},e.translucentPass=function(n,r){n?(t.context=e.getFirstAncestorOfType("vtkOpenGLRenderWindow").getContext(),t.context.depthMask(!1),e.activateTextures()):(t.activeTextures.forEach(function(e){e.deactivate()}),t.context.depthMask(!0))}}(e,t)}var fm={newInstance:g.d(dm),extend:dm};var pm={context:null,lastRenderer:null,keyMatrixTime:null,keyMatrices:null};function gm(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pm,n),Rg.extend(e,t,n),t.keyMatrixTime={},g.e(t.keyMatrixTime),t.keyMatrices={normalMatrix:Ye.b.create(),vcdc:Ye.c.create(),wcvc:Ye.c.create(),wcdc:Ye.c.create()},g.f(e,t,["context","keyMatrixTime"]),function(e,t){t.classHierarchy.push("vtkOpenGLCamera"),e.buildPass=function(n){n&&(t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.openGLRenderWindow=t.openGLRenderer.getParent(),t.context=t.openGLRenderWindow.getContext())},e.opaquePass=function(e){if(e){var n=t.openGLRenderer.getTiledSizeAndOrigin();t.context.viewport(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize),t.context.scissor(n.lowerLeftU,n.lowerLeftV,n.usize,n.vsize)}},e.translucentPass=e.opaquePass,e.opaqueZBufferPass=e.opaquePass,e.volumePass=e.opaquePass,e.getKeyMatrices=function(n){if(n!==t.lastRenderer||t.openGLRenderWindow.getMTime()>t.keyMatrixTime.getMTime()||e.getMTime()>t.keyMatrixTime.getMTime()||n.getMTime()>t.keyMatrixTime.getMTime()||t.renderable.getMTime()>t.keyMatrixTime.getMTime()){Ye.c.copy(t.keyMatrices.wcvc,t.renderable.getViewMatrix()),Ye.b.fromMat4(t.keyMatrices.normalMatrix,t.keyMatrices.wcvc),Ye.b.invert(t.keyMatrices.normalMatrix,t.keyMatrices.normalMatrix),Ye.c.transpose(t.keyMatrices.wcvc,t.keyMatrices.wcvc);var r=t.openGLRenderer.getAspectRatio();Ye.c.copy(t.keyMatrices.vcdc,t.renderable.getProjectionMatrix(r,-1,1)),Ye.c.transpose(t.keyMatrices.vcdc,t.keyMatrices.vcdc),Ye.c.multiply(t.keyMatrices.wcdc,t.keyMatrices.vcdc,t.keyMatrices.wcvc),t.keyMatrixTime.modified(),t.lastRenderer=n}return t.keyMatrices}}(e,t)}var mm={newInstance:g.d(gm),extend:gm},hm={ARRAY_BUFFER:0,ELEMENT_ARRAY_BUFFER:1,TEXTURE_BUFFER:2},vm={ObjectType:hm},ym=vm.ObjectType;var Mm={objectType:ym.ARRAY_BUFFER,openGLRenderWindow:null,context:null};function Am(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mm,n),g.a.obj(e,t),g.a.get(e,t,["openGLRenderWindow"]),function(e,t){function n(e){switch(e){case ym.ELEMENT_ARRAY_BUFFER:return t.context.ELEMENT_ARRAY_BUFFER;case ym.TEXTURE_BUFFER:if("TEXTURE_BUFFER"in t.context)return t.context.TEXTURE_BUFFER;default:case ym.ARRAY_BUFFER:return t.context.ARRAY_BUFFER}}t.classHierarchy.push("vtkOpenGLBufferObject");var r=null,a=null,i=!0,o="";e.getType=function(){return r},e.setType=function(e){r=e},e.getHandle=function(){return a},e.isReady=function(){return!1===i},e.generateBuffer=function(e){var i=n(e);return null===a&&(a=t.context.createBuffer(),r=e),n(r)===i},e.upload=function(s,u){return e.generateBuffer(u)?(t.context.bindBuffer(n(r),a),t.context.bufferData(n(r),s,t.context.STATIC_DRAW),i=!1,!0):(o="Trying to upload array buffer to incompatible buffer.",!1)},e.bind=function(){return!!a&&(t.context.bindBuffer(n(r),a),!0)},e.release=function(){return!!a&&(t.context.bindBuffer(n(r),null),!0)},e.releaseGraphicsResources=function(){null!==a&&(t.context.bindBuffer(n(r),null),t.context.deleteBuffer(a),a=null)},e.setOpenGLRenderWindow=function(n){t.openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t.openGLRenderWindow=n,t.context=null,n&&(t.context=t.openGLRenderWindow.getContext()))},e.getError=function(){return o}}(e,t)}var bm=g.a.newInstance(Am),wm=Object.assign({newInstance:bm,extend:Am},{},vm),Dm={PassTypes:{MIN_KNOWN_PASS:0,ACTOR_PASS:0,COMPOSITE_INDEX_PASS:1,ID_LOW24:2,MAX_KNOWN_PASS:2}},Tm=Dm.PassTypes,Cm=Oe.SelectionContent,Im=Oe.SelectionField,xm=q.a.FieldAssociations,Sm=g.a.vtkErrorMacro;var Nm={fieldAssociation:xm.FIELD_ASSOCIATION_CELLS,renderer:null,area:null,openGLRenderWindow:null,openGLRenderer:null,currentPass:-1,propColorValue:null,props:null,idOffset:1};function Em(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Nm,n),g.a.obj(e,t),t.area=[0,0,0,0],t.propColorValue=[0,0,0],t.props=[],g.a.setGet(e,t,["fieldAssociation","renderer","currentPass"]),g.a.setGetArray(e,t,["area"],4),g.a.setGetArray(e,t,["propColorValue"],3),g.a.event(e,t,"event"),function(e,t){t.classHierarchy.push("vtkOpenGLHardwareSelector"),e.releasePixBuffers=function(){t.pixBuffer=[]},e.beginSelection=function(){t.openGLRenderer=t.openGLRenderWindow.getViewNodeFor(t.renderer),t.maxAttributeId=0;var n=t.openGLRenderWindow.getSize();if(t.framebuffer){t.framebuffer.setOpenGLRenderWindow(t.openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers();var r=t.framebuffer.getSize();r[0]===n[0]&&r[1]===n[1]||(t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer())}else t.framebuffer=Zg.newInstance(),t.framebuffer.setOpenGLRenderWindow(t.openGLRenderWindow),t.framebuffer.saveCurrentBindingsAndBuffers(),t.framebuffer.create(n[0],n[1]),t.framebuffer.populateFramebuffer();t.openGLRenderer.clear(),t.openGLRenderer.setSelector(e),t.hitProps={},t.props=[],e.releasePixBuffers()},e.endSelection=function(){t.hitProps={},t.openGLRenderer.setSelector(null),t.framebuffer.restorePreviousBindingsAndBuffers()},e.preCapturePass=function(){},e.postCapturePass=function(){},e.select=function(){var n=null;return e.captureBuffers()&&(n=e.generateSelection(t.area[0],t.area[1],t.area[2],t.area[3]),e.releasePixBuffers()),n},e.captureBuffers=function(){if(!t.renderer||!t.openGLRenderWindow)return Sm("Renderer and view must be set before calling Select."),!1;for(t.openGLRenderer=t.openGLRenderWindow.getViewNodeFor(t.renderer),e.invokeEvent({type:"StartEvent"}),t.originalBackground=t.renderer.getBackgroundByReference(),t.renderer.setBackground(0,0,0),e.beginSelection(),t.currentPass=Tm.MIN_KNOWN_PASS;t.currentPass<=Tm.COMPOSITE_INDEX_PASS;t.currentPass++)console.log("in pass ".concat(t.currentPass)),e.passRequired(t.currentPass)&&(e.preCapturePass(t.currentPass),t.openGLRenderWindow.traverseAllPasses(),e.postCapturePass(t.currentPass),e.savePixelBuffer(t.currentPass));return e.endSelection(),t.renderer.setBackground(t.originalBackground),e.invokeEvent({type:"EndEvent"}),!0},e.passRequired=function(e){return!0},e.savePixelBuffer=function(n){t.pixBuffer[n]=t.openGLRenderWindow.getPixelData(t.area[0],t.area[1],t.area[2],t.area[3]),n===Tm.ACTOR_PASS&&e.buildPropHitList(t.pixBuffer[n])},e.buildPropHitList=function(n){for(var r=0;r<=t.area[3]-t.area[1];r++)for(var a=0;a<=t.area[2]-t.area[0];a++){var i=e.convert(a,r,n);i>0&&(--i in t.hitProps||(t.hitProps[i]=!0))}},e.renderProp=function(n){t.currentPass===Tm.ACTOR_PASS&&(e.setPropColorValueFromInt(t.props.length+t.idOffset),t.props.push(n))},e.renderCompositeIndex=function(n){t.currentPass===Tm.COMPOSITE_INDEX_PASS&&e.setPropColorValueFromInt(n+t.idOffset)},e.renderAttributeId=function(e){e<0||(t.maxAttributeId=e>t.maxAttributeId?e:t.maxAttributeId)},e.getPropFromID=function(e){return e>=0&&et.area[2]||n[1]t.area[3])return null;var o=[n[0]-t.area[0],n[1]-t.area[1]],s=e.convert(o[0],o[1],t.pixBuffer[Tm.ACTOR_PASS]);if(s<=0)return null;var u={valid:!0};u.propID=s-t.idOffset,u.prop=e.getPropFromID(u.propID);var l=e.convert(o[0],o[1],t.pixBuffer[Tm.COMPOSITE_INDEX_PASS]);return(l<0||l>16777215)&&(l=0),u.compositeID=l-t.idOffset,u}var c=[n[0],n[1]],d=[0,0],f=e.getPixelInformation(n,0,a);if(f&&f.valid)return f;for(var p=1;pp?c[1]-p:0;g<=c[1]+p;++g){if(d[1]=g,c[0]>=p&&(d[0]=c[0]-p,(f=e.getPixelInformation(d,0,a))&&f.valid))return f;if(d[0]=c[0]+p,(f=e.getPixelInformation(d,0,a))&&f.valid)return f}for(var m=c[0]>=p?c[0]-(p-1):0;m<=c[0]+(p-1);++m){if(d[0]=m,c[1]>=p&&(d[1]=c[1]-p,(f=e.getPixelInformation(d,0,a))&&f.valid))return f;if(d[1]=c[1]+p,(f=e.getPixelInformation(d,0,a))&&f.valid)return f}}return a[0]=n[0],a[1]=n[1],null},e.convertSelection=function(e,t){var n=[],r=0;return t.forEach(function(t,a){var i=Oe.newInstance();switch(i.setContentType(Cm.INDICES),e){case xm.FIELD_ASSOCIATION_CELLS:i.setFieldType(Im.CELL);break;case xm.FIELD_ASSOCIATION_POINTS:i.setFieldType(Im.POINT);break;default:Sm("Unknown field association")}i.getProperties().propID=t.info.propID,i.getProperties().prop=t.info.prop,i.getProperties().compositeID=t.info.compositeID,i.getProperties().pixelCount=t.pixelCount,i.setSelectionList(t.attributeIDs),n[r]=i,r++}),n},e.getInfoHash=function(e){return"".concat(e.propID," ").concat(e.compositeID)},e.generateSelection=function(n,r,a,i){for(var o=new Map,s=[0,0],u=r;u<=i;u++)for(var l=n;l<=a;l++){var c=[l,u],d=e.getPixelInformation(c,0,s);if(d&&d.valid){var f=e.getInfoHash(d);o.has(f)?(o.get(f).pixelCount++,-1===o.get(f).attributeIDs.indexOf(d.attributeID)&&o.get(f).attributeIDs.push(d.attributeID)):o.set(f,{info:d,pixelCount:1,attributeIDs:[d.attributeID]})}}return e.convertSelection(t.fieldAssociation,o)},e.attach=function(e,n){t.openGLRenderWindow=e,t.renderer=n}}(e,t)}var Om=g.a.newInstance(Em,"vtkOpenGLHardwareSelector"),Lm=Object.assign({newInstance:Om,extend:Em},Dm),Pm=n(19),km=g.a.vtkDebugMacro,Rm=g.a.vtkErrorMacro;var jm={elementCount:0,stride:0,colorBOStride:0,vertexOffset:0,normalOffset:0,tCoordOffset:0,tCoordComponents:0,colorOffset:0,colorComponents:0,tcoordBO:null};function Bm(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jm,n),wm.extend(e,t,n),g.a.setGet(e,t,["colorBO","elementCount","stride","colorBOStride","vertexOffset","normalOffset","tCoordOffset","tCoordComponents","colorOffset","colorComponents"]),function(e,t){t.classHierarchy.push("vtkOpenGLCellArrayBufferObject"),e.setType(hm.ARRAY_BUFFER),e.createVBO=function(n,r,a,i){if(!n.getData()||!n.getData().length)return t.elementCount=0,0;t.blockSize=3,t.vertexOffset=0,t.normalOffset=0,t.tCoordOffset=0,t.tCoordComponents=0,t.colorComponents=0,t.colorOffset=0;var o=i.points.getData(),s=null,u=null,l=null,c=i.colors?i.colors.getNumberOfComponents():0,d=i.tcoords?i.tcoords.getNumberOfComponents():0;i.normals&&(t.normalOffset=4*t.blockSize,t.blockSize+=3,s=i.normals.getData()),i.tcoords&&(t.tCoordOffset=4*t.blockSize,t.tCoordComponents=d,t.blockSize+=d,u=i.tcoords.getData()),i.colors?(t.colorComponents=i.colors.getNumberOfComponents(),t.colorOffset=0,l=i.colors.getData(),t.colorBO||(t.colorBO=wm.newInstance()),t.colorBO.setOpenGLRenderWindow(t.openGLRenderWindow)):t.colorBO=null,t.stride=4*t.blockSize;var f,p=0,g=0,m=0,h=0,v=0,y={anythingToPoints:function(e,t,n){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Vm,n),g.a.obj(e,t),g.a.setGet(e,t,["shaderType","source","error","handle","context"]),function(e,t){t.classHierarchy.push("vtkShader"),e.compile=function(){var e=t.context.VERTEX_SHADER;if(!t.source||!t.source.length||"Unknown"===t.shaderType)return!1;switch(0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0),t.shaderType){case"Fragment":e=t.context.FRAGMENT_SHADER;break;case"Vertex":default:e=t.context.VERTEX_SHADER}if(t.handle=t.context.createShader(e),t.context.shaderSource(t.handle,t.source),t.context.compileShader(t.handle),!t.context.getShaderParameter(t.handle,t.context.COMPILE_STATUS)){var n=t.context.getShaderInfoLog(t.handle);return _m("Error compiling shader '".concat(t.source,"': ").concat(n)),t.context.deleteShader(t.handle),t.handle=0,!1}return!0},e.cleanup=function(){"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0,t.dirty=!0)}}(e,t)}var Um={newInstance:g.a.newInstance(Fm,"vtkShader"),extend:Fm},Gm=g.a.vtkErrorMacro;var Wm={vertexShaderHandle:0,fragmentShaderHandle:0,geometryShaderHandle:0,vertexShader:null,fragmentShader:null,geometryShader:null,linked:!1,bound:!1,compiled:!1,error:"",handle:0,numberOfOutputs:0,attributesLocs:null,uniformLocs:null,md5Hash:0,context:null,lastCameraMTime:null};function Qm(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wm,n),t.attributesLocs={},t.uniformLocs={},t.vertexShader=Um.newInstance(),t.vertexShader.setShaderType("Vertex"),t.fragmentShader=Um.newInstance(),t.fragmentShader.setShaderType("Fragment"),t.geometryShader=Um.newInstance(),t.geometryShader.setShaderType("Geometry"),g.a.obj(e,t),g.a.get(e,t,["lastCameraMTime"]),g.a.setGet(e,t,["error","handle","compiled","bound","md5Hash","vertexShader","fragmentShader","geometryShader","linked"]),function(e,t){t.classHierarchy.push("vtkShaderProgram"),e.compileShader=function(){return t.vertexShader.compile()?t.fragmentShader.compile()?e.attachShader(t.vertexShader)&&e.attachShader(t.fragmentShader)?e.link()?(e.setCompiled(!0),1):(Gm("Links failed: ".concat(t.error)),0):(Gm(t.error),0):(Gm(t.fragmentShader.getSource().split("\n").map(function(e,t){return"".concat(t,": ").concat(e)}).join("\n")),Gm(t.fragmentShader.getError()),0):(Gm(t.vertexShader.getSource().split("\n").map(function(e,t){return"".concat(t,": ").concat(e)}).join("\n")),Gm(t.vertexShader.getError()),0)},e.cleanup=function(){"Unknown"!==t.shaderType&&0!==t.handle&&(t.context.deleteShader(t.handle),t.handle=0)},e.bind=function(){return!(!t.linked&&!t.link()||(t.context.useProgram(t.handle),e.setBound(!0),0))},e.isBound=function(){return!!t.bound},e.release=function(){t.context.useProgram(null),e.setBound(!1)},e.setContext=function(e){t.vertexShader.setContext(e),t.fragmentShader.setContext(e),t.geometryShader.setContext(e)},e.link=function(){if(t.inked)return!0;if(0===t.handle)return t.error="Program has not been initialized, and/or does not have shaders.",!1;if(t.uniformLocs={},t.context.linkProgram(t.handle),!t.context.getProgramParameter(t.handle,t.context.LINK_STATUS)){var n=t.context.getProgramInfoLog(t.handle);return Gm("Error linking shader ".concat(n)),t.handle=0,!1}return e.setLinked(!0),t.attributeLocs={},!0},e.setUniformMatrix=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniformMatrix4fv(a,!1,r),!0)},e.setUniformMatrix3x3=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniformMatrix3fv(a,!1,r),!0)},e.setUniformf=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniform1f(a,r),!0)},e.setUniformfv=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniform1fv(a,r),!0)},e.setUniformi=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniform1i(a,r),!0)},e.setUniformiv=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniform1iv(a,r),!0)},e.setUniform2f=function(n,r,a){var i=e.findUniform(n);if(-1===i)return t.error="Could not set uniform ".concat(n," . No such uniform."),!1;if(void 0===a)throw new RangeError("Invalid number of values for array");return t.context.uniform2f(i,r,a),!0},e.setUniform2fv=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniform2fv(a,r),!0)},e.setUniform2i=function(n,r,a){var i=e.findUniform(n);if(-1===i)return t.error="Could not set uniform ".concat(n," . No such uniform."),!1;if(void 0===a)throw new RangeError("Invalid number of values for array");return t.context.uniform2i(i,r,a),!0},e.setUniform2iv=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniform2iv(a,r),!0)},e.setUniform3f=function(n,r,a,i){var o=e.findUniform(n);if(-1===o)return t.error="Could not set uniform ".concat(n," . No such uniform."),!1;if(void 0===i)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(o,r,a,i),!0},e.setUniform3fArray=function(n,r){var a=e.findUniform(n);if(-1===a)return t.error="Could not set uniform ".concat(n," . No such uniform."),!1;if(!Array.isArray(r)||3!==r.length)throw new RangeError("Invalid number of values for array");return t.context.uniform3f(a,r[0],r[1],r[2]),!0},e.setUniform3fv=function(n,r){var a=e.findUniform(n);return-1===a?(t.error="Could not set uniform ".concat(n," . No such uniform."),!1):(t.context.uniform3fv(a,r),!0)},e.setUniform3i=function(n){var r=e.findUniform(n);if(-1===r)return t.error="Could not set uniform ".concat(n," . No such uniform."),!1;for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o1?a-1:0),o=1;o1?a-1:0),o=1;o3&&void 0!==arguments[3])||arguments[3],a=Array.isArray(n)?n.join("\n"):n,i=!1;-1!==e.search(t)&&(i=!0);var o="";r&&(o="g");var s=new RegExp(t,o);return{replace:i,result:e.replace(s,a)}}};var Hm={forceEmulation:!1,handleVAO:0,handleProgram:0,supported:!0,buffers:null,context:null,openGLRenderWindow:null};function Km(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Hm,n),t.buffers=[],g.a.obj(e,t),g.a.get(e,t,["supported"]),g.a.setGet(e,t,["forceEmulation"]),function(e,t){t.classHierarchy.push("vtkOpenGLVertexArrayObject"),e.exposedMethod=function(){},e.initialize=function(){t.instancingExtension=null,t.openGLRenderWindow.getWebgl2()||(t.instancingExtension=t.context.getExtension("ANGLE_instanced_arrays")),!t.forceEmulation&&t.openGLRenderWindow&&t.openGLRenderWindow.getWebgl2()?(t.extension=null,t.supported=!0,t.handleVAO=t.context.createVertexArray()):(t.extension=t.context.getExtension("OES_vertex_array_object"),!t.forceEmulation&&t.extension?(t.supported=!0,t.handleVAO=t.extension.createVertexArrayOES()):t.supported=!1)},e.isReady=function(){return 0!==t.handleVAO||!1===t.supported},e.bind=function(){if(e.isReady()||e.initialize(),e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(t.handleVAO):t.context.bindVertexArray(t.handleVAO);else if(e.isReady())for(var n=t.context,r=0;r0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+u,1):n.vertexAttribDivisor(o.index+u,1))}},e.release=function(){if(e.isReady()&&t.supported)t.extension?t.extension.bindVertexArrayOES(null):t.context.bindVertexArray(null);else if(e.isReady())for(var n=t.context,r=0;r0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(o.index+u,0):n.vertexAttribDivisor(o.index+u,0)),n.disableVertexAttribArray(o.index+u)}},e.shaderProgramChanged=function(){e.release(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.handleProgram=0},e.releaseGraphicsResources=function(){e.shaderProgramChanged(),t.handleVAO&&(t.extension?t.extension.deleteVertexArrayOES(t.handleVAO):t.context.deleteVertexArray(t.handleVAO)),t.handleVAO=0,t.supported=!0,t.handleProgram=0},e.addAttributeArray=function(t,n,r,a,i,o,s,u){return e.addAttributeArrayWithDivisor(t,n,r,a,i,o,s,u,0,!1)},e.addAttributeArrayWithDivisor=function(n,r,a,i,o,s,u,l,c,d){if(!n)return!1;if(!n.isBound()||0===r.getHandle()||r.getType()!==hm.ARRAY_BUFFER)return!1;if(0===t.handleProgram&&(t.handleProgram=n.getHandle()),e.isReady()||e.initialize(),!e.isReady()||t.handleProgram!==n.getHandle())return!1;var f=t.context,p={};if(p.name=a,p.index=f.getAttribLocation(t.handleProgram,a),p.offset=i,p.stride=o,p.type=s,p.size=u,p.normalize=l,p.isMatrix=d,p.divisor=c,-1===p.Index)return!1;if(r.bind(),f.enableVertexAttribArray(p.index),f.vertexAttribPointer(p.index,p.size,p.type,p.normalize,p.stride,p.offset),c>0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(p.index,1):f.vertexAttribDivisor(p.index,1)),p.buffer=r.getHandle(),!t.supported){for(var g=!1,m=0;m0&&(t.instancingExtension?t.instancingExtension.vertexAttribDivisorANGLE(p+g,1):f.vertexAttribDivisor(p+g,1));return!0},e.removeAttributeArray=function(n){if(!e.isReady()||0===t.handleProgram)return!1;if(!t.supported)for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qm,n),g.a.obj(e,t),t.shaderSourceTime={},g.a.obj(t.shaderSourceTime),t.attributeUpdateTime={},g.a.obj(t.attributeUpdateTime),g.a.setGet(e,t,["program","shaderSourceTime","VAO","attributeUpdateTime","CABO","primitiveType"]),t.program=Ym.newInstance(),t.VAO=Xm.newInstance(),t.CABO=zm.newInstance(),function(e,t){t.classHierarchy.push("vtkOpenGLHelper"),e.setOpenGLRenderWindow=function(e){t.program.setContext(e.getContext()),t.VAO.setOpenGLRenderWindow(e),t.CABO.setOpenGLRenderWindow(e)},e.releaseGraphicsResources=function(e){t.VAO.releaseGraphicsResources(),t.CABO.releaseGraphicsResources(),t.CABO.setElementCount(0)}}(e,t)}var Jm={newInstance:g.a.newInstance(Zm),extend:Zm},$m=n(86),eh=n.n($m),th=n(44),nh=n.n(th);function rh(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ph,n),Rg.extend(e,t,n),t.primitives=[],t.primTypes=ah,t.tmpMat4=Ye.c.create();for(var r=ah.Start;r= cos(radians(lightConeAngle".concat(d,")))")," {"," attenuation = attenuation * pow(coneDot, lightExponent".concat(d,");")," }"," else"," {"," attenuation = 0.0;"," }"," }"," }"," df = max(0.0, attenuation*dot(normalVCVSOutput, -vertLightDirectionVC));"," diffuseL += ((df".concat("",") * lightColor").concat(d,");")," if (dot(normalVCVSOutput, vertLightDirectionVC) < 0.0)"," {"," float sf = attenuation*pow( max(0.0, dot(lightHalfAngleVC".concat(d,",normalVCVSOutput)), specularPower);")," specularL += ((sf".concat("",") * lightColor").concat(d,");")," }"]);s=s.concat([" diffuseL = diffuseL * diffuseColor;"," specularL = specularL * specularColor;"," gl_FragData[0] = vec4(ambientColor * ambient + diffuseL * diffuse + specularL * specular, opacity);"," //VTK::Light::Impl"]),a=Ym.substitute(a,"//VTK::Light::Impl",s,!1).result;break;default:ch("bad light complexity")}e.Fragment=a},e.replaceShaderNormal=function(n,r,a){if(t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){var i=n.Vertex,o=n.Geometry,s=n.Fragment;t.lastBoundBO.getCABO().getNormalOffset()?(i=Ym.substitute(i,"//VTK::Normal::Dec",["attribute vec3 normalMC;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,i=Ym.substitute(i,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * normalMC;"]).result,o=Ym.substitute(o,"//VTK::Normal::Dec",["in vec3 normalVCVSOutput[];","out vec3 normalVCGSOutput;"]).result,o=Ym.substitute(o,"//VTK::Normal::Impl",["normalVCGSOutput = normalVCVSOutput[i];"]).result,s=Ym.substitute(s,"//VTK::Normal::Dec",["varying vec3 normalVCVSOutput;"]).result,s=Ym.substitute(s,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalVCVSOutput);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):t.haveCellNormals?(s=Ym.substitute(s,"//VTK::Normal::Dec",["uniform mat3 normalMatrix;","uniform samplerBuffer textureN;"]).result,s=Ym.substitute(s,"//VTK::Normal::Impl",["vec3 normalVCVSOutput = normalize(normalMatrix *"," texelFetchBuffer(textureN, gl_PrimitiveID + PrimitiveIDOffset).xyz);"," if (gl_FrontFacing == false) { normalVCVSOutput = -normalVCVSOutput; }"]).result):e.getOpenGLMode(a.getProperty().getRepresentation(),t.lastBoundBO.getPrimitiveType())===t.context.LINES?(s=Ym.substitute(s,"//VTK::UniformFlow::Impl",[" vec3 fdx = vec3(dFdx(vertexVC.x),dFdx(vertexVC.y),dFdx(vertexVC.z));"," vec3 fdy = vec3(dFdy(vertexVC.x),dFdy(vertexVC.y),dFdy(vertexVC.z));"," //VTK::UniformFlow::Impl"]).result,s=Ym.substitute(s,"//VTK::Normal::Impl",["vec3 normalVCVSOutput;"," fdx = normalize(fdx);"," fdy = normalize(fdy);"," if (abs(fdx.x) > 0.0)"," { normalVCVSOutput = normalize(cross(vec3(fdx.y, -fdx.x, 0.0), fdx)); }"," else { normalVCVSOutput = normalize(cross(vec3(fdy.y, -fdy.x, 0.0), fdy));}"]).result):(s=Ym.substitute(s,"//VTK::Normal::Dec",["uniform int cameraParallel;"]).result,s=Ym.substitute(s,"//VTK::UniformFlow::Impl",[" vec3 fdx = dFdx(vertexVC.xyz);"," vec3 fdy = dFdy(vertexVC.xyz);"," //VTK::UniformFlow::Impl"]).result,s=Ym.substitute(s,"//VTK::Normal::Impl",[" fdx = normalize(fdx);"," fdy = normalize(fdy);"," vec3 normalVCVSOutput = normalize(cross(fdx,fdy));"," if (cameraParallel == 1 && normalVCVSOutput.z < 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"," if (cameraParallel == 0 && dot(normalVCVSOutput,vertexVC.xyz) > 0.0) { normalVCVSOutput = -1.0*normalVCVSOutput; }"]).result),n.Vertex=i,n.Geometry=o,n.Fragment=s}},e.replaceShaderPositionVC=function(e,n,r){var a=e.Vertex,i=e.Geometry,o=e.Fragment;r.getProperty().getRepresentation()!==ih.POINTS&&t.lastBoundBO.getPrimitiveType()!==ah.Points||(a=Ym.substitute(a,"//VTK::PositionVC::Impl",["//VTK::PositionVC::Impl"," gl_PointSize = ".concat(r.getProperty().getPointSize(),".0;")],!1).result),t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(a=Ym.substitute(a,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,a=Ym.substitute(a,"//VTK::PositionVC::Impl",["vertexVCVSOutput = MCVCMatrix * vertexMC;"," gl_Position = MCDCMatrix * vertexMC;"]).result,a=Ym.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCDCMatrix;","uniform mat4 MCVCMatrix;"]).result,i=Ym.substitute(i,"//VTK::PositionVC::Dec",["in vec4 vertexVCVSOutput[];","out vec4 vertexVCGSOutput;"]).result,i=Ym.substitute(i,"//VTK::PositionVC::Impl",["vertexVCGSOutput = vertexVCVSOutput[i];"]).result,o=Ym.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=Ym.substitute(o,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;"]).result):(a=Ym.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCDCMatrix;"]).result,a=Ym.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCDCMatrix * vertexMC;"]).result),e.Vertex=a,e.Geometry=i,e.Fragment=o},e.replaceShaderTCoord=function(e,n,r){if(t.lastBoundBO.getCABO().getTCoordOffset()){var a=e.Vertex,i=e.Geometry,o=e.Fragment;if(t.drawingEdges)return;a=Ym.substitute(a,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;var s=t.openGLActor.getActiveTextures(),u=2,l=2;if(s&&s.length>0&&(u=s[0].getComponents(),s[0].getTarget()===t.context.TEXTURE_CUBE_MAP&&(l=3)),t.renderable.getColorTextureMap()&&(u=t.renderable.getColorTextureMap().getPointData().getScalars().getNumberOfComponents(),l=2),2===l){if(a=Ym.substitute(a,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,i=Ym.substitute(i,"//VTK::TCoord::Dec",["in vec2 tcoordVCVSOutput[];","out vec2 tcoordVCGSOutput;"]).result,i=Ym.substitute(i,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=Ym.substitute(o,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform sampler2D texture1;"]).result,s&&s.length>=1)switch(u){case 1:o=Ym.substitute(o,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*"," vec4(tcolor.r,tcolor.r,tcolor.r,1.0);"]).result;break;case 2:o=Ym.substitute(o,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*"," vec4(tcolor.r,tcolor.r,tcolor.r,tcolor.g);"]).result;break;default:o=Ym.substitute(o,"//VTK::TCoord::Impl","gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*texture2D(texture1, tcoordVCVSOutput.st);").result}}else switch(a=Ym.substitute(a,"//VTK::TCoord::Dec","attribute vec3 tcoordMC; varying vec3 tcoordVCVSOutput;").result,i=Ym.substitute(i,"//VTK::TCoord::Dec",["in vec3 tcoordVCVSOutput[];","out vec3 tcoordVCGSOutput;"]).result,i=Ym.substitute(i,"//VTK::TCoord::Impl","tcoordVCGSOutput = tcoordVCVSOutput[i];").result,o=Ym.substitute(o,"//VTK::TCoord::Dec",["varying vec3 tcoordVCVSOutput;","uniform samplerCube texture1;"]).result,u){case 1:o=Ym.substitute(o,"//VTK::TCoord::Impl",["vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);","gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*"," vec4(tcolor.r,tcolor.r,tcolor.r,1.0);"]).result;break;case 2:o=Ym.substitute(o,"//VTK::TCoord::Impl",["vec4 tcolor = textureCube(texture1, tcoordVCVSOutput);","gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*"," vec4(tcolor.r,tcolor.r,tcolor.r,tcolor.g);"]).result;break;default:o=Ym.substitute(o,"//VTK::TCoord::Impl","gl_FragData[0] = clamp(gl_FragData[0],0.0,1.0)*textureCube(texture1, tcoordVCVSOutput);").result}e.Vertex=a,e.Geometry=i,e.Fragment=o}},e.replaceShaderClip=function(e,n,r){var a=e.Vertex,i=e.Fragment;if(t.renderable.getNumberOfClippingPlanes()){var o=t.renderable.getNumberOfClippingPlanes();o>6&&(g.a.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),o=6),a=Ym.substitute(a,"//VTK::Clip::Dec",["uniform int numClipPlanes;","uniform vec4 clipPlanes[6];","varying float clipDistancesVSOutput[6];"]).result,a=Ym.substitute(a,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," clipDistancesVSOutput[planeNum] = dot(clipPlanes[planeNum], vertexMC);"," }"]).result,i=Ym.substitute(i,"//VTK::Clip::Dec",["uniform int numClipPlanes;","varying float clipDistancesVSOutput[6];"]).result,i=Ym.substitute(i,"//VTK::Clip::Impl",["for (int planeNum = 0; planeNum < 6; planeNum++)"," {"," if (planeNum >= numClipPlanes)"," {"," break;"," }"," if (clipDistancesVSOutput[planeNum] < 0.0) discard;"," }"]).result}e.Vertex=a,e.Fragment=i},e.getCoincidentParameters=function(e,n){var r=null,a=n.getProperty();if(t.renderable.getResolveCoincidentTopology()||a.getEdgeVisibility()&&a.getRepresentation()===ih.SURFACE){var i=t.lastBoundBO.getPrimitiveType();i===ah.Points||a.getRepresentation()===ih.POINTS?r=t.renderable.getCoincidentTopologyPointOffsetParameter():i===ah.Lines||a.getRepresentation()===ih.WIREFRAME?r=t.renderable.getCoincidentTopologyLineOffsetParameters():i!==ah.Tris&&i!==ah.TriStrips||(r=t.renderable.getCoincidentTopologyPolygonOffsetParameters()),i!==ah.TrisEdges&&i!==ah.TriStripsEdges||((r=t.renderable.getCoincidentTopologyPolygonOffsetParameters()).factor/=2,r.offset/=2)}return r},e.replaceShaderCoincidentOffset=function(n,r,a){var i=e.getCoincidentParameters(r,a);if(i&&(0!==i.factor||0!==i.offset)){var o=n.Fragment;o=Ym.substitute(o,"//VTK::Coincident::Dec",["uniform float cfactor;","uniform float coffset;"]).result,t.context.getExtension("EXT_frag_depth")&&(0!==i.factor?(o=Ym.substitute(o,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,o=Ym.substitute(o,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):o=Ym.substitute(o,"//VTK::Depth::Impl","gl_FragDepthEXT = gl_FragCoord.z + 0.000016*coffset;").result),t.openGLRenderWindow.getWebgl2()&&(0!==i.factor?(o=Ym.substitute(o,"//VTK::UniformFlow::Impl",["float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));","//VTK::UniformFlow::Impl"],!1).result,o=Ym.substitute(o,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;").result):o=Ym.substitute(o,"//VTK::Depth::Impl","gl_FragDepth = gl_FragCoord.z + 0.000016*coffset;").result),n.Fragment=o}},e.replaceShaderPicking=function(e,t,n){var r=e.Fragment;r=Ym.substitute(r,"//VTK::Picking::Dec",["uniform vec3 mapperIndex;","uniform int picking;"]).result,r=Ym.substitute(r,"//VTK::Picking::Impl"," gl_FragData[0] = picking != 0 ? vec4(mapperIndex,1.0) : gl_FragData[0];").result,e.Fragment=r},e.replaceShaderValues=function(n,r,a){if(e.replaceShaderColor(n,r,a),e.replaceShaderNormal(n,r,a),e.replaceShaderLight(n,r,a),e.replaceShaderTCoord(n,r,a),e.replaceShaderPicking(n,r,a),e.replaceShaderClip(n,r,a),e.replaceShaderCoincidentOffset(n,r,a),e.replaceShaderPositionVC(n,r,a),t.haveSeenDepthRequest){var i=n.Fragment;i=Ym.substitute(i,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,i=Ym.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result,n.Fragment=i}},e.getNeedToRebuildShaders=function(n,r,a){var i=0,o=0,s=n.getPrimitiveType(),u=!0,l=t.currentInput,c=a.getProperty().getInterpolation()!==oh.FLAT?l.getPointData().getNormals():null;null===c&&l.getCellData().getNormals()&&(c=l.getCellData().getNormals());var d=null!==c;if(a.getProperty().getRepresentation()!==ih.POINTS&&s!==ah.Points||(u=d),a.getProperty().getLighting()&&u){i=0;for(var f=r.getLightsByReference(),p=0;p0&&(o++,0===i&&(i=1)),1===i&&(o>1||1!==g.getIntensity()||!g.lightTypeIsHeadLight())&&(i=2),i<3&&g.getPositional()&&(i=3)}}var m=!1,h=t.lastBoundBO.getReferenceByName("lastLightComplexity"),v=t.lastBoundBO.getReferenceByName("lastLightCount");return h===i&&v===o||(t.lastBoundBO.set({lastLightComplexity:i},!0),t.lastBoundBO.set({lastLightCount:o},!0),m=!0),!!(t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||0===n.getProgram()||n.getShaderSourceTime().getMTime()n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())){var i=t.lastBoundBO.getReferenceByName("lastLightComplexity");n.getProgram().isAttributeUsed("vertexMC")&&(n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"vertexMC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||ch("Error setting vertexMC in shader VAO.")),n.getProgram().isAttributeUsed("normalMC")&&n.getCABO().getNormalOffset()&&i>0?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"normalMC",n.getCABO().getNormalOffset(),n.getCABO().getStride(),t.context.FLOAT,3,!1)||ch("Error setting normalMC in shader VAO."):n.getVAO().removeAttributeArray("normalMC"),n.getProgram().isAttributeUsed("tcoordMC")&&n.getCABO().getTCoordOffset()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO(),"tcoordMC",n.getCABO().getTCoordOffset(),n.getCABO().getStride(),t.context.FLOAT,n.getCABO().getTCoordComponents(),!1)||ch("Error setting tcoordMC in shader VAO."):n.getVAO().removeAttributeArray("tcoordMC"),n.getProgram().isAttributeUsed("scalarColor")&&n.getCABO().getColorComponents()?n.getVAO().addAttributeArray(n.getProgram(),n.getCABO().getColorBO(),"scalarColor",n.getCABO().getColorOffset(),n.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,4,!0)||ch("Error setting scalarColor in shader VAO."):n.getVAO().removeAttributeArray("scalarColor"),n.getAttributeUpdateTime().modified()}if(t.renderable.getNumberOfClippingPlanes()){var o=t.renderable.getNumberOfClippingPlanes();o>6&&(g.a.vtkErrorMacro("OpenGL has a limit of 6 clipping planes"),o=6);for(var s=[],u=0;u0){var c=l.getColorByReference(),f=l.getIntensity();t.lightColor[0]=c[0]*f,t.lightColor[1]=c[1]*f,t.lightColor[2]=c[2]*f;var p=l.getDirection(),g=n.getActiveCamera().getViewMatrix(),m=rh(p);l.lightTypeIsSceneLight()&&(m[0]=g[0]*p[0]+g[1]*p[1]+g[2]*p[2],m[1]=g[4]*p[0]+g[5]*p[1]+g[6]*p[2],m[2]=g[8]*p[0]+g[9]*p[1]+g[10]*p[2],d.a.normalize(m)),t.lightDirection[0]=m[0],t.lightDirection[1]=m[1],t.lightDirection[2]=m[2],t.lightHalfAngle[0]=-t.lightDirection[0],t.lightHalfAngle[1]=-t.lightDirection[1],t.lightHalfAngle[2]=1-t.lightDirection[2],d.a.normalize(t.lightDirection),i.setUniform3fArray("lightColor".concat(o),t.lightColor),i.setUniform3fArray("lightDirectionVC".concat(o),t.lightDirection),i.setUniform3fArray("lightHalfAngleVC".concat(o),t.lightHalfAngle),o++}}if(!(a<3)){var h=n.getActiveCamera().getViewMatrix();Ye.c.transpose(h,h),o=0;for(var v=0;v0){var M=y.getTransformedPosition(),A=Ye.e.fromValues(M[0],M[1],M[2]);Ye.e.transformMat4(A,A,h),i.setUniform3fArray("lightAttenuation".concat(o),y.getAttenuationValuesByReference()),i.setUniformi("lightPositional".concat(o),y.getPositional()),i.setUniformf("lightExponent".concat(o),y.getExponent()),i.setUniformf("lightConeAngle".concat(o),y.getConeAngle()),i.setUniform3fArray("lightPositionVC".concat(o),[A[0],A[1],A[2]]),o++}}}}},e.setCameraShaderParameters=function(e,n,r){var a=e.getProgram(),i=t.openGLCamera.getKeyMatrices(n),o=n.getActiveCamera(),s=t.openGLCamera.getKeyMatrixTime().getMTime();if(a.getLastCameraMTime()!==s&&(r.getIsIdentity()&&(a.setUniformMatrix("MCDCMatrix",i.wcdc),a.isUniformUsed("MCVCMatrix")&&a.setUniformMatrix("MCVCMatrix",i.wcvc),a.isUniformUsed("normalMatrix")&&a.setUniformMatrix3x3("normalMatrix",i.normalMatrix)),a.isUniformUsed("cameraParallel")&&a.setUniformi("cameraParallel",o.getParallelProjection()),a.setLastCameraMTime(s)),!r.getIsIdentity()){var u=t.openGLActor.getKeyMatrices();if(a.isUniformUsed("normalMatrix")){var l=Ye.b.create();Ye.b.multiply(l,i.normalMatrix,u.normalMatrix),a.setUniformMatrix3x3("normalMatrix",l)}Ye.c.identity(t.tmpMat4),Ye.c.multiply(t.tmpMat4,i.wcdc,u.mcwc),a.setUniformMatrix("MCDCMatrix",t.tmpMat4),a.isUniformUsed("MCVCMatrix")&&(Ye.c.multiply(t.tmpMat4,i.wcvc,u.mcwc),a.setUniformMatrix("MCVCMatrix",t.tmpMat4)),a.setLastCameraMTime(0)}},e.setPropertyShaderParameters=function(e,n,r){var a=e.getProgram(),i=r.getProperty(),o=i.getOpacity();a.setUniformf("opacityUniform",o);var s=t.drawingEdges?i.getEdgeColorByReference():i.getAmbientColorByReference();a.setUniform3fArray("ambientColorUniform",s),a.setUniformf("ambient",i.getAmbient());var u=t.drawingEdges?i.getEdgeColorByReference():i.getDiffuseColorByReference();if(a.setUniform3fArray("diffuseColorUniform",u),a.setUniformf("diffuse",i.getDiffuse()),!(t.lastBoundBO.getReferenceByName("lastLightComplexity")<1)){var l=i.getSpecularColorByReference();a.setUniform3fArray("specularColorUniform",l),a.setUniformf("specular",i.getSpecular()),a.setUniformf("specularPowerUniform",i.getSpecularPower())}},e.renderPieceStart=function(n,r){t.primitiveIDOffset=0,t.openGLRenderer.getSelector()&&(t.openGLRenderer.getSelector().getCurrentPass(),t.openGLRenderer.getSelector().renderProp(r)),e.updateBufferObjects(n,r),t.renderable.getColorTextureMap()&&t.internalColorTexture.activate(),t.lastBoundBO=null},e.renderPieceDraw=function(n,r){for(var a=r.getProperty().getRepresentation(),i=t.context,o=r.getProperty().getEdgeVisibility()&&a===ih.SURFACE,s=ah.Start;s2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,wh,n),mh.extend(e,t,n),t.tmpMat3=Ye.b.create(),t.normalMatrix=Ye.b.create(),t.mcdcMatrix=Ye.c.create(),t.mcvcMatrix=Ye.c.create(),t.tmpColor=[],t.glyphBOBuildTime={},g.a.obj(t.glyphBOBuildTime,{mtime:0}),function(e,t){t.classHierarchy.push("vtkOpenGLGlyph3DMapper");var n=Object.assign({},e);e.renderPiece=function(n,r){if(e.invokeEvent(Ah),t.renderable.getStatic()||t.renderable.update(),t.currentInput=t.renderable.getInputData(1),e.invokeEvent(bh),t.currentInput){if(t.currentInput.getPoints&&t.currentInput.getPoints().getNumberOfValues()){var a=t.context;t.openGLRenderWindow.getWebgl2()?(t.hardwareSupport=!0,t.extension=null):t.extension||(t.extension=t.context.getExtension("ANGLE_instanced_arrays"),t.hardwareSupport=!!t.extension);var i=r.getProperty().getBackfaceCulling(),o=r.getProperty().getFrontfaceCulling();i||o?o?(t.openGLRenderWindow.enableCullFace(),a.cullFace(a.FRONT)):(t.openGLRenderWindow.enableCullFace(),a.cullFace(a.BACK)):t.openGLRenderWindow.disableCullFace(),e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)}}else hh("No input!")},e.multiply4x4WithOffset=function(e,t,n,r){var a=t[0],i=t[1],o=t[2],s=t[3],u=t[4],l=t[5],c=t[6],d=t[7],f=t[8],p=t[9],g=t[10],m=t[11],h=t[12],v=t[13],y=t[14],M=t[15],A=n[r],b=n[r+1],w=n[r+2],D=n[r+3];e[0]=A*a+b*u+w*f+D*h,e[1]=A*i+b*l+w*p+D*v,e[2]=A*o+b*c+w*g+D*y,e[3]=A*s+b*d+w*m+D*M,A=n[r+4],b=n[r+5],w=n[r+6],D=n[r+7],e[4]=A*a+b*u+w*f+D*h,e[5]=A*i+b*l+w*p+D*v,e[6]=A*o+b*c+w*g+D*y,e[7]=A*s+b*d+w*m+D*M,A=n[r+8],b=n[r+9],w=n[r+10],D=n[r+11],e[8]=A*a+b*u+w*f+D*h,e[9]=A*i+b*l+w*p+D*v,e[10]=A*o+b*c+w*g+D*y,e[11]=A*s+b*d+w*m+D*M,A=n[r+12],b=n[r+13],w=n[r+14],D=n[r+15],e[12]=A*a+b*u+w*f+D*h,e[13]=A*i+b*l+w*p+D*v,e[14]=A*o+b*c+w*g+D*y,e[15]=A*s+b*d+w*m+D*M},e.replaceShaderNormal=function(e,r,a){if(t.hardwareSupport&&t.lastBoundBO.getReferenceByName("lastLightComplexity")>0){var i=e.Vertex;t.lastBoundBO.getCABO().getNormalOffset()&&(i=Ym.substitute(i,"//VTK::Normal::Dec",["attribute vec3 normalMC;","attribute mat3 gNormal;","uniform mat3 normalMatrix;","varying vec3 normalVCVSOutput;"]).result,i=Ym.substitute(i,"//VTK::Normal::Impl",["normalVCVSOutput = normalMatrix * gNormal * normalMC;"]).result),e.Vertex=i}n.replaceShaderNormal(e,r,a)},e.replaceShaderColor=function(e,r,a){if(t.hardwareSupport&&t.renderable.getColorArray()){var i=e.Vertex,o=e.Geometry,s=e.Fragment,u=t.lastBoundBO.getReferenceByName("lastLightComplexity"),l=["uniform float ambient;","uniform float diffuse;","uniform float specular;","uniform float opacityUniform; // the fragment opacity"];u&&(l=l.concat(["uniform vec3 specularColorUniform;","uniform float specularPowerUniform;"]));var c=["vec3 ambientColor;"," vec3 diffuseColor;"," float opacity;"];u&&(c=c.concat([" vec3 specularColor;"," float specularPower;"])),c=c.concat([" opacity = opacityUniform;"]),u&&(c=c.concat([" specularColor = specularColorUniform;"," specularPower = specularPowerUniform;"])),t.drawingEdges||(l=l.concat(["varying vec4 vertexColorVSOutput;"]),i=Ym.substitute(i,"//VTK::Color::Dec",["attribute vec4 gColor;","varying vec4 vertexColorVSOutput;"]).result,i=Ym.substitute(i,"//VTK::Color::Impl",["vertexColorVSOutput = gColor;"]).result,o=Ym.substitute(o,"//VTK::Color::Dec",["in vec4 vertexColorVSOutput[];","out vec4 vertexColorGSOutput;"]).result,o=Ym.substitute(o,"//VTK::Color::Impl",["vertexColorGSOutput = vertexColorVSOutput[i];"]).result,c=c.concat([" diffuseColor = vertexColorVSOutput.rgb;"," ambientColor = vertexColorVSOutput.rgb;"," opacity = opacity*vertexColorVSOutput.a;"])),s=Ym.substitute(s,"//VTK::Color::Impl",c).result,s=Ym.substitute(s,"//VTK::Color::Dec",l).result,e.Vertex=i,e.Geometry=o,e.Fragment=s}n.replaceShaderColor(e,r,a)},e.replaceShaderPositionVC=function(e,r,a){if(t.hardwareSupport){var i=e.Vertex;t.lastBoundBO.getReferenceByName("lastLightComplexity")>0?(i=Ym.substitute(i,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;","vertexVCVSOutput = MCVCMatrix * gVertexMC;"," gl_Position = MCDCMatrix * gVertexMC;"]).result,i=Ym.substitute(i,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCDCMatrix;","uniform mat4 MCVCMatrix;"]).result):(i=Ym.substitute(i,"//VTK::Camera::Dec",["attribute mat4 gMatrix;","uniform mat4 MCDCMatrix;"]).result,i=Ym.substitute(i,"//VTK::PositionVC::Impl",["vec4 gVertexMC = gMatrix * vertexMC;"," gl_Position = MCDCMatrix * gVertexMC;"]).result),e.Vertex=i}n.replaceShaderPositionVC(e,r,a)},e.replaceShaderPicking=function(e,r,a){if(t.hardwareSupport){var i=e.Fragment,o=e.Vertex;o=Ym.substitute(o,"//VTK::Picking::Dec",["attribute vec3 mapperIndexVS;","varying vec3 mapperIndexVSOutput;"]).result,o=Ym.substitute(o,"//VTK::Picking::Impl"," mapperIndexVSOutput = mapperIndexVS;").result,e.Vertex=o,i=Ym.substitute(i,"//VTK::Picking::Dec",["varying vec3 mapperIndexVSOutput;","uniform vec3 mapperIndex;","uniform int picking;"]).result,i=Ym.substitute(i,"//VTK::Picking::Impl",[" vec4 pickColor = picking == 2 ? vec4(mapperIndexVSOutput,1.0) : vec4(mapperIndex,1.0);"," gl_FragData[0] = picking != 0 ? pickColor : gl_FragData[0];"]).result,e.Fragment=i}else n.replaceShaderPicking(e,r,a)},e.updateGlyphShaderParameters=function(n,r,a,i,o,s,u,l){var c=a.getProgram();if(n){var d=t.normalMatrix,f=s,p=9*u,g=t.tmpMat3,m=d[0],h=d[1],v=d[2],y=d[3],M=d[4],A=d[5],b=d[6],w=d[7],D=d[8],T=f[p],C=f[p+1],I=f[p+2],x=f[p+3],S=f[p+4],N=f[p+5],E=f[p+6],O=f[p+7],L=f[p+8];g[0]=T*m+C*y+I*b,g[1]=T*h+C*M+I*w,g[2]=T*v+C*A+I*D,g[3]=x*m+S*y+N*b,g[4]=x*h+S*M+N*w,g[5]=x*v+S*A+N*D,g[6]=E*m+O*y+L*b,g[7]=E*h+O*M+L*w,g[8]=E*v+O*A+L*D,c.setUniformMatrix3x3("normalMatrix",t.tmpMat3)}if(e.multiply4x4WithOffset(t.tmpMat4,t.mcdcMatrix,o,16*u),c.setUniformMatrix("MCDCMatrix",t.tmpMat4),r&&(e.multiply4x4WithOffset(t.tmpMat4,t.mcvcMatrix,o,16*u),c.setUniformMatrix("MCVCMatrix",t.tmpMat4)),i){var P=i.getData();t.tmpColor[0]=P[4*u]/255,t.tmpColor[1]=P[4*u+1]/255,t.tmpColor[2]=P[4*u+2]/255,c.setUniform3fArray("ambientColorUniform",t.tmpColor),c.setUniform3fArray("diffuseColorUniform",t.tmpColor)}l&&c.setUniform3fArray("mapperIndex",l.getPropColorValue())},e.renderPieceDraw=function(n,r){var a=r.getProperty().getRepresentation(),i=t.context,o=r.getProperty().getEdgeVisibility()&&a===vh.SURFACE,s=t.openGLCamera.getKeyMatrices(n),u=t.openGLActor.getKeyMatrices();Ye.b.multiply(t.normalMatrix,s.normalMatrix,u.normalMatrix),Ye.c.multiply(t.mcdcMatrix,s.wcdc,u.mcwc),Ye.c.multiply(t.mcvcMatrix,s.wcvc,u.mcwc);var l=t.renderable.getMatrixArray(),c=t.renderable.getNormalArray(),d=t.renderable.getColorArray(),f=l.length/16,p=!1;t.openGLRenderer.getSelector()&&t.openGLRenderer.getSelector().getCurrentPass()===Mh.COMPOSITE_INDEX_PASS&&(p=!0);for(var g=t.primTypes.Start;ge.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime()))return e.getProgram().isAttributeUsed("gMatrix")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.matrixBuffer,"gMatrix",0,64,t.context.FLOAT,4,!1,1)||hh("Error setting gMatrix in shader VAO."):e.getVAO().removeAttributeArray("gMatrix"),e.getProgram().isAttributeUsed("gNormal")?e.getVAO().addAttributeMatrixWithDivisor(e.getProgram(),t.normalBuffer,"gNormal",0,36,t.context.FLOAT,3,!1,1)||hh("Error setting gNormal in shader VAO."):e.getVAO().removeAttributeArray("gNormal"),e.getProgram().isAttributeUsed("gColor")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.colorBuffer,"gColor",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||hh("Error setting gColor in shader VAO."):e.getVAO().removeAttributeArray("gColor"),e.getProgram().isAttributeUsed("mapperIndexVS")?e.getVAO().addAttributeArrayWithDivisor(e.getProgram(),t.pickBuffer,"mapperIndexVS",0,4,t.context.UNSIGNED_BYTE,4,!0,1,!1)||hh("Error setting mapperIndexVS in shader VAO."):e.getVAO().removeAttributeArray("mapperIndexVS"),n.setMapperShaderParameters(e,r,a),void e.getAttributeUpdateTime().modified();n.setMapperShaderParameters(e,r,a)},e.getNeedToRebuildBufferObjects=function(e,r){return t.renderable.buildArrays(),t.VBOBuildTime.getMTime()t.glyphBOBuildTime.getMTime()){t.matrixBuffer.upload(a,yh.ARRAY_BUFFER),t.normalBuffer.upload(i,yh.ARRAY_BUFFER),o?t.colorBuffer.upload(o.getData(),yh.ARRAY_BUFFER):t.colorBuffer.releaseGraphicsResources();for(var s=a.length/16,u=new Uint8Array(4*s),l=0;l2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,xh,n),Rg.extend(e,t,n),t.tris=Jm.newInstance(),t.openGLTexture=Hg.newInstance(),t.colorTexture=Hg.newInstance(),t.opacityTexture=Hg.newInstance(),t.imagemat=Ye.c.create(),g.a.setGet(e,t,[]),t.VBOBuildTime={},g.a.obj(t.VBOBuildTime),function(e,t){t.classHierarchy.push("vtkOpenGLImageMapper"),e.buildPass=function(n){if(n){t.openGLImageSlice=e.getFirstAncestorOfType("vtkOpenGLImageSlice"),t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.openGLRenderWindow=t.openGLRenderer.getParent(),t.context=t.openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t.openGLRenderWindow),t.openGLTexture.setOpenGLRenderWindow(t.openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t.openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t.openGLRenderWindow);var r=t.openGLRenderer.getRenderable();t.openGLCamera=t.openGLRenderer.getViewNodeFor(r.getActiveCamera()),t.renderable.getSliceAtFocalPoint()&&t.renderable.setSliceFromCamera(r.getActiveCamera())}},e.translucentPass=function(t){t&&e.render()},e.opaqueZBufferPass=function(n){n&&(t.haveSeenDepthRequest=!0,t.renderDepth=!0,e.render(),t.renderDepth=!1)},e.opaquePass=function(t){t&&e.render()},e.render=function(){var n=t.openGLImageSlice.getRenderable(),r=t.openGLRenderer.getRenderable();e.renderPiece(r,n)},e.buildShaders=function(t,n,r){e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=function(e,t,n){e.Vertex=eh.a,e.Fragment=nh.a,e.Geometry=""},e.replaceShaderValues=function(e,n,r){var a=e.Vertex,i=e.Fragment;a=Ym.substitute(a,"//VTK::Camera::Dec",["uniform mat4 MCDCMatrix;"]).result,a=Ym.substitute(a,"//VTK::PositionVC::Impl",[" gl_Position = MCDCMatrix * vertexMC;"]).result,a=Ym.substitute(a,"//VTK::TCoord::Impl","tcoordVCVSOutput = tcoordMC;").result;var o=t.openGLTexture.getComponents();switch(a=Ym.substitute(a,"//VTK::TCoord::Dec","attribute vec2 tcoordMC; varying vec2 tcoordVCVSOutput;").result,i=Ym.substitute(i,"//VTK::TCoord::Dec",["varying vec2 tcoordVCVSOutput;","uniform float shift;","uniform float scale;","uniform float oshift;","uniform float oscale;","uniform sampler2D texture1;","uniform sampler2D colorTexture1;","uniform sampler2D opacityTexture1;","uniform float opacity;"]).result,o){case 1:i=Ym.substitute(i,"//VTK::TCoord::Impl",["float intensity = texture2D(texture1, tcoordVCVSOutput).r;","vec3 tcolor = texture2D(colorTexture1, vec2(intensity * scale + shift, 0.5)).rgb;","float scalarOpacity = texture2D(opacityTexture1, vec2(intensity * oscale + oshift, 0.5)).r;","gl_FragData[0] = vec4(tcolor, scalarOpacity * opacity);"]).result;break;case 2:i=Ym.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = texture2D(texture1, tcoordVCVSOutput);","float intensity = tcolor.r*scale + shift;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(intensity, 0.5)), scale*tcolor.g + shift);"]).result;break;default:i=Ym.substitute(i,"//VTK::TCoord::Impl",["vec4 tcolor = scale*texture2D(texture1, tcoordVCVSOutput.st) + shift;","gl_FragData[0] = vec4(texture2D(colorTexture1, vec2(tcolor.r,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.g,0.5)).r,"," texture2D(colorTexture1, vec2(tcolor.b,0.5)).r, tcolor.a);"]).result}t.haveSeenDepthRequest&&(i=Ym.substitute(i,"//VTK::ZBuffer::Dec","uniform int depthRequest;").result,i=Ym.substitute(i,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float iz = floor(gl_FragCoord.z*65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=a,e.Fragment=i},e.getNeedToRebuildShaders=function(e,n,r){var a=t.openGLTexture.getComponents();return(t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||0===e.getProgram()||t.lastTextureComponents!==a)&&(t.lastHaveSeenDepthRequest=t.haveSeenDepthRequest,t.lastTextureComponents=a,!0)},e.updateShaders=function(n,r,a){if(t.lastBoundBO=n,e.getNeedToRebuildShaders(n,r,a)){var i={Vertex:null,Fragment:null,Geometry:null};e.buildShaders(i,r,a);var o=t.openGLRenderWindow.getShaderCache().readyShaderProgramArray(i.Vertex,i.Fragment,i.Geometry);o!==n.getProgram()&&(n.setProgram(o),n.getVAO().releaseGraphicsResources()),n.getShaderSourceTime().modified()}else t.openGLRenderWindow.getShaderCache().readyShaderProgram(n.getProgram());n.getVAO().bind(),e.setMapperShaderParameters(n,r,a),e.setCameraShaderParameters(n,r,a),e.setPropertyShaderParameters(n,r,a)},e.setMapperShaderParameters=function(e,n,r){e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&(e.getProgram().isAttributeUsed("vertexMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"vertexMC",e.getCABO().getVertexOffset(),e.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Ch("Error setting vertexMC in shader VAO.")),e.getProgram().isAttributeUsed("tcoordMC")&&e.getCABO().getTCoordOffset()&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"tcoordMC",e.getCABO().getTCoordOffset(),e.getCABO().getStride(),t.context.FLOAT,e.getCABO().getTCoordComponents(),t.context.FALSE)||Ch("Error setting tcoordMC in shader VAO.")),e.getAttributeUpdateTime().modified());var a=t.openGLTexture.getTextureUnit();e.getProgram().setUniformi("texture1",a);var i=r.getProperty().getColorWindow(),o=r.getProperty().getColorLevel(),s=r.getProperty().getRGBTransferFunction();if(s){var u=s.getRange();i=u[1]-u[0],o=.5*(u[1]+u[0])}var l=t.openGLTexture.getShiftAndScale(),c=l.scale/i,d=(l.shift-o)/i+.5,f=r.getProperty().getScalarOpacity(),p=1,g=0;if(f){var m=f.getRange(),h=m[1]-m[0],v=.5*(m[0]+m[1]);p=l.scale/h,g=(l.shift-v)/h+.5}t.haveSeenDepthRequest&&e.getProgram().setUniformi("depthRequest",t.renderDepth?1:0),e.getProgram().setUniformf("shift",d),e.getProgram().setUniformf("scale",c),e.getProgram().setUniformf("oshift",g),e.getProgram().setUniformf("oscale",p);var y=t.colorTexture.getTextureUnit(),M=t.opacityTexture.getTextureUnit();e.getProgram().setUniformi("colorTexture1",y),e.getProgram().setUniformi("opacityTexture1",M)},e.setCameraShaderParameters=function(e,n,r){var a=e.getProgram(),i=t.openGLImageSlice.getKeyMatrices(),o=t.currentInput.getIndexToWorld();Ye.c.multiply(t.imagemat,i.mcwc,o);var s=t.openGLCamera.getKeyMatrices(n);Ye.c.multiply(t.imagemat,s.wcdc,t.imagemat),a.setUniformMatrix("MCDCMatrix",t.imagemat)},e.setPropertyShaderParameters=function(e,t,n){var r=e.getProgram(),a=n.getProperty().getOpacity();r.setUniformf("opacity",a)},e.renderPieceStart=function(n,r){e.updateBufferObjects(n,r),t.lastBoundBO=null},e.renderPieceDraw=function(n,r){var a=t.context;t.openGLTexture.activate(),t.colorTexture.activate(),t.opacityTexture.activate(),t.tris.getCABO().getElementCount()&&(e.updateShaders(t.tris,n,r),a.drawArrays(a.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release()),t.openGLTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate()},e.renderPieceFinish=function(e,t){},e.renderPiece=function(n,r){e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):Ch("No input!")},e.computeBounds=function(n,r){e.getInput()?t.bounds=e.getInput().getBounds():d.a.uninitializeBounds(t.bounds)},e.updateBufferObjects=function(t,n){e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=function(n,r){return t.VBOBuildTime.getMTime()1?1:0;var L=i.getPointData().getScalars().getData(),P=null;if(A===Ih.I){P=new L.constructor(C[2]*C[1]*x);for(var k=0,R=0;R2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Eh,n),Rg.extend(e,t,n),t.keyMatrixTime={},g.a.obj(t.keyMatrixTime,{mtime:0}),t.keyMatrices={mcwc:Ye.c.create()},g.a.setGet(e,t,["context"]),function(e,t){t.classHierarchy.push("vtkOpenGLImageSlice"),e.buildPass=function(n){if(t.renderable&&t.renderable.getVisibility()&&n){if(!t.renderable)return;t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes()}},e.traverseOpaqueZBufferPass=function(t){e.traverseOpaquePass(t)},e.traverseOpaquePass=function(n){t.renderable&&t.renderable.getVisibility()&&t.renderable.getIsOpaque()&&(!t.openGLRenderer.getSelector()||t.renderable.getPickable())&&(e.apply(n,!0),t.children.forEach(function(e){e.traverse(n)}),e.apply(n,!1))},e.traverseTranslucentPass=function(n){!t.renderable||!t.renderable.getVisibility()||t.renderable.getIsOpaque()||t.openGLRenderer.getSelector()&&!t.renderable.getPickable()||(e.apply(n,!0),t.children.forEach(function(e){e.traverse(n)}),e.apply(n,!1))},e.queryPass=function(e,n){if(e){if(!t.renderable||!t.renderable.getVisibility())return;t.renderable.getIsOpaque()?n.incrementOpaqueActorCount():n.incrementTranslucentActorCount()}},e.opaqueZBufferPass=function(t,n){return e.opaquePass(t,n)},e.opaquePass=function(n,r){n&&(t.context=e.getFirstAncestorOfType("vtkOpenGLRenderWindow").getContext(),t.context.depthMask(!0))},e.translucentPass=function(n,r){n?(t.context=e.getFirstAncestorOfType("vtkOpenGLRenderWindow").getContext(),t.context.depthMask(!1)):t.context.depthMask(!0)},e.getKeyMatrices=function(){return t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(Ye.c.copy(t.keyMatrices.mcwc,t.renderable.getMatrix()),Ye.c.transpose(t.keyMatrices.mcwc,t.keyMatrices.mcwc),t.keyMatrixTime.modified()),t.keyMatrices}}(e,t)}var Lh={newInstance:g.a.newInstance(Oh,"vtkOpenGLImageSlice"),extend:Oh},Ph=g.a.vtkDebugMacro;var kh={};function Rh(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kh,n),Rg.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkOpenGLPixelSpaceCallbackMapper"),e.opaquePass=function(n,r){t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.openGLRenderWindow=t.openGLRenderer.getParent();var a=t.openGLRenderer.getAspectRatio(),i=t.openGLRenderer?t.openGLRenderer.getRenderable().getActiveCamera():null,o=t.openGLRenderer.getTiledSizeAndOrigin(),s=null;if(t.renderable.getUseZValues()){var u=r.getZBufferTexture(),l=Math.floor(u.getWidth()),c=Math.floor(u.getHeight()),d=t.openGLRenderWindow.getContext();u.bind();var f=r.getFramebuffer();f?f.saveCurrentBindingsAndBuffers():Ph("No framebuffer to save/restore");var p=d.createFramebuffer();d.bindFramebuffer(d.FRAMEBUFFER,p),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,u.getHandle(),0),d.checkFramebufferStatus(d.FRAMEBUFFER)===d.FRAMEBUFFER_COMPLETE&&(s=new Uint8Array(l*c*4),d.viewport(0,0,l,c),d.readPixels(0,0,l,c,d.RGBA,d.UNSIGNED_BYTE,s)),f&&f.restorePreviousBindingsAndBuffers(),d.deleteFramebuffer(p)}t.renderable.invokeCallback(t.renderable.getInputData(),i,a,o,s)},e.queryPass=function(e,n){e&&(t.renderable.getUseZValues(),n.setDepthRequested(!0))}}(e,t)}var jh={newInstance:g.a.newInstance(Rh,"vtkOpenGLPixelSpaceCallbackMapper"),extend:Rh},Bh=g.a.vtkDebugMacro;var zh={context:null,openGLRenderWindow:null,selector:null};function _h(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zh,n),Rg.extend(e,t,n),g.a.get(e,t,["shaderCache"]),g.a.setGet(e,t,["selector"]),function(e,t){t.classHierarchy.push("vtkOpenGLRenderer"),e.buildPass=function(n){if(n){if(!t.renderable)return;t.renderable.isActiveCameraCreated()||t.renderable.resetCamera(),e.updateLights(),e.prepareNodes(),e.addMissingNode(t.renderable.getActiveCamera()),e.addMissingNodes(t.renderable.getViewPropsWithNestedProps()),e.removeUnusedNodes()}},e.updateLights=function(){for(var e=0,n=t.renderable.getLightsByReference(),r=0;r0&&e++;return e||(Bh("No lights are on, creating one."),t.renderable.createLight()),e},e.opaqueZBufferPass=function(n){if(n){var r=0,a=t.context;t.renderable.getTransparent()||(t.context.clearColor(1,0,0,1),r|=a.COLOR_BUFFER_BIT),t.renderable.getPreserveDepthBuffer()||(a.clearDepth(1),r|=a.DEPTH_BUFFER_BIT,a.depthMask(!0));var i=e.getTiledSizeAndOrigin();a.enable(a.SCISSOR_TEST),a.scissor(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),a.viewport(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),a.colorMask(!0,!0,!0,!0),a.clear(r),a.enable(a.DEPTH_TEST)}},e.cameraPass=function(t){t&&e.clear()},e.getAspectRatio=function(){var e=t.parent.getSizeByReference(),n=t.renderable.getViewportByReference();return e[0]*(n[2]-n[0])/((n[3]-n[1])*e[1])},e.getTiledSizeAndOrigin=function(){var e=t.renderable.getViewportByReference(),n=[0,0,1,1],r=d.a.clampValue(e[0]-n[0],0,1),a=d.a.clampValue(e[1]-n[1],0,1),i=t.parent.normalizedDisplayToDisplay(r,a),o=Math.round(i[0]),s=Math.round(i[1]),u=d.a.clampValue(e[2]-n[0],0,1),l=d.a.clampValue(e[3]-n[1],0,1);u>n[2]-n[0]&&(u=n[2]-n[0]),l>n[3]-n[1]&&(l=n[3]-n[1]);var c=t.parent.normalizedDisplayToDisplay(u,l),f=Math.round(c[0])-o,p=Math.round(c[1])-s;return f<0&&(f=0),p<0&&(p=0),{usize:f,vsize:p,lowerLeftU:o,lowerLeftV:s}},e.clear=function(){var n=0,r=t.context;if(!t.renderable.getTransparent()){var a=t.renderable.getBackgroundByReference();t.context.clearColor(a[0],a[1],a[2],a[3]),n|=r.COLOR_BUFFER_BIT}t.renderable.getPreserveDepthBuffer()||(r.clearDepth(1),n|=r.DEPTH_BUFFER_BIT,r.depthMask(!0)),r.colorMask(!0,!0,!0,!0);var i=e.getTiledSizeAndOrigin();r.enable(r.SCISSOR_TEST),r.scissor(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),r.viewport(i.lowerLeftU,i.lowerLeftV,i.usize,i.vsize),r.clear(n),r.enable(r.DEPTH_TEST)},e.releaseGraphicsResources=function(){null!==t.selector&&t.selector.releaseGraphicsResources()},e.setOpenGLRenderWindow=function(n){t.openGLRenderWindow!==n&&(e.releaseGraphicsResources(),t.openGLRenderWindow=n,t.context=null,n&&(t.context=t.openGLRenderWindow.getContext()))}}(e,t)}var Vh={newInstance:g.a.newInstance(_h,"vtkOpenGLRenderer"),extend:_h},Fh=g.a.vtkErrorMacro;var Uh={context:null};function Gh(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uh,n),Rg.extend(e,t,n),t.openGLTexture=Hg.newInstance(),t.tris=Jm.newInstance(),t.keyMatrixTime={},g.a.obj(t.keyMatrixTime,{mtime:0}),t.keyMatrices={normalMatrix:Ye.b.create(),mcwc:Ye.c.create()},g.a.setGet(e,t,["context"]),g.a.get(e,t,["activeTextures"]),function(e,t){t.classHierarchy.push("vtkOpenGLSkybox"),e.buildPass=function(n){if(n){t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),t.openGLRenderWindow=t.openGLRenderer.getParent(),t.context=t.openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t.openGLRenderWindow),t.openGLTexture.setOpenGLRenderWindow(t.openGLRenderWindow);var r=t.openGLRenderer.getRenderable();t.openGLCamera=t.openGLRenderer.getViewNodeFor(r.getActiveCamera())}},e.queryPass=function(e,n){if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementOpaqueActorCount()}},e.opaquePass=function(n,r){if(n&&!t.openGLRenderer.getSelector()){e.updateBufferObjects(),t.openGLRenderWindow.enableDepthMask(),t.openGLRenderWindow.getShaderCache().readyShaderProgram(t.tris.getProgram()),t.openGLTexture.render(t.openGLRenderWindow);var a=t.openGLTexture.getTextureUnit();t.tris.getProgram().setUniformi("sbtexture",a);var i=t.openGLRenderer.getRenderable(),o=t.openGLCamera.getKeyMatrices(i),s=Ye.c.create();if(Ye.c.invert(s,o.wcdc),t.tris.getProgram().setUniformMatrix("IMCDCMatrix",s),"box"===t.lastFormat){var u=i.getActiveCamera().getPosition();t.tris.getProgram().setUniform3f("camPos",u[0],u[1],u[2])}t.tris.getVAO().bind(),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.openGLTexture.deactivate()}},e.updateBufferObjects=function(){if(!t.tris.getCABO().getElementCount()){for(var e=new Float32Array(12),n=0;n<4;n++)e[3*n]=n%2*2-1,e[3*n+1]=n>1?1:-1,e[3*n+2]=1;var r=a.a.newInstance({numberOfComponents:3,values:e});r.setName("points");var i=new Uint16Array(8);i[0]=3,i[1]=0,i[2]=1,i[3]=3,i[4]=3,i[5]=0,i[6]=3,i[7]=2;var o=a.a.newInstance({numberOfComponents:1,values:i});t.tris.getCABO().createVBO(o,"polys",Pm.a.SURFACE,{points:r,cellOffset:0})}t.renderable.getFormat()!==t.lastFormat&&(t.lastFormat=t.renderable.getFormat(),"box"===t.lastFormat&&t.tris.setProgram(t.openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCDCMatrix;\n varying vec3 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCDCMatrix * gl_Position;\n TexCoords = wpos.xyz/wpos.w;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec3 TexCoords;\n uniform samplerCube sbtexture;\n uniform vec3 camPos;\n void main () {\n // skybox looks from inside out\n // which means we have to adjust\n // our tcoords. Otherwise text would\n // be flipped\n vec3 tc = normalize(TexCoords - camPos);\n if (abs(tc.z) < max(abs(tc.x),abs(tc.y)))\n {\n tc = vec3(1.0, 1.0, -1.0) * tc;\n }\n else\n {\n tc = vec3(-1.0, 1.0, 1.0) * tc;\n }\n gl_FragData[0] = textureCube(sbtexture, tc);\n }","")),"background"===t.lastFormat&&t.tris.setProgram(t.openGLRenderWindow.getShaderCache().readyShaderProgramArray("//VTK::System::Dec\n attribute vec3 vertexMC;\n uniform mat4 IMCDCMatrix;\n varying vec2 TexCoords;\n void main () {\n gl_Position = vec4(vertexMC.xyz, 1.0);\n vec4 wpos = IMCDCMatrix * gl_Position;\n TexCoords = vec2(vertexMC.x, vertexMC.y)*0.5 + 0.5;\n }","//VTK::System::Dec\n //VTK::Output::Dec\n varying vec2 TexCoords;\n uniform sampler2D sbtexture;\n void main () {\n gl_FragData[0] = textureCube(sbtexture, TexCoords);\n }","")),t.tris.getShaderSourceTime().modified(),t.tris.getVAO().bind(),t.tris.getVAO().addAttributeArray(t.tris.getProgram(),t.tris.getCABO(),"vertexMC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||Fh("Error setting vertexMC in shader VAO."));var s=t.renderable.getTextures();s.length||Fh("vtkSkybox requires a texture map"),t.openGLTexture.getRenderable()!==s[0]&&(t.openGLTexture.releaseGraphicsResources(t.openGLRenderWindow),t.openGLTexture.setRenderable(s[0]))}}(e,t)}var Wh={newInstance:g.a.newInstance(Gh),extend:Gh},Qh=n(139),Yh=n.n(Qh),Hh=g.a.vtkErrorMacro;var Kh={};function Xh(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Kh,n),mh.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkOpenGLSphereMapper");var n=Object.assign({},e);e.getShaderTemplate=function(e,t,n){e.Vertex=Yh.a,e.Fragment=nh.a,e.Geometry=""},e.replaceShaderValues=function(e,r,a){var i=e.Vertex,o=e.Fragment;i=Ym.substitute(i,"//VTK::Camera::Dec",["uniform mat4 VCDCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,o=Ym.substitute(o,"//VTK::PositionVC::Dec",["varying vec4 vertexVCVSOutput;"]).result,o=Ym.substitute(o,"//VTK::PositionVC::Impl",["vec4 vertexVC = vertexVCVSOutput;\n"]).result,o=Ym.substitute(o,"//VTK::Normal::Dec",["uniform float invertedDepth;\n","uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCDCMatrix;\n"]).result;var s="";t.context.getExtension("EXT_frag_depth")&&(s="gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t.openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),o=Ym.substitute(o,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float b = 2.0*dot(EyePos,EyeDir);\n"," float c = dot(EyePos,EyePos) - 1.0;\n"," float d = b*b - 4.0*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - invertedDepth*sqrt(d))*0.5;\n"," normalVCVSOutput = invertedDepth*normalize(EyePos + t*EyeDir);\n"," vertexVC.xyz = normalVCVSOutput*radiusVCVSOutput + centerVCVSOutput;\n"," }\n"," vec4 pos = VCDCMatrix * vertexVC;\n",s]).result,o=Ym.substitute(o,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(o=Ym.substitute(o,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=i,e.Fragment=o,n.replaceShaderValues(e,r,a)},e.setMapperShaderParameters=function(e,r,a){e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"offsetMC",12,e.getCABO().getStride(),t.context.FLOAT,2,!1)||Hh("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isUniformUsed("invertedDepth")&&e.getProgram().setUniformf("invertedDepth",t.invert?-1:1),n.setMapperShaderParameters(e,r,a)},e.setCameraShaderParameters=function(e,n,r){var a=e.getProgram(),i=n.getActiveCamera(),o=t.openGLCamera.getKeyMatrices(n);if(a.isUniformUsed("VCDCMatrix")&&a.setUniformMatrix("VCDCMatrix",o.vcdc),a.isUniformUsed("MCVCMatrix"))if(r.getIsIdentity())a.setUniformMatrix("MCVCMatrix",o.wcvc);else{var s=t.openGLActor.getKeyMatrices(),u=Ye.c.create();Ye.c.multiply(u,o.wcvc,s.mcwc),a.setUniformMatrix("MCVCMatrix",u)}a.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",i.getParallelProjection())},e.getOpenGLMode=function(e,n){return t.context.TRIANGLES},e.buildBufferObjects=function(e,n){var r=t.currentInput;if(null!==r){t.renderable.mapScalars(r,1);var a=t.renderable.getColorMapColors(),i=t.primitives[t.primTypes.Tris].getCABO(),o=r.getPointData(),s=r.getPoints(),u=s.getNumberOfPoints(),l=s.getData(),c=null;null!=t.renderable.getScaleArray()&&o.hasArray(t.renderable.getScaleArray())&&(c=o.getArray(t.renderable.getScaleArray()).getData());var f=null,p=0,g=null;a?(p=a.getNumberOfComponents(),i.setColorOffset(0),i.setColorBOStride(4),f=a.getData(),g=new Uint8Array(3*u*4),i.getColorBO()||i.setColorBO(wm.newInstance()),i.getColorBO().setOpenGLRenderWindow(t.openGLRenderWindow)):i.getColorBO()&&i.setColorBO(null),i.setColorComponents(p);var m=new Float32Array(5*u*3);i.setStride(20);for(var h=Math.cos(d.a.radiansFromDegrees(30)),v=0,y=0,M=0,A=0,b=0;b2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ev,n),mh.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkOpenGLStickMapper");var n=Object.assign({},e);e.getShaderTemplate=function(e,t,n){e.Vertex=Jh.a,e.Fragment=nh.a,e.Geometry=""},e.replaceShaderValues=function(e,r,a){var i=e.Vertex,o=e.Fragment;i=Ym.substitute(i,"//VTK::Camera::Dec",["uniform mat4 VCDCMatrix;\n","uniform mat4 MCVCMatrix;"]).result,o=Ym.substitute(o,"//VTK::PositionVC::Dec","varying vec4 vertexVCVSOutput;").result,o=Ym.substitute(o,"//VTK::PositionVC::Impl"," vec4 vertexVC = vertexVCVSOutput;\n").result,o=Ym.substitute(o,"//VTK::Normal::Dec",["uniform int cameraParallel;\n","varying float radiusVCVSOutput;\n","varying vec3 orientVCVSOutput;\n","varying float lengthVCVSOutput;\n","varying vec3 centerVCVSOutput;\n","uniform mat4 VCDCMatrix;\n"]).result;var s="";t.context.getExtension("EXT_frag_depth")&&(s=" gl_FragDepthEXT = (pos.z / pos.w + 1.0) / 2.0;\n"),t.openGLRenderWindow.getWebgl2()&&(s="gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"),o=Ym.substitute(o,"//VTK::Depth::Impl",[" vec3 EyePos;\n"," vec3 EyeDir;\n"," if (cameraParallel != 0) {\n"," EyePos = vec3(vertexVC.x, vertexVC.y, vertexVC.z + 3.0*radiusVCVSOutput);\n"," EyeDir = vec3(0.0,0.0,-1.0); }\n"," else {\n"," EyeDir = vertexVC.xyz;\n"," EyePos = vec3(0.0,0.0,0.0);\n"," float lengthED = length(EyeDir);\n"," EyeDir = normalize(EyeDir);\n"," if (lengthED > radiusVCVSOutput*3.0) {\n"," EyePos = vertexVC.xyz - EyeDir*3.0*radiusVCVSOutput; }\n"," }\n"," EyePos = EyePos - centerVCVSOutput;\n"," vec3 base1;\n"," if (abs(orientVCVSOutput.z) < 0.99) {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,0.0,1.0))); }\n"," else {\n"," base1 = normalize(cross(orientVCVSOutput,vec3(0.0,1.0,0.0))); }\n"," vec3 base2 = cross(orientVCVSOutput,base1);\n"," EyePos = vec3(dot(EyePos,base1),dot(EyePos,base2),dot(EyePos,orientVCVSOutput));\n"," EyeDir = vec3(dot(EyeDir,base1),dot(EyeDir,base2),dot(EyeDir,orientVCVSOutput));\n"," EyePos = EyePos/radiusVCVSOutput;\n"," float a = EyeDir.x*EyeDir.x + EyeDir.y*EyeDir.y;\n"," float b = 2.0*(EyePos.x*EyeDir.x + EyePos.y*EyeDir.y);\n"," float c = EyePos.x*EyePos.x + EyePos.y*EyePos.y - 1.0;\n"," float d = b*b - 4.0*a*c;\n"," vec3 normalVCVSOutput = vec3(0.0,0.0,1.0);\n"," if (d < 0.0) { discard; }\n"," else {\n"," float t = (-b - sqrt(d))/(2.0*a);\n"," float tz = EyePos.z + t*EyeDir.z;\n"," vec3 iPoint = EyePos + t*EyeDir;\n"," if (abs(iPoint.z)*radiusVCVSOutput > lengthVCVSOutput*0.5) {\n"," float t2 = (-b + sqrt(d))/(2.0*a);\n"," float tz2 = EyePos.z + t2*EyeDir.z;\n"," if (tz2*radiusVCVSOutput > lengthVCVSOutput*0.5 || tz*radiusVCVSOutput < -0.5*lengthVCVSOutput) { discard; }\n"," else {\n"," normalVCVSOutput = orientVCVSOutput;\n"," float t3 = (lengthVCVSOutput*0.5/radiusVCVSOutput - EyePos.z)/EyeDir.z;\n"," iPoint = EyePos + t3*EyeDir;\n"," vertexVC.xyz = radiusVCVSOutput*(iPoint.x*base1 + iPoint.y*base2 + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," else {\n"," normalVCVSOutput = iPoint.x*base1 + iPoint.y*base2;\n"," vertexVC.xyz = radiusVCVSOutput*(normalVCVSOutput + iPoint.z*orientVCVSOutput) + centerVCVSOutput;\n"," }\n"," }\n"," vec4 pos = VCDCMatrix * vertexVC;\n",s]).result,o=Ym.substitute(o,"//VTK::Normal::Impl","").result,t.haveSeenDepthRequest&&(o=Ym.substitute(o,"//VTK::ZBuffer::Impl",["if (depthRequest == 1) {","float computedZ = (pos.z / pos.w + 1.0) / 2.0;","float iz = floor(computedZ * 65535.0 + 0.1);","float rf = floor(iz/256.0)/255.0;","float gf = mod(iz,256.0)/255.0;","gl_FragData[0] = vec4(rf, gf, 0.0, 1.0); }"]).result),e.Vertex=i,e.Fragment=o,n.replaceShaderValues(e,r,a)},e.setMapperShaderParameters=function(e,r,a){e.getCABO().getElementCount()&&(t.VBOBuildTime>e.getAttributeUpdateTime().getMTime()||e.getShaderSourceTime().getMTime()>e.getAttributeUpdateTime().getMTime())&&(e.getProgram().isAttributeUsed("orientMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"orientMC",12,e.getCABO().getStride(),t.context.FLOAT,3,!1)||$h("Error setting 'orientMC' in shader VAO.")),e.getProgram().isAttributeUsed("offsetMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO().getColorBO(),"offsetMC",0,e.getCABO().getColorBOStride(),t.context.UNSIGNED_BYTE,3,!0)||$h("Error setting 'offsetMC' in shader VAO.")),e.getProgram().isAttributeUsed("radiusMC")&&(e.getVAO().addAttributeArray(e.getProgram(),e.getCABO(),"radiusMC",24,e.getCABO().getStride(),t.context.FLOAT,1,!1)||$h("Error setting 'radiusMC' in shader VAO."))),n.setMapperShaderParameters(e,r,a)},e.setCameraShaderParameters=function(e,n,r){var a=e.getProgram(),i=n.getActiveCamera(),o=t.openGLCamera.getKeyMatrices(n);if(a.isUniformUsed("VCDCMatrix")&&a.setUniformMatrix("VCDCMatrix",o.vcdc),r.getIsIdentity())a.isUniformUsed("MCVCMatrix")&&a.setUniformMatrix("MCVCMatrix",o.wcvc),a.isUniformUsed("normalMatrix")&&a.setUniformMatrix3x3("normalMatrix",o.normalMatrix);else{var s=t.openGLActor.getKeyMatrices(),u=Ye.c.create();if(a.isUniformUsed("MCVCMatrix")&&(Ye.c.multiply(u,o.wcvc,s.mcwc),a.setUniformMatrix("MCVCMatrix",u)),a.isUniformUsed("normalMatrix")){var l=Ye.b.create();Ye.b.multiply(l,o.normalMatrix,s.normalMatrix),a.setUniformMatrix3x3("normalMatrix",l)}}a.isUniformUsed("cameraParallel")&&e.getProgram().setUniformi("cameraParallel",i.getParallelProjection())},e.getOpenGLMode=function(e,n){return t.context.TRIANGLES},e.buildBufferObjects=function(e,n){var r=t.currentInput;if(null!==r){t.renderable.mapScalars(r,1);var a=t.renderable.getColorMapColors(),i=t.primitives[t.primTypes.Tris].getCABO(),o=r.getPointData(),s=r.getPoints(),u=s.getNumberOfPoints(),l=s.getData(),c=null,d=0;i.setColorBOStride(4),i.getColorBO()||i.setColorBO(wm.newInstance()),i.getColorBO().setOpenGLRenderWindow(t.openGLRenderWindow),a&&(d=a.getNumberOfComponents(),i.setColorOffset(4),c=a.getData(),i.setColorBOStride(8)),i.setColorComponents(d),i.setStride(28);var f=new Float32Array(7*u*12),p=new Uint8Array(12*u*(c?8:4)),g=null,m=null;null!=t.renderable.getScaleArray()&&o.hasArray(t.renderable.getScaleArray())&&(g=o.getArray(t.renderable.getScaleArray()).getData()),null!=t.renderable.getOrientationArray()&&o.hasArray(t.renderable.getOrientationArray())?m=o.getArray(t.renderable.getOrientationArray()).getData():$h(["Error setting orientationArray.\n","You have to specify the stick orientation"]);for(var h=[0,1,3,0,3,2,2,3,5,2,5,4],v=0,y=0,M=0,A=0,b=0;b=4?255:0,p[A++]=h[T]>=2?255:0,p[A++]=255,y=b*d,c&&(p[A++]=c[y],p[A++]=c[y+1],p[A++]=c[y+2],p[A++]=c[y+3])}i.setElementCount(M/7),i.upload(f,hm.ARRAY_BUFFER),i.getColorBO().upload(p,hm.ARRAY_BUFFER),t.VBOBuildTime.modified()}}}(e,t)}var nv={newInstance:g.d(tv,"vtkOpenGLStickMapper"),extend:tv};var rv={};function av(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rv,n),Rg.extend(e,t,n),t.keyMatrixTime={},g.a.obj(t.keyMatrixTime),t.normalMatrix=Ye.b.create(),t.MCWCMatrix=Ye.c.create(),g.a.setGet(e,t,["context"]),function(e,t){t.classHierarchy.push("vtkOpenGLVolume"),e.buildPass=function(n){t.renderable&&t.renderable.getVisibility()&&n&&(t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer"),e.prepareNodes(),e.addMissingNode(t.renderable.getMapper()),e.removeUnusedNodes())},e.queryPass=function(e,n){if(e){if(!t.renderable||!t.renderable.getVisibility())return;n.incrementVolumeCount()}},e.traverseVolumePass=function(n){t.renderable&&t.renderable.getVisibility()&&(!t.openGLRenderer.getSelector()||t.renderable.getPickable())&&(e.apply(n,!0),t.children[0].traverse(n),e.apply(n,!1))},e.volumePass=function(n){t.renderable&&t.renderable.getVisibility()&&(n?(t.context=e.getFirstAncestorOfType("vtkOpenGLRenderWindow").getContext(),t.context.depthMask(!1)):t.context.depthMask(!0))},e.getKeyMatrices=function(){return t.renderable.getMTime()>t.keyMatrixTime.getMTime()&&(t.renderable.computeMatrix(),Ye.c.copy(t.MCWCMatrix,t.renderable.getMatrix()),Ye.c.transpose(t.MCWCMatrix,t.MCWCMatrix),t.renderable.getIsIdentity()?Ye.b.identity(t.normalMatrix):(Ye.b.fromMat4(t.normalMatrix,t.MCWCMatrix),Ye.b.invert(t.normalMatrix,t.normalMatrix)),t.keyMatrixTime.modified()),{mcwc:t.MCWCMatrix,normalMatrix:t.normalMatrix}}}(e,t)}var iv={newInstance:g.a.newInstance(av,"vtkOpenGLVolume"),extend:av},ov=n(141),sv=n.n(ov),uv=n(142),lv=n.n(uv),cv=n(143),dv=n.n(cv),fv=g.a.vtkWarningMacro,pv=g.a.vtkErrorMacro;var gv={context:null,VBOBuildTime:null,scalarTexture:null,scalarTextureString:null,opacityTexture:null,opacityTextureString:null,colorTexture:null,colortextureString:null,lightingTexture:null,lightingTextureString:null,jitterTexture:null,tris:null,framebuffer:null,copyShader:null,copyVAO:null,lastXYF:1,targetXYF:1,zBufferTexture:null,lastZBufferTexture:null,lastLightComplexity:0,fullViewportTime:1,idxToView:null,idxNormalMatrix:null,avgWindowArea:0,avgFrameTime:0};function mv(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gv,n),Rg.extend(e,t,n),t.VBOBuildTime={},g.a.obj(t.VBOBuildTime,{mtime:0}),t.tris=Jm.newInstance(),t.scalarTexture=Hg.newInstance(),t.opacityTexture=Hg.newInstance(),t.colorTexture=Hg.newInstance(),t.lightingTexture=Hg.newInstance(),t.jitterTexture=Hg.newInstance(),t.jitterTexture.setWrapS(Ng.REPEAT),t.jitterTexture.setWrapT(Ng.REPEAT),t.framebuffer=Zg.newInstance(),t.idxToView=Ye.c.create(),t.idxNormalMatrix=Ye.b.create(),g.a.setGet(e,t,["context"]),function(e,t){t.classHierarchy.push("vtkOpenGLVolumeMapper"),e.buildPass=function(){t.zBufferTexture=null},e.opaqueZBufferPass=function(e,n){if(e){var r=n.getZBufferTexture();r!==t.zBufferTexture&&(t.zBufferTexture=r)}},e.volumePass=function(n,r){if(n){t.openGLRenderWindow=e.getFirstAncestorOfType("vtkOpenGLRenderWindow"),t.context=t.openGLRenderWindow.getContext(),t.tris.setOpenGLRenderWindow(t.openGLRenderWindow),t.scalarTexture.setOpenGLRenderWindow(t.openGLRenderWindow),t.colorTexture.setOpenGLRenderWindow(t.openGLRenderWindow),t.opacityTexture.setOpenGLRenderWindow(t.openGLRenderWindow),t.lightingTexture.setOpenGLRenderWindow(t.openGLRenderWindow),t.jitterTexture.setOpenGLRenderWindow(t.openGLRenderWindow),t.framebuffer.setOpenGLRenderWindow(t.openGLRenderWindow),t.openGLVolume=e.getFirstAncestorOfType("vtkOpenGLVolume");var a=t.openGLVolume.getRenderable();t.openGLRenderer=e.getFirstAncestorOfType("vtkOpenGLRenderer");var i=t.openGLRenderer.getRenderable();t.openGLCamera=t.openGLRenderer.getViewNodeFor(i.getActiveCamera()),e.renderPiece(i,a)}},e.buildShaders=function(t,n,r){e.getShaderTemplate(t,n,r),e.replaceShaderValues(t,n,r)},e.getShaderTemplate=function(e,n,r){e.Vertex=sv.a,t.openGLRenderWindow.getWebgl2()?e.Fragment=dv.a:e.Fragment=lv.a,e.Geometry=""},e.replaceShaderValues=function(n,r,a){var i=n.Fragment,o=a.getProperty().getInterpolationType(),s=a.getProperty().getUseGradientOpacity(0)&&t.lightingTexture.getComputedGradients(),u=t.scalarTexture.getVolumeInfo();if(t.openGLRenderWindow.getWebgl2()){(s||t.lastLightComplexity>0)&&(i=Ym.substitute(i,"//VTK::Normal::Dec",["uniform highp sampler3D normalTexture;"]).result,i=Ym.substitute(i,"//VTK::Normal::Impl",["vec4 normal = texture(normalTexture, ijk);"]).result);var l=t.currentInput.getExtent(),c=t.currentInput.getSpacing(),d=Ye.e.create();Ye.e.set(d,(l[1]-l[0])*c[0],(l[3]-l[2])*c[1],(l[5]-l[4])*c[2]);var f=Ye.e.length(d)/t.renderable.getSampleDistance();i=Ym.substitute(i,"//VTK::MaximumSamplesValue","".concat(Math.ceil(f))).result}else{i=o===ug.LINEAR?Ym.substitute(i,"//VTK::ComputeTCoords",["vec2 tpos = getTextureCoord(ijk, 0.0);","vec2 tpos2 = getTextureCoord(ijk, 1.0);","float zmix = ijk.z - floor(ijk.z);"]).result:Ym.substitute(i,"//VTK::ComputeTCoords",["vec2 tpos = getTextureCoord(ijk, 0.5);"]).result,i=o===ug.LINEAR?Ym.substitute(i,"//VTK::ScalarFunction",["scalar = getScalarValue(tpos);","float scalar2 = getScalarValue(tpos2);","scalar = mix(scalar, scalar2, zmix);"]).result:Ym.substitute(i,"//VTK::ScalarFunction",["scalar = getScalarValue(tpos);"]).result,(s||t.lastLightComplexity>0)&&(i=Ym.substitute(i,"//VTK::Normal::Dec",["uniform sampler2D normalTexture;"]).result,i=o===ug.LINEAR?Ym.substitute(i,"//VTK::Normal::Impl",["vec4 normal = texture2D(normalTexture, tpos);","vec4 normal2 = texture2D(normalTexture, tpos2);","normal = mix(normal, normal2, zmix);"]).result:Ym.substitute(i,"//VTK::Normal::Impl",["vec4 normal = texture2D(normalTexture,tpos);"]).result),i=u.encodedScalars?Ym.substitute(i,"//VTK::ScalarValueFunction::Impl",["vec4 scalarComps = texture2D(texture1, tpos);","return scalarComps.r + scalarComps.g/255.0 + scalarComps.b/65025.0;"]).result:Ym.substitute(i,"//VTK::ScalarValueFunction::Impl","return texture2D(texture1, tpos).r;").result;var p=t.currentInput.getExtent(),g=t.currentInput.getSpacing(),m=Ye.e.create();Ye.e.set(m,(p[1]-p[0])*g[0],(p[3]-p[2])*g[1],(p[5]-p[4])*g[2]);var h=Ye.e.length(m)/t.renderable.getSampleDistance();i=Ym.substitute(i,"//VTK::MaximumSamplesValue","".concat(Math.ceil(h))).result}s&&(i=Ym.substitute(i,"//VTK::GradientOpacity::Dec",["uniform float goscale;","uniform float goshift;","uniform float gomin;","uniform float gomax;"]).result,i=Ym.substitute(i,"//VTK::GradientOpacity::Impl",["tcolor.a = tcolor.a*clamp(normal.a*normal.a*goscale + goshift, gomin, gomax);"]).result),null!==t.zBufferTexture&&(i=Ym.substitute(i,"//VTK::ZBuffer::Dec",["uniform sampler2D zBufferTexture;","uniform float vpWidth;","uniform float vpHeight;"]).result,i=Ym.substitute(i,"//VTK::ZBuffer::Impl",["vec4 depthVec = texture2D(zBufferTexture, vec2(gl_FragCoord.x / vpWidth, gl_FragCoord.y/vpHeight));","float zdepth = (depthVec.r*256.0 + depthVec.g)/257.0;","zdepth = zdepth * 2.0 - 1.0;","zdepth = -2.0 * camFar * camNear / (zdepth*(camFar-camNear)-(camFar+camNear)) - camNear;","zdepth = -zdepth/rayDir.z;","tbounds.y = min(zdepth,tbounds.y);"]).result),n.Fragment=i,e.replaceShaderLight(n,r,a)},e.replaceShaderLight=function(e,n,r){var a=e.Fragment;switch(t.lastLightComplexity){default:case 0:break;case 1:case 2:case 3:a=Ym.substitute(a,"//VTK::Light::Dec",["uniform float vSpecularPower;","uniform float vAmbient;","uniform float vDiffuse;","uniform float vSpecular;","//VTK::Light::Dec"],!1).result,a=Ym.substitute(a,"//VTK::Light::Impl",[" normal.rgb = 2.0*(normal.rgb - 0.5);"," vec3 diffuse = vec3(0.0, 0.0, 0.0);"," vec3 specular = vec3(0.0, 0.0, 0.0);"," //VTK::Light::Impl"," tcolor.rgb = tcolor.rgb*(diffuse*vDiffuse + vAmbient) + specular*vSpecular;"],!1).result;var i=0;n.getLights().forEach(function(e){e.getSwitch()>0&&(a=Ym.substitute(a,"//VTK::Light::Dec",["uniform vec3 lightColor".concat(i,";"),"uniform vec3 lightDirectionWC".concat(i,"; // normalized"),"uniform vec3 lightHalfAngleWC".concat(i,"; // normalized"),"//VTK::Light::Dec"],!1).result,a=Ym.substitute(a,"//VTK::Light::Impl",[" float df = abs(dot(normal.rgb, -lightDirectionWC".concat(i,"));")," diffuse += ((df".concat("",") * lightColor").concat(i,");")," float sf = pow( abs(dot(lightHalfAngleWC".concat(i,",normal.rgb)), vSpecularPower);")," specular += ((sf".concat("",") * lightColor").concat(i,");")," //VTK::Light::Impl"],!1).result,i++)})}e.Fragment=a},e.getNeedToRebuildShaders=function(n,r,a){var i=0;a.getProperty().getShade()&&(i=0,t.numberOfLights=0,r.getLights().forEach(function(e){e.getSwitch()>0&&(t.numberOfLights++,0===i&&(i=1)),1===i&&(t.numberOfLights>1||1!==e.getIntensity()||!e.lightTypeIsHeadLight())&&(i=2),i<3&&e.getPositional()&&(i=3)}));var o=!1;return t.lastLightComplexity!==i&&(t.lastLightComplexity=i,o=!0),!!(0===n.getProgram()||o||t.lastHaveSeenDepthRequest!==t.haveSeenDepthRequest||!!t.lastZBufferTexture!=!!t.zBufferTexture||n.getShaderSourceTime().getMTime()n.getAttributeUpdateTime().getMTime()||n.getShaderSourceTime().getMTime()>n.getAttributeUpdateTime().getMTime())&&(i.isAttributeUsed("vertexDC")&&(n.getVAO().addAttributeArray(i,n.getCABO(),"vertexDC",n.getCABO().getVertexOffset(),n.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||pv("Error setting vertexDC in shader VAO.")),n.getAttributeUpdateTime().modified()),i.setUniformi("texture1",t.scalarTexture.getTextureUnit()),i.setUniformf("sampleDistance",t.renderable.getSampleDistance()),null!==t.zBufferTexture){i.setUniformi("zBufferTexture",t.zBufferTexture.getTextureUnit());var o=e.getRenderTargetSize();i.setUniformf("vpWidth",o[0]),i.setUniformf("vpHeight",o[1])}},e.setCameraShaderParameters=function(e,n,r){var a=t.openGLCamera.getKeyMatrices(n),i=e.getProgram(),o=t.openGLCamera.getRenderable(),s=o.getClippingRange();i.setUniformf("camThick",s[1]-s[0]),i.setUniformf("camNear",s[0]),i.setUniformf("camFar",s[1]);for(var u=t.currentInput.getBounds(),l=t.currentInput.getDimensions(),c=Ye.e.create(),d=Ye.e.create(),f=1,p=-1,g=1,m=-1,h=0;h<8;++h){Ye.e.set(c,u[h%2],u[2+Math.floor(h/2)%2],u[4+Math.floor(h/4)]),Ye.e.transformMat4(c,c,a.wcvc),Ye.e.normalize(d,c);var v=-s[0]/c[2];Ye.e.scale(c,d,v),Ye.e.transformMat4(c,c,a.vcdc),f=Math.min(c[0],f),p=Math.max(c[0],p),g=Math.min(c[1],g),m=Math.max(c[1],m)}i.setUniformf("dcxmin",f),i.setUniformf("dcxmax",p),i.setUniformf("dcymin",g),i.setUniformf("dcymax",m);var y=t.currentInput.getExtent(),M=t.currentInput.getSpacing(),A=Ye.e.create();Ye.e.set(A,(y[1]-y[0])*M[0],(y[3]-y[2])*M[1],(y[5]-y[4])*M[2]),i.setUniform3f("vSize",A[0],A[1],A[2]),Ye.e.set(c,y[0],y[2],y[4]),t.currentInput.indexToWorldVec3(c,c),Ye.e.transformMat4(c,c,a.wcvc),i.setUniform3f("vOriginVC",c[0],c[1],c[2]);var b=t.currentInput.getIndexToWorld();Ye.c.multiply(t.idxToView,a.wcvc,b),Ye.b.copy(t.idxNormalMatrix,t.currentInput.getDirection()),Ye.b.multiply(t.idxNormalMatrix,a.normalMatrix,t.idxNormalMatrix);var w=Ye.e.length(A)/t.renderable.getSampleDistance();w>t.renderable.getMaximumSamplesPerRay()&&fv("The number of steps required ".concat(Math.ceil(w)," is larger than the\n specified maximum number of steps ").concat(t.renderable.getMaximumSamplesPerRay(),".\n Please either change the\n volumeMapper sampleDistance or its maximum number of samples."));var D=Ye.e.create();if(t.openGLRenderWindow.getWebgl2()?Ye.e.set(D,1,1,1):Ye.e.set(D,l[0]-1,l[1]-1,l[2]-1),Ye.e.divide(D,D,A),i.setUniform3f("vVCToIJK",D[0],D[1],D[2]),!t.openGLRenderWindow.getWebgl2()){var T=t.scalarTexture.getVolumeInfo();i.setUniformf("texWidth",t.scalarTexture.getWidth()),i.setUniformf("texHeight",t.scalarTexture.getHeight()),i.setUniformi("xreps",T.xreps),i.setUniformf("xstride",T.xstride),i.setUniformf("ystride",T.ystride),i.setUniformi("repWidth",T.width),i.setUniformi("repHeight",T.height),i.setUniformi("repDepth",l[2])}for(var C=Ye.e.create(),I=Ye.e.create(),x=0;x<6;++x){switch(x){default:case 0:Ye.e.set(C,1,0,0),Ye.e.set(I,y[1],y[3],y[5]);break;case 1:Ye.e.set(C,-1,0,0),Ye.e.set(I,y[0],y[2],y[4]);break;case 2:Ye.e.set(C,0,1,0),Ye.e.set(I,y[1],y[3],y[5]);break;case 3:Ye.e.set(C,0,-1,0),Ye.e.set(I,y[0],y[2],y[4]);break;case 4:Ye.e.set(C,0,0,1),Ye.e.set(I,y[1],y[3],y[5]);break;case 5:Ye.e.set(C,0,0,-1),Ye.e.set(I,y[0],y[2],y[4])}Ye.e.transformMat3(C,C,t.idxNormalMatrix),Ye.e.transformMat4(I,I,t.idxToView);var S=-1*Ye.e.dot(I,C);i.setUniform3f("vPlaneNormal".concat(x),C[0],C[1],C[2]),i.setUniformf("vPlaneDistance".concat(x),S)}var N=Ye.c.create();switch(Ye.c.invert(N,a.vcdc),i.setUniformMatrix("DCVCMatrix",N),t.lastLightComplexity){default:case 0:break;case 1:case 2:case 3:var E=0,O=o.getDirectionOfProjection(),L=[];n.getLights().forEach(function(e){if(e.getSwitch()>0){var t=e.getColor(),n=e.getIntensity();L[0]=t[0]*n,L[1]=t[1]*n,L[2]=t[2]*n,i.setUniform3fArray("lightColor".concat(E),L);var r=e.getDirection();i.setUniform3fArray("lightDirectionWC".concat(E),r);var a=[-.5*(r[0]+O[0]),-.5*(r[1]+O[1]),-.5*(r[2]+O[2])];i.setUniform3fArray("lightHalfAngleWC".concat(E),a),E++}})}},e.setPropertyShaderParameters=function(e,n,r){var a=e.getProgram();a.setUniformi("ctexture",t.colorTexture.getTextureUnit()),a.setUniformi("otexture",t.opacityTexture.getTextureUnit()),a.setUniformi("jtexture",t.jitterTexture.getTextureUnit());var i=t.scalarTexture.getVolumeInfo(),o=i.max-i.min,s=r.getProperty(),u=s.getScalarOpacity(0).getRange();a.setUniformf("oshift",(i.min-u[0])/(u[1]-u[0])),a.setUniformf("oscale",o/(u[1]-u[0]));var l=s.getRGBTransferFunction(0).getRange();a.setUniformf("cshift",(i.min-l[0])/(l[1]-l[0])),a.setUniformf("cscale",o/(l[1]-l[0]));var c=t.lightingTexture.getComputedGradients();if(s.getUseGradientOpacity(0)&&c){var d=t.lightingTexture.getVolumeInfo(),f=s.getGradientOpacityMinimumOpacity(0),p=s.getGradientOpacityMaximumOpacity(0);a.setUniformf("gomin",f),a.setUniformf("gomax",p);var g=[s.getGradientOpacityMinimumValue(0),s.getGradientOpacityMaximumValue(0)];a.setUniformf("goscale",d.max*(p-f)/(g[1]-g[0])),a.setUniformf("goshift",-g[0]*(p-f)/(g[1]-g[0])+f)}(t.lastLightComplexity>0||s.getUseGradientOpacity(0))&&c&&a.setUniformi("normalTexture",t.lightingTexture.getTextureUnit()),t.lastLightComplexity>0&&(a.setUniformf("vAmbient",s.getAmbient()),a.setUniformf("vDiffuse",s.getDiffuse()),a.setUniformf("vSpecular",s.getSpecular()),a.setUniformf("vSpecularPower",s.getSpecularPower()))},e.getRenderTargetSize=function(){if(t.lastXYF>1.43){var e=t.framebuffer.getSize();return[t.fvp[0]*e[0],t.fvp[1]*e[1]]}return t.openGLRenderWindow.getFramebufferSize()},e.renderPieceStart=function(n,r){if(t.renderable.getAutoAdjustSampleDistances()){var a=n.getVTKWindow().getInteractor(),i=a.getLastFrameTime();if(t.avgFrameTime=.97*t.avgFrameTime+.03*i,t.avgWindowArea=.97*t.avgWindowArea+.03/(t.lastXYF*t.lastXYF),n.getVTKWindow().getInteractor().isAnimating()){var o=Math.sqrt(t.avgFrameTime*a.getDesiredUpdateRate()/t.avgWindowArea);o>10&&(o=10),t.targetXYF=o}else t.targetXYF=Math.sqrt(t.avgFrameTime*a.getStillUpdateRate()/t.avgWindowArea);t.targetXYF<1.53&&t.targetXYF>1.33&&(t.targetXYF=t.lastXYF),Math.abs(1-t.targetXYF/t.lastXYF)<.1&&(t.targetXYF=t.lastXYF),t.lastXYF=t.targetXYF}else t.lastXYF=t.renderable.getImageSampleDistance();t.lastXYF<=1.43&&(t.lastXYF=1);var s=t.lastXYF,u=t.openGLRenderWindow.getFramebufferSize();if(s>1.43){if(t.framebuffer.saveCurrentBindingsAndBuffers(),null===t.framebuffer.getGLFramebuffer())t.framebuffer.create(Math.floor(.7*u[0]),Math.floor(.7*u[1])),t.framebuffer.populateFramebuffer();else{var l=t.framebuffer.getSize();l[0]===Math.floor(.7*u[0])&&l[1]===Math.floor(.7*u[1])||(console.log("resizing"),t.framebuffer.create(Math.floor(.7*u[0]),Math.floor(.7*u[1])),t.framebuffer.populateFramebuffer())}t.framebuffer.bind();var c=t.context;c.clearColor(0,0,0,0),c.colorMask(!0,!0,!0,!0),c.clear(c.COLOR_BUFFER_BIT),c.viewport(0,0,u[0]/s,u[1]/s),t.fvp=[Math.floor(u[0]/s)/Math.floor(.7*u[0]),Math.floor(u[1]/s)/Math.floor(.7*u[1])]}t.context.disable(t.context.DEPTH_TEST),e.updateBufferObjects(n,r),r.getProperty().getInterpolationType()===ug.NEAREST?(t.scalarTexture.setMinificationFilter(Eg.NEAREST),t.scalarTexture.setMagnificationFilter(Eg.NEAREST),t.lightingTexture.setMinificationFilter(Eg.NEAREST),t.lightingTexture.setMagnificationFilter(Eg.NEAREST)):(t.scalarTexture.setMinificationFilter(Eg.LINEAR),t.scalarTexture.setMagnificationFilter(Eg.LINEAR),t.lightingTexture.setMinificationFilter(Eg.LINEAR),t.lightingTexture.setMagnificationFilter(Eg.LINEAR)),t.lastBoundBO=null,null!==t.zBufferTexture&&t.zBufferTexture.activate()};var n=null,r=!1;e.renderPieceDraw=function(a,i){var o=t.context;t.scalarTexture.activate(),t.opacityTexture.activate(),t.colorTexture.activate(),t.jitterTexture.activate(),(i.getProperty().getShade()||i.getProperty().getUseGradientOpacity(0))&&(t.lightingTexture.getComputedGradients()?(t.lightingTexture.activate(),r||(r=!0,t.renderable.invokeLightingActivated())):(null!==n&&clearTimeout(n),n=setTimeout(function(){t.openGLRenderWindow.modified()},20),r=!1)),e.updateShaders(t.tris,a,i),o.drawArrays(o.TRIANGLES,0,t.tris.getCABO().getElementCount()),t.tris.getVAO().release(),t.scalarTexture.deactivate(),t.colorTexture.deactivate(),t.opacityTexture.deactivate(),t.jitterTexture.deactivate(),(i.getProperty().getShade()||i.getProperty().getUseGradientOpacity(0))&&t.lightingTexture.deactivate()},e.renderPieceFinish=function(e,n){if(null!==t.zBufferTexture&&t.zBufferTexture.deactivate(),t.lastXYF>1.43){if(t.framebuffer.restorePreviousBindingsAndBuffers(),null===t.copyShader){t.copyShader=t.openGLRenderWindow.getShaderCache().readyShaderProgramArray(["//VTK::System::Dec","attribute vec4 vertexDC;","uniform vec2 tfactor;","varying vec2 tcoord;","void main() { tcoord = vec2(vertexDC.x*0.5 + 0.5, vertexDC.y*0.5 + 0.5) * tfactor; gl_Position = vertexDC; }"].join("\n"),["//VTK::System::Dec","//VTK::Output::Dec","uniform sampler2D texture1;","varying vec2 tcoord;","void main() { gl_FragData[0] = texture2D(texture1,tcoord); }"].join("\n"),"");var r=t.copyShader;t.copyVAO=Xm.newInstance(),t.copyVAO.setOpenGLRenderWindow(t.openGLRenderWindow),t.tris.getCABO().bind(),t.copyVAO.addAttributeArray(r,t.tris.getCABO(),"vertexDC",t.tris.getCABO().getVertexOffset(),t.tris.getCABO().getStride(),t.context.FLOAT,3,t.context.FALSE)||pv("Error setting vertexDC in copy shader VAO.")}else t.openGLRenderWindow.getShaderCache().readyShaderProgram(t.copyShader);var a=t.openGLRenderWindow.getFramebufferSize();t.context.viewport(0,0,a[0],a[1]);var i=t.framebuffer.getColorTexture();i.activate(),t.copyShader.setUniformi("texture",i.getTextureUnit()),t.copyShader.setUniform2f("tfactor",t.fvp[0],t.fvp[1]);var o=t.context;o.blendFuncSeparate(o.ONE,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA),t.context.drawArrays(t.context.TRIANGLES,0,t.tris.getCABO().getElementCount()),i.deactivate(),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}},e.renderPiece=function(n,r){e.invokeEvent({type:"StartEvent"}),t.renderable.update(),t.currentInput=t.renderable.getInputData(),e.invokeEvent({type:"EndEvent"}),t.currentInput?(e.renderPieceStart(n,r),e.renderPieceDraw(n,r),e.renderPieceFinish(n,r)):pv("No input!")},e.computeBounds=function(n,r){e.getInput()?t.bounnds=e.getInput().getBounds():d.a.uninitializeBounds(t.Bounds)},e.updateBufferObjects=function(t,n){e.getNeedToRebuildBufferObjects(t,n)&&e.buildBufferObjects(t,n)},e.getNeedToRebuildBufferObjects=function(n,r){return t.VBOBuildTime.getMTime()1?1:-1,D[3*T+2]=-1;var C=new Uint16Array(8);C[0]=3,C[1]=0,C[2]=1,C[3]=3,C[4]=3,C[5]=0,C[6]=3,C[7]=2;var I=a.a.newInstance({numberOfComponents:3,values:D});I.setName("points");var x=a.a.newInstance({numberOfComponents:1,values:C});t.tris.getCABO().createVBO(x,"polys",Pm.a.SURFACE,{points:I,cellOffset:0})}t.VBOBuildTime.modified()}}}(e,t)}var hv={newInstance:g.a.newInstance(mv,"vtkOpenGLVolumeMapper"),extend:mv};var vv={};function yv(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vv,n),g.a.obj(e,t),function(e,t){t.overrides={},t.classHierarchy.push("vtkViewNodeFactory"),e.createNode=function(n){if(n.isDeleted())return null;for(var r=0,a=n.getClassName(r++),i=!1,o=Object.keys(t.overrides);a&&!i;)-1!==o.indexOf(a)?i=!0:a=n.getClassName(r++);if(!i)return null;var s=t.overrides[a]();return s.setMyFactory(e),s},e.registerOverride=function(e,n){t.overrides[e]=n}}(e,t)}var Mv={newInstance:g.a.newInstance(yv,"vtkViewNodeFactory"),extend:yv};var Av={};function bv(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Av,n),Mv.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkOpenGLViewNodeFactory")}(0,t),e.registerOverride("vtkActor",lm.newInstance),e.registerOverride("vtkActor2D",fm.newInstance),e.registerOverride("vtkCamera",mm.newInstance),e.registerOverride("vtkGlyph3DMapper",Th.newInstance),e.registerOverride("vtkImageMapper",Nh.newInstance),e.registerOverride("vtkImageSlice",Lh.newInstance),e.registerOverride("vtkMapper",mh.newInstance),e.registerOverride("vtkPixelSpaceCallbackMapper",jh.newInstance),e.registerOverride("vtkRenderer",Vh.newInstance),e.registerOverride("vtkSkybox",Wh.newInstance),e.registerOverride("vtkSphereMapper",qh.newInstance),e.registerOverride("vtkStickMapper",nv.newInstance),e.registerOverride("vtkTexture",Hg.newInstance),e.registerOverride("vtkVolume",iv.newInstance),e.registerOverride("vtkVolumeMapper",hv.newInstance),e.registerOverride("vtkWidgetRepresentation",om.newInstance)}var wv={newInstance:g.a.newInstance(bv,"vtkOpenGLViewNodeFactory"),extend:bv},Dv=n(144),Tv=n.n(Dv),Cv=["lastShaderBound","context","openGLRenderWindow"];var Iv={lastShaderBound:null,shaderPrograms:null,context:null,openGLRenderWindow:null};function xv(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.assign(t,Iv,n),t.shaderPrograms={},g.a.obj(e,t),g.a.setGet(e,t,Cv),function(e,t){t.classHierarchy.push("vtkShaderCache"),e.replaceShaderValues=function(e,n,r){var a=n;r.length>0&&(a=Ym.substitute(a,"VSOut","GSOut").result);var i=t.openGLRenderWindow.getWebgl2(),o="\n",s="#version 100\n";i?s="#version 300 es\n#define attribute in\n#define textureCube texture\n#define texture2D texture\n#define textureCubeLod textureLod\n#define texture2DLod textureLod\n":(t.context.getExtension("OES_standard_derivatives"),t.context.getExtension("EXT_frag_depth")&&(o="#extension GL_EXT_frag_depth : enable\n"),t.context.getExtension("EXT_shader_texture_lod")&&(o+="#extension GL_EXT_shader_texture_lod : enable\n#define textureCubeLod textureCubeLodEXT\n#define texture2DLod texture2DLodEXT")),a=Ym.substitute(a,"//VTK::System::Dec",["".concat(s,"\n"),i?"":"#extension GL_OES_standard_derivatives : enable\n",o,"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;var u=Ym.substitute(e,"//VTK::System::Dec",["".concat(s,"\n"),"#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","precision highp int;","#else","precision mediump float;","precision mediump int;","#endif"]).result;return i&&(u=Ym.substitute(u,"varying","out").result,a=Ym.substitute(a,"varying","in").result,a=Ym.substitute(a,"gl_FragData\\[0\\]","fragOutput0").result,a=Ym.substitute(a,"//VTK::Output::Dec","layout(location = 0) out vec4 fragOutput0;").result),{VSSource:u,FSSource:a,GSSource:Ym.substitute(r,"//VTK::System::Dec",s).result}},e.readyShaderProgramArray=function(t,n,r){var a=e.replaceShaderValues(t,n,r),i=e.getShaderProgram(a.VSSource,a.FSSource,a.GSSource);return e.readyShaderProgram(i)},e.readyShaderProgram=function(t){return t&&(t.getCompiled()||t.compileShader())&&e.bindShader(t)?t:null},e.getShaderProgram=function(e,n,r){var a="".concat(e).concat(n).concat(r),i=Tv()(a);if(-1===Object.keys(t.shaderPrograms).indexOf(i)){var o=Ym.newInstance();return o.setContext(t.context),o.getVertexShader().setSource(e),o.getFragmentShader().setSource(n),r&&o.getGeometryShader().setSource(r),o.setMd5Hash(i),t.shaderPrograms[i]=o,o}return t.shaderPrograms[i]},e.releaseGraphicsResources=function(n){e.releaseCurrentShader(),Object.keys(t.shaderPrograms).map(function(e){return t.shaderPrograms[e]}).forEach(function(e){return e.releaseGraphicsResources(n)})},e.releaseGraphicsResources=function(){t.astShaderBound&&(t.lastShaderBound.release(),t.lastShaderBound=null)},e.bindShader=function(e){return t.lastShaderBound===e?1:(t.lastShaderBound&&t.lastShaderBound.release(),e.bind(),t.lastShaderBound=e,1)}}(e,t),Object.freeze(e)}var Sv={newInstance:g.a.newInstance(xv,"vtkShaderCache"),extend:xv},Nv=g.a.vtkErrorMacro;var Ev={context:null,numberOfTextureUnits:0,textureUnits:0};function Ov(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ev,n),g.a.obj(e,t),t.textureUnits=[],g.a.get(e,t,["numberOfTextureUnits"]),g.a.setGet(e,t,["context"]),function(e,t){t.classHierarchy.push("vtkOpenGLTextureUnitManager"),e.deleteTable=function(){for(var e=0;e=t&&a[1]*i[1]<=n&&a[3]*i[1]>=n},e.getViewportSize=function(t){var n=t.getViewportByReference(),r=e.getFramebufferSize();return[(n[2]-n[0])*r[0],(n[3]-n[1])*r[1]]},e.getViewportCenter=function(t){var n=e.getViewportSize(t);return[.5*n[0],.5*n[1]]},e.displayToNormalizedDisplay=function(t,n,r){var a=e.getFramebufferSize();return[t/a[0],n/a[1],r]},e.normalizedDisplayToDisplay=function(t,n,r){var a=e.getFramebufferSize();return[t*a[0],n*a[1],r]},e.worldToView=function(t,n,r,a){var i=e.getViewportSize(a);return a.worldToView(t,n,r,i[0]/i[1])},e.viewToWorld=function(t,n,r,a){var i=e.getViewportSize(a);return a.viewToWorld(t,n,r,i[0]/i[1])},e.worldToDisplay=function(t,n,r,a){var i=e.worldToView(t,n,r,a),o=a.viewToNormalizedDisplay(i[0],i[1],i[2]);return e.normalizedDisplayToDisplay(o[0],o[1],o[2])},e.displayToWorld=function(t,n,r,a){var i=e.displayToNormalizedDisplay(t,n,r),o=a.normalizedDisplayToView(i[0],i[1],i[2]);return e.viewToWorld(o[0],o[1],o[2],a)},e.normalizedDisplayToViewport=function(t,n,r,a){var i=a.getViewportByReference();i=e.normalizedDisplayToDisplay(i[0],i[1],0);var o=e.normalizedDisplayToDisplay(t,n,r);return[o[0]-i[0]-.5,o[1]-i[1]-.5,r]},e.viewportToNormalizedViewport=function(t,n,r,a){var i=e.getViewportSize(a);return i&&0!==i[0]&&0!==i[1]?[t/(i[0]-1),n/(i[1]-1),r]:[t,n,r]},e.normalizedViewportToViewport=function(t,n,r){var a=e.getFramebufferSize();return[t*(a[0]-1),n*(a[1]-1),r]},e.displayToLocalDisplay=function(t,n,r){return[t,e.getFramebufferSize()[1]-n-1,r]},e.viewportToNormalizedDisplay=function(t,n,r,a){var i=a.getViewportByReference(),o=t+(i=e.normalizedDisplayToDisplay(i[0],i[1],0))[0]+.5,s=n+i[1]+.5;return e.displayToNormalizedDisplay(o,s,r)},e.getPixelData=function(e,n,r,a){var i=new Uint8Array((r-e+1)*(a-n+1)*4);return t.context.readPixels(e,n,r-e+1,a-n+1,t.context.RGBA,t.context.UNSIGNED_BYTE,i),i},e.get3DContext=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{preserveDrawingBuffer:!1,depth:!0,alpha:!0},r=null,a="undefined"!=typeof WebGL2RenderingContext;t.webgl2=!1,t.defaultToWebgl2&&a&&(r=t.canvas.getContext("webgl2"))&&(t.webgl2=!0,Bv("using webgl2")),r||(Bv("using webgl1"),r=t.canvas.getContext("webgl",n)||t.canvas.getContext("experimental-webgl",n));new kv.a({PROVIDE_MOBILE_VRDISPLAY:!0,DIRTY_SUBMIT_FRAME_BINDINGS:!1,BUFFER_SCALE:.75});return navigator.getVRDisplays&&navigator.getVRDisplays().then(function(n){n.length>0&&(t.vrDisplay=n[0],t.vrDisplay.depthNear=.01,t.vrDisplay.depthFar=100,e.invokeHaveVRDisplay())}),t.canvas.addEventListener("webglcontextlost",function(e){e.preventDefault()},!1),t.canvas.addEventListener("webglcontextrestored",e.restoreContext,!1),r},e.startVR=function(){t.oldCanvasSize=t.size.slice(),t.vrDisplay.capabilities.canPresent?t.vrDisplay.requestPresent([{source:t.canvas}]).then(function(){if(t.el&&t.vrDisplay.capabilities.hasExternalDisplay&&t.hideCanvasInVR&&(t.el.style.display="none"),t.queryVRSize){var n=t.vrDisplay.getEyeParameters("left"),r=t.vrDisplay.getEyeParameters("right"),a=Math.floor(n.renderWidth+r.renderWidth),i=Math.floor(Math.max(n.renderHeight,r.renderHeight));e.setSize(a,i)}else e.setSize(t.vrResolution);t.renderable.getRenderers()[0].resetCamera(),t.vrFrameData=new VRFrameData,t.renderable.getInteractor().switchToVRAnimation(),t.vrSceneFrame=t.vrDisplay.requestAnimationFrame(e.vrRender),_v&&(t.vrSceneFrame=t.vrDisplay.requestAnimationFrame(e.vrRender))}).catch(function(){console.error("failed to requestPresent")}):zv("vrDisplay is not connected")},e.stopVR=function(){t.renderable.getInteractor().returnFromVRAnimation(),t.vrDisplay.exitPresent(),t.vrDisplay.cancelAnimationFrame(t.vrSceneFrame),e.setSize.apply(e,jv(t.oldCanvasSize)),t.el&&t.vrDisplay.capabilities.hasExternalDisplay&&(t.el.style.display="block");var n=t.renderable.getRenderers()[0];n.getActiveCamera().setProjectionMatrix(null),n.setViewport(0,0,1,1),e.traverseAllPasses()},e.vrRender=function(){if(t.vrDisplay.isPresenting){t.renderable.getInteractor().updateGamepads(t.vrDisplay.displayId),t.vrSceneFrame=t.vrDisplay.requestAnimationFrame(e.vrRender),t.vrDisplay.getFrameData(t.vrFrameData);var n=t.renderable.getRenderers()[0];n.setViewport(0,0,.5,1),n.getActiveCamera().computeViewParametersFromPhysicalMatrix(t.vrFrameData.leftViewMatrix),n.getActiveCamera().setProjectionMatrix(t.vrFrameData.leftProjectionMatrix),e.traverseAllPasses(),n.setViewport(.5,0,1,1),n.getActiveCamera().computeViewParametersFromPhysicalMatrix(t.vrFrameData.rightViewMatrix),n.getActiveCamera().setProjectionMatrix(t.vrFrameData.rightProjectionMatrix),e.traverseAllPasses(),t.vrDisplay.submitFrame()}},e.restoreContext=function(){var t=em.newInstance();t.setCurrentOperation("Release"),t.traverse(e,null)},e.activateTexture=function(n){var r=t.textureResourceIds.get(n);if(void 0===r){var a=e.getTextureUnitManager().allocate();a<0?zv("Hardware does not support the number of textures defined."):(t.textureResourceIds.set(n,a),t.context.activeTexture(t.context.TEXTURE0+a))}else t.context.activeTexture(t.context.TEXTURE0+r)},e.deactivateTexture=function(n){var r=t.textureResourceIds.get(n);void 0!==r&&(e.getTextureUnitManager().free(r),t.textureResourceIds.delete(n))},e.getTextureUnitForTexture=function(e){var n=t.textureResourceIds.get(e);return void 0!==n?n:-1},e.getDefaultTextureInternalFormat=function(e,n,r){if(t.webgl2)switch(e){case Tt.b.UNSIGNED_CHAR:switch(n){case 1:return t.context.R8;case 2:return t.context.RG8;case 3:return t.context.RGB8;case 4:default:return t.context.RGBA8}default:case Tt.b.FLOAT:switch(n){case 1:return t.context.R16F;case 2:return t.context.RG16F;case 3:return t.context.RGB16F;case 4:default:return t.context.RGBA16F}}switch(n){case 1:return t.context.LUMINANCE;case 2:return t.context.LUMINANCE_ALPHA;case 3:return t.context.RGB;case 4:default:return t.context.RGBA}},e.setBackgroundImage=function(e){t.bgImage.src=e.src},e.setUseBackgroundImage=function(e){t.useBackgroundImage=e,t.useBackgroundImage&&!t.el.contains(t.bgImage)?t.el.appendChild(t.bgImage):!t.useBackgroundImage&&t.el.contains(t.bgImage)&&t.el.removeChild(t.bgImage)},e.captureNextImage=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";if(t.deleted)return null;t.imageFormat=n;var r=t.notifyStartCaptureImage;return t.notifyStartCaptureImage=!0,new Promise(function(n,a){var i=e.onImageReady(function(e){t.notifyStartCaptureImage=r,i.unsubscribe(),n(e)})})},e.getGLInformations=function(){for(var n=e.get3DContext(),r=n.getExtension("OES_texture_float"),a=n.getExtension("OES_texture_half_float"),i=n.getExtension("WEBGL_debug_renderer_info"),o=n.getExtension("WEBGL_draw_buffers"),s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),u=[["Max Vertex Attributes","MAX_VERTEX_ATTRIBS",n.getParameter(n.MAX_VERTEX_ATTRIBS)],["Max Varying Vectors","MAX_VARYING_VECTORS",n.getParameter(n.MAX_VARYING_VECTORS)],["Max Vertex Uniform Vectors","MAX_VERTEX_UNIFORM_VECTORS",n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS)],["Max Fragment Uniform Vectors","MAX_FRAGMENT_UNIFORM_VECTORS",n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS)],["Max Fragment Texture Image Units","MAX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS)],["Max Vertex Texture Image Units","MAX_VERTEX_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)],["Max Combined Texture Image Units","MAX_COMBINED_TEXTURE_IMAGE_UNITS",n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS)],["Max 2D Texture Size","MAX_TEXTURE_SIZE",n.getParameter(n.MAX_TEXTURE_SIZE)],["Max Cube Texture Size","MAX_CUBE_MAP_TEXTURE_SIZE",n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE)],["Max Texture Anisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT",s&&n.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT)],["Point Size Range","ALIASED_POINT_SIZE_RANGE",n.getParameter(n.ALIASED_POINT_SIZE_RANGE).join(" - ")],["Line Width Range","ALIASED_LINE_WIDTH_RANGE",n.getParameter(n.ALIASED_LINE_WIDTH_RANGE).join(" - ")],["Max Viewport Dimensions","MAX_VIEWPORT_DIMS",n.getParameter(n.MAX_VIEWPORT_DIMS).join(" - ")],["Max Renderbuffer Size","MAX_RENDERBUFFER_SIZE",n.getParameter(n.MAX_RENDERBUFFER_SIZE)],["Framebuffer Red Bits","RED_BITS",n.getParameter(n.RED_BITS)],["Framebuffer Green Bits","GREEN_BITS",n.getParameter(n.GREEN_BITS)],["Framebuffer Blue Bits","BLUE_BITS",n.getParameter(n.BLUE_BITS)],["Framebuffer Alpha Bits","ALPHA_BITS",n.getParameter(n.ALPHA_BITS)],["Framebuffer Depth Bits","DEPTH_BITS",n.getParameter(n.DEPTH_BITS)],["Framebuffer Stencil Bits","STENCIL_BITS",n.getParameter(n.STENCIL_BITS)],["Framebuffer Subpixel Bits","SUBPIXEL_BITS",n.getParameter(n.SUBPIXEL_BITS)],["MSAA Samples","SAMPLES",n.getParameter(n.SAMPLES)],["MSAA Sample Buffers","SAMPLE_BUFFERS",n.getParameter(n.SAMPLE_BUFFERS)],["Supported Formats for UByte Render Targets ","UNSIGNED_BYTE RENDER TARGET FORMATS",[r&&Vv(n,n.RGBA,n.UNSIGNED_BYTE)?"RGBA":"",r&&Vv(n,n.RGB,n.UNSIGNED_BYTE)?"RGB":"",r&&Vv(n,n.LUMINANCE,n.UNSIGNED_BYTE)?"LUMINANCE":"",r&&Vv(n,n.ALPHA,n.UNSIGNED_BYTE)?"ALPHA":"",r&&Vv(n,n.LUMINANCE_ALPHA,n.UNSIGNED_BYTE)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Half Float Render Targets","HALF FLOAT RENDER TARGET FORMATS",[a&&Vv(n,n.RGBA,a.HALF_FLOAT_OES)?"RGBA":"",a&&Vv(n,n.RGB,a.HALF_FLOAT_OES)?"RGB":"",a&&Vv(n,n.LUMINANCE,a.HALF_FLOAT_OES)?"LUMINANCE":"",a&&Vv(n,n.ALPHA,a.HALF_FLOAT_OES)?"ALPHA":"",a&&Vv(n,n.LUMINANCE_ALPHA,a.HALF_FLOAT_OES)?"LUMINANCE_ALPHA":""].join(" ")],["Supported Formats for Full Float Render Targets","FLOAT RENDER TARGET FORMATS",[r&&Vv(n,n.RGBA,n.FLOAT)?"RGBA":"",r&&Vv(n,n.RGB,n.FLOAT)?"RGB":"",r&&Vv(n,n.LUMINANCE,n.FLOAT)?"LUMINANCE":"",r&&Vv(n,n.ALPHA,n.FLOAT)?"ALPHA":"",r&&Vv(n,n.LUMINANCE_ALPHA,n.FLOAT)?"LUMINANCE_ALPHA":""].join(" ")],["Max Multiple Render Targets Buffers","MAX_DRAW_BUFFERS_WEBGL",o?n.getParameter(o.MAX_DRAW_BUFFERS_WEBGL):0],["High Float Precision in Vertex Shader","HIGH_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Vertex Shader","MEDIUM_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Vertex Shader","LOW_FLOAT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Float Precision in Fragment Shader","HIGH_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).rangeMax,")"].join("")],["Medium Float Precision in Fragment Shader","MEDIUM_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).rangeMax,")"].join("")],["Low Float Precision in Fragment Shader","LOW_FLOAT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_FLOAT).rangeMax,")"].join("")],["High Int Precision in Vertex Shader","HIGH_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Vertex Shader","MEDIUM_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Vertex Shader","LOW_INT VERTEX_SHADER",[n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.LOW_INT).rangeMax,")"].join("")],["High Int Precision in Fragment Shader","HIGH_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_INT).rangeMax,")"].join("")],["Medium Int Precision in Fragment Shader","MEDIUM_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_INT).rangeMax,")"].join("")],["Low Int Precision in Fragment Shader","LOW_INT FRAGMENT_SHADER",[n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).precision," (-2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMin," - 2",n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.LOW_INT).rangeMax,")"].join("")],["Supported Extensions","EXTENSIONS",n.getSupportedExtensions().join("
\t\t\t\t\t ")],["WebGL Renderer","RENDERER",n.getParameter(n.RENDERER)],["WebGL Vendor","VENDOR",n.getParameter(n.VENDOR)],["WebGL Version","VERSION",n.getParameter(n.VERSION)],["Shading Language Version","SHADING_LANGUAGE_VERSION",n.getParameter(n.SHADING_LANGUAGE_VERSION)],["Unmasked Renderer","UNMASKED_RENDERER",i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL)],["Unmasked Vendor","UNMASKED_VENDOR",i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL)],["WebGL Version","WEBGL_VERSION",t.webgl2?2:1]],l={};u.length;){var c=Rv(u.pop(),3),d=c[0],f=c[1],p=c[2];f&&(l[f]={label:d,value:p})}return l},e.traverseAllPasses=function(){if(t.renderPasses)for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:t.imageFormat,r=document.createElement("canvas"),a=r.getContext("2d");r.width=t.canvas.width,r.height=t.canvas.height,a.drawImage(t.canvas,0,0);var i=t.canvas.getBoundingClientRect();t.renderable.getRenderers().forEach(function(e){e.getViewProps().forEach(function(e){if(e.getContainer)for(var t=e.getContainer().getElementsByTagName("canvas"),n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Uv,n),t.canvas=document.createElement("canvas"),t.canvas.style.width="100%",t.bgImage=new Image,t.bgImage.style.position="absolute",t.bgImage.style.left="0",t.bgImage.style.top="0",t.bgImage.style.width="100%",t.bgImage.style.height="100%",t.bgImage.style.zIndex="-1",t.textureResourceIds=new Map,Rg.extend(e,t,n),t.myFactory=wv.newInstance(),t.myFactory.registerOverride("vtkRenderWindow",Wv),t.shaderCache=Sv.newInstance(),t.shaderCache.setOpenGLRenderWindow(e),t.renderPasses[0]=rm.newInstance(),g.a.event(e,t,"imageReady"),g.a.event(e,t,"haveVRDisplay"),g.a.get(e,t,["shaderCache","textureUnitManager","webgl2","vrDisplay","useBackgroundImage"]),g.a.setGet(e,t,["initialized","context","canvas","renderPasses","notifyStartCaptureImage","defaultToWebgl2","cursor","queryVRSize","hideCanvasInVR","useOffScreen","activeFramebuffer"]),g.a.setGetArray(e,t,["size","vrResolution"],2),Fv(e,t)}var Wv=g.a.newInstance(Gv,"vtkOpenGLRenderWindow"),Qv={newInstance:Wv,extend:Gv};function Yv(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qv,n),g.a.obj(e,t),g.a.get(e,t,["renderWindow","renderer","openGLRenderWindow","interactor","rootContainer","container","controlContainer"]),function(e,t){t.rootContainer||(t.rootContainer=document.querySelector("body")),t.container||(t.container=document.createElement("div"),Xv(t.container,t.containerStyle||Hv),t.rootContainer.appendChild(t.container)),t.renderWindow=Xp.newInstance(),t.renderer=Tc.newInstance(),t.renderWindow.addRenderer(t.renderer),t.openGLRenderWindow=Qv.newInstance(),t.openGLRenderWindow.setContainer(t.container),t.renderWindow.addView(t.openGLRenderWindow),t.interactor=di.newInstance(),t.interactor.setInteractorStyle(So.newInstance()),t.interactor.setView(t.openGLRenderWindow),t.interactor.initialize(),t.interactor.bindEvents(t.container),e.setBackground=t.renderer.setBackground,e.removeController=function(){var e=t.controlContainer;e&&e.parentNode.removeChild(e)},e.setControllerVisibility=function(e){t.controllerVisibility=e,t.controlContainer&&(t.controlContainer.style.display=e?"block":"none")},e.toggleControllerVisibility=function(){e.setControllerVisibility(!t.controllerVisibility)},e.addController=function(n){t.controlContainer=document.createElement("div"),Xv(t.controlContainer,t.controlPanelStyle||Kv),t.rootContainer.appendChild(t.controlContainer),t.controlContainer.innerHTML=n,e.setControllerVisibility(t.controllerVisibility),t.rootContainer.addEventListener("keypress",function(t){"c"===String.fromCharCode(t.charCode)&&e.toggleControllerVisibility()})},e.setBackground.apply(e,Yv(t.background)),e.addRepresentation=function(e){e.getActors().forEach(function(e){t.renderer.addActor(e)})},e.removeRepresentation=function(e){e.getActors().forEach(function(e){return t.renderer.removeActor(e)})},e.resize=function(){var e=t.container.getBoundingClientRect(),n=window.devicePixelRatio||1;t.openGLRenderWindow.setSize(Math.floor(e.width*n),Math.floor(e.height*n)),t.resizeCallback&&t.resizeCallback(e),t.renderWindow.render()},e.setResizeCallback=function(n){t.resizeCallback=n,e.resize()},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}(e,t)}var Jv={newInstance:g.a.newInstance(Zv),extend:Zv};function $v(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ey,n),g.a.obj(e,t),g.a.get(e,t,["renderWindow","renderer","openGLRenderWindow","interactor","container"]),g.a.event(e,t,"resize"),function(e,t){var n=e.invokeResize;delete e.invokeResize,t.renderWindow=Xp.newInstance(),t.renderer=Tc.newInstance(),t.renderWindow.addRenderer(t.renderer),t.openGLRenderWindow=Qv.newInstance(),t.renderWindow.addView(t.openGLRenderWindow),t.interactor=di.newInstance(),t.interactor.setInteractorStyle(So.newInstance()),t.interactor.setView(t.openGLRenderWindow),t.interactor.initialize(),e.setBackground=t.renderer.setBackground,e.setBackground.apply(e,$v(t.background)),e.resize=function(){if(t.container){var e=t.container.getBoundingClientRect(),r=window.devicePixelRatio||1;t.openGLRenderWindow.setSize(Math.floor(e.width*r),Math.floor(e.height*r)),n(),t.renderWindow.render()}},e.setContainer=function(e){t.container&&(t.openGLRenderWindow.setContainer(t.container),t.interactor.unbindEvents(t.container)),t.container=e,t.container&&(t.openGLRenderWindow.setContainer(t.container),t.interactor.bindEvents(t.container))},t.listenWindowResize&&window.addEventListener("resize",e.resize),e.resize()}(e,t)}var ny={newInstance:g.a.newInstance(ty),extend:ty},ry=Yc.newInstance(),ay=ry.connect,iy=ry.disconnect;var oy={viewId:"-1",interactiveQuality:60,interactiveRatio:1/window.devicePixelRatio,stillQuality:100,stillRatio:1,rpcMouseEvent:"viewport.mouse.interaction",rpcGestureEvent:null,rpcWheelEvent:null};function sy(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,oy,n),g.a.obj(e,t,n),g.a.get(e,t,["container","viewStream","canvasView","interactor","interactorStyle","interactiveQuality","interactiveRatio","stillQuality","stillRatio"]),g.a.setGet(e,t,["session","rpcMouseEvent","rpcGestureEvent","rpcWheelEvent"]),function(e,t){t.classHierarchy.push("vtkRemoteView"),t.canvasView=Sg.newInstance(),t.interactorStyle=Wo.newInstance(),t.interactor=di.newInstance(),t.interactor.setView(t.canvasView),t.interactor.initialize(),t.interactor.setInteractorStyle(t.interactorStyle),t.interactorStyle.onRemoteMouseEvent(function(e){t.session&&t.rpcMouseEvent&&t.session.call(t.rpcMouseEvent,[e])}),t.interactorStyle.onRemoteWheelEvent(function(e){t.session&&t.rpcWheelEvent&&t.session.call(t.rpcWheelEvent,[e])}),t.interactorStyle.onRemoteGestureEvent(function(e){t.session&&t.rpcGestureEvent&&t.session.call(t.rpcGestureEvent,[e])}),e.delete=g.a.chain(function(){t.session=null,t.canvasView&&(t.canvasView.setViewStream(null),t.canvasView.delete()),t.interactor&&t.interactor.delete(),t.viewStream&&t.viewStream.delete()},e.delete),e.setViewId=function(n){t.viewStream||(t.viewStream=ry.createViewStream(n),t.canvasView.setViewStream(t.viewStream),t.viewStream.setStillQuality(t.stillQuality),t.viewStream.setStillRatio(t.stillRatio),t.viewStream.setInteractiveQuality(t.interactiveQuality),t.viewStream.setInteractiveRatio(t.interactiveRatio),t.interactor.onStartAnimation(t.viewStream.startInteraction),t.interactor.onEndAnimation(t.viewStream.endInteraction)),t.viewStream.setViewId(n),t.interactorStyle.setRemoteEventAddOn({view:n}),e.modified()},e.setContainer=function(n){t.container&&t.interactor.unbindEvents(n),t.container=n,t.canvasView.setContainer(t.container),n&&(t.interactor.bindEvents(n),e.resize())},e.resize=function(){if(t.container&&t.canvasView){var n=t.container.getBoundingClientRect(),r=n.width,a=n.height;t.canvasView.setSize(r,a),e.render()}},e.render=function(){t.viewStream&&t.viewStream.render()};var n={};g.a.set(n,t,["interactiveQuality","interactiveRatio","stillQuality","stillRatio"]),e.setInteractiveQuality=function(e){var r=n.setInteractiveQuality(e);return t.viewStream&&r&&t.viewStream.setInteractiveQuality(t.interactiveQuality),r},e.setInteractiveRatio=function(e){var r=n.setInteractiveRatio(e);return t.viewStream&&r&&t.viewStream.setInteractiveRatio(t.interactiveRatio),r},e.setStillQuality=function(e){var r=n.setStillQuality(e);return t.viewStream&&r&&t.viewStream.setStillQuality(t.stillQuality),r},e.setStillRatio=function(e){var r=n.setStillRatio(e);return t.viewStream&&r&&t.viewStream.setStillRatio(t.stillRatio),r}}(e,t)}var uy={newInstance:g.a.newInstance(sy,"vtkRemoteView"),extend:sy,SHARED_IMAGE_STREAM:ry,connectImageStream:ay,disconnectImageStream:iy},ly=n(60),cy=n.n(ly),dy={left:function(e){return{top:"0",left:"0",bottom:"0",right:"unset",height:"unset",width:"".concat(e,"px")}},right:function(e){return{top:"0",right:"0",bottom:"0",left:"unset",height:"unset",width:"".concat(e,"px")}},top:function(e){return{top:"0",left:"0",right:"0",bottom:"unset",width:"unset",height:"".concat(e,"px")}},bottom:function(e){return{bottom:"0",left:"0",right:"0",top:"unset",width:"unset",height:"".concat(e,"px")}}};function fy(e,t){var n=Object.assign({},e);function r(e){t.renderWindowContainer.style[e]="0px"}function a(){var e,n,a,i;["left","right","top","bottom"].forEach(r),t.renderWindowContainer.style[t.controlPosition]="".concat(t.controlSize,"px"),e=t.controlContainer,n=t.controlPosition,a=t.controlSize,i=dy[n](a),Object.keys(i).forEach(function(t){e.style[t]=i[t]})}t.renderWindowContainer=document.createElement("div"),t.renderWindowContainer.classList.add(cy.a.renderWindow),n.setContainer(t.renderWindowContainer),t.controlContainer=document.createElement("div"),t.controlContainer.classList.add(cy.a.control),e.setContainer=function(n){t.rootContainer&&(t.rootContainer.removeChild(t.container),t.rootContainer.removeChild(t.controlContainer),t.rootContainer.classList.remove(cy.a.rootContainer)),t.rootContainer=n,t.rootContainer&&(t.rootContainer.appendChild(t.container),t.rootContainer.appendChild(t.controlContainer),t.rootContainer.classList.add(cy.a.rootContainer),a(),e.resize())},e.setControlSize=function(n){t.controlSize=n,a(),e.modified()},e.setControlPosition=function(n){t.controlPosition=n,a(),e.modified()},t.listenWindowResize&&window.addEventListener("resize",e.resize),a(),e.resize()}var py={rootContainer:null,controlPosition:"left",controlSize:10};function gy(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,py,n),ny.extend(e,t),g.a.get(e,t,["rootContainer","controlContainer","renderWindowContainer"]),fy(e,t)}var my={newInstance:g.a.newInstance(gy,"vtkRenderWindowWithControlBar"),extend:gy};function hy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function vy(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:{},n=yy[e];return n&&n.build?n.build(t):(console.log("No builder for",e),null)}function xy(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Iy||Cy?yy[e]={build:t,update:n}:delete yy[e]}function Sy(){Object.keys(yy).forEach(function(e){delete yy[e]})}function Ny(e){if(1===e[1].length)return-1===wy.indexOf(e[1][0]);for(var t=!1,n=0;n1&&void 0!==arguments[1]?arguments[1]:[];return t.dependencies&&t.dependencies.forEach(function(t){n.push(t.id),e(t,n)}),n}(e);t.set({flattenedDepIds:a},!0),a.forEach(function(e){return r.add(e)})}});var a=new Set;t.calls&&t.calls.filter(Ny).filter(function(e){return"removeViewProp"===e[0]}).forEach(function(e){Ty(e[1]).forEach(function(e){var t=n.getInstance(e).get("flattenedDepIds").flattenedDepIds;t&&t.forEach(function(e){return a.add(e)}),a.add(e)})}),vy(a).filter(function(e){return!r.has(e)}).forEach(function(e){return n.unregisterInstance(e)})}},vtkOpenGLCamera:{build:lc.newInstance,update:function(e,t,n){by[t.id]||Ey(e,t,n),by[t.id]=!0}},vtkPolyData:{build:Ie.a.newInstance,update:function(e,t,n){n.start();var r=t.properties,i=r.fields.length,o=[[e.getPointData().removeAllArrays,[]],[e.getCellData().removeAllArrays,[]]];function s(){if(o.length-2===i){for(;o.length;){var t=hy(o.shift(),2),r=t[0],a=t[1];r.apply(void 0,vy(a))}e.modified(),n.end()}}["points","polys","verts","lines","strips"].forEach(function(t){if(r[t]){i+=1;var a=r[t];n.getArray(a.hash,a.dataType,n).then(function(n){o.push([e.get(t)[t].setData,[n,a.numberOfComponents]]),s()},function(e){console.log("error geometry fetching array",e)})}}),r.fields.forEach(function(t){n.getArray(t.hash,t.dataType,n).then(function(n){var r=a.a.newInstance(Object.assign({values:n},t)),i=t.registration?t.registration:"addArray";o.push([e.get(t.location)[t.location][i],[r]]),s()},function(e){console.log("error field fetching array",e)})})}},vtkPVDiscretizableColorTransferFunction:{build:vp.newInstance,update:function(e,t,n){n.start();var r=t.properties.nodes.map(function(e){var t=hy(e,6);return{x:t[0],r:t[1],g:t[2],b:t[3],midpoint:t[4],sharpness:t[5]}});e.set(Object.assign({},t.properties,{nodes:r}),!0),e.sortAndUpdateRange(),e.modified(),n.end()}},vtkPVLODActor:{build:su.a.newInstance,update:Ey},vtkOpenGLActor:{build:su.a.newInstance,update:Ey},vtkRenderWindow:{build:Xp.newInstance,update:function(e,t,n){t.calls&&t.calls.filter(Ny).filter(function(e){return"removeRenderer"===e[0]}).forEach(function(e){Ty(e[1]).forEach(function(e){var t=n.getInstance(e);t.getViewProps().forEach(function(e){var t=e.get("flattenedDepIds").flattenedDepIds;t&&t.forEach(function(e){return n.unregisterInstance(e)}),n.unregisterInstance(n.getInstanceId(e))}),t.removeAllViewProps()})}),e.render(),Ey(e,t,n)}},vtkOpenGLLight:{build:fc.newInstance,update:Ey},vtkPVLight:{build:fc.newInstance,update:Ey}};!function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&Sy(),Object.keys(Oy).forEach(function(e){var t=Oy[e];xy(e,t.build,t.update)})}(),Dy.vtkOpenGLLight={},Dy.vtkPVLight={};var Ly={build:Iy,update:Cy,setTypeMapping:xy,clearTypeMapping:Sy,getSupportedTypes:function(){return Object.keys(yy)},clearOneTimeUpdaters:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:"default",t=ky[e];return t||(t=Object.assign({},Ry(),jy()),ky[e]=t),t}function zy(e,t){var n,r,a,i,o=(n=e.render,r=0,{start:function(){r+=1},end:function(){0==(r-=1)&&n&&n()}}),s=(a={},i="default",{getMTime:function(e){return a[e||i]||1},incrementMTime:function(e){var t=e||i;a[t]||(a[t]=1),a[t]+=1},setActiveViewId:function(e){i=e},getActiveViewId:function(){return i}}),u=Object.assign({},t,o,s),l=-1,c=100,d=function(e){return e.get("managedInstanceId").managedInstanceId},f=function(){return g.a.traverseInstanceTree(e,d)};function p(t){e.set({synchronizedViewId:t},!0,!0)}function m(){return e.get("synchronizedViewId").synchronizedViewId}return{synchronize:function(t){return m()||p(t.id),m()===t.id&&l2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_y,n),Xp.extend(e,t),function(e,t){t.classHierarchy.push("vtkSynchronizableRenderWindow"),t.synchronizerContext||(t.synchronizerContext=By(t.synchronizerContextName));var n=zy(e,t.synchronizerContext);Object.keys(n).forEach(function(t){e[t]=n[t]})}(e,t)}var Fy=g.a.newInstance(Vy,"vtkSynchronizableRenderWindow");var Uy={Core:Tg,Misc:{vtkCanvasView:Sg,vtkFullScreenRenderWindow:Jv,vtkGenericRenderWindow:ny,vtkRemoveView:uy,vtkRenderWindowWithControlBar:my,vtkSynchronizableRenderWindow:{newInstance:Fy,extend:Vy,getSynchronizerContext:By,setSynchronizerContext:function(e,t){ky[e]=t},decorate:function(e){var t=zy(e,By(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default"));return Object.assign(t,e)},createInstanceMap:jy,createArrayHandler:Ry}},OpenGL:{vtkActor:lm,vtkActor2D:fm,vtkBufferObject:wm,vtkCamera:mm,vtkCellArrayBufferObject:zm,vtkFramebuffer:Zg,vtkGlyph3DMapper:Th,vtkHardwareSelector:Lm,vtkHelper:Jm,vtkImageMapper:Nh,vtkImageSlice:Lh,vtkPolyDataMapper:mh,vtkRenderer:Vh,vtkRenderWindow:Qv,vtkShader:Um,vtkShaderCache:Sv,vtkShaderProgram:Ym,vtkSkybox:Wh,vtkSphereMapper:qh,vtkStickMapper:nv,vtkTexture:Hg,vtkTextureUnitManager:Lv,vtkVertexArrayObject:Xm,vtkViewNodeFactory:wv,vtkVolume:iv,vtkVolumeMapper:hv},SceneGraph:{vtkGenericWidgetRepresentation:om,vtkRenderPass:em,vtkViewNode:Rg,vtkViewNodeFactory:Mv}};function Gy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var Wy={actors:[],volumes:[],sourceDependencies:[]};var Qy={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Wy,n),g.a.obj(e,t),g.a.get(e,t,["input","mapper","actors","volumes"]),function(e,t){function n(){if(t.input)for(var e=0;e2&&void 0!==arguments[2]?arguments[2]:-1,i=e.getDataArray(n,r).getRange(a);t.proxyManager.rescaleTransferFunctionToDataRange(n,i)},e.isVisible=function(){return t.actors.length?t.actors[0].getVisibility():!!t.volumes.length&&t.volumes[0].getVisibility()},e.setVisibility=function(e){for(var n=t.actors.length;n--;)t.actors[n].setVisibility(e);for(n=t.volumes.length;n--;)t.volumes[n].setVisibility(e)},e.setColorBy=function(n,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=uu.a.ColorMode.DEFAULT,o=uu.a.ScalarMode.DEFAULT,s=n,u=!!e.getDataArray(n,r),l=n?e.getLookupTableProxy(n).getLookupTable():null;l&&(-1===a?l.setVectorModeToMagnitude():(l.setVectorModeToComponent(),l.setVectorComponent(a))),u&&(i=uu.a.ColorMode.MAP_SCALARS,o="pointData"===r?uu.a.ScalarMode.USE_POINT_FIELD_DATA:uu.a.ScalarMode.USE_CELL_FIELD_DATA,t.mapper.setLookupTable&&t.mapper.setLookupTable(l),e.rescaleTransferFunctionToDataRange(n,r,a)),t.mapper.set({colorByArrayName:s,colorMode:i,scalarMode:o,scalarVisibility:u},!0)},e.getColorBy=function(){if(!t.mapper.getColorByArrayName){var n=e.getInputDataSet();return n.getPointData().getScalars()?[n.getPointData().getScalars().getName(),"pointData",-1]:n.getCellData().getScalars()?[n.getCellData().getScalars().getName(),"cellData",-1]:n.getPointData().getNumberOfArrays()?[n.getPointData().getArrayByIndex(0).getName(),"pointData",-1]:n.getCellData().getNumberOfArrays()?[n.getCellData().getArrayByIndex(0).getName(),"cellData",-1]:[]}var r=[],a=t.mapper.get("colorByArrayName","colorMode","scalarMode","scalarVisibility"),i=a.colorByArrayName,o=a.colorMode,s=a.scalarMode;if(a.scalarVisibility&&i&&(r.push(i),r.push(s===uu.a.ScalarMode.USE_POINT_FIELD_DATA?"pointData":"cellData")),o===uu.a.ColorMode.MAP_SCALARS&&i){var u=e.getLookupTableProxy(i).getLookupTable(),l=u.getVectorMode()===y.a.VectorMode.MAGNITUDE?-1:u.getVectorComponent();r.push(l)}return r},e.listDataArrays=function(){var n=[];if(!t.input)return n;for(var r=e.getInputDataSet(),a=r.getPointData(),i=a.getNumberOfArrays(),o=0;o2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Xy,n),g.a.obj(e,t),g.a.setGet(e,t,["arrayName"]),g.a.get(e,t,["mode","lookupTable","presetName","rgbPoints","hsvPoints","nodes","dataRange"]),function(e,t){t.classHierarchy.push("vtkLookupTableProxy"),t.lookupTable=t.lookupTable||vp.newInstance(),t.lookupTable.setVectorModeToMagnitude(),e.setPresetName=function(n){t.presetName!==n&&(t.presetName=n,t.mode=Hy.Preset,e.applyMode())},e.setRGBPoints=function(n){t.rgbPoints!==n&&(t.rgbPoints=(n||Ky.RGBPoints).slice(),e.applyMode())},e.setHSVPoints=function(n){t.hsvPoints!==n&&(t.hsvPoints=(n||Ky.HSVPoints).slice(),e.applyMode())},e.setNodes=function(n){t.nodes!==n&&(t.nodes=(n||Ky.Nodes).slice(),e.applyMode())},e.setMode=function(n){t.mode!==n&&(t.mode=n,e.applyMode())},e.applyMode=function(){switch(t.mode){case Hy.Preset:t.lookupTable.applyColorMap(xs.getPresetByName(t.presetName));break;case Hy.RGBPoints:t.lookupTable.removeAllPoints(),t.rgbPoints.forEach(function(e){var n;return(n=t.lookupTable).addRGBPoint.apply(n,Yy(e))});break;case Hy.HSVPoints:t.lookupTable.removeAllPoints(),t.hsvPoints.forEach(function(e){var n;return(n=t.lookupTable).addHSVPoint.apply(n,Yy(e))});break;case Hy.Nodes:t.lookupTable.setNodes(t.nodes)}t.lookupTable.setMappingRange(t.dataRange[0],t.dataRange[1]),t.lookupTable.updateRange(),e.modified()},e.setDataRange=function(n,r){t.dataRange[0]===n&&t.dataRange[1]===r||(t.dataRange[0]=n,t.dataRange[1]=r,t.lookupTable.setMappingRange(t.dataRange[0],t.dataRange[1]),t.lookupTable.updateRange(),e.applyMode())},e.applyMode()}(e,t),g.a.proxy(e,t)}var Zy={newInstance:g.a.newInstance(qy,"vtkLookupTableProxy"),extend:qy,Mode:Hy,Defaults:Ky};function Jy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var $y={Gaussians:0,Points:1,Nodes:2},eM={Gaussians:[{position:.5,height:1,width:.5,xBias:.5,yBias:.5}],Points:[[0,0],[1,1]],Nodes:[{x:0,y:0,midpoint:.5,sharpness:0},{x:1,y:1,midpoint:.5,sharpness:0}]};function tM(e,t){t.classHierarchy.push("vtkPiecewiseFunctionProxy"),t.piecewiseFunction=t.piecewiseFunction||De.newInstance(),e.setGaussians=function(n){t.gaussians=(n||[]).slice(),0===t.gaussians.length&&(t.gaussians=eM.Gaussians.slice()),e.applyMode()},e.setPoints=function(n){t.points=(n||[]).slice(),0===t.points.length&&(t.points=eM.Points.slice()),e.applyMode()},e.setNodes=function(n){t.nodes=(n||[]).slice(),0===t.nodes.length&&(t.nodes=eM.Nodes.slice()),e.applyMode()},e.setMode=function(n){t.mode!==n&&(t.mode=n,e.applyMode())},e.applyMode=function(){switch(t.mode){case $y.Gaussians:Xs.applyGaussianToPiecewiseFunction(t.gaussians,255,t.dataRange,t.piecewiseFunction),e.modified();break;case $y.Points:n=t.points,r=t.dataRange,a=t.piecewiseFunction,i=r[1]-r[0],o=n.map(function(e){var t=Jy(e,2),n=t[0],a=t[1];return[n*i+r[0],a]}),a.removeAllPoints(),o.forEach(function(e){var t=Jy(e,2),n=t[0],r=t[1];return a.addPoint(n,r)}),e.modified();break;case $y.Nodes:!function(e,t,n){var r=t[1]-t[0],a=e.map(function(e){return Object.assign({},e,{x:e.x*r+t[0]})});n.setNodes(a)}(t.nodes,t.dataRange,t.piecewiseFunction),e.modified()}var n,r,a,i,o},e.getLookupTableProxy=function(){return t.proxyManager.getLookupTable(t.arrayName)},e.setDataRange=function(n,r){t.dataRange[0]===n&&t.dataRange[1]===r||(t.dataRange[0]=n,t.dataRange[1]=r,e.applyMode())},e.applyMode()}var nM={mode:$y.Gaussians,gaussians:eM.Gaussians,points:eM.Points,nodes:eM.Nodes,arrayName:"No array associated",arrayLocation:"pointData",dataRange:[0,1]};function rM(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nM,n),g.a.obj(e,t),g.a.setGet(e,t,["arrayName"]),g.a.get(e,t,["piecewiseFunction","gaussians","nodes","points","mode","dataRange"]),tM(e,t),g.a.proxy(e,t)}var aM={newInstance:g.a.newInstance(rM,"vtkPiecewiseFunctionProxy"),extend:rM,Mode:$y,Defaults:eM},iM=g.a.vtkErrorMacro;function oM(e,t){function n(n){var r=n.getProxyId?n.getProxyId():n,a=t.proxyIdMapping[r];return Object.keys(t.proxyByGroup).forEach(function(e){var n=t.proxyByGroup[e],r=n.indexOf(a);-1!==r&&n.splice(r,1)}),delete t.proxyIdMapping[r],a.gcPropertyLinks("application"),a.gcPropertyLinks("source"),a.setProxyManager(null),e.invokeProxyRegistrationChange({action:"unregister",proxyId:r,proxyName:a.getProxyName(),proxyGroup:a.getProxyGroup()}),a}e.setActiveSource=function(n){t.activeSource!==n&&(t.activeSourceSubscription&&(t.activeSourceSubscription.unsubscribe(),t.activeSourceSubscription=null),t.activeSource=n,n&&(t.activeSourceSubscription=n.onModified(e.modified)),e.modified(),e.invokeActiveSourceChange(n))},e.setActiveView=function(n){t.activeView!==n&&(t.activeViewSubscription&&(t.activeViewSubscription.unsubscribe(),t.activeViewSubscription=null),t.activeView=n,n&&(t.activeViewSubscription=n.onModified(e.modified)),e.modified(),e.invokeActiveViewChange(n))},e.getProxyById=function(e){return t.proxyIdMapping[e]},e.getProxyGroups=function(){return Object.keys(t.proxyByGroup)},e.getProxyInGroup=function(e){return[].concat(t.proxyByGroup[e]||[])},e.getSources=function(){return[].concat(t.proxyByGroup.Sources||[])},e.getRepresentations=function(){return[].concat(t.proxyByGroup.Representations||[])},e.getViews=function(){return[].concat(t.proxyByGroup.Views||[])},e.createProxy=function(n,r,a){var i=t.proxyConfiguration.definitions;if(!i[n]||!i[n][r])return null;var o=i[n][r],s=Object.assign({},o.options,a),u=o.class.newInstance(Object.assign({},s,{proxyGroup:n,proxyName:r,proxyManager:e}));if(o.proxyProps){var l={};Object.keys(o.proxyProps).forEach(function(t){var n=o.proxyProps[t];l[t]=e.createProxy(n.group,n.name,n.options)}),u.set(l)}return o.props&&u.set(o.props),function(n){if(n){t.proxyIdMapping[n.getProxyId()]=n;var r=n.getProxyGroup();t.proxyByGroup[r]||(t.proxyByGroup[r]=[]),-1===t.proxyByGroup[r].indexOf(n)&&t.proxyByGroup[r].push(n),n.setProxyManager(e),g.a.setImmediate(function(){e.invokeProxyRegistrationChange({action:"register",proxyId:n.getProxyId(),proxyName:n.getProxyName(),proxyGroup:n.getProxyGroup(),proxy:n})})}}(u),s.activateOnCreate&&u.activate(),u},e.getRepresentation=function(n,r){var a=n||e.getActiveSource(),i=r||e.getActiveView();if(!a||!i||!a.getType())return null;var o=a.getProxyId(),s=i.getProxyId(),u=t.sv2rMapping[o];u||(u={},t.sv2rMapping[o]=u);var l=u[s];if(!l){var c=i.getProxyName(),d=a.getType(),f=t.proxyConfiguration.representations[c][d];if(!f)return iM("No definition for representation of ".concat(d," in view ").concat(c)),null;l=e.createProxy("Representations",f.name,f.options),t.r2svMapping[l.getProxyId()]={sourceId:o,viewId:s},u[s]=l,l.setInput(a),i.addRepresentation(l)}return l},e.deleteProxy=function(r){var a=r.getProxyGroup().toLowerCase();if("views"===a&&(r.getRepresentations().forEach(function(t){e.deleteProxy(t)}),r.setContainer(null),n(r),e.getActiveView()===r&&e.setActiveView(e.getViews()[0])),"representations"===a){var i=t.r2svMapping[r.getProxyId()],o=i.sourceId,s=i.viewId;e.getProxyById(s).removeRepresentation(r),delete t.r2svMapping[r.getProxyId()],delete t.sv2rMapping[o][s],n(r)}if("sources"===a){var u=t.sv2rMapping[r.getProxyId()];Object.keys(u).forEach(function(t){e.deleteProxy(u[t])}),n(r),e.getActiveSource()===r&&e.setActiveSource(e.getSources()[0])}r.delete()}}function sM(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,{proxyIdMapping:{},proxyByGroup:{},proxyConfiguration:{},sv2rMapping:{},r2svMapping:{},collapseState:{},lookupTables:{},piecewiseFunctions:{},animating:!1},n),g.a.obj(e,t),g.a.setGet(e,t,["proxyConfiguration","activeSource","activeView"]),g.a.event(e,t,"ActiveSourceChange"),g.a.event(e,t,"ActiveViewChange"),g.a.event(e,t,"ProxyRegistrationChange"),oM(e,t),function(e,t){e.loadState=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(r,a){var i={},o={},s={},u=n.datasetHandler||Ot.a,l=[];t.sources.forEach(function(t){var n=t.id,r=t.group,a=t.name,o=t.props;l.push(Promise.resolve(u(o.dataset)).then(function(t){if(t){var s=e.createProxy(r,a);return s.setName(o.name),s.setInputData(t,o.type),i[n]=s,s}return null}))}),Promise.all(l).then(function(){var n=e.getViews();function a(e){i[e]&&s[e]&&i[e].resetOrientation().then(function(){i[e].getCamera().set(s[e]),i[e].getRenderer().updateLightsGeometryToFollowCamera(),i[e].renderLater()})}t.views.forEach(function(r){var a=r.id,o=r.group,u=r.name,l=r.props,c=r.camera,d=null;t.options.recycleViews&&(d=n.find(function(e){return e.getProxyGroup()===o&&e.getProxyName()===u&&e.getName()===l.name})),d?d.setDisableAnimation(!0):d=e.createProxy(o,u,{disableAnimation:!0}),d.set(l,!0),i[a]=d,s[a]=c}),t.representations.forEach(function(t){var n=t.source,r=t.view,o=t.props;e.getRepresentation(i[n],i[r]).set(o,!0),a(r)}),Object.keys(t.fields).forEach(function(n){var r=t.fields[n],a=r.lookupTable,i=r.piecewiseFunction,o=e.getLookupTable(n,a);o.setPresetName(a.presetName),o.setDataRange.apply(o,sM(a.dataRange));var s=e.getPiecewiseFunction(n,i);switch(i.mode){case aM.Mode.Gaussians:s.setGaussians(i.gaussians);break;case aM.Mode.Points:s.setPoints(i.points);break;case aM.Mode.Nodes:s.setNodes(i.nodes)}s.setMode(i.mode),s.setDataRange.apply(s,sM(i.dataRange))}),Object.keys(s).forEach(a),Object.keys(i).forEach(function(e){var t=i[e].getProxyId();o[e]=t}),t.views.forEach(function(e){var t=e.id;i[t].setDisableAnimation(!1)}),r(Object.assign({},t.userData,{$oldToNewIdMapping:o}))}).catch(a)})},e.saveState=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(r,a){var i=e.getSources(),o=e.getViews(),s=t.datasetHandler||function(e){return e.getState()};delete t.datasetHandler;var u=[],l=new Set,c={userData:n,options:t,sources:[],views:[],representations:[],fields:{}};i.forEach(function(e){var t=Promise.resolve(s(e.getDataset(),e));u.push(t),c.sources.push({id:e.getProxyId(),group:e.getProxyGroup(),name:e.getProxyName(),props:{name:e.getName(),type:e.getType(),dataset:t}})}),o.forEach(function(e){var t=e.getCamera().get("position","viewUp","focalPoint");c.views.push({id:e.getProxyId(),group:e.getProxyGroup(),name:e.getProxyName(),props:Object.assign(uM(e),e.get("axis","orientation","viewUp")),camera:t}),e.getRepresentations().forEach(function(t){c.representations.push({source:t.getInput().getProxyId(),view:e.getProxyId(),props:uM(t)}),l.add(t.getColorBy()[0])})}),l.forEach(function(t){c.fields[t]={lookupTable:e.getLookupTable(t).get("mode","presetName","rgbPoints","hsvPoints","nodes","arrayName","arrayLocation","dataRange"),piecewiseFunction:e.getPiecewiseFunction(t).get("mode","gaussians","points","nodes","arrayName","arrayLocation","dataRange")}}),Promise.all(u).then(function(){for(var e=function(e){c.sources[e].props.dataset.then(function(t){c.sources[e].props.dataset=t})},t=0;t0&&void 0!==arguments[0]&&arguments[0],n=e.getViews().filter(function(e){return!t||e.getContainer()}),r=0;r0&&void 0!==arguments[0]?arguments[0]:250;if(!t.animating){t.animating=!0;for(var a=e.getViews().filter(function(e){return e.getContainer()}),i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,fM,n),g.a.obj(e,t),g.a.get(e,t,["name","type","dataset","algo","inputProxy"]),g.a.set(e,t,["name"]),g.a.event(e,t,"DatasetChange"),g.a.proxy(e,t),function(e,t){t.classHierarchy.push("vtkSourceProxy"),e.setInputProxy=function(n){t.inputSubscription&&(t.inputSubscription(),t.inputSubscription=null),t.inputProxy=n,t.inputProxy&&(t.inputSubscription=n.onModified(e.update,-1).unsubscribe),e.update()},e.setInputData=function(n,r){t.dataset!==n&&(t.dataset=n,t.type=r||n.getClassName(),e.modified(),e.invokeDatasetChange())},e.setInputAlgorithm=function(n,r){var a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.type=r,t.algo!==n&&(t.algo=n,t.algoSubscription&&(t.algoSubscription(),t.algoSubscription=null),n&&a&&(t.algoSubscription=n.onModified(function(){e.update()},-1).unsubscribe,e.update()))},e.update=function(){t.algo&&t.inputProxy&&t.algo.setInputData(t.inputProxy.getDataset()),t.updateDomain&&t.inputProxy&&t.updateDomain(e,t.inputProxy.getDataset()),t.algo&&e.setInputData(t.algo.getOutputData(),t.type)},e.getUpdate=function(){return t.algo.getMTime()>t.dataset.getMTime()},e.delete=g.a.chain(function(){t.algoSubscription&&(t.algoSubscription(),t.algoSubscription=null),t.inputSubscription&&(t.inputSubscription(),t.inputSubscription=null)},e.delete),t.inputProxy&&(t.inputSubscription=t.inputProxy.onModified(function(){e.update()},-1).unsubscribe),t.algoFactory&&e.setInputAlgorithm(t.algoFactory.newInstance(),null,t.autoUpdate),e.update()}(e,t),t.proxyPropertyMapping&&g.a.proxyPropertyMapping(e,t,t.proxyPropertyMapping)}var gM={newInstance:g.a.newInstance(pM,"vtkSourceProxy"),extend:pM},mM={slice:vo.vtkMouseCameraSliceManipulator,multiRotate:vo.vtkMouseCameraTrackballMultiRotateManipulator,pan:vo.vtkMouseCameraTrackballPanManipulator,roll:vo.vtkMouseCameraTrackballRollManipulator,rotate:vo.vtkMouseCameraTrackballRotateManipulator,zoom:vo.vtkMouseCameraTrackballZoomManipulator,zoomToMouse:vo.vtkMouseCameraTrackballZoomToMouseManipulator,range:vo.vtkMouseRangeManipulator,vrPan:vo.vtkVRButtonPanManipulator,gestureCamera:vo.vtkGestureCameraManipulator},hM={"3D":[{type:"rotate"},{type:"pan",options:{shift:!0}},{type:"zoom",options:{control:!0}},{type:"zoom",options:{alt:!0}},{type:"zoom",options:{dragEnabled:!1,scrollEnabled:!0}},{type:"zoom",options:{button:3}},{type:"roll",options:{shift:!0,control:!0}},{type:"roll",options:{shift:!0,alt:!0}},{type:"roll",options:{shift:!0,button:3}},{type:"vrPan"},{type:"gestureCamera"}],"2D":[{type:"pan",options:{shift:!0}},{type:"zoom",options:{control:!0}},{type:"zoom",options:{alt:!0}},{type:"zoom",options:{button:3}},{type:"roll",options:{shift:!0,alt:!0}},{type:"roll",options:{shift:!0,button:3}},{type:"roll",options:{shift:!0}},{type:"vrPan"},{type:"gestureCamera"}]};function vM(e,t){t.removeAllManipulators();for(var n=0;n1.5?"black":"white"}t.classHierarchy.push("vtkViewProxy"),t.renderWindow=Xp.newInstance(),t.renderer=Tc.newInstance({background:[0,0,0]}),t.renderWindow.addRenderer(t.renderer),t.openglRenderWindow=Qv.newInstance(),t.renderWindow.addView(t.openglRenderWindow),t.interactor=di.newInstance(),t.interactor.setView(t.openglRenderWindow),t.interactorStyle3D=Bi.newInstance(),t.interactorStyle2D=Bi.newInstance(),yM.applyPreset("3D",t.interactorStyle3D),yM.applyPreset("2D",t.interactorStyle2D),t.cornerAnnotation=Jo.newInstance(),t.interactor.setInteractorStyle(t.useParallelRendering?t.interactorStyle2D:t.interactorStyle3D),t.camera=t.renderer.getActiveCamera(),t.camera.setParallelProjection(!!t.useParallelRendering),t.orientationAxesArrow=rp.newInstance(),t.orientationAxesCube=Zf.newInstance(),Hf.applyPreset("default",t.orientationAxesCube),Hf.applyPreset("lps",t.orientationAxesCube),t.orientationWidget=Pc.newInstance({actor:t.orientationAxesArrow,interactor:t.renderWindow.getInteractor()}),t.orientationWidget.setEnabled(!0),t.orientationWidget.setViewportCorner(Pc.Corners.BOTTOM_LEFT),t.orientationWidget.setViewportSize(.1),e.setPresetToInteractor3D=function(e){return Array.isArray(e)?yM.applyDefinitions(e,t.interactorStyle3D):yM.applyPreset(e,t.interactorStyle3D)},e.setPresetToInteractor2D=function(e){return Array.isArray(e)?yM.applyDefinitions(e,t.interactorStyle2D):yM.applyPreset(e,t.interactorStyle2D)},e.setOrientationAxesType=function(n){switch(n){case"arrow":t.orientationAxesType="arrow",t.orientationWidget.setActor(t.orientationAxesArrow);break;case"cube":default:t.orientationWidget.setActor(t.orientationAxesCube),t.orientationAxesType="cube"}e.renderLater()},e.setPresetToOrientationAxes=function(n){var r=!1;return"string"==typeof n?(t.presetToOrientationAxes!==n&&(t.presetToOrientationAxes=n,r=Hf.applyPreset(n,t.orientationAxesCube),e.modified()),r):(t.presetToOrientationAxes="Custom",r=Hf.applyDefinitions(n,t.orientationAxesCube),e.modified(),r)},e.setContainer=function(e){t.container&&(t.interactor.unbindEvents(t.container),t.openglRenderWindow.setContainer(null),t.cornerAnnotation.setContainer(null)),t.container=e,e&&(t.openglRenderWindow.setContainer(e),t.cornerAnnotation.setContainer(e),t.interactor.initialize(),t.interactor.bindEvents(e))},e.resize=function(){if(t.container){var n=t.container.getBoundingClientRect();if(n.width===n.height&&0===n.width)return;var r=window.devicePixelRatio||1,a=Math.max(10,r*Math.floor(n.width)),i=Math.max(10,r*Math.floor(n.height));t.openglRenderWindow.setSize(a,i),e.invokeResize({width:a,height:i}),e.renderLater()}},e.renderLater=function(){t.representations.length>0&&t.resetCameraOnFirstRender&&(t.resetCameraOnFirstRender=!1,e.resetCamera()),t.orientationWidget.updateMarkerOrientation(),t.renderer.resetCameraClippingRange(),setTimeout(t.renderWindow.render,0)},e.addRepresentation=function(e){e&&-1===t.representations.indexOf(e)&&(t.representations.push(e),e.getActors().forEach(t.renderer.addActor),e.getVolumes().forEach(t.renderer.addVolume))},e.removeRepresentation=function(e){e&&(-1!==t.representations.indexOf(e)&&(t.representations=t.representations.filter(function(t){return t!==e}),e.getActors().forEach(t.renderer.removeActor),e.getVolumes().forEach(t.renderer.removeVolume)),0===t.representations.length&&(t.resetCameraOnFirstRender=!0))},e.resetCamera=function(){t.renderer.resetCamera(),t.renderer.resetCameraClippingRange(),t.interactorStyle2D.setCenterOfRotation(t.camera.getFocalPoint()),t.interactorStyle3D.setCenterOfRotation(t.camera.getFocalPoint()),e.renderLater()},e.captureImage=function(){return t.renderWindow.captureImages()[0]},e.openCaptureImage=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"_blank",n=new Image;e.captureImage().then(function(e){n.src=e;var r=window.open("",t);r.document.write(n.outerHTML),r.document.title="vtk.js Image Capture",window.focus()})},e.setCornerAnnotation=function(e,n){var r,a,i;t.cornerAnnotation.updateTemplates((i=function(e){return Jo.applyTemplate(n,e)},(a=e)in(r={})?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i,r))},e.setCornerAnnotations=function(n){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Object.keys(n).forEach(function(t){e.setCornerAnnotation(t,n[t])}):t.cornerAnnotation.updateTemplates(n)},e.updateCornerAnnotation=function(e){return t.cornerAnnotation.updateMetadata(e)},e.setAnnotationOpacity=function(n){t.annotationOpacity!==Number(n)&&(t.annotationOpacity=Number(n),t.cornerAnnotation.getAnnotationContainer().style.opacity=n,e.modified())},e.setBackground=g.a.chain(t.renderer.setBackground,n),e.getBackground=t.renderer.getBackground,e.setAnimation=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;if(!t.disableAnimation||!n)if(n)t.renderWindow.getInteractor().requestAnimation(r);else{var a=r===e||0==="".concat(r).indexOf("ViewProxy.updateOrientation.");t.renderWindow.getInteractor().cancelAnimation(r,a)}},e.updateOrientation=function(n,r,a){var i,o,s,u,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(void 0===n)return Promise.resolve();var c=t.camera.getPosition(),d=t.camera.getViewUp(),f=t.camera.getFocalPoint();t.axis=n,t.orientation=r,t.viewUp=a;var p=t.camera.getFocalPoint();p[t.axis]+=t.orientation,(i=t.camera).setPosition.apply(i,MM(p)),(o=t.camera).setViewUp.apply(o,MM(a)),t.renderer.resetCamera();var g=t.camera.getPosition(),m=t.camera.getViewUp();(s=t.camera).setPosition.apply(s,MM(c)),(u=t.camera).setViewUp.apply(u,MM(d));var h=[{position:g,viewUp:m}];if(l){var v=[(c[0]-g[0])/l,(c[1]-g[1])/l,(c[2]-g[2])/l],y=[(d[0]-m[0])/l,(d[1]-m[1])/l,(d[2]-m[2])/l],M=v[0]||v[1]||v[2]||y[0]||y[1]||y[2],A=v.map(function(e){return Math.abs(e)0&&void 0!==arguments[0]?arguments[0]:0;return e.updateOrientation(t.axis,t.orientation,t.viewUp,n)},e.rotate=function(e){var n,r=t.camera.get("viewUp","focalPoint","position"),a=r.viewUp,i=r.focalPoint,o=r.position,s=[i[0]-o[0],i[1]-o[1],i[2]-o[2]];f.a.buildFromDegree().rotate(Number.isNaN(e)?90:e,s).apply(a),(n=t.camera).setViewUp.apply(n,MM(a)),t.camera.modified(),t.orientationWidget.updateMarkerOrientation(),t.renderWindow.render()},e.resetOrientation(),n()}var DM={representations:[],sectionName:"view",annotationOpacity:1,resetCameraOnFirstRender:!0,presetToOrientationAxes:"lps",orientationAxesType:"arrow",disableAnimation:!1,axis:1,orientation:0,viewUp:[0,0,1]};function TM(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,DM,n),g.a.obj(e,t),g.a.setGet(e,t,["name","disableAnimation"]),g.a.get(e,t,["annotationOpacity","camera","container","cornerAnnotation","interactor","interactorStyle2D","interactorStyle3D","openglRenderWindow","orientationAxesType","presetToOrientationAxes","renderer","renderWindow","representations","useParallelRendering"]),g.a.event(e,t,"Resize"),wM(e,t),g.a.proxy(e,t),g.a.proxyPropertyMapping(e,t,{orientationAxesVisibility:{modelKey:"orientationWidget",property:"enabled"},orientationAxesCorner:{modelKey:"orientationWidget",property:"viewportCorner"},orientationAxesSize:{modelKey:"orientationWidget",property:"viewportSize"},cameraViewUp:{modelKey:"camera",property:"viewUp",modified:!1},cameraPosition:{modelKey:"camera",property:"position",modified:!1},cameraFocalPoint:{modelKey:"camera",property:"focalPoint",modified:!1}})}var CM={newInstance:g.a.newInstance(TM,"vtkViewProxy"),extend:TM},IM=512;function xM(e){return Array.isArray(e)?e.map(xM).join(", "):Number.isInteger(e)?e:Number.isFinite(e)?Math.abs(e)<.01?"0":e.toFixed(2):e}var SM={axis:2,orientation:-1,viewUp:[0,1,0],useParallelRendering:!0,sliceRepresentationSubscriptions:[]};function NM(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,SM,n),CM.extend(e,t,n),g.a.get(e,t,["axis"]),function(e,t){t.classHierarchy.push("vtkView2DProxy"),e.updateWidthHeightAnnotation=function(){var n=t.cornerAnnotation.getMetadata(),r=n.ijkOrientation,a=n.dimensions;if(r&&a){var i=a;a.length>3&&(i=a.split(",").map(Number));var o=t.camera.getDirectionOfProjection(),s=t.camera.getViewUp(),u=[0,0,0];d.a.cross(o,s,u);var l=d.a.getMajorAxisIndex(u),c=d.a.getMajorAxisIndex(s),f=i["IJK".indexOf(r[l])],p=i["IJK".indexOf(r[c])];e.updateCornerAnnotation({sliceWidth:f,sliceHeight:p})}};var n=e.updateOrientation;e.updateOrientation=function(r,a,i){for(var o=n(r,a,i),s=t.representations.length;s--;){var u=t.representations[s],l="XYZ"[r];u.setSlicingMode&&u.setSlicingMode(l)}return e.updateCornerAnnotation({axis:"XYZ"[r]}),o};var r=e.addRepresentation;e.addRepresentation=function(n){r(n),n.setSlicingMode&&(n.setSlicingMode("XYZ"[t.axis]),e.bindRepresentationToManipulator(n))};var a=e.removeRepresentation;function i(n){e.updateCornerAnnotation({windowWidth:n}),t.sliceRepresentation&&t.sliceRepresentation.setWindowWidth&&t.sliceRepresentation.setWindowWidth(n)}function o(n){e.updateCornerAnnotation({windowLevel:n}),t.sliceRepresentation&&t.sliceRepresentation.setWindowLevel&&t.sliceRepresentation.setWindowLevel(n)}function s(n){var r=Number(n),a={slice:Number.isInteger(r)?n:r.toFixed(2)};if(t.sliceRepresentation&&t.sliceRepresentation.setSlice&&t.sliceRepresentation.setSlice(r),t.sliceRepresentation&&t.sliceRepresentation.getAnnotations){var i=t.sliceRepresentation.getAnnotations();Object.keys(i).forEach(function(e){a[e]=xM(i[e])})}e.updateCornerAnnotation(a)}e.removeRepresentation=function(n){if(a(n),n===t.sliceRepresentation){e.bindRepresentationToManipulator(null);for(var r=t.representations.length;r--;)e.bindRepresentationToManipulator(t.representations[r])&&(r=0)}},t.rangeManipulator=fo.newInstance({button:1,scrollEnabled:!0}),t.interactorStyle2D.addMouseManipulator(t.rangeManipulator),e.bindRepresentationToManipulator=function(n){var r=0;for(t.rangeManipulator.removeAllListeners(),t.sliceRepresentation=n;t.sliceRepresentationSubscriptions.length;)t.sliceRepresentationSubscriptions.pop().unsubscribe();if(n){if(t.sliceRepresentationSubscriptions.push(t.camera.onModified(e.updateWidthHeightAnnotation)),n.getWindowWidth){var a=function(){return i(n.getWindowWidth())},u=n.getPropertyDomainByName("windowWidth"),l=u.min,c=u.max,d=u.step;d&&"any"!==d||(d=1/IM),t.rangeManipulator.setVerticalListener(l,c,d,n.getWindowWidth,i),t.sliceRepresentationSubscriptions.push(n.onModified(a)),a(),r++}if(n.getWindowLevel){var f=function(){return o(n.getWindowLevel())},p=n.getPropertyDomainByName("windowLevel"),g=p.min,m=p.max,h=p.step;h&&"any"!==h||(h=1/IM),t.rangeManipulator.setHorizontalListener(g,m,h,n.getWindowLevel,o),t.sliceRepresentationSubscriptions.push(n.onModified(f)),f(),r++}if(n.getSlice&&n.getSliceValues){var v=function(){return s(n.getSlice())},y=n.getSliceValues();t.rangeManipulator.setScrollListener(y[0],y[y.length-1],y[1]-y[0]||1,n.getSlice,s),t.sliceRepresentationSubscriptions.push(n.onModified(v)),v(),r++}}return r}}(e,t)}var EM=g.a.newInstance(NM,"vtkView2DProxy"),OM={vtkAbstractRepresentationProxy:Qy,vtkLookupTableProxy:Zy,vtkPiecewiseFunctionProxy:aM,vtkProxyManager:dM,vtkSourceProxy:gM,vtkView2DProxy:{newInstance:EM,extend:NM},vtkViewProxy:CM},LM={representation:{"Surface with edges":{property:{edgeVisibility:!0,representation:2}},Surface:{property:{edgeVisibility:!1,representation:2}},Wireframe:{property:{edgeVisibility:!1,representation:1}},Points:{property:{edgeVisibility:!1,representation:0}}}},PM={representation:"Surface"};var kM={representation:"Surface"};function RM(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kM,n),Qy.extend(e,t),function(e,t){t.classHierarchy.push("vtkGeometryRepresentationProxy"),t.mapper=uu.a.newInstance({interpolateScalarsBeforeMapping:!0,useLookupTableScalarRange:!0,scalarVisibility:!1}),t.actor=su.a.newInstance(),t.property=t.actor.getProperty(),t.sourceDependencies.push(t.mapper),t.actor.setMapper(t.mapper),t.actors.push(t.actor)}(0,t),g.a.proxyPropertyState(e,t,LM,PM),g.a.proxyPropertyMapping(e,t,{opacity:{modelKey:"property",property:"opacity"},visibility:{modelKey:"actor",property:"visibility"},color:{modelKey:"property",property:"diffuseColor"},interpolateScalarsBeforeMapping:{modelKey:"mapper",property:"interpolateScalarsBeforeMapping"},pointSize:{modelKey:"property",property:"pointSize"},useShadow:{modelKey:"property",property:"lighting"},useBounds:{modelKey:"actor",property:"useBounds"}})}var jM={newInstance:g.a.newInstance(RM,"vtkGeometryRepresentationProxy"),extend:RM};var BM={};function zM(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,BM,n),Qy.extend(e,t),function(e,t){t.classHierarchy.push("vtkGlyphRepresentationProxy"),t.property=Uu.a.newInstance(),t.sourceDependencies.push({setInputData:function(e){t.actors.length=0;var n=vp.newInstance();n.applyColorMap({RGBPoints:e.rgbPoints}),t.glyph={};for(var r=e.glyph.length;r--;){var i=e.glyph[r];t.glyph[i.id]=Object(Ot.a)(i)}for(r=e.mapping.length;r--;){var o=e.mapping[r],s=t.glyph[o.glyphId],u=Ie.a.newInstance();u.getPoints().setData(Float32Array.from(o.coordinates),3),o.scale&&u.getPointData().addArray(a.a.newInstance({name:"scaling",values:Float32Array.from(o.scale),numberOfComponents:3}));var l=Cp.newInstance({useLookupTableScalarRange:!0,lookupTable:n,orient:!1,scaling:!!o.scale,scaleArray:"scaling",scaleMode:Cp.ScaleModes.SCALE_BY_COMPONENTS}),c=su.a.newInstance();t.property&&c.setProperty(t.property),c.setMapper(l),l.setInputData(u,0),l.setInputConnection(s.getOutputPort(),1),t.actors.push(c)}}}),e.setColorBy=function(){},e.getColorBy=function(){return[]},e.listDataArrays=function(){return[]}}(e,t),g.a.proxyPropertyMapping(e,t,{edgeVisibility:{modelKey:"property",property:"edgeVisibility"}})}var _M={newInstance:g.a.newInstance(zM,"vtkGlyphRepresentationProxy"),extend:zM};var VM={};function FM(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,VM,n),Qy.extend(e,t),function(e,t){t.classHierarchy.push("vtkMoleculeRepresentationProxy"),t.filter=In.newInstance(),t.sphereMapper=ag.newInstance(),t.stickMapper=sg.newInstance(),t.sphereActor=su.a.newInstance(),t.stickActor=su.a.newInstance(),t.sourceDependencies.push(t.filter),t.sphereMapper.setInputConnection(t.filter.getOutputPort(0)),t.sphereMapper.setScaleArray(t.filter.getSphereScaleArrayName()),t.sphereActor.setMapper(t.sphereMapper),t.stickMapper.setInputConnection(t.filter.getOutputPort(1)),t.stickMapper.setScaleArray("stickScales"),t.stickMapper.setOrientationArray("orientation"),t.stickActor.setMapper(t.stickMapper),t.actors.push(t.sphereActor),t.actors.push(t.stickActor),e.setColorBy=function(){},e.getColorBy=function(){return[]},e.listDataArrays=function(){return[]}}(e,t),g.a.proxyPropertyMapping(e,t,{tolerance:{modelKey:"filter",property:"tolerance"},atomicRadiusScaleFactor:{modelKey:"filter",property:"atomicRadiusScaleFactor"},bondRadius:{modelKey:"filter",property:"bondRadius"},deltaBondFactor:{modelKey:"filter",property:"deltaBondFactor"},radiusType:{modelKey:"filter",property:"radiusType"},hideElements:{modelKey:"filter",property:"hideElements"}})}var UM={newInstance:g.a.newInstance(FM,"vtkMoleculeRepresentationProxy"),extend:FM};var GM={};function WM(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,GM,n),Qy.extend(e,t),function(e,t){t.classHierarchy.push("vtkSkyboxRepresentationProxy"),t.actor=tg.newInstance(),t.actors.push(t.actor),t.sourceDependencies.push({setInputData:function(n){t.actor.removeAllTextures(),t.actor.addTexture(n);var r=t.input.getAlgo().getPositions();e.updateProxyProperty("position",{values:r})}}),e.setColorBy=function(){},e.getColorBy=function(){return[]},e.listDataArrays=function(){return[]},e.setPosition=function(e){t.input.getAlgo().setPosition(e)},e.getPosition=function(){return t.input.getAlgo().getPosition()}}(e,t)}var QM={newInstance:g.a.newInstance(WM,"vtkSkyboxRepresentationProxy"),extend:WM};function YM(e,t){return e+t}function HM(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,XM,n),Qy.extend(e,t),g.a.get(e,t,["slicingMode"]),function(e,t){t.classHierarchy.push("vtkSliceRepresentationProxy"),t.mapper=Lp.newInstance(),t.actor=Up.newInstance(),t.property=t.actor.getProperty(),t.actor.setMapper(t.mapper),t.actors.push(t.actor),t.sourceDependencies.push(t.mapper),t.sourceDependencies.push({setInputData:function(n){var r=KM(n,e.getDataArray(),t,e.updateProxyProperty);e.set(r);var a=n.getBounds(),i=n.getExtent();switch(t.mapper.getSlicingMode()){case Lp.SlicingMode.I:e.setSlice(Math.floor(HM(i[0],i[1])));break;case Lp.SlicingMode.J:e.setSlice(Math.floor(HM(i[2],i[3])));break;case Lp.SlicingMode.K:e.setSlice(Math.floor(HM(i[4],i[5])));break;case Lp.SlicingMode.X:e.setSlice(HM(a[0],a[1]));break;case Lp.SlicingMode.Y:e.setSlice(HM(a[2],a[3]));break;case Lp.SlicingMode.Z:e.setSlice(HM(a[4],a[5]))}}}),e.setSlicingMode=function(n){if(n){if(t.slicingMode!==n){t.slicingMode=n,t.mapper.setSlicingMode(Lp.SlicingMode[n]);var r="".concat(n.toLowerCase(),"Slice");if(r in t&&void 0!==t[r]&&t.mapper.setSlice(t[r]),t.input){var a=KM(e.getInputDataSet(),e.getDataArray(),t,e.updateProxyProperty);e.set(a)}e.modified()}}else console.log("skip setSlicingMode",n)},e.getSliceIndex=function(){return-1!=="XYZ".indexOf(t.slicingMode)?t.mapper.getSliceAtPosition(t.mapper.getSlice()):t.mapper.getSlice()},e.getAnnotations=function(){var n={},r=e.getSliceIndex(),a=t.mapper.getBoundsForSlice(),i=t.mapper.getSlicingModeNormal(),o=t.mapper.getClosestIJKAxis().ijkMode,s=[.5*(a[0]+a[1]),.5*(a[2]+a[3]),.5*(a[4]+a[5])],u=0;a[1]-a[0]Number.EPSILON&&(c[0]="IJK"[d]),p[3]-p[2]>Number.EPSILON&&(c[1]="IJK"[d]),p[5]-p[4]>Number.EPSILON&&(c[2]="IJK"[d])}n.ijkOrientation=c.join("")}return Object.assign({ijkMode:o,sliceBounds:a,sliceIndex:r,sliceNormal:i,sliceOrigin:s,slicePosition:u},n)},e.getSliceValues=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.slicingMode,r=e.getInputDataSet();if(!r)return[];for(var a=[],i=r.getBounds(),o="XYZ".indexOf(n),s=i[2*o+1],u=i[2*o];u<=s;)a.push(u),u++;return a};var n=e.setColorBy;e.setColorBy=function(r,a){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(null===r)t.property.setRGBTransferFunction(null),t.property.setScalarOpacity(null);else{n(r,a,i);var o=e.getLookupTableProxy(r),s=e.getPiecewiseFunctionProxy(r);t.property.setRGBTransferFunction(o.getLookupTable()),t.property.setScalarOpacity(s.getPiecewiseFunction())}},e.setSlicingMode(t.slicingMode||"X")}(e,t),g.a.proxyPropertyMapping(e,t,{visibility:{modelKey:"actor",property:"visibility"},windowWidth:{modelKey:"property",property:"colorWindow"},windowLevel:{modelKey:"property",property:"colorLevel"},interpolationType:{modelKey:"property",property:"interpolationType"},slice:{modelKey:"mapper",property:"slice"}})}var ZM={newInstance:g.a.newInstance(qM,"vtkSliceRepresentationProxy"),extend:qM};var JM={slicingMode:Lp.SlicingMode.NONE,slice:0,offset:0};function $M(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,JM,n),Qy.extend(e,t),g.a.get(e,t,["slicingMode","slice","offset"]),function(e,t){t.classHierarchy.push("vtkSlicedGeometryRepresentationProxy"),t.plane=Te.a.newInstance(),t.cutter=bt.newInstance(),t.cutter.setCutFunction(t.plane),t.mapper=uu.a.newInstance(),t.actor=su.a.newInstance(),t.property=t.actor.getProperty(),t.property.setLighting(!1),t.mapper.setInputConnection(t.cutter.getOutputPort()),t.actor.setMapper(t.mapper),t.actors.push(t.actor),t.sourceDependencies.push(t.cutter),e.setSlice=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=t.slice!==n;t.slice=n;var a=t.plane.getNormal();return!(!t.plane.setOrigin(a[0]*n,a[1]*n,a[2]*n)&&!r||(e.modified(),0))},e.setOffset=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=t.offset!==n;t.offset=n;var a=t.plane.getNormal();return!(!t.actor.setPosition(n*a[0],n*a[1],n*a[2])&&!r||(e.modified(),0))},e.setSlicingMode=function(n){if(t.slicingMode!==n&&n){switch(t.slicingMode=n,Lp.SlicingMode[n]){case Lp.SlicingMode.X:t.plane.setNormal(1,0,0);break;case Lp.SlicingMode.Y:t.plane.setNormal(0,1,0);break;case Lp.SlicingMode.Z:t.plane.setNormal(0,0,1);break;default:return}var r=e.setSlice(t.slice);(r=e.setOffset(t.offset)||r)||e.modified()}else console.log("skip setSlicingMode",n)}}(e,t),g.a.proxyPropertyState(e,t),g.a.proxyPropertyMapping(e,t,{opacity:{modelKey:"property",property:"opacity"},visibility:{modelKey:"actor",property:"visibility"},color:{modelKey:"property",property:"diffuseColor"},useShadow:{modelKey:"property",property:"lighting"},useBounds:{modelKey:"actor",property:"useBounds"}})}var eA=g.a.newInstance($M,"vtkSlicedGeometryRepresentationProxy");function tA(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function nA(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1)&&e.setSampleDistance(),(t.edgeGradient<0||t.edgeGradient>1)&&e.setEdgeGradient();var u=function(e,t,n,r){var a=t.getRange(),i=e.getSpacing(),o=e.getBounds(),s=n.mapperX.getClosestIJKAxis().ijkMode,u=n.mapperY.getClosestIJKAxis().ijkMode,l=n.mapperZ.getClosestIJKAxis().ijkMode,c={xSlice:{domain:{min:o[0],max:o[1],step:i[s]}},ySlice:{domain:{min:o[2],max:o[3],step:i[u]}},zSlice:{domain:{min:o[4],max:o[5],step:i[l]}},windowWidth:{domain:{min:0,max:a[1]-a[0],step:"any"}},windowLevel:{domain:{min:a[0],max:a[1],step:"any"}}};return r("xSlice",c.xSlice),r("ySlice",c.ySlice),r("zSlice",c.zSlice),r("windowWidth",c.windowWidth),r("windowLevel",c.windowLevel),{xSlice:aA(c.xSlice.domain.min,c.xSlice.domain.max),ySlice:aA(c.ySlice.domain.min,c.ySlice.domain.max),zSlice:aA(c.zSlice.domain.min,c.zSlice.domain.max),windowWidth:c.windowWidth.domain.max,windowLevel:Math.floor(aA(c.windowLevel.domain.min,c.windowWidth.domain.max))}}(n,e.getDataArray(),t,e.updateProxyProperty);e.set(u)}}),e.isVisible=function(){return t.volume.getVisibility()},e.setVisibility=function(e){e?t.volume.setVisibility(!0):(t.volume.setVisibility(!1),t.actorX.setVisibility(!1),t.actorY.setVisibility(!1),t.actorZ.setVisibility(!1))},e.getVisibility=function(){return t.volume.getVisibility()||t.actorX.getVisibility()||t.actorY.getVisibility()||t.actorZ.getVisibility()},e.isVisible=e.getVisibility,e.setSliceVisibility=g.a.chain(t.actorX.setVisibility,t.actorY.setVisibility,t.actorZ.setVisibility),e.getSliceVisibility=t.actorX.getVisibility,e.setSampleDistance=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.4;if(t.sampleDistance!==n){t.sampleDistance=n;var r=e.getInputDataSet(),a=.7*Math.sqrt(r.getSpacing().map(function(e){return e*e}).reduce(function(e,t){return e+t},0));t.mapper.setSampleDistance(a*Math.pow(2,3*n-1.5)),e.modified()}},e.setEdgeGradient=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.2;if(t.edgeGradient!==n){if(t.edgeGradient=n,0===n)t.volume.getProperty().setUseGradientOpacity(0,!1);else{var r=e.getDataArray().getRange();t.volume.getProperty().setUseGradientOpacity(0,!0);var a=Math.max(0,n-.3)/.7;t.volume.getProperty().setGradientOpacityMinimumValue(0,.2*(r[1]-r[0])*a*a),t.volume.getProperty().setGradientOpacityMaximumValue(0,1*(r[1]-r[0])*n*n)}e.modified()}};var n=e.setColorBy;e.setColorBy=function(r,a){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;n(r,a,i);var o=e.getLookupTableProxy(r),s=e.getPiecewiseFunctionProxy(r);t.property.setRGBTransferFunction(0,o.getLookupTable()),t.property.setScalarOpacity(0,s.getPiecewiseFunction())}}var sA={sampleDistance:-1,edgeGradient:-1,disableSolidColor:!0};function uA(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,sA,n),Qy.extend(e,t),g.a.get(e,t,["sampleDistance","edgeGradient","cropFilter"]),oA(e,t),g.a.proxyPropertyMapping(e,t,{xSlice:{modelKey:"mapperX",property:"slice"},ySlice:{modelKey:"mapperY",property:"slice"},zSlice:{modelKey:"mapperZ",property:"slice"},volumeVisibility:{modelKey:"volume",property:"visibility"},xSliceVisibility:{modelKey:"actorX",property:"visibility"},ySliceVisibility:{modelKey:"actorY",property:"visibility"},zSliceVisibility:{modelKey:"actorZ",property:"visibility"},windowWidth:{modelKey:"propertySlices",property:"colorWindow"},windowLevel:{modelKey:"propertySlices",property:"colorLevel"},useShadow:{modelKey:"property",property:"shade"},croppingPlanes:{modelKey:"cropFilter",property:"croppingPlanes"}})}var lA={Core:OM,Representations:{vtkGeometryRepresentationProxy:jM,vtkGlyphRepresentationProxy:_M,vtkMoleculeRepresentationProxy:UM,vtkSkyboxRepresentationProxy:QM,vtkSliceRepresentationProxy:ZM,vtkSlicedGeometryRepresentationProxy:{newInstance:eA,extend:$M},vtkVolumeRepresentationProxy:{newInstance:g.a.newInstance(uA,"vtkVolumeRepresentationProxy"),extend:uA,updateConfiguration:iA}}},cA={DEFAULT:0,GEOMETRY:1,SLICE:2,VOLUME:3},dA={PICKING_BUFFER:0,FRONT_BUFFER:1},fA={ViewTypes:cA,RenderingTypes:dA},pA=.5;var gA={contextVisibility:!0,handleVisibility:!0,hasFocus:!1};function mA(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,gA,n),Cu.a.extend(e,t,n),yi.extend(e,t,n),g.a.setGet(e,t,["contextVisibility","handleVisibility","widgetManager"]),g.a.get(e,t,["representations","widgetState"]),g.a.event(e,t,"ActivateHandle"),function(e,t){t.classHierarchy.push("vtkAbstractWidget"),t.actorToRepresentationMap=new WeakMap,e.getBounds=t.widgetState.getBounds,e.getNestedProps=function(){return t.representations},e.activateHandle=function(n){var r=n.selectedState,a=n.representation;t.widgetState.activateOnly(r),t.activeState=r,r&&r.updateManipulator&&r.updateManipulator(),e.invokeActivateHandle({selectedState:r,representation:a}),e.updateCursor&&e.updateCursor()},e.deactivateAllHandles=function(){t.widgetState.deactivate()},e.hasActor=function(e){return t.actorToRepresentationMap.has(e)},e.grabFocus=function(){t.hasFocus=!0},e.loseFocus=function(){t.hasFocus=!1},e.hasFocus=function(){return t.hasFocus},e.placeWidget=function(e){return t.widgetState.placeWidget(e)},e.getPlaceFactor=function(){return t.widgetState.getPlaceFactor()},e.setPlaceFactor=function(e){return t.widgetState.setPlaceFactor(e)},e.getRepresentationFromActor=function(e){return t.actorToRepresentationMap.get(e)},e.updateRepresentationForRender=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dA.FRONT_BUFFER,n=0;n2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,TA,n),g.a.obj(e,t),g.a.setGet(e,t,[{type:"enum",name:"viewType",enum:yA}]),g.a.get(e,t,["selections","widgets","viewId","pickingEnabled"]),DA(e,t)}var IA={newInstance:g.a.newInstance(CA,"vtkWidgetManager"),extend:CA};function xA(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]&&arguments[2];g.a.obj(e,t),g.a.get(e,t,["widgetState"]),g.a.event(e,t,"WidgetChange"),function(e,t){t.classHierarchy.push("vtkAbstractWidgetFactory");var n={};e.getWidgetForView=function(r){var a=r.viewId,i=r.renderer,o=r.viewType,s=r.initialValues;if(!n[a]){if(!i)return null;var u=wA(i),l=u.interactor,c=u.openGLRenderWindow,d=u.camera,f={},p={onWidgetChange:e.onWidgetChange};Object.assign(f,t,{viewType:o,renderer:i,camera:d,openGLRenderWindow:c}),g.a.safeArrays(f),hA.extend(p,f,s),f.representations=e.getRepresentationsForViewType(o).map(function(e){var t=e.builder,n=e.labels,r=e.initialValues;return t.newInstance(Object.assign({labels:n},r))}),f.representations.forEach(function(e){e.setInputData(f.widgetState),e.getActors().forEach(function(t){f.actorToRepresentationMap.set(t,e)})}),t.behavior(p,f),t.methodsToLink&&t.methodsToLink.forEach(function(e){var t,n="set".concat(g.a.capitalize(e)),r="get".concat(g.a.capitalize(e)),a=(SA(t={},e,[]),SA(t,n,[]),SA(t,r,[]),t);f.representations.forEach(function(t){t[e]&&a[e].push(t[e]),t[n]&&a[n].push(t[n]),t[r]&&a[r].push(t[r])}),Object.keys(a).forEach(function(e){var t=a[e];1===t.length?p[e]=t[0]:t.length>1&&(p[e]=g.a.chain.apply(g.a,xA(t)))})}),p.delete=g.a.chain(function(){delete n[a]},p.delete),p.setInteractor(l);var m=Object.freeze(p);return n[a]=m,m}return n[a]},e.setVisibility=function(e){for(var t=Object.keys(n),r=0;r2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,kA,n),g.a.obj(e,t),g.a.setGet(e,t,["active"]),function(e,t){t.classHierarchy.push("vtkWidgetState");var n=[];t.labels={},t.nestedStates=[],e.bindState=function(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[LA];if(t.nestedStates.push(r),n.push(r.onModified(e.modified)),Array.isArray(a)&&a.length)for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,jA,n),g.a.setGetArray(e,t,["bounds"],6),g.a.get(e,t,["placeFactor"]),g.a.event(e,t,"BoundsChange"),t.bounds=t.bounds.slice(),function(e,t){var n=[],r=E.a.newInstance();e.containsPoint=function(e,t,n){return Array.isArray(e)?r.containsPoint(e[0],e[1],e[2]):r.containsPoint(e,t,n)},e.placeWidget=function(a){t.bounds=[];for(var i=0;i<6;i++)n[i]=a[i],t.bounds[i]=a[i]*t.placeFactor;r.setBounds(t.bounds),e.invokeBoundsChange(t.bounds),e.modified()},e.setPlaceFactor=function(a){if(t.placeFactor!==a){t.placeFactor=a,t.bounds=[];for(var i=0;i<6;i++)t.bounds[i]=n[i]*t.placeFactor;r.setBounds(t.bounds),e.invokeBoundsChange(t.bounds),e.modified()}}}(e,t)}},zA={color:.5};var _A={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,zA,n),g.a.setGet(e,t,["color"])}};var VA={direction:[1,0,0]};var FA={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,VA,n),g.a.setGetArray(e,t,["direction"],3),function(e,t){var n="degree"===t.angleUnit?f.a.buildFromDegree():f.a.buildFromRadian();e.rotateFromDirections=function(r,a){n.identity().rotateFromDirections(r,a).apply(t.direction),e.modified()},e.rotate=function(e,r){n.identity().rotate(e,r).apply(t.direction)},e.rotateX=function(e){n.identity().rotateX(e).apply(t.direction)},e.rotateY=function(e){n.identity().rotateY(e).apply(t.direction)},e.rotateZ=function(e){n.identity().rotateZ(e).apply(t.direction)}}(e,t)}};var UA={manipulator:null};var GA={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,UA,n),g.a.setGet(e,t,["manipulator"]),function(e,t){e.updateManipulator=function(){if(t.manipulator){var e=t.origin,n=t.normal,r=t.direction,a=t.manipulator,i=a.setOrigin,o=a.setCenter,s=a.setNormal,u=a.setDirection;e&&i?i(e):e&&o&&o(e),r&&u?u(r):r&&!n&&s?s(r):n&&u&&u(n)}}}(e,t)}},WA={name:""};var QA={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,WA,n),g.a.setGet(e,t,["name"])}};function YA(e,t){return 3===e.length&&3===t.length&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function HA(e,t){var n={o:[],p1:[],p2:[]};e.normalize=function(){d.a.normalize(t.up),d.a.normalize(t.right),d.a.normalize(t.direction),e.modified()},e.updateFromOriginRightUp=function(r,a,i){(function(e,t,n,r){return YA(e,r.o)&&YA(t,r.p1)&&YA(n,r.p2)})(r,a,i,n)||(n.o=r.slice(),n.p1=a.slice(),n.p2=i.slice(),t.up=[i[0]-r[0],i[1]-r[1],i[2]-r[2]],t.right=[a[0]-r[0],a[1]-r[1],a[2]-r[2]],d.a.cross(t.up,t.right,t.direction),d.a.cross(t.direction,t.up,t.right),e.normalize(),e.modified())}}var KA={up:[0,1,0],right:[1,0,0],direction:[0,0,1]};var XA={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,KA,n),g.a.setGetArray(e,t,["up","right","direction"],3),HA(e,t)}};function qA(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var ZA={origin:[0,0,0]};var JA={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ZA,n),g.a.setGetArray(e,t,["origin"],3),function(e,t){e.translate=function(t,n,r){var a=qA(e.getOriginByReference(),3),i=a[0],o=a[1],s=a[2];e.setOrigin(i+t,o+n,s+r)}}(e)}},$A={scale1:.5};var eb={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,$A,n),g.a.setGet(e,t,["scale1"])}},tb={scale3:[1,1,1]};var nb={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,tb,n),g.a.setGetArray(e,t,["scale3"],3)}},rb={visible:!0};var ab={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,rb,n),g.a.setGet(e,t,["visible"]),e.isVisible=e.getVisible}};function ib(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};arguments.length>4&&void 0!==arguments[4]&&arguments[4]||RA.extend(n,r,t);for(var a=0;a2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,pb,n),g.a.obj(e,t),g.a.setGetArray(e,t,["origin","normal"],3),function(e,t){t.classHierarchy.push("vtkLineManipulator"),e.handleEvent=function(e,n){return fb(e.position.x,e.position.y,t.origin,t.normal,e.pokedRenderer,n)}}(e,t)}var mb={projectDisplayToLine:fb,extend:gb,newInstance:g.a.newInstance(gb,"vtkLineManipulator")};function hb(e,t,n,r,a,i){var o=i.displayToWorld(e,t,0,a),s=i.displayToWorld(e,t,1,a);return Te.a.intersectWithLine(o,s,n,r).x}var vb={normal:[0,0,1],origin:[0,0,0]};function yb(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,vb,n),g.a.obj(e,t),g.a.setGetArray(e,t,["normal","origin"],3),function(e,t){t.classHierarchy.push("vtkPlaneManipulator"),e.handleEvent=function(e,n){return hb(e.position.x,e.position.y,t.origin,t.normal,e.pokedRenderer,n)}}(e,t)}var Mb={intersectDisplayWithPlane:hb,extend:yb,newInstance:g.a.newInstance(yb,"vtkPlaneManipulator")};function Ab(e,t,n,r,a,i,o,s){var u=n-e,l=r-t,c=o.getActiveCamera(),f=c.getViewUp(),p=c.getDirectionOfProjection(),g=o.getRenderWindow().getInteractor().getView().getSize(),m=360*u/g[0],h=360*l/g[1],v=Ye.e.fromValues(i[0],i[1],i[2]),y=f,M=[0,0,0];d.a.cross(p,f,M);var A=Ye.c.create();return Ye.c.rotate(A,A,d.a.radiansFromDegrees(m),y),Ye.c.rotate(A,A,d.a.radiansFromDegrees(-h),M),Ye.e.transformMat4(v,v,A),[v[0],v[1],v[2]]}var bb={normal:[0,0,1]};function wb(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,bb,n),g.a.obj(e,t),g.a.setGetArray(e,t,["normal"],3),function(e,t){t.classHierarchy.push("vtkTrackballManipulator");var n=0,r=0;e.handleEvent=function(e,a){var i=Ab(n,r,e.position.x,e.position.y,t.origin,t.normal,e.pokedRenderer);return n=e.position.x,r=e.position.y,i},e.reset=function(e){n=e.position.x,r=e.position.y}}(e,t)}var Db={trackballRotate:Ab,extend:wb,newInstance:g.a.newInstance(wb,"vtkTrackballManipulator")},Tb={vtkLineManipulator:mb,vtkPlaneManipulator:Mb,vtkTrackballManipulator:Db},Cb={HANDLE:0,CONTEXT:1},Ib=g.a.vtkErrorMacro,xb=["active","inactive","static"];var Sb={actors:[],labels:[],behavior:Cb.CONTEXT};var Nb={extend:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Sb,n),Cu.a.extend(e,t,n),g.a.algo(e,t,1,1),g.a.get(e,t,["labels"]),function(e,t){t.classHierarchy.push("vtkWidgetRepresentation");var n={mtimes:{},states:[]};e.getActors=function(){return t.actors},e.getNestedProps=e.getActors,e.setLabels=function(){for(var n=arguments.length,r=new Array(n),a=0;a0&&void 0!==arguments[0]?arguments[0]:t.inputData[0];return n.mtimes.representation===e.getMTime()&&n.mtimes.input===r.getMTime()?n.states:(n.mtimes.representation=e.getMTime(),n.mtimes.input=r.getMTime(),n.states=[],t.labels.forEach(function(e){n.states=n.states.concat(r.getStatesWithLabel(e)||[])}),n.states)},e.getSelectedState=function(t,n){var r=e.getRepresentationStates();return n0&&void 0!==arguments[0]?arguments[0]:dA.FRONT_BUFFER,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!0;switch(t.behavior){case Cb.HANDLE:i=e===dA.PICKING_BUFFER||a;break;case Cb.CONTEXT:i=e===dA.FRONT_BUFFER&&r;break;default:i=!0}for(var o=n&&i,s=0;s1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{},r=Object.assign({},Eb,n);Nb.extend(e,t,r),g.a.setGet(e,t,["activeScaleFactor","activeColor","useActiveColor"]),function(e,t){t.classHierarchy.push("vtkHandleRepresentation")}(0,t)}},Lb=n(25);var Pb={glyphResolution:32,defaultScale:1,defaultDirection:[0,0,1]};function kb(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Pb,n),Ob.extend(e,t,n),g.a.setGet(e,t,["glyphResolution","defaultScale"]),g.a.setGetArray(e,t,["defaultDirection"]),g.a.get(e,t,["glyph","mapper","actor"]),function(e,t){t.classHierarchy.push("vtkCircleContextRepresentation"),t.internalPolyData=Ie.a.newInstance({mtime:0}),t.internalArrays={points:t.internalPolyData.getPoints(),scale:a.a.newInstance({name:"scale",numberOfComponents:1,empty:!0}),color:a.a.newInstance({name:"color",numberOfComponents:1,empty:!0}),direction:a.a.newInstance({name:"direction",numberOfComponents:3,empty:!0})},t.internalPolyData.getPointData().addArray(t.internalArrays.scale),t.internalPolyData.getPointData().addArray(t.internalArrays.color),t.internalPolyData.getPointData().addArray(t.internalArrays.direction),t.pipelines={circle:{source:e,glyph:Mr.newInstance({resolution:t.glyphResolution,radius:1}),mapper:Cp.newInstance({orientationArray:"direction",scaleArray:"scale",colorByArrayName:"color",scalarMode:Lb.a.USE_POINT_FIELD_DATA}),actor:su.a.newInstance({pickable:!1})}},t.pipelines.circle.actor.getProperty().setOpacity(.2),t.pipelines.circle.mapper.setOrientationModeToDirection(),Nb.connectPipeline(t.pipelines.circle),t.actors.push(t.pipelines.circle.actor),t.tranform=f.a.buildFromDegree(),e.setGlyphResolution=g.a.chain(e.setGlyphResolution,function(e){return t.glyph.setResolution(e)}),e.requestData=function(n,r){var a=t.internalArrays,i=a.points,o=a.scale,s=a.color,u=a.direction,l=e.getRepresentationStates(n[0]),c=l.length;s.getNumberOfValues()!==c&&(i.setData(new Float32Array(3*c)),o.setData(new Float32Array(3*c)),u.setData(new Float32Array(3*c)),s.setData(new Float32Array(c)));for(var d={points:i.getData(),scale:o.getData(),color:s.getData(),direction:u.getData()},f=0;f2&&void 0!==arguments[2]?arguments[2]:{},r=Object.assign({},jb,n);Nb.extend(e,t,r),function(e,t){t.classHierarchy.push("vtkContextRepresentation")}(0,t)}};function zb(e,t){t.classHierarchy.push("vtkConvexFaceContextRepresentation"),t.internalPolyData=Ie.a.newInstance({mtime:0}),t.points=new Float32Array(12),t.cells=new Uint8Array([4,0,1,2,3]),t.internalPolyData.getPoints().setData(t.points,3),t.internalPolyData.getPolys().setData(t.cells),t.mapper=uu.a.newInstance({scalarVisibility:!1}),t.actor=su.a.newInstance(),t.actor.getProperty().setOpacity(t.opacity),t.mapper.setInputConnection(e.getOutputPort()),t.actor.setMapper(t.mapper),t.actors.push(t.actor),e.requestData=function(n,r){for(var a=e.getRepresentationStates(n[0]),i=function(e){if(t.cells.length-1!==e){t.points=new Float32Array(3*e),t.cells=new Uint8Array(e+1),t.cells[0]=e;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:dA.FRONT_BUFFER,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(t.behavior){case Cb.HANDLE:e===dA.PICKING_BUFFER?t.actor.getProperty().setOpacity(1):t.actor.getProperty().setOpacity(t.opacity);break;case Cb.CONTEXT:default:t.actor.getProperty().setOpacity(t.opacity)}n(e,r,a,i)}}var _b={defaultColor:[1,0,.5],opacity:.2};function Vb(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,_b,n),Bb.extend(e,t,n),g.a.setGetArray(e,t,["defaultColor"],3),g.a.get(e,t,["mapper","actor"]),g.a.setGet(e,t,["opacity"]),zb(e,t)}var Fb={newInstance:g.a.newInstance(Vb,"vtkConvexFaceContextRepresentation"),extend:Vb};var Ub={defaultScale:1};function Gb(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ub,n),Ob.extend(e,t,n),g.a.get(e,t,["glyph","mapper","actor","defaultScale"]),function(e,t){t.classHierarchy.push("vtkCubeHandleRepresentation"),t.internalPolyData=Ie.a.newInstance({mtime:0}),t.internalArrays={points:t.internalPolyData.getPoints(),scale:a.a.newInstance({name:"scale",numberOfComponents:3,empty:!0}),color:a.a.newInstance({name:"color",numberOfComponents:1,empty:!0})},t.internalPolyData.getPointData().addArray(t.internalArrays.scale),t.internalPolyData.getPointData().addArray(t.internalArrays.color),t.mapper=Cp.newInstance({scaleArray:"scale",colorByArrayName:"color",scalarMode:Lb.a.USE_POINT_FIELD_DATA}),t.actor=su.a.newInstance(),t.glyph=xr.newInstance(),t.mapper.setInputConnection(e.getOutputPort(),0),t.mapper.setInputConnection(t.glyph.getOutputPort(),1),t.actor.setMapper(t.mapper),t.actors.push(t.actor),e.requestData=function(n,r){var a=t.internalArrays,i=a.points,o=a.scale,s=a.color,u=e.getRepresentationStates(n[0]),l=u.length;s.getNumberOfValues()!==l&&(i.setData(new Float32Array(3*l)),o.setData(new Float32Array(3*l)),s.setData(new Float32Array(l)));for(var c={points:i.getData(),scale:o.getData(),color:s.getData()},d=0;d2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,qb,n),Nb.extend(e,t,n),g.a.get(e,t,["sphereResolution","representationStyle"]),g.a.setGet(e,t,["handleSizeRatio","axisScale"]),function(e,t){t.classHierarchy.push("vtkImplicitPlaneRepresentation"),t.plane=Te.a.newInstance(),t.matrix=f.a.buildFromDegree(),t.pipelines={},t.pipelines.outline={source:xr.newInstance(),mapper:uu.a.newInstance(),actor:su.a.newInstance({pickable:!1})},t.pipelines.plane={source:Gt.newInstance(),mapper:uu.a.newInstance(),actor:su.a.newInstance({pickable:!0})},t.pipelines.origin={source:ta.newInstance(),mapper:uu.a.newInstance(),actor:su.a.newInstance({pickable:!0})},t.pipelines.normal={source:pr.newInstance(),mapper:uu.a.newInstance(),actor:su.a.newInstance({pickable:!0})},t.pipelines.display2D={source:e,mapper:du.newInstance(),actor:su.a.newInstance({pickable:!1})};var n=bt.newInstance({cutFunction:t.plane});n.setInputConnection(t.pipelines.outline.source.getOutputPort()),t.pipelines.plane.source.setInputConnection(n.getOutputPort()),Nb.connectPipeline(t.pipelines.outline),Nb.connectPipeline(t.pipelines.plane),Nb.connectPipeline(t.pipelines.origin),Nb.connectPipeline(t.pipelines.normal),Nb.connectPipeline(t.pipelines.display2D),t.actors.push(t.pipelines.outline.actor),t.actors.push(t.pipelines.plane.actor),t.actors.push(t.pipelines.origin.actor),t.actors.push(t.pipelines.normal.actor),t.actors.push(t.pipelines.display2D.actor),e.requestData=function(e,n){var r=e[0],a=r.getOrigin(),i=r.getNormal(),o=r.getBounds();t.plane.setOrigin(a),t.plane.setNormal(i),t.pipelines.outline.source.setCenter(.5*(o[0]+o[1]),.5*(o[2]+o[3]),.5*(o[4]+o[5]));var s=o[1]-o[0],u=o[3]-o[2],l=o[5]-o[4];t.pipelines.outline.source.setXLength(s),t.pipelines.outline.source.setYLength(u),t.pipelines.outline.source.setZLength(l),t.pipelines.normal.source.set({height:Math.max(s,u,l),radius:t.handleSizeRatio*Math.min(s,u,l)*t.axisScale,resolution:t.sphereResolution});var c=t.pipelines.normal.source.getOutputData(),d=Ie.a.newInstance();d.shallowCopy(c),d.getPoints().setData(Float32Array.from(c.getPoints().getData()),3),d.getPointData().removeAllArrays(),t.matrix.identity().translate(a[0],a[1],a[2]).rotateFromDirections([0,1,0],i).apply(d.getPoints().getData()),t.pipelines.normal.mapper.setInputData(d),t.pipelines.origin.actor.setPosition(a);var f=t.handleSizeRatio*Math.min(s,u,l);t.pipelines.origin.actor.setScale(f,f,f),Nb.applyStyles(t.pipelines,t.representationStyle,r.getActive()&&r.getActiveHandle());var p=Ie.a.newInstance();p.shallowCopy(t.pipelines.plane.source.getOutputData()),n[0]=p},e.setSphereResolution=function(e){return t.sphereResolution=e,t.pipelines.origin.source.setPhiResolution(e)&&t.pipelines.origin.source.setThetaResolution(e)},e.setRepresentationStyle=function(n){t.representationStyle=Nb.mergeStyles(Kb,t.representationStyle,n),Nb.applyStyles(t.pipelines,t.representationStyle),e.modified()},e.updateActorVisibility=function(e,n,r,a){if(e===Qb.PICKING_BUFFER)t.pipelines.plane.actor.setVisibility(n),t.pipelines.origin.actor.setVisibility(n),t.pipelines.normal.actor.setVisibility(n),t.pipelines.plane.actor.getProperty().setOpacity(1);else{t.pipelines.outline.actor.setVisibility(n&&r),t.pipelines.plane.actor.setVisibility(n&&a),t.pipelines.origin.actor.setVisibility(n&&a),t.pipelines.normal.actor.setVisibility(n&&a);var i=t.inputData[0];i&&Nb.applyStyles(t.pipelines,t.representationStyle,i.getActive()&&i.getActiveHandle())}},e.getSelectedState=function(e,n){var r=t.inputData[0];switch(r.setActiveHandle(e),e){case t.pipelines.plane.actor:r.setUpdateMethodName("updateFromPlane");break;case t.pipelines.origin.actor:r.setUpdateMethodName("updateFromOrigin");break;case t.pipelines.normal.actor:r.setUpdateMethodName("updateFromNormal");break;default:r.setUpdateMethodName("updateFromPlane")}return r},e.setRepresentationStyle(Xb),e.setSphereResolution(t.sphereResolution)}(e,t)}var Jb={newInstance:g.a.newInstance(Zb,"vtkImplicitPlaneRepresentation"),extend:Zb,generateState:function(){return cb.createBuilder().addField({name:"origin",initialValue:[0,0,0]}).addField({name:"normal",initialValue:[0,0,1]}).addField({name:"activeHandle",initialValue:null}).addField({name:"updateMethodName"}).build()}};function $b(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,nw,n),Bb.extend(e,t,n),g.a.setGetArray(e,t,["edgeColor"],3),g.a.get(e,t,["mapper","actor"]),function(e,t){var n;t.classHierarchy.push("vtkOutlineContextRepresentation"),t.internalPolyData=Ie.a.newInstance({mtime:0}),t.points=new Float32Array(24),t.internalPolyData.getPoints().setData(t.points,3),t.internalPolyData.getLines().setData(Uint16Array.from(tw)),t.mapper=uu.a.newInstance({scalarVisibility:!1}),t.actor=su.a.newInstance(),(n=t.actor.getProperty()).setEdgeColor.apply(n,$b(t.edgeColor)),t.mapper.setInputConnection(e.getOutputPort()),t.actor.setMapper(t.mapper),t.actors.push(t.actor),e.requestData=function(n,r){var a=e.getRepresentationStates(n[0]);if(8===a.length){var i,o=a.map(function(e){return e.getOrigin()}).sort(function(e,t){for(var n=0;n<3;n++)if(e[n]!==t[n])return e[n]-t[n];return 0});t.points=(i=[]).concat.apply(i,$b(o)),t.internalPolyData.getPoints().setData(t.points,3),t.internalPolyData.modified(),r[0]=t.internalPolyData}else ew("OutlineContextRepresentation did not get 8 states")}}(e,t)}var aw={newInstance:g.a.newInstance(rw,"vtkOutlineContextRepresentation"),extend:rw};function iw(e,t){t.classHierarchy.push("vtkPolyLineRepresentation"),t.internalPolyData=Ie.a.newInstance({mtime:0}),t.cells=[],t.mapper=uu.a.newInstance(),t.actor=su.a.newInstance(),t.mapper.setInputConnection(e.getOutputPort()),t.actor.setMapper(t.mapper),t.actors.push(t.actor),e.requestData=function(n,r){var a=e.getRepresentationStates(n[0]),i=a.length;if(i>1){var o=a[a.length-1],s=o.getOrigin(),u=a[a.length-2].getOrigin(),l=d.a.distance2BetweenPoints(s,u)>t.threshold?0:1;l||!o.isVisible||o.isVisible()||l++,i-=l}for(var c=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(0===e)t.internalPolyData.getPoints().setData(new Float32Array([0,0,0])),t.internalPolyData.getLines().setData(new Uint8Array(0));else if(!t.points||t.points.length!==3*e){t.points=new Float32Array(3*e),t.cells=new Uint8Array(e+1+(n?1:0)),t.cells[0]=t.cells.length-1;for(var r=1;r2),f=0;f2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,ow,n),Nb.extend(e,t,n),g.a.setGet(e,t,["threshold","closePolyLine"]),iw(e,t)}var uw={newInstance:g.a.newInstance(sw,"vtkPolyLineRepresentation"),extend:sw};var lw={glyphResolution:8,defaultScale:1};function cw(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,lw,n),Ob.extend(e,t,n),g.a.setGet(e,t,["glyphResolution","defaultScale"]),g.a.get(e,t,["glyph","mapper","actor"]),function(e,t){function n(n){if(t.displayCallback){for(var r=[],a=e.getRepresentationStates(),i=0;i2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Mw,n),OA.extend(e,t,n),function(e,t){function n(e,n){t.widgetState.getStatesWithLabel(e).forEach(function(e){e.setVisible(n)})}t.classHierarchy.push("vtkImageCroppingWidget"),e.setFaceHandlesEnabled=function(e){return n("faces",e)},e.setEdgeHandlesEnabled=function(e){return n("edges",e)},e.setCornerHandlesEnabled=function(e){return n("corners",e)},e.copyImageDataDescription=function(n){var r,a;(r=t.widgetState).setIndexToWorldT.apply(r,pw(n.getIndexToWorld())),(a=t.widgetState).setWorldToIndexT.apply(a,pw(n.getWorldToIndex()));var i=n.getDimensions();t.widgetState.getCroppingPlanes().setPlanes([0,i[0],0,i[1],0,i[2]]),e.modified()},e.updateHandles=function(){for(var e=t.widgetState.getCroppingPlanes().getPlanes(),n=[(e[0]+e[1])/2,(e[2]+e[3])/2,(e[4]+e[5])/2],r=[e[0],n[0],e[1]],a=[e[2],n[1],e[3]],i=[e[4],n[2],e[5]],o=t.widgetState.getIndexToWorldT(),s=0;s<3;s++)for(var u=0;u<3;u++)for(var l=0;l<3;l++)if(1!==s||1!==u||1!==l){var c=[s,u,l].map(function(e){return mw[e]}).join(""),d=hw([r[s],a[u],i[l]],o),f=gw(t.widgetState.getStatesWithLabel(c),1)[0];f.setOrigin.apply(f,pw(d))}},t.behavior=yw,e.getRepresentationsForViewType=function(e){switch(e){case cA.DEFAULT:case cA.GEOMETRY:case cA.SLICE:case cA.VOLUME:default:return[{builder:dw,labels:["handles"]},{builder:aw,labels:["corners"]}]}};var r=cb.createBuilder();r.addField({name:"indexToWorldT",initialValue:Array(16).fill(0)}).addField({name:"worldToIndexT",initialValue:Array(16).fill(0)});var a=cb.createBuilder().addField({name:"planes",initialValue:[0,1,0,1,0,1]}).build();r.addStateFromInstance({labels:["croppingPlanes"],name:"croppingPlanes",instance:a});for(var i=-1;i<2;i++)for(var o=-1;o<2;o++)for(var s=-1;s<2;s++)if(0!==i||0!==o||0!==s){var u=mw[i+1]+mw[o+1]+mw[s+1],l=vw(u);r.addStateFromMixin({labels:["handles",u,l],mixins:["name","origin","color","scale1","visible","manipulator"],name:u,initialValues:{scale1:10,origin:[i,o,s],visible:!0,name:u}})}t.widgetState=r.build(),a.onModified(e.updateHandles);var c=Mb.newInstance(),d=mb.newInstance();t.widgetState.getStatesWithLabel("corners").forEach(function(e){return e.setManipulator(c)}),t.widgetState.getStatesWithLabel("edges").forEach(function(e){return e.setManipulator(c)}),t.widgetState.getStatesWithLabel("faces").forEach(function(e){return e.setManipulator(d)})}(e,t)}var bw={newInstance:g.a.newInstance(Aw,"vtkImageCroppingWidget"),extend:Aw};function ww(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Tw,n),OA.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkPlaneWidget"),t.widgetState=Jb.generateState(),t.behavior=Dw,t.methodsToLink=["representationStyle","sphereResolution","handleSizeRatio","axisScale"],e.getRepresentationsForViewType=function(e){switch(e){case cA.DEFAULT:case cA.GEOMETRY:case cA.SLICE:case cA.VOLUME:default:return[{builder:Jb}]}}}(e,t)}var Iw={newInstance:g.a.newInstance(Cw,"vtkImplicitPlaneWidget"),extend:Cw};function xw(e,t){t.classHierarchy.push("vtkInteractiveOrientationWidgetProp"),g.a.event(e,t,"OrientationChange"),e.handleRightButtonPress=function(n){return t.activeState&&t.activeState.getActive()&&t.pickable?(e.invokeOrientationChange(Object.assign({action:"rightPress",event:n},t.activeState.get("up","right","direction"))),g.a.EVENT_ABORT):g.a.VOID},e.handleLeftButtonPress=function(n){return t.activeState&&t.activeState.getActive()&&t.pickable?(e.invokeOrientationChange(Object.assign({action:"leftPress",event:n},t.activeState.get("up","right","direction"))),g.a.EVENT_ABORT):g.a.VOID}}var Sw=[[-1,-1,-1],[-1,1,-1],[1,-1,-1],[1,1,-1],[-1,-1,1],[-1,1,1],[1,-1,1],[1,1,1]];function Nw(){return cb.createBuilder().addStateFromMixin({labels:["handles","---"],mixins:["origin"],name:"handle",initialValues:{origin:Sw[0]}}).addStateFromMixin({labels:["handles","-+-"],mixins:["origin"],name:"handle",initialValues:{origin:Sw[1]}}).addStateFromMixin({labels:["handles","+--"],mixins:["origin"],name:"handle",initialValues:{origin:Sw[2]}}).addStateFromMixin({labels:["handles","++-"],mixins:["origin"],name:"handle",initialValues:{origin:Sw[3]}}).addStateFromMixin({labels:["handles","--+"],mixins:["origin"],name:"handle",initialValues:{origin:Sw[4]}}).addStateFromMixin({labels:["handles","-++"],mixins:["origin"],name:"handle",initialValues:{origin:Sw[5]}}).addStateFromMixin({labels:["handles","+-+"],mixins:["origin"],name:"handle",initialValues:{origin:Sw[6]}}).addStateFromMixin({labels:["handles","+++"],mixins:["origin"],name:"handle",initialValues:{origin:Sw[7]}}).build("orientation","name")}var Ew={};function Ow(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Ew,n),OA.extend(e,t,n),function(e,t){t.classHierarchy.push("vtkInteractiveOrientationWidget"),t.methodsToLink=["closePolyLine","activeScaleFactor","activeColor","useActiveColor","glyphResolution","defaultScale"],t.behavior=xw,t.widgetState=Nw(),e.setBounds=function(e){for(var n=t.widgetState.getStatesWithLabel("handles"),r=0;r0?e[1]:e[0],o=a[1]>0?e[3]:e[2],s=a[2]>0?e[5]:e[4];n[r].setOrigin(i,o,s)}},e.getRepresentationsForViewType=function(e){switch(e){case cA.DEFAULT:case cA.GEOMETRY:case cA.SLICE:case cA.VOLUME:default:return[{builder:Fb,labels:["---","--+","-++","-+-"],initialValues:{behavior:Cb.HANDLE,pickable:!0,activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,name:"Face 1"}},{builder:Fb,labels:["---","+--","+-+","--+"],initialValues:{behavior:Cb.HANDLE,pickable:!0,activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,name:"Face 2"}},{builder:Fb,labels:["+--","++-","+++","+-+"],initialValues:{behavior:Cb.HANDLE,pickable:!0,activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,name:"Face 3"}},{builder:Fb,labels:["++-","-+-","-++","+++"],initialValues:{behavior:Cb.HANDLE,pickable:!0,activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,name:"Face 4"}},{builder:Fb,labels:["-++","--+","+-+","+++"],initialValues:{behavior:Cb.HANDLE,pickable:!0,activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,name:"Face 5"}},{builder:Fb,labels:["-+-","++-","+--","---"],initialValues:{behavior:Cb.HANDLE,pickable:!0,activeScaleFactor:1.2,activeColor:1,useActiveColor:!0,name:"Face 6"}}]}}}(e,t)}var Lw={newInstance:g.a.newInstance(Ow,"vtkInteractiveOrientationWidget"),extend:Ow};function Pw(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Rw,n),OA.extend(e,t,n),g.a.get(e,t,["painting"]),g.a.setGet(e,t,["manipulator","radius","color"]),function(e,t){t.classHierarchy.push("vtkPaintWidget"),t.behavior=kw,e.getRepresentationsForViewType=function(e){switch(e){case cA.DEFAULT:case cA.GEOMETRY:case cA.SLICE:return[{builder:Rb,labels:["handle","trail"]}];case cA.VOLUME:default:return[{builder:dw,labels:["handle"]}]}},t.widgetState=cb.createBuilder().addField({name:"trueOrigin",initialValue:[0,0,0]}).addStateFromMixin({labels:["handle"],mixins:["origin","color","scale1","direction","manipulator"],name:"handle",initialValues:{scale1:2*t.radius,origin:[0,0,0],direction:[0,0,1]}}).addDynamicMixinState({labels:["trail"],mixins:["origin","color","scale1","direction"],name:"trail",initialValues:{scale1:2*t.radius,origin:[0,0,0],direction:[0,0,1]}}).build();var n=t.widgetState.getHandle();t.manipulator=Mb.newInstance(),n.setManipulator(t.manipulator);var r=e.setRadius;e.setRadius=function(e){r(e)&&n.setScale1(2*e)}}(e,t)}var Bw=g.a.newInstance(jw,"vtkPaintWidget");function zw(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(t,Fw,n),OA.extend(e,t,n),g.a.setGet(e,t,["manipulator"]),Vw(e,t)}var Gw={Core:db,Manipulators:Tb,Representations:fw,Widgets3D:{vtkImageCroppingWidget:bw,vtkImplicitPlaneWidget:Iw,vtkInteractiveOrientationWidget:Lw,vtkPaintWidget:{newInstance:Bw,extend:jw},vtkPolyLineWidget:{newInstance:g.a.newInstance(Uw,"vtkPolyLineWidget"),extend:Uw}}};Ot.a.Common=ft,Ot.a.Filters=da,Ot.a.Imaging=Fa,Ot.a.Interaction=kc,Ot.a.IO=jf,Ot.a.Proxy=lA,Ot.a.Rendering=Uy,Ot.a.Widgets=Gw,Ot.a.mtime=g.a.getCurrentGlobalMTime,Ot.a.macro=g.a,window.vtk=Ot.a}])}); +//# sourceMappingURL=vtk.js.map \ No newline at end of file diff --git a/examples/WitU/controls.md b/examples/WitU/controls.md new file mode 100644 index 00000000..db50c50a --- /dev/null +++ b/examples/WitU/controls.md @@ -0,0 +1,18 @@ +# sampletrace +- command line: + - ```-s 500 500``` resolution of output image + - ```-d ``` degree of downsampling (powers of 2) + +``` + -s 100 100 -d 1 produces a 50x50 grid of sampling rays + -s 100 100 produces a 100x100 grid of sampling rays +``` + +## state file + +- camera + - ```viewpoint``` is origin of camera + - ```viewcenter``` is point you want to look at + - ```aov``` angle of view + + diff --git a/examples/WitU/data.state b/examples/WitU/data.state new file mode 100644 index 00000000..f17ab0cd --- /dev/null +++ b/examples/WitU/data.state @@ -0,0 +1,20 @@ +{ + "Datasets": + [ + { + "name": "Density", + "type": "Volume", + "filename": "WitU-Density.json" + }, + { + "name": "Temperature", + "type": "Volume", + "filename": "WitU-Temperature.json" + }, + { + "name": "vectors", + "type": "Volume", + "filename": "WitU-vectors.json" + } + ] +} diff --git a/examples/WitU/data/render/visualizations/lighting/light_01.state b/examples/WitU/data/render/visualizations/lighting/light_01.state new file mode 100644 index 00000000..0e2d539b --- /dev/null +++ b/examples/WitU/data/render/visualizations/lighting/light_01.state @@ -0,0 +1,8 @@ + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": true, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, diff --git a/examples/WitU/data/render/visualizations/operators/isovalue.state b/examples/WitU/data/render/visualizations/operators/isovalue.state new file mode 100644 index 00000000..67d0fbd5 --- /dev/null +++ b/examples/WitU/data/render/visualizations/operators/isovalue.state @@ -0,0 +1,28 @@ + { + "dataset": "Temperature", + "type": "Volume", + "isovalues" : [1900.0], + "colormap": [ + [ 0.000000, 0.984314, 0.988235, 0.909804 ], + [ 0.050000, 0.980392, 0.980392, 0.823529 ], + [ 0.100000, 0.968627, 0.960784, 0.745098 ], + [ 0.150000, 0.960784, 0.933333, 0.682353 ], + [ 0.200000, 0.949020, 0.898039, 0.635294 ], + [ 0.250000, 0.941176, 0.854902, 0.600000 ], + [ 0.300000, 0.929412, 0.815686, 0.568627 ], + [ 0.350000, 0.909804, 0.768627, 0.529412 ], + [ 0.400000, 0.890196, 0.721569, 0.498039 ], + [ 0.450000, 0.890196, 0.690196, 0.482353 ], + [ 0.500000, 0.878431, 0.662745, 0.458824 ], + [ 0.550000, 0.878431, 0.615686, 0.411765 ], + [ 0.600000, 0.870588, 0.576471, 0.392157 ], + [ 0.650000, 0.870588, 0.541176, 0.372549 ], + [ 0.700000, 0.858824, 0.505882, 0.352941 ], + [ 0.750000, 0.850980, 0.462745, 0.333333 ], + [ 0.800000, 0.831373, 0.419608, 0.313725 ], + [ 0.850000, 0.811765, 0.368627, 0.298039 ], + [ 0.900000, 0.788235, 0.309804, 0.286275 ], + [ 0.950000, 0.768627, 0.278431, 0.301961 ], + [ 1.000000, 0.749020, 0.270588, 0.349020 ] + ] + } diff --git a/examples/WitU/data/render/visualizations/operators/pathlines.state b/examples/WitU/data/render/visualizations/operators/pathlines.state new file mode 100644 index 00000000..e2706e30 --- /dev/null +++ b/examples/WitU/data/render/visualizations/operators/pathlines.state @@ -0,0 +1,19 @@ + { + "type": "PathLines", + "dataset": "pathlines", + "colormap": [ + [0.00, 0.0, 0.0, 1.0], + [0.25, 0.0, 1.0, 0.0], + [0.50, 1.0, 0.0, 0.0], + [0.75, 1.0, 0.0, 1.0], + [1.00, 1.0, 1.0, 0.0] + ], + "opacitymap": [ + [ 0.00, 1.0], + [ 1.00, 1.0] + ], + "radius0": 0.005, + "radius1": 0.03, + "value0": 0.0, + "value1": 1.0 + } diff --git a/examples/WitU/data/render/visualizations/operators/samples.state b/examples/WitU/data/render/visualizations/operators/samples.state new file mode 100644 index 00000000..f8eec76c --- /dev/null +++ b/examples/WitU/data/render/visualizations/operators/samples.state @@ -0,0 +1,16 @@ + { + "dataset": "samples", + "type": "Particles", + "colormap": [ + [0.00,0.781,0.781,0.781], + [1.00,0.781,0.781,0.781] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ], + "radius0": 0.01, + "radius1": 0.02, + "value0": 0.00, + "value1": 1.00 + } diff --git a/examples/WitU/data/render/visualizations/operators/slice.state b/examples/WitU/data/render/visualizations/operators/slice.state new file mode 100644 index 00000000..c59027d5 --- /dev/null +++ b/examples/WitU/data/render/visualizations/operators/slice.state @@ -0,0 +1,33 @@ + { + "dataset": "Temperature", + "type": "Volume", + "slices": [ [ 1.0, 0.0, 0.0, 0.0 ] ], + "data range": [0.0, 5300.0], + "colormap": [ + [ 0.000000, 0.984314, 0.988235, 0.909804 ], + [ 0.050000, 0.980392, 0.980392, 0.823529 ], + [ 0.100000, 0.968627, 0.960784, 0.745098 ], + [ 0.150000, 0.960784, 0.933333, 0.682353 ], + [ 0.200000, 0.949020, 0.898039, 0.635294 ], + [ 0.250000, 0.941176, 0.854902, 0.600000 ], + [ 0.300000, 0.929412, 0.815686, 0.568627 ], + [ 0.350000, 0.909804, 0.768627, 0.529412 ], + [ 0.400000, 0.890196, 0.721569, 0.498039 ], + [ 0.450000, 0.890196, 0.690196, 0.482353 ], + [ 0.500000, 0.878431, 0.662745, 0.458824 ], + [ 0.550000, 0.878431, 0.615686, 0.411765 ], + [ 0.600000, 0.870588, 0.576471, 0.392157 ], + [ 0.650000, 0.870588, 0.541176, 0.372549 ], + [ 0.700000, 0.858824, 0.505882, 0.352941 ], + [ 0.750000, 0.850980, 0.462745, 0.333333 ], + [ 0.800000, 0.831373, 0.419608, 0.313725 ], + [ 0.850000, 0.811765, 0.368627, 0.298039 ], + [ 0.900000, 0.788235, 0.309804, 0.286275 ], + [ 0.950000, 0.768627, 0.278431, 0.301961 ], + [ 1.000000, 0.749020, 0.270588, 0.349020 ] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ] + } diff --git a/examples/WitU/data/render/visualizations/operators/slice_sub.state b/examples/WitU/data/render/visualizations/operators/slice_sub.state new file mode 100644 index 00000000..14eeafe8 --- /dev/null +++ b/examples/WitU/data/render/visualizations/operators/slice_sub.state @@ -0,0 +1,33 @@ + { + "dataset": "Temperature", + "type": "Volume", + "slices": [ [ 1.0, 0.0, 0.0, XVALUE ] ], + "data range": [0.0, 5300.0], + "colormap": [ + [ 0.000000, 0.984314, 0.988235, 0.909804 ], + [ 0.050000, 0.980392, 0.980392, 0.823529 ], + [ 0.100000, 0.968627, 0.960784, 0.745098 ], + [ 0.150000, 0.960784, 0.933333, 0.682353 ], + [ 0.200000, 0.949020, 0.898039, 0.635294 ], + [ 0.250000, 0.941176, 0.854902, 0.600000 ], + [ 0.300000, 0.929412, 0.815686, 0.568627 ], + [ 0.350000, 0.909804, 0.768627, 0.529412 ], + [ 0.400000, 0.890196, 0.721569, 0.498039 ], + [ 0.450000, 0.890196, 0.690196, 0.482353 ], + [ 0.500000, 0.878431, 0.662745, 0.458824 ], + [ 0.550000, 0.878431, 0.615686, 0.411765 ], + [ 0.600000, 0.870588, 0.576471, 0.392157 ], + [ 0.650000, 0.870588, 0.541176, 0.372549 ], + [ 0.700000, 0.858824, 0.505882, 0.352941 ], + [ 0.750000, 0.850980, 0.462745, 0.333333 ], + [ 0.800000, 0.831373, 0.419608, 0.313725 ], + [ 0.850000, 0.811765, 0.368627, 0.298039 ], + [ 0.900000, 0.788235, 0.309804, 0.286275 ], + [ 0.950000, 0.768627, 0.278431, 0.301961 ], + [ 1.000000, 0.749020, 0.270588, 0.349020 ] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ] + } diff --git a/examples/WitU/data/render/visualizations/operators/volume.state b/examples/WitU/data/render/visualizations/operators/volume.state new file mode 100644 index 00000000..981be8c5 --- /dev/null +++ b/examples/WitU/data/render/visualizations/operators/volume.state @@ -0,0 +1,37 @@ + { + "dataset": "Temperature", + "type": "Volume", + "volume rendering" : true, + "data range": [0.0, 10.0], + "colormap": [ + [ 0.000000, 0.984314, 0.988235, 0.909804 ], + [ 0.050000, 0.980392, 0.980392, 0.823529 ], + [ 0.100000, 0.968627, 0.960784, 0.745098 ], + [ 0.150000, 0.960784, 0.933333, 0.682353 ], + [ 0.200000, 0.949020, 0.898039, 0.635294 ], + [ 0.250000, 0.941176, 0.854902, 0.600000 ], + [ 0.300000, 0.929412, 0.815686, 0.568627 ], + [ 0.350000, 0.909804, 0.768627, 0.529412 ], + [ 0.400000, 0.890196, 0.721569, 0.498039 ], + [ 0.450000, 0.890196, 0.690196, 0.482353 ], + [ 0.500000, 0.878431, 0.662745, 0.458824 ], + [ 0.550000, 0.878431, 0.615686, 0.411765 ], + [ 0.600000, 0.870588, 0.576471, 0.392157 ], + [ 0.650000, 0.870588, 0.541176, 0.372549 ], + [ 0.700000, 0.858824, 0.505882, 0.352941 ], + [ 0.750000, 0.850980, 0.462745, 0.333333 ], + [ 0.800000, 0.831373, 0.419608, 0.313725 ], + [ 0.850000, 0.811765, 0.368627, 0.298039 ], + [ 0.900000, 0.788235, 0.309804, 0.286275 ], + [ 0.950000, 0.768627, 0.278431, 0.301961 ], + [ 1.000000, 0.749020, 0.270588, 0.349020 ] + ], + "opacitymap": [ + [ 0.00, 0.0], + [ 0.30, 0.0], + [ 0.31, 0.1], + [ 0.40, 0.1], + [ 0.41, 0.0], + [ 1.00, 0.0] + ] + } diff --git a/examples/WitU/data/state_01.json b/examples/WitU/data/state_01.json new file mode 100755 index 00000000..cce81110 --- /dev/null +++ b/examples/WitU/data/state_01.json @@ -0,0 +1,10 @@ +{ + "lights" : [ + "data/render/visualizations/lighting/light_01.state" + ], + "operators" : [ + "data/render/visualizations/operators/volume.state", + "data/render/visualizations/operators/samples.state", + "data/render/visualizations/operators/slice.state" + ] +} diff --git a/examples/WitU/data/state_02.json b/examples/WitU/data/state_02.json new file mode 100755 index 00000000..a1a12496 --- /dev/null +++ b/examples/WitU/data/state_02.json @@ -0,0 +1,8 @@ +{ + "lights" : [ + "data/render/visualizations/lighting/light_01.state" + ], + "operators" : [ + "data/render/visualizations/operators/samples.state" + ] +} diff --git a/examples/WitU/data/state_all.json b/examples/WitU/data/state_all.json new file mode 100755 index 00000000..e3965264 --- /dev/null +++ b/examples/WitU/data/state_all.json @@ -0,0 +1,12 @@ +{ + "lights" : [ + "data/render/visualizations/lighting/light_01.state" + ], + "operators" : [ + "data/render/visualizations/operators/isovalue.state", + "data/render/visualizations/operators/pathlines.state", + "data/render/visualizations/operators/samples.state", + "data/render/visualizations/operators/slice.state", + "data/render/visualizations/operators/volume.state" + ] +} diff --git a/examples/WitU/data/state_parameters.json b/examples/WitU/data/state_parameters.json new file mode 100644 index 00000000..eb394269 --- /dev/null +++ b/examples/WitU/data/state_parameters.json @@ -0,0 +1,11 @@ +{ + "lights" : [ + "data/render/visualizations/lighting/light_01.state" + ], + "operators" : [ + "data/render/visualizations/operators/volume.state", + "data/render/visualizations/operators/samples.state", + "data/render/visualizations/operators/pathlines.state", + "tmp/slice_state.state" + ] +} diff --git a/examples/WitU/generate_cameras b/examples/WitU/generate_cameras new file mode 100755 index 00000000..5dcacbbd --- /dev/null +++ b/examples/WitU/generate_cameras @@ -0,0 +1,50 @@ +#!/usr/bin/env python + +import sys +import json +import numpy + +if (len(sys.argv) != 4): + print("ERROR: need three [3] args") + exit + +camera_state = sys.argv[1] +state_nocameras = sys.argv[2] +output_state = sys.argv[3] + +from math import * +import os + +def polar2cartesian( r, theta, phi): + return [ + r*cos(radians(t))*sin(radians(p)), + r*sin(radians(t))*sin(radians(p)), + r*cos(radians(p)) + ] + +camdata = [] +with open(camera_state, "r") as camjson: + camdata = json.load(camjson) + +os.system("cat {} > {}".format(state_nocameras, output_state)) + +curid = 0 +with open(output_state, "a") as state_file: + state_file.write(" \"Cameras\": [\n") + all_phis = numpy.arange(camdata["phi"][0], camdata["phi"][1], camdata["phi"][2]) + for p in all_phis: + all_thetas = numpy.arange(camdata["theta"][0], camdata["theta"][1], camdata["theta"][2]) + for t in all_thetas: + if (curid != 0): + state_file.write(" },\n") + (x, y, z) = polar2cartesian( camdata["radius"], t, p ) + state_file.write(" {\n") + state_file.write(" \"aov\" : {},\n".format(camdata["aov"])) + state_file.write(" \"viewpoint\" : [{}, {}, {}],\n".format( x, y, z )) + state_file.write(" \"viewcenter\" : [0.0, 0.0, 0.0],\n" ) + state_file.write(" \"viewup\" : [0.0, 0.0, 1.0],\n" ) + state_file.write(" \"dimensions\" : [{}, {}]\n".format(camdata["width"], camdata["height"])) + curid = curid + 1 + state_file.write(" }\n") + state_file.write(" ]\n") + state_file.write("}\n") diff --git a/examples/WitU/generate_parameters b/examples/WitU/generate_parameters new file mode 100755 index 00000000..2d06700e --- /dev/null +++ b/examples/WitU/generate_parameters @@ -0,0 +1,218 @@ +#!/usr/bin/env python + +import itertools +import numpy +from cintools.cdb import cdb +from cintools.install import install +import re +import os + +CLEAN = False + +cursubdir = -1 + +BASEDIR = "tmp" + +CLAUSES = { + "slice" : "data/render/visualizations/operators/slice_sub.state" +} + +RENDERSTATE = { + "slice" : "data/state_parameters.json" +} + +COMMAND = { + "renderstate" : "./generate_render_state", + "cameras" : "./generate_cameras", + "sampletrace" : "sampletrace" +} + +FILE = { + "data" : "data.state", + "sample" : "{}/sample.state".format(BASEDIR), + "camera" : "{}/camera.json".format(BASEDIR) +} + + +def next_subdir(): + global cursubdir + cursubdir = cursubdir + 1 + cur = "{:05d}".format(cursubdir) + return cur + +def generate(db, sVal, phis, thetas): + global CLAUSES + global RENDERSTATE + global COMMAND + global FILE + global BASEDIR + + cleanup = [] + curid = 0 + subdir = next_subdir() + newfile = "{}/slice_state.state".format(BASEDIR) + write_slice_clause(CLAUSES["slice"], newfile, sVal ) + cleanup.append(newfile) + + # generate the images + # render state + renderfile = "{}/render_slice.state".format(BASEDIR) + cmd = "{} {} {}".format(COMMAND["renderstate"], RENDERSTATE["slice"], renderfile) + print(cmd) + os.system(cmd) + cleanup.append(renderfile) + # cameras + camerafile = "{}/camera_slice.state".format(BASEDIR) + cmd = "{} {} {} {}".format(COMMAND["cameras"], FILE["camera"], renderfile, camerafile) + print(cmd) + os.system(cmd) + cleanup.append(camerafile) + # generate images + cmd = "{} {} {} {}".format(COMMAND["sampletrace"], FILE["data"], FILE["sample"], camerafile) + print(cmd) + os.system(cmd) + # move images + newdir = "{}/{}".format(db.path, subdir) + os.makedirs(newdir) + cmd = "mv *.png {}".format(newdir) + print(cmd) + os.system(cmd) + + # write out the cinema database metadata + for s in itertools.product([sVal], phis, thetas): + db.add_entry({ + "slice":s[0], + "phi":s[1], + "theta":s[2], + "FILE":"{}/samples_{:05d}.png".format(subdir,curid) + }) + curid = curid + 1 + + # clean up + if CLEAN: + for f in cleanup: + print("removing {} ...".format(f)) + os.remove(f) + else: + print("NOT cleaning up ...") + +def write_sample_state(path, **kwargs): + # set default values + vals = { + "type" : "IsoSampler", + "dataset" : "Density", + "isovalue" : 3.0, + "aov" : 1.0, + "viewpoint" : [0.0, 0.0, -20.0], + "viewdirection" : [0.0, 0.0, 1.0], + "viewup" : [0.0, 1.0, 0.0], + "dimensions" : [50, 50] + } + + # overwrite with values from the function call + for key, value in kwargs.items(): + vals[key] = value + + # write out a file + with open(path, "w") as s: + s.write('''{{ + \"Visualizations\" : + [ + {{ + \"operators\" : + [ + {{ + \"type\" : \"{}\", + \"dataset\" : \"{}\", + \"isovalue\" : {} + }} + ] + }} + ], + \"Cameras\" : + [ + {{ + \"aov\" : {}, + \"viewpoint\" : {}, + \"viewdirection\" : {}, + \"viewup\" : {}, + \"dimensions\" : {} + }} + ] +}} '''.format( + vals["type"], + vals["dataset"], + vals["isovalue"], + vals["aov"], + vals["viewpoint"], + vals["viewdirection"], + vals["viewup"], + vals["dimensions"] + )) + +def write_camera_json_file(path, phi, theta): + with open(path, "w") as output: + output.write("{\n") + output.write(" \"radius\" : 4.0,\n") + output.write(" \"aov\" : 40.0,\n") + output.write(" \"width\" : 500,\n") + output.write(" \"height\" : 500,\n") + output.write(" \"theta\" : [{}, {}, {}],\n".format(theta[0], theta[1], theta[2])) + output.write(" \"phi\" : [{}, {}, {}]\n".format(phi[0], phi[1], phi[2])) + output.write("}\n") + +def write_slice_clause(inclause, outclause, value): + lines = [] + print("creating new slice clause: {}".format(outclause)) + with open(inclause, "r") as infile: + lines = infile.readlines(); + + with open(outclause, "w") as outfile: + for line in lines: + outfile.write(re.sub("XVALUE", str(value), line)) + + +# set the camera parameters for the Cinema database +slice_params = [] +theta_params = [] +phi_params = [] + +FULL = True +if FULL: + # create a full database + slice_params = [-0.75, 1.0, 0.25] + # theta_params = [ 0.0, 360.0, 10.0] + theta_params = [ 0.0, 20.0, 10.0] + phi_params = [90.0, 40.0, -10.0] +else: + # use test (smaller) parameters + slice_params = [ 0.0, 2.0, 1.0] + theta_params = [ 0.0, 20.0, 10.0] + phi_params = [90.0, 70.0, -10.0] + +if os.path.exists(BASEDIR): + print("Directory \"{}\" exists. Exiting ...".format(BASEDIR)) + exit() +else: + os.mkdir(BASEDIR) + +write_camera_json_file(FILE["camera"], phi_params, theta_params) +write_sample_state("{}/sample.state".format(BASEDIR), aov=1.0) + +slices = numpy.arange(slice_params[0], slice_params[1], slice_params[2]) +theta = numpy.arange(theta_params[0], theta_params[1], theta_params[2]) +phi = numpy.arange(phi_params[0], phi_params[1], phi_params[2]) + +dbs = [ + "database.cdb" +] +database = cdb.CDB("{}/{}".format(BASEDIR, dbs[0])) +database.create() +for s in slices: + generate( database, s, phi, theta ) + +database.finalize() +install.compare( "cintools/cinema.source", + BASEDIR, + "compare.html", + dbs) diff --git a/examples/WitU/generate_render_state b/examples/WitU/generate_render_state new file mode 100755 index 00000000..bc2e2c01 --- /dev/null +++ b/examples/WitU/generate_render_state @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +import os +import json +import sys + +if (len(sys.argv) != 3): + print("ERROR: need one arg: output filename") + exit + +rdef = sys.argv[1] +outfile = sys.argv[2] + +with open(rdef) as rdef_json: + rdata = json.load(rdef_json) + +lights = rdata["lights"] +operators = rdata["operators"] + +preamble = '''{ + "Datasets": + [ + ], + "Renderer": { + }, + "Visualizations": + [ + { +''' + +postamble = " ]\n }\n ],\n" + +with open(outfile, "w") as state: + state.write(preamble) + + for l in lights: + with open(l, 'r') as statefile: + for line in statefile: + state.write(line) + + state.write(" \"operators\":\n [\n") + + numops = len(operators) + for o in operators: + with open(o, 'r') as statefile: + for line in statefile: + state.write(line) + if (numops != 1): + state.write(",\n") + numops = numops - 1 + + state.write(postamble) diff --git a/examples/WitU/ramp.json b/examples/WitU/ramp.json new file mode 100644 index 00000000..1074c10e --- /dev/null +++ b/examples/WitU/ramp.json @@ -0,0 +1,30 @@ + { + "ColorSpace" : "Diverging", + "Name" : "Preset", + "Points" : + [ + 0.99999997718689815, + 0.0, + 0.5, + 0.0, + 1.0000000130281723, + 1.0, + 0.5, + 0.0 + ], + "RGBPoints" : + [ + 0.99999997718689815, + 0.231373, + 0.298039, + 0.75294099999999997, + 0.99999999510753523, + 0.86500299999999997, + 0.86500299999999997, + 0.86500299999999997, + 1.0000000130281723, + 0.70588200000000001, + 0.0156863, + 0.14902000000000001 + ] + } diff --git a/examples/WitU/readme.md b/examples/WitU/readme.md new file mode 100644 index 00000000..cb11b742 --- /dev/null +++ b/examples/WitU/readme.md @@ -0,0 +1,7 @@ +This is an example of sampling a volumetric scalar field using the IsoSampler vis using a dataset of water formation in the early Universe ("Water in the Universe", or "WitU"). It makes use of the sampletrace application, which contains two raycasting passes: first one to sample and finally one to render, separated by a hard-coded application of the RungeKutta operator followed by the TraceToPathLines operator to trace pathlines from the particles through a vector volume field, then convert the path lines to renderable form. + +The data is available in Box at: https://utexas.box.com/s/1vz5i89x2dqin92y9fxu5r0nbk0yzo0q + +First, run ./setup_data This extracts the necessary scalar and vector volumes from the original VTI. + +Then run ./run to generate 8 images of streamlines traced through the vector field from samples of the scalar field. diff --git a/examples/WitU/render.state b/examples/WitU/render.state new file mode 100644 index 00000000..cba8bd03 --- /dev/null +++ b/examples/WitU/render.state @@ -0,0 +1,172 @@ +{ + "Datasets": + [ + ], + "Renderer": { + }, + "Visualizations": + [ + { + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": true, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, + "operators": + [ + { + "type": "PathLines", + "dataset": "pathlines", + "colormap": [ + [0.00, 0.0, 0.0, 1.0], + [0.25, 0.0, 1.0, 0.0], + [0.50, 1.0, 0.0, 0.0], + [0.75, 1.0, 0.0, 1.0], + [1.00, 1.0, 1.0, 0.0] + ], + "opacitymap": [ + [ 0.00, 1.0], + [ 1.00, 1.0] + ], + "radius0": 0.005, + "radius1": 0.03, + "value0": 0.0, + "value1": 1.0 + }, + { + "dataset": "samples", + "type": "Particles", + "colormap": [ + [0.00,0.5,0.5,1.0], + [0.25,1.0,1.0,0.0], + [0.50,0.5,1.0,0.5], + [0.75,0.5,0.5,1.0], + [1.00,0.5,1.0,0.5] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ], + "radius0": 0.03, + "radius1": 0.04, + "value0": 0.00, + "value1": 1.00 + }, + { + "dataset": "Temperature", + "type": "Volume", + "isovalues" : [4000.0], + "colormap": [ + [ 0.0, 1.0, 0.0, 0.0 ], + [ 1.0, 0.0, 0.0, 1.0 ] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ] + }, + { + "dataset": "Temperature", + "type": "Volume", + "slices": [ [ 1.0, 0.0, 0.0, 0.0 ] ], + "data range": [0.0, 5300.0], + "colormap_unused" : "ramp.json", + "colormap": [ + [ 0.000000, 0.984314, 0.988235, 0.909804 ], + [ 0.050000, 0.980392, 0.980392, 0.823529 ], + [ 0.100000, 0.968627, 0.960784, 0.745098 ], + [ 0.150000, 0.960784, 0.933333, 0.682353 ], + [ 0.200000, 0.949020, 0.898039, 0.635294 ], + [ 0.250000, 0.941176, 0.854902, 0.600000 ], + [ 0.300000, 0.929412, 0.815686, 0.568627 ], + [ 0.350000, 0.909804, 0.768627, 0.529412 ], + [ 0.400000, 0.890196, 0.721569, 0.498039 ], + [ 0.450000, 0.890196, 0.690196, 0.482353 ], + [ 0.500000, 0.878431, 0.662745, 0.458824 ], + [ 0.550000, 0.878431, 0.615686, 0.411765 ], + [ 0.600000, 0.870588, 0.576471, 0.392157 ], + [ 0.650000, 0.870588, 0.541176, 0.372549 ], + [ 0.700000, 0.858824, 0.505882, 0.352941 ], + [ 0.750000, 0.850980, 0.462745, 0.333333 ], + [ 0.800000, 0.831373, 0.419608, 0.313725 ], + [ 0.850000, 0.811765, 0.368627, 0.298039 ], + [ 0.900000, 0.788235, 0.309804, 0.286275 ], + [ 0.950000, 0.768627, 0.278431, 0.301961 ], + [ 1.000000, 0.749020, 0.270588, 0.349020 ] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ] + } + ] + }, + { + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": false, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, + "operators": + [ + { + "dataset": "samples", + "type": "Particles", + "colormap": [ + [0.00,0.5,0.5,1.0], + [0.25,1.0,1.0,0.0], + [0.50,0.5,1.0,0.5], + [0.75,0.5,0.5,1.0], + [1.00,0.5,1.0,0.5] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ], + "radius0": 0.01, + "radius1": 0.02, + "value0": 0.00, + "value1": 1.00 + } + ] + } + ], + "Cameras": + [ + { + "viewpoint": [4.0, 0, 0], + "viewcenter": [0, 0, 0], + "viewup": [0, 1, 0], + "aov": 40, + "dimensions": [500, 500] + }, + { + "viewpoint": [0, 4.0, 0], + "viewcenter": [0, 0, 0], + "viewup": [0, 0, 1], + "aov": 40, + "dimensions": [500, 500] + }, + { + "viewpoint": [0, 0, 4.0], + "viewcenter": [0, 0, 0], + "viewup": [0, 1, 0], + "aov": 40, + "dimensions": [500, 500] + }, + { + "viewpoint": [1, 2, -3], + "viewcenter": [0, 0, 0], + "viewup": [0, 1, 0], + "aov": 40, + "dimensions": [500, 500] + } + ] +} + diff --git a/examples/WitU/render_nocameras.state b/examples/WitU/render_nocameras.state new file mode 100644 index 00000000..232e23f1 --- /dev/null +++ b/examples/WitU/render_nocameras.state @@ -0,0 +1,139 @@ +{ + "Datasets": + [ + ], + "Renderer": { + }, + "Visualizations": + [ + { + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": true, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, + "operators": + [ + { + "type": "PathLines", + "dataset": "pathlines", + "colormap": [ + [0.00, 0.0, 0.0, 1.0], + [0.25, 0.0, 1.0, 0.0], + [0.50, 1.0, 0.0, 0.0], + [0.75, 1.0, 0.0, 1.0], + [1.00, 1.0, 1.0, 0.0] + ], + "opacitymap": [ + [ 0.00, 1.0], + [ 1.00, 1.0] + ], + "radius0": 0.005, + "radius1": 0.03, + "value0": 0.0, + "value1": 1.0 + }, + { + "dataset": "samples", + "type": "Particles", + "colormap": [ + [0.00,0.5,0.5,1.0], + [0.25,1.0,1.0,0.0], + [0.50,0.5,1.0,0.5], + [0.75,0.5,0.5,1.0], + [1.00,0.5,1.0,0.5] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ], + "radius0": 0.03, + "radius1": 0.04, + "value0": 0.00, + "value1": 1.00 + }, + { + "dataset": "Temperature", + "type": "Volume", + "isovalues" : [4000.0], + "colormap": [ + [ 0.0, 1.0, 0.0, 0.0 ], + [ 1.0, 0.0, 0.0, 1.0 ] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ] + }, + { + "dataset": "Temperature", + "type": "Volume", + "slices": [ [ 1.0, 0.0, 0.0, 0.0 ] ], + "data range": [0.0, 5300.0], + "colormap_unused" : "ramp.json", + "colormap": [ + [ 0.000000, 0.984314, 0.988235, 0.909804 ], + [ 0.050000, 0.980392, 0.980392, 0.823529 ], + [ 0.100000, 0.968627, 0.960784, 0.745098 ], + [ 0.150000, 0.960784, 0.933333, 0.682353 ], + [ 0.200000, 0.949020, 0.898039, 0.635294 ], + [ 0.250000, 0.941176, 0.854902, 0.600000 ], + [ 0.300000, 0.929412, 0.815686, 0.568627 ], + [ 0.350000, 0.909804, 0.768627, 0.529412 ], + [ 0.400000, 0.890196, 0.721569, 0.498039 ], + [ 0.450000, 0.890196, 0.690196, 0.482353 ], + [ 0.500000, 0.878431, 0.662745, 0.458824 ], + [ 0.550000, 0.878431, 0.615686, 0.411765 ], + [ 0.600000, 0.870588, 0.576471, 0.392157 ], + [ 0.650000, 0.870588, 0.541176, 0.372549 ], + [ 0.700000, 0.858824, 0.505882, 0.352941 ], + [ 0.750000, 0.850980, 0.462745, 0.333333 ], + [ 0.800000, 0.831373, 0.419608, 0.313725 ], + [ 0.850000, 0.811765, 0.368627, 0.298039 ], + [ 0.900000, 0.788235, 0.309804, 0.286275 ], + [ 0.950000, 0.768627, 0.278431, 0.301961 ], + [ 1.000000, 0.749020, 0.270588, 0.349020 ] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ] + } + ] + }, + { + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": false, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, + "operators": + [ + { + "dataset": "samples", + "type": "Particles", + "colormap": [ + [0.00,0.5,0.5,1.0], + [0.25,1.0,1.0,0.0], + [0.50,0.5,1.0,0.5], + [0.75,0.5,0.5,1.0], + [1.00,0.5,1.0,0.5] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ], + "radius0": 0.01, + "radius1": 0.02, + "value0": 0.00, + "value1": 1.00 + } + ] + } + ], diff --git a/examples/WitU/render_samples_nocameras.state b/examples/WitU/render_samples_nocameras.state new file mode 100644 index 00000000..94ade791 --- /dev/null +++ b/examples/WitU/render_samples_nocameras.state @@ -0,0 +1,41 @@ +{ + "Datasets": + [ + ], + "Renderer": { + }, + "Visualizations": + [ + { + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": false, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, + "operators": + [ + { + "dataset": "samples", + "type": "Particles", + "colormap": [ + [0.00,0.5,0.5,1.0], + [0.25,1.0,1.0,0.0], + [0.50,0.5,1.0,0.5], + [0.75,0.5,0.5,1.0], + [1.00,0.5,1.0,0.5] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ], + "radius0": 0.01, + "radius1": 0.02, + "value0": 0.00, + "value1": 1.00 + } + ] + } + ], diff --git a/examples/WitU/render_visualization_nocameras.state b/examples/WitU/render_visualization_nocameras.state new file mode 100644 index 00000000..7627ff46 --- /dev/null +++ b/examples/WitU/render_visualization_nocameras.state @@ -0,0 +1,107 @@ +{ + "Datasets": + [ + ], + "Renderer": { + }, + "Visualizations": + [ + { + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": true, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, + "operators": + [ + { + "type": "PathLines", + "dataset": "pathlines", + "colormap": [ + [0.00, 0.0, 0.0, 1.0], + [0.25, 0.0, 1.0, 0.0], + [0.50, 1.0, 0.0, 0.0], + [0.75, 1.0, 0.0, 1.0], + [1.00, 1.0, 1.0, 0.0] + ], + "opacitymap": [ + [ 0.00, 1.0], + [ 1.00, 1.0] + ], + "radius0": 0.005, + "radius1": 0.03, + "value0": 0.0, + "value1": 1.0 + }, + { + "dataset": "samples", + "type": "Particles", + "colormap": [ + [0.00,0.5,0.5,1.0], + [0.25,1.0,1.0,0.0], + [0.50,0.5,1.0,0.5], + [0.75,0.5,0.5,1.0], + [1.00,0.5,1.0,0.5] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ], + "radius0": 0.01, + "radius1": 0.02, + "value0": 0.00, + "value1": 1.00 + }, + { + "dataset": "Temperature", + "type": "Volume", + "isovalues" : [4000.0], + "colormap": [ + [ 0.0, 1.0, 0.0, 0.0 ], + [ 1.0, 0.0, 0.0, 1.0 ] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ] + }, + { + "dataset": "Temperature", + "type": "Volume", + "slices": [ [ 1.0, 0.0, 0.0, 0.0 ] ], + "data range": [0.0, 5300.0], + "colormap_unused" : "ramp.json", + "colormap": [ + [ 0.000000, 0.984314, 0.988235, 0.909804 ], + [ 0.050000, 0.980392, 0.980392, 0.823529 ], + [ 0.100000, 0.968627, 0.960784, 0.745098 ], + [ 0.150000, 0.960784, 0.933333, 0.682353 ], + [ 0.200000, 0.949020, 0.898039, 0.635294 ], + [ 0.250000, 0.941176, 0.854902, 0.600000 ], + [ 0.300000, 0.929412, 0.815686, 0.568627 ], + [ 0.350000, 0.909804, 0.768627, 0.529412 ], + [ 0.400000, 0.890196, 0.721569, 0.498039 ], + [ 0.450000, 0.890196, 0.690196, 0.482353 ], + [ 0.500000, 0.878431, 0.662745, 0.458824 ], + [ 0.550000, 0.878431, 0.615686, 0.411765 ], + [ 0.600000, 0.870588, 0.576471, 0.392157 ], + [ 0.650000, 0.870588, 0.541176, 0.372549 ], + [ 0.700000, 0.858824, 0.505882, 0.352941 ], + [ 0.750000, 0.850980, 0.462745, 0.333333 ], + [ 0.800000, 0.831373, 0.419608, 0.313725 ], + [ 0.850000, 0.811765, 0.368627, 0.298039 ], + [ 0.900000, 0.788235, 0.309804, 0.286275 ], + [ 0.950000, 0.768627, 0.278431, 0.301961 ], + [ 1.000000, 0.749020, 0.270588, 0.349020 ] + ], + "opacitymap": [ + [ 0.00, 1.00], + [ 1.00, 1.00] + ] + } + ] + } + ], diff --git a/examples/WitU/run b/examples/WitU/run new file mode 100755 index 00000000..4d8b3875 --- /dev/null +++ b/examples/WitU/run @@ -0,0 +1,2 @@ +sampletrace sample.state render.state + diff --git a/examples/WitU/run_cinema b/examples/WitU/run_cinema new file mode 100755 index 00000000..0cd92594 --- /dev/null +++ b/examples/WitU/run_cinema @@ -0,0 +1,29 @@ +#!/bin/bash + +# clean up +OUTDIR="tmp" +rm -rf $OUTDIR +mkdir $OUTDIR + +./generate_render_state data/state_01.json vis_cam.tmp +./generate_cameras vis_cam.tmp vis_state.tmp +sampletrace data.state sample.state vis_state.tmp +rm vis_state.tmp vis_cam.tmp + +CDB="visualization" +mkdir $OUTDIR/${CDB}.cdb +mv *.png $OUTDIR/${CDB}.cdb +mv data.csv $OUTDIR/${CDB}.cdb + +./generate_render_state data/state_02.json sample_cam.tmp +./generate_cameras sample_cam.tmp sample_state.tmp +sampletrace data.state sample.state sample_state.tmp +rm sample_state.tmp sample_cam.tmp + +CDB="samples" +mkdir $OUTDIR/${CDB}.cdb +mv *.png $OUTDIR/${CDB}.cdb +mv data.csv $OUTDIR/${CDB}.cdb + + + diff --git a/examples/WitU/run_test b/examples/WitU/run_test new file mode 100755 index 00000000..1d35a59f --- /dev/null +++ b/examples/WitU/run_test @@ -0,0 +1,15 @@ +#!/bin/bash + +# clean up +OUTDIR="tmp" +rm -rf $OUTDIR +mkdir $OUTDIR + +./generate_cameras out.state render.state +sampletrace sample.state render.state + +CDB="test" +mkdir $OUTDIR/${CDB}.cdb +mv *.png $OUTDIR/${CDB}.cdb +mv data.csv $OUTDIR/${CDB}.cdb + diff --git a/examples/WitU/sample.state b/examples/WitU/sample.state new file mode 100644 index 00000000..b5ef22a4 --- /dev/null +++ b/examples/WitU/sample.state @@ -0,0 +1,25 @@ +{ + "Visualizations": + [ + { + "annotation": "", + "operators": + [ + { + "type": "IsoSampler", + "dataset": "Density", + "isovalue": 3 + } + ] + } + ], + "Cameras": [ + { + "aov" : 1.0, + "viewpoint" : [0.0, 0.0, -20.0], + "viewdirection" : [0.0, 0.0, 1.0], + "viewup" : [0.0, 1.0, 0.0], + "dimensions" : [50, 50] + } + ] +} diff --git a/examples/WitU/setup_data b/examples/WitU/setup_data new file mode 100755 index 00000000..37a9f689 --- /dev/null +++ b/examples/WitU/setup_data @@ -0,0 +1 @@ +vtkpython `which vti2json` WitU.vti Density Temperature vectors diff --git a/examples/sampletrace/BlueSpeed4.json b/examples/sampletrace/BlueSpeed4.json new file mode 100644 index 00000000..b22a0851 --- /dev/null +++ b/examples/sampletrace/BlueSpeed4.json @@ -0,0 +1,45 @@ +[ + { + "ColorSpace" : "RGB", + "Name" : "Preset 8", + "Points" : + [ + 77.223762512207031, + 0.0, + 0.5, + 0.0, + 276.82882690429688, + 1.0, + 0.5, + 0.0 + ], + "RGBPoints" : + [ + 77.223762512207031, + 0.84844029275167376, + 0.96054397614274911, + 0.95174967591195248, + 117.144775390625, + 0.65474850940569451, + 0.83005653735852225, + 0.87475956210373518, + 157.06578826904297, + 0.47051741023974819, + 0.67075859619001332, + 0.77672040722451297, + 196.98680114746094, + 0.32311504673395003, + 0.45258752604015567, + 0.65417140462041157, + 236.90781402587891, + 0.22886120439990298, + 0.29672188747800793, + 0.55613219511368606, + 276.82882690429688, + 0.15528289758351485, + 0.15422453255869639, + 0.48260295282676352 + ] + } +] + diff --git a/examples/sampletrace/Density.json b/examples/sampletrace/Density.json new file mode 100644 index 00000000..eeba5299 --- /dev/null +++ b/examples/sampletrace/Density.json @@ -0,0 +1,41 @@ +[ + { + "ColorSpace" : "Lab", + "Name" : "Preset 11", + "Points" : + [ + 0.0, + 0.0, + 0.5, + 0.0, + 5532.5106362445213, + 1.0, + 0.5, + 0.0 + ], + "RGBPoints" : + [ + 0.0, + 0.92802210853672096, + 1.0, + 0.84040776707164144, + 29.638450622558594, + 0.64313725490196083, + 0.77254901960784317, + 0.5725490196078431, + 1847.46337890625, + 0.50022363587250751, + 0.65882471566512657, + 0.43721209306220332, + 3447.939697265625, + 0.29755135023765805, + 0.50196174520210202, + 0.29413939425815688, + 5532.5106362445213, + 0.11372549019607843, + 0.26666666666666666, + 0.15686274509803921 + ] + } +] + diff --git a/examples/sampletrace/SampleTraceExample.md b/examples/sampletrace/SampleTraceExample.md new file mode 100644 index 00000000..13154ae0 --- /dev/null +++ b/examples/sampletrace/SampleTraceExample.md @@ -0,0 +1,16 @@ +# SampleTrace example + +The files in this directory demonstrate particle advection, decoration and rendering. For detailed info about how this is accomplished, see *Tracer.md* in the tracer source directory. + +To run the example, simply run: + +**sampletrace data.state sample.state render.state** + +This will run the particle advection to the bitter end, then render slices, a volume scalar field, and the particle traces colormapped by integration time. + +By adding the *-I 3* command line argument, we limit the integration time to 3 units. As it happens, in this case some of the streamlines enter a hairball and take a very long time to die. + +By adding the *-nf k* command line argument, we iteratively truncate the particle traces to *i/(k-1)* of the max advection time and loop for i = 0 to (k-1) frames, resulting in k movie frames. + +By adding the *-dt t* command line argument, we truncate the particle traces to the last *t* proportion of the maximum integration time. + diff --git a/examples/sampletrace/Temperature-slices.json b/examples/sampletrace/Temperature-slices.json new file mode 100644 index 00000000..19583569 --- /dev/null +++ b/examples/sampletrace/Temperature-slices.json @@ -0,0 +1,94 @@ +[ + { + "ColorSpace" : "Lab", + "Creator" : "CCC-Tool", + "Name" : "yel_peach_br", + "NanColor" : [0,0,0], + "AboveColor" : [0,0,0], + "BelowColor" : [0,0,0], + "RGBPoints" : [ + 0, + 0.38039194194378356, + 0.14686061087575597, + 0.1108588351414615, + 0.09999999999999998, + 0.47058793005609173, + 0.2243058244560055, + 0.207886926392227, + 0.19999999999999996, + 0.63013538293516, + 0.33919925215851215, + 0.27425007493789144, + 0.30000000000000004, + 0.6313729542370814, + 0.4039220717311719, + 0.29019598131788954, + 0.4, + 0.6901959499823255, + 0.4627450749700091, + 0.27450997301856034, + 0.5, + 0.7607839472585615, + 0.5607840744286301, + 0.3490199730102772, + 0.6, + 0.7999999469879002, + 0.6470590710577324, + 0.3999999718266233, + 0.7, + 0.8509799459347076, + 0.7333330707351879, + 0.45882397082920073, + 0.8, + 0.9019609459130987, + 0.827451070177363, + 0.5411759715118918, + 0.9, + 0.9411759485649653, + 0.9058820689389299, + 0.678430977331247, + 0.95, + 0.9686269515772171, + 0.9568630681390465, + 0.7960779818591126, + 0.98, + 0.9803919536424698, + 0.9764710676789029, + 0.8627449844634918, + 1, + 0.9999999554687263, + 0.996078068023658, + 0.9411759871935939 + ], + "isCMS" : [ + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ], + "isMoT" : [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + } +] \ No newline at end of file diff --git a/examples/sampletrace/WitU-Density.json b/examples/sampletrace/WitU-Density.json new file mode 100644 index 00000000..403279c5 --- /dev/null +++ b/examples/sampletrace/WitU-Density.json @@ -0,0 +1,8 @@ +{ + "type": "float", + "origin": [-1.000000, -1.000000, -1.000000], + "counts": [100, 100, 100], + "delta": [0.020202, 0.020202, 0.020202], + "rawdata": "WitU-Density.raw", + "number of components": 1 +} diff --git a/examples/sampletrace/WitU-Density.raw b/examples/sampletrace/WitU-Density.raw new file mode 100644 index 00000000..bbaf8605 Binary files /dev/null and b/examples/sampletrace/WitU-Density.raw differ diff --git a/examples/sampletrace/WitU-Temperature.json b/examples/sampletrace/WitU-Temperature.json new file mode 100644 index 00000000..395710d4 --- /dev/null +++ b/examples/sampletrace/WitU-Temperature.json @@ -0,0 +1,8 @@ +{ + "type": "float", + "origin": [-1.000000, -1.000000, -1.000000], + "counts": [100, 100, 100], + "delta": [0.020202, 0.020202, 0.020202], + "rawdata": "WitU-Temperature.raw", + "number of components": 1 +} diff --git a/examples/sampletrace/WitU-Temperature.raw b/examples/sampletrace/WitU-Temperature.raw new file mode 100644 index 00000000..2b8817ff Binary files /dev/null and b/examples/sampletrace/WitU-Temperature.raw differ diff --git a/examples/sampletrace/WitU-vectors.json b/examples/sampletrace/WitU-vectors.json new file mode 100644 index 00000000..64e69b45 --- /dev/null +++ b/examples/sampletrace/WitU-vectors.json @@ -0,0 +1,8 @@ +{ + "type": "float", + "origin": [-1.000000, -1.000000, -1.000000], + "counts": [100, 100, 100], + "delta": [0.020202, 0.020202, 0.020202], + "rawdata": "WitU-vectors.raw", + "number of components": 3 +} diff --git a/examples/sampletrace/WitU-vectors.raw b/examples/sampletrace/WitU-vectors.raw new file mode 100644 index 00000000..64af226e Binary files /dev/null and b/examples/sampletrace/WitU-vectors.raw differ diff --git a/examples/sampletrace/data.state b/examples/sampletrace/data.state new file mode 100644 index 00000000..f17ab0cd --- /dev/null +++ b/examples/sampletrace/data.state @@ -0,0 +1,20 @@ +{ + "Datasets": + [ + { + "name": "Density", + "type": "Volume", + "filename": "WitU-Density.json" + }, + { + "name": "Temperature", + "type": "Volume", + "filename": "WitU-Temperature.json" + }, + { + "name": "vectors", + "type": "Volume", + "filename": "WitU-vectors.json" + } + ] +} diff --git a/examples/sampletrace/render.state b/examples/sampletrace/render.state new file mode 100644 index 00000000..d8a48b6d --- /dev/null +++ b/examples/sampletrace/render.state @@ -0,0 +1,86 @@ + +{ + "Datasets": + [ + ], + "Renderer": { + }, + "Visualizations": + [ + { + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": true, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, + "operators": + [ + { + "dataset": "Density", + "type": "Volume", + "volume rendering" : true, + "data range": [2.0, 5.0], + "transfer function": "Density.json" + }, + { + "dataset": "Temperature", + "type": "Volume", + "volume rendering" : false, + "slices": [ [1.0, 0.0, 0.0, -0.9], [0.0, 0.0, 1.0, 0.9] ], + "data range": [0.0, 5000.0 ], + "transfer function": "Temperature-slices.json" + }, + { + "type": "PathLines", + "dataset": "pathlines", + "data range": [0, 3], + "transfer function": "BlueSpeed4.json", + "radius0": 0.002, + "radius1": 0.005, + "value0": 0.0, + "value1": 2.0 + } + ] + } + ], + "zVisualizations": + [ + { + "Lighting": { + "Sources": [[1, 1, 0, 1]], + "shadows": true, + "Ka": 0.4, + "Kd": 0.6, + "ao count": 0, + "ao radius": 1.0 + }, + "operators": + [ + { + "type": "PathLines", + "dataset": "pathlines", + "data range": [0, 3], + "transfer function": "BlueSpeed4.json", + "radius0": 0.002, + "radius1": 0.005, + "value0": 0.0, + "value1": 2.0 + } + ] + } + ], + "Cameras": + [ + { + "viewpoint": [3, 2, -1], + "viewcenter": [0, 0, 0], + "viewup": [0, 1, 0], + "aov": 40, + "dimensions": [1000, 1000] + } + ] +} + diff --git a/examples/sampletrace/sample.state b/examples/sampletrace/sample.state new file mode 100644 index 00000000..4b8795f1 --- /dev/null +++ b/examples/sampletrace/sample.state @@ -0,0 +1,25 @@ +{ + "Visualizations": + [ + { + "annotation": "", + "operators": + [ + { + "type": "IsoSampler", + "dataset": "Density", + "isovalue": 10 + } + ] + } + ], + "Cameras": [ + { + "aov" : 1.0, + "viewpoint" : [0.0, 0.0, -20.0], + "viewdirection" : [0.0, 0.0, 1.0], + "viewup" : [0.0, 1.0, 0.0], + "dimensions" : [50, 50] + } + ] +} diff --git a/examples/schlieren/SchlierenExamples.md b/examples/schlieren/SchlierenExamples.md new file mode 100644 index 00000000..3dbf2ed4 --- /dev/null +++ b/examples/schlieren/SchlierenExamples.md @@ -0,0 +1,19 @@ +# Schlieren Examples + +This example demonstrates the use of Galaxy's Schlieren rendering capabilities. As described in the source directory, two algorithms have been implements: one in which the each pixel is assigned a value reflecting the deflection of the ray originally spawned for the pixel, and one in which the delflected ray contributes energy to the image plane wherever it arrives. + +In the first case, the *x*, *y* and *z* deflections are represented in the *r*, *g* and *b* FITS files, while the *a* file contains the magnitude of the displacement. + +In the second case, only the *r* FITS file contains meaningful data. + +Note that these are *floating-point* images; to convert them to color images, use (e.g.) **ColorMoves**. + +To run the first algorithm: + +**gxyschlieren [-S1] csafe-1.state** + +To run the second: + +**gxyschlieren -S2 csafe-s.state** + +In each case, three sets of results are created, showing projections along the X, Y and Z axis. \ No newline at end of file diff --git a/examples/schlieren/csafe-1.state b/examples/schlieren/csafe-1.state new file mode 100644 index 00000000..d569ebca --- /dev/null +++ b/examples/schlieren/csafe-1.state @@ -0,0 +1,50 @@ +{ + "Datasets": + [ + { + "name": "iref", + "type": "Volume", + "filename": "csafe-data.json" + } + ], + "Renderer": { + "far": 30 + }, + "Visualizations": + [ + { + "Lighting": + { + }, + "operators": + [ + { + "type": "Volume", + "dataset": "iref" + } + ] + } + ], + "Cameras": + [ + { + "viewpoint": [0, 0, -2], + "viewcenter": [0, 0, 0], + "viewup": [1, 0, 0], + "aov": 0 + }, + { + "viewpoint": [0, -2, 0], + "viewcenter": [0, 0, 0], + "viewup": [1, 0, 0], + "aov": 0 + }, + { + "viewpoint": [-2, 0, 0], + "viewcenter": [0, 0, 0], + "viewup": [0, 1, 0], + "aov": 0 + } + ] +} + diff --git a/examples/schlieren/csafe-2.state b/examples/schlieren/csafe-2.state new file mode 100644 index 00000000..d569ebca --- /dev/null +++ b/examples/schlieren/csafe-2.state @@ -0,0 +1,50 @@ +{ + "Datasets": + [ + { + "name": "iref", + "type": "Volume", + "filename": "csafe-data.json" + } + ], + "Renderer": { + "far": 30 + }, + "Visualizations": + [ + { + "Lighting": + { + }, + "operators": + [ + { + "type": "Volume", + "dataset": "iref" + } + ] + } + ], + "Cameras": + [ + { + "viewpoint": [0, 0, -2], + "viewcenter": [0, 0, 0], + "viewup": [1, 0, 0], + "aov": 0 + }, + { + "viewpoint": [0, -2, 0], + "viewcenter": [0, 0, 0], + "viewup": [1, 0, 0], + "aov": 0 + }, + { + "viewpoint": [-2, 0, 0], + "viewcenter": [0, 0, 0], + "viewup": [0, 1, 0], + "aov": 0 + } + ] +} + diff --git a/examples/schlieren/csafe-data.json b/examples/schlieren/csafe-data.json new file mode 100644 index 00000000..6e925795 --- /dev/null +++ b/examples/schlieren/csafe-data.json @@ -0,0 +1,8 @@ +{ + "type": "float", + "origin": [-1.000000, -1.000000, -1.000000], + "counts": [100, 100, 100], + "delta": [0.020202, 0.020202, 0.020202], + "rawdata": "csafe-data.raw", + "number of components": 1 +} diff --git a/examples/schlieren/csafe-data.raw b/examples/schlieren/csafe-data.raw new file mode 100644 index 00000000..b56372bd Binary files /dev/null and b/examples/schlieren/csafe-data.raw differ diff --git a/scripts/createPartitionDoc.py b/scripts/createPartitionDoc.py index e1ce0826..7ad9c93f 100644 --- a/scripts/createPartitionDoc.py +++ b/scripts/createPartitionDoc.py @@ -80,11 +80,11 @@ def factor(ijk): mm = ijk + 3; i = 1 while i <= (ijk >> 1): - jk = ijk / i; + jk = int(ijk / i); if ijk == (i * jk): j = 1 while j <= (jk >> 1): - k = jk / j; + k = int(jk / j); if jk == (j * k): m = i + j + k; if m < mm: @@ -96,10 +96,10 @@ def factor(ijk): def partition(factors, origin, spacing, counts): boxes = [] - n = [(c-2) / f for c,f in zip(counts, factors)] + n = [int((c-2) / f) for c,f in zip(counts, factors)] counts = [i - 2 for i in counts] IJK = [[1 + i * n[j] for i in range(factors[j])] + [counts[j]] for j in range(3)] - IJK = [zip(IJK[j][:-1], IJK[j][1:]) for j in range(3)] + IJK = [list(zip(IJK[j][:-1], IJK[j][1:])) for j in range(3)] IJK = [[k,j,i] for i in IJK[2] for j in IJK[1] for k in IJK[0]] XYZ = [[[origin[i] + ijk[i][0]*spacing[i], origin[i] + ijk[i][1]*spacing[i]] for i in range(3)] for ijk in IJK] return XYZ diff --git a/scripts/vti2vol b/scripts/vti2vol index 00612956..19b40ff0 100755 --- a/scripts/vti2vol +++ b/scripts/vti2vol @@ -19,9 +19,9 @@ ## ## ## ========================================================================== ## -print ('vti2vol entry') import sys +print ('vti2vol version', sys.version) from vtk import * from vtk.util import numpy_support as ns from os.path import isfile diff --git a/src/apps/CMakeLists.txt b/src/apps/CMakeLists.txt index ebae4b0b..340a33a1 100644 --- a/src/apps/CMakeLists.txt +++ b/src/apps/CMakeLists.txt @@ -47,13 +47,9 @@ find_package(GLUT) if (GXY_WRITE_IMAGES) - add_executable(gxywriter gxywriter.cpp) - target_link_libraries(gxywriter ${VTK_LIBRARIES} ${GALAXY_LIBRARIES}) - set(BINS gxywriter ${BINS}) - - add_executable(raysample raysample.cpp) - target_link_libraries(raysample ${VTK_LIBRARIES} ${GALAXY_LIBRARIES}) - set(BINS raysample ${BINS}) + add_executable(gxywriter gxywriter.cpp) + target_link_libraries(gxywriter ${VTK_LIBRARIES} ${GALAXY_LIBRARIES}) + set(BINS gxywriter ${BINS}) add_executable(sample sample.cpp) target_link_libraries(sample ${VTK_LIBRARIES} ${GALAXY_LIBRARIES}) @@ -74,7 +70,7 @@ else(GXY_WRITE_IMAGES) set(BINS gxyviewer-server ${BINS}) add_executable(gxyviewer-client-no-x gxyviewer-client-no-x.cpp Socket.cpp) - target_link_libraries(gxyviewer-client-no-x pthread ${PNG_LIBRARY_RELEASE}) + target_link_libraries(gxyviewer-client-no-x pthread ${PNG_LIBRARY_RELEASE} ${Z_LIBRARY_RELEASE}) set(BINS gxyviewer-client-no-x ${BINS}) if (X11_FOUND AND OpenGL_FOUND AND GLUT_FOUND) @@ -93,7 +89,7 @@ else(GXY_WRITE_IMAGES) target_link_libraries(gxyviewer-worker ${VTK_LIBRARIES} ${GALAXY_LIBRARIES}) add_executable(gxyviewer-client gxyviewer-client.cpp Socket.cpp) - target_link_libraries(gxyviewer-client ${PNG_LIBRARY_RELEASE} ${GLUT_glut_LIBRARY} ${OPENGL_LIBRARIES} pthread) + target_link_libraries(gxyviewer-client ${PNG_LIBRARY_RELEASE} ${Z_LIBRARY_RELEASE} ${GLUT_glut_LIBRARY} ${OPENGL_LIBRARIES} pthread) set(BINS gxyviewer-worker gxyviewer gxyviewer-client ${BINS}) else(X11_FOUND AND OpenGL_FOUND AND GLUT_FOUND) diff --git a/src/apps/gvt.cpp b/src/apps/gvt.cpp index 1fcb83d2..d338bf96 100644 --- a/src/apps/gvt.cpp +++ b/src/apps/gvt.cpp @@ -182,7 +182,8 @@ main(int argc, char * argv[]) RenderingP r = Rendering::NewP(); r->SetTheOwner(0); - r->SetTheSize(512, 512); + c->set_width(512); + c->set_height(512); r->SetTheCamera(c); r->SetTheDatasets(d); r->SetTheVisualization(vis); diff --git a/src/apps/gxyviewer-server.cpp b/src/apps/gxyviewer-server.cpp index 66e3e4d4..50bc1183 100644 --- a/src/apps/gxyviewer-server.cpp +++ b/src/apps/gxyviewer-server.cpp @@ -125,12 +125,13 @@ render_thread(void *buf) theRendering = ServerRendering::NewP(); - theRendering->SetSocket(skt); + theRendering->SetSocket(skt); theRendering->SetTheOwner(0); - theRendering->SetTheSize(width, height); theRendering->SetTheDatasets(theDatasets); theRendering->SetTheVisualization(theVisualization); - theRendering->SetTheCamera(theCamera); + theCamera->set_width(width); + theCamera->set_height(height); + theRendering->SetTheCamera(theCamera); theRendering->Commit(); RenderingSetP theRenderingSet = RenderingSet::NewP(); diff --git a/src/apps/gxyviewer.cpp b/src/apps/gxyviewer.cpp index f772371b..702b9812 100644 --- a/src/apps/gxyviewer.cpp +++ b/src/apps/gxyviewer.cpp @@ -334,6 +334,8 @@ render_thread(void *d) normalize(viewright); orig_viewup = cross(viewright, orig_viewdirection); theCamera->set_viewup(orig_viewup); + theCamera->set_width(width); + theCamera->set_height(height); theCamera->Commit(); theDatasets = Datasets::NewP(); @@ -347,9 +349,10 @@ render_thread(void *d) theRendering = AsyncRendering::NewP(); theRendering->SetMaxAge(age, fadeout); theRendering->SetTheOwner(0); - theRendering->SetTheSize(width, height); theRendering->SetTheDatasets(theDatasets); theRendering->SetTheVisualization(theVisualization); + theCamera->set_width(width); + theCamera->set_height(height); theRendering->SetTheCamera(theCamera); theRendering->Commit(); diff --git a/src/apps/gxywriter.cpp b/src/apps/gxywriter.cpp index cf996814..1fb16751 100644 --- a/src/apps/gxywriter.cpp +++ b/src/apps/gxywriter.cpp @@ -73,6 +73,7 @@ int main(int argc, char *argv[]) bool clientserver = false; ClientServer cs; int maxConcurrentRenderings = 99999999; + bool override_windowsize = false; for (int i = 1; i < argc; i++) { @@ -80,7 +81,12 @@ int main(int argc, char *argv[]) else if (!strcmp(argv[i], "-C")) cinema = true, cdb = argv[++i]; else if (!strcmp(argv[i], "-c")) clientserver = true; else if (!strncmp(argv[i],"-D", 2)) dbg = true, atch = false, dbgarg = argv[i] + 2; - else if (!strcmp(argv[i], "-s")) width = atoi(argv[++i]), height = atoi(argv[++i]); + else if (!strcmp(argv[i], "-s")) + { + width = atoi(argv[++i]); + height = atoi(argv[++i]); + override_windowsize = true; + } else if (!strcmp(argv[i], "-S")) skip = atoi(argv[++i]); else if (!strcmp(argv[i], "-N")) maxConcurrentRenderings = atoi(argv[++i]); else if (statefile == "") statefile = argv[i]; @@ -195,7 +201,11 @@ int main(int argc, char *argv[]) RenderingP theRendering = Rendering::NewP(); theRendering->SetTheOwner(index++ % mpiSize ); - theRendering->SetTheSize(width, height); + if (override_windowsize) + { + c->set_width(width); + c->set_height(height); + } theRendering->SetTheCamera(c); theRendering->SetTheDatasets(theDatasets); theRendering->SetTheVisualization(v); diff --git a/src/apps/mhviewer.cpp b/src/apps/mhviewer.cpp index 522cf944..c99d5023 100644 --- a/src/apps/mhviewer.cpp +++ b/src/apps/mhviewer.cpp @@ -389,8 +389,10 @@ render_thread(void *d) theCamera->get_viewdirection(orig_viewdirection); theCamera->get_viewup(orig_viewup); theCamera->get_angle_of_view(orig_aov); + theCamera->set_width(width); + theCamera->set_height(height); - center = orig_viewpoint + orig_viewdirection; + center = orig_viewpoint + orig_viewdirection; orig_viewdistance = len(orig_viewdirection); normalize(orig_viewdirection); @@ -416,7 +418,6 @@ render_thread(void *d) theRendering = AsyncRendering::NewP(); theRendering->SetMaxAge(age, fadeout); theRendering->SetTheOwner(0); - theRendering->SetTheSize(width, height); theRendering->SetTheDatasets(theDatasets); theRendering->SetTheCamera(theCamera); diff --git a/src/apps/mhwriter.cpp b/src/apps/mhwriter.cpp index 1432fd79..3336d925 100644 --- a/src/apps/mhwriter.cpp +++ b/src/apps/mhwriter.cpp @@ -337,6 +337,7 @@ main(int argc, char * argv[]) string data = ""; char *dbgarg; bool dbg = false; + bool override_windowsize = false; #if 0 dbg = true; @@ -381,7 +382,10 @@ main(int argc, char * argv[]) case 't': target = atof(argv[++i]); break; case 'p': power = atof(argv[++i]); break; case 'k': sigma = atof(argv[++i]); break; - case 's': width = atoi(argv[++i]); height = atoi(argv[++i]); break; + case 's': width = atoi(argv[++i]); + height = atoi(argv[++i]); + override_windowsize = true; + break; default: syntax(argv[0]); } @@ -502,7 +506,11 @@ main(int argc, char * argv[]) { RenderingP theRendering = Rendering::NewP(); theRendering->SetTheOwner((indx++) % mpiSize); - theRendering->SetTheSize(width, height); + if (override_windowsize) + { + c->set_width(width); + c->set_height(height); + } theRendering->SetTheCamera(c); theRendering->SetTheDatasets(theDatasets); theRendering->SetTheVisualization(v); diff --git a/src/apps/particleproc.cpp b/src/apps/particleproc.cpp index a91e6e3e..e34cc9bf 100644 --- a/src/apps/particleproc.cpp +++ b/src/apps/particleproc.cpp @@ -115,6 +115,7 @@ main(int argc, char * argv[]) string data = ""; char *dbgarg; bool dbg = false; + bool override_windowsize = false; ospInit(&argc, (const char **)argv); @@ -129,7 +130,10 @@ main(int argc, char * argv[]) case 'D': dbg = true, dbgarg = argv[i] + 2; break; case 'n': samples_per_partition = atoi(argv[++i]); break; case 'r': radius = atof(argv[++i]); break; - case 's': width = atoi(argv[++i]); height = atoi(argv[++i]); break; + case 's': width = atoi(argv[++i]); + height = atoi(argv[++i]); + override_windowsize = true; + break; default: syntax(argv[0]); } @@ -219,7 +223,11 @@ main(int argc, char * argv[]) { RenderingP theRendering = Rendering::NewP(); theRendering->SetTheOwner((indx++) % mpiSize); - theRendering->SetTheSize(width, height); + if (override_windowsize) + { + c->set_width(width); + c->set_height(height); + } theRendering->SetTheCamera(c); theRendering->SetTheDatasets(theDatasets); theRendering->SetTheVisualization(v); diff --git a/src/apps/raysample.cpp b/src/apps/raysample.cpp deleted file mode 100644 index 4a8a2193..00000000 --- a/src/apps/raysample.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// ========================================================================== // -// Copyright (c) 2014-2019 The University of Texas at Austin. // -// All rights reserved. // -// // -// Licensed under the Apache License, Version 2.0 (the "License"); // -// you may not use this file except in compliance with the License. // -// A copy of the License is included with this software in the file LICENSE. // -// If your copy does not contain the License, you may obtain a copy of the // -// License at: // -// // -// https://www.apache.org/licenses/LICENSE-2.0 // -// // -// Unless required by applicable law or agreed to in writing, software // -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // -// See the License for the specific language governing permissions and // -// limitations under the License. // -// // -// ========================================================================== // - -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -int mpiRank, mpiSize; - -#include "Debug.h" - -using namespace gxy; -using namespace std; -using namespace rapidjson; - -#define WIDTH 1920 -#define HEIGHT 1080 - -// default values -int width = WIDTH; -int height = HEIGHT; -float radius = 0.001; -int samples_per_partition = 100; - -void -syntax(char *a) -{ - cerr << "syntax: " << a << " [options] data" << endl; - cerr << "optons:" << endl; - cerr << " -D run debugger" << endl; - cerr << " -n nsamples number of samples in each partition (" << samples_per_partition << ")" << endl; - cerr << " -s x y window size (" << WIDTH << "x" << HEIGHT << ")" << endl; - cerr << " -r radius radius of samples (" << radius << ")" << endl; - cerr << " -d factor downsampling factor for sampler pass (0)" << endl; - exit(1); -} - -int -main(int argc, char * argv[]) -{ - string data = ""; - char *dbgarg; - bool dbg = false; - int downsample = 0; - - // process command line args - for (int i = 1; i < argc; i++) - { - if (argv[i][0] == '-') - switch (argv[i][1]) - { - case 'D': dbg = true, dbgarg = argv[i] + 2; break; - case 'n': samples_per_partition = atoi(argv[++i]); break; - case 'r': radius = atof(argv[++i]); break; - case 's': width = atoi(argv[++i]); height = atoi(argv[++i]); break; - case 'd': downsample = atoi(argv[++i]); break; - default: - syntax(argv[0]); - exit(0); - } - else if (data == "") data = argv[i]; - else { - syntax(argv[0]); - exit(0); - } - } - - ospInit(&argc, (const char **)argv); - - Application theApplication(&argc, &argv); - theApplication.Start(); - - - theApplication.Run(); - mpiRank = theApplication.GetRank(); - mpiSize = theApplication.GetSize(); - - Sampler::Initialize(); - Renderer::Initialize(); - - SamplerP theSampler = Sampler::NewP(); - RendererP theRenderer = Renderer::NewP(); - - Document *doc = theApplication.OpenJSONFile( data ); - theRenderer->LoadStateFromDocument(*doc); - - srand(mpiRank); - - Debug *d = dbg ? new Debug(argv[0], false, dbgarg) : NULL; - - if (mpiRank == 0) - { - // BEGIN SAMPLING - // sampling state is loaded from an external file - DatasetsP theDatasets = Datasets::NewP(); - theDatasets->LoadFromJSON(*doc); - theDatasets->Commit(); - - // Create a Visualization that specifies how the volume is to be sampled... - VisualizationP vis0 = Visualization::NewP(); - vector theVisualizations = Visualization::LoadVisualizationsFromJSON(*doc); - vis0 = theVisualizations[0]; - vis0->Commit(theDatasets); - - // Create a rendering set for the sampling pass... - RenderingSetP theRenderingSet0 = RenderingSet::NewP(); - - // read in a set of cameras which are used to sample the data - vector theCameras; - Camera::LoadCamerasFromJSON(*doc, theCameras); - RenderingP theRendering0; - for (vector::iterator iCam = theCameras.begin(); iCam != theCameras.end(); iCam++) - { - theRendering0 = Rendering::NewP(); - theRendering0->SetTheOwner(0); - theRendering0->SetTheSize(width >> downsample, height >> downsample); - theRendering0->SetTheDatasets(theDatasets); - theRendering0->SetTheCamera(*iCam); - theRendering0->SetTheVisualization(vis0); - theRendering0->Commit(); - - theRenderingSet0->AddRendering(theRendering0); - theRenderingSet0->Commit(); - } - - // Creates a Particles dataset to sample into and attach it to the - // 'Sampler' renderer. - - vector datasets = theDatasets->GetDatasetNames(); - VolumeP volume = Volume::Cast(theDatasets->Find(datasets[0])); - - ParticlesP samples = Particles::NewP(); - samples->CopyPartitioning(volume); - samples->SetDefaultColor(0.5, 0.5, 0.5, 1.0); - theSampler->SetSamples(samples); - - // Commit the Sampler, initiate sampling, and wait for it to be done - theSampler->Commit(); - theSampler->Start(theRenderingSet0); - theRenderingSet0->WaitForDone(); - - // Now the 'samples' particle set contains the samples. Save it to the datasets - samples->Commit(); - theDatasets->Insert("samples", samples); - theDatasets->Commit(); - - // END SAMPLING - - // Now we set up a Visualization to visualize the samples. - // This time we'll be lighting... - - VisualizationP vis1 = Visualization::NewP(); - - float light[] = {1.0, 2.0, 3.0}; int t = 1; - Lighting *l = vis1->get_the_lights(); - l->SetLights(1, light, &t); - l->SetK(0.8, 0.2); - l->SetShadowFlag(false); - l->SetAO(0, 0.0); - - // A ParticlesVis to render the samples - - ParticlesVisP pvis = ParticlesVis::NewP(); - pvis->SetName("samples"); - pvis->Commit(theDatasets); - pvis->SetRadius(radius); - vec4f cmap1[2] = { {0.0, 1.0, 1.0, 0.0}, {1.0, 0.0, 1.0, 1.0} }; - pvis->SetColorMap(2, cmap1); - pvis->SetRadiusTransform(0.0, 0.02, 1.0, 0.02); - vis1->AddVis(pvis); - - vis1->Commit(theDatasets); - - // Now we set up a RenderingSet for the visualization - CameraP cam1 = Camera::NewP(); - cam1->set_viewup(0.0, 1.0, 0.0); - cam1->set_angle_of_view(35.0); - cam1->set_viewpoint(-1.0, -2.0, -3.0); - cam1->set_viewdirection(1.0, 2.0, 3.0); - cam1->Commit(); - - RenderingSetP theRenderingSet1 = RenderingSet::NewP(); - - RenderingP theRendering2 = Rendering::NewP(); - theRendering2->SetTheOwner(0); - theRendering2->SetTheSize(width, height); - theRendering2->SetTheDatasets(theDatasets); - theRendering2->SetTheCamera(cam1); - theRendering2->SetTheVisualization(vis1); - theRendering2->Commit(); - - theRenderingSet1->AddRendering(theRendering2); - theRenderingSet1->Commit(); - - // Render, wait, and write results - - theRenderer->Start(theRenderingSet1); - theRenderingSet1->WaitForDone(); - theRenderingSet1->SaveImages(string("raysample")); - - theApplication.QuitApplication(); - } - - theApplication.Wait(); -} diff --git a/src/apps/raysample/design.md b/src/apps/raysample/design.md deleted file mode 100644 index 095f3d80..00000000 --- a/src/apps/raysample/design.md +++ /dev/null @@ -1,24 +0,0 @@ -# Notes on adapting galaxy to ray-based sampling - -The overall task is to adapt galaxy so that we can prototype different sampling approaches at scale. - -Our current prototype samples at an isosurface boundary. This is an operation defined by Galaxy's current design, which uses the classes `Datasets`, `Visualization`, `VolumeVis`, `RenderingSet`, `Camera`, `Rendering` in conjunction with the `Sampler` class to generate sampled data. - -In general, there are two approaches we can pursue. It's likely that we should pursue a combination of both, in the interests of ease of prototyping, execution efficiency and performance integrity of the existing Galaxy code. - -- **Adaptation of the current framework**. This means that we adapt our current classes and operations to support ray-based sampling -- **Support for a sample-based workflow**. This means that we develop a workflow based on sampling operations, in which samples are both the input and the output. For example, a sampling operation is performed, and the output of that operation is used to seed ray generation for a next step. This is the approach spelled out in the paper, and it also fits well with the design of galaxy `Datasets` - -This document is the start of the design discussion to determine our path forward. - -## Overview - -Per the project proposal, we'd like to be able to use a ray-based approach to intelligent sampling. This means we need to be able to control the following: - -- **Initial ray creation**. Determining how the initial set of rays is created. - - Looking at the code, it appears that if we make the `Camera::spawn_rays_task` a member variable instead of a nested class, we will be able to create different methods of spawning rays. In particular, we would like the following: - - orthographic projection - - Control over the gemoetry boundary of the projection (circular, arbitrary, etc.) -- **Ray event processing**. Determining when a ray hits something of interest, and what is done in response. -- **Ray propogation**. Determining when a ray's path is altered (to follow a gradient, for example), stopped, or new rays are spawned at a specific point. - diff --git a/src/apps/raysample/gradient.state b/src/apps/raysample/gradient.state deleted file mode 100755 index e9d1c365..00000000 --- a/src/apps/raysample/gradient.state +++ /dev/null @@ -1,38 +0,0 @@ -{ - "Datasets": - [ - { - "name": "scalar", - "type": "Volume", - "filename": "vectors-oneBall.vol" - }, - { - "name": "vectors", - "type": "Volume", - "filename": "vectors-vectors.json" - } - ], - "Visualizations": - [ - { - "annotation": "", - "operators": - [ - { - "type": "GradientSampler", - "dataset": "scalar", - "tolerance": 0.99, - "volume rendering": false - } - ] - } - ], - "Cameras": [ - { - "aov" : 30.0, - "viewpoint" : [0.0, 0.0, -20.0], - "viewdirection" : [0.0, 0.0, 1.0], - "viewup" : [0.0, 1.0, 0.0] - } - ] -} diff --git a/src/apps/raysample/isovalue.state b/src/apps/raysample/isovalue.state deleted file mode 100755 index c9868a68..00000000 --- a/src/apps/raysample/isovalue.state +++ /dev/null @@ -1,38 +0,0 @@ -{ - "Datasets": - [ - { - "name": "scalar", - "type": "Volume", - "filename": "vectors-oneBall.vol" - }, - { - "name": "vectors", - "type": "Volume", - "filename": "vectors-vectors.json" - } - ], - "Visualizations": - [ - { - "annotation": "", - "operators": - [ - { - "type": "IsoSampler", - "dataset": "scalar", - "isovalue": 0.9, - "volume rendering": false - } - ] - } - ], - "Cameras": [ - { - "aov" : 30.0, - "viewpoint" : [0.0, 0.0, -20.0], - "viewdirection" : [0.0, 0.0, 1.0], - "viewup" : [0.0, 1.0, 0.0] - } - ] -} diff --git a/src/apps/raysample/readme.md b/src/apps/raysample/readme.md deleted file mode 100644 index a3225493..00000000 --- a/src/apps/raysample/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# Samray application examples and support files - -- `sample.json` is a json file defining the sampling operation diff --git a/src/apps/sample.cpp b/src/apps/sample.cpp index 696af5d6..c5af82e0 100644 --- a/src/apps/sample.cpp +++ b/src/apps/sample.cpp @@ -193,6 +193,7 @@ main(int argc, char * argv[]) string data = ""; char *dbgarg; bool dbg = false; + bool override_windowsize = false; ospInit(&argc, (const char **)argv); @@ -207,7 +208,10 @@ main(int argc, char * argv[]) case 'D': dbg = true, dbgarg = argv[i] + 2; break; case 'n': samples_per_partition = atoi(argv[++i]); break; case 'r': radius = atof(argv[++i]); break; - case 's': width = atoi(argv[++i]); height = atoi(argv[++i]); break; + case 's': width = atoi(argv[++i]); + height = atoi(argv[++i]); + override_windowsize = true; + break; default: syntax(argv[0]); } @@ -305,7 +309,11 @@ main(int argc, char * argv[]) { RenderingP theRendering = Rendering::NewP(); theRendering->SetTheOwner((indx++) % mpiSize); - theRendering->SetTheSize(width, height); + if (override_windowsize) + { + c->set_width(width); + c->set_height(height); + } theRendering->SetTheCamera(c); theRendering->SetTheDatasets(theDatasets); theRendering->SetTheVisualization(v); diff --git a/src/multiserver/CMakeLists.txt b/src/multiserver/CMakeLists.txt index e0f75f7d..fef3c0ce 100644 --- a/src/multiserver/CMakeLists.txt +++ b/src/multiserver/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(msserver gxy_multiserver gxy_data gxy_framework) set(BINS msserver ${BINS}) add_executable(msviewer msviewer.cpp ClientWindow.cpp JsonInterface.cpp CommandLine.cpp) -target_link_libraries(msviewer gxy_multiserver ${PNG_LIBRARY_RELEASE} ${GLUT_glut_LIBRARY} ${OPENGL_LIBRARIES} ${OSPRAY_LIBRARIES} pthread) +target_link_libraries(msviewer gxy_multiserver ${PNG_LIBRARY_RELEASE} ${Z_LIBRARY_RELEASE} ${GLUT_glut_LIBRARY} ${OPENGL_LIBRARIES} ${OSPRAY_LIBRARIES} pthread) set(BINS msviewer ${BINS}) add_executable(msclient msclient.cpp SocketHandler.cpp CommandLine.cpp) diff --git a/src/multiserver/ViewerClientServer.cpp b/src/multiserver/ViewerClientServer.cpp index 62eee135..09ead8ed 100644 --- a/src/multiserver/ViewerClientServer.cpp +++ b/src/multiserver/ViewerClientServer.cpp @@ -167,6 +167,12 @@ ViewerClientServer::handle(string line) if (ss.fail()) return string("error window command needs width and height as integers"); + // DHR: not clear what to do here ... + GetTheCamera()->set_width(w); + GetTheCamera()->set_height(h); + GetTheCamera()->Commit(); + + // assuming the Rendering already has the camera ... GetTheRendering()->SetTheSize(w, h); GetTheRendering()->SetHandler(this); GetTheRendering()->Commit(); diff --git a/src/renderer/CMakeLists.txt b/src/renderer/CMakeLists.txt index 4fa91413..92300235 100644 --- a/src/renderer/CMakeLists.txt +++ b/src/renderer/CMakeLists.txt @@ -34,6 +34,7 @@ if (COMMAND cmake_policy) endif(COMMAND cmake_policy) find_library(PNG_LIBRARY_RELEASE png) +find_library(Z_LIBRARY_RELEASE z) include_directories(${GALAXY_INCLUDES} ${OSPRAY_INCLUDE_DIRS} ${EMBREE_INCLUDE_DIRS}) include_directories_ispc(${GALAXY_INCLUDES} ${OSPRAY_INCLUDE_DIRS} ${EMBREE_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/src) @@ -88,7 +89,7 @@ set (CPP_SOURCES if (ospray_DIR) ospray_create_library(gxy_renderer ${CPP_SOURCES} ${ISPC_SOURCES} - LINK ${OSPRAY_LIBRARIES} ${VTK_LIBRARIES} gxy_data gxy_framework gxy_ospray ${PNG_LIBRARY_RELEASE} COMPONENT lib) + LINK ${OSPRAY_LIBRARIES} ${VTK_LIBRARIES} gxy_data gxy_framework gxy_ospray ${PNG_LIBRARY_RELEASE} ${Z_LIBRARY_RELEASE} COMPONENT lib) set_target_properties(gxy_renderer PROPERTIES VERSION ${GALAXY_VERSION} SOVERSION ${GALAXY_SOVERSION}) # install(TARGETS gxy_renderer DESTINATION lib) endif() diff --git a/src/renderer/Camera.cpp b/src/renderer/Camera.cpp index 499ffd4b..e6777bf2 100644 --- a/src/renderer/Camera.cpp +++ b/src/renderer/Camera.cpp @@ -238,7 +238,9 @@ Camera::LoadFromJSON(Value& v) else { if (v.HasMember("annotation")) + { SetAnnotation(string(v["annotation"].GetString())); + } eye[0] = v["viewpoint"][0].GetDouble(); eye[1] = v["viewpoint"][1].GetDouble(); @@ -263,6 +265,12 @@ Camera::LoadFromJSON(Value& v) return false; } + if (v.HasMember("dimensions")) + { + set_width(v["dimensions"][0].GetInt()); + set_height(v["dimensions"][0].GetInt()); + } + up[0] = v["viewup"][0].GetDouble(); up[1] = v["viewup"][1].GetDouble(); up[2] = v["viewup"][2].GetDouble(); @@ -832,7 +840,7 @@ Camera::print() int Camera::serialSize() { - return KeyedObject::serialSize() + (sizeof(int) + annotation.length() + 1) + sizeof(eye) + sizeof(dir) + sizeof(up) + sizeof(float); + return KeyedObject::serialSize() + (sizeof(int) + annotation.length() + 1) + sizeof(eye) + sizeof(dir) + sizeof(up) + sizeof(float) + sizeof(int) + sizeof(int); } unsigned char * @@ -858,6 +866,12 @@ Camera::serialize(unsigned char *p) *(float *)p = aov; p += sizeof(float); + *(int *)p = camwidth; + p += sizeof(int); + + *(int *)p = camheight; + p += sizeof(int); + return p; } @@ -881,6 +895,12 @@ Camera::deserialize(unsigned char *p) set_angle_of_view(*(float *)p); p += sizeof(float); + set_width(*(int *)p); + p += sizeof(int); + + set_height(*(int *)p); + p += sizeof(int); + return p; } diff --git a/src/renderer/Camera.h b/src/renderer/Camera.h index fa4b1a46..279281e1 100644 --- a/src/renderer/Camera.h +++ b/src/renderer/Camera.h @@ -127,7 +127,7 @@ class Camera : public KeyedObject //! set the view direction for the camera void set_viewdirection(vec3f xyz) { dir[0] = xyz.x; dir[1] = xyz.y; dir[2] = xyz.z; } - //! get the view direction for the camera + //! get the view direction for the camera void get_viewdirection(float &x, float &y, float &z) { x = dir[0]; y = dir[1]; z = dir[2]; } //! get the view direction for the camera void get_viewdirection(float *xyz) { xyz[0] = dir[0]; xyz[1] = dir[1]; xyz[2] = dir[2]; } @@ -141,7 +141,7 @@ class Camera : public KeyedObject //! set the up orientation for the camera void set_viewup(vec3f xyz) { up[0] = xyz.x; up[1] = xyz.y; up[2] = xyz.z; } - //! get the up orientation for the camera + //! get the up orientation for the camera void get_viewup(float &x, float &y, float &z) { x = up[0]; y = up[1]; z = up[2]; } //! get the up orientation for the camera void get_viewup(float *xyz) { xyz[0] = up[0]; xyz[1] = up[1]; xyz[2] = up[2]; } @@ -155,6 +155,15 @@ class Camera : public KeyedObject //! get the view angle for the camera float get_angle_of_view() { return aov; } + //! set width + void set_width(int w) {camwidth = w;} + //! set height + void set_height(int h) {camheight = h;} + //! get width + int get_width() { return camwidth;} + //! get height of camera + int get_height() { return camheight;} + //! print the details of this camera void print(); @@ -187,10 +196,12 @@ class Camera : public KeyedObject std::string annotation; - float eye[3]; - float dir[3]; - float up[3]; - float aov; + float eye[3]; + float dir[3]; + float up[3]; + float aov; + int camwidth=512; + int camheight=512; std::vector permutation; bool permute; diff --git a/src/renderer/MappedVis.cpp b/src/renderer/MappedVis.cpp index 7e4f3f8b..705f93ef 100644 --- a/src/renderer/MappedVis.cpp +++ b/src/renderer/MappedVis.cpp @@ -88,6 +88,17 @@ MappedVis::LoadFromJSON(Value& v) { Vis::LoadFromJSON(v); + if (v.HasMember("data range")) + { + data_range_min = v["data range"][0].GetDouble(); + data_range_max = v["data range"][1].GetDouble(); + data_range = true; + } + else + { + data_range = false; + } + if (v.HasMember("transfer function")) { string fname = v["transfer function"].GetString(); @@ -117,14 +128,24 @@ MappedVis::LoadFromJSON(Value& v) opacitymap.clear(); - Value& oa = doc["Points"]; - for (int i = 0; i < oa.Size(); i += 4) - { - vec2f xo; - xo.x = oa[i+0].GetDouble(); - xo.y = oa[i+1].GetDouble(); + if (doc.HasMember("Points")) + { + Value& oa = doc["Points"]; + for (int i = 0; i < oa.Size(); i += 4) + { + vec2f xo; + xo.x = oa[i+0].GetDouble(); + xo.y = oa[i+1].GetDouble(); + opacitymap.push_back(xo); + } + } + else + { + vec2f xo = {0.0, 1.0}; opacitymap.push_back(xo); - } + xo = {1.0, 1.0}; + opacitymap.push_back(xo); + } colormap.clear(); @@ -189,13 +210,14 @@ MappedVis::serialSize() { return super::serialSize() + sizeof(Key) + sizeof(int) + colormap.size()*sizeof(vec4f) + - sizeof(int) + opacitymap.size()*sizeof(vec2f); + sizeof(int) + opacitymap.size()*sizeof(vec2f) + + sizeof(float) + sizeof(float) + sizeof(bool); } unsigned char * MappedVis::deserialize(unsigned char *ptr) { - ptr = super::deserialize(ptr); + ptr = super::deserialize(ptr); int nc = *(int *)ptr; ptr += sizeof(int); @@ -207,25 +229,43 @@ MappedVis::deserialize(unsigned char *ptr) SetOpacityMap(no, (vec2f *)ptr); ptr += no * sizeof(vec2f); - return ptr; + data_range_min = *(float *)ptr; + ptr += sizeof(float); + + data_range_max = *(float *)ptr; + ptr += sizeof(float); + + data_range = *(bool *)ptr; + ptr += sizeof(bool); + + return ptr; } unsigned char * MappedVis::serialize(unsigned char *ptr) { - ptr = super::serialize(ptr); + ptr = super::serialize(ptr); + + *(int *)ptr = colormap.size(); + ptr += sizeof(int); + memcpy(ptr, colormap.data(), colormap.size()*sizeof(vec4f)); + ptr += colormap.size()*sizeof(vec4f); - *(int *)ptr = colormap.size(); - ptr += sizeof(int); - memcpy(ptr, colormap.data(), colormap.size()*sizeof(vec4f)); - ptr += colormap.size()*sizeof(vec4f); + *(int *)ptr = opacitymap.size(); + ptr += sizeof(int); + memcpy(ptr, opacitymap.data(), opacitymap.size()*sizeof(vec2f)); + ptr += opacitymap.size()*sizeof(vec2f); + + *(float *)ptr = data_range_min; + ptr += sizeof(float); + + *(float *)ptr = data_range_max; + ptr += sizeof(float); - *(int *)ptr = opacitymap.size(); - ptr += sizeof(int); - memcpy(ptr, opacitymap.data(), opacitymap.size()*sizeof(vec2f)); - ptr += opacitymap.size()*sizeof(vec2f); + *(bool *)ptr = data_range; + ptr += sizeof(bool); - return ptr; + return ptr; } bool @@ -283,9 +323,10 @@ MappedVis::local_commit(MPI_Comm c) OSPData oAlphas = ospNewData(256, OSP_FLOAT, opacity); ospSetData(transferFunction, "opacities", oAlphas); ospRelease(oAlphas); - - ospSet2f(transferFunction, "valueRange", colormap[0].x, colormap[n_colors-1].x); - + if (data_range) + ospSet2f(transferFunction, "valueRange", data_range_min, data_range_max); + else + ospSet2f(transferFunction, "valueRange", colormap[0].x, colormap[n_colors-1].x); ospCommit(transferFunction); ispc::MappedVis_set_transferFunction(ispc, ospray_util::GetIE(transferFunction)); diff --git a/src/renderer/MappedVis.h b/src/renderer/MappedVis.h index 6105da30..3e2aa204 100644 --- a/src/renderer/MappedVis.h +++ b/src/renderer/MappedVis.h @@ -81,6 +81,9 @@ class MappedVis : public Vis protected: virtual void allocate_ispc(); virtual void initialize_ispc(); + + float data_range_min, data_range_max; + bool data_range; std::vector colormap; std::vector opacitymap; diff --git a/src/renderer/Rendering.cpp b/src/renderer/Rendering.cpp index c6e5341c..96481ba9 100644 --- a/src/renderer/Rendering.cpp +++ b/src/renderer/Rendering.cpp @@ -224,6 +224,7 @@ Rendering::local_commit(MPI_Comm c) delete[] framebuffer; framebuffer = new float[width*height*4]; + memset(framebuffer, 0, width*height*4*sizeof(float)); #ifndef GXY_WRITE_IMAGES if (kbuffer) @@ -256,7 +257,11 @@ Rendering::local_reset() } CameraP Rendering::GetTheCamera() { return camera; } -void Rendering::SetTheCamera(CameraP c) { camera = c; } +void Rendering::SetTheCamera(CameraP c) +{ + camera = c; + SetTheSize(c->get_width(), c->get_height()); +} DatasetsP Rendering::GetTheDatasets() { return datasets; } void Rendering::SetTheDatasets(DatasetsP ds) { datasets = ds; } diff --git a/src/renderer/Visualization.cpp b/src/renderer/Visualization.cpp index d798acba..18092473 100644 --- a/src/renderer/Visualization.cpp +++ b/src/renderer/Visualization.cpp @@ -235,8 +235,6 @@ Visualization::SetOsprayObjects(std::map& ospray_object_map) ospAddGeometry(ospModel, (OSPGeometry)op->GetOSP()); else vispc[nvispc++] = v->GetIspc(); - //if (VolumeVis::IsA(v)) - //vispc[nvispc++] = v->GetIspc(); } if (ospModel) diff --git a/src/schlieren/CMakeLists.txt b/src/schlieren/CMakeLists.txt index 3d4a506f..4c6359b3 100644 --- a/src/schlieren/CMakeLists.txt +++ b/src/schlieren/CMakeLists.txt @@ -48,11 +48,15 @@ include_directories(${GALAXY_INCLUDES} ${OSPRAY_INCLUDE_DIRS} ${EMBREE_INCLUDE_D set (ISPC_SOURCES SchlierenTraceRays.ispc + Schlieren2TraceRays.ispc ) set (CPP_SOURCES Schlieren.cpp SchlierenTraceRays.cpp + Schlieren2.cpp + Schlieren2TraceRays.cpp + Schlieren2Rendering.cpp ) if (ospray_DIR) @@ -61,7 +65,7 @@ if (ospray_DIR) install(TARGETS gxy_schlieren DESTINATION lib) endif() -install(FILES Schlieren.h DESTINATION include) +install(FILES Schlieren.h Schlieren2.h Schlieren2Rendering.h DESTINATION include) if (GXY_WRITE_IMAGES) diff --git a/src/schlieren/Schlieren.md b/src/schlieren/Schlieren.md new file mode 100644 index 00000000..e97f8568 --- /dev/null +++ b/src/schlieren/Schlieren.md @@ -0,0 +1,28 @@ +# Schlieren + +The files in this directory contain two implementations of Schlieren rendering. Each is implemented as subclasses of *Renderer* which replace the Trace method to do bendy schlieren integration rather than the straight-ray tracing done by the standard Renderer. + +The examples can be run in the + +## Schlieren + +Trace initially orthographic rays through a diffractive volume according to Snell's law. Results at each pixel reflect the vector in the projection plane between the pixel center and where the ray *originally destined* for that point ended up. The r result is deflection in X, the g is the deflection in Y, the b is the deflection in Z (the projection plane is arbitrary). The a result is the magnitude of the deflection vector. + +Example: + +**gxyschlieren csafe-1.state** + +Generates four FITS files. Note that these are 'floating point' images; use eg. *Colormoves* to create a normal colored image. + +## Schlieren2 + +Trace initially orthographic rays through a diffractive volume according to Snell's law. Rays striking the projection plane are accumulated at the hit point. Only the first FITS file contains meaningful data + +This algorithm also implements its own subclass of *Rendering* which accumulates hits on the image plane. + +Example: + +**gxyschlieren -S2 csafe-2.state** + +Again, this result is a 'floating point' image; use eg. *Colormoves* to create a normal colored image. + diff --git a/src/schlieren/Schlieren2.cpp b/src/schlieren/Schlieren2.cpp new file mode 100644 index 00000000..e43094e9 --- /dev/null +++ b/src/schlieren/Schlieren2.cpp @@ -0,0 +1,439 @@ +/// ========================================================================= // +// Copyright (c) 2014-2018 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#define _GNU_SOURCE // XXX TODO: what needs this? remove if possible + +#include +#include "Schlieren2.h" +#include "RayQManager.h" +#include "Particles.h" +#include "Rays.h" +#include "Schlieren2TraceRays.h" + +#include "rapidjson/document.h" +#include "rapidjson/stringbuffer.h" + +using namespace rapidjson; + +#include + +using namespace std; + +namespace gxy +{ +WORK_CLASS_TYPE(Schlieren2::NormalizeSchlieren2ImagesMsg); + +KEYED_OBJECT_CLASS_TYPE(Schlieren2) + +void +Schlieren2::Initialize() +{ + RegisterClass(); + NormalizeSchlieren2ImagesMsg::Register(); + super::Initialize(); +} + +void +Schlieren2::initialize() +{ + super::initialize(); + SetFar(10); + SetRaysPerPixel(-1); +} + +void +Schlieren2::HandleTerminatedRays(RayList *raylist) +{ + RenderingSetP renderingSet = raylist->GetTheRenderingSet(); + RenderingP rendering = raylist->GetTheRendering(); + CameraP camera = rendering->GetTheCamera(); + + vec3f vp, vd, vu; float aov; + + camera->get_viewpoint(vp); + camera->get_viewdirection(vd); + camera->get_viewup(vu); + camera->get_angle_of_view(aov); + + bool is_ortho = aov == 0.0; + + // Center of image plane + + vec3f center; + if (is_ortho) + { + normalize(vd); + center = vp + vd * GetFar(); + } + else + { + float d = 1.0 / tan(2*3.1415926*(aov/2.0)/360.0); + center = vp + (vd * d); + normalize(vd); + } + + vec3f vr = cross(vd, vu); + normalize(vr); + + vu = cross(vr, vd); + normalize(vu); + + // Get planar equation of projection plane: {vd.x, vd.y, vd.z, d} where d is: + + vec4f projection_plane(vd.x, vd.y, vd.z, -dot(vd, center)); + + // Need to be able to transform screen x,y to WCS point + + int width, height; + rendering->GetTheSize(width, height); + + float pixel_scaling = (((width < height) ? width : height) - 1.0) / 2.0; + float off_x = ((width - 1) / 2.0); + float off_y = ((height - 1) / 2.0); + + // for each ray... + + int mx, my; + float dmax = 0; + + int kkk = 0; + for (int i = 0; i < raylist->GetRayCount(); i++) + { + // If its terminated, project forward to projection plane + // and determine color by difference + // between projected destination and original destination + + if (raylist->get_classification(i) == Renderer::TERMINATED) + { + // Final point and direction of bent ray + + vec3f p_term(raylist->get_ox(i), raylist->get_oy(i), raylist->get_oz(i)); + vec3f d_term(raylist->get_dx(i), raylist->get_dy(i), raylist->get_dz(i)); + + normalize(d_term); + + // We want the intersection of the ray starting at the exit point in + // the exit direction with the projection plane. The projection distance + // is the hyp - the perpendicular distance divided by the cosine of the + // angle between the perpendicular direction and the exit vector. + + float d_perp = -(dot(projection_plane, p_term) + projection_plane.w); + float cos_theta = dot(projection_plane, d_term); + float d_exit_vector = d_perp / cos_theta; + + vec3f p_proj = p_term + d_term * d_exit_vector; + + vec3f p_vec = p_proj - center; + + float X = (dot(p_vec, vr) * pixel_scaling) + off_x; + float Y = (dot(p_vec, vu) * pixel_scaling) + off_y; + + if (X < 0 || X >= width || Y < 0 || Y >= height) + { + raylist->set_classification(i, Renderer::DROP_ON_FLOOR); + continue; + } + + // Now p_proj is the point the bent ray extends to in the projection plane. + // Where would the original ray have hit? + + float pixel_ix = raylist->get_x(i); + float pixel_iy = raylist->get_y(i); + + float pixel_fx = (pixel_ix - off_x) / pixel_scaling; + float pixel_fy = (pixel_iy - off_y) / pixel_scaling; + + vec3f pixel_wcs = center + (vr * pixel_fx) + (vu * pixel_fy); + + // distance of pixel_wcs from plane perpendicular to the plane... + + d_perp = -(dot(projection_plane, pixel_wcs) + projection_plane.w); + + vec3f p_proj_orig; + if (is_ortho) + { + // Then project perpendicular to projection plane + p_proj_orig = pixel_wcs + (vd * d_perp); + } + else + { + // original ray direction from eye through pixel + + vec3f d_orig = pixel_wcs - vp; + normalize(d_orig); + + // Distance along original direction depends on angle between original dir and + // normal of projection plane + + cos_theta = dot(projection_plane, d_orig); + float d_orig_vector = d_perp / cos_theta; + + p_proj_orig = pixel_wcs + d_orig * d_orig_vector; + } + + vec3f delta = p_proj - p_proj_orig; + if (GetCutoffType() == 0 && delta.x < GetCutoffValue()) + { + raylist->set_classification(i, Renderer::DROP_ON_FLOOR); + continue; + } + else if (GetCutoffType() == 1 && delta.y < GetCutoffValue()) + { + raylist->set_classification(i, Renderer::DROP_ON_FLOOR); + continue; + } + else + { + float dd = sqrt(delta.x*delta.x + delta.y*delta.y); + if (dd < GetCutoffValue()) + { + raylist->set_classification(i, Renderer::DROP_ON_FLOOR); + continue; + } + } + + raylist->set_r(i, X); + raylist->set_g(i, Y); + raylist->set_b(i, 0.0); + raylist->set_o(i, 0.0); + } + } + + std::cerr << kkk << " photons moved bucket\n"; + + super::HandleTerminatedRays(raylist); +} + +int +Schlieren2::SerialSize() +{ + return super::SerialSize() + 2*sizeof(float) + 2*sizeof(int); +} + +unsigned char * +Schlieren2::Serialize(unsigned char *p) +{ + p = super::Serialize(p); + *(int *)p = GetRaysPerPixel(); + p += sizeof(int); + *(float *)p = GetFar(); + p += sizeof(float); + *(float *)p = GetCutoffValue(); + p += sizeof(float); + *(int *)p = GetCutoffType(); + p += sizeof(int); + return p; +} + +unsigned char * +Schlieren2::Deserialize(unsigned char *p) +{ + p = super::Deserialize(p); + SetRaysPerPixel(*(int *)p); + p += sizeof(int); + SetFar(*(float *)p); + p += sizeof(float); + SetCutoffValue(*(float *)p); + p += sizeof(float); + SetCutoffType(*(int *)p); + p += sizeof(int); + return p; +} + +void +Schlieren2::Trace(RayList *raylist) +{ + RendererP renderer = raylist->GetTheRenderer(); + RenderingSetP renderingSet = raylist->GetTheRenderingSet(); + RenderingP rendering = raylist->GetTheRendering(); + VisualizationP visualization = rendering->GetTheVisualization(); + + // This is called when a list of rays is pulled off the + // RayQ. When we are done with it we decrement the + // ray list count (rather than when it was pulled off the + // RayQ) so we don't send a message upstream saying we are idle + // until we actually are. + + Schlieren2TraceRays tracer; + + RayList *out = tracer.Trace(rendering->GetLighting(), visualization, raylist); + if (out) + { + if (out->GetRayCount() > renderer->GetMaxRayListSize()) + { + vector rayLists; + out->Split(rayLists); + for (vector::iterator it = rayLists.begin(); it != rayLists.end(); it++) + { + RayList *s = *it; + renderingSet->Enqueue(*it); + } + delete out; + } + else + renderingSet->Enqueue(out); + } +} + +bool +Schlieren2::LoadStateFromValue(Value& v) +{ + if (v.HasMember("far")) + SetFar(v["far"].GetDouble()); + + if (v.HasMember("rays per pixel")) + SetRaysPerPixel(v["rays per pixel"].GetInt()); + + return true; +} + +void +Schlieren2::SaveStateToValue(Value& v, Document& doc) +{ + v.AddMember("far", Value().SetDouble(GetFar()), doc.GetAllocator()); +} + +bool +Schlieren2::NormalizeSchlieren2ImagesMsg::CollectiveAction(MPI_Comm c, bool is_root) +{ + return false; + + char *ptr = (char *)contents->get(); + Key key = *(Key *)ptr; + RenderingSetP rs = RenderingSet::GetByKey(key); + + for (int i = 0; i < rs->GetNumberOfRenderings(); i++) + { + RenderingP r = rs->GetRendering(i); + if (r->IsLocal()) + { + int width, height; + r->GetTheSize(width, height); + + int n = width * height; + + float *p = r->GetPixels(); + + float mm[3] = {p[0], p[1], p[2]}; + float MM[3] = {p[0], p[1], p[2]}; + for (int i = 0; i < n; i++, p += 4) + { + for (int j = 0; j < 3; j++) + { + if (p[j] < mm[j]) mm[j] = p[j]; + if (p[j] > MM[j]) MM[j] = p[j]; + } + } + + std::cerr << "r " << mm[0] << " " << MM[0] << "\n"; + std::cerr << "g " << mm[1] << " " << MM[1] << "\n"; + std::cerr << "b " << mm[2] << " " << MM[2] << "\n"; + + p = r->GetPixels(); + for (int i = 0; i < n; i++, p += 4) + for (int j = 0; j < 3; j++) + if (MM[j] != mm[j]) + p[j] = (p[j] - mm[j])/(MM[j] - mm[j]); + } + } + + return false; +} + +void +Schlieren2::NormalizeImages(RenderingSetP rs) +{ + NormalizeSchlieren2ImagesMsg msg(rs); + msg.Broadcast(true, true); +} + +void +Schlieren2::local_render(RendererP renderer, RenderingSetP renderingSet) +{ + // NeedInitialRays tells us whether we need to generate initial rays + // for the current frame. It is possible that this RenderingSet has + // already seen a raylist from a later frame, in which case we won't + // bother generating rays for this one. + + int fnum = renderingSet->NeedInitialRays(); + if (fnum != -1) + { +#ifdef GXY_WRITE_IMAGES + GetTheRayQManager()->Pause(); + + if (renderingSet->CameraIsActive()) + { + std::cerr << "RenderingSet: Cannot InitializeState when camera is already active\n"; + exit(0); + } + + // Bump to keep from seeming finished until all camera rays have been spawned + + renderingSet->IncrementActiveCameraCount(); + + GetTheRayQManager()->Resume(); +#endif + +#ifdef GXY_WRITE_IMAGES + renderingSet->initializeSpawnedRayCount(); +#endif + + vector> rvec; + for (int i = 0; i < renderingSet->GetNumberOfRenderings(); i++) + { + RenderingP rendering = renderingSet->GetRendering(i); + rendering->resolve_lights(renderer); + + CameraP camera = rendering->GetTheCamera(); + VisualizationP visualization = rendering->GetTheVisualization(); + + Box *gBox = visualization->get_global_box(); + Box *lBox = visualization->get_local_box(); + +#if 0 + if (GetRaysPerPixel() == -1) + camera->generate_initial_rays(renderer, renderingSet, rendering, lBox, gBox, rvec, fnum); + else + for (int i = 0; i < GetRaysPerPixel(); i++) + camera->generate_initial_rays(renderer, renderingSet, rendering, lBox, gBox, rvec, fnum, i); +#else + camera->generate_initial_rays(renderer, renderingSet, rendering, lBox, gBox, rvec, fnum); +#endif + } + +#ifdef GXY_PRODUCE_STATUS_MESSAGES + renderingSet->_dumpState(c, "status"); // Note this will sync after cameras, I think +#endif + +#ifdef GXY_EVENT_TRACKING + GetTheEventTracker()->Add(new CameraLoopEndEvent); +#endif + +#ifdef GXY_WRITE_IMAGES + for (auto& r : rvec) + r.get(); + + renderingSet->DecrementActiveCameraCount(0); +#endif // GXY_WRITE_IMAGES + } + +} + +} // namespace gxy diff --git a/src/schlieren/Schlieren2.h b/src/schlieren/Schlieren2.h new file mode 100644 index 00000000..38cef5b5 --- /dev/null +++ b/src/schlieren/Schlieren2.h @@ -0,0 +1,110 @@ +// ========================================================================== // +// Copyright (c) 2014-2019 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#pragma once + +/*! + * This is the initial class that abstracts the operation of galaxy from + * ray-based renderer to ray-based sampler. + * + * At the moment the design is simply to take over some of the operations + * of the renderer and create samples instead of pixels. A more thorough + * discussion will follow as the design is worked out. + * \file Sampler.h + * \brief Initial class for ray-based sampling + * \ingroup applications + */ + +#include + +#include "Renderer.h" + +namespace gxy +{ + +class RayList; + +OBJECT_POINTER_TYPES(Schlieren2) + +class Schlieren2 : public Renderer +{ + KEYED_OBJECT_SUBCLASS(Schlieren2, Renderer) + +public: + static void Initialize(); + virtual void initialize(); //!< initializes the singleton Renderer + + + virtual bool LoadStateFromValue(rapidjson::Value&); + virtual void SaveStateToValue(rapidjson::Value&, rapidjson::Document&); + + virtual void HandleTerminatedRays(RayList *raylist); + + virtual int SerialSize(); + virtual unsigned char *Serialize(unsigned char *); + virtual unsigned char *Deserialize(unsigned char *); + + virtual void Trace(RayList *); + + void NormalizeImages(RenderingSetP); + + float GetFar() { return far; } + void SetFar(float f) { far = f; } + + float GetCutoffValue() { return cutoff_value; } + void SetCutoffValue(float f) { cutoff_value = f; } + + int GetRaysPerPixel() { return raysPerPixel; } + void SetRaysPerPixel(int f) { raysPerPixel = f; } + + float GetCutoffType() { return cutoff_type; } + void SetCutoffType(int t) { cutoff_type = t; } + + virtual void local_render(RendererP, RenderingSetP); + +private: + float far; + int raysPerPixel; + float cutoff_value; + int cutoff_type; + + //! a Work unit to instruct Galaxy processes to begin rendering + class NormalizeSchlieren2ImagesMsg : public Work + { + public: + NormalizeSchlieren2ImagesMsg(RenderingSetP rs) : NormalizeSchlieren2ImagesMsg(sizeof(Key)) + { + unsigned char *p = (unsigned char *)contents->get(); + *(Key *)p = rs->getkey(); + } + + ~NormalizeSchlieren2ImagesMsg() {} + + WORK_CLASS(NormalizeSchlieren2ImagesMsg, true); + + bool CollectiveAction(MPI_Comm coll_comm, bool isRoot); + + private: + int frame; + }; + +}; + +} // namespace gxy diff --git a/src/schlieren/Schlieren2Rendering.cpp b/src/schlieren/Schlieren2Rendering.cpp new file mode 100644 index 00000000..0895a48f --- /dev/null +++ b/src/schlieren/Schlieren2Rendering.cpp @@ -0,0 +1,77 @@ +// ========================================================================== // +// Copyright (c) 2014-2019 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#include "Schlieren2Rendering.h" + +namespace gxy +{ +KEYED_OBJECT_CLASS_TYPE(Schlieren2Rendering) + +void +Schlieren2Rendering::Register() +{ + RegisterClass(); +} + +void +Schlieren2Rendering::AddLocalPixels(Pixel *p, int n, int f, int s) +{ +std::cerr << "SR " << n << "\n"; + +#if defined(GXY_EVENT_TRACKING) + GetTheEventTracker()->Add(new LocalPixelsEvent(n, this->getkey(), f)); +#endif + + if (! framebuffer) + { + cerr << "ERROR: Rendering::Schlieren2AddLocalPixel called by non-owner" << endl; + exit(1); + } + + if (f >= frame) + { + if (f > frame) + frame = f; + + while (n-- > 0) + { + float x = p->r, y = p->g; + int ix = floor(x), iy = floor(y); + float dx = x - ix, dy = y - iy; + + if (ix >= 0 && ix < width) + { + if (iy > 0) framebuffer[(iy*width + ix) << 2] += (1.0 - dx) * (1.0 - dy); + if (iy+1 < height) framebuffer[((iy+1)*width + ix) << 2] += (1.0 - dx) * dy; + } + + if ((ix+1) >= 0 && (ix+1) < width) + { + if (iy > 0) framebuffer[(iy * width + (ix+1)) << 2] += dx * (1.0 - dy); + if (iy+1 < height) framebuffer[((iy+1)*width + (ix+1)) << 2] += dx * dy; + } + + p++; + } + + } +} + +} diff --git a/src/schlieren/Schlieren2Rendering.h b/src/schlieren/Schlieren2Rendering.h new file mode 100644 index 00000000..5e9adc78 --- /dev/null +++ b/src/schlieren/Schlieren2Rendering.h @@ -0,0 +1,45 @@ +// ========================================================================== // +// Copyright (c) 2014-2019 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#pragma once + +/*! \file Schlieren2Rendering.h + * \brief extents Rendering to accumulating pixel hit counts rather than updating color buffers. + * \ingroup render + */ + +#include "Rendering.h" + +namespace gxy +{ + +OBJECT_POINTER_TYPES(Schlieren2Rendering) + +class Schlieren2Rendering : public Rendering +{ + KEYED_OBJECT_SUBCLASS(Schlieren2Rendering, Rendering); + +public: + virtual void AddLocalPixels(Pixel *p, int n, int f, int sender = -1); +}; + +} + + diff --git a/src/schlieren/Schlieren2TraceRays.cpp b/src/schlieren/Schlieren2TraceRays.cpp new file mode 100644 index 00000000..9868a185 --- /dev/null +++ b/src/schlieren/Schlieren2TraceRays.cpp @@ -0,0 +1,57 @@ +// ========================================================================== // +// Copyright (c) 2014-2019 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#include "Schlieren2TraceRays.h" +#include "Schlieren2TraceRays_ispc.h" + +#include +#include +#include +#include +#include +#include + +#include "RayFlags.h" + +using namespace std; +using namespace rapidjson; + +namespace gxy +{ + +Schlieren2TraceRays::Schlieren2TraceRays() +{ + allocate_ispc(); + initialize_ispc(); +} + +Schlieren2TraceRays::~Schlieren2TraceRays() +{ +} + +RayList * +Schlieren2TraceRays::Trace(Lighting* lights, VisualizationP visualization, RayList *raysIn) +{ + ispc::Schlieren2TraceRays_Schlieren2TraceRays(GetIspc(), visualization->GetIspc(), raysIn->GetRayCount(), raysIn->GetIspc()); + return NULL; + +} + +} // namespace gxy diff --git a/src/schlieren/Schlieren2TraceRays.h b/src/schlieren/Schlieren2TraceRays.h new file mode 100644 index 00000000..de91c6a9 --- /dev/null +++ b/src/schlieren/Schlieren2TraceRays.h @@ -0,0 +1,65 @@ +// ========================================================================== // +// Copyright (c) 2014-2019 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#pragma once + +/*! \file Schlieren2TraceRays.h + * \brief controls the ray tracing loop within Galaxy + * \ingroup render + */ + +#include +#include +#include +#include + +#include "dtypes.h" +#include "IspcObject.h" +#include "Lighting.h" +#include "Rays.h" +#include "Visualization.h" + +namespace gxy +{ +OBJECT_POINTER_TYPES(Schlieren2TraceRays) + +//! controls the ray tracing loop within Galaxy +/*! \sa KeyedObject, IspcObject + * \ingroup render + */ +class Schlieren2TraceRays : public IspcObject +{ +public: + Schlieren2TraceRays(); //!< default constructor + ~Schlieren2TraceRays(); //!< default destructor + + //! trace a given RayList against the given Visualization using the given Lighting + /*! \returns a RayList pointer to rays spawned during this trace + * \param lights a pointer to the Lighting object to use during this trace + * \param visualization a pointer to the Visualization to trace + * \param raysIn a pointer to the RayList of rays to trace + */ + RayList *Trace(Lighting* lights, VisualizationP visualization, RayList * raysIn); + +protected: + +}; + +} // namespace gxy diff --git a/src/schlieren/Schlieren2TraceRays.ih b/src/schlieren/Schlieren2TraceRays.ih new file mode 100644 index 00000000..347e4ce6 --- /dev/null +++ b/src/schlieren/Schlieren2TraceRays.ih @@ -0,0 +1,27 @@ +// ========================================================================== // +// Copyright (c) 2014-2019 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#include "ospray/SDK/math/vec.ih" + +struct Schlieren2TraceRays_ispc +{ +}; + + diff --git a/src/schlieren/Schlieren2TraceRays.ispc b/src/schlieren/Schlieren2TraceRays.ispc new file mode 100644 index 00000000..3b0cfca1 --- /dev/null +++ b/src/schlieren/Schlieren2TraceRays.ispc @@ -0,0 +1,309 @@ +#define PRINT_BEND if (1 == 0) + +// ========================================================================== // +// Copyright (c) 2016-2018 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +// adapted from Intel OSPRay ospray/render/scivis/SciVisRenderer.ispc +// ======================================================================== // +// Copyright 2009-2016 Intel Corporation // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// ======================================================================== // + +#include "galaxy.h" + +#include "ospray/SDK/math/vec.ih" +#include "ospray/SDK/common/Ray.ih" +#include "ospray/SDK/render/util.ih" +#include "ospray/SDK/common/Model.ih" +#include "ospray/SDK/transferFunction/LinearTransferFunction.ih" +#include "ospray/SDK/volume/Volume.ih" + +#include "Rays.ih" +#include "Schlieren2TraceRays.ih" +#include "Lighting.ih" +#include "RayFlags.h" +#include "Visualization.ih" +#include "VolumeVis.ih" + +export void Schlieren2TraceRays_initialize(void *uniform _self) +{ +} + +export void Schlieren2TraceRays_destroy(void *uniform ispc) +{ +} + +inline float +EntryT(const Ray& ray, const uniform box3f& box) +{ + vec3f d = ray.dir; + + if (d.x == 0.f) d.x = 1e-6f; + if (d.y == 0.f) d.y = 1e-6f; + if (d.z == 0.f) d.z = 1e-6f; + + // Get the volume enter/exit t's for the ray irrespective of the rays lifetime + const vec3f mins = (box.lower - ray.org) * rcp(d); + const vec3f maxs = (box.upper - ray.org) * rcp(d); + + // print("min\nX %\nY %\nZ %\n", mins.x, mins.y, mins.z); + // print("max\nX %\nY %\nZ %\n", maxs.x, maxs.y, maxs.z); + + return max(min(mins.x,maxs.x), + max(min(mins.y,maxs.y), + min(mins.z,maxs.z))); +} + +inline float +ExitT(const Ray& ray, const uniform box3f& box) +{ + vec3f d = ray.dir; + + if (d.x == 0.f) d.x = 1e-6f; + if (d.y == 0.f) d.y = 1e-6f; + if (d.z == 0.f) d.z = 1e-6f; + + const vec3f mins = (box.lower - ray.org) * rcp(d); + const vec3f maxs = (box.upper - ray.org) * rcp(d); + + PRINT_BEND print("mins.x %\nmins.y %\nmins.z %\n", mins.x, mins.y, mins.z); + PRINT_BEND print("maxs.x %\nmaxs.y %\nmaxs.z %\n", maxs.x, maxs.y, maxs.z); + + return min(max(mins.x,maxs.x), + min(max(mins.y,maxs.y), + max(mins.z,maxs.z))); +} + +// the ray origin should be inside the box. Does the step also end +// inside the box? If so, bump the origin by the step size and keep +// the containing loop going. If not, figure out the exit point and +// cause the loop to break + +inline bool +Step(Ray& ray, const uniform float step, const uniform box3f& box) +{ + vec3f coord = ray.org + step*ray.dir; + +#if 0 + print("box\nl % % %\nu % % %\nOX %\nOY %\nOZ %\n", + box.lower.x, + box.lower.y, + box.lower.z, + box.upper.x, + box.upper.y, + box.upper.z, + coord.x, coord.y, coord.z); +#endif + + if (box.lower.x > coord.x || box.lower.y > coord.y || box.lower.z > coord.z || + box.upper.x < coord.x || box.upper.y < coord.y || box.upper.z < coord.z) + { + float tExit = ExitT(ray, box); + PRINT_BEND print("step outside tExit %\n", tExit); + + if (tExit < 0 || tExit > step) + PRINT_BEND print("invalid tExit\n"); + + ray.org = ray.org + tExit*ray.dir; + PRINT_BEND print("Exit: ", ray.org.z); + + return true; + } + else + { + ray.org = coord; + return false; + } +} + +export void* uniform Schlieren2TraceRays_Schlieren2TraceRays(void *uniform _self, + void *uniform _vis, + const uniform int nRaysIn, + void *uniform _raysIn) +{ + uniform Schlieren2TraceRays_ispc *uniform self = (uniform Schlieren2TraceRays_ispc *)_self; + uniform Visualization_ispc *uniform vis = (uniform Visualization_ispc *)_vis; + uniform RayList_ispc *uniform raysIn = (uniform RayList_ispc *)_raysIn; + uniform box3f box = vis->local_bb; + uniform float step; + + // print("AT TOP: mask %\n", __mask); + + PRINT_BEND print("box\nl % % %\nu % % %\n", + box.lower.x, + box.lower.y, + box.lower.z, + box.upper.x, + box.upper.y, + box.upper.z); + + if (vis->nVolumeVis == 1) + { + uniform VolumeVis_ispc *uniform vvis = vis->volumeVis[0]; + uniform Volume *uniform vol = (uniform Volume *uniform)((uniform Vis_ispc *uniform)vvis)->data; + + step = vol->samplingStep * vol->samplingRate; + + foreach (i = 0 ... nRaysIn) + { + Ray ray; + + ray.org = make_vec3f(raysIn->ox[i], raysIn->oy[i], raysIn->oz[i]); + ray.dir = make_vec3f(raysIn->dx[i], raysIn->dy[i], raysIn->dz[i]); + + ray.dir = normalize(ray.dir); + + PRINT_BEND print("in===================\n"); + PRINT_BEND print("OX %\nOY %\nOZ %\n", ray.org.x, ray.org.y, ray.org.z); + PRINT_BEND print("DX %\nDY %\nDZ %\n", ray.dir.x, ray.dir.y, ray.dir.z); + + // if (ray.dir.x == 0.f) ray.dir.x = 1e-6f; + // if (ray.dir.y == 0.f) ray.dir.y = 1e-6f; + // if (ray.dir.z == 0.f) ray.dir.z = 1e-6f; + + // Get the volume enter/exit t's for the ray irrespective of the rays lifetime + // tExitVolume is the distance to the exit boundary. CANNOT be used for much + // since the ray bends. + + float tEntry = EntryT(ray, box); + PRINT_BEND print("tE: %\n", tEntry); + + // move the ray origin to the entry point (if its not already inside the volume) + +// print("AAAA\ntEntry %\nOX %\nDX %\n", tEntry, ray.org.x, ray.dir.x); + if (tEntry > 0.0) ray.org = ray.org + tEntry * ray.dir; + +// print("BBBB\nOX %\nDX %\n", ray.org.x, ray.dir.x); + + float sLast = vol->sample(vol, ray.org); + PRINT_BEND print("sL %\n", sLast); + + bool done = false; + do + { + done = Step(ray, step, box); + +// print("OX %\nDX %\n", ray.org.x, ray.dir.x); + + float sThis = vol->sample(vol, ray.org); + + if (sThis != sLast) + { +// print("BEND!\n"); + vec3f grad = vol->computeGradient(vol, ray.org); + + float magg = length(grad); + PRINT_BEND print("GX %\nGY %\nGZ %\n", grad.x, grad.y, grad.z); + + if (magg > 0.0001) + { + + grad = normalize(grad); + PRINT_BEND print("GX %\nGY %\nGZ %\n", grad.x, grad.y, grad.z); + + PRINT_BEND print("DX %\nDY %\nDZ %\n", ray.dir.x, ray.dir.y, ray.dir.z); + PRINT_BEND print("SL %\nST %\n", sLast, sThis); + + // Axis of rotation + vec3f u = make_vec3f(ray.dir.y*grad.z - ray.dir.z*grad.y, ray.dir.z*grad.x - ray.dir.x*grad.z, ray.dir.x*grad.y - ray.dir.y*grad.x); + + float dcu = length(u); + if (dcu < 0.001) + continue; + + u = normalize(u); + + // print("UX %\nUY %\nUZ %\n", u.x, u.y, u.z); + + // Alpha is the angle between the incoming direction and the gradient, beta the angle between the + // new outgoing direction and the gradient + + + // print("DX %\nDY %\nDZ %\n", ray.dir.x, ray.dir.y, ray.dir.z); + + vec3f rdir = ray.dir; + rdir = normalize(rdir); + + float cos_theta1 = dot(grad, rdir); + if (cos_theta1 != 0.0) + { + if (cos_theta1 < 0.0) cos_theta1 = -cos_theta1; + + // print("CT1 %\n", cos_theta1); + + float theta1 = acos(cos_theta1); + // print("T1 %\n", theta1); + + float bend = sLast / sThis; + // print("SL %\nST %\nB %\n", sLast, sThis, bend); + + float theta2 = bend*theta1; + float R = theta1 - theta2; + + // print("R %\n", R); + + float cosR = cos(R); + float sinR = sin(R); + + vec3f vx = make_vec3f(cosR + u.x*u.x*(1 - cosR), u.x*u.y*(1 - cosR) - u.z*sinR, u.x*u.z*(1 - cosR) + u.y*sinR); + vec3f vy = make_vec3f(u.y*u.x*(1 - cosR) + u.z*sinR, cosR + u.y*u.y*(1 - cosR), u.y*u.z*(1 - cosR) - u.x*sinR); + vec3f vz = make_vec3f(u.z*u.x*(1 - cosR) - u.y*sinR, u.z*u.y*(1 - cosR) + u.x*sinR, cosR + u.z*u.z*(1 - cosR)); + + vec3f rdir = (ray.dir.x * vx) + (ray.dir.y * vy) + (ray.dir.z * vz); + rdir = normalize(rdir); + ray.dir = rdir; + } + } + } + sLast = sThis; + } + while (!done); + + PRINT_BEND print("out===================\n"); + PRINT_BEND print("OX %\nOY %\nOZ %\n", ray.org.x, ray.org.y, ray.org.z); + PRINT_BEND print("DX %\nDY %\nDZ %\n", ray.dir.x, ray.dir.y, ray.dir.z); + + raysIn->term[i] |= RAY_BOUNDARY; + raysIn->ox[i] = ray.org.x; + raysIn->oy[i] = ray.org.y; + raysIn->oz[i] = ray.org.z; + raysIn->dx[i] = ray.dir.x; + raysIn->dy[i] = ray.dir.y; + raysIn->dz[i] = ray.dir.z; + + PRINT_BEND print("FOX %\nFOY %\nFOZ %\n", ray.org.x, ray.org.y, ray.org.z); + PRINT_BEND print("FDX %\nFDY %\nFDZ %\n", ray.dir.x, ray.dir.y, ray.dir.z); + } + } + else + PRINT_BEND print("Can only Schlieren2 one volume\n"); +} + diff --git a/src/schlieren/gxyschlieren.cpp b/src/schlieren/gxyschlieren.cpp index ae1f6720..7d72bd3a 100644 --- a/src/schlieren/gxyschlieren.cpp +++ b/src/schlieren/gxyschlieren.cpp @@ -25,6 +25,8 @@ #include "Application.h" #include "Schlieren.h" +#include "Schlieren2.h" +#include "Schlieren2Rendering.h" #include "ClientServer.h" #include @@ -44,7 +46,8 @@ syntax(char *a) cerr << " -D[which] run debugger in selected processes. If which is given, it is a number or a hyphenated range, defaults to all" << endl; cerr << " -A wait for attachment" << endl; cerr << " -s w h window width, height (1920 1080)" << endl; - cerr << " -S k render only every k'th rendering" << endl; + cerr << " -S1 Snell integration, difference vector in image plane (default)" << endl; + cerr << " -S2 Snell integration, accumulation at hit point" << endl; cerr << " -c client/server interface" << endl; cerr << " -N max number of simultaneous renderings (VERY large)" << endl; exit(1); @@ -69,19 +72,26 @@ int main(int argc, char *argv[]) bool atch = false; bool cinema = false; int width = 1920, height = 1080; - int skip = 0; bool clientserver = false; ClientServer cs; int maxConcurrentRenderings = 99999999; + bool override_windowsize = false; + bool original_algorithm = true; for (int i = 1; i < argc; i++) { if (!strcmp(argv[i], "-A")) dbg = true, atch = true, dbgarg = argv[i] + 2; + else if (!strcmp(argv[i], "-S1")) original_algorithm = true; + else if (!strcmp(argv[i], "-S2")) original_algorithm = false; else if (!strcmp(argv[i], "-C")) cinema = true, cdb = argv[++i]; else if (!strcmp(argv[i], "-c")) clientserver = true; else if (!strncmp(argv[i],"-D", 2)) dbg = true, atch = false, dbgarg = argv[i] + 2; - else if (!strcmp(argv[i], "-s")) width = atoi(argv[++i]), height = atoi(argv[++i]); - else if (!strcmp(argv[i], "-S")) skip = atoi(argv[++i]); + else if (!strcmp(argv[i], "-s")) + { + width = atoi(argv[++i]); + height = atoi(argv[++i]); + override_windowsize = true; + } else if (!strcmp(argv[i], "-N")) maxConcurrentRenderings = atoi(argv[++i]); else if (statefile == "") statefile = argv[i]; else syntax(argv[0]); @@ -90,12 +100,18 @@ int main(int argc, char *argv[]) if (statefile == "") syntax(argv[0]); - // ospInit(&argc, (const char **)argv); - Application theApplication(&argc, &argv); theApplication.Start(); - Schlieren::Initialize(); + if (original_algorithm) + { + Schlieren::Initialize(); + } + else + { + Schlieren2::Initialize(); + Schlieren2Rendering::Register(); + } mpiRank = theApplication.GetRank(); mpiSize = theApplication.GetSize(); @@ -117,7 +133,20 @@ int main(int argc, char *argv[]) cerr << "connection ok" << endl; } - SchlierenP theSchlierenRenderer = Schlieren::NewP(); + RendererP theRenderer; + + if (original_algorithm) + { + Schlieren::Initialize(); + theRenderer = Schlieren::NewP(); + } + else + { + Schlieren2::Initialize(); + Schlieren2Rendering::Register(); + theRenderer = Schlieren2::NewP(); + } + rapidjson::Document *doc = GetTheApplication()->OpenJSONFile(statefile); if (! doc) @@ -128,7 +157,7 @@ int main(int argc, char *argv[]) exit(1); } - theSchlierenRenderer->LoadStateFromDocument(*doc); + theRenderer->LoadStateFromDocument(*doc); vector theCameras; if (! Camera::LoadCamerasFromJSON(*doc, theCameras)) @@ -183,19 +212,26 @@ int main(int argc, char *argv[]) for (auto c : theCameras) for (auto v : theVisualizations) { - if (skip && (k % skip) != 0) - { - std::cerr << "S"; - continue; - } - if (theRenderingSets.back()->GetNumberOfRenderings() >= maxConcurrentRenderings) theRenderingSets.push_back(RenderingSet::NewP()); - RenderingP theRendering = Rendering::NewP(); + RenderingP theRendering; + + if (original_algorithm) + { + theRendering = Rendering::NewP(); + } + else + { + theRendering = Schlieren2Rendering::NewP(); + } theRendering->SetTheOwner(index++ % mpiSize ); - theRendering->SetTheSize(width, height); + if (override_windowsize) + { + c->set_width(width); + c->set_height(height); + } theRendering->SetTheCamera(c); theRendering->SetTheDatasets(theDatasets); theRendering->SetTheVisualization(v); @@ -230,7 +266,7 @@ int main(int argc, char *argv[]) theApplication.Wait(); exit(1); } - theSchlierenRenderer->Start(rs); + theRenderer->Start(rs); #if 1 #ifdef GXY_PRODUCE_STATUS_MESSAGES @@ -257,7 +293,8 @@ int main(int argc, char *argv[]) #endif rs->WaitForDone(); - theSchlierenRenderer->NormalizeImages(rs); + if (original_algorithm) + Schlieren::Cast(theRenderer)->NormalizeImages(rs); sleep(4); rs->SaveImages(cinema ? (cdb + "/image/image").c_str() : "image", true); @@ -275,7 +312,7 @@ int main(int argc, char *argv[]) theVisualizations.clear(); theCameras.clear(); - theSchlierenRenderer = nullptr; + theRenderer = nullptr; theApplication.QuitApplication(); } diff --git a/src/tracer/CMakeLists.txt b/src/tracer/CMakeLists.txt index 766fd3dd..4b504a8a 100644 --- a/src/tracer/CMakeLists.txt +++ b/src/tracer/CMakeLists.txt @@ -24,7 +24,7 @@ if (GXY_WRITE_IMAGES) target_link_libraries(tester ${VTK_LIBRARIES} ${Galaxy_LIBRARIES} ${MPI_C_LIBRARIES}) set(BINS tester) - add_executable(sampletrace sampletrace.cpp RungeKutta.cpp TraceToPathLines.cpp) + add_executable(sampletrace sampletrace.cpp RungeKutta.cpp TraceToPathLines.cpp Interpolator.cpp) target_link_libraries(sampletrace gxy_sampler ${VTK_LIBRARIES} ${Galaxy_LIBRARIES} ${MPI_C_LIBRARIES}) set(BINS sampletrace ${BINS}) diff --git a/src/tracer/Interpolator.cpp b/src/tracer/Interpolator.cpp new file mode 100644 index 00000000..1a7c95f7 --- /dev/null +++ b/src/tracer/Interpolator.cpp @@ -0,0 +1,164 @@ +// ========================================================================== // +// Copyright (c) 2014-2019 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#include + +#include +#include +#include + +#include + +#include "Interpolator.h" + +using namespace gxy; +using namespace std; + +namespace gxy +{ + +class InterpolateVolumeOntoGeometryMsg : public Work +{ +public: + InterpolateVolumeOntoGeometryMsg(GeometryP s, VolumeP v, GeometryP d) : InterpolateVolumeOntoGeometryMsg(3 * sizeof(Key)) + { + Key *keys = (Key *)contents->get(); + keys[0] = s->getkey(); + keys[1] = v->getkey(); + keys[2] = d->getkey(); + } + + WORK_CLASS(InterpolateVolumeOntoGeometryMsg, true) + + bool CollectiveAction(MPI_Comm c, bool isRoot) + { + Key *keys = (Key *)get(); + + GeometryP src = Geometry::GetByKey(keys[0]); + VolumeP vol = Volume::GetByKey(keys[1]); + GeometryP dst = Geometry::GetByKey(keys[2]); + + if (src != dst) + { + dst->allocate(src->GetNumberOfVertices(), src->GetConnectivitySize()); + memcpy((void *)dst->GetVertices(), (void *)src->GetVertices(), dst->GetNumberOfVertices()*sizeof(vec3f)); + if (src->GetConnectivitySize() > 0) + memcpy((void *)dst->GetConnectivity(), (void *)src->GetConnectivity(), dst->GetConnectivitySize()*sizeof(int)); + } + + float ox, oy, oz; + vol->get_ghosted_local_origin(ox, oy, oz); + + float dx, dy, dz; + vol->get_deltas(dx, dy, dz); + + int ik, jk, kk; + vol->get_ghosted_local_counts(ik, jk, kk); + + int istride = 1; + int jstride = ik; + int kstride = ik * jk; + + vec3f *p = dst->GetVertices(); + float *d = dst->GetData(); + float m, M; + for (int i = 0; i < dst->GetNumberOfVertices(); i++, p++, d++) + { + float x = (p->x - ox) / dx; + float y = (p->y - oy) / dy; + float z = (p->z - oz) / dz; + + int ix = (int)x; + int iy = (int)y; + int iz = (int)z; + + float dx = x - ix; + float dy = y - iy; + float dz = z - iz; + + int v000 = (ix + 0) * istride + (iy + 0) * jstride + (iz + 0) * kstride; + int v001 = (ix + 0) * istride + (iy + 0) * jstride + (iz + 1) * kstride; + int v010 = (ix + 0) * istride + (iy + 1) * jstride + (iz + 0) * kstride; + int v011 = (ix + 0) * istride + (iy + 1) * jstride + (iz + 1) * kstride; + int v100 = (ix + 1) * istride + (iy + 0) * jstride + (iz + 0) * kstride; + int v101 = (ix + 1) * istride + (iy + 0) * jstride + (iz + 1) * kstride; + int v110 = (ix + 1) * istride + (iy + 1) * jstride + (iz + 0) * kstride; + int v111 = (ix + 1) * istride + (iy + 1) * jstride + (iz + 1) * kstride; + + float b000 = (1.0 - dx) * (1.0 - dy) * (1.0 - dz); + float b001 = (1.0 - dx) * (1.0 - dy) * (dz); + float b010 = (1.0 - dx) * (dy) * (1.0 - dz); + float b011 = (1.0 - dx) * (dy) * (dz); + float b100 = (dx) * (1.0 - dy) * (1.0 - dz); + float b101 = (dx) * (1.0 - dy) * (dz); + float b110 = (dx) * (dy) * (1.0 - dz); + float b111 = (dx) * (dy) * (dz); + + if (vol->get_type() == Volume::FLOAT) + { + float *s = (float *)vol->get_samples(); + *d = s[v000]*b000 + s[v001]*b001 + s[v010]*b010 + s[v011]*b011 + + s[v100]*b100 + s[v101]*b101 + s[v110]*b110 + s[v111]*b111; + } + else + { + unsigned char *s = (unsigned char *)vol->get_samples(); + *d = s[v000]*b000 + s[v001]*b001 + s[v010]*b010 + s[v011]*b011 + + s[v100]*b100 + s[v101]*b101 + s[v110]*b110 + s[v111]*b111; + } + + if (i == 0) m = M = *d; + else + { + if (m > *d) m = *d; + if (M < *d) M = *d; + } + } + + std::cerr << "min " << m << " max " << M << "\n"; + + return false; + } +}; + +WORK_CLASS_TYPE(InterpolateVolumeOntoGeometryMsg) + +void +InitializeInterpolateVolumeOntoGeometry() +{ + InterpolateVolumeOntoGeometryMsg::Register(); +} + +void +InterpolateVolumeOntoGeometry(GeometryP s, VolumeP v) +{ + InterpolateVolumeOntoGeometryMsg msg(s, v, s); + msg.Broadcast(true, true); +} + +void +InterpolateVolumeOntoGeometry(GeometryP s, VolumeP v, GeometryP d) +{ + InterpolateVolumeOntoGeometryMsg msg(s, v, d); + msg.Broadcast(true, true); +} + +} + diff --git a/src/tracer/Interpolator.h b/src/tracer/Interpolator.h new file mode 100644 index 00000000..b6ad16f8 --- /dev/null +++ b/src/tracer/Interpolator.h @@ -0,0 +1,30 @@ +// ========================================================================== // +// Copyright (c) 2014-2019 The University of Texas at Austin. // +// All rights reserved. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// A copy of the License is included with this software in the file LICENSE. // +// If your copy does not contain the License, you may obtain a copy of the // +// License at: // +// // +// https://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +// ========================================================================== // + +#include "Geometry.h" +#include "Volume.h" + +namespace gxy +{ + void InitializeInterpolateVolumeOntoGeometry(); + void InterpolateVolumeOntoGeometry(GeometryP s, VolumeP v, GeometryP d); + void InterpolateVolumeOntoGeometry(GeometryP s, VolumeP v); +} + diff --git a/src/tracer/RungeKutta.cpp b/src/tracer/RungeKutta.cpp index 4f0dcff0..f1f0e861 100644 --- a/src/tracer/RungeKutta.cpp +++ b/src/tracer/RungeKutta.cpp @@ -19,15 +19,16 @@ void RungeKutta::initialize() { super::initialize(); + min_velocity = -1; + max_integration_time = -1; max_steps = 1000; stepsize = 0.2; - minlen = 1e-12; pthread_cond_init(&signal, NULL); pthread_mutex_init(&lock, NULL); } int -RungeKutta::serialSize() { return super::serialSize() + sizeof(Key) + sizeof(int) + 2*sizeof(float); } +RungeKutta::serialSize() { return super::serialSize() + sizeof(Key) + sizeof(int) + 3*sizeof(float); } bool RungeKutta::SetVectorField(VolumeP v) @@ -48,7 +49,9 @@ RungeKutta::serialize(unsigned char *ptr) *(Key *)ptr = vectorField->getkey(); ptr += sizeof(Key); *(int *)ptr = max_steps; ptr += sizeof(int); *(float *)ptr = stepsize; ptr += sizeof(float); - *(float *)ptr = minlen; ptr += sizeof(float); + *(float *)ptr = min_velocity; ptr += sizeof(float); + *(float *)ptr = max_integration_time; ptr += sizeof(float); + return ptr; } @@ -59,7 +62,9 @@ RungeKutta::deserialize(unsigned char *ptr) vectorField = Volume::GetByKey(*(Key *)ptr); ptr += sizeof(Key); max_steps = *(int *)ptr; ptr += sizeof(int); stepsize = *(float *)ptr; ptr += sizeof(float); - minlen = *(float *)ptr; ptr += sizeof(float); + min_velocity = *(float *)ptr; ptr += sizeof(float); + max_integration_time = *(float *)ptr; ptr += sizeof(float); + return ptr; } @@ -191,7 +196,7 @@ RungeKutta::local_trace(int id, int n, vec3f& p, vec3f& u, float t) vec3f velocity(vel[0], vel[1], vel[2]), normalized_velocity; float vlen = len(velocity); - if (vlen < minlen) + if (min_velocity > 0 && vlen < min_velocity) { terminated = true; zero(velocity); @@ -199,6 +204,9 @@ RungeKutta::local_trace(int id, int n, vec3f& p, vec3f& u, float t) } else { + if (max_integration_time >= 0 && max_integration_time < tLast) + terminated = true; + normalized_velocity = velocity * (1.0 / vlen); } diff --git a/src/tracer/RungeKutta.h b/src/tracer/RungeKutta.h index fdcc4e5f..f577da39 100644 --- a/src/tracer/RungeKutta.h +++ b/src/tracer/RungeKutta.h @@ -57,9 +57,6 @@ class RungeKutta: public KeyedDataObject float get_stepsize() { return stepsize; } void set_stepsize(float s) { stepsize = s; } - float get_minlen() { return minlen; } - void set_minlen(float m) { minlen = m; } - int get_number_of_local_trajectories() { return trajectories.size(); } float get_maximum_integration_time() { return max_integration_time; } @@ -101,6 +98,12 @@ class RungeKutta: public KeyedDataObject void Signal() { pthread_cond_signal(&signal); } void Wait() { pthread_cond_wait(&signal, &lock); } + float GetMinVelocity() { return min_velocity; } + void SetMinVelocity(float v) { min_velocity = v; } + + float GetMaxIntegrationTime() { return max_integration_time; } + void SetMaxIntegrationTime(float t) { max_integration_time = t; } + protected: VolumeP vectorField; @@ -118,7 +121,8 @@ class RungeKutta: public KeyedDataObject int max_steps; float stepsize; - float minlen; + float min_velocity; + float max_time; class RKTraceMsg : public Work { diff --git a/src/tracer/TraceToPathLines.cpp b/src/tracer/TraceToPathLines.cpp index ad4b02f1..30fa8611 100644 --- a/src/tracer/TraceToPathLines.cpp +++ b/src/tracer/TraceToPathLines.cpp @@ -13,14 +13,18 @@ class TraceToPathLinesMsg : public Work { public: - TraceToPathLinesMsg(RungeKuttaP rkp, PathLinesP plp) - : TraceToPathLinesMsg(2*sizeof(Key)) + TraceToPathLinesMsg(RungeKuttaP rkp, PathLinesP plp, float t, float dt) + : TraceToPathLinesMsg(2*sizeof(Key) + 2*sizeof(float)) { unsigned char *g = (unsigned char *)get(); *(Key *)g = rkp->getkey(); g += sizeof(Key); *(Key *)g = plp->getkey(); g += sizeof(Key); + *(float *)g = t; + g += sizeof(float); + *(float *)g = dt; + g += sizeof(float); } ~TraceToPathLinesMsg() {} @@ -35,6 +39,10 @@ class TraceToPathLinesMsg : public Work g += sizeof(Key); PathLinesP plp = PathLines::GetByKey(*(Key *)g); g += sizeof(Key); + float t = *(float *)g; + g += sizeof(float); + float dt = *(float *)g; + g += sizeof(float); plp->CopyPartitioning(rkp); @@ -45,19 +53,27 @@ class TraceToPathLinesMsg : public Work // How much space do I need? - int np = 0, nc = 0; - for (auto id = keys.begin(); id != keys.end(); id++) + int np = 0, nc = 0, ii = 0; + for (auto id = keys.begin(); id != keys.end(); id++, ii++) { - trajectory t = rkp->get_trajectory(*id); - for (auto seg = t->begin(); seg != t->end(); seg++) + trajectory traj = rkp->get_trajectory(*id); + for (auto segp = traj->begin(); segp != traj->end(); segp++) { - np += (*seg)->points.size(); - nc += (*seg)->points.size() - 1; + auto seg = *segp; + + auto k = 0; + for (auto n = 0; n < seg->times.size(); n++) + if (seg->times[n] > (t - dt) && seg->times[n] < t) + k++; + + if (k > 1) + { + np += k; + nc += k - 1; + } } } -std::cerr << np << " points, " << nc << " cells\n"; - plp->allocate(np, nc); vec3f *pbuf = plp->GetVertices(); @@ -67,14 +83,26 @@ std::cerr << np << " points, " << nc << " cells\n"; np = 0; nc = 0; for (auto id = keys.begin(); id != keys.end(); id++) { - trajectory t = rkp->get_trajectory(*id); - for (auto seg = t->begin(); seg != t->end(); seg++) + trajectory traj = rkp->get_trajectory(*id); + for (auto segp = traj->begin(); segp != traj->end(); segp++) { - memcpy((void *)(pbuf + np), (*seg)->points.data(), (*seg)->points.size()*sizeof(vec3f)); - memcpy((void *)(dbuf + np), (*seg)->times.data(), (*seg)->times.size()*sizeof(float)); - for (int i = 0; i < (*seg)->points.size(); i++, np++) - if (i < ((*seg)->points.size() - 1)) - cbuf[nc++] = np; + auto seg = *segp; + auto k = 0, ik = -1; + for (auto n = 0; n < seg->times.size(); n++) + if (seg->times[n] > (t - dt) && seg->times[n] < t) + { + k++; + if (ik < 0) ik = n; + } + + if (k > 1) + { + memcpy((void *)(pbuf + np), ((vec3f *)seg->points.data()) + ik, k*sizeof(vec3f)); + memcpy((void *)(dbuf + np), ((float *)seg->times.data()) + ik, k*sizeof(float)); + for (int i = 0; i < k; i++, np++) + if (i < (k - 1)) + cbuf[nc++] = np; + } } } @@ -93,9 +121,9 @@ RegisterTraceToPathLines() } void -TraceToPathLines(RungeKuttaP rkp, PathLinesP plp) +TraceToPathLines(RungeKuttaP rkp, PathLinesP plp, float t, float dt) { - TraceToPathLinesMsg msg(rkp, plp); + TraceToPathLinesMsg msg(rkp, plp, t, dt); msg.Broadcast(true, true); } diff --git a/src/tracer/TraceToPathLines.h b/src/tracer/TraceToPathLines.h index bc2667ec..5c5b5c47 100644 --- a/src/tracer/TraceToPathLines.h +++ b/src/tracer/TraceToPathLines.h @@ -2,6 +2,6 @@ namespace gxy { void RegisterTraceToPathLines(); -void TraceToPathLines(RungeKuttaP rkp, PathLinesP plp); +void TraceToPathLines(RungeKuttaP rkp, PathLinesP plp, float t, float dt); } diff --git a/src/tracer/Tracer.md b/src/tracer/Tracer.md new file mode 100644 index 00000000..e61ab078 --- /dev/null +++ b/src/tracer/Tracer.md @@ -0,0 +1,21 @@ +# Tracer + +The files in this directory implement Runge-Kutta particle advection and various tools that aid in visualizing those path lines. + + * **RungeKutta.cpp**, **RungeKutta.h** implements distributed-memory Runge-Kutte4 particle advection.rParticles are traced in whichever vector-field partition that contains the current head of the particle trace, and when a boundary is encountered, a partial trace is retained in the current process and a message is sent to continue the trace on the neighbor across the boundary (if there is one) The inputs are a particle set, a vector field, and various parameters; the output is a set of particle traces distributed similarly to the underlying vector field. Note that each trace in particle trace data set may consist of several segments if the particle re-enters a partition of the vector field where its already been. + * **TraceToPathLines.cpp**, **TracetoPathLines.h** implement converting structured particle traces to simple renderable path lines. It allows two parameters: a time *t* and a delta-time *dt*; if given, only the portion of the streamline with integration time between (*t* - *dt*) and *t. + * **Interpolator.cpp**, **Interpolator.h** interpolate a scalar volume dataset onto a Geometry dataset - eg. either particles or pathlines. + +The example application *sampletrace* is included in **sampletrace.cpp**. This application implements a multi-step workflow that: + +1. Reads an initial set of datasets by processing the input *data.state* file +2. Uses a sampler (see *../sample*) to sample a given volume. This operation is specified in the *sample.state* input file. The dataset to be sampled is specified therein. The result of this step is a Particles dataset named 'samples'. +2. Optionally interpolates an arbitrary scalar volume dataset onto the samples particles. This dataset is specied by the *-sdata name* command-line parameter. +3. Runs the **RungeKutta** operator to advect particle traces. It expects to find a vector dataset named *vectors*. It then produces particle traces from the samples produced earlier. The results are stored in the RungeKutta object. +4. Runs **TraceToPathLines** to convert some or all of the particle traces to renderable pathlines +5. Optionally interpolates an arbitrary scalar volume dataset onto the resulting pathlines. This dataset is specied by the *-pdata name* command-line parameter. +6. Renders images based on the *render.state* file given on the command line. + +Note that steps 5, 6, and 7 may run in a loop (controlled by the command-line *-nf* and *-dt* arguments) that enable rendering movies where the particle traces are animated in integration time. + +For a complete set of command-line args, please run **sampletrace --**. See the *sampletrace* directory in the examples. diff --git a/src/tracer/sampletrace.cpp b/src/tracer/sampletrace.cpp index 16e1566d..922d5af7 100644 --- a/src/tracer/sampletrace.cpp +++ b/src/tracer/sampletrace.cpp @@ -36,6 +36,7 @@ #include "RungeKutta.h" #include "TraceToPathLines.h" +#include "Interpolator.h" #include @@ -53,10 +54,15 @@ using namespace rapidjson; // default values int width = WIDTH; int height = HEIGHT; +int sam_width = WIDTH; +int sam_height = HEIGHT; int maxsteps = 2000; float h = 0.2; float z = 1e-12; +float t = -1.0; float max_i = -1; +float dt = 1.0; +int nf = 1; void @@ -65,26 +71,34 @@ syntax(char *a) cerr << "syntax: " << a << " sampling.state rendering.state [options]" << endl; cerr << "optons:" << endl; cerr << " -D run debugger" << endl; - cerr << " -s x y window size (" << WIDTH << "x" << HEIGHT << ")" << endl; + cerr << " -s x y sample size (" << WIDTH << "x" << HEIGHT << ")" << endl; + cerr << " -w x y window size (" << WIDTH << "x" << HEIGHT << ")" << endl; cerr << " -h h portion of cell size to step (0.2)" << endl; cerr << " -z z termination magnitude of vectors (1e-12)" << endl; - cerr << " -d factor downsampling factor for sampler pass (0)" << endl; + cerr << " -t t max integration time (none)" << endl; cerr << " -m n max number of steps per streamline (2000)" << endl; cerr << " -P print samples\n"; cerr << " -I max scale the colormap to this to avoid hairballs (scale to max integration time)\n"; + cerr << " -dt dt truncate pathlines to this length in proportion of total integration time (don't truncate)\n"; + cerr << " -nf nf animate by moving head of pathlines from 0 to total integration time in this number of frames (1)\n"; + cerr << " -sdata name volume to map onto samples\n"; + cerr << " -pdata name volume to map onto pathlines\n"; exit(1); } int main(int argc, char * argv[]) { + string data_state = ""; string sampling_state = ""; string rendering_state = ""; + string pdata = ""; + string sdata = ""; char *dbgarg; bool dbg = false; - int downsample = 0; bool printsamples = false; - + bool override_windowsize = false; + bool override_samplesize = false; ospInit(&argc, (const char **)argv); @@ -94,33 +108,88 @@ main(int argc, char * argv[]) // process command line args for (int i = 1; i < argc; i++) { - if (argv[i][0] == '-') - switch (argv[i][1]) - { - case 'D': dbg = true, dbgarg = argv[i] + 2; break; - case 's': width = atoi(argv[++i]); height = atoi(argv[++i]); break; - case 'd': downsample = atoi(argv[++i]); break; - case 'm': maxsteps = atoi(argv[++i]); break; - case 'h': h = atof(argv[++i]); break; - case 'z': z = atof(argv[++i]); break; - case 'P': printsamples = true; break; - case 'I': max_i = atof(argv[++i]); break; - - default: - syntax(argv[0]); - } - else if (sampling_state == "") sampling_state = argv[i]; - else if (rendering_state == "") rendering_state = argv[i]; - else syntax(argv[0]); + if (! strcmp(argv[i], "-D")) + { + dbg = true; + dbgarg = argv[i] + 2; + } + else if (! strcmp(argv[i], "-m")) + { + maxsteps = atoi(argv[++i]); + } + else if (! strcmp(argv[i], "-s")) + { + sam_width = atoi(argv[++i]); + sam_height = atoi(argv[++i]); + override_samplesize = true; + } + else if (! strcmp(argv[i], "-w")) + { + width = atoi(argv[++i]); + height = atoi(argv[++i]); + override_windowsize = true; + } + else if (! strcmp(argv[i], "-z")) + { + z = atof(argv[++i]); + } + else if (! strcmp(argv[i], "-t")) + { + t = atof(argv[++i]); + } + else if (! strcmp(argv[i], "-P")) + { + printsamples = true; + } + else if (! strcmp(argv[i], "-I")) + { + max_i = atof(argv[++i]); + } + else if (! strcmp(argv[i], "-dt")) + { + dt = atof(argv[++i]); + } + else if (! strcmp(argv[i], "-nf")) + { + nf = atoi(argv[++i]); + } + else if (! strcmp(argv[i], "-pdata")) + { + pdata = argv[++i]; + } + else if (! strcmp(argv[i], "-sdata")) + { + sdata = argv[++i]; + } + else if (data_state == "") + { + data_state = argv[i]; + } + else if (sampling_state == "") + { + sampling_state = argv[i]; + } + else if (rendering_state == "") + { + rendering_state = argv[i]; + } + else + { + syntax(argv[0]); + } } - if (sampling_state == "" || rendering_state == "") + if (data_state == "" || sampling_state == "" || rendering_state == "") syntax(argv[0]); theApplication.Run(); + + mpiRank = theApplication.GetRank(); mpiSize = theApplication.GetSize(); + Debug *d = dbg ? new Debug(argv[0], false, dbgarg) : NULL; + Sampler::Initialize(); Renderer::Initialize(); RungeKutta::RegisterRK(); @@ -129,14 +198,20 @@ main(int argc, char * argv[]) SamplerP theSampler = Sampler::NewP(); RendererP theRenderer = Renderer::NewP(); - srand(mpiRank); + InitializeInterpolateVolumeOntoGeometry(); - Debug *d = dbg ? new Debug(argv[0], false, dbgarg) : NULL; + srand(mpiRank); if (mpiRank == 0) { - // BEGIN SAMPLING + Document *ddoc = theApplication.OpenJSONFile(data_state); + if (! ddoc) + { + std::cerr << "error loading data state file\n"; + exit(1); + } + // BEGIN SAMPLING Document *sdoc = theApplication.OpenJSONFile(sampling_state); if (! sdoc) { @@ -153,9 +228,9 @@ main(int argc, char * argv[]) theSampler->LoadStateFromDocument(*sdoc); - // sampling state is loaded from an external file + // load datasets DatasetsP theDatasets = Datasets::NewP(); - theDatasets->LoadFromJSON(*sdoc); + theDatasets->LoadFromJSON(*ddoc); theDatasets->Commit(); // Create a list of sampling Visualizations that specifies how the volume is to be sampled... @@ -179,8 +254,14 @@ main(int argc, char * argv[]) RenderingP r = Rendering::NewP(); r = Rendering::NewP(); r->SetTheOwner(0); - r->SetTheSize(width >> downsample, height >> downsample); r->SetTheDatasets(theDatasets); + if (override_samplesize) + { + std::cerr << "Overriding sampling width, height: " << sam_width << ", " << sam_height << std::endl; + c->set_width(sam_width); + c->set_height(sam_height); + } + // this call now sets size r->SetTheCamera(c); r->SetTheVisualization(v); r->Commit(); @@ -206,8 +287,17 @@ main(int argc, char * argv[]) theSampler->Start(theSamplingRenderingSet); theSamplingRenderingSet->WaitForDone(); - // Now the 'samples' particle set contains the samples. Save it to the datasets samples->Commit(); + + if (sdata != "") + { + VolumeP vdata = Volume::Cast(theDatasets->Find(sdata)); + InterpolateVolumeOntoGeometry(samples, vdata); + samples->Commit(); + } + + // Now the 'samples' particle set contains the samples. Save it to the datasets + theDatasets->Insert("samples", samples); theDatasets->Commit(); @@ -223,32 +313,21 @@ main(int argc, char * argv[]) RungeKuttaP rkp = RungeKutta::NewP(); rkp->set_max_steps(maxsteps); rkp->set_stepsize(h); - rkp->set_minlen(z); + rkp->SetMinVelocity(z); + rkp->SetMaxIntegrationTime(t); if (! rkp->SetVectorField(Volume::Cast(theDatasets->Find("vectors")))) exit(1); rkp->Commit(); - -#if 0 - vec3f pts[10]; - pts[0].x = 0.0; pts[0].y = 0.0; pts[0].z = 0.0; - rkp->Trace(1, pts); -#else rkp->Trace(samples); -#endif - std::cerr << "max integration time: " << rkp->get_maximum_integration_time() << "\n"; - if (max_i == -1) max_i = rkp->get_maximum_integration_time(); - - PathLinesP plp = PathLines::NewP(); + float tMax = rkp->get_maximum_integration_time(); + std::cerr << "max integration time: " << tMax << "\n"; - TraceToPathLines(rkp, plp); - plp->Commit(); - - theDatasets->Insert("pathlines", plp); - theDatasets->Commit(); + if (max_i == -1) max_i = tMax; + dt = dt * max_i; // And now on to rendering... @@ -261,18 +340,6 @@ main(int argc, char * argv[]) // Create a list of sampling Visualizations that specifies how the volume is to be sampled... vector theRenderingVisualizations = Visualization::LoadVisualizationsFromJSON(*rdoc); - - for (auto v : theRenderingVisualizations) - { - for (auto i = 0; i < v->GetNumberOfVis(); i++) - { - MappedVisP mvp = MappedVis::Cast(v->GetVis(i)); - if (mvp) - mvp->ScaleMaps(0.0, max_i); - } - v->Commit(theDatasets); - } - // read in a set of cameras which are used to sample the data vector theRenderingCameras; Camera::LoadCamerasFromJSON(*rdoc, theRenderingCameras); @@ -280,31 +347,72 @@ main(int argc, char * argv[]) for (auto c : theRenderingCameras) c->Commit(); - // Create a rendering set for the sampling pass... - RenderingSetP theRenderingRenderingSet = RenderingSet::NewP(); + PathLinesP plp = PathLines::NewP(); - for (auto v : theRenderingVisualizations) - for (auto c : theRenderingCameras) - { - RenderingP r = Rendering::NewP(); - r = Rendering::NewP(); - r->SetTheOwner(0); - r->SetTheSize(width, height); - r->SetTheDatasets(theDatasets); - r->SetTheCamera(c); - r->SetTheVisualization(v); - r->Commit(); + for (auto f = 0; f < nf; f ++) + { + float head_time = (nf == 1) ? max_i : (max_i * (f + 1)) / nf; + + // Create a rendering set for the rendering pass... + RenderingSetP rs = RenderingSet::NewP(); + + TraceToPathLines(rkp, plp, head_time, dt); + plp->Commit(); - theRenderingRenderingSet->AddRendering(r); + if (pdata != "") + { + VolumeP vdata = Volume::Cast(theDatasets->Find(pdata)); + InterpolateVolumeOntoGeometry(plp, vdata); + plp->Commit(); } - theRenderingRenderingSet->Commit(); + theDatasets->Insert("pathlines", plp); + theDatasets->Commit(); + + for (auto v : theRenderingVisualizations) + { + for (auto i = 0; i < v->GetNumberOfVis(); i++) + { + MappedVisP mvp = MappedVis::Cast(v->GetVis(i)); + if (mvp) + mvp->ScaleMaps(0.0, max_i); + } + v->Commit(theDatasets); + } - // Render, wait, and write results + for (auto v : theRenderingVisualizations) + for (auto c : theRenderingCameras) + { + RenderingP r = Rendering::NewP(); + r->SetTheOwner(0); + r->SetTheDatasets(theDatasets); + if (override_windowsize) + { + std::cerr << "Overriding rendering width, height: " << width << ", " << height << std::endl; + c->set_width(width); + c->set_height(height); + } + r->SetTheCamera(c); + r->SetTheVisualization(v); + r->Commit(); + + rs->AddRendering(r); + } + + rs->Commit(); + + // Render, wait, and write results + + // if (f == (nf-1)) + { + theRenderer->Start(rs); + rs->WaitForDone(); - theRenderer->Start(theRenderingRenderingSet); - theRenderingRenderingSet->WaitForDone(); - theRenderingRenderingSet->SaveImages(string("samples")); + char namebuf[100]; + sprintf(namebuf, "samples-%04d", f); + rs->SaveImages(string(namebuf)); + } + } theApplication.QuitApplication(); } diff --git a/src/tracer/tester.cpp b/src/tracer/tester.cpp index d9b12ddd..9d6ef8ba 100644 --- a/src/tracer/tester.cpp +++ b/src/tracer/tester.cpp @@ -58,6 +58,8 @@ syntax(char *a) cerr << " -S seeds.csv seeds (csv with header line) (none)" << endl; cerr << " -P x y z single seed to trace (0.0, 0.0, 0.0)" << endl; cerr << " -T dump local trajectories to stderr (no)" << endl; + cerr << " -z z termination magnitude of vectors (1e-12)" << endl; + cerr << " -t t max integration time (none)" << endl; cerr << " -I max scale the colormap to this to avoid hairballs (scale to max integration time)\n"; exit(1); } @@ -75,9 +77,11 @@ int main(int argc, char *argv[]) int nsteps = 2000; float h = 0.2; float z = 1e-12; + float t = -1; float X = 0.0, Y = 0.0, Z = 0.0; bool dump_trajectories = false; float max_i = -1; + bool override_windowsize = false; ospInit(&argc, (const char **)argv); @@ -90,11 +94,18 @@ int main(int argc, char *argv[]) else if (!strcmp(argv[i],"-m")) nsteps = atoi(argv[++i]); else if (!strcmp(argv[i],"-h")) h = atof(argv[++i]); else if (!strcmp(argv[i],"-z")) z = atof(argv[++i]); - else if (!strcmp(argv[i],"-s")) width = atoi(argv[++i]), height = atoi(argv[++i]); + else if (!strcmp(argv[i],"-s")) + { + width = atoi(argv[++i]); + height = atoi(argv[++i]); + override_windowsize = true; + } else if (!strcmp(argv[i],"-S")) seedfile = argv[++i]; else if (!strcmp(argv[i],"-P")) X = atof(argv[++i]), Y = atof(argv[++i]), Z = atof(argv[++i]); else if (!strcmp(argv[i],"-T")) dump_trajectories = true; else if (!strcmp(argv[i],"-I")) max_i = atof(argv[++i]); + else if (!strcmp(argv[i],"-z")) z = atof(argv[++i]); + else if (!strcmp(argv[i],"-t")) t = atof(argv[++i]); else if (!strcmp(argv[i],"--")) syntax(argv[0]); else statefile = argv[i]; } @@ -147,7 +158,8 @@ int main(int argc, char *argv[]) RungeKuttaP rkp = RungeKutta::NewP(); rkp->set_max_steps(nsteps); rkp->set_stepsize(h); - rkp->set_minlen(z); + rkp->SetMinVelocity(z); + rkp->SetMaxIntegrationTime(t); if (! rkp->SetVectorField(Volume::Cast(theDatasets->Find("vectors")))) exit(1); @@ -215,7 +227,7 @@ int main(int argc, char *argv[]) PathLinesP plp = PathLines::NewP(); - TraceToPathLines(rkp, plp); + TraceToPathLines(rkp, plp, 1e10, 1e10); plp->Commit(); theDatasets->Insert("pathlines", plp); @@ -245,7 +257,11 @@ int main(int argc, char *argv[]) RenderingP r = Rendering::NewP(); r = Rendering::NewP(); r->SetTheOwner(0); - r->SetTheSize(width, height); + if (override_windowsize) + { + c->set_width(width); + c->set_height(height); + } r->SetTheDatasets(theDatasets); r->SetTheCamera(c); r->SetTheVisualization(v); diff --git a/tests/create_data_driven_datasets.vpy b/tests/create_data_driven_datasets.vpy index 4a1ce6a5..7bb94e48 100755 --- a/tests/create_data_driven_datasets.vpy +++ b/tests/create_data_driven_datasets.vpy @@ -57,11 +57,11 @@ def SetVectors(d, name): def Names(d): pd = d.GetPointData() if pd.GetScalars() != None: - print 'scalars:', pd.GetScalars().GetName() + print('scalars:', pd.GetScalars().GetName()) if pd.GetVectors() != None: - print 'vectors:', pd.GetVectors().GetName() + print('vectors:', pd.GetVectors().GetName()) for i in range(pd.GetNumberOfArrays()): - print i, ": ", pd.GetArray(i).GetName() + print(i, ": ", pd.GetArray(i).GetName()) def do_particles(id): SetScalars(id, 'eightBalls')