/*
 * 
 *                  xxxxxxx      xxxxxxx
 *                   x:::::x    x:::::x 
 *                    x:::::x  x:::::x  
 *                     x:::::xx:::::x   
 *                      x::::::::::x    
 *                       x::::::::x     
 *                       x::::::::x     
 *                      x::::::::::x    
 *                     x:::::xx:::::x   
 *                    x:::::x  x:::::x  
 *                   x:::::x    x:::::x 
 *              THE xxxxxxx      xxxxxxx TOOLKIT
 *                    
 *                  http://www.goXTK.com
 *                   
 * Copyright (c) 2012 The X Toolkit Developers <dev@goXTK.com>
 *                   
 *    The X Toolkit (XTK) is licensed under the MIT License:
 *      http://www.opensource.org/licenses/mit-license.php
 * 
 *      "Free software" is a matter of liberty, not price.
 *      "Free" as in "free speech", not as in "free beer".
 *                                         - Richard M. Stallman
 * 
 * FUELED BY:
 *  - the wonderful Constructive Solid Geometry library by Evan Wallace (http://madebyevan.com)
 *    LICENSE: https://raw.github.com/xtk/X/master/lib/csg/LICENSE
 *
 *  - parts of the Google Closure Library (http://code.google.com/closure/library)
 *    LICENSE: https://raw.github.com/xtk/google-closure-library/master/LICENSE
 *
 *  - zlib.js, the ultimate gzip/zlib javascript implementation (https://github.com/imaya/zlib.js)
 *    LICENSE: https://raw.github.com/imaya/zlib.js/master/LICENSE
 *
 * MORE CREDITS: https://raw.github.com/xtk/X/master/LICENSE
 *
 */
function n(a){throw a;}var p=void 0,q=!0,t=null,u=!1;function da(){return function(){}}function ea(a){return function(b){this[a]=b}}function v(a){return function(){return this[a]}}var w,fa=this;function ga(){}
function ha(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ia(a){return a!==p}function ka(a){return"array"==ha(a)}function la(a){var b=ha(a);return"array"==b||"object"==b&&"number"==typeof a.length}function ma(a){return"string"==typeof a}function x(a){return"number"==typeof a}function na(a){return"function"==ha(a)}function oa(a){var b=typeof a;return"object"==b&&a!=t||"function"==b}function pa(a){return a[qa]||(a[qa]=++ra)}var qa="closure_uid_"+(1E9*Math.random()>>>0),ra=0;
function sa(a,b,c){return a.call.apply(a.bind,arguments)}function ta(a,b,c){a||n(Error());if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function ua(a,b,c){ua=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?sa:ta;return ua.apply(t,arguments)}
function va(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}}var wa=Date.now||function(){return+new Date};function B(a,b){var c=a.split("."),d=fa;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&ia(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}
function C(a,b){function c(){}c.prototype=b.prototype;a.v=b.prototype;a.prototype=new c;a.prototype.constructor=a};function xa(a,b,c){this.Qa=this.Pa=this.Oa=0;3==arguments.length?(this.Oa=Number(a),this.Pa=Number(b),this.Qa=Number(c)):a instanceof xa?(this.Oa=Number(a.x()),this.Pa=Number(a.y()),this.Qa=Number(a.d())):(this.Oa=Number(a[0]),this.Pa=Number(a[1]),this.Qa=Number(a[2]))}
xa.prototype={k:function(){return new xa(this.Oa,this.Pa,this.Qa)},Xb:function(a){return this.Oa*a.x()+this.Pa*a.y()+this.Qa*a.d()},he:function(a,b){return za(this,Aa(Ba(a,this),b))},length:function(){return Math.sqrt(this.Xb(this))},hc:function(a){return new xa(this.Pa*a.d()-this.Qa*a.y(),this.Qa*a.x()-this.Oa*a.d(),this.Oa*a.y()-this.Pa*a.x())},x:v("Oa"),y:v("Pa"),d:v("Qa")};function Ca(a){var b=a.length();return new xa(a.Oa/b,a.Pa/b,a.Qa/b)}
function Aa(a,b){return new xa(a.Oa*b,a.Pa*b,a.Qa*b)}function Ba(a,b){return new xa(a.Oa-b.x(),a.Pa-b.y(),a.Qa-b.d())}function za(a,b){return new xa(a.Oa+b.x(),a.Pa+b.y(),a.Qa+b.d())}function Da(a){return new xa(-a.Oa,-a.Pa,-a.Qa)};var E=E||{};E.Sj=q;E.Xa=function(a){eval("X.DEV === undefined")||window.console.time(a)};E.Ra=function(a){eval("X.DEV === undefined")||window.console.timeEnd(a)};window["X.counter"]=new function(){this.Gh=0;this.Oj=function(){return this.Gh++}};function Ea(a,b){for(var c in b){var d=b.__lookupGetter__(c),e=b.__lookupSetter__(c);c in a||(d||e?(d&&a.__defineGetter__(c,d),e&&a.__defineSetter__(c,e)):a[c]=b[c])}}var Fa=window.vh;
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c?this:a||window,e.concat(d.call(arguments)))}function c(){}"function"!==typeof this&&n(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var d=Array.prototype.slice,e=d.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
for(var Ga=0,Ha=["ms","moz","webkit","o"],Ia=0;Ia<Ha.length&&!window.requestAnimationFrame;++Ia)window.requestAnimationFrame=window[Ha[Ia]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[Ha[Ia]+"CancelAnimationFrame"]||window[Ha[Ia]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=Date.now(),c=Math.max(0,16-(b-Ga)),d=window.setTimeout(function(){a(b+c)},c);Ga=b+c;return d});
window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});
"slice"in ArrayBuffer.prototype||(ArrayBuffer.prototype.slice=function(a,b){a===p&&n(Error("Not enough arguments."));var c=b||this.byteLength;0>a&&(a=this.byteLength+a);0>c&&(c=this.byteLength+c);c<a&&(c=a=0);0>a&&(a=0);0>c&&(c=0);a>this.byteLength&&(a=this.byteLength);c>this.byteLength&&(c=this.byteLength);for(var d=new ArrayBuffer(c-a),e=new Uint8Array(this),f=new Uint8Array(d),g=a,h=0;g<c;++g,++h)f[h]=e[g];return d});B("$",Fa);B("Function.prototype.bind",Function.prototype.bind);
B("window.requestAnimationFrame",window.requestAnimationFrame);B("window.cancelAnimationFrame",window.cancelAnimationFrame);var Ja=0;function Ka(){}w=Ka.prototype;w.key=0;w.lc=u;w.Vd=u;w.ua=function(a,b,c,d,e,f){na(a)?this.Jg=q:a&&a.handleEvent&&na(a.handleEvent)?this.Jg=u:n(Error("Invalid listener argument"));this.Yb=a;this.ah=b;this.src=c;this.type=d;this.capture=!!e;this.ff=f;this.Vd=u;this.key=++Ja;this.lc=u};w.handleEvent=function(a){return this.Jg?this.Yb.call(this.ff||this.src,a):this.Yb.handleEvent.call(this.Yb,a)};function La(a,b){for(var c in a)b.call(p,a[c],c,a)}function Ma(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}var Oa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Pa(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<Oa.length;f++)c=Oa[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function Qa(a){if(!Ra.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Sa,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(Ta,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(Ua,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(Va,"&quot;"));return a}var Sa=/&/g,Ta=/</g,Ua=/>/g,Va=/\"/g,Ra=/[&<>\"]/;var Wa,Xa,Ya,Za,$a,ab,cb;function db(){return fa.navigator?fa.navigator.userAgent:t}function eb(){return fa.navigator}Za=Ya=Xa=Wa=u;var fb;if(fb=db()){var gb=eb();Wa=0==fb.indexOf("Opera");Xa=!Wa&&-1!=fb.indexOf("MSIE");Ya=!Wa&&-1!=fb.indexOf("WebKit");Za=!Wa&&!Ya&&"Gecko"==gb.product}var ib=Wa,I=Xa,jb=Za,kb=Ya,mb,nb=eb();mb=nb&&nb.platform||"";$a=-1!=mb.indexOf("Mac");ab=-1!=mb.indexOf("Win");cb=-1!=mb.indexOf("Linux");var ob=!!eb()&&-1!=(eb().appVersion||"").indexOf("X11");
function pb(){var a=fa.document;return a?a.documentMode:p}var qb;a:{var rb="",sb;if(ib&&fa.opera)var tb=fa.opera.version,rb="function"==typeof tb?tb():tb;else if(jb?sb=/rv\:([^\);]+)(\)|;)/:I?sb=/MSIE\s+([^\);]+)(\)|;)/:kb&&(sb=/WebKit\/(\S+)/),sb)var ub=sb.exec(db()),rb=ub?ub[1]:"";if(I){var vb=pb();if(vb>parseFloat(rb)){qb=String(vb);break a}}qb=rb}var wb={};
function xb(a){var b;if(!(b=wb[a])){b=0;for(var c=String(qb).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",l=RegExp("(\\d*)(\\D*)","g"),k=RegExp("(\\d*)(\\D*)","g");do{var j=l.exec(g)||["","",""],m=k.exec(h)||["","",""];if(0==j[0].length&&0==m[0].length)break;b=((0==j[1].length?0:parseInt(j[1],10))<(0==m[1].length?0:parseInt(m[1],10))?-1:(0==j[1].length?0:parseInt(j[1],
10))>(0==m[1].length?0:parseInt(m[1],10))?1:0)||((0==j[2].length)<(0==m[2].length)?-1:(0==j[2].length)>(0==m[2].length)?1:0)||(j[2]<m[2]?-1:j[2]>m[2]?1:0)}while(0==b)}b=wb[a]=0<=b}return b}var yb=fa.document,zb=!yb||!I?p:pb()||("CSS1Compat"==yb.compatMode?parseInt(qb,10):5);var Ab=!I||I&&9<=zb,Bb=I&&!xb("9");!kb||xb("528");jb&&xb("1.9b")||I&&xb("8")||ib&&xb("9.5")||kb&&xb("528");jb&&!xb("8")||I&&xb("9");var Cb=Array.prototype,Db=Cb.indexOf?function(a,b,c){return Cb.indexOf.call(a,b,c)}:function(a,b,c){c=c==t?0:0>c?Math.max(0,a.length+c):c;if(ma(a))return!ma(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Eb=Cb.forEach?function(a,b,c){Cb.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=ma(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Gb=Cb.map?function(a,b,c){return Cb.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=
ma(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Hb=Cb.some?function(a,b,c){return Cb.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=ma(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return q;return u};function Ib(a,b){var c=Db(a,b);0<=c&&Cb.splice.call(a,c,1)}function Jb(a,b,c){return 2>=arguments.length?Cb.slice.call(a,b):Cb.slice.call(a,b,c)};function Kb(){0!=Lb&&(this.Sk=Error().stack,pa(this))}var Lb=0;function Mb(a,b){this.type=a;this.currentTarget=this.target=b}w=Mb.prototype;w.kc=u;w.defaultPrevented=u;w.me=q;w.stopPropagation=function(){this.kc=q};w.preventDefault=function(){this.defaultPrevented=q;this.me=u};function Nb(a){Nb[" "](a);return a}Nb[" "]=ga;function Ob(a,b){a&&this.ua(a,b)}C(Ob,Mb);w=Ob.prototype;w.target=t;w.relatedTarget=t;w.offsetX=0;w.offsetY=0;w.clientX=0;w.clientY=0;w.screenX=0;w.screenY=0;w.button=0;w.keyCode=0;w.charCode=0;w.ctrlKey=u;w.altKey=u;w.shiftKey=u;w.metaKey=u;w.vj=u;w.kb=t;
w.ua=function(a,b){var c=this.type=a.type;Mb.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(jb){var e;a:{try{Nb(d.nodeName);e=q;break a}catch(f){}e=u}e||(d=t)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=kb||a.offsetX!==p?a.offsetX:a.layerX;this.offsetY=kb||a.offsetY!==p?a.offsetY:a.layerY;this.clientX=a.clientX!==p?a.clientX:a.pageX;this.clientY=a.clientY!==p?a.clientY:a.pageY;this.screenX=
a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.vj=$a?a.metaKey:a.ctrlKey;this.state=a.state;this.kb=a;a.defaultPrevented&&this.preventDefault();delete this.kc};w.stopPropagation=function(){Ob.v.stopPropagation.call(this);this.kb.stopPropagation?this.kb.stopPropagation():this.kb.cancelBubble=q};
w.preventDefault=function(){Ob.v.preventDefault.call(this);var a=this.kb;if(a.preventDefault)a.preventDefault();else if(a.returnValue=u,Bb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};w.qi=v("kb");var Pb={},Qb={},Rb={},Sb={};function M(a,b,c,d,e){if(ka(b)){for(var f=0;f<b.length;f++)M(a,b[f],c,d,e);return t}a=Tb(a,b,c,u,d,e);b=a.key;Pb[b]=a;return b}
function Tb(a,b,c,d,e,f){b||n(Error("Invalid event type"));e=!!e;var g=Qb;b in g||(g[b]={ha:0,Ga:0});g=g[b];e in g||(g[e]={ha:0,Ga:0},g.ha++);var g=g[e],h=pa(a),l;g.Ga++;if(g[h]){l=g[h];for(var k=0;k<l.length;k++)if(g=l[k],g.Yb==c&&g.ff==f){if(g.lc)break;d||(l[k].Vd=u);return l[k]}}else l=g[h]=[],g.ha++;var j=Ub,m=Ab?function(a){return j.call(m.src,m.Yb,a)}:function(a){a=j.call(m.src,m.Yb,a);if(!a)return a},k=m,g=new Ka;g.ua(c,k,a,b,e,f);g.Vd=d;k.src=a;k.Yb=g;l.push(g);Rb[h]||(Rb[h]=[]);Rb[h].push(g);
a.addEventListener?(a==fa||!a.customEvent_)&&a.addEventListener(b,k,e):a.attachEvent(b in Sb?Sb[b]:Sb[b]="on"+b,k);return g}function Vb(a,b,c,d,e){if(ka(b))for(var f=0;f<b.length;f++)Vb(a,b[f],c,d,e);else a=Tb(a,b,c,q,d,e),Pb[a.key]=a}function Wb(a,b,c,d,e){if(ka(b))for(var f=0;f<b.length;f++)Wb(a,b[f],c,d,e);else{d=!!d;a:{f=Qb;if(b in f&&(f=f[b],d in f&&(f=f[d],a=pa(a),f[a]))){a=f[a];break a}a=t}if(a)for(f=0;f<a.length;f++)if(a[f].Yb==c&&a[f].capture==d&&a[f].ff==e){Xb(a[f].key);break}}}
function Xb(a){var b=Pb[a];if(!b||b.lc)return u;var c=b.src,d=b.type,e=b.ah,f=b.capture;c.removeEventListener?(c==fa||!c.customEvent_)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(d in Sb?Sb[d]:Sb[d]="on"+d,e);c=pa(c);Rb[c]&&(e=Rb[c],Ib(e,b),0==e.length&&delete Rb[c]);b.lc=q;if(b=Qb[d][f][c])b.Rg=q,Yb(d,f,c,b);delete Pb[a];return q}
function Yb(a,b,c,d){if(!d.je&&d.Rg){for(var e=0,f=0;e<d.length;e++)d[e].lc?d[e].ah.src=t:(e!=f&&(d[f]=d[e]),f++);d.length=f;d.Rg=u;0==f&&(delete Qb[a][b][c],Qb[a][b].ha--,0==Qb[a][b].ha&&(delete Qb[a][b],Qb[a].ha--),0==Qb[a].ha&&delete Qb[a])}}function Zb(a,b){var c=pa(a),d=Rb[c];if(d){var e=ia(b),f=ia(p);return e&&f?(d=Qb[b],!!d&&!!d[p]&&c in d[p]):!e&&!f?q:Hb(d,function(a){return e&&a.type==b||f&&a.capture==p})}return u}
function $b(a,b,c,d,e){var f=1;b=pa(b);if(a[b]){var g=--a.Ga,h=a[b];h.je?h.je++:h.je=1;try{for(var l=h.length,k=0;k<l;k++){var j=h[k];j&&!j.lc&&(f&=ac(j,e)!==u)}}finally{a.Ga=Math.max(g,a.Ga),h.je--,Yb(c,d,b,h)}}return Boolean(f)}function ac(a,b){a.Vd&&Xb(a.key);return a.handleEvent(b)}
function Ub(a,b){if(a.lc)return q;var c=a.type,d=Qb;if(!(c in d))return q;var d=d[c],e,f;if(!Ab){var g;if(!(g=b))a:{g=["window","event"];for(var h=fa;e=g.shift();)if(h[e]!=t)h=h[e];else{g=t;break a}g=h}e=g;g=q in d;h=u in d;if(g){if(0>e.keyCode||e.returnValue!=p)return q;a:{var l=u;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(k){l=q}if(l||e.returnValue==p)e.returnValue=q}}l=new Ob;l.ua(e,this);e=q;try{if(g){for(var j=[],m=l.currentTarget;m;m=m.parentNode)j.push(m);f=d[q];f.Ga=f.ha;for(var s=j.length-
1;!l.kc&&0<=s&&f.Ga;s--)l.currentTarget=j[s],e&=$b(f,j[s],c,q,l);if(h){f=d[u];f.Ga=f.ha;for(s=0;!l.kc&&s<j.length&&f.Ga;s++)l.currentTarget=j[s],e&=$b(f,j[s],c,u,l)}}else e=ac(a,l)}finally{j&&(j.length=0)}return e}c=new Ob(b,this);return e=ac(a,c)}var bc=0;function cc(a){return a+"_"+bc++};function dc(){Kb.call(this);this.Vk={};this.Qk=this}C(dc,Kb);dc.prototype.customEvent_=q;w=dc.prototype;w.vf=t;w.Bf=ea("vf");w.addEventListener=function(a,b,c,d){M(this,a,b,c,d)};w.removeEventListener=function(a,b,c,d){Wb(this,a,b,c,d)};
w.dispatchEvent=function(a){var b=a.type||a,c=Qb;if(b in c){if(ma(a))a=new Mb(a,this);else if(a instanceof Mb)a.target=a.target||this;else{var d=a;a=new Mb(b,this);Pa(a,d)}var d=1,e,c=c[b],b=q in c,f;if(b){e=[];for(f=this;f;f=f.vf)e.push(f);f=c[q];f.Ga=f.ha;for(var g=e.length-1;!a.kc&&0<=g&&f.Ga;g--)a.currentTarget=e[g],d&=$b(f,e[g],a.type,q,a)&&a.me!=u}if(u in c)if(f=c[u],f.Ga=f.ha,b)for(g=0;!a.kc&&g<e.length&&f.Ga;g++)a.currentTarget=e[g],d&=$b(f,e[g],a.type,u,a)&&a.me!=u;else for(e=this;!a.kc&&
e&&f.Ga;e=e.vf)a.currentTarget=e,d&=$b(f,e,a.type,u,a)&&a.me!=u;a=Boolean(d)}else a=q;return a};function P(){dc.call(this);this.f="base";this.qa=window["X.counter"].Oj();this.h=u}C(P,dc);P.prototype.__defineGetter__("classname",v("f"));P.prototype.__defineGetter__("id",v("qa"));B("X.base",P);function ec(a,b){this.Ma=new xa(a);this.na=new xa(b)}ec.prototype={k:function(){return new ec(this.Ma.k(),this.na.k())},jc:function(){this.na=Da(this.na)}};function fc(a,b){this.na=a;this.Ad=b}fc.prototype={k:function(){return new fc(this.na.k(),this.Ad)},jc:function(){this.na=Da(this.na);this.Ad=-this.Ad}};function gc(a,b){this.Gb=a;this.te=b;var c=a[0].Ma,d=a[2].Ma,d=Ca(Ba(a[1].Ma,c).hc(Ba(d,c)));this.La=new fc(d,d.Xb(c))}gc.prototype={k:function(){var a=this.Gb.map(function(a){return a.k()});return new gc(a,this.te)},jc:function(){this.Gb.reverse().map(function(a){a.jc()});this.La.jc()}};
function hc(a,b,c,d,e,f){for(var g=0,h=[],l=0;l<a.Gb.length;l++){var k=b.na.Xb(a.Gb[l].Ma)-b.Ad,k=-1E-5>k?2:1E-5<k?1:0,g=g|k;h.push(k)}switch(g){case 0:(0<b.na.Xb(a.La.na)?c:d).push(a);break;case 1:e.push(a);break;case 2:f.push(a);break;case 3:c=[];d=[];for(l=0;l<a.Gb.length;l++){var j=(l+1)%a.Gb.length,k=h[l],m=h[j],g=a.Gb[l],j=a.Gb[j];2!=k&&c.push(g);1!=k&&d.push(2!=k?g.k():g);3==(k|m)&&(k=(b.Ad-b.na.Xb(g.Ma))/b.na.Xb(Ba(j.Ma,g.Ma)),k=new ec(g.Ma.he(j.Ma,k),g.na.he(j.na,k)),c.push(k),d.push(k.k()))}3<=
c.length&&e.push(new gc(c,a.te));3<=d.length&&f.push(new gc(d,a.te))}};function ic(a){this.sa=this.ta=this.La=t;this.P=[];a&&jc(this,a)}ic.prototype={k:function(){var a=new ic,b=this.La&&this.La.k();a.La=b;b=this.ta&&this.ta.k();a.ta=b;b=this.sa&&this.sa.k();a.sa=b;a.re(this.P.map(function(a){return a.k()}));return a},O:function(){for(var a=0;a<this.P.length;a++)this.P[a].jc();this.La.jc();this.ta&&this.ta.O();this.sa&&this.sa.O();a=this.ta;this.ta=this.sa;this.sa=a},re:ea("P")};
function jc(a,b){if(b.length){a.La||(a.La=b[0].La.k());for(var c=[],d=[],e=0;e<b.length;e++)hc(b[e],a.La,a.P,a.P,c,d);c.length&&(a.ta||(a.ta=new ic),jc(a.ta,c));d.length&&(a.sa||(a.sa=new ic),jc(a.sa,d))}}function kc(a){var b=a.P.slice();a.ta&&(b=b.concat(kc(a.ta)));a.sa&&(b=b.concat(kc(a.sa)));return b}function lc(a,b){a.P=mc(b,a.P);a.ta&&lc(a.ta,b);a.sa&&lc(a.sa,b)}
function mc(a,b){if(!a.La)return b.slice();for(var c=[],d=[],e=0;e<b.length;e++)hc(b[e],a.La,c,d,c,d);a.ta&&(c=mc(a.ta,c));d=a.sa?mc(a.sa,d):[];return c.concat(d)};function nc(){this.P=[]}function oc(a){var b=new nc;b.re(a);return b}
nc.prototype={k:function(){var a=new nc;a.re(this.P.map(function(a){return a.k()}));return a},Kf:function(a){var b=new ic(this.k().P);a=new ic(a.k().P);lc(b,a);lc(a,b);a.O();lc(a,b);a.O();jc(b,kc(a));return oc(kc(b))},Aa:function(a){var b=new ic(this.k().P);a=new ic(a.k().P);b.O();lc(b,a);lc(a,b);a.O();lc(a,b);a.O();jc(b,kc(a));b.O();return oc(kc(b))},hf:function(a){var b=new ic(this.k().P);a=new ic(a.k().P);b.O();lc(a,b);a.O();lc(b,a);lc(a,b);jc(b,kc(a));b.O();return oc(kc(b))},inverse:function(){var a=
this.k();a.P.map(function(a){a.jc()});return a},re:ea("P")};function pc(){P.call(this);this.f="indexer";this.Re=[];this.Jk=[];this.Za={}}C(pc,P);pc.prototype.add=function(a){a==t&&n(Error("Invalid object."));var b=window.JSON.stringify(a);b in this.Za||(this.Za[b]=this.Re.length,this.Re.push(a));return this.Za[b]};pc.prototype.unique=v("Re");function qc(a){P.call(this);this.f="file";this.Od=a;this.h=q}C(qc,P);function rc(){this.mb=this.r=t}rc.prototype.__defineSetter__("file",function(a){if(a==t||ka(a)&&0==a.length)this.r=t;else{if(ka(a)){if(1==a.length){this.r=new qc(a[0]);return}this.r=Gb(a,function(a){var c=new S;c.r=new qc(a);return c})}else this.r=new qc(a);this.mb=t}});rc.prototype.__defineGetter__("file",function(){return!this.r?"":ka(this.r)?this.r.map(function(a){return a.r.Od}):this.r.Od});
rc.prototype.__defineGetter__("filedata",function(){return ka(this.r)?this.r.map(function(a){return a.mb}):this.mb});rc.prototype.__defineSetter__("filedata",function(a){if(a==t||ka(a)&&0==a.length)this.mb=t;if(ka(a))if(1==a.length)this.mb=a[0];else{var b=this.r.length,c;for(c=0;c<b;c++)this.r[c].mb=a[c]}else this.mb=a});function sc(a){if("function"==typeof a.rd)return a.rd();if(ma(a))return a.split("");if(la(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Ma(a)};function tc(a,b){this.Z={};this.K=[];var c=arguments.length;if(1<c){c%2&&n(Error("Uneven number of arguments"));for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.Te(a)}w=tc.prototype;w.ha=0;w.Mf=0;w.ae=v("ha");w.rd=function(){uc(this);for(var a=[],b=0;b<this.K.length;b++)a.push(this.Z[this.K[b]]);return a};function vc(a){for(var b=0;b<a.K.length;b++){var c=a.K[b];if(wc(a.Z,c)&&a.Z[c]==u)return q}return u}w.clear=function(){this.Z={};this.Mf=this.ha=this.K.length=0};
w.remove=function(a){return wc(this.Z,a)?(delete this.Z[a],this.ha--,this.Mf++,this.K.length>2*this.ha&&uc(this),q):u};function uc(a){if(a.ha!=a.K.length){for(var b=0,c=0;b<a.K.length;){var d=a.K[b];wc(a.Z,d)&&(a.K[c++]=d);b++}a.K.length=c}if(a.ha!=a.K.length){for(var e={},c=b=0;b<a.K.length;)d=a.K[b],wc(e,d)||(a.K[c++]=d,e[d]=1),b++;a.K.length=c}}w.get=function(a,b){return wc(this.Z,a)?this.Z[a]:b};w.set=function(a,b){wc(this.Z,a)||(this.ha++,this.K.push(a),this.Mf++);this.Z[a]=b};
w.Te=function(a){var b;if(a instanceof tc)uc(a),b=a.K.concat(),a=a.rd();else{b=[];var c=0,d;for(d in a)b[c++]=d;a=Ma(a)}for(c=0;c<b.length;c++)this.set(b[c],a[c])};w.k=function(){return new tc(this)};w.Jf=function(){for(var a=new tc,b=0;b<this.K.length;b++){var c=this.K[b];a.set(this.Z[c],c)}return a};function wc(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function xc(){P.call(this);this.f="colortable";this.Za=new tc;Ea(this,new rc)}C(xc,P);xc.prototype.add=function(a,b,c,d,e,f){(!x(a)||!x(c)||!x(d)||!x(e)||!x(f))&&n(Error("Invalid color table entry."));this.Za.set(a,[b,c,d,e,f]);this.h=q};xc.prototype.get=function(a){return this.Za.get(a)};B("X.colortable.prototype.get",xc.prototype.get);function yc(a,b,c){this.x=ia(a)?a:0;this.y=ia(b)?b:0;this.d=ia(c)?c:0}yc.prototype.k=function(){return new yc(this.x,this.y,this.d)};function T(a,b,c){this.x=a;this.y=b;this.d=c}C(T,yc);w=T.prototype;w.k=function(){return new T(this.x,this.y,this.d)};w.Db=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.d*this.d)};w.scale=function(a){this.x*=a;this.y*=a;this.d*=a;return this};w.O=function(){this.x=-this.x;this.y=-this.y;this.d=-this.d;return this};w.normalize=function(){return this.scale(1/this.Db())};w.add=function(a){this.x+=a.x;this.y+=a.y;this.d+=a.d;return this};
w.Aa=function(a){this.x-=a.x;this.y-=a.y;this.d-=a.d;return this};function zc(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.d-b.d;return Math.sqrt(c*c+d*d+e*e)}function Ac(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.d-b.d;return c*c+d*d+e*e}function Bc(a,b){return new T(a.x+b.x,a.y+b.y,a.d+b.d)}function Cc(a,b){return new T(a.y*b.d-a.d*b.y,a.d*b.x-a.x*b.d,a.x*b.y-a.y*b.x)};E.l=T;w=E.l.prototype;w.k=T.prototype.k;w.Db=T.prototype.Db;w.scale=T.prototype.scale;w.O=T.prototype.O;w.add=T.prototype.add;w.Aa=T.prototype.Aa;w.normalize=function(){var a=this.Db();return 0==a?this.scale(0):this.scale(1/a)};E.l.Xb=function(a,b){return a.x*b.x+a.y*b.y+a.d*b.d};E.l.hc=Cc;E.l.ef=zc;E.l.he=function(a,b,c){return new T(a.x+c*(b.x-a.x),a.y+c*(b.y-a.y),a.d+c*(b.d-a.d))};E.l.prototype.__defineGetter__("xx",v("x"));E.l.prototype.__defineGetter__("yy",v("y"));
E.l.prototype.__defineGetter__("zz",v("d"));B("X.vector",E.l);B("X.vector.prototype.clone",E.l.prototype.k);B("X.vector.prototype.magnitude",E.l.prototype.Db);B("X.vector.prototype.scale",E.l.prototype.scale);B("X.vector.prototype.invert",E.l.prototype.O);B("X.vector.prototype.normalize",E.l.prototype.normalize);B("X.vector.prototype.add",E.l.prototype.add);B("X.vector.prototype.subtract",E.l.prototype.Aa);B("X.vector.dot",E.l.Xb);B("X.vector.cross",E.l.hc);B("X.vector.distance",E.l.ef);
B("X.vector.lerp",E.l.he);function Dc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Dc.prototype.BYTES_PER_ELEMENT=8;Dc.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};Dc.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{Dc.BYTES_PER_ELEMENT=8}catch(Ec){}Dc.prototype.BYTES_PER_ELEMENT=Dc.prototype.BYTES_PER_ELEMENT;Dc.prototype.set=Dc.prototype.set;Dc.prototype.toString=Dc.prototype.toString;B("Float64Array",Dc)};function Ic(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Ic.prototype.BYTES_PER_ELEMENT=4;Ic.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};Ic.prototype.toString=Array.prototype.join;"undefined"==typeof Float32Array&&(Ic.BYTES_PER_ELEMENT=4,Ic.prototype.BYTES_PER_ELEMENT=Ic.prototype.BYTES_PER_ELEMENT,Ic.prototype.set=Ic.prototype.set,Ic.prototype.toString=Ic.prototype.toString,B("Float32Array",Ic));function Jc(a,b,c){var d=new Float32Array(3);d[0]=a;d[1]=b;d[2]=c;return d}function Kc(a,b){var c=a[0],d=a[1],e=a[2],c=1/Math.sqrt(c*c+d*d+e*e);b[0]=a[0]*c;b[1]=a[1]*c;b[2]=a[2]*c};function Lc(){return new Float32Array(4)}function Mc(a,b,c,d){var e=Lc();e[0]=a;e[1]=b;e[2]=c;e[3]=d;return e};function Nc(){return new Float32Array(16)}function Oc(){var a=Nc();a[0]=a[5]=a[10]=a[15]=1;return a}function Pc(a,b,c,d,e,f,g,h,l,k,j,m,s,r,z,y,D){a[0]=b;a[1]=c;a[2]=d;a[3]=e;a[4]=f;a[5]=g;a[6]=h;a[7]=l;a[8]=k;a[9]=j;a[10]=m;a[11]=s;a[12]=r;a[13]=z;a[14]=y;a[15]=D;return a}function Qc(a,b,c){b*=4;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3]}function Rc(a,b,c){b*=4;c[0]=a[b];c[1]=a[b+1];c[2]=a[b+2];c[3]=a[b+3]}function Sc(a,b,c,d,e,f){a[b]=c;a[b+4]=d;a[b+8]=e;a[b+12]=f}
function Tc(a,b,c){a[b]=c[0];a[b+4]=c[1];a[b+8]=c[2];a[b+12]=c[3]}function Uc(a,b,c){c[0]=a[b];c[1]=a[b+4];c[2]=a[b+8];c[3]=a[b+12]}
function Vc(a,b,c){var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],l=a[5],k=a[6],j=a[7],m=a[8],s=a[9],r=a[10],z=a[11],y=a[12],D=a[13],F=a[14];a=a[15];var H=b[0],A=b[1],G=b[2],J=b[3],K=b[4],R=b[5],N=b[6],W=b[7],aa=b[8],Z=b[9],ba=b[10],L=b[11],O=b[12],Q=b[13],hb=b[14];b=b[15];c[0]=d*H+h*A+m*G+y*J;c[1]=e*H+l*A+s*G+D*J;c[2]=f*H+k*A+r*G+F*J;c[3]=g*H+j*A+z*G+a*J;c[4]=d*K+h*R+m*N+y*W;c[5]=e*K+l*R+s*N+D*W;c[6]=f*K+k*R+r*N+F*W;c[7]=g*K+j*R+z*N+a*W;c[8]=d*aa+h*Z+m*ba+y*L;c[9]=e*aa+l*Z+s*ba+D*L;c[10]=f*aa+k*Z+r*ba+F*
L;c[11]=g*aa+j*Z+z*ba+a*L;c[12]=d*O+h*Q+m*hb+y*b;c[13]=e*O+l*Q+s*hb+D*b;c[14]=f*O+k*Q+r*hb+F*b;c[15]=g*O+j*Q+z*hb+a*b;return c}
function Wc(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],l=a[6],k=a[7],j=a[8],m=a[9],s=a[10],r=a[11],z=a[12],y=a[13],D=a[14],F=a[15],H=c*h-d*g,A=c*l-e*g,G=c*k-f*g,J=d*l-e*h,K=d*k-f*h,R=e*k-f*l,N=j*y-m*z,W=j*D-s*z,aa=j*F-r*z,Z=m*D-s*y,ba=m*F-r*y,L=s*F-r*D,O=H*L-A*ba+G*Z+J*aa-K*W+R*N;if(0==O)return u;O=1/O;b[0]=(h*L-l*ba+k*Z)*O;b[1]=(-d*L+e*ba-f*Z)*O;b[2]=(y*R-D*K+F*J)*O;b[3]=(-m*R+s*K-r*J)*O;b[4]=(-g*L+l*aa-k*W)*O;b[5]=(c*L-e*aa+f*W)*O;b[6]=(-z*R+D*G-F*A)*O;b[7]=(j*R-s*G+r*A)*O;b[8]=(g*ba-h*
aa+k*N)*O;b[9]=(-c*ba+d*aa-f*N)*O;b[10]=(z*K-y*G+F*H)*O;b[11]=(-j*K+m*G-r*H)*O;b[12]=(-g*Z+h*W-l*N)*O;b[13]=(c*Z-d*W+e*N)*O;b[14]=(-z*J+y*A-D*H)*O;b[15]=(j*J-m*A+s*H)*O;return q}function Xc(a,b,c){var d=b[0],e=b[1];b=b[2];c[0]=d*a[0]+e*a[4]+b*a[8]+a[12];c[1]=d*a[1]+e*a[5]+b*a[9]+a[13];c[2]=d*a[2]+e*a[6]+b*a[10]+a[14]}
function Yc(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];c[0]=d*a[0]+e*a[4]+f*a[8]+b*a[12];c[1]=d*a[1]+e*a[5]+f*a[9]+b*a[13];c[2]=d*a[2]+e*a[6]+f*a[10]+b*a[14];c[3]=d*a[3]+e*a[7]+f*a[11]+b*a[15];return c}function Zc(a,b,c,d){var e=a[1]*b+a[5]*c+a[9]*d+a[13],f=a[2]*b+a[6]*c+a[10]*d+a[14],g=a[3]*b+a[7]*c+a[11]*d+a[15];a[12]=a[0]*b+a[4]*c+a[8]*d+a[12];a[13]=e;a[14]=f;a[15]=g;return a}new Float64Array(3);new Float64Array(3);new Float64Array(4);new Float64Array(4);new Float64Array(4);new Float64Array(16);E.e={};E.e.Mg=function(a,b,c,d){c=c.Aa(b);c.normalize();d=E.l.hc(c,d);d.normalize();var e=E.l.hc(d,c);e.normalize();c.O();Sc(a,0,d.x,d.y,d.d,0);Sc(a,1,e.x,e.y,e.d,0);Sc(a,2,c.x,c.y,c.d,0);Zc(a,-b.x,-b.y,-b.d);return a};E.e.U=function(a,b,c,d){var e=1/(b*a[3]+c*a[7]+d*a[11]+a[15]);return new E.l((b*a[0]+c*a[4]+d*a[8]+a[12])*e,(b*a[1]+c*a[5]+d*a[9]+a[13])*e,(b*a[2]+c*a[6]+d*a[10]+a[14])*e)};
E.e.Mj=function(a,b,c){var d=new Float32Array(4),e=new Float32Array(4);Uc(a,b,d);Uc(a,c,e);Tc(a,b,e);Tc(a,c,d);return a};E.e.Lj=function(a,b,c){var d=new Float32Array(4),e=new Float32Array(4);Rc(a,b,d);Rc(a,c,e);Qc(a,b,e);Qc(a,c,d);return a};E.e.sd=Oc;E.e.k=function(a){var b=Nc();b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};
E.e.Jf=function(a,b){if(b==a){var c=a[1],d=a[2],e=a[3],f=a[6],g=a[7],h=a[11];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=c;b[6]=a[9];b[7]=a[13];b[8]=d;b[9]=f;b[11]=a[14];b[12]=e;b[13]=g;b[14]=h}else b[0]=a[0],b[1]=a[4],b[2]=a[8],b[3]=a[12],b[4]=a[1],b[5]=a[5],b[6]=a[9],b[7]=a[13],b[8]=a[2],b[9]=a[6],b[10]=a[10],b[11]=a[14],b[12]=a[3],b[13]=a[7],b[14]=a[11],b[15]=a[15];return b};
E.e.fi=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],l=a[7],k=a[8],j=a[9],m=a[10],s=a[11],r=a[12],z=a[13],y=a[14];a=a[15];return(b*g-c*f)*(m*a-s*y)-(b*h-d*f)*(j*a-s*z)+(b*l-e*f)*(j*y-m*z)+(c*h-d*g)*(k*a-s*r)-(c*l-e*g)*(k*y-m*r)+(d*l-e*h)*(k*z-j*r)};E.e.O=Wc;E.e.kf=function(a,b,c,d,e){var f=b/2;b=e-d;var g=Math.sin(f);if(0==b||0==g||0==c)return a;f=Math.cos(f)/g;return Pc(a,f/c,0,0,0,0,f,0,0,0,0,-(e+d)/b,-1,0,0,-(2*d*e)/b,0)};
E.e.Li=function(a,b,c,d,e,f,g){return Pc(a,2*f/(c-b),0,0,0,0,2*f/(e-d),0,0,(c+b)/(c-b),(e+d)/(e-d),-(g+f)/(g-f),-1,0,0,-(2*g*f)/(g-f),0)};E.e.Mi=function(a,b,c,d,e,f,g){return Pc(a,2/(c-b),0,0,0,0,2/(e-d),0,0,0,0,-2/(g-f),0,-(c+b)/(c-b),-(e+d)/(e-d),-(g+f)/(g-f),1)};E.e.multiply=Vc;E.e.Qg=Yc;E.e.translate=Zc;E.e.scale=function(a,b,c,d){return Pc(a,a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*c,a[5]*c,a[6]*c,a[7]*c,a[8]*d,a[9]*d,a[10]*d,a[11]*d,a[12],a[13],a[14],a[15])};
E.e.rotate=function(a,b,c,d,e){var f=a[0],g=a[1],h=a[2],l=a[3],k=a[4],j=a[5],m=a[6],s=a[7],r=a[8],z=a[9],y=a[10],D=a[11],F=Math.cos(b),H=Math.sin(b),A=1-F;b=c*c*A+F;var G=c*d*A+e*H,J=c*e*A-d*H,K=c*d*A-e*H,R=d*d*A+F,N=d*e*A+c*H,W=c*e*A+d*H;c=d*e*A-c*H;e=e*e*A+F;return Pc(a,f*b+k*G+r*J,g*b+j*G+z*J,h*b+m*G+y*J,l*b+s*G+D*J,f*K+k*R+r*N,g*K+j*R+z*N,h*K+m*R+y*N,l*K+s*R+D*N,f*W+k*c+r*e,g*W+j*c+z*e,h*W+m*c+y*e,l*W+s*c+D*e,a[12],a[13],a[14],a[15])};
E.e.ne=function(a,b){var c=a[4],d=a[5],e=a[6],f=a[7],g=a[8],h=a[9],l=a[10],k=a[11],j=Math.cos(b),m=Math.sin(b);a[4]=c*j+g*m;a[5]=d*j+h*m;a[6]=e*j+l*m;a[7]=f*j+k*m;a[8]=c*-m+g*j;a[9]=d*-m+h*j;a[10]=e*-m+l*j;a[11]=f*-m+k*j;return a};E.e.oe=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[8],h=a[9],l=a[10],k=a[11],j=Math.cos(b),m=Math.sin(b);a[0]=c*j+g*-m;a[1]=d*j+h*-m;a[2]=e*j+l*-m;a[3]=f*j+k*-m;a[8]=c*m+g*j;a[9]=d*m+h*j;a[10]=e*m+l*j;a[11]=f*m+k*j;return a};
E.e.pe=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],l=a[6],k=a[7],j=Math.cos(b),m=Math.sin(b);a[0]=c*j+g*m;a[1]=d*j+h*m;a[2]=e*j+l*m;a[3]=f*j+k*m;a[4]=c*-m+g*j;a[5]=d*-m+h*j;a[6]=e*-m+l*j;a[7]=f*-m+k*j;return a};B("X.matrix.identity",E.e.sd);B("X.matrix.clone",E.e.k);B("X.matrix.transpose",E.e.Jf);B("X.matrix.determinant",E.e.fi);B("X.matrix.invert",E.e.O);B("X.matrix.multiply",E.e.multiply);B("X.matrix.multiplyByVector",E.e.U);B("X.matrix.multiplyByVec4",E.e.Qg);
B("X.matrix.makePerspective",E.e.kf);B("X.matrix.makeFrustum",E.e.Li);B("X.matrix.makeOrtho",E.e.Mi);B("X.matrix.makeLookAt",E.e.Mg);B("X.matrix.translate",E.e.translate);B("X.matrix.scale",E.e.scale);B("X.matrix.rotate",E.e.rotate);B("X.matrix.rotateX",E.e.ne);B("X.matrix.rotateY",E.e.oe);B("X.matrix.rotateZ",E.e.pe);B("X.matrix.swapRows",E.e.Mj);B("X.matrix.swapCols",E.e.Lj);function $c(){P.call(this);this.f="transform";this.I=E.e.sd()}C($c,P);$c.prototype.__defineGetter__("matrix",v("I"));$c.prototype.__defineSetter__("matrix",function(a){(a==t||!(a instanceof Float32Array))&&n(Error("Invalid matrix."));this.I=a;this.q()});w=$c.prototype;w.ne=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));E.e.ne(this.I,a*Math.PI/180);this.q()};w.oe=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));E.e.oe(this.I,a*Math.PI/180);this.q()};
w.pe=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));E.e.pe(this.I,a*Math.PI/180);this.q()};w.ph=function(a){x(a)||n(Error("Invalid distance."));E.e.translate(this.I,a,0,0);this.q()};w.qh=function(a){x(a)||n(Error("Invalid distance."));E.e.translate(this.I,0,a,0);this.q()};w.rh=function(a){x(a)||n(Error("Invalid distance."));E.e.translate(this.I,0,0,a);this.q()};function ad(a,b,c){a.I[b+4*c]*=-1;a.q()}w.mi=function(){ad(this,0,0)};w.ni=function(){ad(this,1,1)};
w.oi=function(){ad(this,2,2)};w.q=function(){this.h=q};B("X.transform",$c);B("X.transform.prototype.rotateX",$c.prototype.ne);B("X.transform.prototype.rotateY",$c.prototype.oe);B("X.transform.prototype.rotateZ",$c.prototype.pe);B("X.transform.prototype.translateX",$c.prototype.ph);B("X.transform.prototype.translateY",$c.prototype.qh);B("X.transform.prototype.translateZ",$c.prototype.rh);B("X.transform.prototype.flipX",$c.prototype.mi);B("X.transform.prototype.flipY",$c.prototype.ni);
B("X.transform.prototype.flipZ",$c.prototype.oi);B("X.transform.prototype.modified",$c.prototype.q);function bd(){P.call(this);this.f="texture";this.Ub=this.Lb=this.r=t;this.Le=this.Me=0;this.Xf=u;Ea(this,new rc)}C(bd,P);bd.prototype.__defineSetter__("rawData",function(a){this.Ub=a;this.h=q});bd.prototype.__defineSetter__("rawDataHeight",function(a){this.Le=a;this.h=q});bd.prototype.__defineSetter__("rawDataWidth",function(a){this.Me=a;this.h=q});bd.prototype.__defineSetter__("grayscale",function(a){this.Xf=a;this.h=q});B("X.texture",bd);function U(a,b){P.call(this);this.f="triplets";this.eb=Infinity;this.$a=-Infinity;this.fb=Infinity;this.ab=-Infinity;this.gb=Infinity;this.bb=-Infinity;this.Ed=[0,0,0];this.Wf=q;this.L=0;this.X=new Float32Array(a);b!=t&&(this.X=b.X.subarray(0,b.X.length),this.L=this.X.length,this.eb=b.eb,this.$a=b.$a,this.fb=b.fb,this.ab=b.ab,this.gb=b.gb,this.bb=b.bb,this.Ed=b.Ed.slice(),this.Wf=u)}C(U,P);w=U.prototype;
w.add=function(a,b,c){this.eb=Math.min(this.eb,a);this.$a=Math.max(this.$a,a);this.fb=Math.min(this.fb,b);this.ab=Math.max(this.ab,b);this.gb=Math.min(this.gb,c);this.bb=Math.max(this.bb,c);this.Ed=[(this.eb+this.$a)/2,(this.fb+this.ab)/2,(this.gb+this.bb)/2];this.Wf=u;this.h=q;this.X[this.L++]=a;this.X[this.L++]=b;this.X[this.L++]=c;return this.L/3};w.Eb=function(){if(this.L!=this.X.length){var a=new Float32Array(this.L);a.set(this.X.subarray(0,this.L));this.X=a}};
w.get=function(a){a*=3;return[this.X[a],this.X[a+1],this.X[a+2]]};w.remove=function(){n(Error("Not implemented."))};w.clear=function(){this.X=new Float32Array(this.X.length);this.h=q};U.prototype.__defineGetter__("count",function(){this.Eb();return this.X.length/3});U.prototype.__defineGetter__("length",function(){this.Eb();return this.X.length});B("X.triplets",U);B("X.triplets.prototype.add",U.prototype.add);B("X.triplets.prototype.resize",U.prototype.Eb);B("X.triplets.prototype.get",U.prototype.get);
B("X.triplets.prototype.remove",U.prototype.remove);B("X.triplets.prototype.clear",U.prototype.clear);function cd(){this.ya=dd;this.aa=new $c;this.G=[1,1,1];this.Fc=this.T=this.ia=this.p=this.g=t;this.Ac=[];this.ka=q;this.zc=this.$c=1;this.qc=t;this.Rc=u;this.ra=1;this.pa=0;this.Zc=q}var dd="TRIANGLES";cd.prototype.__defineSetter__("type",function(a){return this.ya=a});cd.prototype.__defineGetter__("type",v("ya"));cd.prototype.__defineGetter__("texture",function(){this.T||(this.T=new bd);return this.T});cd.prototype.__defineGetter__("transform",v("aa"));cd.prototype.__defineGetter__("points",v("g"));
cd.prototype.__defineSetter__("points",ea("g"));cd.prototype.__defineGetter__("normals",v("p"));cd.prototype.__defineSetter__("normals",ea("p"));cd.prototype.__defineGetter__("colors",v("ia"));cd.prototype.__defineSetter__("colors",ea("ia"));cd.prototype.__defineGetter__("color",v("G"));cd.prototype.__defineSetter__("color",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid color."));for(var b=this.c,c=b.length,d=0,d=0;d<c;d++)b[d].color=a;this.G=a;this.h=q});
cd.prototype.__defineGetter__("opacity",v("ra"));cd.prototype.__defineSetter__("opacity",function(a){(!x(a)||1<a||0>a)&&n(Error("Invalid opacity."));for(var b=this.c,c=b.length,d=0,d=0;d<c;d++)b[d]!=t&&(b[d].opacity=a);this.ra=a;this.h=q});cd.prototype.__defineGetter__("caption",v("qc"));cd.prototype.__defineSetter__("caption",function(a){this.qc=a;this.h=q});cd.prototype.__defineGetter__("visible",v("ka"));
cd.prototype.__defineSetter__("visible",function(a){for(var b=this.c,c=b.length,d=0,d=0;d<c;d++)b[d]!=t&&(b[d].visible=a);this.ka=a;this.h=q});cd.prototype.__defineGetter__("pointsize",v("$c"));cd.prototype.__defineSetter__("pointsize",function(a){x(a)||n(Error("Invalid point size."));this.$c=a;this.h=q});cd.prototype.__defineGetter__("magicmode",v("Rc"));cd.prototype.__defineSetter__("magicmode",function(a){"boolean"!=typeof a&&n(Error("Invalid magic mode setting."));this.Rc=a;this.h=q});
cd.prototype.__defineGetter__("linewidth",v("zc"));cd.prototype.__defineSetter__("linewidth",function(a){x(a)||n(Error("Invalid line width."));this.zc=a;this.h=q});cd.prototype.__defineGetter__("pickable",v("Zc"));cd.prototype.__defineSetter__("pickable",function(a){"boolean"!=typeof a&&n(Error("Invalid pickable setting."));this.Zc=a;this.h=q});cd.prototype.__defineGetter__("textureCoordinateMap",v("Fc"));cd.prototype.__defineSetter__("textureCoordinateMap",ea("Ok"));function ed(){this.cb=Infinity;this.da=this.ja=-Infinity;this.ea=Infinity;this.Qb=[0,0,0];this.Ob=[1,1,1]}ed.prototype.__defineGetter__("lowerThreshold",v("da"));ed.prototype.__defineSetter__("lowerThreshold",ea("da"));ed.prototype.__defineGetter__("upperThreshold",v("ea"));ed.prototype.__defineSetter__("upperThreshold",ea("ea"));ed.prototype.__defineGetter__("min",v("cb"));ed.prototype.__defineGetter__("max",v("ja"));ed.prototype.__defineGetter__("minColor",v("Qb"));
ed.prototype.__defineSetter__("minColor",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid min. color."));this.Qb=a});ed.prototype.__defineGetter__("maxColor",v("Ob"));ed.prototype.__defineSetter__("maxColor",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid max. color."));this.Ob=a});function fd(){P.call(this);this.f="scalars";this.Pc=this.B=t;this.jg=q;this.ze=0;Ea(this,new rc);Ea(this,new ed);this.Qb=[0,1,0];this.Ob=[1,0,0]}C(fd,P);fd.prototype.__defineGetter__("array",v("B"));fd.prototype.__defineSetter__("array",function(a){this.Pc=this.B=a;this.h=q});fd.prototype.__defineGetter__("interpolation",v("ze"));fd.prototype.__defineSetter__("interpolation",ea("ze"));B("X.scalars",fd);function V(a){P.call(this);this.f="object";this.c=[];this.C=this.Ta=t;Ea(this,new cd);a!=t&&this.fc(a)}C(V,P);
V.prototype.fc=function(a){this.ya=a.ya;this.aa=new $c;this.aa.I=new Float32Array(a.aa.I);this.G=a.G.slice();a.g&&(this.g=new U(a.g.length,a.g));a.p&&(this.p=new U(a.p.length,a.p));a.ia&&(this.ia=new U(a.ia.length,a.ia));this.T=a.T;this.Fc=a.Fc;a.r&&(this.r=new qc((new String(a.r.Od)).toString()));this.ra=a.ra;this.c.length=0;var b=a.c;if(b)for(var c=b.length,d=0,d=0;d<c;d++)this.c.push(new E[b[d].f](b[d]));this.ka=a.ka;this.$c=a.$c;this.zc=a.zc;a.qc&&(this.qc=(new String(a.qc)).toString());this.Rc=
a.Rc;this.Zc=a.Zc;this.Ac=a.Ac.slice();this.h=q};V.prototype.__defineGetter__("colortable",function(){this.Ta||(this.Ta=new xc);return this.Ta});V.prototype.__defineGetter__("scalars",function(){this.C||(this.C=new fd);return this.C});V.prototype.__defineGetter__("children",v("c"));V.prototype.q=function(){var a=new gd;a.S=this;this.dispatchEvent(a)};V.prototype.remove=function(){var a=new hd;a.S=this;this.dispatchEvent(a)};
function id(a,b){(a==t||b==t||!(a instanceof V)||!(b instanceof V))&&n(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.ra?-1:1==b.ra?1:a.pa!=t&&b.pa!=t&&a.pa>b.pa?-1:1}B("X.object",V);B("X.object.prototype.modified",V.prototype.q);B("X.object.prototype.remove",V.prototype.remove);function jd(){}function kd(a){for(var b=a.g.count,c=[],d=0,d=0;d<b;d+=3){var e=a.g.get(d),f=a.g.get(d+1),g=a.g.get(d+2),h=a.p.get(d),l=a.p.get(d+1),k=a.p.get(d+2),j=a.G;a.ia&&0<a.ia.length&&(j=a.ia.get(d));var m=[];m.push(new ec(e,h));m.push(new ec(f,l));m.push(new ec(g,k));c.push(new gc(m,j))}return oc(c)}
function ld(a,b){(b==t||!(b instanceof nc))&&n(Error("Invalid CSG object."));var c=new pc,d=[];Gb(b.P,function(a){var b=[],g=a.te,b=Gb(a.Gb,function(a){a.color=g;return c.add(a)});for(a=a=2;a<b.length;a++)d.push([b[0],b[a-1],b[a]])}.bind(a));a.Fh=Gb(c.unique(),function(a){return[a.Ma.x(),a.Ma.y(),a.Ma.d()]});a.Eh=Gb(c.unique(),function(a){return[a.na.x(),a.na.y(),a.na.d()]});a.Dh=Gb(c.unique(),function(a){return!a.color?t:[a.color[0],a.color[1],a.color[2]]});a.g=new U(9*d.length);a.p=new U(9*d.length);
a.ia=new U(9*d.length);Gb(d,function(a){var b=a[0],c=a[1];a=a[2];var d=this.Fh,l=this.Eh,k=this.Dh;this.g.add(d[b][0],d[b][1],d[b][2]);this.g.add(d[c][0],d[c][1],d[c][2]);this.g.add(d[a][0],d[a][1],d[a][2]);this.p.add(l[b][0],l[b][1],l[b][2]);this.p.add(l[c][0],l[c][1],l[c][2]);this.p.add(l[a][0],l[a][1],l[a][2]);k[b]&&this.ia.add(k[b][0],k[b][1],k[b][2]);k[c]&&this.ia.add(k[c][0],k[c][1],k[c][2]);k[a]&&this.ia.add(k[a][0],k[a][1],k[a][2])}.bind(a));0==a.ia.L&&(a.ia=t);a.ya=dd}
jd.prototype.Kf=function(a){(a==t||!(a instanceof nc)&&!(a instanceof V))&&n(Error("Invalid object."));var b=a;a instanceof V&&(b=kd(b));a=new V;Ea(a,new jd);ld(a,kd(this).Kf(b));return a};jd.prototype.Aa=function(a){(a==t||!(a instanceof nc)&&!(a instanceof V))&&n(Error("Invalid object."));var b=a;a instanceof V&&(b=kd(b));a=new V;Ea(a,new jd);ld(a,kd(this).Aa(b));return a};
jd.prototype.hf=function(a){(a==t||!(a instanceof nc)&&!(a instanceof V))&&n(Error("Invalid object."));var b=a;a instanceof V&&(b=kd(b));a=new V;Ea(a,new jd);ld(a,kd(this).hf(b));return a};jd.prototype.inverse=function(){var a=new V;Ea(a,new jd);ld(a,kd(this).inverse());return a};B("X.constructable",jd);B("X.constructable.prototype.intersect",jd.prototype.hf);B("X.constructable.prototype.inverse",jd.prototype.inverse);B("X.constructable.prototype.subtract",jd.prototype.Aa);
B("X.constructable.prototype.union",jd.prototype.Kf);function md(a){Mb.call(this,a);this.f="event"}C(md,Mb);var nd=cc("pan"),od=cc("rotate"),pd=cc("zoom"),qd=cc("scroll");cc("render");var rd=cc("resetview"),sd=cc("windowlevel"),td=cc("modified"),ud=cc("remove"),vd=cc("progress"),wd=cc("hover"),xd=cc("hover_end");function yd(){md.call(this,sd);this.Ee=this.Se=0}C(yd,md);function zd(){md.call(this,nd);this.pa=new E.l(0,0,0)}C(zd,md);function Ad(){md.call(this,od);this.pa=new E.l(0,0,0)}C(Ad,md);function Bd(){md.call(this,pd);this.Ya=this.nb=u}C(Bd,md);
function Cd(){md.call(this,qd);this.Y=u}C(Cd,md);function Dd(){md.call(this,wd);this.Ud=this.Td=0}C(Dd,md);function Ed(){md.call(this,xd)}C(Ed,md);function Fd(){md.call(this,rd)}C(Fd,md);function gd(){md.call(this,td);this.z=this.S=t}C(gd,md);function hd(){md.call(this,ud);this.z=this.S=t}C(hd,md);function Gd(){md.call(this,vd);this.ng=0}C(Gd,md);B("X.event.events.PAN",nd);B("X.event.events.ROTATE",od);B("X.event.events.ZOOM",pd);B("X.event.events.SCROLL",qd);function Hd(){P.call(this);this.f="parser";this.J=t;this.L=0;this.Mh=0<(new Int8Array((new Int16Array([1])).buffer))[0];this.Kd=q;this.Lk=-Infinity;this.Kk=Infinity}C(Hd,P);Hd.prototype.parse=function(){n(Error("The function parse() should be overloaded."))};function Id(a){for(var b=Infinity,c=-Infinity,d=a.length,e=0,e=0;e<d;e++)if(!isNaN(a[e]))var f=a[e],b=Math.min(b,f),c=Math.max(c,f);return[b,c]}
function Jd(a,b,c){b===p&&(b=0);c===p&&(c=a.length);for(var d="",e=0,e=b;e<c;++e)d+=String.fromCharCode(a[e]);return d}
function Y(a,b,c){c!=t||(c=1);var d=1,e=Uint8Array;switch(b){case "schar":e=Int8Array;break;case "ushort":e=Uint16Array;d=2;break;case "sshort":e=Int16Array;d=2;break;case "uint":e=Uint32Array;d=4;break;case "sint":e=Int32Array;d=4;break;case "float":e=Float32Array;d=4;break;case "complex":e=Float64Array;d=8;break;case "double":e=Float64Array,d=8}b=new e(a.J.slice(a.L,a.L+=c*d));if(a.Mh!=a.Kd){a=b;b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(e=0;e<a.byteLength;e+=d)for(var f=e+d-1,g=e;f>
g;f--,g++){var h=b[g];b[g]=b[f];b[f]=h}b=a}return 1==c?b[0]:b}
function Kd(a,b){var c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],d=Mc(0,0,0,1),e=Lc();Yc(a,d,e);c[0]=e[0]<c[0]?e[0]:c[0];c[1]=e[0]>c[1]?e[0]:c[1];c[2]=e[1]<c[2]?e[1]:c[2];c[3]=e[1]>c[3]?e[1]:c[3];c[4]=e[2]<c[4]?e[2]:c[4];c[5]=e[2]>c[5]?e[2]:c[5];d=Mc(0,0,b[3],1);Yc(a,d,e);c[0]=e[0]<c[0]?e[0]:c[0];c[1]=e[0]>c[1]?e[0]:c[1];c[2]=e[1]<c[2]?e[1]:c[2];c[3]=e[1]>c[3]?e[1]:c[3];c[4]=e[2]<c[4]?e[2]:c[4];c[5]=e[2]>c[5]?e[2]:c[5];d=Mc(0,b[2],0,
1);Yc(a,d,e);c[0]=e[0]<c[0]?e[0]:c[0];c[1]=e[0]>c[1]?e[0]:c[1];c[2]=e[1]<c[2]?e[1]:c[2];c[3]=e[1]>c[3]?e[1]:c[3];c[4]=e[2]<c[4]?e[2]:c[4];c[5]=e[2]>c[5]?e[2]:c[5];d=Mc(b[1],0,0,1);Yc(a,d,e);c[0]=e[0]<c[0]?e[0]:c[0];c[1]=e[0]>c[1]?e[0]:c[1];c[2]=e[1]<c[2]?e[1]:c[2];c[3]=e[1]>c[3]?e[1]:c[3];c[4]=e[2]<c[4]?e[2]:c[4];c[5]=e[2]>c[5]?e[2]:c[5];d=Mc(b[1],b[2],0,1);Yc(a,d,e);c[0]=e[0]<c[0]?e[0]:c[0];c[1]=e[0]>c[1]?e[0]:c[1];c[2]=e[1]<c[2]?e[1]:c[2];c[3]=e[1]>c[3]?e[1]:c[3];c[4]=e[2]<c[4]?e[2]:c[4];c[5]=e[2]>
c[5]?e[2]:c[5];d=Mc(b[1],0,b[3],1);Yc(a,d,e);c[0]=e[0]<c[0]?e[0]:c[0];c[1]=e[0]>c[1]?e[0]:c[1];c[2]=e[1]<c[2]?e[1]:c[2];c[3]=e[1]>c[3]?e[1]:c[3];c[4]=e[2]<c[4]?e[2]:c[4];c[5]=e[2]>c[5]?e[2]:c[5];d=Mc(0,b[2],b[3],1);Yc(a,d,e);c[0]=e[0]<c[0]?e[0]:c[0];c[1]=e[0]>c[1]?e[0]:c[1];c[2]=e[1]<c[2]?e[1]:c[2];c[3]=e[1]>c[3]?e[1]:c[3];c[4]=e[2]<c[4]?e[2]:c[4];c[5]=e[2]>c[5]?e[2]:c[5];d=Mc(b[1],b[2],b[3],1);Yc(a,d,e);c[0]=e[0]<c[0]?e[0]:c[0];c[1]=e[0]>c[1]?e[0]:c[1];c[2]=e[1]<c[2]?e[1]:c[2];c[3]=e[1]>c[3]?e[1]:
c[3];c[4]=e[2]<c[4]?e[2]:c[4];c[5]=e[2]>c[5]?e[2]:c[5];return c}
function Ld(a,b){var c=Oc();if(!(a.length==b.length&&a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2])){var d=Math.acos(a[2]),e=new Float32Array(3),f=a[0],g=a[1],h=a[2],l=b[0],k=b[1],j=b[2];e[0]=g*j-h*k;e[1]=h*l-f*j;e[2]=f*k-g*l;Kc(e,e);f=Math.cos(d/2);g=Math.sin(d/2)*e[0];h=Math.sin(d/2)*e[1];d=Math.sin(d/2)*e[2];Sc(c,0,f*f+g*g-h*h-d*d,2*(g*h-f*d),2*(g*d+f*h),0);Sc(c,1,2*(g*h+f*d),f*f+h*h-g*g-d*d,2*(h*d-f*g),0);Sc(c,2,2*(g*d-f*h),2*(h*d+f*g),f*f+d*d-h*h-g*g,0)}d=Nc();Wc(c,d);return[c,d]}
function Md(a,b,c,d,e,f,g,h){var l=new Nd;Kc(b,b);for(var k=[],j=[],m=0;6>m;m++)for(var s=Math.floor(m/2),r=(s+1)%3,z=(s+2)%3,y=(4+2*s)%6,D=0;2>D;D++){var F=(2+D+2*s)%6,H=-(b[s]*(d[m]-a[s])+b[r]*(d[F]-a[r]))/b[z]+a[z];if(H>=d[y]&&H<=d[y+1]||H<=d[y]&&H>=d[y+1]){var A=[];A[s]=d[m];A[r]=d[F];A[z]=H;k.push(A)}else A=[],A[s]=d[m],A[r]=d[F],A[z]=H,j.push(A)}a=Jc(0,0,1);a=Ld(b,a);d=a[0];a=a[1];s=[];for(j=0;j<k.length;++j)m=Mc(k[j][0],k[j][1],k[j][2],1),r=Lc(),Yc(d,m,r),s.push([r[0],r[1],r[2]]);d=Jc(1,0,
0);k=new Float32Array(3);Xc(a,d,k);j=Jc(0,1,0);d=new Float32Array(3);Xc(a,j,d);m=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];for(j=j=0;j<s.length;++j)s[j][0]<m[0]&&(m[0]=s[j][0]),s[j][0]>m[1]&&(m[1]=s[j][0]),s[j][1]<m[2]&&(m[2]=s[j][1]),s[j][1]>m[3]&&(m[3]=s[j][1]),s[j][2]<m[4]&&(m[4]=s[j][2]),s[j][2]>m[5]&&(m[5]=s[j][2]);j=Mc(m[0]+(m[1]-m[0])/2,m[2]+(m[3]-m[2])/2,m[4]+(m[5]-m[4])/2,0);s=Lc();Vc(a,j,s);var r=Math.floor(m[0]),z=Math.ceil(m[1]),
y=z-r,D=Math.floor(m[2]),F=Math.ceil(m[3]),H=F-D,j=Math.ceil(y/1),G=Math.ceil(H/1),A=new Uint8Array(4*j*G),J=new bd;J.Me=j;J.Le=G;var G=Lc(),K=Mc(0,0,m[4],1),R=Nc();Vc(f.Ah,a,R);for(var N=F-1E-7,W=z-1E-7,aa=0,Z=0,ba=0,L=D,L=D;L<=N;L+=1){ba++;Z=0;K[1]=L;for(j=r;j<=W;j+=1){Z++;K[0]=j;Yc(R,K,G);var O=4*aa;if(0<=G[0]&&G[0]<f.M[0]&&0<=G[1]&&G[1]<f.M[1]&&0<=G[2]&&G[2]<f.M[2]){var Q=e[Math.floor(G[2])][Math.floor(G[1])][Math.floor(G[0])],hb=0,Fc=0,Gc=0,Hc=0;h?((Q=h.get(Q))||(Q=[0,0.61,0,0,1]),hb=255*Q[1],
Fc=255*Q[2],Gc=255*Q[3],Hc=255*Q[4]):(hb=Fc=Gc=255*(Q/f.ja),Hc=255);A[O]=hb;A[++O]=Fc;A[++O]=Gc;A[++O]=Hc}else A[O]=0,A[++O]=0,A[++O]=0,A[++O]=0;aa++}}J.Ub=A;l.T=J;l.Sh=m;l.Ch=a;l.Bh=R;l.Ih=D;l.Ik=F;l.Rh=r;l.Pk=z;l.Zf=Z;l.Yf=ba;l.Hc=1;l.D=y;l.uc=1;l.u=H;l.w=[s[0],s[1],s[2]];l.tc=[b[0],b[1],b[2]];l.Pd=[k[0],k[1],k[2]];l.Y=[d[0],d[1],d[2]];l.ka=u;l.Bb=f;l.zb=f.Bb!=t&&!g?u:q;l.pc=c;l.gc();l.ka=u;return l}
function Od(a,b,c,d){for(var e=d.Sa,f=[],g=[],h=0;6>h;h++){var l=Math.floor(h/2),k=(l+1)%3,j=(l+2)%3,m=(2+2*l)%6,s=(4+2*l)%6,r=(e[h]-b[l])*(1/c[l]);if(Infinity!=r&&-Infinity!=r){var z=b[k]+c[k]*r,r=b[j]+c[j]*r;z>=e[m]&&z<=e[m+1]&&r>=e[s]&&r<=e[s+1]?(m=[],m[l]=e[h],m[k]=z,m[j]=r,f.push(m)):(m=[],m[l]=e[h],m[k]=z,m[j]=r,g.push(m))}}b=[f,g];e=b[0];d.b[a].m=b;d.b[a].Ie=-(c[0]*e[0][0]+c[1]*e[0][1]+c[2]*e[0][2]);b=zc(new T(e[0][0],e[0][1],e[0][2]),new T(e[1][0],e[1][1],e[1][2]));d.b[a].Hk=b;e=Jc(0,0,1);
f=Ld(c,e)[0];g=Mc(d.we[0],d.we[1],d.we[2],0);e=Lc();Yc(f,g,e);f=Lc();g=e[2];f[0]=c[0]*g;f[1]=c[1]*g;f[2]=c[2]*g;f[3]=c[3]*g;d.b[a].Dc=e[2];d.b[a].W=f;c=Math.abs(Math.floor(b/e[2]));d.bd[a]=c;d.b[a].o=c;d.b[a].m[0][0][0]>d.b[a].m[0][1][0]?0<f[0]&&(c=d.b[a].m[0][0],d.b[a].m[0][0]=d.b[a].m[0][1],d.b[a].m[0][1]=c):d.b[a].m[0][0][0]<d.b[a].m[0][1][0]?0>f[0]&&(c=d.b[a].m[0][0],d.b[a].m[0][0]=d.b[a].m[0][1],d.b[a].m[0][1]=c):d.b[a].m[0][0][1]>d.b[a].m[0][1][1]?0<f[1]&&(c=d.b[a].m[0][0],d.b[a].m[0][0]=d.b[a].m[0][1],
d.b[a].m[0][1]=c):d.b[a].m[0][0][1]<d.b[a].m[0][1][1]?0>f[1]&&(c=d.b[a].m[0][0],d.b[a].m[0][0]=d.b[a].m[0][1],d.b[a].m[0][1]=c):d.b[a].m[0][0][2]>d.b[a].m[0][1][2]?0<f[2]&&(c=d.b[a].m[0][0],d.b[a].m[0][0]=d.b[a].m[0][1],d.b[a].m[0][1]=c):d.b[a].m[0][0][2]<d.b[a].m[0][1][2]&&0>f[2]&&(c=d.b[a].m[0][0],d.b[a].m[0][0]=d.b[a].m[0][1],d.b[a].m[0][1]=c)}
function Pd(a,b){var c;c=b.J;for(var d=b.M,e=b.ja,f=Array(d[2]),g=Array(d[2]),h=d[1]*d[0],l=0,k=0,j=0,m=0,s=0,m=0;m<d[2];m++){var r=c.subarray(m*h,(m+1)*h),s=0;g[m]=Array(d[1]);f[m]=Array(d[1]);for(j=0;j<d[1];j++){g[m][j]=new c.constructor(d[0]);f[m][j]=new c.constructor(d[0]);for(k=0;k<d[0];k++)l=r[s],g[m][j][k]=255*(l/e),f[m][j][k]=l,s++}}c=[f,g];b.Ba=c[0];b.Fk=c[1];E.Xa(a.f+".reslice");b.la=b.j!=t;b.Ta&&(b.Oc=b.Ta.Za);b.bl=[b.M[0],b.M[1],b.M[2]];b.t=[b.wa[0]+b.yb[0]/2,b.wa[1]+b.yb[1]/2,b.wa[2]+
b.yb[2]/2];b.Sa=[Math.min(b.wa[0],b.wa[0]+b.yb[0]),Math.max(b.wa[0],b.wa[0]+b.yb[0]),Math.min(b.wa[1],b.wa[1]+b.yb[1]),Math.max(b.wa[1],b.wa[1]+b.yb[1]),Math.min(b.wa[2],b.wa[2]+b.yb[2]),Math.max(b.wa[2],b.wa[2]+b.yb[2])];b.b=[{},{},{}];c=Jc(b.t[0],b.t[1],b.t[2]);b.b[0].dd=c;d=Jc(1,0,0);Kc(d,d);b.b[0].i=d;e=[1,1,0];b.b[0].G=e;Od(0,c,d,b);b.c[0].c=Array(b.b[0].o);c[0]=b.b[0].m[0][0][0]+b.b[0].W[0]*Math.round(b.b[0].o/2);c[1]=b.b[0].m[0][0][1]+b.b[0].W[1]*Math.round(b.b[0].o/2);c[2]=b.b[0].m[0][0][2]+
b.b[0].W[2]*Math.round(b.b[0].o/2);c=Md(c,b.b[0].i,b.b[0].G,b.Sa,b.Ba,b,b.la,b.Oc);b.la&&(c.j=b.j.c[0].c[Math.round(b.b[0].o/2)].T);b.c[0].c[Math.round(b.b[0].o/2)]=c;b.ob=Math.round(b.b[0].o/2);b.vc=Math.round(b.b[0].o/2);c=Jc(b.t[0],b.t[1],b.t[2]);b.b[1].dd=c;d=Jc(0,1,0);Kc(d,d);b.b[1].i=d;e=[1,0,0];b.b[1].G=e;Od(1,c,d,b);b.c[1].c=Array(b.b[1].o);c[0]=b.b[1].m[0][0][0]+b.b[1].W[0]*Math.round(b.b[1].o/2);c[1]=b.b[1].m[0][0][1]+b.b[1].W[1]*Math.round(b.b[1].o/2);c[2]=b.b[1].m[0][0][2]+b.b[1].W[2]*
Math.round(b.b[1].o/2);c=Md(c,b.b[1].i,b.b[1].G,b.Sa,b.Ba,b,b.la,b.Oc);b.la&&(c.j=b.j.c[1].c[Math.round(b.b[1].o/2)].T);b.c[1].c[Math.round(b.b[1].o/2)]=c;b.pb=Math.round(b.b[1].o/2);b.wc=Math.round(b.b[1].o/2);c=Jc(b.t[0],b.t[1],b.t[2]);b.b[2].dd=c;d=Jc(0,0,1);Kc(d,d);b.b[2].i=d;e=[0,1,0];b.b[2].G=e;Od(2,c,d,b);b.c[2].c=Array(b.b[2].o);c[0]=b.b[2].m[0][0][0]+b.b[2].W[0]*Math.round(b.b[2].o/2);c[1]=b.b[2].m[0][0][1]+b.b[2].W[1]*Math.round(b.b[2].o/2);c[2]=b.b[2].m[0][0][2]+b.b[2].W[2]*Math.round(b.b[2].o/
2);c=Md(c,b.b[2].i,b.b[2].G,b.Sa,b.Ba,b,b.la,b.Oc);b.la&&(c.j=b.j.c[2].c[Math.round(b.b[2].o/2)].T);b.c[2].c[Math.round(b.b[2].o/2)]=c;b.qb=Math.round(b.b[2].o/2);b.xc=Math.round(b.b[2].o/2);E.Ra(a.f+".reslice");return b.Ba};function Qd(){Hd.call(this);this.f="parserLBL"}C(Qd,Hd);
Qd.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");var d=b.Ac,e=d.length;0==e&&n(Error("No _pointIndices defined on the X.object."));this.J=c;var f=[],g=Y(this,"uchar",c.byteLength),h=g.length,l=u,k=0;for(c=1;c<h;c++)10==g[c-1]?(k=c,l=q):l&&32==g[c]&&(f.push(parseInt(Jd(g,k,c),10)),l=u);g=b.C.B?b.C.B:new Float32Array(e);h=f.length;for(c=0;c<h;c++)g[f[c]]=1;f=new Float32Array(3*e);for(c=h=0;c<e;c++)l=d[c],l>e&&n(Error("Could not find scalar for vertex.")),l=g[l],f[h++]=l,f[h++]=l,f[h++]=l;b.C.B=
g;b.C.Pc=f;b.C.h=q;E.Ra(this.f+".parse");d=new gd;d.S=b;d.z=a;this.dispatchEvent(d)};B("X.parserLBL",Qd);B("X.parserLBL.prototype.parse",Qd.prototype.parse);function Rd(a,b){this.x=ia(a)?a:0;this.y=ia(b)?b:0}w=Rd.prototype;w.k=function(){return new Rd(this.x,this.y)};function Sd(a,b){return new Rd(a.x-b.x,a.y-b.y)}w.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};w.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};w.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};
w.translate=function(a,b){a instanceof Rd?(this.x+=a.x,this.y+=a.y):(this.x+=a,x(b)&&(this.y+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.x*=a;this.y*=c;return this};function Td(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}w=Td.prototype;w.k=function(){return new Td(this.top,this.right,this.bottom,this.left)};w.contains=function(a){return!this||!a?u:a instanceof Td?a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom:a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom};
w.ceil=function(){this.top=Math.ceil(this.top);this.right=Math.ceil(this.right);this.bottom=Math.ceil(this.bottom);this.left=Math.ceil(this.left);return this};w.floor=function(){this.top=Math.floor(this.top);this.right=Math.floor(this.right);this.bottom=Math.floor(this.bottom);this.left=Math.floor(this.left);return this};w.round=function(){this.top=Math.round(this.top);this.right=Math.round(this.right);this.bottom=Math.round(this.bottom);this.left=Math.round(this.left);return this};
w.translate=function(a,b){a instanceof Rd?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(this.left+=a,this.right+=a,x(b)&&(this.top+=b,this.bottom+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.left*=a;this.right*=a;this.top*=c;this.bottom*=c;return this};function Ud(a,b){this.width=a;this.height=b}w=Ud.prototype;w.k=function(){return new Ud(this.width,this.height)};w.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};w.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};w.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};w.scale=function(a,b){var c=x(b)?b:a;this.width*=a;this.height*=c;return this};function Vd(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}w=Vd.prototype;w.k=function(){return new Vd(this.left,this.top,this.width,this.height)};w.Ig=function(a){var b=Math.max(this.left,a.left),c=Math.min(this.left+this.width,a.left+a.width);if(b<=c){var d=Math.max(this.top,a.top);a=Math.min(this.top+this.height,a.top+a.height);if(d<=a)return this.left=b,this.top=d,this.width=c-b,this.height=a-d,q}return u};
w.contains=function(a){return a instanceof Vd?this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height:a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height};function Wd(a,b){var c=b.x<a.left?a.left-b.x:Math.max(b.x-(a.left+a.width),0),d=b.y<a.top?a.top-b.y:Math.max(b.y-(a.top+a.height),0);return c*c+d*d}w.ef=function(a){return Math.sqrt(Wd(this,a))};
w.ceil=function(){this.left=Math.ceil(this.left);this.top=Math.ceil(this.top);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};w.floor=function(){this.left=Math.floor(this.left);this.top=Math.floor(this.top);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};w.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
w.translate=function(a,b){a instanceof Rd?(this.left+=a.x,this.top+=a.y):(this.left+=a,x(b)&&(this.top+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.left*=a;this.width*=a;this.top*=c;this.height*=c;return this};var Xd;function Yd(a,b){var c;c=a.className;c=ma(c)&&c.match(/\S+/g)||[];for(var d=Jb(arguments,1),e=c.length+d.length,f=c,g=0;g<d.length;g++)0<=Db(f,d[g])||f.push(d[g]);a.className=c.join(" ");return c.length==e};var Zd=!I||I&&9<=zb;!jb&&!I||I&&I&&9<=zb||jb&&xb("1.9.1");I&&xb("9");function $d(a){return a?new ae(be(a)):Xd||(Xd=new ae)}function ce(a){return ma(a)?document.getElementById(a):a}var de={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function ee(a,b,c){return fe(document,arguments)}
function fe(a,b){var c=b[0],d=b[1];if(!Zd&&d&&(d.name||d.type)){c=["<",c];d.name&&c.push(' name="',Qa(d.name),'"');if(d.type){c.push(' type="',Qa(d.type),'"');var e={};Pa(e,d);delete e.type;d=e}c.push(">");c=c.join("")}var f=a.createElement(c);d&&(ma(d)?f.className=d:ka(d)?Yd.apply(t,[f].concat(d)):La(d,function(a,b){"style"==b?f.style.cssText=a:"class"==b?f.className=a:"for"==b?f.htmlFor=a:b in de?f.setAttribute(de[b],a):0==b.lastIndexOf("aria-",0)||0==b.lastIndexOf("data-",0)?f.setAttribute(b,a):
f[b]=a}));if(2<b.length){d=function(b){b&&f.appendChild(ma(b)?a.createTextNode(b):b)};for(c=2;c<b.length;c++){var g=b[c];if(la(g)&&!(oa(g)&&0<g.nodeType)){var e=Eb,h;a:{if((h=g)&&"number"==typeof h.length){if(oa(h)){h="function"==typeof h.item||"string"==typeof h.item;break a}if(na(h)){h="function"==typeof h.item;break a}}h=u}if(h)if(h=g.length,0<h){for(var l=Array(h),k=0;k<h;k++)l[k]=g[k];g=l}else g=[];e(g,d)}else d(g)}}return f}function ge(a){a&&a.parentNode&&a.parentNode.removeChild(a)}
function he(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}function ie(a,b){if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||Boolean(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}function be(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function ae(a){this.ba=a||fa.document||document}w=ae.prototype;w.be=$d;w.s=function(a){return ma(a)?this.ba.getElementById(a):a};w.vh=ae.prototype.s;
w.Ic=function(a,b,c){return fe(this.ba,arguments)};w.createElement=function(a){return this.ba.createElement(a)};w.createTextNode=function(a){return this.ba.createTextNode(String(a))};function je(a){return"CSS1Compat"==a.ba.compatMode}function ke(a){var b=a.ba;a=!kb&&"CSS1Compat"==b.compatMode?b.documentElement:b.body;b=b.parentWindow||b.defaultView;return I&&xb("10")&&b.pageYOffset!=a.scrollTop?new Rd(a.scrollLeft,a.scrollTop):new Rd(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}
w.appendChild=function(a,b){a.appendChild(b)};w.contains=ie;function le(a,b){var c=be(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,t))?c[b]||c.getPropertyValue(b)||"":""}function me(a,b){return le(a,b)||(a.currentStyle?a.currentStyle[b]:t)||a.style&&a.style[b]}function ne(a){a=a?be(a):document;return I&&!(I&&9<=zb)&&!je($d(a))?a.body:a.documentElement}
function oe(a){var b=a.getBoundingClientRect();I&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function pe(a){if(I&&!(I&&8<=zb))return a.offsetParent;var b=be(a),c=me(a,"position"),d="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=me(a,"position"),d=d&&"static"==c&&a!=b.documentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return t}
function qe(a){for(var b=new Td(0,Infinity,Infinity,0),c=$d(a),d=c.ba.body,e=c.ba.documentElement,f=!kb&&"CSS1Compat"==c.ba.compatMode?c.ba.documentElement:c.ba.body;a=pe(a);)if((!I||0!=a.clientWidth)&&(!kb||0!=a.clientHeight||a!=d)&&a!=d&&a!=e&&"visible"!=me(a,"overflow")){var g=re(a),h;h=a;if(jb&&!xb("1.9")){var l=parseFloat(le(h,"borderLeftWidth"));if(se(h))var k=h.offsetWidth-h.clientWidth-l-parseFloat(le(h,"borderRightWidth")),l=l+k;h=new Rd(l,parseFloat(le(h,"borderTopWidth")))}else h=new Rd(h.clientLeft,
h.clientTop);g.x+=h.x;g.y+=h.y;b.top=Math.max(b.top,g.y);b.right=Math.min(b.right,g.x+a.clientWidth);b.bottom=Math.min(b.bottom,g.y+a.clientHeight);b.left=Math.max(b.left,g.x)}d=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,f);c=(c.ba.parentWindow||c.ba.defaultView||window).document;c="CSS1Compat"==c.compatMode?c.documentElement:c.body;c=new Ud(c.clientWidth,c.clientHeight);b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&
b.bottom>b.top&&b.right>b.left?b:t}
function re(a){var b,c=be(a),d=me(a,"position"),e=jb&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new Rd(0,0),g=ne(c);if(a==g)return f;if(a.getBoundingClientRect)b=oe(a),a=ke($d(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!e)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(g),f.x=b.screenX-a.screenX,f.y=b.screenY-a.screenY;else{b=a;do{f.x+=b.offsetLeft;f.y+=b.offsetTop;b!=a&&(f.x+=b.clientLeft||0,f.y+=b.clientTop||0);
if(kb&&"fixed"==me(b,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(ib||kb&&"absolute"==d)f.y-=c.body.offsetTop;for(b=a;(b=pe(b))&&b!=c.body&&b!=g;)if(f.x-=b.scrollLeft,!ib||"TR"!=b.tagName)f.y-=b.scrollTop}return f}
function te(a){var b=new Rd;if(1==a.nodeType){if(a.getBoundingClientRect){var c=oe(a);b.x=c.left;b.y=c.top}else{var c=ke($d(a)),d=re(a);b.x=d.x-c.x;b.y=d.y-c.y}if(jb&&!xb(12)){var e;I?e="-ms-transform":kb?e="-webkit-transform":ib?e="-o-transform":jb&&(e="-moz-transform");var f;e&&(f=me(a,e));f||(f=me(a,"transform"));f?(a=f.match(ue),a=!a?new Rd(0,0):new Rd(parseFloat(a[1]),parseFloat(a[2]))):a=new Rd(0,0);b=new Rd(b.x+a.x,b.y+a.y)}}else e=na(a.qi),f=a,a.targetTouches?f=a.targetTouches[0]:e&&a.kb.targetTouches&&
(f=a.kb.targetTouches[0]),b.x=f.clientX,b.y=f.clientY;return b}function ve(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}function we(a){if("none"!=me(a,"display"))return xe(a);var b=a.style,c=b.display,d=b.visibility,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=xe(a);b.display=c;b.position=e;b.visibility=d;return a}
function xe(a){var b=a.offsetWidth,c=a.offsetHeight,d=kb&&!b&&!c;return(!ia(b)||d)&&a.getBoundingClientRect?(a=oe(a),new Ud(a.right-a.left,a.bottom-a.top)):new Ud(b,c)}function ye(a,b){a.style.display=b?"":"none"}function se(a){return"rtl"==me(a,"direction")}function ze(a,b){if(/^\d+px?$/.test(b))return parseInt(b,10);var c=a.style.left,d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b;var e=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return e}
function Ae(a,b){var c=a.currentStyle?a.currentStyle[b]:t;return c?ze(a,c):0}var Be={thin:2,medium:4,thick:6};function Ce(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:t))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:t;return c in Be?Be[c]:ze(a,c)}var ue=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;function De(a,b){dc.call(this);this.A=a;var c=oa(this.A)&&1==this.A.nodeType?this.A:this.A?this.A.body:t;this.Ji=!!c&&se(c);this.Yk=M(this.A,jb?"DOMMouseScroll":"mousewheel",this,b)}C(De,dc);
De.prototype.handleEvent=function(a){var b=0,c=0,d=0;a=a.kb;if("mousewheel"==a.type){c=1;if(I||kb&&(ab||xb("532.0")))c=40;d=Ee(-a.wheelDelta,c);ia(a.wheelDeltaX)?(b=Ee(-a.wheelDeltaX,c),c=Ee(-a.wheelDeltaY,c)):c=d}else d=a.detail,100<d?d=3:-100>d&&(d=-3),ia(a.axis)&&a.axis===a.HORIZONTAL_AXIS?b=d:c=d;x(this.Ng)&&(b=Math.min(Math.max(b,-this.Ng),this.Ng));x(this.Og)&&(c=Math.min(Math.max(c,-this.Og),this.Og));this.Ji&&(b=-b);b=new Fe(d,a,b,c);this.dispatchEvent(b)};
function Ee(a,b){return kb&&($a||cb)&&0!=a%b?a:a/b}function Fe(a,b,c,d){b&&this.ua(b,p);this.type="mousewheel";this.detail=a;this.Tk=c;this.Jc=d}C(Fe,Ob);I||kb&&xb("525");function Ge(a){P.call(this);this.f="interactor";this.Ha=a;this.Fe=this.dg=this.cg=this.eg=this.bg=this.fg=t;this.Nd=q;this.Vb=this.Pb=this.rb=u;this.ma=[0,0];this.Ae=new E.l(0,0,0);this.Qc=new E.l(0,0,0);this.Kg=0;this.mg=this.Id=t;this.lg=u;this.Q={MOUSEWHEEL_ENABLED:q,MOUSECLICKS_ENABLED:q,KEYBOARD_ENABLED:q,HOVERING_ENABLED:q,CONTEXTMENU_ENABLED:u,TOUCH_ENABLED:q,TOUCH_BOUNCING_ENABLED:u}}C(Ge,P);Ge.prototype.__defineGetter__("config",v("Q"));Ge.prototype.__defineGetter__("leftButtonDown",v("rb"));
Ge.prototype.__defineGetter__("middleButtonDown",v("Pb"));Ge.prototype.__defineGetter__("rightButtonDown",v("Vb"));
Ge.prototype.ua=function(){this.Q.MOUSEWHEEL_ENABLED?(this.Fe=new De(this.Ha),this.fg=M(this.Fe,"mousewheel",this.ud.bind(this))):(Xb(this.fg),this.Fe=t);this.Q.MOUSECLICKS_ENABLED?(this.bg=M(this.Ha,"mousedown",this.Wi.bind(this)),this.eg=M(this.Ha,"mouseup",this.aj.bind(this))):(Xb(this.bg),Xb(this.eg));this.Ha.oncontextmenu=this.Q.CONTEXTMENU_ENABLED?t:function(){return u};window.onkeydown=this.Q.KEYBOARD_ENABLED?this.Ug.bind(this):t;this.Q.TOUCH_ENABLED?(this.Q.TOUCH_BOUNCING_ENABLED||document.body.addEventListener("touchmove",
function(a){a.preventDefault()},u),this.Qh=M(this.Ha,"touchstart",this.oj.bind(this)),this.Ph=M(this.Ha,"touchmove",this.mj.bind(this)),this.Oh=M(this.Ha,"touchend",this.ij.bind(this))):(Xb(this.Qh),Xb(this.Ph),Xb(this.Oh));Xb(this.cg);Xb(this.dg);this.cg=M(this.Ha,"mousemove",this.Yi.bind(this));this.dg=M(this.Ha,"mouseout",this.Zi.bind(this))};
Ge.prototype.Wi=function(a){0==a.button?this.rb=q:1==a.button?this.Pb=q:2==a.button&&(this.Vb=q);eval("this.onMouseDown("+this.rb+","+this.Pb+","+this.Vb+")");He(this);a.preventDefault()};Ge.prototype.Vi=da();Ge.prototype.aj=function(a){0==a.button?this.rb=u:1==a.button?this.Pb=u:2==a.button&&(this.Vb=u);eval("this.onMouseUp("+this.rb+","+this.Pb+","+this.Vb+")");He(this);a.preventDefault()};Ge.prototype.__defineGetter__("mousePosition",v("ma"));w=Ge.prototype;w.$i=da();
w.Zi=function(a){this.Nd=u;this.Q.KEYBOARD_ENABLED&&(window.onkeydown=t);this.Vb=this.Pb=this.rb=u;He(this);this.Ae=new E.l(0,0,0);a.preventDefault()};w.Xi=da();w.oj=function(a){a.preventDefault();a.ua(a.kb.targetTouches[0],a.currentTarget);eval("this.onTouchStart("+a.clientX+","+a.clientY+")");this.Qc=new E.l(a.clientX,a.clientY,0);this.mg=setTimeout(this.kj.bind(this,a),500)};w.nj=da();
w.kj=function(a){eval("this.onTouchHover("+a.clientX+","+a.clientY+")");a=new Bd;a.nb=q;a.Ya=this instanceof Ie;this.dispatchEvent(a);this.Qd=q};w.jj=da();function Je(a){clearTimeout(a.mg);if(a.Qd){var b=new Bd;b.nb=u;b.Ya=a instanceof Ie;a.dispatchEvent(b)}a.Qd=u}w.ij=function(a){a.preventDefault();eval("this.onTouchEnd()");Je(this)};w.hj=da();
w.mj=function(a){a.preventDefault();this.Qd||Je(this);this.touchmoveEvent=a=a.kb;eval("this.onTouchMove(this['touchmoveEvent'])");var b=a.targetTouches;if(1==b.length){a=b[0];var c=[a.clientX,a.clientY];a=new E.l(c[0],c[1],0);var b=c[0]>3*this.Ha.clientWidth/4,d=c[0]<this.Ha.clientWidth/4,e=c[1]<this.Ha.clientHeight/4,c=c[1]>3*this.Ha.clientHeight/4,c=!b&&!d&&!e&&!c,e=this.Qc.Aa(a);this.Qc=a.k();if(this.Qd)a=new zd,5<e.x?e.x=1:-5>e.x&&(e.x=-1),5<e.y?e.y=1:-5>e.y&&(e.y=-1),a.pa=e,this.dispatchEvent(a);
else if(this instanceof Me&&(b||d))a=new Cd,a.Y=0>e.y,this.dispatchEvent(a);else if(this instanceof Ie||c)e.scale(3),a=new Ad,a.pa=e,this.dispatchEvent(a)}else 2==b.length&&(a=b[0],b=b[1],a=[a.clientX,a.clientY],b=[b.clientX,b.clientY],a=new E.l(a[0],a[1],0),b=new E.l(b[0],b[1],0),e=Ac(a,b),b=e-this.Kg,this.Kg=e,this.Qc.Aa(a),this.Qc=a.k(),10<Math.abs(b)&&(a=new Bd,a.nb=0<b,a.Ya=this instanceof Ie,this.dispatchEvent(a)))};w.lj=da();
w.Yi=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.Nd=q;this.Q.KEYBOARD_ENABLED&&window.onkeydown==t&&(window.onkeydown=this.Ug.bind(this));a.preventDefault();var b=a.shiftKey;this.lg=b;this.ma=[a.offsetX,a.offsetY];var c=new E.l(this.ma[0],this.ma[1],0);a=this.Ae.Aa(c);this.Ae=c.k();this.Q.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.Pb||this.rb||this.Vb)&&He(this),this.Id=setTimeout(function(){He(this);var a=new Dd;a.Td=c.x;a.Ud=c.y;this.dispatchEvent(a);
this.Id=t}.bind(this),300));0!=a.Db()&&(this.rb&&!b?(b=new Ad,a.scale(3),b.pa=a,this.dispatchEvent(b)):this.Pb||this.rb&&b?(b=new zd,b.pa=a,this.dispatchEvent(b)):this.Vb&&(b=new Bd,b.nb=0<a.y,b.Ya=u,this.dispatchEvent(b)))};function He(a){a.Id&&clearTimeout(a.Id);a.dispatchEvent(new Ed)}w.bj=da();w.ud=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");He(this);a.preventDefault()};w.Ti=da();
w.Ug=function(a){if(this.Nd){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");He(this);var b=a.altKey,c=a.ctrlKey,d=a.metaKey,e=a.shiftKey,f=a.keyCode;82==f&&!b&&!c&&!d&&!e?(a.preventDefault(),a=new Fd,this.dispatchEvent(a)):37<=f&&40>=f&&(a.preventDefault(),e?a=new zd:b?a=new Bd:(a=new Ad,this instanceof Me&&(a=new Cd)),a&&(c=new E.l(0,0,0),37==f?(c.x=5,a.Y=u,b&&(a.Y=q,a.nb=q,a.Ya=u)):39==f?(c.x=-5,a.Y=q,b&&(a.nb=u,a.Ya=u)):38==f?(c.y=5,a.Y=q,b&&(a.nb=q,a.Ya=q)):40==f&&(c.y=-5,a.Y=u,b&&(a.nb=
u,a.Ya=q)),a.pa=c,this.dispatchEvent(a)))}};B("X.interactor",Ge);B("X.interactor.prototype.init",Ge.prototype.ua);B("X.interactor.prototype.onMouseDown",Ge.prototype.Vi);B("X.interactor.prototype.onMouseUp",Ge.prototype.$i);B("X.interactor.prototype.onMouseMove",Ge.prototype.Xi);B("X.interactor.prototype.onMouseWheel",Ge.prototype.bj);B("X.interactor.prototype.onKey",Ge.prototype.Ti);B("X.interactor.prototype.onTouchStart",Ge.prototype.nj);B("X.interactor.prototype.onTouchMove",Ge.prototype.lj);
B("X.interactor.prototype.onTouchEnd",Ge.prototype.hj);B("X.interactor.prototype.onTouchHover",Ge.prototype.jj);function Me(a){Ge.call(this,a);this.f="interactor2D"}C(Me,Ge);Me.prototype.ud=function(a){Me.v.ud.call(this,a);var b=new Cd;a.Jc==t&&(a.Jc=0);b.Y=0>a.Jc;this.dispatchEvent(b)};function Nd(a){V.call(this);this.f="slice";this.w=[0,0,0];this.tc=[0,0,1];this.Y=[0,1,0];this.Pd=[1,0,0];this.u=this.D=10;this.Fc=[0,1,0,0,1,1,1,1,1,0,0,0];this.j=this.Bb=t;this.zb=q;this.pc=[1,1,1];a!=t&&this.fc(a)}C(Nd,V);Nd.prototype.fc=function(a){this.w=a.w.slice();this.tc=a.tc.slice();this.Y=a.Y.slice();this.D=a.D;this.u=a.u;this.Bb=a.Bb;this.j=a.j;this.zb=a.zb;this.pc=a.pc;this.Hh=a.Hh;Nd.v.fc.call(this,a)};Nd.prototype.__defineSetter__("height",ea("u"));
Nd.prototype.__defineSetter__("width",ea("D"));Nd.prototype.create=function(){this.gc()};
Nd.prototype.gc=function(){var a=(new T(this.tc[0],this.tc[1],this.tc[2])).normalize(),b=new T(this.Y[0],this.Y[1],this.Y[2]),c=new T(this.Pd[0],this.Pd[1],this.Pd[2]),d=new T(this.w[0],this.w[1],this.w[2]),e=Bc(c.k().O().scale(this.D/2),b.k().O().scale(this.u/2)),f=new T(e.x+d.x,e.y+d.y,e.d+d.d),e=Bc(c.k().O().scale(this.D/2),b.k().scale(this.u/2)),g=new T(e.x+d.x,e.y+d.y,e.d+d.d),e=Bc(c.k().scale(this.D/2),b.k().O().scale(this.u/2)),h=new T(e.x+d.x,e.y+d.y,e.d+d.d),e=Bc(c.k().scale(this.D/2),b.k().scale(this.u/
2)),b=new T(e.x+d.x,e.y+d.y,e.d+d.d);this.g=new U(18);this.p=new U(18);this.g.add(f.x,f.y,f.d);this.g.add(g.x,g.y,g.d);this.g.add(h.x,h.y,h.d);this.g.add(h.x,h.y,h.d);this.g.add(b.x,b.y,b.d);this.g.add(g.x,g.y,g.d);this.p.add(a.x,a.y,a.d);this.p.add(a.x,a.y,a.d);this.p.add(a.x,a.y,a.d);this.p.add(a.x,a.y,a.d);this.p.add(a.x,a.y,a.d);this.p.add(a.x,a.y,a.d);this.zb&&(a=new V,a.g=new U(24),a.p=new U(24),a.g.add(f.x,f.y,f.d),a.g.add(g.x,g.y,g.d),a.g.add(g.x,g.y,g.d),a.g.add(b.x,b.y,b.d),a.g.add(b.x,
b.y,b.d),a.g.add(h.x,h.y,h.d),a.g.add(h.x,h.y,h.d),a.g.add(f.x,f.y,f.d),a.p.add(0,0,0),a.p.add(0,0,0),a.p.add(0,0,0),a.p.add(0,0,0),a.p.add(0,0,0),a.p.add(0,0,0),a.p.add(0,0,0),a.p.add(0,0,0),a.G=[this.pc[0],this.pc[1],this.pc[2]],a.ya="LINES",a.zc=2,this.c.push(a))};B("X.slice",Nd);B("X.slice.prototype.create",Nd.prototype.create);function S(a){V.call(this);this.f="volume";this.w=[0,0,0];this.M=[10,10,10];this.Sa=[1,1,1];this.bd=[10,10,10];this.jd=[1,1,1];this.Lb=[];this.xc=this.qb=this.wc=this.pb=this.vc=this.ob=0;this.fd=new V;this.gd=new V;this.hd=new V;this.Sd=this.ib=u;this.za=0;this.j=t;this.zb=q;this.ga=Infinity;this.fa=-Infinity;this.kg=q;this.ja=0;this.J=t;Ea(this,new rc);Ea(this,new ed);a!=t&&this.fc(a)}C(S,V);
S.prototype.fc=function(a){this.w=a.w.slice();this.M=a.M.slice();this.jd=a.jd.slice();this.ob=a.ob;this.vc=a.vc;this.pb=a.pb;this.wc=a.wc;this.qb=a.qb;this.xc=a.xc;this.Kh=a.Kh;this.Lh=a.Lh;this.Jh=a.Jh;this.Tf=a.Tf.slice();this.fd=new V(a.fd);this.gd=new V(a.gd);this.hd=new V(a.hd);this.ja=a.ja;this.J=a.J;this.ib=a.ib;this.Sd=a.Sd;this.za=a.za;this.j=a.j;this.zb=a.zb;S.v.fc.call(this,a)};
S.prototype.gc=function(a){this.c.length=0;this.fd.c.length=0;this.gd.c.length=0;this.hd.c.length=0;this.c.push(this.fd);this.c.push(this.gd);this.c.push(this.hd);this.wa=a.Cd;this.we=a.Dd;this.yb=a.Bd;this.oc=a.Hb;this.Ah=a.Ib;this.Mk=a.lh;this.Nk=a.Na;this.Ca=a.orientation;this.ja=a.max;this.J=a.data;this.h=q};
S.prototype.q=function(a){a="undefined"!==typeof a?a:q;if(0<this.c.length){this.ib!=this.Sd&&(this.ib?(this.c[0].c[parseInt(this.ob,10)].visible=u,this.c[1].c[parseInt(this.pb,10)].visible=u,this.c[2].c[parseInt(this.qb,10)].visible=u):this.c[this.za].visible=u,this.h=q,this.Sd=this.ib);if(!this.ka)return;if(this.ib)Ne(this,this.za);else for(var b=0,b=0;3>b;b++){var c=this.c[b],d=0,e=0;0==b?(d=this.ob,e=this.vc,this.vc=this.ob):1==b?(d=this.pb,e=this.wc,this.wc=this.pb):2==b&&(d=this.qb,e=this.xc,
this.xc=this.qb);if(this.c[b].c[parseInt(d,10)]==t){var f=new Float32Array(3);f[0]=this.b[b].m[0][0][0]+this.b[b].W[0]*parseInt(d,10);f[1]=this.b[b].m[0][0][1]+this.b[b].W[1]*parseInt(d,10);f[2]=this.b[b].m[0][0][2]+this.b[b].W[2]*parseInt(d,10);if(this.la){var g=Md(f,this.b[b].i,this.b[b].G,this.Sa,this.j.Ba,this.j,this.j.la,this.j.Ta.Za);this.j.c[b].c[parseInt(d,10)]=g;this.j.c[b].q(q)}f=Md(f,this.b[b].i,this.b[b].G,this.Sa,this.Ba,this,q,t);this.la&&(f.j=f.T,f.j=this.j.c[b].c[parseInt(d,10)].T);
c.c[parseInt(d,10)]=f;this.c[b].q(q)}c.c[parseInt(e,10)].visible=u;c=c.c[parseInt(d,10)];c.visible=q;c.ra=1}}a&&S.v.q.call(this)};S.prototype.__defineGetter__("dimensions",v("M"));S.prototype.__defineGetter__("bbox",v("Sa"));S.prototype.__defineGetter__("range",v("bd"));S.prototype.__defineGetter__("dimensionsRAS",v("Tf"));S.prototype.__defineGetter__("volumeRendering",v("ib"));S.prototype.__defineSetter__("volumeRendering",function(a){this.ib=a;this.q(u)});
S.prototype.__defineGetter__("visible",v("ka"));S.prototype.__defineSetter__("visible",function(a){if(a)this.ka=a,this.q(u);else{for(var b=this.c,c=b.length,d=0,d=0;d<c;d++)b[d].visible=a;this.ka=a;this.h=q}});S.prototype.__defineGetter__("center",v("w"));S.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center."));this.w=a});S.prototype.__defineGetter__("image",v("Lb"));
S.prototype.__defineGetter__("labelmap",function(){this.j||(this.j=new Oe(this));return this.j});S.prototype.__defineGetter__("indexX",v("ob"));S.prototype.__defineSetter__("indexX",function(a){x(a)&&(0<=a&&a<this.fd.c.length)&&(this.ob=a,this.q(u))});S.prototype.__defineGetter__("indexY",v("pb"));S.prototype.__defineSetter__("indexY",function(a){x(a)&&(0<=a&&a<this.gd.c.length)&&(this.pb=a,this.q(u))});S.prototype.__defineGetter__("indexZ",v("qb"));
S.prototype.__defineSetter__("indexZ",function(a){x(a)&&(0<=a&&a<this.hd.c.length)&&(this.qb=a,this.q(u))});S.prototype.__defineGetter__("windowLow",v("ga"));S.prototype.__defineSetter__("windowLow",ea("ga"));S.prototype.__defineGetter__("windowHigh",v("fa"));S.prototype.__defineSetter__("windowHigh",ea("fa"));S.prototype.__defineGetter__("borders",v("zb"));S.prototype.__defineSetter__("borders",ea("zb"));S.prototype.__defineGetter__("reslicing",v("kg"));S.prototype.__defineSetter__("reslicing",ea("kg"));
S.prototype.__defineSetter__("xNormX",function(a){this.b[0].i[0]=a});S.prototype.__defineGetter__("xNormX",function(){return this.b[0].i[0]});S.prototype.__defineSetter__("xNormY",function(a){this.b[0].i[1]=a});S.prototype.__defineGetter__("xNormY",function(){return this.b[0].i[1]});S.prototype.__defineSetter__("xNormZ",function(a){this.b[0].i[2]=a});S.prototype.__defineGetter__("xNormZ",function(){return this.b[0].i[2]});S.prototype.__defineSetter__("xColor",function(a){this.b[0].G=a});
S.prototype.__defineGetter__("xColor",function(){return this.b[0].G});S.prototype.__defineSetter__("yNormX",function(a){this.b[1].i[0]=a});S.prototype.__defineGetter__("yNormX",function(){return this.b[1].i[0]});S.prototype.__defineSetter__("yNormY",function(a){this.b[1].i[1]=a});S.prototype.__defineGetter__("yNormY",function(){return this.b[1].i[1]});S.prototype.__defineSetter__("yNormZ",function(a){this.b[1].i[2]=a});S.prototype.__defineGetter__("yNormZ",function(){return this.b[1].i[2]});
S.prototype.__defineSetter__("yColor",function(a){this.b[1].G=a});S.prototype.__defineGetter__("yColor",function(){return this.b[1].G});S.prototype.__defineSetter__("zNormX",function(a){this.b[2].i[0]=a});S.prototype.__defineGetter__("zNormX",function(){return this.b[2].i[0]});S.prototype.__defineSetter__("zNormY",function(a){this.b[2].i[1]=a});S.prototype.__defineGetter__("zNormY",function(){return this.b[2].i[1]});S.prototype.__defineSetter__("zNormZ",function(a){this.b[2].i[2]=a});
S.prototype.__defineGetter__("zNormZ",function(){return this.b[2].i[2]});S.prototype.__defineSetter__("zColor",function(a){this.b[2].G=a});S.prototype.__defineGetter__("zColor",function(){return this.b[2].G});
S.prototype.Fj=function(a){this.c[a].visible=u;for(var b=0;b<this.c[a].c.length;b++)"undefined"!=typeof this.c[a].c[b]&&(this.la&&(this.j.c[a].c[b].remove(),this.j.c[a].c[b]=t),this.c[a].c[b].remove(),this.c[a].c[b]=t);Kc(this.b[a].i,this.b[a].i);Od(a,this.b[a].dd,this.b[a].i,this);this.c[a].c=[];this.c[a].c=Array(this.b[a].o);this.la&&(b=Md(this.b[a].dd,this.b[a].i,this.b[a].G,this.Sa,this.j.Ba,this.j,this.j.la,this.j.Ta.Za),this.j.c[a].c=[],this.j.c[a].c=Array(this.b[a].o),this.j.c[a].c[Math.round(this.b[a].o/
2)]=b,this.j.c[a].q());b=Md(this.b[a].dd,this.b[a].i,this.b[a].G,this.Sa,this.Ba,this,q,t);this.la&&(b.j=b.T,b.j=this.j.c[a].c[Math.round(this.b[a].o/2)].T);this.c[a].c[Math.round(this.b[a].o/2)]=b;0==a?(this.ob=Math.round(this.b[a].o/2),this.vc=Math.round(this.b[a].o/2)):1==a?(this.pb=Math.round(this.b[a].o/2),this.wc=Math.round(this.b[a].o/2)):(this.qb=Math.round(this.b[a].o/2),this.xc=Math.round(this.b[a].o/2));this.c[a].q();this.c[a].c[Math.round(this.b[a].o/2)].ka=q};
function Ne(a,b){if(a.ib&&(a.h||b!=a.za)){var c=a.c[a.za];c.visible=u;var c=a.c[b],d=c.c.length,e;for(e=0;e<d;e++){if(c.c[e]==t){var f=new Float32Array(3);f[0]=a.b[b].m[0][0][0]+a.b[b].W[0]*e;f[1]=a.b[b].m[0][0][1]+a.b[b].W[1]*e;f[2]=a.b[b].m[0][0][2]+a.b[b].W[2]*e;if(a.la){var g=Md(f,a.b[b].i,a.b[b].G,a.Sa,a.j.Ba,a.j,a.j.la,a.j.Ta.Za);a.j.c[b].c[e]=g;a.j.c[b].q(q)}f=Md(f,a.b[b].i,a.b[b].G,a.Sa,a.Ba,a,q,t);f.c[0].ka=u;a.la&&(f.j=f.T,f.j=a.j.c[b].c[e].T);c.c[e]=f;a.c[b].q(q)}c.c[e].ka=q}a.za=b;a.h=
u}}B("X.volume",S);B("X.volume.prototype.modified",S.prototype.q);B("X.volume.prototype.sliceInfoChanged",S.prototype.Fj);function Pe(){Hd.call(this);this.f="parserSTL"}C(Pe,Hd);
Pe.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");this.J=c;var d=b.g,e=b.p;if("solid"==Jd(Y(this,"uchar",5))){b.g=d=new U(c.byteLength);b.p=e=new U(c.byteLength);var f=d,d=e,e=Y(this,"uchar",c.byteLength-5);c=e.length;var g=u,h=u,l=0,k;for(k=0;k<c;k++)if(10==e[k]){if(g||h){var j=Jd(e,l,k).split(" "),h=parseFloat(j[0]),m=parseFloat(j[1]),j=parseFloat(j[2]);g?(d.add(h,m,j),d.add(h,m,j),d.add(h,m,j)):f.add(h,m,j);h=g=u}}else 32==e[k-1]&&(102==e[k]?(l=k+=13,g=q):118==e[k]&&(l=k+=7,h=q))}else{this.L=
80;f=Y(this,"uint");b.g=d=new U(9*f);b.p=e=new U(9*f);for(c=c=0;c<f;c++)g=Y(this,"float",12),l=g[0],k=g[1],h=g[2],e.add(l,k,h),e.add(l,k,h),e.add(l,k,h),d.add(g[3],g[4],g[5]),d.add(g[6],g[7],g[8]),d.add(g[9],g[10],g[11]),this.L+=2}E.Ra(this.f+".parse");f=new gd;f.S=b;f.z=a;this.dispatchEvent(f)};B("X.parserSTL",Pe);B("X.parserSTL.prototype.parse",Pe.prototype.parse);function Qe(){Hd.call(this);this.f="parserDCM"}C(Qe,Hd);
Qe.prototype.parse=function(a,b,c){c=this.wd(c,b);if(c.ie==c.tb){var d=c.Ef.length,e,f=0;for(e=0;e<d;e++){var g=c.Ef[d-1-e];g!==p&&(g*=c.xb,c.data.set(c.pd.subarray(g,g+c.xb),f*c.xb),f++)}b.M=[c.Ea[0],c.Ea[1],c.Ea[2]];Infinity==c.V[2]&&(1<c.location.length?(c.location.sort(),c.V[2]=Math.abs(c.location[0]-c.location[1])):c.V[2]=1);d=[c.V[0],c.V[1],c.V[2]];b.jd=d;f=Id(c.data);e=f[0];f=f[1];c.min=b.cb=b.ga=e;c.max=b.ja=b.fa=f;-Infinity==b.da&&(b.da=e);Infinity==b.ea&&(b.ea=f);e=0;f=c.xd[0];for(g=0;++e<
c.xd.length;)c.xd[e]>f&&(g=e,f=c.xd[e]);f=c.Zg[g].split("\\");g=Cc(new T(c.Na[0],c.Na[1],c.Na[2]),new T(c.Na[3],c.Na[4],c.Na[5]));e=Nc();Sc(e,0,-c.Na[0],-c.Na[3],-g.x,-f[0]);Sc(e,1,-c.Na[1],-c.Na[4],-g.y,-f[1]);Sc(e,2,c.Na[2],c.Na[5],g.d,f[2]);Sc(e,3,0,0,0,1);c.Hb=e;c.Ib=Nc();Wc(c.Hb,c.Ib);g=Mc(0,0,0,1);f=Lc();Yc(e,g,f);g=Mc(d[0],d[1],d[2],1);d=Lc();Yc(e,g,d);e=Kd(e,[0,b.M[0],b.M[1],b.M[2]]);c.Dd=[d[0]-f[0],d[1]-f[1],d[2]-f[2]];c.Bd=[e[1]-e[0],e[3]-e[2],e[5]-e[4]];c.Cd=[e[0],e[2],e[4]];b.gc(c);b.Lb=
Pd(this,b)}c=new gd;c.S=b;c.z=a;this.dispatchEvent(c)};
Qe.prototype.wd=function(a,b){this.J=a;var c=0;if(b.nc!=t){d=b.nc;e=Y(this,"ushort",this.J.byteLength-2*d.xb);f=0;for(l=3;0<l;)if(g=e[f++],32==g)if(h=e[f++],19==h){f++;g=e[f++];for(h=0;h<g/2;h++)k=e[f++],j=k&255,k=(k&65280)>>8,c+=String.fromCharCode(j),c+=String.fromCharCode(k),c=parseInt(c,10);d.xd.push(c);l--}else if(50==h){f++;g=e[f++];m="";for(h=0;h<g/2;h++)k=e[f++],j=k&255,k=(k&65280)>>8,m+=String.fromCharCode(j),m+=String.fromCharCode(k);d.Zg.push(m);l--}else if(4161==h){f++;g=e[f++];m="";for(h=
0;h<g/2;h++)k=e[f++],j=k&255,k=(k&65280)>>8,m+=String.fromCharCode(j),m+=String.fromCharCode(k);d.location.push(m);l--}d.Ea[2]++}else{var d={rows:0,cols:0,V:t,Ue:0,Xh:0,tb:1,Ri:1,Xk:t,ie:0,xb:0,pd:t,xf:0,Ef:[],data:t,min:Infinity,max:-Infinity,location:[],Zg:[],xd:[]};d.tb=b.r.length;d.tb==t&&(d.tb=1);for(var e=Y(this,"ushort",this.J.byteLength),f=66,g=t,h=t,g=t,l=9;0<l;)if(g=e[f++],40==g)switch(h=e[f++],f++,g=e[f++],h){case 16:d.rows=e[f++];l--;break;case 17:d.cols=e[f++];l--;break;case 256:d.Ue=
e[f++];l--;break;case 257:d.Xh=e[f++];l--;break;case 2:d.Ri=e[f++];l--;break;case 48:m="";for(h=h=0;h<g/2;h++)var k=e[f++],j=k&255,k=(k&65280)>>8,m=m+String.fromCharCode(j),m=m+String.fromCharCode(k);m=m.split("\\");d.V=[parseFloat(m[0]),parseFloat(m[1]),Infinity];l--}else if(32==g)switch(h=e[f++],f++,g=e[f++],h){case 19:for(h=0;h<g/2;h++)k=e[f++],j=k&255,k=(k&65280)>>8,c+=String.fromCharCode(j),c+=String.fromCharCode(k),c=parseInt(c,10);l--;break;case 50:for(var m="",h=0;h<g/2;h++)k=e[f++],j=k&255,
k=(k&65280)>>8,m+=String.fromCharCode(j),m+=String.fromCharCode(k);m=m.split("\\");d.origin=[parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])];l--;break;case 55:m="";for(h=0;h<g/2;h++)k=e[f++],j=k&255,k=(k&65280)>>8,m+=String.fromCharCode(j),m+=String.fromCharCode(k);m=m.split("\\");d.Na=[parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2]),parseFloat(m[3]),parseFloat(m[4]),parseFloat(m[5])];l--}else if(16==g)switch(h=e[f++],f++,g=e[f++],h){case 8720:for(h=0;h<g/2;h++)f++}b.nc=d;d.Ea=[d.cols,d.rows,
1];d.xb=d.rows*d.cols;switch(d.Ue){case 8:d.pd=new Uint8Array(d.cols*d.rows*d.tb);d.data=new Uint8Array(d.cols*d.rows*d.tb);break;case 16:d.pd=new Uint16Array(d.cols*d.rows*d.tb);d.data=new Uint16Array(d.cols*d.rows*d.tb);break;case 32:d.pd=new Uint32Array(d.cols*d.rows*d.tb),d.data=new Uint32Array(d.cols*d.rows*d.tb)}}this.L=this.J.byteLength-2*d.xb;e=t;switch(d.Ue){case 8:e=Y(this,"uchar",d.xb);break;case 16:e=Y(this,"ushort",d.xb);break;case 32:e=Y(this,"uint",d.xb)}d.Ef[c]=d.xf;d.pd.set(e,d.xf*
d.xb);d.xf++;++d.ie;return d};B("X.parserDCM",Qe);B("X.parserDCM.prototype.parse",Qe.prototype.parse);function Re(){Hd.call(this);this.f="parserVTK"}C(Re,Hd);
Re.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");var d=b.g,e=b.p,f=new Uint8Array(c),g="";b.g=d=new U(c.byteLength);b.p=e=new U(c.byteLength);c=0;for(var h=f.length;c<h;c+=32768)g+=Jd(f,c,Math.min(c+32768,h));f=g.split("\n");g=f.length;this.ld=this.md=t;this.ac=[];this.Ia=dd;this.Ge=this.Sb=this.Kb=this.Tb=u;c=0;for(h=g%8;h--;)Se(this,f[c]),c++;for(h=0.125*g^0;h--;)Se(this,f[c]),c++,Se(this,f[c]),c++,Se(this,f[c]),c++,Se(this,f[c]),c++,Se(this,f[c]),c++,Se(this,f[c]),c++,Se(this,f[c]),c++,
Se(this,f[c]),c++;c=this.md;var f=this.ld,g=f.length,l=h=this.ac.length;do{var k=this.ac[h-l],j=k.length,m;for(m=0;m<j&&!("LINES"==this.Ia&&m+1>=j);m++){var s=parseInt(k[m],10),r=c.get(s);d.add(r[0],r[1],r[2]);var z=s,y=r;"LINES"==this.Ia?(z=parseInt(k[m+1],10),y=c.get(z),d.add(y[0],y[1],y[2])):"TRIANGLE_STRIPS"==this.Ia&&(0==m||m==j-1)&&d.add(r[0],r[1],r[2]);s<g?(y=f.get(s),e.add(y[0],y[1],y[2]),"LINES"==this.Ia?(z=f.get(z),e.add(z[0],z[1],z[2])):"TRIANGLE_STRIPS"==this.Ia&&(0==m||m==j-1)&&e.add(y[0],
y[1],y[2])):(z=new T(r[0],r[1],r[2]),z.normalize(),e.add(z.x,z.y,z.d),"LINES"==this.Ia?(z=new T(y[0],y[1],y[2]),z.normalize(),e.add(z.x,z.y,z.d)):"TRIANGLE_STRIPS"==this.Ia&&(0==m||m==j-1)&&e.add(z.x,z.y,z.d))}l--}while(0<l);b.ya=this.Ia;E.Ra(this.f+".parse");d=new gd;d.S=b;d.z=a;this.dispatchEvent(d)};
function Se(a,b){b=b.replace(/^\s+|\s+$/g,"");var c=b.split(" "),d=c.length,e=c[0];switch(e){case "POINTS":a.Tb=q;a.Kb=u;a.Sb=u;c=parseInt(c[1],10);a.md=new U(3*c);a.ld=new U(3*c);return;case "VERTICES":a.Kb=q;a.Tb=u;a.Sb=u;c=parseInt(c[1],10);3<=c?a.Ia=dd:1==c?a.Ia="POINTS":n(Error("This VTK file is not supported!"));a.ac=[];return;case "TRIANGLE_STRIPS":a.Kb=q;a.Tb=u;a.Sb=u;a.Ia="TRIANGLE_STRIPS";a.ac=[];return;case "LINES":a.Kb=q;a.Tb=u;a.Sb=u;a.Ia="LINES";a.ac=[];return;case "POLYGONS":a.Kb=q;
a.Tb=u;a.Sb=u;a.Ia="POLYGONS";a.ac=[];return;case "POINT_DATA":a.Sb=q;a.Tb=u;a.Kb=u;return}if(a.Tb)if(1==d||isNaN(parseFloat(e)))a.Tb=u;else{if(3<=d){var e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]);a.md.add(e,f,g)}6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.md.add(e,f,g));9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.md.add(d,e,c))}else a.Kb?1==d||isNaN(parseFloat(e))?a.Kb=u:(c=c.slice(1),a.ac.push(c)):a.Sb&&("NORMALS"==e?a.Ge=q:1==d||isNaN(parseFloat(e))?
(a.Sb=u,a.Ge=u):a.Ge&&(3<=d&&(e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]),a.ld.add(e,f,g)),6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.ld.add(e,f,g)),9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.ld.add(d,e,c))))}B("X.parserVTK",Re);B("X.parserVTK.prototype.parse",Re.prototype.parse);function Te(){Hd.call(this);this.f="parserFSM";this.Kd=u}C(Te,Hd);
Te.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");this.J=c;var d=b.g,e=b.p;b.Ac=[];var f=b.Ac;c=0;var g;do g=Y(this,"uchar"),c++;while(200>c&&10!=g);Y(this,"uchar");e=Y(this,"uint");c=Y(this,"uint");var h=Y(this,"float",3*e);g=Y(this,"uint",3*c);var l=new Uint32Array(e),k=new Float32Array(9*c);b.g=d=new U(9*c);b.p=e=new U(9*c);var j;for(j=0;j<c;j++){var m=3*j,s=g[m],r=g[m+1],z=g[m+2];f.push(s);f.push(r);f.push(z);l[s]+=1;l[r]+=1;l[z]+=1;var m=3*s,y=3*r,D=3*z,F=h[m],H=h[m+1],A=h[m+2],r=h[y],
z=h[y+1],s=h[y+2],G=h[D],J=h[D+1],K=h[D+2];d.add(F,H,A);d.add(r,z,s);d.add(G,J,K);F=new T(F,H,A);G=new T(G,J,K);r=(new T(r,z,s)).k().Aa(F);z=G.k().Aa(F);r=Cc(r,z).normalize();k[m]+=r.x;k[m+1]+=r.y;k[m+2]+=r.d;k[y]+=r.x;k[y+1]+=r.y;k[y+2]+=r.d;k[D]+=r.x;k[D+1]+=r.y;k[D+2]+=r.d}for(j=0;j<c;j++)m=3*j,s=g[m],r=g[m+1],z=g[m+2],m=3*s,y=3*r,D=3*z,f=new T(k[y],k[y+1],k[y+2]),h=new T(k[D],k[D+1],k[D+2]),m=(new T(k[m],k[m+1],k[m+2])).scale(1/l[s]).normalize(),f=f.scale(1/l[r]).normalize(),h=h.scale(1/l[z]).normalize(),
e.add(m.x,m.y,m.d),e.add(f.x,f.y,f.d),e.add(h.x,h.y,h.d);c=Y(this,"uchar",this.J.byteLength-this.L);g=t;for(m=0;m<c.length;m++)if(99==c[m]&&114==c[m+1]&&97==c[m+2]&&115==c[m+3]){for(e=g=m+9;10!=c[m]&&m<c.length;)e++,m++;g=Jd(c.subarray(g,e)).split(" ");break}g&&(b.aa.ph(parseFloat(g[0])),b.aa.qh(parseFloat(g[1])),b.aa.rh(parseFloat(g[2])));b.ya=dd;E.Ra(this.f+".parse");c=new gd;c.S=b;c.z=a;this.dispatchEvent(c)};B("X.parserFSM",Te);B("X.parserFSM.prototype.parse",Te.prototype.parse);var Ue={Ye:function(a,b,c){return Ue.update(a,0,b,c)},update:function(a,b,c,d){var e=Ue.wh,f="number"===typeof c?c:c=0;d="number"===typeof d?d:a.length;b^=4294967295;for(f=d&7;f--;++c)b=b>>>8^e[(b^a[c])&255];for(f=d>>3;f--;c+=8)b=b>>>8^e[(b^a[c])&255],b=b>>>8^e[(b^a[c+1])&255],b=b>>>8^e[(b^a[c+2])&255],b=b>>>8^e[(b^a[c+3])&255],b=b>>>8^e[(b^a[c+4])&255],b=b>>>8^e[(b^a[c+5])&255],b=b>>>8^e[(b^a[c+6])&255],b=b>>>8^e[(b^a[c+7])&255];return(b^4294967295)>>>0}};
Ue.wh=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,
3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,
366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,
3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,
1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,
1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function Ve(a){var b=a.length,c=0,d=Number.POSITIVE_INFINITY,e,f,g,h,l,k,j,m,s;for(m=0;m<b;++m)a[m]>c&&(c=a[m]),a[m]<d&&(d=a[m]);e=1<<c;f=new Uint32Array(e);g=1;h=0;for(l=2;g<=c;){for(m=0;m<b;++m)if(a[m]===g){k=0;j=h;for(s=0;s<g;++s)k=k<<1|j&1,j>>=1;for(s=k;s<e;s+=l)f[s]=g<<16|m;++h}++g;h<<=1;l<<=1}return[f,c,d]};function We(a,b){this.Ve=[];this.We=32768;this.jb=this.nd=this.va=this.If=0;this.input=new Uint8Array(a);this.pg=u;this.Xe=Xe;this.Eb=u;if(b||!(b={}))b.index&&(this.va=b.index),b.bufferSize&&(this.We=b.bufferSize),b.bufferType&&(this.Xe=b.bufferType),b.resize&&(this.Eb=b.resize);switch(this.Xe){case Ye:this.ca=32768;this.Ka=new Uint8Array(32768+this.We+258);break;case Xe:this.ca=0;this.Ka=new Uint8Array(this.We);this.ic=this.ji;this.sg=this.$h;this.df=this.di;break;default:n(Error("invalid inflate mode"))}}
var Ye=0,Xe=1;
We.prototype.qd=function(){for(;!this.pg;){var a=Ze(this,3);a&1&&(this.pg=q);a>>>=1;switch(a){case 0:var a=this.input,b=this.va,c=this.Ka,d=this.ca,e=p,f=p,g=p,h=c.length,e=p;this.jb=this.nd=0;e=a[b++];e===p&&n(Error("invalid uncompressed block header: LEN (first byte)"));f=e;e=a[b++];e===p&&n(Error("invalid uncompressed block header: LEN (second byte)"));f|=e<<8;e=a[b++];e===p&&n(Error("invalid uncompressed block header: NLEN (first byte)"));g=e;e=a[b++];e===p&&n(Error("invalid uncompressed block header: NLEN (second byte)"));g|=
e<<8;f===~g&&n(Error("invalid uncompressed block header: length verify"));b+f>a.length&&n(Error("input buffer is broken"));switch(this.Xe){case Ye:for(;d+f>c.length;)e=h-d,f-=e,c.set(a.subarray(b,b+e),d),d+=e,b+=e,this.ca=d,c=this.ic(),d=this.ca;break;case Xe:for(;d+f>c.length;)c=this.ic({yg:2});break;default:n(Error("invalid inflate mode"))}c.set(a.subarray(b,b+f),d);d+=f;this.va=b+=f;this.ca=d;this.Ka=c;break;case 1:this.df($e,af);break;case 2:bf(this);break;default:n(Error("unknown BTYPE: "+a))}}return this.sg()};
var cf=new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),df=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258]),ef=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0]),ff=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]),gf=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),hf=new Uint8Array(288),
jf,kf;jf=0;for(kf=hf.length;jf<kf;++jf)hf[jf]=143>=jf?8:255>=jf?9:279>=jf?7:8;var $e=Ve(hf),lf=new Uint8Array(30),mf,nf;mf=0;for(nf=lf.length;mf<nf;++mf)lf[mf]=5;var af=Ve(lf);function Ze(a,b){for(var c=a.nd,d=a.jb,e=a.input,f=a.va,g;d<b;)g=e[f++],g===p&&n(Error("input buffer is broken")),c|=g<<d,d+=8;g=c&(1<<b)-1;a.nd=c>>>b;a.jb=d-b;a.va=f;return g}
function of(a,b){for(var c=a.nd,d=a.jb,e=a.input,f=a.va,g=b[0],h=b[1],l;d<h;)l=e[f++],l===p&&n(Error("input buffer is broken")),c|=l<<d,d+=8;e=g[c&(1<<h)-1];g=e>>>16;a.nd=c>>g;a.jb=d-g;a.va=f;return e&65535}
function bf(a){function b(a,b,c){var d,e,f;for(f=0;f<a;)switch(d=of(this,b),d){case 16:for(d=3+Ze(this,2);d--;)c[f++]=e;break;case 17:for(d=3+Ze(this,3);d--;)c[f++]=0;e=0;break;case 18:for(d=11+Ze(this,7);d--;)c[f++]=0;e=0;break;default:e=c[f++]=d}return c}var c=Ze(a,5)+257,d=Ze(a,5)+1,e=Ze(a,4)+4,f=new Uint8Array(cf.length),g;for(g=0;g<e;++g)f[cf[g]]=Ze(a,3);e=Ve(f);f=new Uint8Array(c);g=new Uint8Array(d);a.df(Ve(b.call(a,c,e,f)),Ve(b.call(a,d,e,g)))}w=We.prototype;
w.df=function(a,b){var c=this.Ka,d=this.ca;this.vg=a;for(var e=c.length-258,f,g,h;256!==(f=of(this,a));)if(256>f)d>=e&&(this.ca=d,c=this.ic(),d=this.ca),c[d++]=f;else{f-=257;h=df[f];0<ef[f]&&(h+=Ze(this,ef[f]));f=of(this,b);g=ff[f];0<gf[f]&&(g+=Ze(this,gf[f]));d>=e&&(this.ca=d,c=this.ic(),d=this.ca);for(;h--;)c[d]=c[d++-g]}for(;8<=this.jb;)this.jb-=8,this.va--;this.ca=d};
w.di=function(a,b){var c=this.Ka,d=this.ca;this.vg=a;for(var e=c.length,f,g,h;256!==(f=of(this,a));)if(256>f)d>=e&&(c=this.ic(),e=c.length),c[d++]=f;else{f-=257;h=df[f];0<ef[f]&&(h+=Ze(this,ef[f]));f=of(this,b);g=ff[f];0<gf[f]&&(g+=Ze(this,gf[f]));d+h>e&&(c=this.ic(),e=c.length);for(;h--;)c[d]=c[d++-g]}for(;8<=this.jb;)this.jb-=8,this.va--;this.ca=d};
w.ic=function(){var a=new Uint8Array(this.ca-32768),b=this.ca-32768,c=this.Ka;a.set(c.subarray(32768,a.length));this.Ve.push(a);this.If+=a.length;c.set(c.subarray(b,b+32768));this.ca=32768;return c};w.ji=function(a){var b=this.input.length/this.va+1|0,c=this.input,d=this.Ka;a&&("number"===typeof a.yg&&(b=a.yg),"number"===typeof a.Th&&(b+=a.Th));2>b?(a=(c.length-this.va)/this.vg[2],a=258*(a/2)|0,a=a<d.length?d.length+a:d.length<<1):a=d.length*b;a=new Uint8Array(a);a.set(d);return this.Ka=a};
w.sg=function(){var a=0,b=this.Ka,c=this.Ve,d,e=new Uint8Array(this.If+(this.ca-32768)),f,g,h,l;if(0===c.length)return this.Ka.subarray(32768,this.ca);f=0;for(g=c.length;f<g;++f){d=c[f];h=0;for(l=d.length;h<l;++h)e[a++]=d[h]}f=32768;for(g=this.ca;f<g;++f)e[a++]=b[f];this.Ve=[];return this.buffer=e};w.$h=function(){var a,b=this.ca;this.Eb?(a=new Uint8Array(b),a.set(this.Ka.subarray(0,b))):a=this.Ka.subarray(0,b);return this.buffer=a};new Uint8Array(256);var pf;for(pf=0;256>pf;++pf)for(var qf=pf,rf=7,qf=qf>>>1;qf;qf>>>=1)--rf;var sf=[],tf;for(tf=0;288>tf;tf++)switch(q){case 143>=tf:sf.push([tf+48,8]);break;case 255>=tf:sf.push([tf-144+400,9]);break;case 279>=tf:sf.push([tf-256+0,7]);break;case 287>=tf:sf.push([tf-280+192,8]);break;default:n("invalid literal: "+tf)}
function uf(){var a=vf;switch(q){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,a-
31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:n("invalid length: "+a)}}var wf=[],vf,xf;
for(vf=3;258>=vf;vf++)xf=uf(),wf[vf]=xf[2]<<24|xf[1]<<16|xf[0];new Uint32Array(wf);function yf(){};function zf(a){this.input=a;this.va=0;this.member=[]}
zf.prototype.qd=function(){for(var a=this.input.length;this.va<a;){var b=new yf,c=p,d=p,e=p,f=c=e=p,g=p,c=c=p,h=this.input,d=this.va;b.Eg=h[d++];b.Fg=h[d++];(31!==b.Eg||139!==b.Fg)&&n(Error("invalid file signature:",b.Eg,b.Fg));b.rg=h[d++];switch(b.rg){case 8:break;default:n(Error("unknown compression method: "+b.rg))}b.$d=h[d++];c=h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24;b.$k=new Date(1E3*c);b.dl=h[d++];b.al=h[d++];0<(b.$d&4)&&(b.Pj=h[d++]|h[d++]<<8,d+=b.Pj);if(0<(b.$d&8)){g=[];for(f=0;0<(c=h[d++]);)g[f++]=
String.fromCharCode(c);b.name=g.join("")}if(0<(b.$d&16)){g=[];for(f=0;0<(c=h[d++]);)g[f++]=String.fromCharCode(c);b.comment=g.join("")}0<(b.$d&2)&&(b.ai=Ue.Ye(h,0,d)&65535,b.ai!==(h[d++]|h[d++]<<8)&&n(Error("invalid header crc16")));c=h[h.length-4]|h[h.length-3]<<8|h[h.length-2]<<16|h[h.length-1]<<24;h.length-d-4-4<512*c&&(e=c);d=new We(h,{index:d,bufferSize:e});b.data=e=d.qd();d=d.va;b.Rk=c=(h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24)>>>0;Ue.Ye(e)!==c&&n(Error("invalid CRC-32 checksum: 0x"+Ue.Ye(e).toString(16)+
" / 0x"+c.toString(16)));b.Wk=c=(h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24)>>>0;(e.length&4294967295)!==c&&n(Error("invalid input size: "+(e.length&4294967295)+" / "+c));this.member.push(b);this.va=d}a=this.member;b=e=d=0;for(h=a.length;b<h;++b)e+=a[b].data.length;e=new Uint8Array(e);for(b=0;b<h;++b)e.set(a[b].data,d),d+=a[b].data.length;return e};function Af(){Hd.call(this);this.f="parserMGZ";this.Kd=u}C(Af,Hd);
Af.prototype.parse=function(a,b,c,d){E.Xa(this.f+".parse");d&&(c=(new zf(new Uint8Array(c))).qd(),c=c.buffer);d=this.wd(c);var e=[d.mf,d.nf,d.of];b.M=e;c=d.sh;b.jd=c;var f=d.min,g=d.max;b.cb=b.ga=f;b.ja=b.fa=g;-Infinity==b.da&&(b.da=f);Infinity==b.ea&&(b.ea=g);f=Nc();Sc(f,0,d.Wa[0][0],d.Wa[1][0],d.Wa[2][0],0);Sc(f,1,d.Wa[0][1],d.Wa[1][1],d.Wa[2][1],0);Sc(f,2,d.Wa[0][2],d.Wa[1][2],d.Wa[2][2],0);Sc(f,3,0,0,0,1);for(var g=e[0]/2,h=e[1]/2,l=e[2]/2,e=[0,0,0],k=0;3>k;++k)e[k]=d.Wa[3][k]-(f[k+0]*c[0]*g+
f[k+4]*c[1]*h+f[k+8]*c[2]*l);g=e[1];h=e[2];f[12]=e[0];f[13]=g;f[14]=h;f[15]=1;d.Hb=f;d.Ib=Nc();Wc(d.Hb,d.Ib);g=Mc(0,0,0,1);e=Lc();Yc(f,g,e);g=Mc(c[0],c[1],c[2],1);c=Lc();Yc(f,g,c);f=Kd(f,[0,b.M[0],b.M[1],b.M[2]]);d.Dd=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];d.Bd=[f[1]-f[0],f[3]-f[2],f[5]-f[4]];d.Cd=[f[0],f[2],f[4]];b.gc(d);E.Ra(this.f+".parse");b.Lb=Pd(this,b);d=new gd;d.S=b;d.z=a;this.dispatchEvent(d)};
Af.prototype.wd=function(a){this.J=a;a={version:0,zh:0,xh:0,pi:0,yh:0,mf:0,nf:0,of:0,Qi:0,type:0,hi:0,ih:0,Vj:t,Wa:t,sh:t,data:t,min:Infinity,max:-Infinity};a.version=Y(this,"uint");a.mf=Y(this,"uint");a.nf=Y(this,"uint");a.of=Y(this,"uint");a.Qi=Y(this,"uint");a.type=Y(this,"uint");a.hi=Y(this,"uint");a.ih=Y(this,"ushort");if(0<a.ih){a.sh=Y(this,"float",3);var b=[];b.push(Y(this,"float",3));b.push(Y(this,"float",3));b.push(Y(this,"float",3));b.push(Y(this,"float",3));a.Wa=b}this.L=284;b=a.mf*a.nf*
a.of;switch(a.type){case 0:a.data=Y(this,"uchar",b);break;case 1:a.data=Y(this,"uint",b);break;case 3:a.data=Y(this,"float",b);break;case 4:a.data=Y(this,"ushort",b);break;default:n(Error("Unsupported MGH/MGZ data type: "+a.type))}b=Id(a.data);a.min=b[0];a.max=b[1];this.L+16<this.J.byteLength&&(a.zh=Y(this,"float"),a.pi=Y(this,"float"),a.xh=Y(this,"float"),a.yh=Y(this,"float"));return a};B("X.parserMGZ",Af);B("X.parserMGZ.prototype.parse",Af.prototype.parse);function Bf(){Hd.call(this);this.f="parserCRV";this.Kd=u}C(Bf,Hd);
Bf.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");var d=b.Ac;0==d.length&&n(Error("No _pointIndices defined on the X.object."));this.J=c;this.L=3;var e=Y(this,"uint");Y(this,"uint");Y(this,"uint");var f=0,g=0,h=0,l=0,k=0,j=0,m=0,s=0,r=0,z=0,y=0;c=Array(2);var D=Array(2),F=Y(this,"float",e),H;for(H=0;H<e;H++){var A=F[H];0==H&&(c[0]=D[0]=A);0<=A?(f++,l+=A):(g++,h+=A);r+=A;y++;D[0]=Math.max(A,D[0]);c[0]=Math.min(A,c[0]);F[H]=A}0!=f&&(k=l/f);0!=g&&(j=h/g);0!=y&&(z=r/y);for(y=r=h=l=0;y<e;y++)A=
F[y],H=0,0<=A?(H=Math.pow(A-k,2),l+=H):(H=Math.pow(A-j,2),h+=H),H=Math.pow(A-z,2),r+=H;1<f&&(m=Math.sqrt(l/(f-1)));1<g&&(s=Math.sqrt(h/(g-1)));c[1]=j-2.5*s;D[1]=k+2.5*m;e=d.length;f=new Float32Array(3*e);for(y=0;y<e;y++)g=F[d[y]],h=3*y,f[h]=g,f[h+1]=g,f[h+2]=g;b.C.cb=c[1];b.C.ja=D[1];-Infinity==b.C.da&&(b.C.da=c[1]);Infinity==b.C.ea&&(b.C.ea=D[1]);b.C.B=F;b.C.Pc=f;b.C.h=q;E.Ra(this.f+".parse");d=new gd;d.S=b;d.z=a;this.dispatchEvent(d)};B("X.parserCRV",Bf);B("X.parserCRV.prototype.parse",Bf.prototype.parse);function Cf(){Hd.call(this);this.f="parserTRK"}C(Cf,Hd);
Cf.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");var d=b.g,e=b.p,f=b.ia;this.J=c;Y(this,"uchar",6);Y(this,"ushort",3);var g=Y(this,"float",3);Y(this,"float",3);var h=Y(this,"ushort");Y(this,"uchar",200);Y(this,"ushort");Y(this,"uchar",200);c=Y(this,"float",16);Y(this,"uchar",444);Y(this,"uchar",4);Y(this,"uchar",4);Y(this,"float",6);Y(this,"uchar",2);Y(this,"uchar");Y(this,"uchar");Y(this,"uchar");Y(this,"uchar");Y(this,"uchar");Y(this,"uchar");var l=Y(this,"uint");Y(this,"uint");var k=Y(this,
"uint"),j=[],m=[],s=Infinity,r=-Infinity,z=t,y=t,D=t,F=t,e=d=t,H=Y(this,"uint",(this.J.byteLength-1E3)/4);this.L=k;for(var A=Y(this,"float",(this.J.byteLength-1E3)/4),G=0,k=f=0;k<l;k++){for(var J=H[G],K=new U(3*J),R=0,N=0;N<J;N++){var W=A[G+3*N+N*h+1],aa=A[G+3*N+N*h+2],Z=A[G+3*N+N*h+3],W=W/g[0],aa=aa/g[1],Z=Z/g[2];K.add(W,aa,Z);if(0<N)var ba=K.get(N-1),R=R+Math.sqrt(Math.pow(W-ba[0],2)+Math.pow(aa-ba[1],2)+Math.pow(Z-ba[2],2));N<J-1&&(f+=6)}G+=3*J+J*h+1;N=K.eb;J=K.$a;W=K.fb;aa=K.ab;Z=K.gb;ba=K.bb;
if(!z||N<z)z=N;if(!y||J>y)y=J;if(!D||W<D)D=W;if(!F||aa>F)F=aa;if(!d||Z<d)d=Z;if(!e||ba>e)e=ba;j.push(K);m.push(R)}g=(z+y)/2;D=(D+F)/2;h=(d+e)/2;F=new Float32Array(f);b.g=d=new U(f);b.p=e=new U(f);b.ia=f=new U(f);for(k=z=0;k<l;k++){y=j[k];H=y.count;R=m[k];s=Math.min(s,R);r=Math.max(r,R);for(N=0;N<H-1;N++){G=y.get(N);A=y.get(N+1);d.add(G[0],G[1],G[2]);d.add(A[0],A[1],A[2]);var K=G[0]-g,J=G[1]-D,W=G[2]-h,aa=Math.sqrt(K*K+J*J+W*W),Z=A[0]-g,ba=A[1]-D,L=A[2]-h,O=Math.sqrt(Z*Z+ba*ba+L*L);e.add(K/aa,J/aa,
W/aa);e.add(Z/O,ba/O,L/O);A=[Math.abs(A[0]-G[0]),Math.abs(A[1]-G[1]),Math.abs(A[2]-G[2])];G=Math.sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2]);A[0]/=G;A[1]/=G;A[2]/=G;f.add(A[0],A[1],A[2]);f.add(A[0],A[1],A[2]);F[z++]=R;F[z++]=R;F[z++]=R;F[z++]=R;F[z++]=R;F[z++]=R}}b.ya="LINES";l=new fd;l.cb=s;l.ja=r;l.da=s;l.ea=r;l.Pc=F;l.jg=u;l.h=q;b.C=l;E.Ra(this.f+".parse");E.e.Jf(c,b.aa.I);c=new gd;c.S=b;c.z=a;this.dispatchEvent(c)};B("X.parserTRK",Cf);B("X.parserTRK.prototype.parse",Cf.prototype.parse);function Df(){Hd.call(this);this.f="parserIMAGE"}C(Df,Hd);Df.prototype.parse=function(a,b,c,d){c instanceof ArrayBuffer||n(Error());for(var e=new Uint8Array(c),f=e.length,g=Array(f);f--;)g[f]=String.fromCharCode(e[f]);e=window.btoa(g.join(""));f=new Image;Vb(f,"load",this.tj.bind(this,f,a,b,c,d));f.src="data:image/"+d+";base64,"+e};Df.prototype.tj=function(a,b,c){b.Lb=a;b.Ub=t;a=new gd;a.S=c;a.z=b;this.dispatchEvent(a)};B("X.parserIMAGE",Df);B("X.parserIMAGE.prototype.parse",Df.prototype.parse);function Ef(){Hd.call(this);this.f="parserLUT"}C(Ef,Hd);
Ef.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");this.J=c;c=Y(this,"uchar",c.byteLength);var d=c.length,e=0,f;for(f=0;f<d;f++)if(10==c[f]){var g=Jd(c,e,f),e=f+1,g=g.replace(/^\s+|\s+$/g,"");"#"!=g[0]&&(g=g.split(" "),g=g.filter(function(a){return""!=a}),6==g.length&&(g[2]=parseInt(g[2],10)/255,g[3]=parseInt(g[3],10)/255,g[4]=parseInt(g[4],10)/255,g[5]=parseInt(g[5],10)/255,a.add(parseInt(g[0],10),g[1],g[2],g[3],g[4],g[5],10)))}E.Ra(this.f+".parse");c=new gd;c.S=b;c.z=a;this.dispatchEvent(c)};
B("X.parserLUT",Ef);B("X.parserLUT.prototype.parse",Ef.prototype.parse);function Ff(){Hd.call(this);this.f="parserNRRD"}C(Ff,Hd);
Ff.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");this.J=c;c=Y(this,"uchar",c.byteLength);var d=c.length,e=t,f=0,g;for(g=1;g<d;g++)if(10==c[g-1]&&10==c[g]){e=Jd(c,0,g-2);f=g+1;break}var h,l,k,j,d=e.split(/\r?\n/),e=0;for(g=d.length;e<g;e++)if(h=d[e],h.match(/NRRD\d+/))this.Ii=q;else if(!h.match(/^#/)&&(j=h.match(/(.*):(.*)/)))l=j[1].trim(),h=j[2].trim(),(k=this.li[l])?k.call(this,h):this[l]=h;this.Ii||n(Error("Not an NRRD file"));"raw"!==this.encoding&&("gzip"!==this.encoding&&"gz"!==this.encoding)&&
n(Error("Only raw or gz/gzip encoding is allowed"));if(!this.$&&(this.$=[new T(1,0,0),new T(0,1,0),new T(0,0,1)],this.Gf)){d=[];for(j=0;2>=j;j++)d.push(!isNaN(this.Gf[j])?this.$[j].scale(this.Gf[j]):p)}f=c.subarray(f);if("gzip"==this.encoding||"gz"==this.encoding)f=(new zf(new Uint8Array(f))).qd();f=f.buffer;c={data:t,min:Infinity,max:-Infinity};c.data=new this.Jb(f);f=Id(c.data);e=c.min=f[0];g=c.max=f[1];b.cb=b.ga=e;b.ja=b.fa=g;b.M=[this.Cf[0],this.Cf[1],this.Cf[2]];f=(new T(this.$[0][0],this.$[0][1],
this.$[0][2])).Db();j=(new T(this.$[1][0],this.$[1][1],this.$[1][2])).Db();d=(new T(this.$[2][0],this.$[2][1],this.$[2][2])).Db();b.jd=[f,j,d];-Infinity==b.da&&(b.da=e);Infinity==b.ea&&(b.ea=g);h=g=1;"left-posterior-superior"==this.lh&&(h=g=-1);e=Oc();Sc(e,0,g*this.$[0][0],g*this.$[1][0],g*this.$[2][0],g*this.Ff[0]);Sc(e,1,h*this.$[0][1],h*this.$[1][1],h*this.$[2][1],h*this.Ff[1]);Sc(e,2,1*this.$[0][2],1*this.$[1][2],1*this.$[2][2],1*this.Ff[2]);Sc(e,3,0,0,0,1);c.Hb=e;c.Ib=Nc();Wc(c.Hb,c.Ib);h=Mc(0,
0,0,1);g=Lc();Yc(e,h,g);j=Mc(f,j,d,1);f=Lc();Yc(e,j,f);j=Kd(e,[0,b.M[0],b.M[1],b.M[2]]);c.Dd=[f[0]-g[0],f[1]-g[1],f[2]-g[2]];c.Bd=[j[1]-j[0],j[3]-j[2],j[5]-j[4]];c.Cd=[j[0],j[2],j[4]];b.gc(c);E.Ra(this.f+".parse");b.Lb=Pd(this,b);c=new gd;c.S=b;c.z=a;this.dispatchEvent(c)};
Ff.prototype.li={type:function(a){switch(a){case "uchar":case "unsigned char":case "uint8":case "uint8_t":this.Jb=Uint8Array;break;case "signed char":case "int8":case "int8_t":this.Jb=Int8Array;break;case "short":case "short int":case "signed short":case "signed short int":case "int16":case "int16_t":this.Jb=Int16Array;break;case "ushort":case "unsigned short":case "unsigned short int":case "uint16":case "uint16_t":this.Jb=Uint16Array;break;case "int":case "signed int":case "int32":case "int32_t":this.Jb=
Int32Array;break;case "uint":case "unsigned int":case "uint32":case "uint32_t":this.Jb=Uint32Array;break;case "float":this.Jb=Float32Array;break;case "double":this.Jb=Float64Array;break;default:n(Error("Unsupported NRRD data type: "+a))}return this.type=a},endian:function(a){return this.Uk=a},encoding:function(a){return this.encoding=a},dimension:function(a){return this.Ea=parseInt(a,10)},sizes:function(a){var b,c,d,e;d=a.split(/\s+/);e=[];b=0;for(c=d.length;b<c;b++)a=d[b],e.push(parseInt(a,10));
return this.Cf=e},space:function(a){return this.lh=a},"space origin":function(a){return this.Ff=a.split("(")[1].split(")")[0].split(",")},"space directions":function(a){var b,c;a=a.match(/\(.*?\)/g);var d,e,f;f=[];d=0;for(e=a.length;d<e;d++)c=a[d],f.push(function(){var a,d,e,f;e=c.slice(1,-1).split(/,/);f=[];a=0;for(d=e.length;a<d;a++)b=e[a],f.push(parseFloat(b));return f}());return this.$=f},spacings:function(a){var b;b=a.split(/\s+/);var c,d,e;e=[];c=0;for(d=b.length;c<d;c++)a=b[c],e.push(parseFloat(a));
return this.Gf=e}};B("X.parserNRRD",Ff);B("X.parserNRRD.prototype.parse",Ff.prototype.parse);function Gf(){Hd.call(this);this.f="parserNII"}C(Gf,Hd);
Gf.prototype.parse=function(a,b,c){var d=c,e=-1,e="undefined"==typeof DataView?(new Int32Array(c,0,1))[0]:(new DataView(c,0)).getInt32(0,q);348!=e&&(d=(new zf(new Uint8Array(d))).qd(),d=d.buffer);c=this.wd(d);d=c.min;e=c.max;b.cb=b.ga=d;b.ja=b.fa=e;-Infinity==b.da&&(b.da=d);Infinity==b.ea&&(b.ea=e);d=Nc();Sc(d,3,0,0,0,1);if(0==c.yf)Sc(d,0,c.V[1],0,0,0),Sc(d,0,0,c.V[2],0,0),Sc(d,0,0,0,c.V[3],0);else if(0<c.yf){var e=0,f=c.fh,g=c.gh,h=c.hh,l=1,k=1,j=1,m=c.bh,s=c.dh,r=c.eh,e=1-(f*f+g*g+h*h);1E-7>e?(e=
1/Math.sqrt(f*f+g*g+h*h),f*=e,g*=e,h*=e,e=0):e=Math.sqrt(e);0<c.V[1]&&(l=c.V[1]);0<c.V[2]&&(k=c.V[2]);0<c.V[2]&&(j=c.V[3]);0>c.V[0]&&(j=-j);Sc(d,0,(e*e+f*f-g*g-h*h)*l,2*(f*g-e*h)*k,2*(f*h+e*g)*j,m);Sc(d,1,2*(f*g+e*h)*l,(e*e+g*g-f*f-h*h)*k,2*(g*h-e*f)*j,s);Sc(d,2,2*(f*h-e*g)*l,2*(g*h+e*f)*k,(e*e+h*h-g*g-f*f)*j,r)}else 0<c.jh?(e=c.mh,f=c.nh,g=c.oh,Sc(d,0,e[0],e[1],e[2],e[3]),Sc(d,1,f[0],f[1],f[2],f[3]),Sc(d,2,g[0],g[1],g[2],g[3])):window.console.log("UNKNOWN METHOD IN PARSER NII");c.Hb=d;c.Ib=Nc();
Wc(c.Hb,c.Ib);f=Mc(0,0,0,1);e=Lc();Yc(d,f,e);g=Mc(c.V[1],c.V[2],c.V[3],1);f=Lc();Yc(d,g,f);d=Kd(d,c.Ea);c.Dd=[f[0]-e[0],f[1]-e[1],f[2]-e[2]];c.Bd=[d[1]-d[0],d[3]-d[2],d[5]-d[4]];c.Cd=[d[0],d[2],d[4]];b.M=[c.Ea[1],c.Ea[2],c.Ea[3]];b.gc(c);b.Lb=Pd(this,b);c=new gd;c.S=b;c.z=a;this.dispatchEvent(c)};
Gf.prototype.wd=function(a){this.J=a;a={Ej:0,bi:t,ci:t,ki:0,Cj:0,xj:0,gi:t,Ea:t,Ei:0,Fi:0,Gi:0,Ci:0,cf:0,Wh:0,Jj:0,V:t,th:0,Bj:0,Aj:0,Ij:0,Gj:t,Qj:t,Yh:0,Zh:0,Hj:0,Nj:0,ri:0,si:0,ei:t,Vh:t,yf:0,jh:0,fh:0,gh:0,hh:0,bh:0,dh:0,eh:0,mh:t,nh:t,oh:t,Di:t,Ki:t,data:t,min:Infinity,max:-Infinity};a.Ej=Y(this,"uint");a.bi=Y(this,"uchar",10);a.ci=Y(this,"uchar",18);a.ki=Y(this,"uint");a.Cj=Y(this,"ushort");a.xj=Y(this,"uchar");a.gi=Y(this,"uchar");a.Ea=Y(this,"ushort",8);a.Ei=Y(this,"float");a.Fi=Y(this,"float");
a.Gi=Y(this,"float");a.Ci=Y(this,"ushort");a.cf=Y(this,"ushort");a.Wh=Y(this,"ushort");a.Jj=Y(this,"ushort");a.V=Y(this,"float",8);a.th=Y(this,"float");a.Bj=Y(this,"float");a.Aj=Y(this,"float");a.Ij=Y(this,"ushort");a.Gj=Y(this,"uchar");a.Qj=Y(this,"uchar");a.Yh=Y(this,"float");a.Zh=Y(this,"float");a.Hj=Y(this,"float");a.Nj=Y(this,"float");a.ri=Y(this,"uint",1);a.si=Y(this,"uint",1);a.ei=Y(this,"uchar",80);a.Vh=Y(this,"uchar",24);a.yf=Y(this,"ushort");a.jh=Y(this,"ushort");a.fh=Y(this,"float");a.gh=
Y(this,"float");a.hh=Y(this,"float");a.bh=Y(this,"float");a.dh=Y(this,"float");a.eh=Y(this,"float");a.mh=Y(this,"float",4);a.nh=Y(this,"float",4);a.oh=Y(this,"float",4);a.Di=Y(this,"uchar",16);a.Ki=Y(this,"uchar",4);this.L=parseInt(a.th,10);var b=a.Ea[1]*a.Ea[2]*a.Ea[3];switch(a.cf){case 2:a.data=Y(this,"uchar",b);break;case 4:a.data=Y(this,"sshort",b);break;case 8:a.data=Y(this,"sint",b);break;case 16:a.data=Y(this,"float",b);break;case 32:a.data=Y(this,"complex",b);break;case 64:a.data=Y(this,"double",
b);break;case 256:a.data=Y(this,"schar",b);break;case 512:a.data=Y(this,"ushort",b);break;case 768:a.data=Y(this,"uint",b);break;default:n(Error("Unsupported NII data type: "+a.cf))}b=Id(a.data);a.min=b[0];a.max=b[1];return a};B("X.parserNII",Gf);B("X.parserNII.prototype.parse",Gf.prototype.parse);function Hf(){Hd.call(this);this.f="parserOBJ"}C(Hf,Hd);
Hf.prototype.parse=function(a,b,c){E.Xa(this.f+".parse");this.J=c;c=c.byteLength;var d=Y(this,"uchar",c),e=[];b.g=new U(c);b.p=new U(c);var f=b.g,g=b.p,h=0,l;for(l=0;l<c;++l)if(10==d[l]){var k=Jd(d,h,l).replace(/\s{2,}/g," ").split(" ");if("v"==k[0])e.push([parseFloat(k[1]),parseFloat(k[2]),parseFloat(k[3])]);else if("f"==k[0]){var j=e[parseInt(k[1],10)-1],h=e[parseInt(k[2],10)-1],k=e[parseInt(k[3],10)-1];f.add(j[0],j[1],j[2]);f.add(h[0],h[1],h[2]);f.add(k[0],k[1],k[2]);j=new T(j[0],j[1],j[2]);k=
new T(k[0],k[1],k[2]);h=Cc((new T(h[0],h[1],h[2])).Aa(j),k.Aa(j));h.normalize();g.add(h.x,h.y,h.d);g.add(h.x,h.y,h.d);g.add(h.x,h.y,h.d)}h=l+1}E.Ra(this.f+".parse");c=new gd;c.S=b;c.z=a;this.dispatchEvent(c)};B("X.parserOBJ",Hf);B("X.parserOBJ.prototype.parse",Hf.prototype.parse);function If(){P.call(this);this.f="loader";this.yc=new tc;this.ad=0}C(If,P);function Jf(a,b){a.ad+=b/a.yc.ae()/3;a.ad=Math.min(1,a.ad);var c=new Gd;c.ng=a.ad;a.dispatchEvent(c)}function Kf(a){a=a.r.Od;var b=a.split(".").pop().toUpperCase();b==a.toUpperCase()&&(b="");b in Lf||n(Error("The "+b+" file format is not supported."));return[a,b,Lf[b][0],Lf[b][1],Lf[b][2]]}
If.prototype.load=function(a,b){(!a||!b)&&n(Error("No container or object to load."));if(!wc(this.yc.Z,a.qa)||this.yc.get(a.qa)){this.yc.set(a.qa,u);var c=Kf(a)[0];if(a.mb!=t)this.parse(t,a,b);else{var d=new XMLHttpRequest;M(d,"abort",this.xg.bind(this,d,a,b));M(d,"error",this.xg.bind(this,d,a,b));M(d,"load",this.parse.bind(this,d,a,b));d.open("GET",c,q);d.responseType="arraybuffer";d.send(t)}}};
If.prototype.parse=function(a,b,c){Jf(this,1);setTimeout(function(){var d=Kf(b),e=d[3],d=new d[2];Vb(d,td,this.complete.bind(this));var f=b.mb;f==t&&(f=a.response,b.mb=f);d.parse(b,c,f,e)}.bind(this),100)};If.prototype.complete=function(a){Jf(this,1);setTimeout(function(){var b=a.z,c=a.S;b.r.h=u;b.h=q;c.q();this.yc.set(b.qa,q)}.bind(this),100)};If.prototype.xg=function(a,b,c){n(Error("Loading failed: ",b,c))};
var Lf={OBJ:[Hf,t],STL:[Pe,t],VTK:[Re,t],TRK:[Cf,t],FSM:[Te,t],INFLATED:[Te,t],SMOOTHWM:[Te,t],SPHERE:[Te,t],PIAL:[Te,t],ORIG:[Te,t],NRRD:[Ff,t],NII:[Gf,t],GZ:[Gf,t],DCM:[Qe,t],DICOM:[Qe,t],"":[Qe,t],CRV:[Bf,t],LABEL:[Qd,t],MGH:[Af,u],MGZ:[Af,q],TXT:[Ef,t],LUT:[Ef,t],PNG:[Df,"png"],JPG:[Df,"jpeg"],JPEG:[Df,"jpeg"],GIF:[Df,"gif"]};function Mf(a,b){(!x(a)||!x(b))&&n(Error("A camera needs valid width and height values."));P.call(this);this.f="camera";this.bc=new E.l(0,100,0);this.sc=new E.l(0,0,0);this.Y=new E.l(0,0,1);this.D=a;this.u=b;this.n=this.ke(this.bc,this.sc)}C(Mf,P);Mf.prototype.observe=function(a){(a==t||!(a instanceof Ge))&&n(Error("Could not observe the interactor."));M(a,od,this.fj.bind(this));M(a,nd,this.cj.bind(this));M(a,pd,this.rj.bind(this))};
Mf.prototype.fj=function(a){a instanceof Ad||n(Error("Received no valid rotate event."));this.rotate(a.pa)};Mf.prototype.rj=function(a){a instanceof Bd||n(Error("Received no valid zoom event."));a.nb?this.Nf(a.Ya):this.Of(a.Ya)};Mf.prototype.cj=function(a){a instanceof zd||n(Error("Received no valid pan event."));this.uf(a.pa)};Mf.prototype.__defineGetter__("view",v("n"));
Mf.prototype.__defineSetter__("view",function(a){(a==t||!(a instanceof Float32Array))&&n(Error("Invalid view matrix."));this.n=a});Mf.prototype.__defineGetter__("position",function(){return[this.bc.x,this.bc.y,this.bc.d]});Mf.prototype.__defineSetter__("position",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid position."));this.bc=new E.l(a[0],a[1],a[2]);this.reset()});Mf.prototype.__defineGetter__("focus",function(){return[this.sc.x,this.sc.y,this.sc.d]});
Mf.prototype.__defineSetter__("focus",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid focus"));this.sc=new E.l(a[0],a[1],a[2]);this.reset()});Mf.prototype.__defineGetter__("up",function(){return[this.Y.x,this.Y.y,this.Y.d]});Mf.prototype.__defineSetter__("up",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid up vector."));this.Y=new E.l(a[0],a[1],a[2]);this.reset()});w=Mf.prototype;w.reset=function(){this.n=this.ke(this.bc,this.sc)};
w.rotate=function(a){ka(a)&&2==a.length?a=new E.l(a[0],a[1],0):a instanceof E.l||n(Error("Invalid distance vector for rotate operation."));return a};w.uf=function(a){ka(a)&&2==a.length?a=new E.l(a[0],a[1],0):a instanceof E.l||n(Error("Invalid distance vector for pan operation."));this.n[12]-=a.x;this.n[13]+=a.y};w.Nf=function(a){var b=20;a!=t&&!a&&(b=1);this.n[14]+=b};w.Of=function(a){var b=20;a!=t&&!a&&(b=1);this.n[14]-=b};
w.ke=function(a,b){(!(a instanceof E.l)||!(b instanceof E.l))&&n(Error("3D vectors required for calculating the view."));return E.e.sd()};B("X.camera",Mf);B("X.camera.prototype.pan",Mf.prototype.uf);B("X.camera.prototype.rotate",Mf.prototype.rotate);B("X.camera.prototype.zoomIn",Mf.prototype.Nf);B("X.camera.prototype.zoomOut",Mf.prototype.Of);function Nf(a){function b(a,b,d){b=2*b*Math.PI;b=za(Aa(l,Math.cos(b)),Aa(k,Math.sin(b)));a=za(za(c,Aa(e,a)),Aa(b,f));d=za(Aa(b,1-Math.abs(d)),Aa(g,d));return new ec(a,d)}this.P=[];a=a||{};var c=new xa(a.start||[0,-1,0]),d=new xa(a.end||[0,1,0]),e=Ba(d,c),f=a.ub||1;a=a.Df||16;for(var g=Ca(e),h=0.5<Math.abs(g.y()),l=Ca((new xa(h,!h,0)).hc(g)),k=Ca(l.hc(g)),h=new ec(c,Da(g)),d=new ec(d,Ca(g)),j=[],m=0;m<a;m++){var s=m/a,r=(m+1)/a;j.push(new gc([h,b(0,s,-1),b(0,r,-1)]));j.push(new gc([b(0,r,0),b(0,s,
0),b(1,s,0),b(1,r,0)]));j.push(new gc([d,b(1,r,1),b(1,s,1)]))}return oc(j)}C(Nf,nc);function Of(){V.call(this);this.f="cylinder";this.Qe=[-10,-10,-10];this.ye=[10,10,10];this.cc=10;this.Va=32;Ea(this,new jd)}C(Of,V);Of.prototype.__defineGetter__("start",v("Qe"));Of.prototype.__defineSetter__("start",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid start"));this.Qe=a});Of.prototype.__defineGetter__("end",v("ye"));Of.prototype.__defineSetter__("end",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid end"));this.ye=a});Of.prototype.__defineGetter__("radius",v("cc"));
Of.prototype.__defineSetter__("radius",function(a){x(a)||n(Error("Invalid radius."));this.cc=a});Of.prototype.q=function(){ld(this,new Nf({start:this.Qe,end:this.ye,ub:this.cc,Df:this.Va}));Of.v.q.call(this)};B("X.cylinder",Of);B("X.cylinder.prototype.modified",Of.prototype.q);function Pf(a){function b(a,b){a*=2*Math.PI;b*=Math.PI;var e=new xa(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));g.push(new ec(za(c,Aa(e,d)),e))}this.P=[];a=a||{};var c=new xa(a.Ze||[0,0,0]),d=a.ub||1,e=a.Df||16;a=a.Kj||8;for(var f=[],g=[],h=0;h<e;h++)for(var l=0;l<a;l++)g=[],b(h/e,l/a),0<l&&b((h+1)/e,l/a),l<a-1&&b((h+1)/e,(l+1)/a),b(h/e,(l+1)/a),f.push(new gc(g));return oc(f)}C(Pf,nc);function Qf(){V.call(this);this.f="sphere";this.w=[0,0,0];this.cc=5;this.Va=32;this.Nh=16;Ea(this,new jd)}C(Qf,V);Qf.prototype.__defineGetter__("center",v("w"));Qf.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center"));this.w=a});Qf.prototype.__defineGetter__("radius",v("cc"));Qf.prototype.__defineSetter__("radius",function(a){x(a)||n(Error("Invalid radius."));this.cc=a});
Qf.prototype.q=function(){ld(this,new Pf({Ze:this.w,ub:this.cc,Df:this.Va,Kj:this.Nh}));Qf.v.q.call(this)};B("X.sphere",Qf);B("X.sphere.prototype.modified",Qf.prototype.q);function Oe(a){S.call(this);this.f="labelmap";this.Bb=a;this.Pe=new Float32Array([-255,-255,-255,-255])}C(Oe,S);Oe.prototype.q=function(){var a=new gd;a.S=this;this.dispatchEvent(a);this.Bb.q()};Oe.prototype.__defineSetter__("showOnly",function(a){var b=[-1,-1,-1,-1];a!=t&&(ka(a)&&4==a.length?b=a:(this.Ta||n(Error("No colortable assigned.")),b=this.Ta.Za.get(a).slice(1,5)));this.Pe=new Float32Array([Math.floor(255*b[0]),Math.floor(255*b[1]),Math.floor(255*b[2]),Math.floor(255*b[3])])});
B("X.labelmap",Oe);function Rf(a){this.P=[];a=a||{};var b=new xa(a.Ze||[0,0,0]),c=!a.ub?[1,1,1]:a.ub.length?a.ub:[a.ub,a.ub,a.ub];return oc([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(function(a){return new gc(a[0].map(function(e){e=new xa(b.x()+c[0]*(2*!!(e&1)-1),b.y()+c[1]*(2*!!(e&2)-1),b.d()+c[2]*(2*!!(e&4)-1));return new ec(e,new xa(a[1]))}))}))}C(Rf,nc);function Sf(){V.call(this);this.f="cube";this.w=[0,0,0];this.De=this.Ce=this.Be=20;this.Fc=[0,1,1,1,1,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0];Ea(this,new jd)}C(Sf,V);Sf.prototype.__defineGetter__("center",v("w"));Sf.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center"));this.w=a});Sf.prototype.__defineGetter__("lengthX",v("Be"));
Sf.prototype.__defineSetter__("lengthX",function(a){x(a)||n(Error("Invalid lengthX."));this.Be=a});Sf.prototype.__defineGetter__("lengthY",v("Ce"));Sf.prototype.__defineSetter__("lengthY",function(a){x(a)||n(Error("Invalid lengthY."));this.Ce=a});Sf.prototype.__defineGetter__("lengthZ",v("De"));Sf.prototype.__defineSetter__("lengthZ",function(a){x(a)||n(Error("Invalid lengthZ."));this.De=a});Sf.prototype.q=function(){ld(this,new Rf({Ze:this.w,ub:[this.Be/2,this.Ce/2,this.De/2]}));Sf.v.q.call(this)};
B("X.cube",Sf);B("X.cube.prototype.modified",Sf.prototype.q);function Ie(a){Ge.call(this,a);this.f="interactor3D";this.Gk=u}C(Ie,Ge);Ie.prototype.ud=function(a){Ie.v.ud.call(this,a);var b=new Bd;a.Jc==t&&(a.Jc=0);b.nb=0>a.Jc;b.Ya=q;this.dispatchEvent(b)};function Tf(a){P.call(this);this.f="array";this.B=[];this.Rf=a}C(Tf,P);function Uf(a,b,c){for(var d=0;4>d;d++)if(a[d+0]!==b[d+c])return u;return q}Tf.prototype.add=function(a){this.B.push(a);return q};Tf.prototype.remove=function(a){a=this.B.indexOf(a);-1<a&&this.B.splice(a,1);return q};Tf.prototype.clear=function(){this.B.length=0};
function Vf(a,b,c){var d=c-b;if(!(2>d)){d=b+Math.floor(d/2);Vf(a,b,d);for(Vf(a,d,c);b<d;++b)if(0<a.Rf(a.B[b],a.B[d])){var e=a.B[b];a.B[b]=a.B[d];for(var f=a,g=d,h=c;g+1<h&&0>f.Rf(f.B[g+1],e);){var l=f,k=g+1,j=l.B[g];l.B[g]=l.B[k];l.B[k]=j;++g}f.B[g]=e}}}Tf.prototype.sort=function(){Vf(this,0,this.B.length)};function Wf(a,b){Mf.call(this,a,b);this.f="camera2D"}C(Wf,Mf);Wf.prototype.rotate=function(a){a=Wf.v.rotate.call(this,a);var b=new yd;0<a.x?b.Se--:0>a.x&&b.Se++;0<a.y?b.Ee++:0>a.y&&b.Ee--;this.dispatchEvent(b)};Wf.prototype.Nf=function(a){var b=20;a!=t&&!a&&(b=0.02);this.n[14]+=b};Wf.prototype.Of=function(a){var b=20;a!=t&&!a&&(b=0.02);this.n[14]-=b};
Wf.prototype.uf=function(a){ka(a)&&2==a.length?a=new E.l(a[0],a[1],0):a instanceof E.l||n(Error("Invalid distance vector for pan operation."));this.n[12]-=a.x/this.n[14];this.n[13]+=a.y/this.n[14]};function Xf(a,b){Mf.call(this,a,b);this.f="camera3D";this.Uf=45;this.Ke=E.e.kf(E.e.sd(),this.Uf,a/b,1,1E4)}C(Xf,Mf);Xf.prototype.rotate=function(a){a=Xf.v.rotate.call(this,a);var b=-a.x/5*Math.PI/180;a=-a.y/5*Math.PI/180;var c=new E.l(this.n[1],this.n[5],this.n[9]),d=new E.l(this.n[0],this.n[4],this.n[8]);c.normalize();d.normalize();E.e.rotate(this.n,b,c.x,c.y,c.d);E.e.rotate(this.n,a,d.x,d.y,d.d)};Xf.prototype.ke=function(a,b){var c=Xf.v.ke.call(this,a,b);E.e.Mg(c,a,b,this.Y);return c};
function Yf(a,b,c,d){var e=new Float32Array(4),f=new Float32Array(4),g=new Float32Array(16),h=new Float32Array(16);new Float32Array(16);E.e.multiply(a.Ke,a.n,h);E.e.O(h,g);e[0]=b;e[1]=c;e[2]=2*d-1;e[3]=1;E.e.Qg(g,e,f);f[3]=1/f[3];f[0]*=f[3];f[1]*=f[3];f[2]*=f[3];return f}B("X.camera3D",Xf);function Zf(a){Kb.call(this);this.Cb=a;this.K=[]}C(Zf,Kb);var $f=[];function ag(a,b,c,d,e){ka(c)||($f[0]=c,c=$f);for(var f=0;f<c.length;f++){var g=M(b,c[f],d||a,e||u,a.Cb||a);a.K.push(g)}}Zf.prototype.zf=function(){Eb(this.K,Xb);this.K.length=0};Zf.prototype.handleEvent=function(){n(Error("EventHandler.handleEvent not implemented"))};function bg(){}bg.zg=function(){return bg.Hg?bg.Hg:bg.Hg=new bg};bg.prototype.Pi=0;bg.zg();function cg(a){dc.call(this);this.Wb=a||$d();this.zj=dg}C(cg,dc);cg.prototype.Ai=bg.zg();var dg=t;w=cg.prototype;w.Gg=t;w.Lc=u;w.A=t;w.zj=t;w.vd=t;w.od=t;w.$e=t;w.s=v("A");w.Bf=function(a){this.vd&&this.vd!=a&&n(Error("Method not supported"));cg.v.Bf.call(this,a)};w.be=v("Wb");w.Ic=function(){this.A=this.Wb.createElement("div")};w.mc=function(a){this.Zb(a)};
w.Zb=function(a,b){this.Lc&&n(Error("Component already rendered"));this.A||this.Ic();a?a.insertBefore(this.A,b||t):this.Wb.ba.body.appendChild(this.A);(!this.vd||this.vd.Lc)&&this.Yd()};w.Yd=function(){function a(a){!a.Lc&&a.s()&&a.Yd()}this.Lc=q;this.od&&Eb(this.od,a,p)};w.Zd=function(){function a(a){a.Lc&&a.Zd()}this.od&&Eb(this.od,a,p);this.ti&&this.ti.zf();this.Lc=u};
w.removeChild=function(a,b){if(a){var c=ma(a)?a:a.Gg||(a.Gg=":"+(a.Ai.Pi++).toString(36)),d;this.$e&&c?(d=this.$e,d=(c in d?d[c]:p)||t):d=t;a=d;c&&a&&(d=this.$e,c in d&&delete d[c],Ib(this.od,a),b&&(a.Zd(),a.A&&ge(a.A)),c=a,c==t&&n(Error("Unable to set parent component")),c.vd=t,cg.v.Bf.call(c,t))}a||n(Error("Child is not in parent component"));return a};function eg(){dc.call(this)}C(eg,dc);w=eg.prototype;w.Lf=0;w.td=0;w.lf=100;w.wg=0;w.Hf=1;w.Hi=u;w.Oi=u;w.se=function(a){a=fg(this,a);this.Lf!=a&&(this.Lf=a+this.wg>this.lf?this.lf-this.wg:a<this.td?this.td:a,!this.Hi&&!this.Oi&&this.dispatchEvent("change"))};w.ee=function(){return fg(this,this.Lf)};w.de=function(){return fg(this,this.td)};w.ce=function(){return fg(this,this.lf)};function fg(a,b){return a.Hf==t?b:a.td+Math.round((b-a.td)/a.Hf)*a.Hf};function gg(a){cg.call(this,a);this.yd=new eg;M(this.yd,"change",this.ui,u,this)}C(gg,cg);var ig={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};w=gg.prototype;w.Ic=function(){this.vb=this.be().Ic("div","progress-bar-thumb");var a=ig[this.Yg];this.A=this.be().Ic("div",a,this.vb);jg(this);a=this.de();this.s().setAttribute("aria-valuemin",a);a=this.ce();this.s().setAttribute("aria-valuemax",a)};
w.Yd=function(){gg.v.Yd.call(this);I&&7>qb&&M(this.s(),"resize",this.ve,u,this);this.ve();var a=this.s();a.setAttribute("role","progressbar");a.setAttribute("aria-live","polite")};w.Zd=function(){gg.v.Zd.call(this);I&&7>qb&&Wb(this.s(),"resize",this.ve,u,this)};w.ee=function(){return this.yd.ee()};w.se=function(a){this.yd.se(a);this.s()&&jg(this)};function jg(a){var b=a.ee();a.s().setAttribute("aria-valuenow",b)}w.de=function(){return this.yd.de()};w.ce=function(){return this.yd.ce()};w.Yg="horizontal";
w.ui=function(){this.ve();this.dispatchEvent("change")};w.ve=function(){if(this.vb){var a=this.de(),b=this.ce(),a=(this.ee()-a)/(b-a),b=Math.round(100*a);"vertical"==this.Yg?I&&7>qb?(this.vb.style.top=0,this.vb.style.height="100%",b=this.vb.offsetHeight,a=Math.round(a*b),this.vb.style.top=b-a+"px",this.vb.style.height=a+"px"):(this.vb.style.top=100-b+"%",this.vb.style.height=b+"%"):this.vb.style.width=b+"%"}};function kg(a,b){a==t&&n(Error("No valid parent element."));b==t&&n(Error("Invalid initial value."));gg.call(this);this.f="progressbar";this.Ua=a;this.Je="";this.Fd=this.Ab=t;this.$b=[];var c;c=".progress-bar-horizontal {\n  position: relative;\n  border: 1px solid #949dad;\n";c+="  background: white;\n";c+="  padding: 1px;\n";c+="  overflow: hidden;\n";c+="  margin: 2px;\n";c+="  width: 100px;\n";c+="  height: 5px;\n";c+="}";var d;d=".progress-bar-thumb {\n  position: relative;\n  background: #F62217;\n";
d+="  overflow: hidden;\n";d+="  width: 0%;\n";d+="  height: 100%;\n";d+="}";var e;e=".progress-bar-thumb-done {\n  background: #57E964;\n}";this.$b=[c,d,e];this.se(b);this.gf()}C(kg,gg);
kg.prototype.gf=function(){var a=le(this.Ua,"position");if("static"==a||""==a)this.Je=this.Ua.style.position,this.Ua.style.position="relative";var a=document.getElementsByTagName("head")[0],b=ee("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.$b[0])),d=document.createTextNode(String(this.$b[1])),e=document.createTextNode(String(this.$b[2]));a.appendChild(b);b.appendChild(c);b.appendChild(d);b.appendChild(e);this.Ab=b;this.mc(this.Ua);a=this.s();a.style.position=
"absolute";a.style.top=(this.Ua.clientHeight-5)/2+"px";a.style.left=(this.Ua.clientWidth-100)/2+"px";a.classList.add("xtk-progress-bar")};function lg(a){var b=a.s().style.top,c=a.s().style.left;ge(a.s());var d=new kg(a.Ua,100),e=d.s();e.style.position="absolute";e.style.top=b;e.style.left=c;e.classList.add("xtk-progress-bar");(e.firstElementChild!=p?e.firstElementChild:he(e.firstChild)).classList.add("progress-bar-thumb-done");a.Fd=d}
kg.prototype.ge=function(){this.Ab&&ge(this.Ab);this.s()&&ge(this.s());this.Fd&&ge(this.Fd.s());this.Fd=this.Ab=t;this.Je&&(this.Ua.style.position=this.Je)};function mg(a,b,c){na(a)?c&&(a=ua(a,c)):a&&"function"==typeof a.handleEvent?a=ua(a.handleEvent,a):n(Error("Invalid listener argument"));return 2147483647<b?-1:fa.setTimeout(a,b||0)};function ng(){P.call(this);this.f="renderer";this.z=window.document.body;this.D=this.z.clientWidth;this.u=this.z.clientHeight;this.N=this.F=this.oa=t;this.sb=new Tf(id);this.hb=[];this.R=t;this.He=this.Ld=this.Md=u;this.a=this.Da=t;this.Q={PROGRESSBAR_ENABLED:q,INTERMEDIATE_RENDERING:u,SLICENAVIGATORS:q};this.Pf=-1;window.console.log("XTK release 10 -- 2013-09-13 11:42:24 -- http://www.goXTK.com -- @goXTK")}C(ng,P);w=ng.prototype;w.dj=function(a){this.Da&&this.Da.se(100*a.ng)};
w.Ui=function(a){a!=t&&a instanceof gd&&a.S&&this.wb(a.S)};w.ej=function(a){a!=t&&a instanceof hd&&a.S&&this.remove(a.S)};w.rf=function(a){(a==t||!(a instanceof Dd))&&n(Error("Invalid hover event."))};w.sf=function(){var a=ce(this.z);this.D=a.clientWidth;this.u=a.clientHeight;a=ce(this.oa);a.width=this.D;a.height=this.u;"renderer3D"==this.f&&(this.a.viewport(0,0,this.D,this.u),this.F.Ke=E.e.kf(E.e.sd(),this.F.Uf,this.oa.width/this.oa.height,1,1E4))};w.tf=function(a){(a==t||!(a instanceof Cd))&&n(Error("Invalid scroll event."))};
ng.prototype.__defineGetter__("config",v("Q"));ng.prototype.__defineGetter__("interactor",v("N"));ng.prototype.__defineGetter__("camera",v("F"));ng.prototype.__defineGetter__("loadingCompleted",v("Ld"));ng.prototype.__defineGetter__("container",v("z"));ng.prototype.__defineSetter__("container",function(a){a==t&&n(Error("An ID to a valid container (<div>..) is required."));var b=a;ma(b)&&(b=ce(a));oa(b)&&1==b.nodeType||n(Error("Could not find the given container."));this.z=b});w=ng.prototype;
w.zd=function(){this.F.reset()};
w.ua=function(a){var b=ee("canvas");this.z.appendChild(b);this.D=this.z.clientWidth;this.u=this.z.clientHeight;b.width=this.D;b.height=this.u;try{var c=b.getContext(a);c||n(Error())}catch(d){var e="Sorry, "+a+' context is <strong>not supported</strong> on this machine! See <a href="http://crash.goXTK.com" target="_blank">http://crash.goXTK.com</a> for requirements..';this.z.innerHTML='<h3 style="color:red;font-family:sans-serif;">Oooops..</h3><p style="color:red;font-family:sans-serif;">'+e+"</p>";
n(Error(e))}this.R=new If;M(this.R,vd,this.dj.bind(this));this.oa=b;this.a=c;b=new Ie(this.oa);"2d"==a&&(b=new Me(this.oa));b.ua();M(b,rd,this.zd.bind(this));M(b,wd,this.rf.bind(this));M(b,qd,this.tf.bind(this));this.N=b;b=new Xf(this.D,this.u);"2d"==a&&(b=new Wf(this.D,this.u));b.observe(this.N);this.F=b;M(window,"resize",this.sf,u,this)};w.add=function(a){(a instanceof Sf||a instanceof Qf||a instanceof Of)&&a.q();this.hb.push(a);this.wb(a)};
w.remove=function(a){(!this.oa||!this.a)&&n(Error("The renderer was not initialized properly."));if(a!=t){var b=0;if(a!=t){if(a=pa(a),Rb[a]){a=Rb[a];for(var c=a.length-1;0<=c;c--)Xb(a[c].key),b++}}else La(Pb,function(a,c){Xb(c);b++})}return u};w.wb=function(a){(!this.oa||!this.a)&&n(Error("The renderer was not initialized properly."));a!=t&&(Zb(a,td)||M(a,td,this.Ui.bind(this)),Zb(a,ud)||M(a,ud,this.ej.bind(this)))};
w.get=function(a){a==t&&n(Error("Invalid object id."));for(var b=this.sb.B,c=b.length,d=0,d=0;d<c;d++)if(b[d].qa==a)return b[d];return t};
w.mc=function(){(!this.oa||!this.a)&&n(Error("The renderer was not initialized properly."));if(this.ig==t){if(vc(this.R.yc)){if(this.Q.PROGRESSBAR_ENABLED&&!this.Da&&(this.Da=new kg(this.z,3)),this.He=this.Ld=u,this.ig=mg(function(){this.ig=t;this.mc()}.bind(this),100),!this.Q.INTERMEDIATE_RENDERING)return}else if(!this.Ld&&!this.He&&(this.He=q,eval("this.onShowtime()"),this.Ld=q),this.Da){this.Q.PROGRESSBAR_ENABLED&&(this.Da&&!this.Qf)&&(lg(this.Da),this.Qf=mg(function(){this.Qf=t;this.Da&&(this.Da.ge(),
this.Da=t);this.mc()}.bind(this),700));return}this.Pf=window.requestAnimationFrame(this.mc.bind(this),this.oa);eval("this.onRender()");this.Zb(u,q)}};w.Xg=da();w.Vg=da();w.Zb=da();
w.Wd=function(){window.cancelAnimationFrame(this.Pf);this.R&&(delete this.R,this.R=t);this.Da&&(this.Da.ge(),delete this.Da,this.Da=t);this.sb.clear();delete this.sb;this.hb.length=0;delete this.hb;delete this.R;this.R=t;delete this.F;this.F=t;delete this.N;this.N=t;delete this.a;this.a=t;ge(this.oa);delete this.oa;this.oa=t};function og(){P.call(this);this.f="shaders";this.Rd="";var a;a="precision mediump float;\n\n";a+="attribute vec3 vertexPosition;\n";a+="attribute vec3 vertexNormal;\n";a+="attribute vec3 vertexColor;\n";a+="attribute vec2 vertexTexturePos;\n";a+="attribute float vertexScalar;\n";a+="\n";a+="uniform mat4 view;\n";a+="uniform mat4 perspective;\n";a+="uniform vec3 center;\n";a+="uniform mat4 objectTransform;\n";a+="uniform bool useObjectColor;\n";a+="uniform bool useScalars;\n";a+="uniform bool scalarsReplaceMode;\n";
a+="uniform float scalarsMin;\n";a+="uniform float scalarsMax;\n";a+="uniform vec3 scalarsMinColor;\n";a+="uniform vec3 scalarsMaxColor;\n";a+="uniform float scalarsMinThreshold;\n";a+="uniform float scalarsMaxThreshold;\n";a+="uniform int scalarsInterpolation;\n";a+="uniform vec3 objectColor;\n";a+="uniform float pointSize;\n";a+="\n";a+="varying float fDiscardNow;\n";a+="varying vec4 fVertexPosition;\n";a+="varying vec3 fragmentColor;\n";a+="varying vec2 fragmentTexturePos;\n";a+="varying vec3 fVertexNormal;\n";
a+="varying vec3 fTransformedVertexNormal;\n";a+="\n";a+="void main(void) {\n";a+="  fTransformedVertexNormal = mat3(view[0].xyz,view[1].xyz,view[2].xyz) * ";a+="mat3(objectTransform[0].xyz,objectTransform[1].xyz,objectTransform[2].xyz) * ";a+="vertexNormal;\n";a+="  fVertexNormal = vertexNormal;\n";a+="  fDiscardNow = 0.0;\n";a+="  vec3 vertexPosition2 = vertexPosition - center;\n";a+="  fVertexPosition = view * objectTransform * vec4(vertexPosition2, 1.0);\n";a+="  fragmentTexturePos = vertexTexturePos;\n";
a+="  if (useScalars) {\n";a+="    float scalarValue = vertexScalar;\n";a+="    if (scalarValue < scalarsMinThreshold || scalarValue > scalarsMaxThreshold) {\n";a+="      if (scalarsReplaceMode) {\n";a+="        fragmentColor = objectColor;\n";a+="      } else {\n";a+="        fDiscardNow = 1.0;\n";a+="      }\n";a+="    } else {\n";a+="      if (scalarsReplaceMode) {\n";a+="        if (scalarsInterpolation == 1) {\n";a+="            vec3 zeroMaxColor;\n";a+="            vec3 zeroMinColor;\n";a+=
"            zeroMaxColor[0] = scalarsMaxColor[0]*0.33;\n";a+="            zeroMaxColor[1] = scalarsMaxColor[1]*0.33;\n";a+="            zeroMaxColor[2] = scalarsMaxColor[2]*0.33;\n";a+="            zeroMinColor[0] = scalarsMinColor[0]*0.33;\n";a+="            zeroMinColor[1] = scalarsMinColor[1]*0.33;\n";a+="            zeroMinColor[2] = scalarsMinColor[2]*0.33;\n";a+="            if(scalarValue < 0.0) {fragmentColor = scalarValue/(scalarsMin) * scalarsMinColor + (1.0 - scalarValue/(scalarsMin)) * (zeroMinColor);}\n";
a+="            else {fragmentColor = scalarValue/(scalarsMax) * scalarsMaxColor + (1.0 - scalarValue/(scalarsMax)) * (zeroMaxColor);}\n";a+="        } else {\n";a+="            fragmentColor = scalarValue * scalarsMaxColor + (1.0 - scalarValue) * scalarsMinColor;\n";a+="          }\n";a+="      } else {\n";a+="        fragmentColor = vertexColor;\n";a+="      }\n";a+="    }\n";a+="  } else if (useObjectColor) {\n";a+="    fragmentColor = objectColor;\n";a+="  } else {\n";a+="    fragmentColor = vertexColor;\n";
a+="  }\n";a+="  gl_PointSize = pointSize;\n";a+="  gl_Position = perspective * fVertexPosition;\n";this.Rd=a+="}\n";this.Gd="";a="precision mediump float;\n\n";a+="uniform bool usePicking;\n";a+="uniform bool useTexture;\n";a+="uniform bool volumeTexture;\n";a+="uniform bool useLabelMapTexture;\n";a+="uniform sampler2D textureSampler;\n";a+="uniform sampler2D textureSampler2;\n";a+="uniform float objectOpacity;\n";a+="uniform float labelmapOpacity;\n";a+="uniform vec4 labelmapColor;\n";a+="uniform float volumeLowerThreshold;\n";
a+="uniform float volumeUpperThreshold;\n";a+="uniform float volumeScalarMin;\n";a+="uniform float volumeScalarMax;\n";a+="uniform vec3 volumeScalarMinColor;\n";a+="uniform vec3 volumeScalarMaxColor;\n";a+="uniform float volumeWindowLow;\n";a+="uniform float volumeWindowHigh;\n";a+="\n";a+="varying float fDiscardNow;\n";a+="varying vec4 fVertexPosition;\n";a+="varying vec3 fragmentColor;\n";a+="varying vec2 fragmentTexturePos;\n";a+="varying vec3 fVertexNormal;\n";a+="varying vec3 fTransformedVertexNormal;\n";
a+="\n";a+="void main(void) {\n";a+=" if (fDiscardNow > 0.0) {\n";a+="   discard;\n";a+=" }\n";a+=" if (usePicking) {\n";a+="   gl_FragColor = vec4(fragmentColor, 1.0);\n";a+=" } else if (useTexture) {\n";a+="   vec4 texture1 = texture2D(textureSampler,fragmentTexturePos);\n";a+="   vec4 textureSum = texture1;\n";a+="   if (volumeTexture) {\n";a+="     float _windowLow = (volumeWindowLow / volumeScalarMax);\n";a+="     float _windowHigh = (volumeWindowHigh / volumeScalarMax);\n";a+="     vec3 _minrange = vec3(_windowLow,_windowLow,_windowLow);\n";
a+="     vec3 _maxrange = vec3(_windowHigh,_windowHigh,_windowHigh);\n";a+="     vec3 fac = _maxrange - _minrange;\n";a+="     textureSum = vec4((textureSum.r - _minrange)/fac,1);\n";a+="     textureSum = textureSum.r * vec4(volumeScalarMaxColor,1) + (1.0 - textureSum.r) * vec4(volumeScalarMinColor,1);\n";a+="   }\n";a+="   if (useLabelMapTexture) {\n";a+="     vec4 texture2 = texture2D(textureSampler2,fragmentTexturePos);\n";a+="     if (texture2.a > 0.0) {\n";a+="         if (labelmapColor.a != -255.0) {\n";
a+="           if (all(equal(floor(texture2 * vec4(255)), labelmapColor))) {\n";a+="             if (labelmapOpacity < 1.0) {\n";a+="               textureSum = mix(texture2, textureSum, 1.0 - labelmapOpacity);\n";a+="             } else {\n";a+="               textureSum = texture2;\n";a+="             }\n";a+="           }\n";a+="         } else {\n";a+="           if (labelmapOpacity < 1.0) {\n";a+="             textureSum = mix(texture2, textureSum, 1.0 - labelmapOpacity);\n";a+="           } else {\n";
a+="             textureSum = texture2;\n";a+="           }\n";a+="         }\n";a+="     }\n";a+="   }\n";a+="   if (volumeTexture) {\n";a+="     float _volumeLowerThreshold = (volumeLowerThreshold / volumeScalarMax);\n";a+="     float _volumeUpperThreshold = (volumeUpperThreshold / volumeScalarMax);\n";a+="     if (texture1.r < _volumeLowerThreshold ||\n";a+="         texture1.r > _volumeUpperThreshold ||\n";a+="         texture1.a == 0.0 ) {\n";a+="       discard;\n";a+="     };\n";a+="   };\n";
a+="   gl_FragColor = textureSum;\n";a+="   gl_FragColor.a = objectOpacity;\n";a+=" } else {\n";a+="   vec3 nNormal = normalize(fTransformedVertexNormal);\n";a+="   if (fVertexNormal == vec3(0.0,0.0,0.0)) {\n";a+="     gl_FragColor = vec4(fragmentColor,1.0);\n";a+="     return;\n";a+="   }\n";a+="   vec3 light = vec3(0.0, 0.0, 1.0);\n";a+="   vec3 lightDirection = vec3(0,0,-10);\n";a+="   lightDirection = normalize(lightDirection);\n";a+="   vec3 eyeDirection = normalize(-fVertexPosition.xyz);\n";
a+="   vec3 reflectionDirection = reflect(-lightDirection, nNormal);\n";a+="   float specular = pow(max(dot(reflectionDirection, eyeDirection), 0.0), 10.0);\n";a+="   float diffuse = 0.8 * max(dot(nNormal, light), 0.0);\n";a+="   float ambient = 0.3;\n";a+="   gl_FragColor = vec4(fragmentColor * ambient +\n";a+="                       fragmentColor * diffuse +\n";a+="                       vec3(0.2, 0.2, 0.2) * specular,\n";a+="                       objectOpacity);\n";a+=" }\n";this.Gd=a+="}\n"}
C(og,P);
var pg={sk:"vertexPosition",rk:"vertexNormal",qk:"vertexColor",uk:"vertexTexturePos",tk:"vertexScalar"},qg={vk:"view",$j:"perspective",Rj:"center",Zj:"objectTransform",mk:"useObjectColor",Xj:"objectColor",ok:"useScalars",ik:"scalarsReplaceMode",fk:"scalarsMin",ck:"scalarsMax",gk:"scalarsMinColor",dk:"scalarsMaxColor",hk:"scalarsMinThreshold",ek:"scalarsMaxThreshold",bk:"scalarsInterpolation",ak:"pointSize",Yj:"objectOpacity",Wj:"normal",nk:"usePicking",pk:"useTexture",lk:"useLabelMapTexture",Uj:"labelmapOpacity",
Tj:"labelmapColor",jk:"textureSampler",kk:"textureSampler2",wk:"volumeLowerThreshold",Ck:"volumeUpperThreshold",zk:"volumeScalarMin",xk:"volumeScalarMax",Ak:"volumeScalarMinColor",yk:"volumeScalarMaxColor",Ek:"volumeWindowLow",Dk:"volumeWindowHigh",Bk:"volumeTexture"};function rg(a,b,c){a==t&&n(Error("Invalid GL Buffer."));b==t&&n(Error("Invalid number of items."));c==t&&n(Error("Invalid item size."));P.call(this);this.f="buffer";this.H=a;this.Mb=b;this.Nb=c}C(rg,P);function sg(a,b,c,d,e,f,g,h){var l,k;if(l=c.offsetParent){var j="HTML"==l.tagName||"BODY"==l.tagName;if(!j||"static"!=me(l,"position"))k=re(l),j||(j=(j=se(l))&&jb?-l.scrollLeft:j&&(!I||!xb("8"))&&"visible"!=me(l,"overflowX")?l.scrollWidth-l.clientWidth-l.scrollLeft:l.scrollLeft,k=Sd(k,new Rd(j,l.scrollTop)))}l=k||new Rd;k=re(a);j=we(a);k=new Vd(k.x,k.y,j.width,j.height);(j=qe(a))&&k.Ig(new Vd(j.left,j.top,j.right-j.left,j.bottom-j.top));var j=$d(a),m=$d(c);if(j.ba!=m.ba){var s=j.ba.body,m=m.ba.parentWindow||
m.ba.defaultView,r=new Rd(0,0),z=be(s)?be(s).parentWindow||be(s).defaultView:window,y=s;do{var D=z==m?re(y):te(y);r.x+=D.x;r.y+=D.y}while(z&&z!=m&&(y=z.frameElement)&&(z=z.parent));s=Sd(r,re(s));I&&!je(j)&&(s=Sd(s,ke(j)));k.left+=s.x;k.top+=s.y}a=(b&4&&se(a)?b^2:b)&-5;b=new Rd(a&2?k.left+k.width:k.left,a&1?k.top+k.height:k.top);b=Sd(b,l);e&&(b.x+=(a&2?-1:1)*e.x,b.y+=(a&1?-1:1)*e.y);var F;if(g&&(F=qe(c)))F.top-=l.y,F.right-=l.x,F.bottom-=l.y,F.left-=l.x;return tg(b,c,d,f,F,g,h)}
function tg(a,b,c,d,e,f,g){a=a.k();var h=0,l=(c&4&&se(b)?c^2:c)&-5;c=we(b);g=g?g.k():c.k();if(d||0!=l)l&2?a.x-=g.width+(d?d.right:0):d&&(a.x+=d.left),l&1?a.y-=g.height+(d?d.bottom:0):d&&(a.y+=d.top);if(f){if(e){h=a;d=0;if(65==(f&65)&&(h.x<e.left||h.x>=e.right))f&=-2;if(132==(f&132)&&(h.y<e.top||h.y>=e.bottom))f&=-5;h.x<e.left&&f&1&&(h.x=e.left,d|=1);h.x<e.left&&(h.x+g.width>e.right&&f&16)&&(g.width=Math.max(g.width-(h.x+g.width-e.right),0),d|=4);h.x+g.width>e.right&&f&1&&(h.x=Math.max(e.right-g.width,
e.left),d|=1);f&2&&(d|=(h.x<e.left?16:0)|(h.x+g.width>e.right?32:0));h.y<e.top&&f&4&&(h.y=e.top,d|=2);h.y<=e.top&&(h.y+g.height<e.bottom&&f&32)&&(g.height=Math.max(g.height-(e.top-h.y),0),h.y=0,d|=8);h.y>=e.top&&(h.y+g.height>e.bottom&&f&32)&&(g.height=Math.max(g.height-(h.y+g.height-e.bottom),0),d|=8);h.y+g.height>e.bottom&&f&4&&(h.y=Math.max(e.bottom-g.height,e.top),d|=2);f&8&&(d|=(h.y<e.top?64:0)|(h.y+g.height>e.bottom?128:0));h=d}else h=256;if(h&496)return h}f=a;e=jb&&($a||ob)&&xb("1.9");f instanceof
Rd?(a=f.x,f=f.y):(a=f,f=p);b.style.left=ve(a,e);b.style.top=ve(f,e);if(!(c==g||(!c||!g?0:c.width==g.width&&c.height==g.height)))a=je($d(be(b))),I&&(!a||!xb("8"))?(c=b.style,a?(I?(a=Ae(b,"paddingLeft"),e=Ae(b,"paddingRight"),f=Ae(b,"paddingTop"),d=Ae(b,"paddingBottom"),a=new Td(f,e,d,a)):(a=le(b,"paddingLeft"),e=le(b,"paddingRight"),f=le(b,"paddingTop"),d=le(b,"paddingBottom"),a=new Td(parseFloat(f),parseFloat(e),parseFloat(d),parseFloat(a))),I?(e=Ce(b,"borderLeft"),f=Ce(b,"borderRight"),d=Ce(b,"borderTop"),
b=Ce(b,"borderBottom"),b=new Td(d,f,b,e)):(e=le(b,"borderLeftWidth"),f=le(b,"borderRightWidth"),d=le(b,"borderTopWidth"),b=le(b,"borderBottomWidth"),b=new Td(parseFloat(d),parseFloat(f),parseFloat(b),parseFloat(e))),c.pixelWidth=g.width-b.left-a.left-a.right-b.right,c.pixelHeight=g.height-b.top-a.top-a.bottom-b.bottom):(c.pixelWidth=g.width,c.pixelHeight=g.height)):(b=b.style,jb?b.MozBoxSizing="border-box":kb?b.WebkitBoxSizing="border-box":b.boxSizing="border-box",b.width=Math.max(g.width,0)+"px",
b.height=Math.max(g.height,0)+"px");return h};function ug(){}ug.prototype.lb=da();function vg(a,b){this.af=a instanceof Rd?a:new Rd(a,b)}C(vg,ug);vg.prototype.lb=function(a,b,c,d){sg(ne(a),0,a,b,this.af,c,t,d)};function wg(a,b,c){this.element=a;this.ug=b;this.sj=c}C(wg,ug);wg.prototype.lb=function(a,b,c){sg(this.element,this.ug,a,b,p,c,this.sj)};function xg(a,b){dc.call(this);this.Cb=new Zf(this);this.Af(a||t);b&&(this.Mc=b)}C(xg,dc);w=xg.prototype;w.A=t;w.Uh=q;w.og=t;w.Fa=u;w.Dj=u;w.jf=-1;w.Lg=-1;w.zi=u;w.ii=q;w.Mc="toggle_display";w.s=v("A");w.Af=function(a){this.Fa&&n(Error("Can not change this state of the popup while showing."));this.A=a};
function yg(a,b){a.ue&&a.ue.stop();a.fe&&a.fe.stop();if(b){if(!a.Fa&&a.pf()){a.A||n(Error("Caller must call setElement before trying to show the popup"));a.lb();var c=be(a.A);a.zi&&ag(a.Cb,c,"keydown",a.Si,q);if(a.Uh)if(ag(a.Cb,c,"mousedown",a.Tg,q),I){var d;try{d=c.activeElement}catch(e){}for(;d&&"IFRAME"==d.nodeName;){try{var f=d.contentDocument||d.contentWindow.document}catch(g){break}c=f;d=c.activeElement}ag(a.Cb,c,"mousedown",a.Tg,q);ag(a.Cb,c,"deactivate",a.Sg)}else ag(a.Cb,c,"blur",a.Sg);"toggle_display"==
a.Mc?(a.A.style.visibility="visible",ye(a.A,q)):"move_offscreen"==a.Mc&&a.lb();a.Fa=q;a.ue?(Vb(a.ue,"end",a.Wg,u,a),a.ue.play()):a.Wg()}}else zg(a)}w.lb=ga;function zg(a,b){if(!a.Fa||!a.dispatchEvent({type:"beforehide",target:b}))return u;a.Cb&&a.Cb.zf();a.Fa=u;a.Lg=wa();a.fe?(Vb(a.fe,"end",va(a.tg,b),u,a),a.fe.play()):a.tg(b);return q}w.tg=function(a){"toggle_display"==this.Mc?this.Dj?mg(this.Dg,0,this):this.Dg():"move_offscreen"==this.Mc&&(this.A.style.top="-10000px");this.qf(a)};
w.Dg=function(){this.A.style.visibility="hidden";ye(this.A,u)};w.pf=function(){return this.dispatchEvent("beforeshow")};w.Wg=function(){this.jf=wa();this.Lg=-1;this.dispatchEvent("show")};w.qf=function(a){this.dispatchEvent({type:"hide",target:a})};w.Tg=function(a){a=a.target;!ie(this.A,a)&&((!this.og||ie(this.og,a))&&!(150>wa()-this.jf))&&zg(this,a)};w.Si=function(a){27==a.keyCode&&zg(this,a.target)&&(a.preventDefault(),a.stopPropagation())};
w.Sg=function(a){if(this.ii){var b=be(this.A);if(I||ib){if(a=b.activeElement,!a||ie(this.A,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>wa()-this.jf||zg(this)}};function Ag(a,b){this.wj=4;this.le=b||p;xg.call(this,a)}C(Ag,xg);Ag.prototype.lb=function(){if(this.le){var a=!this.Fa&&"move_offscreen"!=this.Mc,b=this.s();a&&(b.style.visibility="hidden",ye(b,q));this.le.lb(b,this.wj,this.Zk);a&&ye(b,u)}};function Bg(a){this.Z=new tc;a&&this.Te(a)}function Cg(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+pa(a):b.substr(0,1)+a}w=Bg.prototype;w.ae=function(){return this.Z.ae()};w.add=function(a){this.Z.set(Cg(a),a)};w.Te=function(a){a=sc(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};w.zf=function(a){a=sc(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};w.remove=function(a){return this.Z.remove(Cg(a))};w.clear=function(){this.Z.clear()};
w.contains=function(a){a=Cg(a);return wc(this.Z.Z,a)};w.Ig=function(a){var b=new Bg;a=sc(a);for(var c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};w.rd=function(){return this.Z.rd()};w.k=function(){return new Bg(this)};function Dg(a,b,c){this.Wb=c||(a?$d(ce(a)):$d());Ag.call(this,this.Wb.Ic("div",{style:"position:absolute;display:none;"}));this.bf=new Rd(1,1);this.Xd=new Bg;a&&Eg(this,a);if(b!=t)if(a=this.s(),"textContent"in a)a.textContent=b;else if(a.firstChild&&3==a.firstChild.nodeType){for(;a.lastChild!=a.firstChild;)a.removeChild(a.lastChild);a.firstChild.data=b}else{for(;c=a.firstChild;)a.removeChild(c);a.appendChild(be(a).createTextNode(String(b)))}}C(Dg,Ag);var Fg=[];w=Dg.prototype;w.Ja=t;w.className="goog-tooltip";
w.kh=500;w.yi=0;w.be=v("Wb");function Eg(a,b){b=ce(b);a.Xd.add(b);M(b,"mouseover",a.xi,u,a);M(b,"mouseout",a.Ag,u,a);M(b,"mousemove",a.wi,u,a);M(b,"focus",a.vi,u,a);M(b,"blur",a.Ag,u,a)}w.Af=function(a){var b=this.s();b&&ge(b);Dg.v.Af.call(this,a);a&&(b=this.Wb.ba.body,b.insertBefore(a,b.lastChild))};
w.pf=function(){if(!xg.prototype.pf.call(this))return u;if(this.anchor)for(var a,b=0;a=Fg[b];b++)ie(a.s(),this.anchor)||yg(a,u);0<=Db(Fg,this)||Fg.push(this);a=this.s();a.className=this.className;Gg(this);M(a,"mouseover",this.Cg,u,this);M(a,"mouseout",this.Bg,u,this);Hg(this);return q};
w.qf=function(){Ib(Fg,this);for(var a=this.s(),b,c=0;b=Fg[c];c++)b.anchor&&ie(a,b.anchor)&&yg(b,u);this.$g&&Ig(this.$g);Wb(a,"mouseover",this.Cg,u,this);Wb(a,"mouseout",this.Bg,u,this);this.anchor=p;if(0==(this.Fb?this.Fa?4:1:this.Kc?3:this.Fa?2:0))this.qe=u;xg.prototype.qf.call(this)};w.Pg=function(a,b){this.anchor==a&&this.Xd.contains(this.anchor)&&(this.qe||!this.cl?(yg(this,u),this.Fa||(this.anchor=a,this.le=b||Jg(this,0)||p,this.Fa&&this.lb(),yg(this,q))):this.anchor=p);this.Fb=p};
w.Ni=function(a){this.Kc=p;a==this.anchor&&(this.Ja==t||this.Ja!=this.s()&&!this.Xd.contains(this.Ja))&&(!this.qg||!this.qg.Ja)&&yg(this,u)};function Kg(a,b){var c=ke(a.Wb);a.bf.x=b.clientX+c.x;a.bf.y=b.clientY+c.y}w.xi=function(a){var b=Lg(this,a.target);this.Ja=b;Gg(this);b!=this.anchor&&(this.anchor=b,this.Fb||(this.Fb=mg(ua(this.Pg,this,b,p),this.kh)),Mg(this),Kg(this,a))};function Lg(a,b){try{for(;b&&!a.Xd.contains(b);)b=b.parentNode;return b}catch(c){return t}}
w.wi=function(a){Kg(this,a);this.qe=q};w.vi=function(a){this.Ja=a=Lg(this,a.target);this.qe=q;if(this.anchor!=a){this.anchor=a;var b=Jg(this,1);Gg(this);this.Fb||(this.Fb=mg(ua(this.Pg,this,a,b),this.kh));Mg(this)}};function Jg(a,b){if(0==b){var c=a.bf.k();return new Ng(c)}return new Og(a.Ja)}function Mg(a){if(a.anchor)for(var b,c=0;b=Fg[c];c++)ie(b.s(),a.anchor)&&(b.qg=a,a.$g=b)}
w.Ag=function(a){var b=Lg(this,a.target),c=Lg(this,a.relatedTarget);b!=c&&(b==this.Ja&&(this.Ja=t),Hg(this),this.qe=u,this.Fa&&(!a.relatedTarget||!ie(this.s(),a.relatedTarget))?Ig(this):this.anchor=p)};w.Cg=function(){var a=this.s();this.Ja!=a&&(Gg(this),this.Ja=a)};w.Bg=function(a){var b=this.s();if(this.Ja==b&&(!a.relatedTarget||!ie(b,a.relatedTarget)))this.Ja=t,Ig(this)};function Hg(a){a.Fb&&(fa.clearTimeout(a.Fb),a.Fb=p)}
function Ig(a){if(2==(a.Fb?a.Fa?4:1:a.Kc?3:a.Fa?2:0))a.Kc=mg(ua(a.Ni,a,a.anchor),a.yi)}function Gg(a){a.Kc&&(fa.clearTimeout(a.Kc),a.Kc=p)}function Ng(a,b){vg.call(this,a,b)}C(Ng,vg);Ng.prototype.lb=function(a,b,c){b=ne(a);b=qe(b);c=c?new Td(c.top+10,c.right,c.bottom,c.left+10):new Td(10,0,0,10);tg(this.af,a,4,c,b,9)&496&&tg(this.af,a,4,c,b,5)};function Og(a){wg.call(this,a,3)}C(Og,wg);
Og.prototype.lb=function(a,b,c){var d=new Rd(10,0);sg(this.element,this.ug,a,b,d,c,9)&496&&sg(this.element,2,a,1,d,c,5)};function Pg(a,b,c,d){a==t&&n(Error("No valid parent element."));(!x(b)||!x(c))&&n(Error("Invalid coordinates."));(d==t||!(d instanceof Ge))&&n(Error("Invalid interactor."));Dg.call(this);this.f="caption";this.Ua=a;this.Td=b;this.Ud=c;this.N=d;this.Ab=t;this.$b=[];a=".x-tooltip {\n  background: #C0C0FF;\n  color: #000000;\n";a+="  border: 1px solid infotext;\n";a+="  padding: 1px;\n";a+="  font-family: sans-serif;\n";a+="}";this.$b=[a];Vb(d,xd,this.ge.bind(this));this.gf()}C(Pg,Dg);
Pg.prototype.gf=function(){var a=le(this.Ua,"position");if("static"==a||""==a)this.Ua.style.position="relative";var a=document.getElementsByTagName("head")[0],b=ee("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.$b[0]));a.appendChild(b);b.appendChild(c);this.Ab=b;this.le=new vg(this.Td,this.Ud)||p;this.Fa&&this.lb();yg(this,q);Eg(this,this.Ua);this.s().classList.add("x-tooltip")};
Pg.prototype.ge=function(){yg(this,u);this.Ab&&ge(this.Ab);this.s()&&ge(this.s());this.Ab=t};function Qg(){ng.call(this);this.f="renderer3D";this.Uc=this.Xc=this.Tc=this.Wc=this.Sc=this.Vc=this.Ne=this.Oe=t;this.w=[0,0,0];this.Nc=[0,0,0];this.gg=t;this.xe=new tc;this.kd=new tc;this.ec=new tc;this.Yc=new tc;this.rc=new tc;this.Bc=new tc;this.dc=new tc;this.Gc=new tc;this.Q={PROGRESSBAR_ENABLED:q,PICKING_ENABLED:q,ORDERING_ENABLED:q,STATISTICS_ENABLED:u,INTERMEDIATE_RENDERING:u}}C(Qg,ng);Qg.prototype.__defineGetter__("config",v("Q"));w=Qg.prototype;
w.yj=function(){this.Uc=this.Xc=this.Tc=this.Wc=this.Sc=this.Vc=t;this.w=[0,0,0]};w.rf=function(a){Qg.v.rf.call(this,a);var b=a.Td;a=a.Ud;var c=this.wf(b,a);if(c=this.get(c))if(c=c.qc){var d=te(this.z);(new Pg(this.z,d.x+b+10,d.y+a+10,this.N)).s().innerHTML=c}};
w.ua=function(){Qg.v.ua.call(this,"experimental-webgl");try{if(this.a.viewport(0,0,this.D,this.u),this.a.clearColor(this.Nc[0],this.Nc[1],this.Nc[2],0),this.a.enable(this.a.BLEND),this.a.blendEquation(this.a.FUNC_ADD),this.a.blendFunc(this.a.SRC_ALPHA,this.a.ONE_MINUS_SRC_ALPHA),this.a.enable(this.a.DEPTH_TEST),this.a.depthFunc(this.a.LEQUAL),this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT),this.Q.PICKING_ENABLED){var a=this.a.createFramebuffer(),b=this.a.createRenderbuffer(),c=this.a.createTexture();
this.a.bindTexture(this.a.TEXTURE_2D,c);this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGB,this.D,this.u,0,this.a.RGB,this.a.UNSIGNED_BYTE,t);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST);this.a.bindFramebuffer(this.a.FRAMEBUFFER,
a);this.a.bindRenderbuffer(this.a.RENDERBUFFER,b);this.a.renderbufferStorage(this.a.RENDERBUFFER,this.a.DEPTH_COMPONENT16,this.D,this.u);this.a.bindRenderbuffer(this.a.RENDERBUFFER,t);this.a.framebufferTexture2D(this.a.FRAMEBUFFER,this.a.COLOR_ATTACHMENT0,this.a.TEXTURE_2D,c,0);this.a.framebufferRenderbuffer(this.a.FRAMEBUFFER,this.a.DEPTH_ATTACHMENT,this.a.RENDERBUFFER,b);this.a.bindFramebuffer(this.a.FRAMEBUFFER,t);this.gg=a}}catch(d){n(Error("Exception while accessing GL Context!\n"+d))}a=new og;
(this.oa==t||this.a==t||this.F==t)&&n(Error("Renderer was not initialized properly."));(a==t||!(a instanceof og))&&n(Error("Could not add shaders."));b=Object.keys(qg);Object.keys(pg).every(function(a){a=pg[a];return-1!=this.Rd.search(a)||-1!=this.Gd.search(a)}.bind(a))||n(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=qg[a];return-1!=this.Rd.search(a)||-1!=this.Gd.search(a)}.bind(a))||n(Error("Could not find all uniforms in the shader sources."));b=this.a.createShader(this.a.FRAGMENT_SHADER);
c=this.a.createShader(this.a.VERTEX_SHADER);this.a.shaderSource(b,a.Gd);this.a.shaderSource(c,a.Rd);this.a.compileShader(b);this.a.compileShader(c);this.a.getShaderParameter(b,this.a.COMPILE_STATUS)||n(Error("Fragement Shader compilation failed!\n"+this.a.getShaderInfoLog(b)));this.a.getShaderParameter(c,this.a.COMPILE_STATUS)||n(Error("Vertex Shader compilation failed!\n"+this.a.getShaderInfoLog(c)));var e=this.a.createProgram();this.a.attachShader(e,c);this.a.attachShader(e,b);this.a.linkProgram(e);
this.a.getProgramParameter(e,this.a.LINK_STATUS)||n(Error("Could not create shader program!\n"+this.a.getShaderInfoLog(b)+"\n"+this.a.getShaderInfoLog(c)+"\n"+this.a.getProgramInfoLog(e)));this.a.useProgram(e);this.Ne=e;Object.keys(pg).forEach(function(a){a=pg[a];this.xe.set(a,this.a.getAttribLocation(this.Ne,a));this.a.enableVertexAttribArray(this.xe.get(a))}.bind(this));Object.keys(qg).forEach(function(a){a=qg[a];this.kd.set(a,this.a.getUniformLocation(this.Ne,a))}.bind(this));this.Oe=a};
w.wb=function(a){Qg.v.wb.call(this,a);var b=u;if(a!=t){this.get(a.qa)&&(b=q);var c=a.qa,d=a.g,e=a.p,f=a.ia,g=a.T,h=a.r,l=a.aa,k=a.Ta,j=a.j,m=a.C;if(j!=t&&j.r!=t&&j.r.h)this.wb(j);else if(j!=t&&j.h&&this.wb(j),k!=t&&k.r!=t&&k.r.h)this.R.load(k,a);else if(g!=t&&g.r!=t&&g.r.h)this.R.load(g,a);else{if(h!=t&&ka(h))if(a.nc!=t){if(a.nc.ie!=h.length||!a.h)return}else{b=0;c=h.length;for(b=0;b<c;b++)this.R.load(h[b],a);return}else{if(h!=t&&h.h){this.R.load(a,a);return}if(m!=t&&m.r!=t&&m.r.h){this.R.load(m,
a);return}}if(0<a.c.length){h=a.c;k=h.length;for(j=j=0;j<k;j++)this.wb(h[j])}if(d){for(h=0;this.Md;)h++,window.console.log("Possible thread lock avoided: "+h);this.Md=q;k=a instanceof Nd&&a.Bb instanceof Oe;b&&(g!=t&&g.h)&&(h=this.dc.get(c),h!=t&&this.a.isBuffer(h.H)&&this.a.deleteBuffer(h.H));h=t;g!=t&&(!b||g.h?(h=a.Fc,h==t&&n(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),j=u,g.Ub&&(j=q),this.a.pixelStorei(this.a.UNPACK_FLIP_Y_WEBGL,j),
j=this.a.createTexture(),j.Bi=g.Lb,this.Gc.set(g.qa,j),this.a.bindTexture(this.a.TEXTURE_2D,j),g.Ub?(j=this.a.RGBA,g.Xf&&(j=this.a.LUMINANCE,this.a.pixelStorei(this.a.UNPACK_ALIGNMENT,1)),this.a.texImage2D(this.a.TEXTURE_2D,0,j,g.Me,g.Le,0,j,this.a.UNSIGNED_BYTE,g.Ub)):this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,this.a.RGBA,this.a.UNSIGNED_BYTE,j.Bi),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,
this.a.CLAMP_TO_EDGE),k?(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST)):(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.LINEAR),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.LINEAR)),this.a.bindTexture(this.a.TEXTURE_2D,t),j=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,j),this.a.bufferData(this.a.ARRAY_BUFFER,new Float32Array(h),
this.a.STATIC_DRAW),h=new rg(j,h.length,2),this.dc.set(c,h),g.h=u):h=this.dc.get(c));Jf(this.R,0.1);if(k)this.Md=u,E.Ra(this.f+".update"),Jf(this.R,0.9);else{if(!b||d.h||l.h){k=l.I;g=E.e.U(k,d.eb,d.fb,d.gb);k=E.e.U(k,d.$a,d.ab,d.bb);if(this.Vc===t||g.x<this.Vc)this.Vc=g.x;if(this.Sc===t||k.x>this.Sc)this.Sc=k.x;if(this.Wc===t||g.y<this.Wc)this.Wc=g.y;if(this.Tc===t||k.y>this.Tc)this.Tc=k.y;if(this.Xc===t||g.d<this.Xc)this.Xc=g.d;if(this.Uc===t||k.d>this.Uc)this.Uc=k.d;this.w=[(this.Vc+this.Sc)/2,
(this.Wc+this.Tc)/2,(this.Xc+this.Uc)/2];l.h=u}b&&d.h&&(l=this.ec.get(c),l!=t&&this.a.isBuffer(l.H)&&this.a.deleteBuffer(l.H));l=t;!b||d.h?(l=this.a.createBuffer(),d.Eb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,l),this.a.bufferData(this.a.ARRAY_BUFFER,d.X,this.a.STATIC_DRAW),l=new rg(l,d.count,3),d.h=u):l=this.ec.get(c);Jf(this.R,0.3);b&&e.h&&(g=this.ec.get(c),g!=t&&this.a.isBuffer(g.H)&&this.a.deleteBuffer(g.H));g=t;!b||e.h?(g=this.a.createBuffer(),e.Eb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,g),this.a.bufferData(this.a.ARRAY_BUFFER,
e.X,this.a.STATIC_DRAW),g=new rg(g,e.count,3),e.h=u):g=this.Yc.get(c);Jf(this.R,0.3);b&&(f&&f.h)&&(e=this.rc.get(c),e!=t&&this.a.isBuffer(e.H)&&this.a.deleteBuffer(e.H));e=t;f&&(!b||f.h?(f.length!=d.length&&n(Error("Mismatch between points and point colors.")),e=this.a.createBuffer(),f.Eb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,e),this.a.bufferData(this.a.ARRAY_BUFFER,f.X,this.a.STATIC_DRAW),e=new rg(e,f.count,3),f.h=u):e=this.rc.get(c));Jf(this.R,0.2);b&&(m&&m.h)&&(f=this.Bc.get(c),f!=t&&this.a.isBuffer(f.H)&&
this.a.deleteBuffer(f.H));f=t;m&&(f=m.Pc,!b||m.h?(f.length!=d.length&&n(Error("Mismatch between points and scalars.")),d=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,d),this.a.bufferData(this.a.ARRAY_BUFFER,f,this.a.STATIC_DRAW),f=new rg(d,f.length,3),m.h=u):f=this.Bc.get(c));Jf(this.R,0.1);b||this.sb.add(a);this.ec.set(c,l);this.Yc.set(c,g);this.rc.set(c,e);this.dc.set(c,h);this.Bc.set(c,f);this.Md=a.h=u}}else a.h=u}}};
w.wf=function(a,b){if(this.Q.PICKING_ENABLED){this.Zb(q,u);var c=new Uint8Array(4);this.a.readPixels(a,this.u-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);return c[0]+255*c[1]+65025*c[2]}return-1};
w.Zb=function(a,b){Qg.v.Zb.call(this,a,b);this.a.viewport(0,0,this.D,this.u);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var c=this.sb.B,d=c.length;if(0!=d){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.gg):this.a.bindFramebuffer(this.a.FRAMEBUFFER,t);var e=this.F.Ke,f=this.F.n;this.a.uniformMatrix4fv(this.kd.get("perspective"),u,e);this.a.uniformMatrix4fv(this.kd.get("view"),u,f);e=this.w;this.a.uniform3f(this.kd.get("center"),parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]));
f=this.hb.length;for(e=0;e<f;++e){var g=this.hb[e];if(g instanceof S){var h=E.e.U(this.F.n,g.t[0]+g.b[0].i[0],g.t[1]+g.b[0].i[1],g.t[2]+g.b[0].i[2]),l=E.e.U(this.F.n,g.t[0]-g.b[0].i[0],g.t[1]-g.b[0].i[1],g.t[2]-g.b[0].i[2]),k=Math.abs(h.d-l.d),h=E.e.U(this.F.n,g.t[0]+g.b[1].i[0],g.t[1]+g.b[1].i[1],g.t[2]+g.b[1].i[2]),l=E.e.U(this.F.n,g.t[0]-g.b[1].i[0],g.t[1]-g.b[1].i[1],g.t[2]+-g.b[1].i[2]),j=Math.abs(h.d-l.d),h=E.e.U(this.F.n,g.t[0]+g.b[2].i[0],g.t[1]+g.b[2].i[1],g.t[2]+g.b[2].i[2]),l=E.e.U(this.F.n,
g.t[0]-g.b[2].i[0],g.t[1]-g.b[2].i[1],g.t[2]-g.b[2].i[2]),h=Math.max(k,j,Math.abs(h.d-l.d));h==k?Ne(g,0):h==j?Ne(g,1):Ne(g,2)}}if(this.Q.ORDERING_ENABLED){k=u;f=this.hb;g=f.length-1;do if(e=f[g],e instanceof S&&e.ib){var k=e.c[e.za].c,j=e.za,h=E.e.U(this.F.n,e.t[0]+e.b[j].W[0],e.t[1]+e.b[j].W[1],e.t[2]+e.b[j].W[2]),l=E.e.U(this.F.n,e.t[0]-e.b[j].W[0],e.t[1]-e.b[j].W[1],e.t[2]-e.b[j].W[2]),h=h.d-l.d,l=Math.max(e.oc[e.za],Math.max(e.oc[e.za+4],e.oc[e.za+8])),m=Math.min(e.oc[e.za],Math.min(e.oc[e.za+
4],e.oc[e.za+8]));if(0>h*(l+m))for(h=h=0;h<e.bd[j]-1;h++)k[h].ra=e.ra,k[h].pa=e.b[j].Dc*h;else for(h=e.bd[j]-1;0<=h;h--)k[h].ra=e.ra,k[h].pa=(e.bd[j]-1)*e.b[j].Dc-e.b[j].Dc*h;k=q}while(g--);f=this.sb.B;g=f.length-1;do if(e=f[g],e.ka&&!(1==e.ra||e instanceof Nd))k=e,j=e.g.Ed,e=E.e.U(e.aa.I,j[0],j[1],j[2]),e=E.e.U(this.F.n,e.x,e.y,e.d),e=E.l.ef(this.F.bc,e),e=Math.round(1E3*e)/1E3,k.pa=e,k=q;while(g--);k&&this.sb.sort()}if(f=!a&&b!=t&&b&&this.Q.STATISTICS_ENABLED)var s=0,r=0,z=0,y=0;var e=this.xe,g=
e.get("vertexPosition"),k=e.get("vertexNormal"),j=e.get("vertexColor"),h=e.get("vertexTexturePos"),l=e.get("vertexScalar"),e=this.kd,m=e.get("usePicking"),D=e.get("useObjectColor"),F=e.get("objectColor"),H=e.get("useScalars"),A=e.get("scalarsReplaceMode"),G=e.get("scalarsMin"),J=e.get("scalarsMax"),K=e.get("scalarsMinColor"),R=e.get("scalarsMaxColor"),N=e.get("scalarsInterpolation"),W=e.get("scalarsMinThreshold"),aa=e.get("scalarsMaxThreshold"),Z=e.get("objectOpacity"),ba=e.get("labelmapOpacity"),
L=e.get("labelmapColor"),O=e.get("useTexture"),Q=e.get("useLabelMapTexture"),hb=e.get("textureSampler"),Fc=e.get("textureSampler2"),Gc=e.get("volumeLowerThreshold"),Hc=e.get("volumeUpperThreshold"),Ug=e.get("volumeScalarMin"),Vg=e.get("volumeScalarMax"),Wg=e.get("volumeWindowLow"),Xg=e.get("volumeWindowHigh"),Yg=e.get("volumeScalarMinColor"),Zg=e.get("volumeScalarMaxColor"),hg=e.get("volumeTexture"),$g=e.get("objectTransform"),ah=e.get("pointSize"),e=d;do{var ca=c[d-e];if(ca){var ja=t;ca instanceof
Nd&&ca.Bb&&(ja=ca.Bb);if(ca.ka&&(!ja||ja.ka)&&(!a||ca.Zc)){var ya=ca.qa,bb=ca.Rc,Na=this.ec.get(ya),lb=this.Yc.get(ya),Ke=this.rc.get(ya),Fb=this.Bc.get(ya),Le=this.dc.get(ya);this.a.bindBuffer(this.a.ARRAY_BUFFER,Na.H);this.a.vertexAttribPointer(g,Na.Nb,this.a.FLOAT,u,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,lb.H);this.a.vertexAttribPointer(k,lb.Nb,this.a.FLOAT,u,0,0);a?this.a.uniform1i(m,q):this.a.uniform1i(m,u);Ke&&!a&&!bb?(this.a.uniform1i(D,u),this.a.bindBuffer(this.a.ARRAY_BUFFER,Ke.H),this.a.vertexAttribPointer(j,
Ke.Nb,this.a.FLOAT,u,0,0)):(lb=1,bb&&!a&&(lb=0),this.a.uniform1i(D,lb),lb=ca.G,a&&(lb=[Math.floor(ya%65025%255)/255,Math.floor(ya%65025/255)/255,Math.floor(ya/65025)/255]),this.a.uniform3f(F,parseFloat(lb[0]),parseFloat(lb[1]),parseFloat(lb[2])),this.a.vertexAttribPointer(j,Na.Nb,this.a.FLOAT,u,0,0));Fb&&!a&&!bb?(this.a.uniform1i(H,q),this.a.uniform1i(A,ca.C.jg),ya=ca.C.Qb,bb=ca.C.Ob,this.a.uniform3f(K,parseFloat(ya[0]),parseFloat(ya[1]),parseFloat(ya[2])),this.a.uniform3f(R,parseFloat(bb[0]),parseFloat(bb[1]),
parseFloat(bb[2])),this.a.uniform1f(W,parseFloat(ca.C.da)),this.a.uniform1f(aa,parseFloat(ca.C.ea)),this.a.uniform1f(G,parseFloat(ca.C.cb)),this.a.uniform1f(J,parseFloat(ca.C.ja)),this.a.uniform1i(N,parseInt(ca.C.ze,10)),this.a.bindBuffer(this.a.ARRAY_BUFFER,Fb.H),this.a.vertexAttribPointer(l,Fb.Nb,this.a.FLOAT,u,0,0)):(this.a.uniform1i(H,u),this.a.vertexAttribPointer(l,Na.Nb,this.a.FLOAT,u,0,0));this.a.uniform1f(Z,parseFloat(ca.ra));ca.T&&Le&&!a?(this.a.uniform1i(O,q),this.a.activeTexture(this.a.TEXTURE0),
this.a.bindTexture(this.a.TEXTURE_2D,this.Gc.get(ca.T.qa)),this.a.uniform1i(hb,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,Le.H),this.a.vertexAttribPointer(h,Le.Nb,this.a.FLOAT,u,0,0),this.a.uniform1i(hg,u)):(this.a.uniform1i(O,u),this.a.vertexAttribPointer(h,Na.Nb,this.a.FLOAT,u,0,0));ja&&(this.a.uniform1i(hg,q),this.a.uniform1f(Gc,ja.da),this.a.uniform1f(Hc,ja.ea),this.a.uniform1f(Ug,ja.cb),this.a.uniform1f(Vg,ja.ja),ya=ja.Qb,bb=ja.Ob,this.a.uniform3f(Yg,parseFloat(ya[0]),parseFloat(ya[1]),parseFloat(ya[2])),
this.a.uniform3f(Zg,parseFloat(bb[0]),parseFloat(bb[1]),parseFloat(bb[2])),this.a.uniform1f(Wg,ja.ga),this.a.uniform1f(Xg,ja.fa),Fb=ja.j,this.a.uniform1i(Q,u),ja.ib?this.a.uniform1f(Z,parseFloat(ja.ra)):Fb&&Fb.ka&&(ja=ca.j.qa,this.a.uniform1i(Q,q),this.a.activeTexture(this.a.TEXTURE1),this.a.bindTexture(this.a.TEXTURE_2D,this.Gc.get(ja)),this.a.uniform1i(Fc,1),this.a.uniform1f(ba,Fb.ra),this.a.uniform4fv(L,Fb.Pe)));this.a.uniformMatrix4fv($g,u,ca.aa.I);ja=1;"POINTS"==ca.ya&&(ja=ca.$c);this.a.uniform1f(ah,
ja);ja=-1;ca.ya==dd?(ja=this.a.TRIANGLES,f&&(r+=Na.Mb/3)):"LINES"==ca.ya?(this.a.lineWidth(ca.zc),ja=this.a.LINES,f&&(z+=Na.Mb/2)):"POINTS"==ca.ya?(ja=this.a.POINTS,f&&(y+=Na.Mb)):"TRIANGLE_STRIPS"==ca.ya?(ja=this.a.TRIANGLE_STRIP,f&&(r+=Na.Mb/3)):"POLYGONS"==ca.ya&&(ja=0==Na.Mb%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(r+=Na.Mb/3));f&&(s+=Na.Mb);this.a.drawArrays(ja,0,Na.Mb)}}}while(--e);f&&(c="Objects: "+d+" | "+("Vertices: "+s+" | "),c+="Triangles: "+Math.round(r)+" | ",c+="Lines: "+z+" | ",c+=
"Points: "+y+" | ",c+="Textures: "+this.Gc.ae(),window.console.log(c))}};
w.remove=function(a){Qg.v.remove.call(this,a);if(0<a.c.length)for(var b=a.c,c=b.length,d=0,d=0;d<c;d++)this.remove(b[d]);b=a.qa;c=this.dc.get(b);c!=t&&this.a.isBuffer(c.H)&&this.a.deleteBuffer(c.H);if(a.T&&(c=this.Gc.get(a.T.qa)))this.a.deleteTexture(c),this.Gc.remove(a.T.qa);c=this.ec.get(b);c!=t&&this.a.isBuffer(c.H)&&this.a.deleteBuffer(c.H);c=this.Yc.get(b);c!=t&&this.a.isBuffer(c.H)&&this.a.deleteBuffer(c.H);c=this.rc.get(b);c!=t&&this.a.isBuffer(c.H)&&this.a.deleteBuffer(c.H);c=this.Bc.get(b);
c!=t&&this.a.isBuffer(c.H)&&this.a.deleteBuffer(c.H);this.ec.remove(b);this.Yc.remove(b);this.rc.remove(b);this.dc.remove(b);this.Bc.remove(b);this.sb.remove(a);return q};w.Wd=function(){this.Oe=t;delete this.Oe;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);Qg.v.Wd.call(this)};Qg.prototype.__defineGetter__("bgColor",v("Nc"));Qg.prototype.__defineSetter__("bgColor",ea("Nc"));
Qg.prototype.uj=function(a,b,c,d,e){c!=t||(c=4);d!=t||(d=2);if(e==t){e=this.wf(a,b);if(-1==e)return t;e=this.get(e);if(!e)return t}var f=Yf(this.F,2*(a/this.D)-1,2*((this.u-b)/this.u)-1,0);a=Yf(this.F,2*(a/this.D)-1,2*((this.u-b)/this.u)-1,1);f[0]+=this.w[0];f[1]+=this.w[1];f[2]+=this.w[2];a[0]+=this.w[0];a[1]+=this.w[1];a[2]+=this.w[2];b=[e.g.eb,e.g.fb,e.g.gb];var g=[e.g.$a,e.g.fb,e.g.gb],h=[e.g.$a,e.g.ab,e.g.gb],l=[e.g.eb,e.g.ab,e.g.gb],k=[e.g.eb,e.g.ab,e.g.bb],j=[e.g.eb,e.g.fb,e.g.bb],m=[e.g.$a,
e.g.ab,e.g.bb],s=[e.g.$a,e.g.fb,e.g.bb];b=[E.e.U(e.aa.I,b[0],b[1],b[2]),E.e.U(e.aa.I,g[0],g[1],g[2]),E.e.U(e.aa.I,h[0],h[1],h[2]),E.e.U(e.aa.I,l[0],l[1],l[2]),E.e.U(e.aa.I,k[0],k[1],k[2]),E.e.U(e.aa.I,j[0],j[1],j[2]),E.e.U(e.aa.I,m[0],m[1],m[2]),E.e.U(e.aa.I,s[0],s[1],s[2])];var g=[Infinity,-Infinity,Infinity,-Infinity,Infinity,-Infinity],r;for(r in b)r=b[r],g=[Math.min(g[0],r.x),Math.max(g[1],r.x),Math.min(g[2],r.y),Math.max(g[3],r.y),Math.min(g[4],r.d),Math.max(g[5],r.d)];r=g;b=[];g=[];for(h=0;6>
h;h++){var l=Math.floor(h/2),k=(l+1)%3,j=(l+2)%3,s=(2+2*l)%6,z=(4+2*l)%6,y=(r[h]-f[l])*(1/a[l]);Infinity!=y&&-Infinity!=y&&(m=f[k]+a[k]*y,y=f[j]+a[j]*y,m>=r[s]&&m<=r[s+1]&&y>=r[z]&&y<=r[z+1]?(s=[],s[l]=r[h],s[k]=m,s[j]=y,b.push(s)):(s=[],s[l]=r[h],s[k]=m,s[j]=y,g.push(s)))}a=[b,g];a=a[0];if(0==a.length)return t;g=Array(2);for(r=0;2>r;r++)b=a[r],g[r]=Math.sqrt((b[0]-f[0])*(b[0]-f[0])+(b[1]-f[1])*(b[1]-f[1])+(b[2]-f[2])*(b[2]-f[2]));f=b=r=t;g[0]<g[1]?(r=a[0],b=a[1]):(r=a[1],b=a[0]);f=Math.sqrt((r[0]-
b[0])*(r[0]-b[0])+(r[1]-b[1])*(r[1]-b[1])+(r[2]-b[2])*(r[2]-b[2]));f/=c;a=r;r=[b[0]-r[0],b[1]-r[1],b[2]-r[2]];b=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);g=[r[0]/b,r[1]/b,r[2]/b];h=e.g.X;l=h.length;for(r=0;r<f;r+=c){a=[a[0]+c*g[0],a[1]+c*g[1],a[2]+c*g[2]];for(b=0;b<l;b+=3)if(k=h[b],j=h[b+1],m=h[b+2],s=new E.l(k,j,m),s=E.e.U(e.aa.I,k,j,m),Math.sqrt((a[0]-s.x)*(a[0]-s.x)+(a[1]-s.y)*(a[1]-s.y)+(a[2]-s.d)*(a[2]-s.d))<=d)return[s.x,s.y,s.d]}return t};B("X.renderer3D",Qg);
B("X.renderer3D.prototype.init",Qg.prototype.ua);B("X.renderer3D.prototype.add",Qg.prototype.add);B("X.renderer3D.prototype.onShowtime",Qg.prototype.Xg);B("X.renderer3D.prototype.onRender",Qg.prototype.Vg);B("X.renderer3D.prototype.get",Qg.prototype.get);B("X.renderer3D.prototype.render",Qg.prototype.mc);B("X.renderer3D.prototype.destroy",Qg.prototype.Wd);B("X.renderer3D.prototype.remove",Qg.prototype.remove);B("X.renderer3D.prototype.resetBoundingBox",Qg.prototype.yj);
B("X.renderer3D.prototype.resetViewAndRender",Qg.prototype.zd);B("X.renderer3D.prototype.pick",Qg.prototype.wf);B("X.renderer3D.prototype.pick3d",Qg.prototype.uj);function Rg(){ng.call(this);this.f="renderer2D";this.Ca=t;this.xa=-1;this.Rb=[];this.$f=this.Jd=this.Vf=this.Hd=t;this.Cc=this.Ec=this.cd=this.ed=0;this.fa=this.ga=this.ea=this.da=this.Sf=-1;this.ag=new Float32Array([-255,-255,-255,-255]);this.hg=q}C(Rg,ng);Rg.prototype.gj=da();Rg.prototype.pj=da();Rg.prototype.tf=function(a){Rg.v.tf.call(this,a);var b=this.hb[0];if(b){var c="",c=0==this.xa?"indexX":1==this.xa?"indexY":"indexZ";b[c]=a.Y?b[c]+1:b[c]-1;eval("this.onScroll();")}};
Rg.prototype.qj=function(a){var b=this.hb[0];if(b){var c=b.fa-b.ga,d=c/2,e=parseInt(c+c/15*-a.Se,10);a=parseInt(d+d/15*a.Ee,10);c==e&&e++;d==a&&a++;b.ga-=parseInt(d-a,10);b.ga-=parseInt(c-e,10);b.ga=Math.max(b.ga,b.cb);b.fa-=parseInt(d-a,10);b.fa+=parseInt(c-e,10);b.fa=Math.min(b.fa,b.ja);eval("this.onWindowLevel();")}};Rg.prototype.__defineGetter__("orientation",v("Ca"));
Rg.prototype.__defineSetter__("orientation",function(a){a=a.toUpperCase();"AXIAL"==a?(a="Z",this.xa=2):"SAGITTAL"==a?(a="X",this.xa=0):"CORONAL"==a&&(a="Y",this.xa=1);"X"!=a&&("Y"!=a&&"Z"!=a)&&n(Error("Invalid orientation."));this.Ca=a});Rg.prototype.__defineGetter__("radiological",v("hg"));Rg.prototype.__defineSetter__("radiological",ea("hg"));w=Rg.prototype;
w.ua=function(){this.Ca||n(Error("No 2D orientation set."));Rg.v.ua.call(this,"2d");this.a.fillStyle="rgba(50,50,50,0)";this.a.fillRect(0,0,this.oa.width,this.oa.height);this.Hd=ee("canvas");this.Jd=ee("canvas");M(this.F,sd,this.qj.bind(this))};w.sf=function(){Rg.v.sf.call(this);Sg(this)};w.zd=function(){Rg.v.zd.call(this);Sg(this);var a=this.hb[0];a&&(a.fa=a.ja,a.ga=a.cb)};
w.wb=function(a){Rg.v.wb.call(this,a);var b=u;this.get(a.qa)&&(b=q);if(a instanceof S){var c=a.r,d=a.j,e=a.Ta;if(d!=t&&d.r!=t&&d.r.h)this.wb(d);else if(e!=t&&e.r!=t&&e.r.h)this.R.load(e,a);else{if(c!=t&&ka(c))if(a.nc!=t){if(a.nc.ie!=c.length||b&&!a.h)return}else{b=0;d=c.length;for(b=0;b<d;b++)this.R.load(c[b],a);return}else if(c!=t&&c.h){this.R.load(a,a);return}this.xa="X"==this.Ca?0:"Y"==this.Ca?1:2;this.Va=a.c[this.xa].c;e=t;e=0==this.xa?a.indexX:1==this.xa?a.indexY:a.indexZ;c=a.c[this.xa].c[e].Zf;
d=a.c[this.xa].c[e].Yf;this.Ec=a.c[this.xa].c[e].Hc;this.Cc=a.c[this.xa].c[e].uc;this.ed=c;this.cd=d;e=this.Hd;e.width=c;e.height=d;var f=this.Jd;f.width=c;f.height=d;this.Vf=e.getContext("2d");this.$f=f.getContext("2d");b||(this.sb.add(a),Sg(this))}}};function Sg(a){var b=Math.min(a.D/(a.ed*a.Ec),a.u/(a.cd*a.Cc));a.F.n[14]=b}
w.uh=function(a,b){var c=this.hb[0],d=this.F.n,e=t,f=this.ed,g=this.cd,h=t,l=t;if("Y"==this.Ca)e=this.Va[parseInt(c.indexY,10)],h=e.Hc,l=e.uc,this.Rb[0]="yellow",this.Rb[1]="green";else if("Z"==this.Ca)e=this.Va[parseInt(c.indexZ,10)],h=e.Hc,l=e.uc,this.Rb[0]="yellow",this.Rb[1]="red";else{e=this.Va[parseInt(c.indexX,10)];h=e.uc;l=e.Hc;this.Rb[0]="red";this.Rb[1]="green";var k=f,f=g,g=k,k=h,h=l,l=k}var j=1*d[12],m=-1*d[13],k=Math.max(d[14],0.6),d=[this.D/2,this.u/2],h=f*h*k,s=g*l*k,l=d[0]-h/2,d=d[1]-
s/2,m=(b-(d+m*k))/s,j=(a-(l+j*k))/h*f,m=m*g,h=e.Sh[4];"X"==this.Ca?(k=f-j,j=m,m=k):"Y"==this.Ca?j=f-j:"Z"==this.Ca&&(j=f-j,m=g-m);j=e.Rh+j*e.Hc;m=e.Ih+m*e.uc;j=Mc(j,m,h,1);f=Nc();Yc(e.Bh,j,f);g=Nc();Yc(e.Ch,j,g);e=Math.round((c.b[0].i[0]*g[0]+c.b[0].i[1]*g[1]+c.b[0].i[2]*g[2]+c.b[0].Ie)/Math.abs(c.b[0].Dc));e>=c.b[0].o?e=c.b[0].o-1:0>e&&(e=0);j=Math.round((c.b[1].i[0]*g[0]+c.b[1].i[1]*g[1]+c.b[1].i[2]*g[2]+c.b[1].Ie)/Math.abs(c.b[1].Dc));j>=c.b[1].o?j=c.b[1].o-1:0>j&&(j=0);m=Math.round((c.b[2].i[0]*
g[0]+c.b[2].i[1]*g[1]+c.b[2].i[2]*g[2]+c.b[2].Ie)/Math.abs(c.b[2].Dc));m>=c.b[2].o?m=c.b[2].o-1:0>m&&(m=0);return[[e,j,m],[f[0],f[1],f[2]],[g[0],g[1],g[2]]]};
w.Zb=function(a,b){Rg.v.Zb.call(this,a,b);if(0!=this.sb.B.length){var c=this.hb[0],d=t,d=0==this.xa?c.indexX:1==this.xa?c.indexY:c.indexZ,e=this.Va[parseInt(d,10)].Zf,f=this.Va[parseInt(d,10)].Yf;this.Ec=this.Va[parseInt(d,10)].Hc;this.Cc=this.Va[parseInt(d,10)].uc;this.ed=e;this.cd=f;var g=this.D,h=this.u,l=this.F.n;this.a.save();this.a.clearRect(-g,-h,2*g,2*h);this.a.restore();var k=Math.max(l[14],0.1);this.a.setTransform(k,0,0,k,0,0);var j=1*l[12],l=-1*l[13],m=t;c.j&&(m=c.j.Pe);var s=this.Va[parseInt(d,
10)],r=s.T.Ub,s=s.j,z=t;s&&(z=s.Ub);var y=this.ed,D=this.cd,F=this.Vf,H=this.$f,A=F.getImageData(0,0,y,D),G=H.getImageData(0,0,y,D),J=A.data,K=G.data,R=J.length,N=c.ja,W=c.da,aa=c.ea,Z=c.ga/N,ba=c.fa/N;if(this.Sf!=d||this.da!=W||this.ea!=aa||this.ga!=Z||this.fa!=ba||m&&!Uf(m,this.ag,0)){var L=this.Hd;L.width=e;L.height=f;L=this.Jd;L.width=e;L.height=f;e=0;do{var L=[0,0,0,0],f=[0,0,0,0],O=r[e]/255*N,Q=r[e],Q=(Q/255-Z)/(ba-Z),Q=255*Q;O>=W&&O<=aa&&(L=new T(c.Qb[0],c.Qb[1],c.Qb[2]),L=(new T(c.Ob[0],c.Ob[1],
c.Ob[2])).scale(Q).add(L.scale(255-Q)),L=[Math.floor(L.x),Math.floor(L.y),Math.floor(L.d),255],s&&(-255==m[3]?f=[z[e],z[e+1],z[e+2],z[e+3]]:Uf(m,z,e)&&(f=[z[e],z[e+1],z[e+2],z[e+3]])));"X"==this.Ca?(J[e]=L[0],J[e+1]=L[1],J[e+2]=L[2],J[e+3]=L[3],K[e]=f[0],K[e+1]=f[1],K[e+2]=f[2],K[e+3]=f[3]):"Y"==this.Ca?(Q=4*y*Math.floor(e/(4*y))-e%(4*y),J[Q]=L[0],J[Q+1]=L[1],J[Q+2]=L[2],J[Q+3]=L[3],K[Q]=f[0],K[Q+1]=f[1],K[Q+2]=f[2],K[Q+3]=f[3]):(Q=R-1-e,J[Q-3]=L[0],J[Q-2]=L[1],J[Q-1]=L[2],J[Q]=L[3],K[Q-3]=f[0],K[Q-
2]=f[1],K[Q-1]=f[2],K[Q]=f[3]);e+=4}while(e<R);F.putImageData(A,0,0);H.putImageData(G,0,0);this.Sf=d;this.da=W;this.ea=aa;this.ga=Z;this.fa=ba;s&&(this.ag=m)}this.a.globalAlpha=1;this.a.translate(g/2/k,h/2/k);"X"==this.Ca&&(this.a.rotate(0.5*Math.PI),d=j,j=l,l=-d);j=-y*this.Ec/2+j;l=-D*this.Cc/2+l;this.a.drawImage(this.Hd,j,l,y*this.Ec,D*this.Cc);s&&c.j.ka&&(this.a.globalAlpha=c.j.ra,this.a.drawImage(this.Jd,j,l,y*this.Ec,D*this.Cc));if(this.Q.SLICENAVIGATORS&&(this.N.Nd&&this.N.lg&&!this.N.rb)&&
(j=this.N.ma,j=this.uh(j[0],j[1])))c.ob=j[0][0],c.pb=j[0][1],c.qb=j[0][2],c.q(u),this.a.setTransform(1,0,0,1,0,0),this.a.lineWidth=1,this.a.beginPath(),this.a.moveTo(this.N.ma[0],0),this.a.lineTo(this.N.ma[0],this.N.ma[1]-10),this.a.moveTo(this.N.ma[0],this.N.ma[1]+10),this.a.lineTo(this.N.ma[0],this.u),this.a.strokeStyle=this.Rb[0],this.a.stroke(),this.a.closePath(),this.a.beginPath(),this.a.moveTo(0,this.N.ma[1]),this.a.lineTo(this.N.ma[0]-10,this.N.ma[1]),this.a.moveTo(this.N.ma[0]+10,this.N.ma[1]+
0.5),this.a.lineTo(this.D,this.N.ma[1]),this.a.strokeStyle=this.Rb[1],this.a.stroke(),this.a.closePath(),this.a.font="10pt Arial",this.a.textAlign="left",this.a.textBaseline="top",this.a.fillStyle="white",this.a.fillText("RAS: "+j[2][0].toFixed(2)+", "+j[2][1].toFixed(2)+", "+j[2][2].toFixed(2),0,0),y=s=l="undefined","undefined"!=typeof c.Ba[j[1][2].toFixed(0)]&&"undefined"!=typeof c.Ba[j[1][2].toFixed(0)][j[1][1].toFixed(0)]&&(l=c.Ba[j[1][2].toFixed(0)][j[1][1].toFixed(0)][j[1][0].toFixed(0)],c.la&&
(s=c.j.Ba[j[1][2].toFixed(0)][j[1][1].toFixed(0)][j[1][0].toFixed(0)],c.j.Oc&&(y=c.j.Oc.get(s),"undefined"!=typeof y&&(y=y[0])))),this.a.fillText("Background:  "+l+" ("+j[1][0].toFixed(0)+", "+j[1][1].toFixed(0)+", "+j[1][2].toFixed(0)+")",0,15),c.la&&this.a.fillText("Labelmap:  "+y+" ("+s+")",0,30)}};B("X.renderer2D",Rg);B("X.renderer2D.prototype.init",Rg.prototype.ua);B("X.renderer2D.prototype.add",Rg.prototype.add);B("X.renderer2D.prototype.onShowtime",Rg.prototype.Xg);
B("X.renderer2D.prototype.onRender",Rg.prototype.Vg);B("X.renderer2D.prototype.onScroll",Rg.prototype.gj);B("X.renderer2D.prototype.onWindowLevel",Rg.prototype.pj);B("X.renderer2D.prototype.get",Rg.prototype.get);B("X.renderer2D.prototype.resetViewAndRender",Rg.prototype.zd);B("X.renderer2D.prototype.xy2ijk",Rg.prototype.uh);B("X.renderer2D.prototype.render",Rg.prototype.mc);B("X.renderer2D.prototype.destroy",Rg.prototype.Wd);function Tg(){V.call(this);this.f="fibers";Ea(this,new rc)}C(Tg,V);B("X.fibers",Tg);function bh(){V.call(this);this.f="mesh";Ea(this,new rc)}C(bh,V);B("X.mesh",bh);
