-
Notifications
You must be signed in to change notification settings - Fork 8
/
xtk_release_3a.js
269 lines (269 loc) · 121 KB
/
xtk_release_3a.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*
*
* 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 <[email protected]>
*
* The X Toolkit (XTK) is licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*
*
*
*
* 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/X/master/lib/closure-library/LICENSE
*
* - the JSXCompressor library (http://jsxgraph.uni-bayreuth.de/wp/jsxcompressor/)
* LICENSE: https://raw.github.com/xtk/X/master/lib/JXG/LICENSE
*
* MORE CREDITS: https://raw.github.com/xtk/X/master/LICENSE
*
*/
function g(a){throw a;}var n=void 0,o=!0,q=null,r=!1;function aa(){return function(){}}function ba(a){return function(b){this[a]=b}}function t(a){return function(){return this[a]}}var w,ca=this;function fa(){}
function ga(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 ha(a){return a!==n}function x(a){return a!=q}function ja(a){return"array"==ga(a)}function ka(a){var b=ga(a);return"array"==b||"object"==b&&"number"==typeof a.length}function y(a){return"string"==typeof a}function z(a){return"number"==typeof a}function na(a){return"function"==ga(a)}function oa(a){a=ga(a);return"object"==a||"array"==a||"function"==a}function qa(a){return a[ta]||(a[ta]=++ua)}
var ta="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ua=0;function va(a,b,c){return a.call.apply(a.bind,arguments)}function wa(a,b,c){a||g(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 xa(a,b,c){xa=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?va:wa;return xa.apply(q,arguments)}function ya(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 za=Date.now||function(){return+new Date};
function A(a,b){var c=a.split("."),d=ca;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var f;c.length&&(f=c.shift());)!c.length&&ha(b)?d[f]=b:d=d[f]?d[f]:d[f]={}}function C(a,b){function c(){}c.prototype=b.prototype;a.C=b.prototype;a.prototype=new c};window["X.Counter"]=function(){var a=0;return{ze:function(){a+=1},Ah:function(){a+=-1},value:function(){return a}}}();
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c?this:a||window,f.concat(d.call(arguments)))}function c(){}"function"!==typeof this&&g(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var d=Array.prototype.slice,f=d.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});A("Function.prototype.bind",Function.prototype.bind);function Aa(a){if(!Ba.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Ca,"&"));-1!=a.indexOf("<")&&(a=a.replace(Da,"<"));-1!=a.indexOf(">")&&(a=a.replace(Ea,">"));-1!=a.indexOf('"')&&(a=a.replace(Fa,"""));return a}var Ca=/&/g,Da=/</g,Ea=/>/g,Fa=/\"/g,Ba=/[&<>\"]/;var Ga,Ha,Ia,Ja,Ka,La,Ma;function Na(){return ca.navigator?ca.navigator.userAgent:q}function Oa(){return ca.navigator}Ka=Ja=Ia=Ha=Ga=r;var Pa;if(Pa=Na()){var Qa=Oa();Ga=0==Pa.indexOf("Opera");Ha=!Ga&&-1!=Pa.indexOf("MSIE");Ja=(Ia=!Ga&&-1!=Pa.indexOf("WebKit"))&&-1!=Pa.indexOf("Mobile");Ka=!Ga&&!Ia&&"Gecko"==Qa.product}var Ra=Ga,E=Ha,Sa=Ka,F=Ia,Ta=Ja,Ua,Va=Oa();Ua=Va&&Va.platform||"";La=-1!=Ua.indexOf("Mac");Ma=-1!=Ua.indexOf("Win");var Wa=!!Oa()&&-1!=(Oa().appVersion||"").indexOf("X11"),Xa;
a:{var Ya="",Za;if(Ra&&ca.opera)var $a=ca.opera.version,Ya="function"==typeof $a?$a():$a;else if(Sa?Za=/rv\:([^\);]+)(\)|;)/:E?Za=/MSIE\s+([^\);]+)(\)|;)/:F&&(Za=/WebKit\/(\S+)/),Za)var ab=Za.exec(Na()),Ya=ab?ab[1]:"";if(E){var bb,cb=ca.document;bb=cb?cb.documentMode:n;if(bb>parseFloat(Ya)){Xa=""+bb;break a}}Xa=Ya}var db={};
function eb(a){var b;if(!(b=db[a])){b=0;for(var c=(""+Xa).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=(""+a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),f=Math.max(c.length,d.length),e=0;0==b&&e<f;e++){var h=c[e]||"",i=d[e]||"",j=RegExp("(\\d*)(\\D*)","g"),p=RegExp("(\\d*)(\\D*)","g");do{var k=j.exec(h)||["","",""],m=p.exec(i)||["","",""];if(0==k[0].length&&0==m[0].length)break;b=((0==k[1].length?0:parseInt(k[1],10))<(0==m[1].length?0:parseInt(m[1],10))?-1:(0==k[1].length?0:parseInt(k[1],
10))>(0==m[1].length?0:parseInt(m[1],10))?1:0)||((0==k[2].length)<(0==m[2].length)?-1:(0==k[2].length)>(0==m[2].length)?1:0)||(k[2]<m[2]?-1:k[2]>m[2]?1:0)}while(0==b)}b=db[a]=0<=b}return b}var fb={};function gb(a){return fb[a]||(fb[a]=E&&document.documentMode&&document.documentMode>=a)};function ib(a,b){for(var c in a)b.call(n,a[c],c,a)}function jb(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function kb(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}var lb="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");function mb(a,b){for(var c,d,f=1;f<arguments.length;f++){d=arguments[f];for(c in d)a[c]=d[c];for(var e=0;e<lb.length;e++)c=lb[e],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var nb=Array.prototype,ob=nb.indexOf?function(a,b,c){return nb.indexOf.call(a,b,c)}:function(a,b,c){c=c==q?0:0>c?Math.max(0,a.length+c):c;if(y(a))return!y(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},pb=nb.forEach?function(a,b,c){nb.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=y(a)?a.split(""):a,e=0;e<d;e++)e in f&&b.call(c,f[e],e,a)},qb=nb.map?function(a,b,c){return nb.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=Array(d),e=y(a)?
a.split(""):a,h=0;h<d;h++)h in e&&(f[h]=b.call(c,e[h],h,a));return f},rb=nb.some?function(a,b,c){return nb.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=y(a)?a.split(""):a,e=0;e<d;e++)if(e in f&&b.call(c,f[e],e,a))return o;return r},sb=nb.every?function(a,b,c){return nb.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=y(a)?a.split(""):a,e=0;e<d;e++)if(e in f&&!b.call(c,f[e],e,a))return r;return o};function tb(a,b){var c=ob(a,b);0<=c&&nb.splice.call(a,c,1)}
function ub(a){return nb.concat.apply(nb,arguments)}function vb(a){if(ja(a))return ub(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b}function wb(a,b,c){return 2>=arguments.length?nb.slice.call(a,b):nb.slice.call(a,b,c)};function xb(a){if("function"==typeof a.$)a=a.$();else if(ka(a)||y(a))a=a.length;else{var b=0,c;for(c in a)b++;a=b}return a}function yb(a){if("function"==typeof a.aa)return a.aa();if(y(a))return a.split("");if(ka(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return jb(a)}
function zb(a,b){if("function"==typeof a.every)return a.every(b,n);if(ka(a)||y(a))return sb(a,b,n);var c;if("function"==typeof a.Tb)c=a.Tb();else if("function"!=typeof a.aa)if(ka(a)||y(a)){c=[];for(var d=a.length,f=0;f<d;f++)c.push(f)}else c=kb(a);else c=n;for(var d=yb(a),f=d.length,e=0;e<f;e++)if(!b.call(n,d[e],c&&c[e],a))return r;return o};var Eb="StopIteration"in ca?ca.StopIteration:Error("StopIteration");function Fb(){}Fb.prototype.next=function(){g(Eb)};Fb.prototype.vb=function(){return this};function Gb(a){if(a instanceof Fb)return a;if("function"==typeof a.vb)return a.vb(r);if(ka(a)){var b=0,c=new Fb;c.next=function(){for(;;){b>=a.length&&g(Eb);if(b in a)return a[b++];b++}};return c}g(Error("Not implemented"))}
function Hb(a,b){if(ka(a))try{pb(a,b,n)}catch(c){c!==Eb&&g(c)}else{a=Gb(a);try{for(;;)b.call(n,a.next(),n,a)}catch(d){d!==Eb&&g(d)}}};function Ib(a,b){this.r={};this.n=[];var c=arguments.length;if(1<c){c%2&&g(Error("Uneven number of arguments"));for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.md(a)}w=Ib.prototype;w.g=0;w.ic=0;w.$=t("g");w.aa=function(){Jb(this);for(var a=[],b=0;b<this.n.length;b++)a.push(this.r[this.n[b]]);return a};w.Tb=function(){Jb(this);return this.n.concat()};w.qd=function(a){for(var b=0;b<this.n.length;b++){var c=this.n[b];if(Kb(this.r,c)&&this.r[c]==a)return o}return r};
w.Pb=function(a,b){if(this===a)return o;if(this.g!=a.$())return r;var c=b||Lb;Jb(this);for(var d,f=0;d=this.n[f];f++)if(!c(this.get(d),a.get(d)))return r;return o};function Lb(a,b){return a===b}w.clear=function(){this.r={};this.ic=this.g=this.n.length=0};w.remove=function(a){return Kb(this.r,a)?(delete this.r[a],this.g--,this.ic++,this.n.length>2*this.g&&Jb(this),o):r};
function Jb(a){if(a.g!=a.n.length){for(var b=0,c=0;b<a.n.length;){var d=a.n[b];Kb(a.r,d)&&(a.n[c++]=d);b++}a.n.length=c}if(a.g!=a.n.length){for(var f={},c=b=0;b<a.n.length;)d=a.n[b],Kb(f,d)||(a.n[c++]=d,f[d]=1),b++;a.n.length=c}}w.get=function(a,b){return Kb(this.r,a)?this.r[a]:b};w.set=function(a,b){Kb(this.r,a)||(this.g++,this.n.push(a),this.ic++);this.r[a]=b};w.md=function(a){var b;a instanceof Ib?(b=a.Tb(),a=a.aa()):(b=kb(a),a=jb(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};w.d=function(){return new Ib(this)};
w.vb=function(a){Jb(this);var b=0,c=this.n,d=this.r,f=this.ic,e=this,h=new Fb;h.next=function(){for(;;){f!=e.ic&&g(Error("The map has changed since the iterator was created"));b>=c.length&&g(Eb);var h=c[b++];return a?h:d[h]}};return h};function Kb(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Mb(a){this.r=new Ib;a&&this.md(a)}function Nb(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+qa(a):b.substr(0,1)+a}w=Mb.prototype;w.$=function(){return this.r.$()};w.add=function(a){this.r.set(Nb(a),a)};w.md=function(a){for(var a=yb(a),b=a.length,c=0;c<b;c++)this.add(a[c])};w.Lc=function(a){for(var a=yb(a),b=a.length,c=0;c<b;c++)this.remove(a[c])};w.remove=function(a){return this.r.remove(Nb(a))};w.clear=function(){this.r.clear()};
w.contains=function(a){a=Nb(a);return Kb(this.r.r,a)};w.Be=function(a){for(var b=new Mb,a=yb(a),c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};w.aa=function(){return this.r.aa()};w.d=function(){return new Mb(this)};w.Pb=function(a){return this.$()==xb(a)&&Ob(this,a)};
function Ob(a,b){var c=xb(b);if(a.$()>c)return r;!(b instanceof Mb)&&5<c&&(b=new Mb(b));return zb(a,function(a){if("function"==typeof b.contains)a=b.contains(a);else if("function"==typeof b.qd)a=b.qd(a);else if(ka(b)||y(b))a=0<=ob(b,a);else a:{for(var c in b)if(b[c]==a){a=o;break a}a=r}return a})}w.vb=function(){return this.r.vb(r)};function Pb(){}Pb.prototype.ne=r;Pb.prototype.Z=function(){this.ne||(this.ne=o,this.t())};Pb.prototype.t=function(){this.Ff&&Qb.apply(q,this.Ff)};function Rb(a){a&&"function"==typeof a.Z&&a.Z()}function Qb(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];ka(d)?Qb.apply(q,d):Rb(d)}};function Sb(a,b){this.He=b;this.Sb=[];a>this.He&&g(Error("[goog.structs.SimplePool] Initial cannot be greater than max"));for(var c=0;c<a;c++)this.Sb.push(this.vc())}C(Sb,Pb);w=Sb.prototype;w.ke=q;w.me=q;function Tb(a,b){a.Sb.length<a.He?a.Sb.push(b):a.ud(b)}w.vc=function(){return this.ke?this.ke():{}};w.ud=function(a){if(this.me)this.me(a);else if(oa(a))if(na(a.Z))a.Z();else for(var b in a)delete a[b]};w.t=function(){Sb.C.t.call(this);for(var a=this.Sb;a.length;)this.ud(a.pop());delete this.Sb};function Ub(){this.Qb=[];this.Jd=new Ib;this.hf=this.jf=this.kf=this.cf=0;this.hc=new Ib;this.he=this.gf=0;this.Fd=1;this.vd=new Sb(0,4E3);this.vd.vc=function(){return new Vb};this.df=new Sb(0,50);this.df.vc=function(){return new Wb};var a=this;this.yd=new Sb(0,2E3);this.yd.vc=function(){return""+a.Fd++};this.yd.ud=aa()}function Wb(){this.Rd=this.time=this.count=0}
Wb.prototype.toString=function(){var a=[];a.push(this.type," ",this.count," (",Math.round(10*this.time)/10," ms)");this.Rd&&a.push(" [VarAlloc = ",this.Rd,"]");return a.join("")};function Vb(){}function Xb(a,b,c,d){var f=[];-1==c?f.push(" "):f.push(Yb(a.pe-c));f.push(" ",Zb(a.pe-b));0==a.wd?f.push(" Start "):1==a.wd?(f.push(" Done "),f.push(Yb(a.Eh-a.startTime)," ms ")):f.push(" Comment ");f.push(d,a);0<a.Wg&&f.push("[VarAlloc ",a.Wg,"] ");return f.join("")}
Vb.prototype.toString=function(){return this.type==q?this.Df:"["+this.type+"] "+this.Df};Ub.prototype.reset=function(){for(var a=0;a<this.Qb.length;a++){var b=this.vd.id;b&&Tb(this.yd,b);Tb(this.vd,this.Qb[a])}this.Qb.length=0;this.Jd.clear();this.cf=za();this.he=this.gf=this.hf=this.jf=this.kf=0;b=this.hc.Tb();for(a=0;a<b.length;a++){var c=this.hc.get(b[a]);c.count=0;c.time=0;c.Rd=0;Tb(this.df,c)}this.hc.clear()};
Ub.prototype.toString=function(){for(var a=[],b=-1,c=[],d=0;d<this.Qb.length;d++){var f=this.Qb[d];1==f.wd&&c.pop();a.push(" ",Xb(f,this.cf,b,c.join("")));b=f.pe;a.push("\n");0==f.wd&&c.push("| ")}if(0!=this.Jd.$()){var e=za();a.push(" Unstopped timers:\n");Hb(this.Jd,function(b){a.push(" ",b," (",e-b.startTime," ms, started at ",Zb(b.startTime),")\n")})}b=this.hc.Tb();for(d=0;d<b.length;d++)c=this.hc.get(b[d]),1<c.count&&a.push(" TOTAL ",c,"\n");a.push("Total tracers created ",this.gf,"\n","Total comments created ",
this.he,"\n","Overhead start: ",this.kf," ms\n","Overhead end: ",this.jf," ms\n","Overhead comment: ",this.hf," ms\n");return a.join("")};function Yb(a){var a=Math.round(a),b="";1E3>a&&(b=" ");100>a&&(b=" ");10>a&&(b=" ");return b+a}function Zb(a){a=Math.round(a);return(""+(100+a/1E3%60)).substring(1,3)+"."+(""+(1E3+a%1E3)).substring(1,4)}new Ub;function $b(){}var ac=0;w=$b.prototype;w.key=0;w.pb=r;w.nd=r;w.ra=function(a,b,c,d,f,e){na(a)?this.Ce=o:a&&a.handleEvent&&na(a.handleEvent)?this.Ce=r:g(Error("Invalid listener argument"));this.Yb=a;this.We=b;this.src=c;this.type=d;this.capture=!!f;this.xd=e;this.nd=r;this.key=++ac;this.pb=r};w.handleEvent=function(a){return this.Ce?this.Yb.call(this.xd||this.src,a):this.Yb.handleEvent.call(this.Yb,a)};!E||gb(9);var bc=!E||gb(9),cc=E&&!eb("8");!F||eb("528");Sa&&eb("1.9b")||E&&eb("8")||Ra&&eb("9.5")||F&&eb("528");!Sa||eb("8");function dc(a,b){this.type=a;this.currentTarget=this.target=b}C(dc,Pb);w=dc.prototype;w.t=function(){delete this.type;delete this.target;delete this.currentTarget};w.$a=r;w.dc=o;w.stopPropagation=function(){this.$a=o};w.preventDefault=function(){this.dc=r};function ec(a){ec[" "](a);return a}ec[" "]=fa;function gc(a,b){a&&this.ra(a,b)}C(gc,dc);w=gc.prototype;w.target=q;w.relatedTarget=q;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=r;w.altKey=r;w.shiftKey=r;w.metaKey=r;w.ha=q;
w.ra=function(a,b){var c=this.type=a.type;dc.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(Sa){var f;a:{try{ec(d.nodeName);f=o;break a}catch(e){}f=r}f||(d=q)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=F||a.offsetX!==n?a.offsetX:a.layerX;this.offsetY=F||a.offsetY!==n?a.offsetY:a.layerY;this.clientX=a.clientX!==n?a.clientX:a.pageX;this.clientY=a.clientY!==n?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.state=a.state;this.ha=a;delete this.dc;delete this.$a};w.stopPropagation=function(){gc.C.stopPropagation.call(this);this.ha.stopPropagation?this.ha.stopPropagation():this.ha.cancelBubble=o};
w.preventDefault=function(){gc.C.preventDefault.call(this);var a=this.ha;if(a.preventDefault)a.preventDefault();else if(a.returnValue=r,cc)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};w.Of=t("ha");w.t=function(){gc.C.t.call(this);this.relatedTarget=this.currentTarget=this.target=this.ha=q};var hc={},ic={},jc={},kc={};
function G(a,b,c,d,f){if(b){if(ja(b)){for(var e=0;e<b.length;e++)G(a,b[e],c,d,f);return q}var d=!!d,h=ic;b in h||(h[b]={g:0,U:0});h=h[b];d in h||(h[d]={g:0,U:0},h.g++);var h=h[d],i=qa(a),j;h.U++;if(h[i]){j=h[i];for(e=0;e<j.length;e++)if(h=j[e],h.Yb==c&&h.xd==f){if(h.pb)break;return j[e].key}}else j=h[i]=[],h.g++;e=lc();e.src=a;h=new $b;h.ra(c,e,a,b,d,f);c=h.key;e.key=c;j.push(h);hc[c]=h;jc[i]||(jc[i]=[]);jc[i].push(h);a.addEventListener?(a==ca||!a.le)&&a.addEventListener(b,e,d):a.attachEvent(b in
kc?kc[b]:kc[b]="on"+b,e);return c}g(Error("Invalid event type"))}function lc(){var a=mc,b=bc?function(c){return a.call(b.src,b.key,c)}:function(c){c=a.call(b.src,b.key,c);if(!c)return c};return b}function nc(a,b,c,d,f){if(ja(b))for(var e=0;e<b.length;e++)nc(a,b[e],c,d,f);else a=G(a,b,c,d,f),hc[a].nd=o}
function oc(a,b,c,d,f){if(ja(b))for(var e=0;e<b.length;e++)oc(a,b[e],c,d,f);else{d=!!d;a:{e=ic;if(b in e&&(e=e[b],d in e&&(e=e[d],a=qa(a),e[a]))){a=e[a];break a}a=q}if(a)for(e=0;e<a.length;e++)if(a[e].Yb==c&&a[e].capture==d&&a[e].xd==f){pc(a[e].key);break}}}
function pc(a){if(!hc[a])return r;var b=hc[a];if(b.pb)return r;var c=b.src,d=b.type,f=b.We,e=b.capture;c.removeEventListener?(c==ca||!c.le)&&c.removeEventListener(d,f,e):c.detachEvent&&c.detachEvent(d in kc?kc[d]:kc[d]="on"+d,f);c=qa(c);f=ic[d][e][c];if(jc[c]){var h=jc[c];tb(h,b);0==h.length&&delete jc[c]}b.pb=o;f.Le=o;qc(d,e,c,f);delete hc[a];return o}
function qc(a,b,c,d){if(!d.Fc&&d.Le){for(var f=0,e=0;f<d.length;f++)d[f].pb?d[f].We.src=q:(f!=e&&(d[e]=d[f]),e++);d.length=e;d.Le=r;0==e&&(delete ic[a][b][c],ic[a][b].g--,0==ic[a][b].g&&(delete ic[a][b],ic[a].g--),0==ic[a].g&&delete ic[a])}}function rc(a){var b,c=0,d=b==q;b=!!b;if(a==q)ib(jc,function(a){for(var f=a.length-1;0<=f;f--){var e=a[f];if(d||b==e.capture)pc(e.key),c++}});else if(a=qa(a),jc[a])for(var a=jc[a],f=a.length-1;0<=f;f--){var e=a[f];if(d||b==e.capture)pc(e.key),c++}}
function sc(a){var b=tc,a=qa(a),c=jc[a];if(c){var d=ha(b),f=ha(n);return d&&f?(c=ic[b],!!c&&!!c[n]&&a in c[n]):!d&&!f?o:rb(c,function(a){return d&&a.type==b||f&&a.capture==n})}return r}function uc(a,b,c,d,f){var e=1,b=qa(b);if(a[b]){a.U--;a=a[b];a.Fc?a.Fc++:a.Fc=1;try{for(var h=a.length,i=0;i<h;i++){var j=a[i];j&&!j.pb&&(e&=vc(j,f)!==r)}}finally{a.Fc--,qc(c,d,b,a)}}return Boolean(e)}function vc(a,b){var c=a.handleEvent(b);a.nd&&pc(a.key);return c}
function mc(a,b){if(!hc[a])return o;var c=hc[a],d=c.type,f=ic;if(!(d in f))return o;var f=f[d],e,h;if(!bc){var i;if(!(i=b))a:{i=["window","event"];for(var j=ca;e=i.shift();)if(x(j[e]))j=j[e];else{i=q;break a}i=j}e=i;i=o in f;j=r in f;if(i){if(0>e.keyCode||e.returnValue!=n)return o;a:{var p=r;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(k){p=o}if(p||e.returnValue==n)e.returnValue=o}}p=new gc;p.ra(e,this);e=o;try{if(i){for(var m=[],l=p.currentTarget;l;l=l.parentNode)m.push(l);h=f[o];h.U=h.g;for(var s=
m.length-1;!p.$a&&0<=s&&h.U;s--)p.currentTarget=m[s],e&=uc(h,m[s],d,o,p);if(j){h=f[r];h.U=h.g;for(s=0;!p.$a&&s<m.length&&h.U;s++)p.currentTarget=m[s],e&=uc(h,m[s],d,r,p)}}else e=vc(c,p)}finally{m&&(m.length=0),p.Z()}return e}d=new gc(b,this);try{e=vc(c,d)}finally{d.Z()}return e}var wc=0;function xc(a){return a+"_"+wc++};function H(a){dc.call(this,a);this._className="event"}C(H,dc);var yc=xc("pan"),zc=xc("rotate"),Ac=xc("zoom"),Bc=xc("render"),Cc=xc("resetview"),tc=xc("modified"),Dc=xc("progress"),Fc=xc("hover"),Gc=xc("hover_end");function Hc(){H.call(this,yc);this.cb=new Ic(0,0)}C(Hc,H);function Jc(){H.call(this,zc);this.cb=new Ic(0,0)}C(Jc,H);function Kc(){H.call(this,Ac);this.xa=this.Ra=r}C(Kc,H);function Lc(){H.call(this,Bc)}C(Lc,H);function Mc(){H.call(this,Fc);this.uc=this.tc=0}C(Mc,H);
function Nc(){H.call(this,Gc)}C(Nc,H);function Oc(){H.call(this,Cc)}C(Oc,H);function Pc(){H.call(this,tc);this.Ga=new I}C(Pc,H);function Qc(){H.call(this,Dc);this.de=0}C(Qc,H);function Rc(a,b,c){this.x=ha(a)?a:0;this.y=ha(b)?b:0;this.b=ha(c)?c:0}Rc.prototype.d=function(){return new Rc(this.x,this.y,this.b)};Rc.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.b+")"};Rc.prototype.ff=function(){return[this.x,this.y,this.b]};function N(a,b,c){this.x=a;this.y=b;this.b=c}C(N,Rc);w=N.prototype;w.d=function(){return new N(this.x,this.y,this.b)};w.Ya=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.b*this.b)};w.scale=function(a){this.x*=a;this.y*=a;this.b*=a;return this};w.B=function(){this.x=-this.x;this.y=-this.y;this.b=-this.b;return this};w.normalize=function(){return this.scale(1/this.Ya())};w.add=function(a){this.x+=a.x;this.y+=a.y;this.b+=a.b;return this};
w.ka=function(a){this.x-=a.x;this.y-=a.y;this.b-=a.b;return this};w.Pb=function(a){return this==a||!!a&&this.x==a.x&&this.y==a.y&&this.b==a.b};function Sc(a,b){var c=a.x-b.x,d=a.y-b.y,f=a.b-b.b;return Math.sqrt(c*c+d*d+f*f)}function Tc(a,b){return new N(a.x+b.x,a.y+b.y,a.b+b.b)}function Uc(a,b){return new N(a.y*b.b-a.b*b.y,a.b*b.x-a.x*b.b,a.x*b.y-a.y*b.x)};function Vc(){}C(Vc,Pb);w=Vc.prototype;w.le=o;w.Hc=q;w.Md=ba("Hc");w.addEventListener=function(a,b,c,d){G(this,a,b,c,d)};w.removeEventListener=function(a,b,c,d){oc(this,a,b,c,d)};
w.dispatchEvent=function(a){var b=a.type||a,c=ic;if(b in c){if(y(a))a=new dc(a,this);else if(a instanceof dc)a.target=a.target||this;else{var d=a,a=new dc(b,this);mb(a,d)}var d=1,f,c=c[b],b=o in c,e;if(b){f=[];for(e=this;e;e=e.Hc)f.push(e);e=c[o];e.U=e.g;for(var h=f.length-1;!a.$a&&0<=h&&e.U;h--)a.currentTarget=f[h],d&=uc(e,f[h],a.type,o,a)&&a.dc!=r}if(r in c)if(e=c[r],e.U=e.g,b)for(h=0;!a.$a&&h<f.length&&e.U;h++)a.currentTarget=f[h],d&=uc(e,f[h],a.type,r,a)&&a.dc!=r;else for(f=this;!a.$a&&f&&e.U;f=
f.Hc)a.currentTarget=f,d&=uc(e,f,a.type,r,a)&&a.dc!=r;a=Boolean(d)}else a=o;return a};w.t=function(){Vc.C.t.call(this);rc(this);this.Hc=q};function P(){this._className="base";this.c=r}C(P,Vc);P.prototype.className=t("_className");P.prototype.print=function(){var a=Object.keys(this),b="",c="<unknown>",d=0;for(d in a){var f="this."+a[d],e=eval(f);"this._className"==f?c=e:b+=f+": "+e+"\n"}return"== X."+c+" ==\n"+b};P.prototype.If=t("c");function Wc(a){a.c=r}A("X.base",P);A("X.base.prototype.className",P.prototype.className);A("X.base.prototype.print",P.prototype.print);A("X.base.prototype.dirty",P.prototype.If);function R(a){P.call(this);this._className="triplets";this.Ca=this.Fa=this.Ba=this.Ea=this.Aa=this.Da=q;this.jc=[0,0,0];this.T=[];x(a)&&a instanceof R&&(this.T=a.all().slice(),this.Da=a.Da,this.Aa=a.Aa,this.Ea=a.Ea,this.Ba=a.Ba,this.Fa=a.Fa,this.Ca=a.Ca,this.jc=a.jc.slice())}C(R,P);w=R.prototype;
w.add=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("Invalid triplet."));if(!this.Da||a<this.Da)this.Da=a;if(!this.Aa||a>this.Aa)this.Aa=a;if(!this.Ea||b<this.Ea)this.Ea=b;if(!this.Ba||b>this.Ba)this.Ba=b;if(!this.Fa||c<this.Fa)this.Fa=c;if(!this.Ca||c>this.Ca)this.Ca=c;this.jc=[(this.Da+this.Aa)/2,(this.Ea+this.Ba)/2,(this.Fa+this.Ca)/2];this.c=o;return this.T.push(a,b,c)/3};w.get=function(a){(!z(a)||3*a>this.T.length)&&g(Error("Invalid id."));a*=3;return[this.T[a],this.T[a+1],this.T[a+2]]};
w.remove=function(a){(!z(a)||3*a>this.T.length)&&g(Error("Invalid id."));this.T.splice(a,3);this.c=o};w.all=t("T");w.clear=function(){this.T=[];this.c=o};w.count=function(){return this.T.length/3};w.length=function(){return this.T.length};A("X.triplets",R);A("X.triplets.prototype.add",R.prototype.add);A("X.triplets.prototype.get",R.prototype.get);A("X.triplets.prototype.remove",R.prototype.remove);A("X.triplets.prototype.all",R.prototype.all);A("X.triplets.prototype.clear",R.prototype.clear);
A("X.triplets.prototype.count",R.prototype.count);A("X.triplets.prototype.length",R.prototype.length);function Xc(){P.call(this);this._className="parser"}C(Xc,P);w=Xc.prototype;w.parse=function(){g(Error("The function parse() should be overloaded."))};w.bc=function(a,b){var c=this.s(a,b+2),d=this.s(a,b+3),f=(d<<1&255|c>>7)-127,c=(c&127)<<16|this.s(a,b+1)<<8|this.s(a,b);return 0==c&&-127==f?0:(1-2*(d>>7))*(1+c*Math.pow(2,-23))*Math.pow(2,f)};
function Yc(a,b,c){var d=a.s(b,c),f=a.s(b,c+1),e=(d<<1&255|f>>7)-127,a=(f&127)<<16|a.s(b,c+2)<<8|a.s(b,c+3);return 0==a&&-127==e?0:(1-2*(d>>7))*(1+a*Math.pow(2,-23))*Math.pow(2,e)}function Zc(a,b,c,d){var f=[],e=0,h=Infinity,i;for(i=0;i<d;i++){var j=a.bc(b,c+4*i);f[i]=j;e=Math.max(e,j);h=Math.min(h,j)}return[f,e,h]}function $c(a,b,c){return(a.s(b,c+3)<<24)+(a.s(b,c+2)<<16)+(a.s(b,c+1)<<8)+a.s(b,c)}function ad(a,b,c){return(a.s(b,c)<<24)+(a.s(b,c+1)<<16)+(a.s(b,c+2)<<8)+a.s(b,c+3)}
w.Kc=function(a,b){return(this.s(a,b+1)<<8)+this.s(a,b)};w.ug=function(a,b){var c=this.s(a,b);return 127<c?c-256:c};w.s=function(a,b){return a.charCodeAt(b)&255};function bd(){Xc.call(this);this._className="parserTRK"}C(bd,Xc);
bd.prototype.parse=function(a,b){var c=a.k,d=a.o,f=a.W,e=0,h=e+6,i=0,j=Infinity,p;for(p=0;3>p;p++)var k=this.Kc(b,h+2*p),i=Math.max(i,k),j=Math.min(j,k);var m=Zc(this,b,e+12,3)[0];Zc(this,b,e+24,3);var l=this.Kc(b,e+36),s=this.Kc(b,e+238);Zc(this,b,e+440,16);Zc(this,b,e+956,6);for(var h=$c(this,b,e+988),e=$c(this,b,e+996),i=[],v=q,u=q,B=q,D=q,K=k=q,j=0;j<h;j++){var L=$c(this,b,e),J=new R,e=e+4;for(p=0;p<L;p++){var da=this.bc(b,e),e=e+4,$=this.bc(b,e),e=e+4,ea=this.bc(b,e),e=e+4;0<l&&(Zc(this,b,e,
l),e+=4*l);da/=m[0];$/=m[1];ea/=m[2];J.add(da,$,ea)}0<s&&(e+=4*s);p=J.Da;var L=J.Aa,da=J.Ea,$=J.Ba,ea=J.Fa,hb=J.Ca;if(!v||p<v)v=p;if(!u||L>u)u=L;if(!B||da<B)B=da;if(!D||$>D)D=$;if(!k||ea<k)k=ea;if(!K||hb>K)K=hb;i.push(J)}e=(v+u)/2;B=(B+D)/2;k=(k+K)/2;for(j=0;j<h;j++){K=i[j];D=K.count();for(p=0;p<D-1;p++)l=K.get(p),m=K.get(p+1),c.add(l[0],l[1],l[2]),c.add(m[0],m[1],m[2]),s=l[0]-e,v=l[1]-B,u=l[2]-k,J=Math.sqrt(s*s+v*v+u*u),L=m[0]-e,da=m[1]-B,$=m[2]-k,ea=Math.sqrt(L*L+da*da+$*$),d.add(s/J,v/J,u/J),d.add(L/
ea,da/ea,$/ea),m=[Math.abs(m[0]-l[0]),Math.abs(m[1]-l[1]),Math.abs(m[2]-l[2])],l=Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2]),m[0]/=l,m[1]/=l,m[2]/=l,f.add(m[0],m[1],m[2]),f.add(m[0],m[1],m[2])}a.rb(cd);c=new Pc;c.Ga=a;this.dispatchEvent(c)};A("X.parserTRK",bd);A("X.parserTRK.prototype.parse",bd.prototype.parse);function dd(){Xc.call(this);this._className="parserSTL"}C(dd,Xc);dd.prototype.parse=function(a,b){for(var c=b.split("\n"),d=c.length,f=a.k,e=a.o,h=0,i=d%8;i--;)this.z(f,e,c[h]),h++;for(i=0.125*d^0;i--;)this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++;c=new Pc;c.Ga=a;this.dispatchEvent(c)};
dd.prototype.z=function(a,b,c){var c=c.replace(/^\s+|\s+$/g,""),d=c.split(" ");if("vertex"==d[0]){var c=parseFloat(d[1]),f=parseFloat(d[2]),d=parseFloat(d[3]);a.add(c,f,d)}else"facet"==d[0]&&(c=parseFloat(d[2]),f=parseFloat(d[3]),d=parseFloat(d[4]),b.add(c,f,d),b.add(c,f,d),b.add(c,f,d))};A("X.parserSTL",dd);A("X.parserSTL.prototype.parse",dd.prototype.parse);function S(a,b,c){this.Q=this.P=this.O=0;3==arguments.length?(this.O=Number(a),this.P=Number(b),this.Q=Number(c)):"x"in a&&"y"in a&&"z"in a?(this.O=Number(a.x()),this.P=Number(a.y()),this.Q=Number(a.b())):(this.O=Number(a[0]),this.P=Number(a[1]),this.Q=Number(a[2]))}
S.prototype={d:function(){return new S(this.O,this.P,this.Q)},Gc:function(){return new S(-this.O,-this.P,-this.Q)},Za:function(a){return new S(this.O+a.x(),this.P+a.y(),this.Q+a.b())},mb:function(a){return new S(this.O-a.x(),this.P-a.y(),this.Q-a.b())},va:function(a){return new S(this.O*a,this.P*a,this.Q*a)},oe:function(a){return new S(this.O/a,this.P/a,this.Q/a)},Va:function(a){return this.O*a.x()+this.P*a.y()+this.Q*a.b()},Dd:function(a,b){return this.Za(a.mb(this).va(b))},length:function(){return Math.sqrt(this.Va(this))},
tb:function(){return this.oe(this.length())},wc:function(a){return new S(this.P*a.b()-this.Q*a.y(),this.Q*a.x()-this.O*a.b(),this.O*a.y()-this.P*a.x())},x:t("O"),y:t("P"),b:t("Q")};A("csgVector",S);A("csgVector.prototype.clone",S.prototype.d);A("csgVector.prototype.plus",S.prototype.Za);A("csgVector.prototype.minus",S.prototype.mb);A("csgVector.prototype.dividedBy",S.prototype.oe);A("csgVector.prototype.times",S.prototype.va);A("csgVector.prototype.dot",S.prototype.Va);
A("csgVector.prototype.lerp",S.prototype.Dd);A("csgVector.prototype.length",S.prototype.length);A("csgVector.prototype.unit",S.prototype.tb);A("csgVector.prototype.cross",S.prototype.wc);A("csgVector.prototype.negated",S.prototype.Gc);A("csgVector.prototype.x",S.prototype.x);A("csgVector.prototype.y",S.prototype.y);A("csgVector.prototype.z",S.prototype.b);function ed(){this.Mc=n}
function fd(a,b,c){switch(typeof b){case "string":gd(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==q){c.push("null");break}if(ja(b)){var d=b.length;c.push("[");for(var f="",e=0;e<d;e++)c.push(f),f=b[e],fd(a,a.Mc?a.Mc.call(b,""+e,f):f,c),f=",";c.push("]");break}c.push("{");d="";for(e in b)Object.prototype.hasOwnProperty.call(b,e)&&(f=b[e],"function"!=typeof f&&(c.push(d),gd(e,c),c.push(":"),
fd(a,a.Mc?a.Mc.call(b,e,f):f,c),d=","));c.push("}");break;case "function":break;default:g(Error("Unknown type: "+typeof b))}}var hd={'"':'\\"',"\\":"\\\\","/":"\\/","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},id=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function gd(a,b){b.push('"',a.replace(id,function(a){if(a in hd)return hd[a];var b=a.charCodeAt(0),f="\\u";16>b?f+="000":256>b?f+="00":4096>b&&(f+="0");return hd[a]=f+b.toString(16)}),'"')};function jd(){P.call(this);this._className="indexer";this.ld=[];this.ad={}}C(jd,P);jd.prototype.add=function(a){x(a)||g(Error("Invalid object."));var b;b=[];fd(new ed,a,b);b=b.join("");b in this.ad||(this.ad[b]=this.ld.length,this.ld.push(a));return this.ad[b]};jd.prototype.unique=t("ld");function T(a,b){this.J=new S(a);this.w=new S(b)}T.prototype={d:function(){return new T(this.J.d(),this.w.d())},qa:function(){this.w=this.w.Gc()},Ae:function(a,b){return new T(this.J.Dd(a.J,b),this.w.Dd(a.w,b))},xg:t("J"),Gd:t("w")};A("csgVertex",T);A("csgVertex.prototype.clone",T.prototype.d);A("csgVertex.prototype.flip",T.prototype.qa);A("csgVertex.prototype.interpolate",T.prototype.Ae);A("csgVertex.prototype.pos",T.prototype.xg);A("csgVertex.prototype.normal",T.prototype.Gd);function kd(a,b){this.w=a;this.ub=b}kd.prototype={d:function(){return new kd(this.w.d(),this.ub)},qa:function(){this.w=this.w.Gc();this.ub=-this.ub},dh:t("ub"),Gd:t("w")};A("csgPlane.prototype.w",kd.prototype.dh);A("csgPlane.prototype.normal",kd.prototype.Gd);function ld(a,b){this.la=a;this.fc=b;var c=a[0].J,d=a[2].J,d=a[1].J.mb(c).wc(d.mb(c)).tb();this.M=new kd(d,d.Va(c))}
ld.prototype={d:function(){var a=this.la.map(function(a){return a.d()});return new ld(a,this.fc)},qa:function(){this.la.reverse().map(function(a){a.qa()});this.M.qa()},bh:t("la"),Pg:t("fc"),bf:function(a,b,c,d,f){for(var e=0,h=[],i=0;i<this.la.length;i++){var j=a.w.Va(this.la[i].J)-a.ub,j=-1.0E-5>j?2:1.0E-5<j?1:0,e=e|j;h.push(j)}switch(e){case 0:(0<a.w.Va(this.M.w)?b:c).push(this);break;case 1:d.push(this);break;case 2:f.push(this);break;case 3:b=[];c=[];for(i=0;i<this.la.length;i++){var p=(i+1)%
this.la.length,j=h[i],k=h[p],e=this.la[i],p=this.la[p];2!=j&&b.push(e);1!=j&&c.push(2!=j?e.d():e);3==(j|k)&&(j=(a.ub-a.w.Va(e.J))/a.w.Va(p.J.mb(e.J)),j=e.Ae(p,j),b.push(j),c.push(j.d()))}3<=b.length&&d.push(new ld(b,this.fc));3<=c.length&&f.push(new ld(c,this.fc))}}};A("csgPolygon",ld);A("csgPolygon.prototype.clone",ld.prototype.d);A("csgPolygon.prototype.flip",ld.prototype.qa);A("csgPolygon.prototype.vertices",ld.prototype.bh);A("csgPolygon.prototype.shared",ld.prototype.Pg);function md(a){this.D=this.F=this.M=q;this.i=[];a&&this.ib(a)}
md.prototype={d:function(){var a=new md;a.Kg(this.M&&this.M.d());a.Hg(this.F&&this.F.d());a.Dg(this.D&&this.D.d());a.ec(this.i.map(function(a){return a.d()}));return a},B:function(){for(var a=0;a<this.i.length;a++)this.i[a].qa();this.M.qa();this.F&&this.F.B();this.D&&this.D.B();a=this.F;this.F=this.D;this.D=a},pd:function(a){if(!this.M)return a.slice();for(var b=[],c=[],d=0;d<a.length;d++)a[d].bf(this.M,b,c,b,c);this.F&&(b=this.F.pd(b));c=this.D?this.D.pd(c):[];return b.concat(c)},Y:function(a){this.i=
a.pd(this.i);this.F&&this.F.Y(a);this.D&&this.D.Y(a)},La:function(){var a=this.i.slice();this.F&&(a=a.concat(this.F.La()));this.D&&(a=a.concat(this.D.La()));return a},ib:function(a){if(a.length){this.M||(this.M=a[0].M.d());for(var b=[],c=[],d=0;d<a.length;d++)a[d].bf(this.M,this.i,this.i,b,c);b.length&&(this.F||(this.F=new md),this.F.ib(b));c.length&&(this.D||(this.D=new md),this.D.ib(c))}},Kg:ba("M"),Hg:ba("F"),Dg:ba("D"),Ve:t("i"),ec:ba("i")};function U(){this.i=[]}function nd(a){var b=new U;b.ec(a);return b}
U.prototype={d:function(){var a=new U;a.ec(this.i.map(function(a){return a.d()}));return a},Vg:t("i"),Rc:function(a){var b=new md(this.d().i),a=new md(a.d().i);b.Y(a);a.Y(b);a.B();a.Y(b);a.B();b.ib(a.La());return nd(b.La())},ka:function(a){var b=new md(this.d().i),a=new md(a.d().i);b.B();b.Y(a);a.Y(b);a.B();a.Y(b);a.B();b.ib(a.La());b.B();return nd(b.La())},Dc:function(a){var b=new md(this.d().i),a=new md(a.d().i);b.B();a.Y(b);a.B();b.Y(a);a.Y(b);b.ib(a.La());b.B();return nd(b.La())},inverse:function(){var a=
this.d();a.i.map(function(a){a.qa()});return a},Ve:t("i"),ec:ba("i")};A("CSG",U);A("CSG.fromPolygons",nd);A("CSG.prototype.toPolygons",U.prototype.Vg);A("CSG.prototype.union",U.prototype.Rc);A("CSG.prototype.subtract",U.prototype.ka);A("CSG.prototype.intersect",U.prototype.Dc);A("CSG.prototype.inverse",U.prototype.inverse);A("CSG.prototype.polygons",U.prototype.Ve);A("CSG.prototype.setPolygons",U.prototype.ec);function V(a,b){this.x=ha(a)?a:0;this.y=ha(b)?b:0}V.prototype.d=function(){return new V(this.x,this.y)};V.prototype.toString=function(){return"("+this.x+", "+this.y+")"};function od(a,b){return new V(a.x-b.x,a.y-b.y)};function Ic(a,b){this.x=a;this.y=b}C(Ic,V);w=Ic.prototype;w.d=function(){return new Ic(this.x,this.y)};w.Ya=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};w.scale=function(a){this.x*=a;this.y*=a;return this};w.B=function(){this.x=-this.x;this.y=-this.y;return this};w.normalize=function(){return this.scale(1/this.Ya())};w.add=function(a){this.x+=a.x;this.y+=a.y;return this};w.ka=function(a){this.x-=a.x;this.y-=a.y;return this};
w.rotate=function(a){var b=Math.cos(a),a=Math.sin(a),c=this.y*b+this.x*a;this.x=this.x*b-this.y*a;this.y=c;return this};w.Pb=function(a){return this==a||!!a&&this.x==a.x&&this.y==a.y};function pd(a,b){this.width=a;this.height=b}function qd(a,b){return a==b?o:!a||!b?r:a.width==b.width&&a.height==b.height}w=pd.prototype;w.d=function(){return new pd(this.width,this.height)};w.toString=function(){return"("+this.width+" x "+this.height+")"};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){this.width*=a;this.height*=a;return this};function rd(a,b){if(a instanceof rd)this.v=a.ff();else{var c;if(c=ka(a))a:{for(var d=c=0;d<a.length;d++){if(!ka(a[d])||0<c&&a[d].length!=c){c=r;break a}for(var f=0;f<a[d].length;f++)if(!z(a[d][f])){c=r;break a}0==c&&(c=a[d].length)}c=0!=c}c?this.v=vb(a):a instanceof pd?this.v=sd(a.height,a.width):z(a)&&z(b)&&0<a&&0<b?this.v=sd(a,b):g(Error("Invalid argument(s) for Matrix contructor"))}this.q=new pd(this.v[0].length,this.v.length)}
function td(a){for(var b=[],c=0;c<a;c++){b[c]=[];for(var d=0;d<a;d++)b[c][d]=c==d?1:0}return new rd(b)}function ud(a,b,c){for(var d=0;d<a.K().height;d++)for(var f=0;f<a.K().width;f++)b.call(c,a.v[d][f],d,f,a)}function vd(a,b){var c=new rd(a.K());ud(a,function(d,f,e){c.v[f][e]=b.call(n,d,f,e,a)});return c}function sd(a,b){for(var c=[],d=0;d<a;d++){c[d]=[];for(var f=0;f<b;f++)c[d][f]=0}return c}w=rd.prototype;
w.add=function(a){qd(this.q,a.K())||g(Error("Matrix summation is only supported on arrays of equal size"));return vd(this,function(b,c,d){return b+a.v[c][d]})};w.Pb=function(a,b){if(this.q.width!=a.q.width||this.q.height!=a.q.height)return r;for(var c=b||0,d=0;d<this.q.height;d++)for(var f=0;f<this.q.width;f++)if(!(Math.abs(this.v[d][f]-a.v[d][f])<=(c||1.0E-6)))return r;return o};w.K=t("q");function wd(a,b,c){return!(0<=b&&b<a.q.height&&0<=c&&c<a.q.width)?q:a.v[b][c]}
function W(a,b,c,d){0<=b&&b<a.q.height&&0<=c&&c<a.q.width||g(Error("Index out of bounds when setting matrix value, ("+b+","+c+") in size ("+a.q.height+","+a.q.width+")"));a.v[b][c]=d}w.multiply=function(a){if(a instanceof rd)return this.q.width!=a.K().height&&g(Error("Invalid matrices for multiplication. Second matrix should have the same number of rows as the first has columns.")),xd(this,a);if(z(a))return yd(this,a);g(Error("A matrix can only be multiplied by a number or another matrix."))};
w.ka=function(a){qd(this.q,a.K())||g(Error("Matrix subtraction is only supported on arrays of equal size."));return vd(this,function(b,c,d){return b-a.v[c][d]})};w.ff=t("v");w.toString=function(){var a=0;ud(this,function(b){b=(""+b).length;b>a&&(a=b)});var b=[];pb(this.v,function(c){b.push("[ ");pb(c,function(c){c=""+c;b.push(Array(a-c.length+1).join(" ")+c+" ")});b.push("]\n")});return b.join("")};
function xd(a,b){var c=new rd(a.q.height,b.K().width);ud(c,function(a,f,e){for(var h=a=0;h<this.q.width;h++)a+=wd(this,f,h)*wd(b,h,e);W(c,f,e,a)},a);return c}function yd(a,b){return vd(a,function(a){return a*b})};function Y(a,b){rd.call(this,a,b);this._className="matrix"}C(Y,rd);function zd(a){for(var b=[],c=0;c<a;c++){b[c]=[];for(var d=0;d<a;d++)b[c][d]=c==d?1:0}return new Y(b)}w=Y.prototype;w.A=function(){var a=[],b=this.K();if(0==b.height||0==b.width)return[];var c,d;for(d=0;d<b.height;d++)for(c=0;c<b.width;c++)a.push(wd(this,c,d));return a};
w.translate=function(a){this.q.width!=this.q.height&&g(Error("Can not translate non-square matrix."));var b=this.K(),c=td(b.height);a instanceof Ic&&3==b.height?(W(c,0,2,a.x),W(c,1,2,a.y)):a instanceof N&&4==b.height?(W(c,0,3,a.x),W(c,1,3,a.y),W(c,2,3,a.b)):g(Error("Translation failed."));return new Y(this.multiply(c))};
w.rotate=function(a,b){(4!=this.K().height||this.q.width!=this.q.height)&&g(Error("Only 4x4 matrices can be rotated."));(!x(b)||!(b instanceof N))&&g(Error("Invalid axis vector."));z(a)||g(Error("Invalid angle."));var c=b.normalize(),d=Math.cos(a),f=Math.sin(a),e=td(4);W(e,0,0,d+c.x*c.x*(1-d));W(e,0,1,c.x*c.y*(1-d)-c.b*f);W(e,0,2,c.x*c.b*(1-d)+c.y*f);W(e,1,0,c.y*c.x*(1-d)+c.b*f);W(e,1,1,d+c.y*c.y*(1-d));W(e,1,2,c.y*c.b*(1-d)-c.x*f);W(e,2,0,c.b*c.x*(1-d)-c.y*f);W(e,2,1,c.b*c.y*(1-d)+c.x*f);W(e,2,2,
d+c.b*c.b*(1-d));return new Y(this.multiply(e))};w.ca=function(a){var b=this.K(),c=Array(b.width),d;for(d=0;d<c.length;d++)c[d]=Array(1),c[d][0]=1;a instanceof N&&3<=b.width?(c[0][0]=a.x,c[1][0]=a.y,c[2][0]=a.b):g(Error("Multiplication by vector failed."));a=this.multiply(new rd(c));return new N(parseFloat(wd(a,0,0)),parseFloat(wd(a,1,0)),parseFloat(wd(a,2,0)))};w.Tg=function(a,b){var c=this.v[a];this.v[a]=this.v[b];this.v[b]=c};
w.Sg=function(a,b){for(var c=this.K(),d=0,d=0;d<c.height;d++){var f=wd(this,d,a);f||(f=0);var e=wd(this,d,b);e||(e=0);W(this,d,a,e);W(this,d,b,f)}};A("X.matrix",Y);A("X.matrix.createIdentityMatrix",zd);A("X.matrix.prototype.flatten",Y.prototype.A);A("X.matrix.prototype.translate",Y.prototype.translate);A("X.matrix.prototype.rotate",Y.prototype.rotate);A("X.matrix.prototype.multiplyByVector",Y.prototype.ca);A("X.matrix.prototype.swapRows",Y.prototype.Tg);A("X.matrix.prototype.swapCols",Y.prototype.Sg);function Ad(){P.call(this);this._className="transform";this.f=zd(4);this.na=new Float32Array(this.f.A())}C(Ad,P);w=Ad.prototype;w.zg=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new N(0,1,0));this.na=new Float32Array(this.f.A());this.c=o};w.Ag=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new N(1,0,0));this.na=new Float32Array(this.f.A());this.c=o};
w.Bg=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new N(0,0,1));this.na=new Float32Array(this.f.A());this.c=o};w.Xg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new N(a,0,0));this.na=new Float32Array(this.f.A());this.c=o};w.Yg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new N(0,a,0));this.na=new Float32Array(this.f.A());this.c=o};
w.Zg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new N(0,0,a));this.na=new Float32Array(this.f.A());this.c=o};w.Zf=t("f");w.Ze=function(a){var b=zd(4);x(a)&&a instanceof Y&&(b=a);this.f=b;this.na=new Float32Array(this.f.A());this.c=o};function Bd(a,b,c){var d=wd(a.f,b,c);d||(d=0);W(a.f,b,c,-1*d);a.na=new Float32Array(a.f.A());a.c=o}w.Lf=function(){Bd(this,0,0)};w.Mf=function(){Bd(this,1,1)};w.Nf=function(){Bd(this,2,2)};A("X.transform",Ad);
A("X.transform.prototype.rotateX",Ad.prototype.zg);A("X.transform.prototype.rotateY",Ad.prototype.Ag);A("X.transform.prototype.rotateZ",Ad.prototype.Bg);A("X.transform.prototype.translateX",Ad.prototype.Xg);A("X.transform.prototype.translateY",Ad.prototype.Yg);A("X.transform.prototype.translateZ",Ad.prototype.Zg);A("X.transform.prototype.matrix",Ad.prototype.Zf);A("X.transform.prototype.setMatrix",Ad.prototype.Ze);A("X.transform.prototype.flipX",Ad.prototype.Lf);A("X.transform.prototype.flipY",Ad.prototype.Mf);
A("X.transform.prototype.flipZ",Ad.prototype.Nf);function Cd(a){P.call(this);this._className="file";this.tf=a;this.c=o}C(Cd,P);Cd.prototype.path=t("tf");function Dd(){P.call(this);this._className="texture";var a=window["X.Counter"];a.ze();this._id=a.value();this.Gb=this.Sd=this.Pa=q;this.oc=this.pc=0;this.c=o}C(Dd,P);Dd.prototype.id=t("_id");Dd.prototype.file=t("Pa");Dd.prototype.zd=t("Sd");function I(a){P.call(this);this._className="object";var b=window["X.Counter"];b.ze();this._id=b.value();this._type=Ed;this.rc=new Ad;this._color=[1,1,1];this.k=new R;this.o=new R;this.W=new R;this.Pa=this.Sa=this.S=q;this._opacity=1;this.bb=q;this._visible=o;this._lineWidth=this._pointSize=1;this._caption=q;this._magicMode=r;x(a)&&(this._type=a.type(),this.rc.Ze(new Y(a.transform().f)),this._color=Array(a.color()),this.k=new R(a.k),this.o=new R(a.o),this.W=new R(a.W),this.S=a.S,this.Sa=a.Sa,a.file()&&
(this.Pa=new Cd((new String(a.file().path())).toString())),this._opacity=a.opacity(),this.bb=a.children(),this._visible=a.lf(),this._pointSize=a.Ue(),this._lineWidth=a.lineWidth(),a.caption()&&(this._caption=(new String(a.caption())).toString()),this._magicMode=a.Ge(),this.c=o);this.c=o}C(I,P);var Ed="TRIANGLES",cd="LINES";w=I.prototype;w.id=t("_id");
function Fd(a){for(var b=a.k.count(),c=[],d=0,d=0;d<b;d+=3){var f=a.k.get(d),e=a.k.get(d+1),h=a.k.get(d+2),i=a.o.get(d),j=a.o.get(d+1),p=a.o.get(d+2),k=a._color;0<a.W.length()&&(k=a.W.get(d));var m=[];m.push(new T(f,i));m.push(new T(e,j));m.push(new T(h,p));c.push(new ld(m,k))}return nd(c)}
function Gd(a,b){(!x(b)||!(b instanceof U))&&g(Error("Invalid CSG object."));a.k.clear();a.o.clear();a.W.clear();var c=new jd,d=[];qb(b.i,function(a){for(var b=[],h=a.fc,b=qb(a.la,function(a){a.color=h;return c.add(a)}),a=a=2;a<b.length;a++)d.push([b[0],b[a-1],b[a]])}.bind(a));a.qf=qb(c.unique(),function(a){return[a.J.x(),a.J.y(),a.J.b()]});a.pf=qb(c.unique(),function(a){return[a.w.x(),a.w.y(),a.w.b()]});a.of=qb(c.unique(),function(a){return!a.color?q:[a.color[0],a.color[1],a.color[2]]});qb(d,function(a){var b=
a[0],c=a[1],a=a[2],d=this.qf,j=this.pf,p=this.of;this.k.add(d[b][0],d[b][1],d[b][2]);this.k.add(d[c][0],d[c][1],d[c][2]);this.k.add(d[a][0],d[a][1],d[a][2]);this.o.add(j[b][0],j[b][1],j[b][2]);this.o.add(j[c][0],j[c][1],j[c][2]);this.o.add(j[a][0],j[a][1],j[a][2]);p[b]&&this.W.add(p[b][0],p[b][1],p[b][2]);p[c]&&this.W.add(p[c][0],p[c][1],p[c][2]);p[a]&&this.W.add(p[a][0],p[a][1],p[a][2])}.bind(a));a.rb(Ed)}w.type=t("_type");w.rb=ba("_type");w.transform=t("rc");w.vg=t("k");w.bg=t("o");w.Cf=t("W");
w.color=t("_color");w.Ug=t("S");w.Pc=function(a){if(x(a)){if(y(a)){var b=a,c=a=new Dd;x(b)?(y(b)&&(b=new Cd(b)),c.Pa=b):c.Pa=q}a instanceof Dd||g(Error("Invalid texture."));this.S=a}else this.S=q};w.Ye=function(a,b,c){(!z(a)&&0>a&&1<a||!z(b)&&0>b&&1<b||!z(c)&&0>c&&1<c)&&g(Error("Invalid color."));if(this.Wb())for(var d=this.children(),f=d.length,e=0,e=0;e<f;e++)d[e].Ye(a,b,c);this._color[0]=a;this._color[1]=b;this._color[2]=c;this.c=o};
w.Rc=function(a){(!x(a)||!(a instanceof U)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Fd(b));a=new I;Gd(a,Fd(this).Rc(b));return a};w.ka=function(a){(!x(a)||!(a instanceof U)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Fd(b));a=new I;Gd(a,Fd(this).ka(b));return a};w.Dc=function(a){(!x(a)||!(a instanceof U)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Fd(b));a=new I;Gd(a,Fd(this).Dc(b));return a};
w.inverse=function(a){(!x(a)||!(a instanceof U)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Fd(b));a=new I;Gd(a,Fd(this).inverse(b));return a};w.opacity=t("_opacity");w.caption=t("_caption");w.Eg=function(a){this._caption=a;this.c=o};w.p=function(a){if(this.Wb())for(var b=this.children(),c=b.length,d=0,d=0;d<c;d++)b[d].p(a);this._visible=a;this.c=o};w.lf=t("_visible");
w.$e=function(a){(!z(a)||1<a||0>a)&&g(Error("Invalid opacity."));if(this.Wb())for(var b=this.children(),c=b.length,d=0,d=0;d<c;d++)b[d].$e(a);this._opacity=a;this.c=o};w.load=function(a){this.Pa=x(a)?new Cd(a):q};w.file=t("Pa");w.$b=function(){var a=new Pc;a.Ga=this;this.dispatchEvent(a)};w.children=function(){this.bb||(this.bb=[]);return this.bb};w.Wb=function(){return!this.bb?r:0<this.bb.length};w.Ig=function(a){z(a)||g(Error("Invalid line width."));this._lineWidth=a;this.c=o};w.lineWidth=t("_lineWidth");
w.Lg=function(a){z(a)||g(Error("Invalid point size."));this._pointSize=a;this.c=o};w.Ue=t("_pointSize");w.Ge=t("_magicMode");w.Jg=function(a){"boolean"!=typeof a&&g(Error("Invalid magicMode setting."));this._magicMode=a};function Hd(a,b){(!x(a)||!x(b)||!(a instanceof I)||!(b instanceof I))&&g(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.opacity()?-1:1==b.opacity()?1:x(a.xc)&&x(b.xc)&&a.xc>b.xc?-1:1}A("X.object",I);A("X.object.prototype.id",I.prototype.id);
A("X.object.prototype.type",I.prototype.type);A("X.object.prototype.transform",I.prototype.transform);A("X.object.prototype.points",I.prototype.vg);A("X.object.prototype.normals",I.prototype.bg);A("X.object.prototype.texture",I.prototype.Ug);A("X.object.prototype.setTexture",I.prototype.Pc);A("X.object.prototype.colors",I.prototype.Cf);A("X.object.prototype.color",I.prototype.color);A("X.object.prototype.setColor",I.prototype.Ye);A("X.object.prototype.opacity",I.prototype.opacity);
A("X.object.prototype.setOpacity",I.prototype.$e);A("X.object.prototype.lineWidth",I.prototype.lineWidth);A("X.object.prototype.setLineWidth",I.prototype.Ig);A("X.object.prototype.pointSize",I.prototype.Ue);A("X.object.prototype.setPointSize",I.prototype.Lg);A("X.object.prototype.load",I.prototype.load);A("X.object.prototype.file",I.prototype.file);A("X.object.prototype.caption",I.prototype.caption);A("X.object.prototype.visible",I.prototype.lf);A("X.object.prototype.setCaption",I.prototype.Eg);
A("X.object.prototype.setVisible",I.prototype.p);A("X.object.prototype.magicMode",I.prototype.Ge);A("X.object.prototype.setMagicMode",I.prototype.Jg);A("X.object.prototype.intersect",I.prototype.Dc);A("X.object.prototype.inverse",I.prototype.inverse);A("X.object.prototype.subtract",I.prototype.ka);A("X.object.prototype.union",I.prototype.Rc);A("X.object.prototype.children",I.prototype.children);function Id(){Xc.call(this);this._className="parserVTK"}C(Id,Xc);
Id.prototype.parse=function(a,b){var c=a.k,d=a.o,f=b.split("\n"),e=f.length,h=new R,i=new R;this.G=[];this.X=Ed;this.ed=this.Ja=this.ya=this.Ka=r;for(var j=0,p=e%8;p--;)this.z(h,i,f[j]),j++;for(p=0.125*e^0;p--;)this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++;if(this.X==Ed){f=i.length();j=e=this.G.length;do{var p=this.G[e-j],k=p.length,m;for(m=0;m<k;m++){var l=parseInt(p[m],10),s=
h.get(l);c.add(s[0],s[1],s[2]);l<f?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new N(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b))}j--}while(0<j)}else if("TRIANGLE_STRIPS"==this.X){f=i.length();j=e=this.G.length;do{p=this.G[e-j];k=p.length;for(m=0;m<k;m++)l=parseInt(p[m],10),s=h.get(l),c.add(s[0],s[1],s[2]),(0==m||m==k-1)&&c.add(s[0],s[1],s[2]),l<f?(l=i.get(l),d.add(l[0],l[1],l[2]),(0==m||m==k-1)&&d.add(l[0],l[1],l[2])):(l=new N(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b),(0==m||m==k-1)&&d.add(l.x,
l.y,l.b));j--}while(0<j)}else if(this.X==cd){f=i.length();j=e=this.G.length;do{p=this.G[e-j];k=p.length;for(m=0;m<k-1;m++){var v=parseInt(p[m],10),l=parseInt(p[m+1],10),u=h.get(v),s=h.get(l);c.add(u[0],u[1],u[2]);c.add(s[0],s[1],s[2]);v<f-1?(s=i.get(v),l=i.get(l),d.add(s[0],s[1],s[2]),d.add(l[0],l[1],l[2])):(l=new N(u[0],u[1],u[2]),l.normalize(),d.add(l.x,l.y,l.b),l=new N(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b))}j--}while(0<j)}else if("POINTS"==this.X){f=i.length();j=e=this.G.length;do{p=
this.G[e-j];k=p.length;for(m=0;m<k;m++)l=parseInt(p[m],10),s=h.get(l),c.add(s[0],s[1],s[2]),l<f?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new N(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b));j--}while(0<j)}else if("POLYGONS"==this.X){f=i.length();j=e=this.G.length;do{p=this.G[e-j];k=p.length;for(m=0;m<k;m++)l=parseInt(p[m],10),s=h.get(l),c.add(s[0],s[1],s[2]),l<f?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new N(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b));j--}while(0<j)}a.rb(this.X);c=new Pc;c.Ga=
a;this.dispatchEvent(c)};
Id.prototype.z=function(a,b,c){var c=c.replace(/^\s+|\s+$/g,""),c=c.split(" "),d=c.length,f=c[0];if("POINTS"==f)this.Ka=o,this.Ja=this.ya=r;else if("VERTICES"==f)this.ya=o,this.Ja=this.Ka=r,a=parseInt(c[1],10),3<=a?this.X=Ed:1==a?this.X="POINTS":g(Error("VTK file not supported!")),this.G=[];else if("TRIANGLE_STRIPS"==f)this.ya=o,this.Ja=this.Ka=r,this.X="TRIANGLE_STRIPS",this.G=[];else if("LINES"==f)this.ya=o,this.Ja=this.Ka=r,this.X=cd,this.G=[];else if("POLYGONS"==f)this.ya=o,this.Ja=this.Ka=r,
this.X="POLYGONS",this.G=[];else if("POINT_DATA"==f)this.Ja=o,this.ya=this.Ka=r;else if(this.Ka)if(1==d||isNaN(parseFloat(f)))this.Ka=r;else{if(3<=d){var f=parseFloat(c[0]),e=parseFloat(c[1]),h=parseFloat(c[2]);a.add(f,e,h)}6<=d&&(f=parseFloat(c[3]),e=parseFloat(c[4]),h=parseFloat(c[5]),a.add(f,e,h));9<=d&&(d=parseFloat(c[6]),f=parseFloat(c[7]),c=parseFloat(c[8]),a.add(d,f,c))}else this.ya?1==d||isNaN(parseFloat(f))?this.ya=r:this.G.push(c.slice(1)):this.Ja&&("NORMALS"==f?this.ed=o:1==d||isNaN(parseFloat(f))?
this.ed=this.Ja=r:this.ed&&(3<=d&&(f=parseFloat(c[0]),e=parseFloat(c[1]),h=parseFloat(c[2]),b.add(f,e,h)),6<=d&&(f=parseFloat(c[3]),e=parseFloat(c[4]),h=parseFloat(c[5]),b.add(f,e,h)),9<=d&&(d=parseFloat(c[6]),f=parseFloat(c[7]),c=parseFloat(c[8]),b.add(d,f,c))))};A("X.parserVTK",Id);A("X.parserVTK.prototype.parse",Id.prototype.parse);function Jd(){Xc.call(this);this._className="parserFSM"}C(Jd,Xc);
Jd.prototype.parse=function(a,b){var c=a.k,d=a.o,f=new R,e;e=3;var h=0,i;do i=this.s(b,e++),h++;while(200>h&&10!=i);e++;var j=ad(this,b,e);e+=4;h=ad(this,b,e);e+=4;i=[];for(var p=0,p=0;p<j;p++){var k=Yc(this,b,e);e+=4;var m=Yc(this,b,e);e+=4;var l=Yc(this,b,e);e+=4;i[p]=0;f.add(k,m,l)}j=[];p=[];for(k=0;k<h;k++){var s=ad(this,b,e);e+=4;l=ad(this,b,e);e+=4;m=ad(this,b,e);e+=4;i[s]+=1;i[l]+=1;i[m]+=1;j.push([s,l,m]);p.push(new N(0,0,0))}for(k=0;k<h;k++){var s=j[k][0],l=j[k][1],m=j[k][2],v=f.get(s);e=
f.get(l);var u=f.get(m),v=new N(v[0],v[1],v[2]),u=new N(u[0],u[1],u[2]);e=(new N(e[0],e[1],e[2])).d().ka(v);v=u.d().ka(v);e=Uc(e,v).normalize();p[s]=p[s].add(e);p[l]=p[l].add(e);p[m]=p[m].add(e)}for(k=0;k<h;k++)s=j[k][0],l=j[k][1],m=j[k][2],v=f.get(s),e=f.get(l),u=f.get(m),c.add(v[0],v[1],v[2]),c.add(e[0],e[1],e[2]),c.add(u[0],u[1],u[2]),s=p[s].scale(1/i[s]).normalize(),l=p[l].scale(1/i[l]).normalize(),m=p[m].scale(1/i[m]).normalize(),d.add(s.x,s.y,s.b),d.add(l.x,l.y,l.b),d.add(m.x,m.y,m.b);a.rb(Ed);
c=new Pc;c.Ga=a;this.dispatchEvent(c)};A("X.parserFSM",Jd);A("X.parserFSM.prototype.parse",Jd.prototype.parse);function Kd(a){function b(){la+=8;return ma<ia.length?ia.charCodeAt(ma++)&255:-1}function c(){var a;la++;a=O&1;O>>=1;0==O&&(O=b(),a=O&1,O=O>>1|128);return a}function d(a){for(var b=0,d=a;d--;)b=b<<1|c();a&&(b=$[b]>>8-a);return b}function f(a){da++;K[L++]=a;s.push(String.fromCharCode(a));32768==L&&(L=0)}function e(){this.Na=this.Ma=0;this.Ec=q;this.De=-1}function h(){for(;;){if(Ab[pa]>=De)return-1;if(Ee[Ab[pa]]==pa)return Ab[pa]++;Ab[pa]++}}function i(){var a=Bb[Cb],b;v&&document.write("<br>len:"+
pa+" treepos:"+Cb);if(17==pa)return-1;Cb++;pa++;b=h();v&&document.write("<br>IsPat "+b);if(0<=b)a.Ma=b,v&&document.write("<br>b0 "+a.Ma);else if(a.Ma=32768,v&&document.write("<br>b0 "+a.Ma),i())return-1;b=h();if(0<=b)a.Na=b,v&&document.write("<br>b1 "+a.Na),a.Ec=q;else if(a.Na=32768,v&&document.write("<br>b1 "+a.Na),a.Ec=Bb[Cb],a.De=Cb,i())return-1;pa--;return 0}function j(a,b,c){v&&document.write("currentTree "+a+" numval "+b+" lengths "+c+" show 0");Bb=a;Cb=0;Ee=c;De=b;for(a=0;17>a;a++)Ab[a]=0;
pa=0;if(i())return v&&window.console.log("invalid huffman tree\n"),-1;if(v){document.write("<br>Tree: "+Bb.length);for(a=0;32>a;a++)document.write("Places["+a+"].b0="+Bb[a].Ma+"<br>"),document.write("Places["+a+"].b1="+Bb[a].Na+"<br>")}return 0}function p(a){for(var b,d,f=0,e=a[f];;)if(b=c(),v&&document.write("b="+b),b){if(!(e.Na&32768))return v&&document.write("ret1"),e.Na;e=e.Ec;b=a.length;for(d=0;d<b;d++)if(a[d]===e){f=d;break}}else{if(!(e.Ma&32768))return v&&document.write("ret2"),e.Ma;f++;e=
a[f]}}function k(){var a,h,i,l;do{a=c();h=d(2);switch(h){case 0:v&&window.console.log("Stored\n");break;case 1:v&&window.console.log("Fixed Huffman codes\n");break;case 2:v&&window.console.log("Dynamic Huffman codes\n");break;case 3:v&&window.console.log("Reserved block type!!\n");break;default:v&&window.console.log("Unexpected value %d!\n",h)}if(0==h){var m;O=1;m=b();m|=b()<<8;h=b();h|=b()<<8;for((m^~h)&65535&&document.write("BlockLen checksum mismatch\n");m--;)h=b(),f(h)}else if(1==h)for(var k;;)if(k=
$[d(7)]>>1,23<k?(k=k<<1|c(),199<k?(k-=128,k=k<<1|c()):(k-=48,143<k&&(k+=136))):k+=256,256>k)f(k);else if(256==k)break;else{k-=257;l=d(hb[k])+ea[k];k=$[d(5)]>>3;8<M[k]?(m=d(8),m|=d(M[k]-8)<<8):m=d(M[k]);m+=Ec[k];for(k=0;k<l;k++)h=K[L-m&32767],f(h)}else if(2==h){var s=Array(320);h=257+d(5);m=1+d(5);i=4+d(4);for(k=0;19>k;k++)s[k]=0;for(k=0;k<i;k++)s[Q[k]]=d(3);l=ra.length;for(i=0;i<l;i++)ra[i]=new e;if(j(ra,19,s)){L=0;return}if(v){document.write("<br>distanceTree");for(k=0;k<ra.length;k++)document.write("<br>"+
ra[k].Ma+" "+ra[k].Na+" "+ra[k].Ec+" "+ra[k].De)}l=h+m;i=0;var u=-1;for(v&&document.write("<br>n="+l+" bits: "+la+"<br>");i<l;)if(u++,k=p(ra),v&&document.write("<br>"+u+" i:"+i+" decode: "+k+" bits "+la+"<br>"),16>k)s[i++]=k;else if(16==k){var B;k=3+d(2);if(i+k>l){L=0;return}for(B=i?s[i-1]:0;k--;)s[i++]=B}else{k=17==k?3+d(3):11+d(7);if(i+k>l){L=0;return}for(;k--;)s[i++]=0}l=fc.length;for(i=0;i<l;i++)fc[i]=new e;if(j(fc,h,s)){L=0;return}l=fc.length;for(i=0;i<l;i++)ra[i]=new e;k=[];l=s.length;for(i=
h;i<l;i++)k[i-h]=s[i];if(j(ra,m,k)){L=0;return}for(v&&document.write("<br>literalTree");;)if(k=p(fc),256<=k){k-=256;if(0==k)break;k--;l=d(hb[k])+ea[k];k=p(ra);8<M[k]?(m=d(8),m|=d(M[k]-8)<<8):m=d(M[k]);for(m+=Ec[k];l--;)h=K[L-m&32767],f(h)}else f(k)}}while(!a);L=0;O=1}function m(){v&&window.console.log("NEXTFILE");s=[];var a=[];J=r;a[0]=b();a[1]=b();v&&window.console.log("type: "+a[0]+" "+a[1]);120==a[0]&&218==a[1]&&(v&&window.console.log("GEONExT-GZIP"),k(),v&&window.console.log(s.join("")),D[B]=
Array(2),D[B][0]=s.join(""),D[B][1]="geonext.gxt",B++);31==a[0]&&139==a[1]&&(v&&window.console.log("GZIP"),l(),v&&window.console.log(s.join("")),D[B]=Array(2),D[B][0]=s.join(""),D[B][1]="file",B++);if(80==a[0]&&75==a[1]&&(J=o,a[2]=b(),a[3]=b(),3==a[2]&&4==a[3])){a[0]=b();a[1]=b();v&&window.console.log("ZIP-Version: "+a[1]+" "+a[0]/10+"."+a[0]%10);u=b();u|=b()<<8;v&&window.console.log("gpflags: "+u);a=b();a|=b()<<8;v&&window.console.log("method: "+a);b();b();b();b();var c=b(),c=c|b()<<8,c=c|b()<<16,
c=c|b()<<24,d=b(),d=d|b()<<8,d=d|b()<<16,d=d|b()<<24,e=b(),e=e|b()<<8,e=e|b()<<16,e=e|b()<<24;v&&window.console.log("local CRC: "+c+"\nlocal Size: "+e+"\nlocal CompSize: "+d);c=b();c|=b()<<8;d=b();d|=b()<<8;v&&window.console.log("filelen "+c);e=0;for(sa=[];c--;){var f=b();"/"==f|":"==f?e=0:e<Db-1&&(sa[e++]=String.fromCharCode(f))}v&&window.console.log("nameBuf: "+sa);Fe||(Fe=sa);for(e=0;e<d;)b(),e++;da=0;8==a&&(k(),v&&window.console.log(s.join("")),D[B]=Array(2),D[B][0]=s.join(""),D[B][1]=sa.join(""),
B++);l()}}function l(){var a=[],c;u&8&&(a[0]=b(),a[1]=b(),a[2]=b(),a[3]=b(),80==a[0]&&75==a[1]&&7==a[2]&&8==a[3]&&(b(),b(),b(),b()),b(),b(),b(),b(),b(),b(),b(),b(),v&&window.console.log("CRC:"));J&&m();a[0]=b();if(8!=a[0])v&&window.console.log("Unknown compression method!");else{u=b();v&&u&-32&&window.console.log("Unknown flags set!");b();b();b();b();b();b();if(u&4){a[0]=b();a[2]=b();pa=a[0]+256*a[1];v&&window.console.log("Extra field size: "+pa);for(a=0;a<pa;a++)b()}if(u&8){a=0;for(sa=[];c=b();){if("7"==
c||":"==c)a=0;a<Db-1&&(sa[a++]=c)}v&&window.console.log("original file name: "+sa)}if(u&16)for(;b(););u&2&&(b(),b());k();b();b();b();b();b();b();b();b();J&&m()}}var s=[],v=r,u,B=0,D=[],K=Array(32768),L=0,J=r,da,$=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,
138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,
123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],ea=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],hb=[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,99,99],Ec=[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],M=[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],Q=[16,17,18,0,8,7,9,6,10,
5,11,4,12,3,13,2,14,1,15],ia=a,ma=0,O=1,la=0,Db=256,sa=[],Fe,fc=Array(288),ra=Array(32),Cb=0,Bb=q,pa=0,Ab=Array(17);Ab[0]=0;var Ee,De;Kd.prototype.$g=function(){v&&window.console.log(ia);m();return D}};function Ld(){Xc.call(this);this._className="parserNRRD"}C(Ld,Xc);
Ld.prototype.parse=function(a,b){var c=0,d=b.match(/^([\s\S]*?)\r?\n\r?\n/),c=d[0].length,f,e,h,i,j,p,d=d[1].split(/\r?\n/);for(j=0,p=d.length;j<p;j++)if(f=d[j],f.match(/NRRD\d+/))this.Wf=o;else if(!f.match(/^#/)&&(i=f.match(/(.*):(.*)/)))e=i[1].trim(),f=i[2].trim(),(h=this.Kf[e])?h.call(this,f):this[e]=f;this.Wf||g(Error("Not an NRRD file"));"raw"!==this.encoding&&"gzip"!==this.encoding&&"gz"!==this.encoding&&g(Error("Only raw or gz/gzip encoding is allowed"));if(!this.V&&(this.V=[new N(1,0,0),new N(0,
1,0),new N(0,0,1)],this.Od)){d=[];for(i=0;2>=i;i++)d.push(!isNaN(this.Od[i])?this.V[i].scale(this.Od[i]):n)}i=0;i="gzip"==this.encoding||"gz"==this.encoding?(new Kd(b.substr(c))).$g()[0][0]:b.substr(c);j=this.ab[0]*this.ab[1]*this.ab[2];c=Array(j);d=-Infinity;p=Infinity;for(f=0;f<j;f++)e=this.Jc(i,0+f*this.Ic),c[f]=e,d=Math.max(d,e),p=Math.min(p,e);a.ea=[this.ab[0],this.ab[1],this.ab[2]];a.H=[(new N(this.V[0][0],this.V[0][1],this.V[0][2])).Ya(),(new N(this.V[1][0],this.V[1][1],this.V[1][2])).Ya(),
(new N(this.V[2][0],this.V[2][1],this.V[2][2])).Ya()];a.Hb=[p,d];a.ef(p,d);a.pa();j=this.ab;f=d;i=j[2];d=j[1];j=j[0];e=d*j;p=Array(i);for(h=0;h<i;h++){p[h]=Array(d);for(var k=0;k<d;k++)p[h][k]=new Uint8Array(j)}for(k=k=0;k<i;k++){h=c.slice(k*e,(k+1)*e);for(var m=new Uint8Array(4*e),l=0,s=0,v=0,l=0;l<d;l++)for(s=0;s<j;s++){var u=h[v],u=255*(u/f),B=4*v;m[B]=u;m[++B]=u;m[++B]=u;m[++B]=255;p[k][l][s]=u;v++}l=h=new Dd;l.Gb=m;l.c=o;m=h;m.pc=j;m.c=o;m=h;m.oc=d;m.c=o;a.ce.children()[k].Pc(h)}for(l=0;l<d;l++){m=
new Uint8Array(4*i*j);for(k=v=0;k<i;k++)for(s=0;s<j;s++)u=p[k][l][s],B=4*v,m[B]=u,m[++B]=u,m[++B]=u,m[++B]=255,v++;c=h=new Dd;c.Gb=m;c.c=o;c=h;c.pc=j;c.c=o;c=h;c.oc=i;c.c=o;a.be.children()[l].Pc(h)}for(s=0;s<j;s++){m=new Uint8Array(4*i*d);for(k=v=0;k<i;k++)for(l=0;l<d;l++)u=p[k][l][s],B=4*v,m[B]=u,m[++B]=u,m[++B]=u,m[++B]=255,v++;c=h=new Dd;c.Gb=m;c.c=o;c=h;c.pc=d;c.c=o;c=h;c.oc=i;c.c=o;a.ae.children()[s].Pc(h)}c=new Pc;c.Ga=a;this.dispatchEvent(c)};
Ld.prototype.Kf={type:function(a){switch(a){case "unsigned char":case "uint8":this.Jc=this.s;this.Ic=1;break;case "signed char":case "int8":this.Jc=this.ug;this.Ic=1;break;case "short":case "signed short":case "unsigned short":case "short int":case "int16":this.Jc=this.Kc;this.Ic=2;break;case "int":case "int32":break;case "float":this.Jc=this.bc;this.Ic=4;break;default:g(Error("Only short/int/int8/float data is allowed. Found "+a))}return this.type=a},endian:function(a){return a},encoding:function(a){return this.encoding=
a},dimension:function(a){return parseInt(a,10)},sizes:function(a){var b,c,d,f;d=a.split(/\s+/);f=[];for(b=0,c=d.length;b<c;b++)a=d[b],f.push(parseInt(a,10));return this.ab=f},"space directions":function(a){var b,c,d;c=a.match(/\(.*?\)/g);return this.V=function(){var a,e,h;h=[];for(a=0,e=c.length;a<e;a++)d=c[a],h.push(function(){var a,c,e,f;e=d.slice(1,-1).split(/,/);f=[];for(a=0,c=e.length;a<c;a++)b=e[a],f.push(parseFloat(b));return f}());return h}()},spacings:function(a){var b;b=a.split(/\s+/);var c,
d,f;f=[];for(c=0,d=b.length;c<d;c++)a=b[c],f.push(parseFloat(a));return this.Od=f}};A("X.parserNRRD",Ld);A("X.parserNRRD.prototype.parse",Ld.prototype.parse);function Md(){P.call(this);this._className="loader";this.xb=q;this.Fb=0}C(Md,P);function Nd(a){x(a.xb)||(a.xb=new Ib);return a.xb}function Od(a){return!x(a.xb)?o:!a.xb.qd(r)}Md.prototype.Yf=function(a){Pd(this,1.7);setTimeout(function(){Wc(a.S.file());a.$b();Nd(this).set(a.id(),o)}.bind(this),100)};function Pd(a,b){a.Fb+=b/Nd(a).$()/3;1<a.Fb&&(a.Fb=1);var c=new Qc;c.de=a.Fb;a.dispatchEvent(c)}Md.prototype.Fe=function(){g(Error("Could not get the file."))};
Md.prototype.Xf=function(a,b){Pd(this,1);setTimeout(function(){var c=b.file().path().split(".").pop().toLowerCase();"stl"==c?(c=new dd,nc(c,tc,this.ac.bind(this)),c.parse(b,a.response)):"vtk"==c?(c=new Id,nc(c,tc,this.ac.bind(this)),c.parse(b,a.response)):"trk"==c?(c=new bd,nc(c,tc,this.ac.bind(this)),c.parse(b,a.response)):"fsm"==c?(c=new Jd,nc(c,tc,this.ac.bind(this)),c.parse(b,a.response)):"nrrd"==c&&(c=new Ld,nc(c,tc,this.ac.bind(this)),c.parse(b,a.response))}.bind(this),100)};
Md.prototype.ac=function(a){Pd(this,1);setTimeout(function(){var b=a.Ga;Wc(b.file());b.$b();Nd(this).set(b.id(),o)}.bind(this),100)};function Qd(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}Qd.prototype.d=function(){return new Qd(this.top,this.right,this.bottom,this.left)};Qd.prototype.toString=function(){return"("+this.top+"t, "+this.right+"r, "+this.bottom+"b, "+this.left+"l)"};Qd.prototype.contains=function(a){return!this||!a?r:a instanceof Qd?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};function Rd(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}w=Rd.prototype;w.d=function(){return new Rd(this.left,this.top,this.width,this.height)};w.toString=function(){return"("+this.left+", "+this.top+" - "+this.width+"w x "+this.height+"h)"};
w.Be=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,o}return r};w.contains=function(a){return a instanceof Rd?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};
w.K=function(){return new pd(this.width,this.height)};var Sd;function Td(a,b){var c;c=(c=a.className)&&"function"==typeof c.split?c.split(/\s+/):[];var d=wb(arguments,1),f;f=c;for(var e=0,h=0;h<d.length;h++)0<=ob(f,d[h])||(f.push(d[h]),e++);f=e==d.length;a.className=c.join(" ");return f};var Ud=!E||gb(9);!Sa&&!E||E&&gb(9)||Sa&&eb("1.9.1");E&&eb("9");function Vd(a){return a?new Wd(Xd(a)):Sd||(Sd=new Wd)}function Yd(a){return y(a)?document.getElementById(a):a}function Zd(a,b){ib(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in $d?a.setAttribute($d[d],b):0==d.lastIndexOf("aria-",0)?a.setAttribute(d,b):a[d]=b})}
var $d={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"};function ae(a,b,c){return be(document,arguments)}
function be(a,b){var c=b[0],d=b[1];if(!Ud&&d&&(d.name||d.type)){c=["<",c];d.name&&c.push(' name="',Aa(d.name),'"');if(d.type){c.push(' type="',Aa(d.type),'"');var f={};mb(f,d);d=f;delete d.type}c.push(">");c=c.join("")}c=a.createElement(c);d&&(y(d)?c.className=d:ja(d)?Td.apply(q,[c].concat(d)):Zd(c,d));2<b.length&&ce(a,c,b);return c}
function ce(a,b,c){function d(c){c&&b.appendChild(y(c)?a.createTextNode(c):c)}for(var f=2;f<c.length;f++){var e=c[f];ka(e)&&!(oa(e)&&0<e.nodeType)?pb(de(e)?vb(e):e,d):d(e)}}function ee(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function fe(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}
function ge(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 Xd(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function de(a){if(a&&"number"==typeof a.length){if(oa(a))return"function"==typeof a.item||"string"==typeof a.item;if(na(a))return"function"==typeof a.item}return r}function Wd(a){this.u=a||ca.document||document}w=Wd.prototype;
w.zc=Vd;w.e=function(a){return y(a)?this.u.getElementById(a):a};w.kb=function(a,b,c){return be(this.u,arguments)};w.createElement=function(a){return this.u.createElement(a)};w.createTextNode=function(a){return this.u.createTextNode(a)};function he(a){return"CSS1Compat"==a.u.compatMode}function ie(a){var b=a.u,a=!F&&"CSS1Compat"==b.compatMode?b.documentElement:b.body,b=b.parentWindow||b.defaultView;return new V(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}w.appendChild=function(a,b){a.appendChild(b)};
w.contains=ge;function je(a,b){var c=Xd(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,q))?c[b]||c.getPropertyValue(b):""}function ke(a,b){return a.currentStyle?a.currentStyle[b]:q}function le(a,b){return je(a,b)||ke(a,b)||a.style&&a.style[b]}function me(a){a=a?9==a.nodeType?a:Xd(a):document;return E&&!gb(9)&&!he(Vd(a))?a.body:a.documentElement}
function ne(a){var b=a.getBoundingClientRect();E&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function oe(a){if(E&&!gb(8))return a.offsetParent;for(var b=Xd(a),c=le(a,"position"),d="fixed"==c||"absolute"==c,a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=le(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 q}
function pe(a){for(var b=new Qd(0,Infinity,Infinity,0),c=Vd(a),d=c.u.body,f=c.u.documentElement,e=!F&&"CSS1Compat"==c.u.compatMode?c.u.documentElement:c.u.body;a=oe(a);)if((!E||0!=a.clientWidth)&&(!F||0!=a.clientHeight||a!=d)&&a!=d&&a!=f&&"visible"!=le(a,"overflow")){var h=qe(a),i;i=a;if(Sa&&!eb("1.9")){var j=parseFloat(je(i,"borderLeftWidth"));if(re(i))var p=i.offsetWidth-i.clientWidth-j-parseFloat(je(i,"borderRightWidth")),j=j+p;i=new V(j,parseFloat(je(i,"borderTopWidth")))}else i=new V(i.clientLeft,
i.clientTop);h.x+=i.x;h.y+=i.y;b.top=Math.max(b.top,h.y);b.right=Math.min(b.right,h.x+a.clientWidth);b.bottom=Math.min(b.bottom,h.y+a.clientHeight);b.left=Math.max(b.left,h.x)}d=e.scrollLeft;e=e.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,e);c=c.u.parentWindow||c.u.defaultView||window;f=c.document;F&&!eb("500")&&!Ta?("undefined"==typeof c.innerHeight&&(c=window),f=c.innerHeight,a=c.document.documentElement.scrollHeight,c==c.top&&a<f&&(f-=15),c=new pd(c.innerWidth,f)):(c="CSS1Compat"==
f.compatMode?f.documentElement:f.body,c=new pd(c.clientWidth,c.clientHeight));b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,e+c.height);return 0<=b.top&&0<=b.left&&b.bottom>b.top&&b.right>b.left?b:q}
function qe(a){var b,c=Xd(a),d=le(a,"position"),f=Sa&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),e=new V(0,0),h=me(c);if(a==h)return e;if(a.getBoundingClientRect)b=ne(a),a=ie(Vd(c)),e.x=b.left+a.x,e.y=b.top+a.y;else if(c.getBoxObjectFor&&!f)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(h),e.x=b.screenX-a.screenX,e.y=b.screenY-a.screenY;else{b=a;do{e.x+=b.offsetLeft;e.y+=b.offsetTop;b!=a&&(e.x+=b.clientLeft||0,e.y+=b.clientTop||0);
if(F&&"fixed"==le(b,"position")){e.x+=c.body.scrollLeft;e.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(Ra||F&&"absolute"==d)e.y-=c.body.offsetTop;for(b=a;(b=oe(b))&&b!=c.body&&b!=h;)if(e.x-=b.scrollLeft,!Ra||"TR"!=b.tagName)e.y-=b.scrollTop}return e}function se(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}
function te(a){if("none"!=le(a,"display"))return ue(a);var b=a.style,c=b.display,d=b.visibility,f=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=ue(a);b.display=c;b.position=f;b.visibility=d;return a}function ue(a){var b=a.offsetWidth,c=a.offsetHeight,d=F&&!b&&!c;return(!ha(b)||d)&&a.getBoundingClientRect?(a=ne(a),new pd(a.right-a.left,a.bottom-a.top)):new pd(b,c)}function ve(a,b){a.style.display=b?"":"none"}function re(a){return"rtl"==le(a,"direction")}
function we(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 f=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return f}var xe={thin:2,medium:4,thick:6};function ye(a,b){if("none"==ke(a,b+"Style"))return 0;var c=ke(a,b+"Width");return c in xe?xe[c]:we(a,c)};function ze(a){this.ba=a;this.n=[]}C(ze,Pb);var Ae=[];function Be(a,b,c,d,f){ja(c)||(Ae[0]=c,c=Ae);for(var e=0;e<c.length;e++)a.n.push(G(b,c[e],d||a,f||r,a.ba||a))}ze.prototype.Lc=function(){pb(this.n,pc);this.n.length=0};ze.prototype.t=function(){ze.C.t.call(this);this.Lc()};ze.prototype.handleEvent=function(){g(Error("EventHandler.handleEvent not implemented"))};function Ce(){}(function(a){a.re=function(){return a.Tf||(a.Tf=new a)}})(Ce);Ce.prototype.Fd=0;Ce.re();function Ge(a){this.ga=a||Vd()}C(Ge,Vc);w=Ge.prototype;w.Sf=Ce.re();w.ye=q;w.Xa=r;w.h=q;w.nb=q;w.jb=q;w.Ob=q;w.eh=r;w.e=t("h");w.Md=function(a){this.nb&&this.nb!=a&&g(Error("Method not supported"));Ge.C.Md.call(this,a)};w.zc=t("ga");w.kb=function(){this.h=this.ga.createElement("div")};w.cc=function(a){this.qb(a)};w.qb=function(a,b){this.Xa&&g(Error("Component already rendered"));this.h||this.kb();a?a.insertBefore(this.h,b||q):this.ga.u.body.appendChild(this.h);(!this.nb||this.nb.Xa)&&this.yc()};
w.yc=function(){this.Xa=o;He(this,function(a){!a.Xa&&a.e()&&a.yc()})};w.Rb=function(){He(this,function(a){a.Xa&&a.Rb()});this.Bc&&this.Bc.Lc();this.Xa=r};w.t=function(){Ge.C.t.call(this);this.Xa&&this.Rb();this.Bc&&(this.Bc.Z(),delete this.Bc);He(this,function(a){a.Z()});!this.eh&&this.h&&ee(this.h);this.nb=this.h=this.Ob=this.jb=q};w.Wb=function(){return!!this.jb&&0!=this.jb.length};function He(a,b){a.jb&&pb(a.jb,b,n)}
w.removeChild=function(a,b){if(a){var c=y(a)?a:a.ye||(a.ye=":"+(a.Sf.Fd++).toString(36)),a=this.Ob&&c?(c in this.Ob?this.Ob[c]:n)||q:q;if(c&&a){var d=this.Ob;c in d&&delete d[c];tb(this.jb,a);b&&(a.Rb(),a.h&&ee(a.h));c=a;c==q&&g(Error("Unable to set parent component"));c.nb=q;Ge.C.Md.call(c,q)}}a||g(Error("Child is not in parent component"));return a};function Ie(){}C(Ie,Vc);w=Ie.prototype;w.Qd=0;w.Zb=0;w.Ed=100;w.qe=0;w.Pd=1;w.Vf=r;w.ag=r;w.Qc=function(a){a=Je(this,a);this.Qd!=a&&(this.Qd=a+this.qe>this.Ed?this.Ed-this.qe:a<this.Zb?this.Zb:a,!this.Vf&&!this.ag&&this.dispatchEvent("change"))};w.Ac=function(){return Je(this,this.Qd)};w.Vb=function(){return Je(this,this.Zb)};w.Ub=function(){return Je(this,this.Ed)};function Je(a,b){return a.Pd==q?b:a.Zb+Math.round((b-a.Zb)/a.Pd)*a.Pd};function Ke(a){this.ga=a||Vd();this.ob=new Ie;G(this.ob,"change",this.Pf,r,this)}C(Ke,Ge);var Le={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};w=Ke.prototype;w.kb=function(){this.da=this.zc().kb("div","progress-bar-thumb");var a=Le[this.Qe];this.h=this.zc().kb("div",a,this.da);Me(this);this.e().setAttribute("aria-valuemin",this.Vb());this.e().setAttribute("aria-valuemax",this.Ub())};
w.yc=function(){Ke.C.yc.call(this);E&&7>Xa&&G(this.e(),"resize",this.Sc,r,this);this.Sc();var a=this.e();a.setAttribute("role","progressbar");a.Dh="progressbar";this.e().setAttribute("aria-live","polite")};w.Rb=function(){Ke.C.Rb.call(this);Ne(this)};function Ne(a){E&&7>Xa&&oc(a.e(),"resize",a.Sc,r,a)}w.Ac=function(){return this.ob.Ac()};w.Qc=function(a){this.ob.Qc(a);this.e()&&Me(this)};function Me(a){var b=a.Ac();a.e().setAttribute("aria-valuenow",b)}w.Vb=function(){return this.ob.Vb()};w.Ub=function(){return this.ob.Ub()};
w.Qe="horizontal";w.Pf=function(){this.Sc();this.dispatchEvent("change")};w.Sc=function(){if(this.da){var a=this.Vb(),b=this.Ub(),a=(this.Ac()-a)/(b-a),b=Math.round(100*a);"vertical"==this.Qe?E&&7>Xa?(this.da.style.top=0,this.da.style.height="100%",b=this.da.offsetHeight,a=Math.round(a*b),this.da.style.top=b-a+"px",this.da.style.height=a+"px"):(this.da.style.top=100-b+"%",this.da.style.height=b+"%"):this.da.style.width=b+"%"}};w.t=function(){Ne(this);Ke.C.t.call(this);this.da=q;this.ob.Z()};function Oe(a,b){x(a)||g(Error("No valid parent element."));x(b)||g(Error("Invalid initial value."));Ke.call(this);this._className="progressbar";this.Ia=a;this.lc=this.oa=q;this.Oa=[];this.Oa=[".progress-bar-horizontal {\n position: relative;\n border: 1px solid #949dad;\n background: white;\n padding: 1px;\n overflow: hidden;\n margin: 2px;\n width: 100px;\n height: 5px;\n}",".progress-bar-thumb {\n position: relative;\n background: #F62217;\n overflow: hidden;\n width: 0%;\n height: 100%;\n}",
".progress-bar-thumb-done {\n background: #57E964;\n}"];this.Qc(b);this.Ad()}C(Oe,Ke);
Oe.prototype.Ad=function(){this.Ia.style.position="relative";var a=document.getElementsByTagName("head")[0],b=ae("style");b.type="text/css";b.media="screen";var c=document.createTextNode(this.Oa[0]),d=document.createTextNode(this.Oa[1]),f=document.createTextNode(this.Oa[2]);a.appendChild(b);b.appendChild(c);b.appendChild(d);b.appendChild(f);this.oa=b;this.cc(this.Ia);a=this.e();a.style.position="absolute";a.style.top=(this.Ia.clientHeight-5)/2;a.style.left=(this.Ia.clientWidth-100)/2};
function Pe(a){var b=a.e().style.top,c=a.e().style.left;ee(a.e());var d=new Oe(a.Ia,100),f=d.e();f.style.position="absolute";f.style.top=b;f.style.left=c;(f.firstElementChild!=n?f.firstElementChild:fe(f.firstChild)).classList.add("progress-bar-thumb-done");a.lc=d}Oe.prototype.Bd=function(){this.oa&&ee(this.oa);this.e()&&ee(this.e());this.lc&&ee(this.lc.e());this.lc=this.oa=q};function Qe(a,b,c,d,f){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));(!x(b)||!(b instanceof Array)||3!=b.length)&&g(Error("Invalid front direction."));(!x(c)||!(c instanceof Array)||3!=c.length)&&g(Error("Invalid up direction."));z(d)||g(Error("Invalid width."));z(f)||g(Error("Invalid height."));I.call(this);this._className="slice";this.j=a;this.Uc=b;this.Ta=c;this.Nb=d;this.fb=f;this.Sa=[0,1,0,0,1,1,1,1,1,0,0,0];this.Lb=q;this.pa()}C(Qe,I);
Qe.prototype.pa=function(){this.k.clear();var a=new N(this.Uc[0],this.Uc[1],this.Uc[2]),b=new N(this.Ta[0],this.Ta[1],this.Ta[2]),c=Uc(b,a),d=new N(this.j[0],this.j[1],this.j[2]),f=new N(1,1,1);1==a.x?(f=new N(this.j[0],this.fb/2,this.Nb/2),this.Sa=[0,0,1,0,0,1,0,1,1,1,1,0]):1==a.y?(f=new N(this.Nb/2,this.j[1],this.fb/2),this.Sa=[0,0,0,1,1,0,1,0,1,1,0,1]):1==a.b&&(f=new N(this.Nb/2,this.fb/2,this.j[2]));var e=Tc(c.d().B(),b.d().B()),e=new N(e.x*f.x,e.y*f.y,e.b*f.b);e.add(d);var h=Tc(c.d().B(),b),
h=new N(h.x*f.x,h.y*f.y,h.b*f.b);h.add(d);var i=Tc(c,b.d().B()),i=new N(i.x*f.x,i.y*f.y,i.b*f.b);i.add(d);var j=i,b=Tc(c,b),b=new N(b.x*f.x,b.y*f.y,b.b*f.b);b.add(d);d=h;this.k.add(e.x,e.y,e.b);this.k.add(h.x,h.y,h.b);this.k.add(i.x,i.y,i.b);this.k.add(j.x,j.y,j.b);this.k.add(b.x,b.y,b.b);this.k.add(d.x,d.y,d.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b)};A("X.slice",Qe);function Re(){P.call(this);this._className="shader";this.sc="";this.sc="precision mediump float;\n\nattribute vec3 vertexPosition;\nattribute vec3 vertexNormal;\nattribute vec3 vertexColor;\nattribute vec2 vertexTexturePos;\n\nuniform mat4 view;\nuniform mat4 perspective;\nuniform vec3 center;\nuniform mat4 objectTransform;\nuniform bool useObjectColor;\nuniform vec3 objectColor;\nuniform float pointSize;\n\nvarying vec4 fVertexPosition;\nvarying vec3 fragmentColor;\nvarying vec2 fragmentTexturePos;\nvarying vec3 fTransformedVertexNormal;\n\nvoid main(void) {\n fTransformedVertexNormal = mat3(view[0].xyz,view[1].xyz,view[2].xyz) * mat3(objectTransform[0].xyz,objectTransform[1].xyz,objectTransform[2].xyz) * vertexNormal;\n vec3 vertexPosition2 = vertexPosition - center;\n fVertexPosition = view * objectTransform * vec4(vertexPosition2, 1.0);\n fragmentTexturePos = vertexTexturePos;\n if (useObjectColor) {\n fragmentColor = objectColor;\n } else {\n fragmentColor = vertexColor;\n }\n gl_PointSize = pointSize;\n gl_Position = perspective * fVertexPosition;\n}\n";
this.mc="";this.mc="precision mediump float;\n\nuniform bool usePicking;\nuniform bool useTexture;\nuniform sampler2D textureSampler;\nuniform float objectOpacity;\nuniform float volumeLowerThreshold;\nuniform float volumeUpperThreshold;\nuniform float volumeScalarMin;\nuniform float volumeScalarMax;\n\nvarying vec4 fVertexPosition;\nvarying vec3 fragmentColor;\nvarying vec2 fragmentTexturePos;\nvarying vec3 fTransformedVertexNormal;\n\nvoid main(void) {\n if (usePicking) {\n gl_FragColor = vec4(fragmentColor, 1.0);\n } else if (useTexture) {\n gl_FragColor = texture2D(textureSampler, vec2(fragmentTexturePos.s,fragmentTexturePos.t));\n float _volumeLowerThreshold = (volumeLowerThreshold / volumeScalarMax);\n float _volumeUpperThreshold = (volumeUpperThreshold / volumeScalarMax);\n if (gl_FragColor.r < _volumeLowerThreshold ||\n gl_FragColor.r > _volumeUpperThreshold) {\n discard;\n };\n gl_FragColor.a = objectOpacity;\n } else {\n vec3 nNormal = normalize(fTransformedVertexNormal);\n vec3 light = vec3(0.0, 0.0, 1.0);\n vec3 lightDirection = vec3(0,0,-10);\n lightDirection = normalize(lightDirection);\n vec3 eyeDirection = normalize(-fVertexPosition.xyz);\n vec3 reflectionDirection = reflect(-lightDirection, nNormal);\n float specular = pow(max(dot(reflectionDirection, eyeDirection), 0.0), 10.0);\n float diffuse = 0.8 * max(dot(nNormal, light), 0.0);\n float ambient = 0.3;\n gl_FragColor = vec4(fragmentColor * ambient +\n fragmentColor * diffuse +\n vec3(0.2, 0.2, 0.2) * specular,\n objectOpacity);\n }\n}\n"}
C(Re,P);var Se={sh:"vertexPosition",rh:"vertexNormal",qh:"vertexColor",th:"vertexTexturePos"},Te={uh:"view",kh:"perspective",fh:"center",jh:"objectTransform",nh:"useObjectColor",hh:"objectColor",lh:"pointSize",ih:"objectOpacity",gh:"normal",oh:"usePicking",ph:"useTexture",mh:"textureSampler",vh:"volumeLowerThreshold",yh:"volumeUpperThreshold",xh:"volumeScalarMin",wh:"volumeScalarMax"};
function Ue(a){var b=Object.keys(Te);Object.keys(Se).every(function(a){a=eval("X.shaders.attributes."+a);return-1!=this.sc.search(a)||-1!=this.mc.search(a)}.bind(a))||g(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=eval("X.shaders.uniforms."+a);return-1!=this.sc.search(a)||-1!=this.mc.search(a)}.bind(a))||g(Error("Could not find all uniforms in the shader sources."))}A("X.shaders.attributes",Se);A("X.shaders.uniforms",Te);function Ve(){I.call(this);this._className="volume";this.j=[0,0,0];this.ea=[10,10,10];this.H=[1,1,1];this.Yc=this._indexZ=this.Xc=this._indexY=this.Wc=this._indexX=0;this.ae=new I;this.be=new I;this.ce=new I;this._lowerThreshold=0;this._upperThreshold=1E3;this.Hb=[0,1E3];this.ee=this._volumeRendering=r;this.Mb=0}C(Ve,I);w=Ve.prototype;
w.pa=function(){this.children().length=0;this.children().push(this.ae);this.children().push(this.be);this.children().push(this.ce);for(var a=0,a=0;3>a;a++){for(var b=(this.ea[a]-1)/2,c=b,d=0,d=0;d<this.ea[a];d++){var f=-b*this.H[a]+d*this.H[a],e=[[this.j[0]+f,this.j[1],this.j[2]],[this.j[0],this.j[1]+f,this.j[2]],[this.j[0],this.j[1],this.j[2]+f]],f=this.children()[a].children(),h=0,i=0;0==a?(h=this.ea[2]*this.H[2]-this.H[2],i=this.ea[1]*this.H[1]-this.H[1]):1==a?(h=this.ea[0]*this.H[0]-this.H[0],
i=this.ea[2]*this.H[2]-this.H[2]):2==a&&(h=this.ea[0]*this.H[0]-this.H[0],i=this.ea[1]*this.H[1]-this.H[1]);e=new Qe(e[a],[[1,0,0],[0,1,0],[0,0,1]][a],[[0,1,0],[0,0,-1],[0,1,0]][a],h,i);e.Lb=this;e.p(d==c);f.push(e)}0==a?this.Wc=this._indexX=c:1==a?this.Xc=this._indexY=c:2==a&&(this.Yc=this._indexZ=c)}this.c=o};
w.$b=function(){this._volumeRendering!=this.ee&&(this.c=o,this.ee=this._volumeRendering);if(this._volumeRendering)We(this,this.Mb);else{if(this.c){var a=this.children()[this.Mb];a.p(r)}for(var b=0,b=0;3>b;b++){var a=this.children()[b],c=0,d=0;0==b?(c=this._indexX,d=this.Wc,this.Wc=this._indexX):1==b?(c=this._indexY,d=this.Xc,this.Xc=this._indexY):2==b&&(c=this._indexZ,d=this.Yc,this.Yc=this._indexZ);a.children()[parseInt(d,10)].p(r);a.children()[parseInt(c,10)].p(o)}}Ve.C.$b.call(this)};w.Hf=t("ea");
w.Cg=t("Hb");w.ef=function(a,b){(!x(a)||!z(a)||!x(b)||!z(b)||a>b||a<this.Hb[0]||b>this.Hb[1])&&g(Error("Invalid threshold range."));this._lowerThreshold=a;this._upperThreshold=b};w.Og=aa();w.p=ba("_visible");w.Fg=function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));this.j=a};
function We(a,b){if(!(!a.c&&!a._volumeRendering||!a.c&&b==a.Mb)){a.children()[0].children()[parseInt(a._indexX,10)].p(r);a.children()[1].children()[parseInt(a._indexY,10)].p(r);a.children()[2].children()[parseInt(a._indexZ,10)].p(r);var c=a.children()[a.Mb];c.p(r);c=a.children()[b];c.p(o);a.Mb=b}}A("X.volume",Ve);A("X.volume.prototype.dimensions",Ve.prototype.Hf);A("X.volume.prototype.scalarRange",Ve.prototype.Cg);A("X.volume.prototype.setVisible",Ve.prototype.p);
A("X.volume.prototype.setCenter",Ve.prototype.Fg);A("X.volume.prototype.setVolumeRendering",Ve.prototype.Og);A("X.volume.prototype.threshold",Ve.prototype.ef);A("X.volume.prototype.modified",Ve.prototype.$b);function Xe(a){this.Ua=a||Ye}function Ye(a,b){return""+a<""+b?-1:""+a>""+b?1:0}w=Xe.prototype;w.N=q;w.Ua=q;w.ta=q;w.sa=q;w.g=0;
w.add=function(a){if(this.N==q)return this.sa=this.ta=this.N=new Ze(a),this.g=1,o;var b=r;$e(this,function(c){var d=q;if(0<this.Ua(c.value,a)){if(d=c.left,c.left==q){var f=new Ze(a,c);c.left=f;c==this.ta&&(this.ta=f);b=o;af(this,c)}}else 0>this.Ua(c.value,a)&&(d=c.right,c.right==q&&(f=new Ze(a,c),c.right=f,c==this.sa&&(this.sa=f),b=o,af(this,c)));return d});b&&(this.g+=1);return b};
w.remove=function(a){var b=q;$e(this,function(c){var d=q;if(0<this.Ua(c.value,a))d=c.left;else if(0>this.Ua(c.value,a))d=c.right;else if(b=c.value,c.left!=q||c.right!=q){var f=q,e;if(c.left!=q){e=bf(this,c.left);if(e!=c.left){if(e.parent.right=e.left)e.left.parent=e.parent;e.left=c.left;e.left.parent=e;f=e.parent}e.parent=c.parent;e.right=c.right;e.right&&(e.right.parent=e);c==this.sa&&(this.sa=e)}else{e=cf(this,c.right);if(e!=c.right){if(e.parent.left=e.right)e.right.parent=e.parent;e.right=c.right;
e.right.parent=e;f=e.parent}e.parent=c.parent;e.left=c.left;e.left&&(e.left.parent=e);c==this.ta&&(this.ta=e)}df(c)?c.parent.left=e:ef(c)?c.parent.right=e:this.N=e;af(this,f?f:e)}else df(c)?(c.parent.left=q,c==this.ta&&(this.ta=c.parent),af(this,c.parent)):ef(c)?(c.parent.right=q,c==this.sa&&(this.sa=c.parent),af(this,c.parent)):this.clear();return d});b&&(this.g=this.N?this.g-1:0);return b};w.clear=function(){this.sa=this.ta=this.N=q;this.g=0};
w.contains=function(a){var b=r;$e(this,function(c){var d=q;0<this.Ua(c.value,a)?d=c.left:0>this.Ua(c.value,a)?d=c.right:b=o;return d});return b};w.$=t("g");w.Vb=function(){return cf(this).value};w.Ub=function(){return bf(this).value};w.aa=function(){var a=[];ff(this,function(b){a.push(b)});return a};
function ff(a,b){if(a.N){var c,d=c=cf(a);for(c=c.left?c.left:c;d!=q;)if(d.left!=q&&d.left!=c&&d.right!=c)d=d.left;else{if(d.right!=c&&b(d.value))break;var f=d,d=d.right!=q&&d.right!=c?d.right:d.parent;c=f}}}function $e(a,b,c){for(c=c?c:a.N;c&&c!=q;)c=b.call(a,c)}
function af(a,b){$e(a,function(a){var b=a.left?a.left.height:0,f=a.right?a.right.height:0;1<b-f?(a.left.right&&(!a.left.left||a.left.left.height<a.left.right.height)&&gf(this,a.left),hf(this,a)):1<f-b&&(a.right.left&&(!a.right.right||a.right.right.height<a.right.left.height)&&hf(this,a.right),gf(this,a));b=a.left?a.left.height:0;f=a.right?a.right.height:0;a.height=Math.max(b,f)+1;return a.parent},b)}
function gf(a,b){df(b)?(b.parent.left=b.right,b.right.parent=b.parent):ef(b)?(b.parent.right=b.right,b.right.parent=b.parent):(a.N=b.right,a.N.parent=q);var c=b.right;b.right=b.right.left;b.right!=q&&(b.right.parent=b);c.left=b;b.parent=c}function hf(a,b){df(b)?(b.parent.left=b.left,b.left.parent=b.parent):ef(b)?(b.parent.right=b.left,b.left.parent=b.parent):(a.N=b.left,a.N.parent=q);var c=b.left;b.left=b.left.right;b.left!=q&&(b.left.parent=b);c.right=b;b.parent=c}
function cf(a,b){if(!b)return a.ta;var c=b;$e(a,function(a){var b=q;a.left&&(b=c=a.left);return b},b);return c}function bf(a,b){if(!b)return a.sa;var c=b;$e(a,function(a){var b=q;a.right&&(b=c=a.right);return b},b);return c}function Ze(a,b){this.value=a;this.parent=b?b:q}Ze.prototype.left=q;Ze.prototype.right=q;Ze.prototype.height=1;function ef(a){return!!a.parent&&a.parent.right==a}function df(a){return!!a.parent&&a.parent.left==a};function jf(a,b,c){x(a)||g(Error("Invalid GL Buffer."));x(b)||g(Error("Invalid number of items."));x(c)||g(Error("Invalid item size."));P.call(this);this._className="buffer";this.R=a;this.za=b;this.hb=c}C(jf,P);var kf=ca.window;function lf(a,b,c){na(a)?c&&(a=xa(a,c)):a&&"function"==typeof a.handleEvent?a=xa(a.handleEvent,a):g(Error("Invalid listener argument"));return 2147483647<b?-1:kf.setTimeout(a,b||0)};function mf(a,b,c,d,f,e,h,i){var j,p=c.offsetParent;if(p){var k="HTML"==p.tagName||"BODY"==p.tagName;if(!k||"static"!=le(p,"position"))j=qe(p),k||(j=od(j,new V(p.scrollLeft,p.scrollTop)))}p=qe(a);k=te(a);p=new Rd(p.x,p.y,k.width,k.height);(k=pe(a))&&p.Be(new Rd(k.left,k.top,k.right-k.left,k.bottom-k.top));var k=Vd(a),m=Vd(c);if(k.u!=m.u){var l=k.u.body,m=m.u.parentWindow||m.u.defaultView,s=new V(0,0),v=Xd(l)?Xd(l).parentWindow||Xd(l).defaultView:window,u=l;do{var B;if(v==m)B=qe(u);else{var D=u;B=
new V;if(1==D.nodeType)if(D.getBoundingClientRect)D=ne(D),B.x=D.left,B.y=D.top;else{var K=ie(Vd(D)),D=qe(D);B.x=D.x-K.x;B.y=D.y-K.y}else{var K=na(D.Of),L=D;D.targetTouches?L=D.targetTouches[0]:K&&D.ha.targetTouches&&(L=D.ha.targetTouches[0]);B.x=L.clientX;B.y=L.clientY}}s.x+=B.x;s.y+=B.y}while(v&&v!=m&&(u=v.frameElement)&&(v=v.parent));l=od(s,qe(l));E&&!he(k)&&(l=od(l,ie(k)));p.left+=l.x;p.top+=l.y}a=(b&4&&re(a)?b^2:b)&-5;b=new V(a&2?p.left+p.width:p.left,a&1?p.top+p.height:p.top);j&&(b=od(b,j));
f&&(b.x+=(a&2?-1:1)*f.x,b.y+=(a&1?-1:1)*f.y);var J;if(h&&(J=pe(c))&&j)J.top-=j.y,J.right-=j.x,J.bottom-=j.y,J.left-=j.x;return nf(b,c,d,e,J,h,i)}
function nf(a,b,c,d,f,e,h){var a=a.d(),i=0,j=(c&4&&re(b)?c^2:c)&-5,c=te(b),h=h?h.d():c.d();if(d||0!=j)j&2?a.x-=h.width+(d?d.right:0):d&&(a.x+=d.left),j&1?a.y-=h.height+(d?d.bottom:0):d&&(a.y+=d.top);if(e){if(f){i=a;d=0;if(65==(e&65)&&(i.x<f.left||i.x>=f.right))e&=-2;if(132==(e&132)&&(i.y<f.top||i.y>=f.bottom))e&=-5;i.x<f.left&&e&1&&(i.x=f.left,d|=1);i.x<f.left&&i.x+h.width>f.right&&e&16&&(h.width=Math.max(h.width-(i.x+h.width-f.right),0),d|=4);i.x+h.width>f.right&&e&1&&(i.x=Math.max(f.right-h.width,
f.left),d|=1);e&2&&(d|=(i.x<f.left?16:0)|(i.x+h.width>f.right?32:0));i.y<f.top&&e&4&&(i.y=f.top,d|=2);i.y>=f.top&&i.y+h.height>f.bottom&&e&32&&(h.height=Math.max(h.height-(i.y+h.height-f.bottom),0),d|=8);i.y+h.height>f.bottom&&e&4&&(i.y=Math.max(f.bottom-h.height,f.top),d|=2);e&8&&(d|=(i.y<f.top?64:0)|(i.y+h.height>f.bottom?128:0));i=d}else i=256;if(i&496)return i}e=a;f=Sa&&(La||Wa)&&eb("1.9");e instanceof V?(a=e.x,e=e.y):(a=e,e=n);b.style.left=se(a,f);b.style.top=se(e,f);qd(c,h)||(a=he(Vd(Xd(b))),
E&&(!a||!eb("8"))?(c=b.style,a?(E?(a=we(b,ke(b,"paddingLeft")),f=we(b,ke(b,"paddingRight")),e=we(b,ke(b,"paddingTop")),d=we(b,ke(b,"paddingBottom")),a=new Qd(e,f,d,a)):(a=je(b,"paddingLeft"),f=je(b,"paddingRight"),e=je(b,"paddingTop"),d=je(b,"paddingBottom"),a=new Qd(parseFloat(e),parseFloat(f),parseFloat(d),parseFloat(a))),E?(f=ye(b,"borderLeft"),e=ye(b,"borderRight"),d=ye(b,"borderTop"),b=ye(b,"borderBottom"),b=new Qd(d,e,b,f)):(f=je(b,"borderLeftWidth"),e=je(b,"borderRightWidth"),d=je(b,"borderTopWidth"),
b=je(b,"borderBottomWidth"),b=new Qd(parseFloat(d),parseFloat(e),parseFloat(b),parseFloat(f))),c.pixelWidth=h.width-b.left-a.left-a.right-b.right,c.pixelHeight=h.height-b.top-a.top-a.bottom-b.bottom):(c.pixelWidth=h.width,c.pixelHeight=h.height)):(b=b.style,Sa?b.MozBoxSizing="border-box":F?b.WebkitBoxSizing="border-box":b.boxSizing="border-box",b.width=Math.max(h.width,0)+"px",b.height=Math.max(h.height,0)+"px"));return i};function of(){}of.prototype.ja=aa();function pf(a,b){this.element=a;this.je=b}C(pf,of);pf.prototype.ja=function(a,b,c){mf(this.element,this.je,a,b,n,c)};function qf(a,b){this.ba=new ze(this);this.Ld(a||q);b&&this.rb(b)}C(qf,Vc);w=qf.prototype;w.h=q;w.Af=o;w.fe=q;w.L=r;w.Qg=r;w.Cd=-1;w.Rf=r;w.Jf=o;w.sb="toggle_display";w.rb=ba("sb");w.e=t("h");w.Ld=function(a){this.L&&g(Error("Can not change this state of the popup while showing."));this.h=a};
w.p=function(a){this.gc&&this.gc.stop();this.Xb&&this.Xb.stop();if(a){if(!this.L&&this.Hd()){this.h||g(Error("Caller must call setElement before trying to show the popup"));this.ja();a=Xd(this.h);this.Rf&&Be(this.ba,a,"keydown",this.cg,o);if(this.Af)if(Be(this.ba,a,"mousedown",this.Ne,o),E){var b;try{b=a.activeElement}catch(c){}for(;b&&"IFRAME"==b.nodeName;){try{var d=b.contentDocument||b.contentWindow.document}catch(f){break}a=d;b=a.activeElement}Be(this.ba,a,"mousedown",this.Ne,o);Be(this.ba,a,
"deactivate",this.Me)}else Be(this.ba,a,"blur",this.Me);"toggle_display"==this.sb?(this.h.style.visibility="visible",ve(this.h,o)):"move_offscreen"==this.sb&&this.ja();this.L=o;this.gc?(nc(this.gc,"end",this.Pe,r,this),this.gc.play()):this.Pe()}}else rf(this)};w.ja=fa;function rf(a,b){if(!a.L||!a.dispatchEvent({type:"beforehide",target:b}))return r;a.ba&&a.ba.Lc();a.Xb?(nc(a.Xb,"end",ya(a.ie,b),r,a),a.Xb.play()):a.ie(b);return o}
w.ie=function(a){"toggle_display"==this.sb?this.Qg?lf(this.xe,0,this):this.xe():"move_offscreen"==this.sb&&(this.h.style.left="-200px",this.h.style.top="-200px");this.L=r;this.Id(a)};w.xe=function(){this.h.style.visibility="hidden";ve(this.h,r)};w.Hd=function(){return this.dispatchEvent("beforeshow")};w.Pe=function(){this.Cd=za();this.dispatchEvent("show")};w.Id=function(a){za();this.dispatchEvent({type:"hide",target:a})};
w.Ne=function(a){a=a.target;!ge(this.h,a)&&(!this.fe||ge(this.fe,a))&&!(150>za()-this.Cd)&&rf(this,a)};w.cg=function(a){27==a.keyCode&&rf(this,a.target)&&(a.preventDefault(),a.stopPropagation())};w.Me=function(a){if(this.Jf){var b=Xd(this.h);if(E||Ra){if(a=b.activeElement,!a||ge(this.h,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>za()-this.Cd||rf(this)}};w.t=function(){qf.C.t.call(this);this.ba.Z();Rb(this.gc);Rb(this.Xb);delete this.h;delete this.ba};function sf(a,b){this.rd=a instanceof V?a:new V(a,b)}C(sf,of);sf.prototype.ja=function(a,b,c,d){mf(me(a),0,a,b,this.rd,c,q,d)};function tf(a,b){this.wg=4;this.Kd=b||n;qf.call(this,a)}C(tf,qf);tf.prototype.Oc=function(a){this.Kd=a||n;this.L&&this.ja()};tf.prototype.ja=function(){if(this.Kd){var a=!this.L&&"move_offscreen"!=this.sb,b=this.e();a&&(b.style.visibility="hidden",ve(b,o));this.Kd.ja(b,this.wg,this.Bh);a&&ve(b,r)}};function uf(a,b,c){this.ga=c||(a?Vd(Yd(a)):Vd());tf.call(this,this.ga.kb("div",{style:"position:absolute;display:none;"}));this.sd=new V(1,1);this.Wa=new Mb;a&&vf(this,a);if(b!=q)if(a=this.e(),"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(Xd(a).createTextNode(b))}}C(uf,tf);var wf=[];w=uf.prototype;w.I=q;w.className="goog-tooltip";
w.af=500;w.Qf=0;w.zc=t("ga");function vf(a,b){b=Yd(b);a.Wa.add(b);G(b,"mouseover",a.ue,r,a);G(b,"mouseout",a.Cc,r,a);G(b,"mousemove",a.te,r,a);G(b,"focus",a.se,r,a);G(b,"blur",a.Cc,r,a)}w.detach=function(a){if(a)a=Yd(a),xf(this,a),this.Wa.remove(a);else{for(var b=this.Wa.aa(),c=0;a=b[c];c++)xf(this,a);this.Wa.clear()}};function xf(a,b){oc(b,"mouseover",a.ue,r,a);oc(b,"mouseout",a.Cc,r,a);oc(b,"mousemove",a.te,r,a);oc(b,"focus",a.se,r,a);oc(b,"blur",a.Cc,r,a)}
w.Ld=function(a){var b=this.e();b&&ee(b);uf.C.Ld.call(this,a);a&&(b=this.ga.u.body,b.insertBefore(a,b.lastChild))};w.Hd=function(){if(!qf.prototype.Hd.call(this))return r;if(this.anchor)for(var a,b=0;a=wf[b];b++)ge(a.e(),this.anchor)||a.p(r);0<=ob(wf,this)||wf.push(this);a=this.e();a.className=this.className;yf(this);G(a,"mouseover",this.we,r,this);G(a,"mouseout",this.ve,r,this);zf(this);return o};
w.Id=function(){tb(wf,this);for(var a=this.e(),b,c=0;b=wf[c];c++)b.anchor&&ge(a,b.anchor)&&b.p(r);this.Se&&Af(this.Se);oc(a,"mouseover",this.we,r,this);oc(a,"mouseout",this.ve,r,this);this.anchor=n;if(0==(this.ua?this.L?4:1:this.lb?3:this.L?2:0))this.Nc=r;qf.prototype.Id.call(this)};w.Ke=function(a,b){this.anchor==a&&this.Wa.contains(this.anchor)&&(this.Nc||!this.Ch?(this.p(r),this.L||(this.anchor=a,this.Oc(b||Bf(this,0)),this.p(o))):this.anchor=n);this.ua=n};
w.$f=function(a){this.lb=n;a==this.anchor&&(this.I==q||this.I!=this.e()&&!this.Wa.contains(this.I))&&(!this.ge||!this.ge.I)&&this.p(r)};function Cf(a,b){var c=ie(a.ga);a.sd.x=b.clientX+c.x;a.sd.y=b.clientY+c.y}w.ue=function(a){var b=Df(this,a.target);this.I=b;yf(this);b!=this.anchor&&(this.anchor=b,this.ua||(this.ua=lf(xa(this.Ke,this,b,n),this.af)),Ef(this),Cf(this,a))};function Df(a,b){try{for(;b&&!a.Wa.contains(b);)b=b.parentNode;return b}catch(c){return q}}
w.te=function(a){Cf(this,a);this.Nc=o};w.se=function(a){this.I=a=Df(this,a.target);this.Nc=o;if(this.anchor!=a){this.anchor=a;var b=Bf(this,1);yf(this);this.ua||(this.ua=lf(xa(this.Ke,this,a,b),this.af));Ef(this)}};function Bf(a,b){if(0==b){var c=a.sd.d();return new Ff(c)}return new Gf(a.I)}function Ef(a){if(a.anchor)for(var b,c=0;b=wf[c];c++)ge(b.e(),a.anchor)&&(b.ge=a,a.Se=b)}
w.Cc=function(a){var b=Df(this,a.target),c=Df(this,a.relatedTarget);b!=c&&(b==this.I&&(this.I=q),zf(this),this.Nc=r,this.L&&(!a.relatedTarget||!ge(this.e(),a.relatedTarget))?Af(this):this.anchor=n)};w.we=function(){var a=this.e();this.I!=a&&(yf(this),this.I=a)};w.ve=function(a){var b=this.e();if(this.I==b&&(!a.relatedTarget||!ge(b,a.relatedTarget)))this.I=q,Af(this)};function zf(a){a.ua&&(kf.clearTimeout(a.ua),a.ua=n)}
function Af(a){if(2==(a.ua?a.L?4:1:a.lb?3:a.L?2:0))a.lb=lf(xa(a.$f,a,a.anchor),a.Qf)}function yf(a){a.lb&&(kf.clearTimeout(a.lb),a.lb=n)}w.t=function(){this.p(r);zf(this);this.detach();this.e()&&ee(this.e());this.I=q;delete this.ga;uf.C.t.call(this)};function Ff(a,b){sf.call(this,a,b)}C(Ff,sf);Ff.prototype.ja=function(a,b,c){b=me(a);b=pe(b);c=c?new Qd(c.top+10,c.right,c.bottom,c.left+10):new Qd(10,0,0,10);nf(this.rd,a,4,c,b,9)&496&&nf(this.rd,a,4,c,b,5)};function Gf(a){pf.call(this,a,3)}C(Gf,pf);
Gf.prototype.ja=function(a,b,c){var d=new V(10,0);mf(this.element,this.je,a,b,d,c,9)&496&&mf(this.element,2,a,1,d,c,5)};function Hf(a){this.h=a;this.Ee=G(this.h,Sa?"DOMMouseScroll":"mousewheel",this)}C(Hf,Vc);
Hf.prototype.handleEvent=function(a){var b=0,c=0,d=0,a=a.ha;if("mousewheel"==a.type){c=1;if(E||F&&(Ma||eb("532.0")))c=40;d=F&&La&&0!=-a.wheelDelta%c?-a.wheelDelta:-a.wheelDelta/c;ha(a.wheelDeltaX)?(b=F&&La&&0!=-a.wheelDeltaX%c?-a.wheelDeltaX:-a.wheelDeltaX/c,c=F&&La&&0!=-a.wheelDeltaY%c?-a.wheelDeltaY:-a.wheelDeltaY/c):c=d}else d=a.detail,100<d?d=3:-100>d&&(d=-3),ha(a.axis)&&a.axis===a.HORIZONTAL_AXIS?b=d:c=d;z(this.Ie)&&Math.min(Math.max(b,-this.Ie),this.Ie);z(this.Je)&&(c=Math.min(Math.max(c,-this.Je),
this.Je));b=new If(d,a,0,c);try{this.dispatchEvent(b)}finally{b.Z()}};Hf.prototype.t=function(){Hf.C.t.call(this);pc(this.Ee);delete this.Ee};function If(a,b,c,d){b&&this.ra(b,n);this.type="mousewheel";this.detail=a;this.td=d}C(If,gc);E||F&&eb("525");function Jf(a){(!x(a)||!(a instanceof Element))&&g(Error("Could not add interactor to the given element."));P.call(this);this._className="interactor";this.eb=a;this.cd=this.Vd=this.Ud=this.Wd=this.Td=this.Xd=q;this.bd=o;this.rightButtonDown=this.middleButtonDown=this.leftButtonDown=r;this.Zc=new Ic(0,0);this.config={MOUSEWHEEL_ENABLED:o,MOUSECLICKS_ENABLED:o,KEYBOARD_ENABLED:o,HOVERING_ENABLED:o,CONTEXTMENU_ENABLED:r}}C(Jf,P);w=Jf.prototype;
w.ra=function(){this.config.MOUSEWHEEL_ENABLED?(this.cd=new Hf(this.eb),this.Xd=G(this.cd,"mousewheel",this.og.bind(this))):(pc(this.Xd),this.cd=q);this.config.MOUSEWHEEL_ENABLED?(this.Td=G(this.eb,"mousedown",this.hg.bind(this)),this.Wd=G(this.eb,"mouseup",this.mg.bind(this))):(pc(this.Td),pc(this.Wd));this.eb.oncontextmenu=this.config.CONTEXTMENU_ENABLED?q:function(){return r};window.onkeydown=this.config.KEYBOARD_ENABLED?this.Oe.bind(this):q;pc(this.Ud);pc(this.Vd);this.Ud=G(this.eb,"mousemove",
this.jg.bind(this));this.Vd=G(this.eb,"mouseout",this.kg.bind(this))};w.hg=function(a){0==a.button?this.leftButtonDown=o:1==a.button?this.middleButtonDown=o:2==a.button&&(this.rightButtonDown=o);eval("this.onMouseDown(this['leftButtonDown'],this['middleButtonDown'],this['rightButtonDown'])");Kf(this);a.preventDefault()};w.gg=aa();
w.mg=function(a){0==a.button?this.leftButtonDown=r:1==a.button?this.middleButtonDown=r:2==a.button&&(this.rightButtonDown=r);eval("this.onMouseUp(this['leftButtonDown'],this['middleButtonDown'],this['rightButtonDown'])");Kf(this);a.preventDefault()};w.lg=aa();w.kg=function(a){this.bd=r;this.config.KEYBOARD_ENABLED&&(window.onkeydown=q);this.rightButtonDown=this.middleButtonDown=this.leftButtonDown=r;Kf(this);this.Zc=new Ic(0,0);a.preventDefault()};w.ig=aa();
w.jg=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.bd=o;this.config.KEYBOARD_ENABLED&&window.onkeydown==q&&(window.onkeydown=this.Oe.bind(this));a.preventDefault();var b=a.shiftKey,c=new Ic(a.offsetX,a.offsetY),a=this.Zc.ka(c);this.Zc=c.d();this.config.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.middleButtonDown||this.leftButtonDown||this.rightButtonDown)&&Kf(this),this.Vc=setTimeout(function(){Kf(this);var a=new Mc;a.tc=c.x;a.uc=c.y;this.dispatchEvent(a);
this.Vc=q}.bind(this),300));2>Math.abs(a.x)&&(a.x=0);2>Math.abs(a.y)&&(a.y=0);0!=a.Ya()&&(this.leftButtonDown&&!b?(b=new Jc,b.cb=a,b.zh=0,this.dispatchEvent(b)):this.middleButtonDown||this.leftButtonDown&&b?(b=new Hc,5<a.x?a.x=5:-5>a.x&&(a.x=-5),5<a.y?a.y=5:-5>a.y&&(a.y=-5),b.cb=a,this.dispatchEvent(b)):this.rightButtonDown&&(b=new Kc,b.Ra=0<a.y,b.xa=r,this.dispatchEvent(b)))};function Kf(a){a.Vc&&clearTimeout(a.Vc);a.dispatchEvent(new Nc)}w.ng=aa();
w.og=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");Kf(this);a.preventDefault();var b=new Kc;x(a.td)||(a.td=0);b.Ra=0>a.td;b.xa=o;this.dispatchEvent(b)};w.eg=aa();
w.Oe=function(a){if(this.bd){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");Kf(this);var b=a.altKey,c=a.ctrlKey,d=a.metaKey,f=a.shiftKey,e=a.keyCode;if(82==e&&!b&&!c&&!d&&!f)a.preventDefault(),a=new Oc,this.dispatchEvent(a);else if(37<=e&&40>=e&&(a.preventDefault(),a=f?new Hc:b?new Kc:new Jc))c=new Ic(0,0),37==e?(c.x=5,b&&(a.Ra=o,a.xa=r)):39==e?(c.x=-5,b&&(a.Ra=r,a.xa=r)):38==e?(c.y=5,b&&(a.Ra=o,a.xa=o)):40==e&&(c.y=-5,b&&(a.Ra=r,a.xa=o)),a.cb=c,this.dispatchEvent(a)}};A("X.interactor",Jf);
A("X.interactor.prototype.onMouseDown",Jf.prototype.gg);A("X.interactor.prototype.onMouseUp",Jf.prototype.lg);A("X.interactor.prototype.onMouseMove",Jf.prototype.ig);A("X.interactor.prototype.onMouseWheel",Jf.prototype.ng);A("X.interactor.prototype.onKey",Jf.prototype.eg);function Lf(a,b,c,d){x(a)||g(Error("No valid parent element."));(!z(b)||!z(c))&&g(Error("Invalid coordinates."));(!x(d)||!(d instanceof Jf))&&g(Error("Invalid interactor."));uf.call(this);this._className="caption";this.Ia=a;this.tc=b;this.uc=c;this.gb=d;this.oa=q;this.Oa=[];this.Oa=[".x-tooltip {\n background: #C0C0FF;\n color: #000000;\n border: 1px solid infotext;\n padding: 1px;\n font-family: sans-serif;\n}"];nc(d,Gc,this.Bd.bind(this));this.Ad()}C(Lf,uf);
Lf.prototype.Ad=function(){this.Ia.style.position="relative";var a=document.getElementsByTagName("head")[0],b=ae("style");b.type="text/css";b.media="screen";var c=document.createTextNode(this.Oa[0]);a.appendChild(b);b.appendChild(c);this.oa=b;this.Oc(new sf(this.tc,this.uc));this.p(o);vf(this,this.Ia);this.e().classList.add("x-tooltip")};Lf.prototype.Bd=function(){this.p(r);this.oa&&ee(this.oa);this.e()&&ee(this.e());this.oa=q};function Mf(a,b){(!z(a)||!z(b))&&g(Error("A camera needs valid width and height values."));P.call(this);this._className="camera";this.sf=45;this.nc=new N(0,0,100);this.wb=new N(0,0,0);this.Ta=new N(0,1,0);var c=Float32Array,d;d=a/b;var f=1*Math.tan(this.sf*Math.PI/360),e=-f;d=new Y([[2/(f*d-e*d),0,(f*d+e*d)/(f*d-e*d),0],[0,2/(f-e),(f+e)/(f-e),0],[0,0,-10001/9999,-2.000200020002],[0,0,-1,0]]);this.uf=new c(d.A());this.l=Nf(this,this.nc,this.wb);this.Qa=new Float32Array(this.l.A())}C(Mf,P);w=Mf.prototype;
w.tg=function(a){a instanceof Kc||g(Error("Received no valid zoom event."));a.Ra?this.mf(a.xa):this.nf(a.xa)};w.pg=function(a){a instanceof Hc||g(Error("Received no valid pan event."));this.Re(a.cb)};w.rg=function(a){a instanceof Jc||g(Error("Received no valid rotate event."));this.rotate(a.cb)};w.view=t("l");w.Ng=function(a){(!x(a)||!(a instanceof Y))&&g(Error("Invalid view matrix."));this.l=a;this.Qa=new Float32Array(this.l.A())};w.position=t("nc");
w.Oc=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The position was invalid."));this.nc=new N(a,b,c);this.reset()};w.reset=function(){this.l=Nf(this,this.nc,this.wb);this.Qa=new Float32Array(this.l.A())};w.focus=t("wb");w.Gg=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The focus was invalid."));this.wb=new N(a,b,c);this.reset()};w.ah=t("Ta");w.Mg=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The up-vector was invalid."));this.Ta=new N(a,b,c);this.reset()};
w.Re=function(a){a instanceof Ic||g(Error("Invalid distance vector for pan operation."));a=new N(-a.x,a.y,0);a=zd(4).translate(a);this.l=new Y(a.multiply(this.l));this.Qa=new Float32Array(this.l.A());this.dispatchEvent(new Lc)};
w.rotate=function(a){a instanceof Array&&2==a.length?a=new Ic(a[0],a[1]):a instanceof Ic||g(Error("Invalid distance vector for rotate operation."));var b=-a.x/5*Math.PI/180,a=-a.y/5*Math.PI/180,c=zd(4),d=new N(parseFloat(wd(this.l,0,0)),parseFloat(wd(this.l,0,1)),parseFloat(wd(this.l,0,2))),b=c.rotate(b,new N(parseFloat(wd(this.l,1,0)),parseFloat(wd(this.l,1,1)),parseFloat(wd(this.l,1,2)))),a=c.rotate(a,d);this.l=new Y(this.l.multiply(a.multiply(b)));this.Qa=new Float32Array(this.l.A());this.dispatchEvent(new Lc)};
w.mf=function(a){var b=20;x(a)&&!a&&(b=1);a=new N(0,0,b);a=zd(4).translate(a);this.l=new Y(a.multiply(this.l));this.Qa=new Float32Array(this.l.A());this.dispatchEvent(new Lc)};w.nf=function(a){var b=30;x(a)&&!a&&(b=1);a=new N(0,0,-b);a=zd(4).translate(a);this.l=new Y(a.multiply(this.l));this.Qa=new Float32Array(this.l.A());this.dispatchEvent(new Lc)};
function Nf(a,b,c){(!(b instanceof N)||!(c instanceof N))&&g(Error("3D vectors required for calculating the view."));var d=zd(4),c=new N(b.x-c.x,b.y-c.y,b.b-c.b),c=c.normalize(),a=a.Ta.d();a.Pb(c)&&(a.b+=1.0E-6);var f=Uc(a,c),a=Uc(c,f),f=f.normalize(),a=a.normalize();W(d,0,0,f.x);W(d,0,1,f.y);W(d,0,2,f.b);W(d,0,3,0);W(d,1,0,a.x);W(d,1,1,a.y);W(d,1,2,a.b);W(d,1,3,0);W(d,2,0,c.x);W(d,2,1,c.y);W(d,2,2,c.b);W(d,2,3,0);W(d,3,0,0);W(d,3,1,0);W(d,3,2,0);W(d,3,3,1);b=b.d();return d.translate(b.B())}
A("X.camera",Mf);A("X.camera.prototype.view",Mf.prototype.view);A("X.camera.prototype.setView",Mf.prototype.Ng);A("X.camera.prototype.position",Mf.prototype.position);A("X.camera.prototype.setPosition",Mf.prototype.Oc);A("X.camera.prototype.focus",Mf.prototype.focus);A("X.camera.prototype.setFocus",Mf.prototype.Gg);A("X.camera.prototype.up",Mf.prototype.ah);A("X.camera.prototype.setUp",Mf.prototype.Mg);A("X.camera.prototype.pan",Mf.prototype.Re);A("X.camera.prototype.rotate",Mf.prototype.rotate);
A("X.camera.prototype.zoomIn",Mf.prototype.mf);A("X.camera.prototype.zoomOut",Mf.prototype.nf);function Z(a){x(a)||g(Error("An ID to a valid container (<div>..) is required."));a=Yd(a);(!(oa(a)&&1==a.nodeType)||0==a.clientWidth||0==a.clientHeight)&&g(Error("Could not find the given container or it has an undefined size."));P.call(this);this._className="renderer";this.wa=a;this.Nb=this.wa.clientWidth;this.fb=this.wa.clientHeight;this.gb=this.m=this.gd=this.hd=this.a=this.ma=q;this.Ha=new Xe(Hd);this.Ib=[];this.Bb=this.Eb=this.Ab=this.Db=this.zb=this.Cb=q;this.j=[0,0,0];this.Yd=q;this.Tc=new Ib;
this.Jb=new Ib;this.Kb=new Ib;this.dd=new Ib;this.kc=new Ib;this.qc=new Ib;this.kd=new Ib;this.fa=this.yb=q;this.$c=r;this.config={PROGRESSBAR_ENABLED:o,PICKING_ENABLED:o,ORDERING_ENABLED:o,STATISTICS_ENABLED:r};window.console.log("XTK Release 3a -- 20/12/12 -- http://www.goXTK.com")}C(Z,P);w=Z.prototype;w.width=t("Nb");w.height=t("fb");w.canvas=function(){x(this.ma)||(this.ma=ae("canvas"));return this.ma};w.Ef=t("wa");w.Bf=t("m");w.Uf=t("gb");
function Of(a){x(a.yb)||(a.yb=new Md,G(Of(a),Dc,a.qg.bind(a)));return a.yb}w.qg=function(a){this.fa&&this.fa.Qc(100*a.de)};w.fg=function(a){x(a)&&a instanceof Pc&&Pf(this,a.Ga)};w.dg=function(a){if(x(a)&&a instanceof Mc){var b=a.tc,a=a.uc,c=this.get(this.Te(b,a));if(c&&(c=c.caption()))(new Lf(this.wa,this.wa.offsetLeft+b+10,this.wa.offsetTop+a+10,this.gb)).e().innerHTML=c}};w.yg=function(){this.Bb=this.Eb=this.Ab=this.Db=this.zb=this.Cb=q;this.j=[0,0,0]};
function Qf(a){a.config.PROGRESSBAR_ENABLED&&a.fa&&!a.$d&&(Pe(a.fa),a.$d=lf(function(){this.$d=q;this.fa&&(this.fa.Bd(),this.fa=q);this.cc()}.bind(a),700))}w.Xe=function(){this.m.reset();this.qb(r,r)};
w.ra=function(){var a=this.canvas();a.width=this.width();a.height=this.height();this.wa.appendChild(a);try{var b=a.getContext("experimental-webgl");b||g(Error())}catch(c){alert("WebGL not supported! See http://wiki.goXTK.com/index.php/X:Browsers for instructions.."),g(Error("WebGL not supported! See http://wiki.goXTK.com/index.php/X:Browsers for instructions.."))}try{if(b.viewport(0,0,this.width(),this.height()),b.clearColor(0,0,0,0),b.enable(b.BLEND),b.blendEquation(b.FUNC_ADD),b.blendFunc(b.SRC_ALPHA,
b.ONE_MINUS_SRC_ALPHA),b.enable(b.DEPTH_TEST),b.depthFunc(b.LEQUAL),b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT),this.config.PICKING_ENABLED){var d=b.createFramebuffer(),f=b.createRenderbuffer(),e=b.createTexture();b.bindTexture(b.TEXTURE_2D,e);b.texImage2D(b.TEXTURE_2D,0,b.RGB,this.width(),this.height(),0,b.RGB,b.UNSIGNED_BYTE,q);b.bindFramebuffer(b.FRAMEBUFFER,d);b.bindRenderbuffer(b.RENDERBUFFER,f);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,this.width(),this.height());b.bindRenderbuffer(b.RENDERBUFFER,
q);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f);b.bindFramebuffer(b.FRAMEBUFFER,q);this.Yd=d}}catch(h){g(Error("Exception while accessing GL Context!\n"+h))}d=new Jf(a);d.ra();G(d,Cc,this.Xe.bind(this));G(d,Fc,this.dg.bind(this));f=new Mf(this.width(),this.height());(!x(d)||!(d instanceof Jf))&&g(Error("Could not observe the interactor."));G(d,yc,f.pg.bind(f));G(d,zc,f.rg.bind(f));G(d,Ac,f.tg.bind(f));
G(f,Bc,this.qb.bind(this,r,r));this.ma=a;this.a=b;this.m=f;this.gb=d;Rf(this)};
function Rf(a){var b=new Re;(!x(a.ma)||!x(a.a)||!x(a.m))&&g(Error("Renderer was not initialized properly."));(!x(b)||!(b instanceof Re))&&g(Error("Could not add shaders."));Ue(b);var c=a.a.createShader(a.a.FRAGMENT_SHADER),d=a.a.createShader(a.a.VERTEX_SHADER);a.a.shaderSource(c,b.mc);a.a.shaderSource(d,b.sc);a.a.compileShader(c);a.a.compileShader(d);a.a.getShaderParameter(c,a.a.COMPILE_STATUS)||g(Error("Fragement Shader compilation failed!\n"+a.a.getShaderInfoLog(c)));a.a.getShaderParameter(d,a.a.COMPILE_STATUS)||
g(Error("Vertex Shader compilation failed!\n"+a.a.getShaderInfoLog(d)));var f=a.a.createProgram();a.a.attachShader(f,d);a.a.attachShader(f,c);a.a.linkProgram(f);a.a.getProgramParameter(f,a.a.LINK_STATUS)||g(Error("Could not create shader program!\n"+a.a.getShaderInfoLog(c)+"\n"+a.a.getShaderInfoLog(d)+"\n"+a.a.getProgramInfoLog(f)));a.a.useProgram(f);a.gd=f;Object.keys(Se).forEach(function(a){a=eval("X.shaders.attributes."+a);this.Tc.set(a,this.a.getAttribLocation(this.gd,a));this.a.enableVertexAttribArray(this.Tc.get(a))}.bind(a));
Object.keys(Te).forEach(function(a){a=eval("X.shaders.uniforms."+a);this.Jb.set(a,this.a.getUniformLocation(this.gd,a))}.bind(a));a.hd=b}w.add=function(a){this.Ib.push(a);Pf(this,a)};
function Pf(a,b){(!x(a.ma)||!x(a.a)||!x(a.m))&&g(Error("Renderer was not initialized properly."));(!x(b)||!(b instanceof I))&&g(Error("Illegal object."));var c=r;a.get(b.id())&&(c=o);sc(b)||G(b,tc,a.fg.bind(a));var d=b.id(),f=b.k,e=b.o,h=b.W,i=b.S,j=b.file(),p=b.transform();if(x(i)&&x(i.file())&&i.file().c)c=Of(a),x(b.S)||g(Error("Internal error during texture loading.")),d=new Image,i=b.S.file().path(),d.src=i,b.S.Sd=d,nc(d,"load",c.Yf.bind(c,b)),Nd(c).set(b.id(),r),Pd(c,0.3);else if(x(j)&&j.c)c=
Of(a),x(b.file())||g(Error("Internal error during file loading.")),b.k.clear(),b.o.clear(),d=b.file().path(),i=d.split(".").pop(),i=i.toUpperCase(),"TRK"==i||"STL"==i||"FSM"==i||"VTK"==i||"NRRD"==i||g(Error("The "+i+" file format is not supported.")),i=new XMLHttpRequest,G(i,"abort",c.Fe.bind(c,i,b)),G(i,"error",c.Fe.bind(c,i,b)),G(i,"load",c.Xf.bind(c,i,b)),i.open("GET",d,o),i.overrideMimeType("text/plain; charset=x-user-defined"),i.setRequestHeader("Content-Type","text/plain"),i.send(q),Nd(c).set(b.id(),
r);else{if(b.c&&b.Wb())for(var j=b.children(),k=j.length,m=0,m=0;m<k;m++)Pf(a,j[m]);if(0==f.count())Wc(b);else{for(j=0;a.$c;)j++;a.$c=o;if(f.c||p.c){k=p.f;j=k.ca(new N(f.Da,f.Ea,f.Fa));k=k.ca(new N(f.Aa,f.Ba,f.Ca));if(a.Cb===q||j.x<a.Cb)a.Cb=j.x;if(a.zb===q||k.x>a.zb)a.zb=k.x;if(a.Db===q||j.y<a.Db)a.Db=j.y;if(a.Ab===q||k.y>a.Ab)a.Ab=k.y;if(a.Eb===q||j.b<a.Eb)a.Eb=j.b;if(a.Bb===q||k.b>a.Bb)a.Bb=k.b;a.j=[(a.Cb+a.zb)/2,(a.Db+a.Ab)/2,(a.Eb+a.Bb)/2];Wc(p)}c&&f.c&&(p=a.Kb.get(d),x(p)&&a.a.isBuffer(p.R)&&
a.a.deleteBuffer(p.R));p=q;!c||f.c?(p=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,p),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(f.all()),a.a.STATIC_DRAW),p=new jf(p,f.count(),3),Wc(f)):p=a.Kb.get(d);Pd(Of(a),0.3);c&&e.c&&(j=a.Kb.get(d),x(j)&&a.a.isBuffer(j.R)&&a.a.deleteBuffer(j.R));j=q;!c||e.c?(j=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,j),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(e.all()),a.a.STATIC_DRAW),j=new jf(j,e.count(),3),Wc(e)):j=a.dd.get(d);Pd(Of(a),0.3);c&&
h.c&&(e=a.kc.get(d),x(e)&&a.a.isBuffer(e.R)&&a.a.deleteBuffer(e.R));e=q;0<h.length()&&(!c||h.c?(h.length()!=f.length()&&g(Error("Mismatch between points and point colors.")),f=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,f),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(h.all()),a.a.STATIC_DRAW),e=new jf(f,h.count(),3),Wc(h)):e=a.kc.get(d));Pd(Of(a),0.3);c&&x(i)&&i.c&&(h=a.qc.get(d),x(h)&&a.a.isBuffer(h.R)&&a.a.deleteBuffer(h.R));h=q;x(i)&&(!c||i.c?(h=b.Sa,x(h)||g(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),
f=a.a.createTexture(),f.zd=i.zd(),a.kd.set(i.id(),f),a.a.bindTexture(a.a.TEXTURE_2D,f),i.Gb?(a.a.texImage2D(a.a.TEXTURE_2D,0,a.a.RGBA,i.pc,i.oc,0,a.a.RGBA,a.a.UNSIGNED_BYTE,i.Gb),a.a.texParameteri(a.a.TEXTURE_2D,a.a.TEXTURE_WRAP_S,a.a.CLAMP_TO_EDGE),a.a.texParameteri(a.a.TEXTURE_2D,a.a.TEXTURE_WRAP_T,a.a.CLAMP_TO_EDGE),a.a.pixelStorei(a.a.UNPACK_FLIP_Y_WEBGL,o)):(a.a.texImage2D(a.a.TEXTURE_2D,0,a.a.RGBA,a.a.RGBA,a.a.UNSIGNED_BYTE,f.zd),a.a.pixelStorei(a.a.UNPACK_FLIP_Y_WEBGL,r)),a.a.texParameteri(a.a.TEXTURE_2D,
a.a.TEXTURE_MAG_FILTER,a.a.LINEAR),a.a.texParameteri(a.a.TEXTURE_2D,a.a.TEXTURE_MIN_FILTER,a.a.LINEAR),a.a.bindTexture(a.a.TEXTURE_2D,q),f=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,f),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(h),a.a.STATIC_DRAW),h=new jf(f,h.length,2),Wc(i)):h=a.qc.get(d));Pd(Of(a),0.1);!c&&!a.Ha.add(b)&&g(Error("Could not add object to this renderer."));a.Kb.set(d,p);a.dd.set(d,j);a.kc.set(d,e);a.qc.set(d,h);Wc(b);a.$c=r}}}
w.cc=function(){(!this.ma||!this.a||!this.m)&&g(Error("The renderer was not initialized properly."));x(this.Zd)||(Od(Of(this))?this.fa?(Qf(this),eval("this.onShowtime()")):this.qb(r,o):(this.config.PROGRESSBAR_ENABLED&&!this.fa&&(this.fa=new Oe(this.wa,3)),this.Zd=lf(function(){this.Zd=q;this.cc()}.bind(this),100)))};w.sg=aa();w.get=function(a){x(a)||g(Error("Invalid object id."));for(var b=this.Ha.aa(),c=0,d=b.length,c=0;c<d;c++)if(b[c].id()==a)return b[c];return q};
w.Te=function(a,b){if(this.config.PICKING_ENABLED){this.qb(o,r);var c=new Uint8Array(4);this.a.readPixels(a,this.fb-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);var d=Math.round(10*(c[0]/255)),f=Math.round(10*(c[1]/255)),c=Math.round(10*(c[2]/255));return 100*d+10*f+c}return-1};
w.qb=function(a,b){var c=this.Ha.aa(),d=c.length;if(0!=d){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.Yd):this.a.bindFramebuffer(this.a.FRAMEBUFFER,q);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var f=this.m.uf,e=this.m.Qa;this.a.uniformMatrix4fv(this.Jb.get("perspective"),r,f);this.a.uniformMatrix4fv(this.Jb.get("view"),r,e);f=this.j;this.a.uniform3f(this.Jb.get("center"),parseFloat(f[0]),parseFloat(f[1]),parseFloat(f[2]));if(this.config.ORDERING_ENABLED)a:{var h=r,f=this.Ha.aa(),
e=f.length,i;i=e-1;do{var j=f[i];if(!j)break a;var p=j._opacity,k=j.Lb;j instanceof Qe&&(p=k&&k._volumeRendering?j._opacity=j.Lb._opacity:j._opacity=1);1!=p&&(h=j.k.jc,j=this.m.l.ca(j.rc.f.ca(new N(h[0],h[1],h[2]))),j=Sc(this.m.wb,j),f[i].xc=j,h=o)}while(i--);if(h){this.Ha.clear();i=e-1;do this.Ha.add(f[i]);while(i--)}}if(f=!a&&x(b)&&b&&this.config.STATISTICS_ENABLED)var m=0,l=0,s=0,v=0;i=this.Ib.length;for(e=0;e<i;++e)if(j=this.Ib[e],j instanceof Ve){var u=new N(1,0,0),u=this.m.view().ca(u),h=Sc(this.m.focus(),
u),u=new N(-1,0,0),u=this.m.view().ca(u),p=Sc(this.m.focus(),u),u=new N(0,1,0),u=this.m.view().ca(u),k=Sc(this.m.focus(),u),u=new N(0,-1,0),u=this.m.view().ca(u),B=Sc(this.m.focus(),u),u=new N(0,0,1),u=this.m.view().ca(u),D=Sc(this.m.focus(),u),u=new N(0,0,-1),u=this.m.view().ca(u),u=Sc(this.m.focus(),u),K=Math.max(h,k,D,p,B,u);K==h||K==p?We(j,0):K==k||K==B?We(j,1):(K==D||K==u)&&We(j,2)}e=this.Tc;i=e.get("vertexPosition");var j=e.get("vertexNormal"),h=e.get("vertexColor"),p=e.get("vertexTexturePos"),
e=this.Jb,k=e.get("usePicking"),B=e.get("useObjectColor"),D=e.get("objectColor"),u=e.get("objectOpacity"),K=e.get("useTexture"),L=e.get("textureSampler"),J=e.get("volumeLowerThreshold"),da=e.get("volumeUpperThreshold"),$=e.get("volumeScalarMin"),ea=e.get("volumeScalarMax"),hb=e.get("objectTransform"),Ec=e.get("pointSize"),e=d;do{var M=c[d-e];if(M){var Q=q;M instanceof Qe&&M.Lb&&(Q=M.Lb);if(M._visible&&(!Q||Q._visible)){var ia=M._id,ma=M._magicMode,O=this.Kb.get(ia),la=this.dd.get(ia),Db=this.kc.get(ia),
sa=this.qc.get(ia);this.a.bindBuffer(this.a.ARRAY_BUFFER,O.R);this.a.vertexAttribPointer(i,O.hb,this.a.FLOAT,r,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,la.R);this.a.vertexAttribPointer(j,la.hb,this.a.FLOAT,r,0,0);a?this.a.uniform1i(k,o):this.a.uniform1i(k,r);Db&&!a&&!ma?(this.a.uniform1i(B,r),this.a.bindBuffer(this.a.ARRAY_BUFFER,Db.R),this.a.vertexAttribPointer(h,Db.hb,this.a.FLOAT,r,0,0)):(la=1,ma&&!a&&(la=0),this.a.uniform1i(B,la),ma=M._color,a&&(999<ia&&g(Error("Id out of bounds.")),ma=Math.floor(0.01*
ia),la=Math.floor(0.1*ia)-10*ma,ma=[ma/10,la/10,(ia-100*ma-10*la)/10]),this.a.uniform3f(D,parseFloat(ma[0]),parseFloat(ma[1]),parseFloat(ma[2])),this.a.vertexAttribPointer(h,O.hb,this.a.FLOAT,r,0,0));this.a.uniform1f(u,parseFloat(M._opacity));M.S&&sa&&!a?(this.a.uniform1i(K,o),this.a.activeTexture(this.a.TEXTURE0),this.a.bindTexture(this.a.TEXTURE_2D,this.kd.get(M.S._id)),this.a.uniform1i(L,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,sa.R),this.a.vertexAttribPointer(p,sa.hb,this.a.FLOAT,r,0,0)):(this.a.uniform1i(K,
r),this.a.vertexAttribPointer(p,O.hb,this.a.FLOAT,r,0,0));Q&&(this.a.uniform1f(J,Q._lowerThreshold),this.a.uniform1f(da,Q._upperThreshold),ia=Q.Hb,this.a.uniform1f($,ia[0]),this.a.uniform1f(ea,ia[1]),Q._volumeRendering&&this.a.uniform1f(u,parseFloat(Q._opacity)));this.a.uniformMatrix4fv(hb,r,M.rc.na);Q=1;"POINTS"==M._type&&(Q=M._pointSize);this.a.uniform1f(Ec,Q);Q=-1;M.type()==Ed?(Q=this.a.TRIANGLES,f&&(l+=O.za/3)):M.type()==cd?(this.a.lineWidth(M.lineWidth()),Q=this.a.LINES,f&&(s+=O.za/2)):"POINTS"==
M.type()?(Q=this.a.POINTS,f&&(v+=O.za)):"TRIANGLE_STRIPS"==M.type()?(Q=this.a.TRIANGLE_STRIP,f&&(l+=O.za/3)):"POLYGONS"==M.type()&&(Q=0==O.za%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(l+=O.za/3));f&&(m+=O.za);this.a.drawArrays(Q,0,O.za)}}}while(--e);f&&(c="Objects: "+d+" | "+("Vertices: "+m+" | ")+("Triangles: "+Math.round(l)+" | "),c=c+("Lines: "+s+" | ")+("Points: "+v+" | ")+("Textures: "+this.kd.$()),window.console.log(c))}};
w.Gf=function(){this.Ha.clear();delete this.Ha;this.Ib.length=0;delete this.Ib;this.hd=q;delete this.hd;this.yb=q;delete this.yb;this.m=q;delete this.m;this.gb=q;delete this.gb;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);this.a=q;delete this.a;ee(this.ma);delete this.ma};A("X.renderer",Z);A("X.renderer.prototype.width",Z.prototype.width);A("X.renderer.prototype.height",Z.prototype.height);A("X.renderer.prototype.canvas",Z.prototype.canvas);A("X.renderer.prototype.container",Z.prototype.Ef);
A("X.renderer.prototype.camera",Z.prototype.Bf);A("X.renderer.prototype.interactor",Z.prototype.Uf);A("X.renderer.prototype.resetBoundingBox",Z.prototype.yg);A("X.renderer.prototype.resetViewAndRender",Z.prototype.Xe);A("X.renderer.prototype.init",Z.prototype.ra);A("X.renderer.prototype.add",Z.prototype.add);A("X.renderer.prototype.onShowtime",Z.prototype.sg);A("X.renderer.prototype.get",Z.prototype.get);A("X.renderer.prototype.pick",Z.prototype.Te);A("X.renderer.prototype.render",Z.prototype.cc);
A("X.renderer.prototype.destroy",Z.prototype.Gf);function Sf(a){function b(a,b){var a=a*2*Math.PI,b=b*Math.PI,e=new S(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));h.push(new T(c.Za(e.va(d)),e))}this.i=[];for(var a=a||{},c=new S(a.od||[0,0,0]),d=a.ia||1,f=a.Nd||16,a=a.Rg||8,e=[],h,i=0;i<f;i++)for(var j=0;j<a;j++)h=[],b(i/f,j/a),0<j&&b((i+1)/f,j/a),j<a-1&&b((i+1)/f,(j+1)/a),b(i/f,(j+1)/a),e.push(new ld(h));return nd(e)}C(Sf,U);A("CSG.sphere",Sf);function Tf(a,b){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));z(b)||g(Error("Invalid radius."));I.call(this);this._className="Sphere";this.j=a;this.fd=b;this.jd=32;this.yf=16;this.pa()}C(Tf,I);Tf.prototype.pa=function(){Gd(this,new Sf({od:this.j,ia:this.fd,Nd:this.jd,Rg:this.yf}))};A("X.sphere",Tf);function Uf(a){function b(a,b,d){b=2*b*Math.PI;b=j.va(Math.cos(b)).Za(p.va(Math.sin(b)));a=c.Za(f.va(a)).Za(b.va(e));d=b.va(1-Math.abs(d)).Za(h.va(d));return new T(a,d)}this.i=[];for(var a=a||{},c=new S(a.start||[0,-1,0]),d=new S(a.end||[0,1,0]),f=d.mb(c),e=a.ia||1,a=a.Nd||16,h=f.tb(),i=0.5<Math.abs(h.y()),j=(new S(i,!i,0)).wc(h).tb(),p=j.wc(h).tb(),i=new T(c,h.Gc()),d=new T(d,h.tb()),k=[],m=0;m<a;m++){var l=m/a,s=(m+1)/a;k.push(new ld([i,b(0,l,-1),b(0,s,-1)]));k.push(new ld([b(0,s,0),b(0,l,0),b(1,
l,0),b(1,s,0)]));k.push(new ld([d,b(1,s,1),b(1,l,1)]))}return nd(k)}C(Uf,U);A("CSG.cylinder",Uf);function Vf(a,b,c){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid start position."));(!x(b)||!(b instanceof Array)||3!=b.length)&&g(Error("Invalid end position."));z(c)||g(Error("Invalid radius."));I.call(this);this._className="cylinder";this.zf=a;this.rf=b;this.fd=c;this.jd=32;this.pa()}C(Vf,I);Vf.prototype.pa=function(){Gd(this,new Uf({start:this.zf,end:this.rf,ia:this.fd,Nd:this.jd}))};A("X.cylinder",Vf);function Wf(a){this.i=[];var a=a||{},b=new S(a.od||[0,0,0]),c=!a.ia?[1,1,1]:a.ia.length?a.ia:[a.ia,a.ia,a.ia];return nd([[[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 ld(a[0].map(function(f){f=new S(b.x()+c[0]*(2*!!(f&1)-1),b.y()+c[1]*(2*!!(f&2)-1),b.b()+c[2]*(2*!!(f&4)-1));return new T(f,new S(a[1]))}))}))}C(Wf,U);A("CSG.cube",Wf);function Xf(a,b,c,d){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));(!z(b)||!z(c)||!z(d))&&g(Error("Invalid radii."));I.call(this);this._className="cube";this.j=a;this.vf=b;this.wf=c;this.xf=d;this.Sa=[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];this.pa()}C(Xf,I);Xf.prototype.pa=function(){Gd(this,new Wf({od:this.j,ia:[this.vf,this.wf,this.xf]}))};A("X.cube",Xf);