-
Notifications
You must be signed in to change notification settings - Fork 8
/
xtk_release_3.js
268 lines (268 loc) · 121 KB
/
xtk_release_3.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
/*
*
* 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,s=!1;function aa(){return function(){}}function ba(a){return function(b){this[a]=b}}function t(a){return function(){return this[a]}}var v,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 w(a){return a!=q}function ka(a){return"array"==ga(a)}function la(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 ma(a){return"function"==ga(a)}function na(a){a=ga(a);return"object"==a||"array"==a||"function"==a}function pa(a){return a[ra]||(a[ra]=++sa)}
var ra="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),sa=0;function ta(a,b,c){return a.call.apply(a.bind,arguments)}function ua(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 va(a,b,c){va=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ta:ua;return va.apply(q,arguments)}function wa(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 xa=Date.now||function(){return+new Date};
function B(a,b){var c=a.split("."),d=ca;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&ha(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}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{ye:function(){a+=1},yh:function(){a+=-1},value:function(){return a}}}();
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c?this:a||window,e.concat(d.call(arguments)))}function c(){}"function"!==typeof this&&g(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var d=Array.prototype.slice,e=d.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});B("Function.prototype.bind",Function.prototype.bind);function ya(a){if(!za.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Aa,"&"));-1!=a.indexOf("<")&&(a=a.replace(Ba,"<"));-1!=a.indexOf(">")&&(a=a.replace(Ca,">"));-1!=a.indexOf('"')&&(a=a.replace(Da,"""));return a}var Aa=/&/g,Ba=/</g,Ca=/>/g,Da=/\"/g,za=/[&<>\"]/;var Ea,Fa,Ga,Ha,Ia,Ja,Ka;function La(){return ca.navigator?ca.navigator.userAgent:q}function Ma(){return ca.navigator}Ia=Ha=Ga=Fa=Ea=s;var Pa;if(Pa=La()){var Qa=Ma();Ea=0==Pa.indexOf("Opera");Fa=!Ea&&-1!=Pa.indexOf("MSIE");Ha=(Ga=!Ea&&-1!=Pa.indexOf("WebKit"))&&-1!=Pa.indexOf("Mobile");Ia=!Ea&&!Ga&&"Gecko"==Qa.product}var Ra=Ea,D=Fa,Sa=Ia,F=Ga,Ta=Ha,Ua,Wa=Ma();Ua=Wa&&Wa.platform||"";Ja=-1!=Ua.indexOf("Mac");Ka=-1!=Ua.indexOf("Win");var Xa=!!Ma()&&-1!=(Ma().appVersion||"").indexOf("X11"),Ya;
a:{var $a="",ab;if(Ra&&ca.opera)var bb=ca.opera.version,$a="function"==typeof bb?bb():bb;else if(Sa?ab=/rv\:([^\);]+)(\)|;)/:D?ab=/MSIE\s+([^\);]+)(\)|;)/:F&&(ab=/WebKit\/(\S+)/),ab)var cb=ab.exec(La()),$a=cb?cb[1]:"";if(D){var db,eb=ca.document;db=eb?eb.documentMode:n;if(db>parseFloat($a)){Ya=""+db;break a}}Ya=$a}var fb={};
function gb(a){var b;if(!(b=fb[a])){b=0;for(var c=(""+Ya).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=(""+a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var h=c[f]||"",i=d[f]||"",k=RegExp("(\\d*)(\\D*)","g"),p=RegExp("(\\d*)(\\D*)","g");do{var r=k.exec(h)||["","",""],m=p.exec(i)||["","",""];if(0==r[0].length&&0==m[0].length)break;b=((0==r[1].length?0:parseInt(r[1],10))<(0==m[1].length?0:parseInt(m[1],10))?-1:(0==r[1].length?0:parseInt(r[1],
10))>(0==m[1].length?0:parseInt(m[1],10))?1:0)||((0==r[2].length)<(0==m[2].length)?-1:(0==r[2].length)>(0==m[2].length)?1:0)||(r[2]<m[2]?-1:r[2]>m[2]?1:0)}while(0==b)}b=fb[a]=0<=b}return b}var hb={};function ib(a){return hb[a]||(hb[a]=D&&document.documentMode&&document.documentMode>=a)};function jb(a,b){for(var c in a)b.call(n,a[c],c,a)}function kb(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function lb(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}var mb="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");function nb(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<mb.length;f++)c=mb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var ob=Array.prototype,pb=ob.indexOf?function(a,b,c){return ob.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},qb=ob.forEach?function(a,b,c){ob.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=y(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},rb=ob.map?function(a,b,c){return ob.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=y(a)?
a.split(""):a,h=0;h<d;h++)h in f&&(e[h]=b.call(c,f[h],h,a));return e},sb=ob.some?function(a,b,c){return ob.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=y(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return o;return s},tb=ob.every?function(a,b,c){return ob.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=y(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return s;return o};function ub(a,b){var c=pb(a,b);0<=c&&ob.splice.call(a,c,1)}
function vb(a){return ob.concat.apply(ob,arguments)}function wb(a){if(ka(a))return vb(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b}function xb(a,b,c){return 2>=arguments.length?ob.slice.call(a,b):ob.slice.call(a,b,c)};function yb(a){if("function"==typeof a.$)a=a.$();else if(la(a)||y(a))a=a.length;else{var b=0,c;for(c in a)b++;a=b}return a}function zb(a){if("function"==typeof a.aa)return a.aa();if(y(a))return a.split("");if(la(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return kb(a)}
function Ab(a,b){if("function"==typeof a.every)return a.every(b,n);if(la(a)||y(a))return tb(a,b,n);var c;if("function"==typeof a.Qb)c=a.Qb();else if("function"!=typeof a.aa)if(la(a)||y(a)){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=lb(a);else c=n;for(var d=zb(a),e=d.length,f=0;f<e;f++)if(!b.call(n,d[f],c&&c[f],a))return s;return o};var Fb="StopIteration"in ca?ca.StopIteration:Error("StopIteration");function Gb(){}Gb.prototype.next=function(){g(Fb)};Gb.prototype.ub=function(){return this};function Hb(a){if(a instanceof Gb)return a;if("function"==typeof a.ub)return a.ub(s);if(la(a)){var b=0,c=new Gb;c.next=function(){for(;;){b>=a.length&&g(Fb);if(b in a)return a[b++];b++}};return c}g(Error("Not implemented"))}
function Ib(a,b){if(la(a))try{qb(a,b,n)}catch(c){c!==Fb&&g(c)}else{a=Hb(a);try{for(;;)b.call(n,a.next(),n,a)}catch(d){d!==Fb&&g(d)}}};function Jb(a,b){this.q={};this.m=[];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.ld(a)}v=Jb.prototype;v.g=0;v.fc=0;v.$=t("g");v.aa=function(){Kb(this);for(var a=[],b=0;b<this.m.length;b++)a.push(this.q[this.m[b]]);return a};v.Qb=function(){Kb(this);return this.m.concat()};v.pd=function(a){for(var b=0;b<this.m.length;b++){var c=this.m[b];if(Lb(this.q,c)&&this.q[c]==a)return o}return s};
v.Mb=function(a,b){if(this===a)return o;if(this.g!=a.$())return s;var c=b||Mb;Kb(this);for(var d,e=0;d=this.m[e];e++)if(!c(this.get(d),a.get(d)))return s;return o};function Mb(a,b){return a===b}v.clear=function(){this.q={};this.fc=this.g=this.m.length=0};v.remove=function(a){return Lb(this.q,a)?(delete this.q[a],this.g--,this.fc++,this.m.length>2*this.g&&Kb(this),o):s};
function Kb(a){if(a.g!=a.m.length){for(var b=0,c=0;b<a.m.length;){var d=a.m[b];Lb(a.q,d)&&(a.m[c++]=d);b++}a.m.length=c}if(a.g!=a.m.length){for(var e={},c=b=0;b<a.m.length;)d=a.m[b],Lb(e,d)||(a.m[c++]=d,e[d]=1),b++;a.m.length=c}}v.get=function(a,b){return Lb(this.q,a)?this.q[a]:b};v.set=function(a,b){Lb(this.q,a)||(this.g++,this.m.push(a),this.fc++);this.q[a]=b};v.ld=function(a){var b;a instanceof Jb?(b=a.Qb(),a=a.aa()):(b=lb(a),a=kb(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};v.d=function(){return new Jb(this)};
v.ub=function(a){Kb(this);var b=0,c=this.m,d=this.q,e=this.fc,f=this,h=new Gb;h.next=function(){for(;;){e!=f.fc&&g(Error("The map has changed since the iterator was created"));b>=c.length&&g(Fb);var h=c[b++];return a?h:d[h]}};return h};function Lb(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Nb(a){this.q=new Jb;a&&this.ld(a)}function Ob(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+pa(a):b.substr(0,1)+a}v=Nb.prototype;v.$=function(){return this.q.$()};v.add=function(a){this.q.set(Ob(a),a)};v.ld=function(a){for(var a=zb(a),b=a.length,c=0;c<b;c++)this.add(a[c])};v.Jc=function(a){for(var a=zb(a),b=a.length,c=0;c<b;c++)this.remove(a[c])};v.remove=function(a){return this.q.remove(Ob(a))};v.clear=function(){this.q.clear()};
v.contains=function(a){a=Ob(a);return Lb(this.q.q,a)};v.Ae=function(a){for(var b=new Nb,a=zb(a),c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};v.aa=function(){return this.q.aa()};v.d=function(){return new Nb(this)};v.Mb=function(a){return this.$()==yb(a)&&Pb(this,a)};
function Pb(a,b){var c=yb(b);if(a.$()>c)return s;!(b instanceof Nb)&&5<c&&(b=new Nb(b));return Ab(a,function(a){if("function"==typeof b.contains)a=b.contains(a);else if("function"==typeof b.pd)a=b.pd(a);else if(la(b)||y(b))a=0<=pb(b,a);else a:{for(var c in b)if(b[c]==a){a=o;break a}a=s}return a})}v.ub=function(){return this.q.ub(s)};function Qb(){}Qb.prototype.me=s;Qb.prototype.Z=function(){this.me||(this.me=o,this.s())};Qb.prototype.s=function(){this.Ef&&Rb.apply(q,this.Ef)};function Sb(a){a&&"function"==typeof a.Z&&a.Z()}function Rb(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];la(d)?Rb.apply(q,d):Sb(d)}};function Tb(a,b){this.Ge=b;this.Pb=[];a>this.Ge&&g(Error("[goog.structs.SimplePool] Initial cannot be greater than max"));for(var c=0;c<a;c++)this.Pb.push(this.tc())}C(Tb,Qb);v=Tb.prototype;v.je=q;v.le=q;function Ub(a,b){a.Pb.length<a.Ge?a.Pb.push(b):a.td(b)}v.tc=function(){return this.je?this.je():{}};v.td=function(a){if(this.le)this.le(a);else if(na(a))if(ma(a.Z))a.Z();else for(var b in a)delete a[b]};v.s=function(){Tb.C.s.call(this);for(var a=this.Pb;a.length;)this.td(a.pop());delete this.Pb};function Vb(){this.Nb=[];this.Id=new Jb;this.gf=this.hf=this.jf=this.bf=0;this.ec=new Jb;this.ge=this.ff=0;this.Ed=1;this.ud=new Tb(0,4E3);this.ud.tc=function(){return new Wb};this.cf=new Tb(0,50);this.cf.tc=function(){return new Xb};var a=this;this.xd=new Tb(0,2E3);this.xd.tc=function(){return""+a.Ed++};this.xd.td=aa()}function Xb(){this.Qd=this.time=this.count=0}
Xb.prototype.toString=function(){var a=[];a.push(this.type," ",this.count," (",Math.round(10*this.time)/10," ms)");this.Qd&&a.push(" [VarAlloc = ",this.Qd,"]");return a.join("")};function Wb(){}function Yb(a,b,c,d){var e=[];-1==c?e.push(" "):e.push(Zb(a.oe-c));e.push(" ",$b(a.oe-b));0==a.vd?e.push(" Start "):1==a.vd?(e.push(" Done "),e.push(Zb(a.Ch-a.startTime)," ms ")):e.push(" Comment ");e.push(d,a);0<a.Ug&&e.push("[VarAlloc ",a.Ug,"] ");return e.join("")}
Wb.prototype.toString=function(){return this.type==q?this.Cf:"["+this.type+"] "+this.Cf};Vb.prototype.reset=function(){for(var a=0;a<this.Nb.length;a++){var b=this.ud.id;b&&Ub(this.xd,b);Ub(this.ud,this.Nb[a])}this.Nb.length=0;this.Id.clear();this.bf=xa();this.ge=this.ff=this.gf=this.hf=this.jf=0;b=this.ec.Qb();for(a=0;a<b.length;a++){var c=this.ec.get(b[a]);c.count=0;c.time=0;c.Qd=0;Ub(this.cf,c)}this.ec.clear()};
Vb.prototype.toString=function(){for(var a=[],b=-1,c=[],d=0;d<this.Nb.length;d++){var e=this.Nb[d];1==e.vd&&c.pop();a.push(" ",Yb(e,this.bf,b,c.join("")));b=e.oe;a.push("\n");0==e.vd&&c.push("| ")}if(0!=this.Id.$()){var f=xa();a.push(" Unstopped timers:\n");Ib(this.Id,function(b){a.push(" ",b," (",f-b.startTime," ms, started at ",$b(b.startTime),")\n")})}b=this.ec.Qb();for(d=0;d<b.length;d++)c=this.ec.get(b[d]),1<c.count&&a.push(" TOTAL ",c,"\n");a.push("Total tracers created ",this.ff,"\n","Total comments created ",
this.ge,"\n","Overhead start: ",this.jf," ms\n","Overhead end: ",this.hf," ms\n","Overhead comment: ",this.gf," ms\n");return a.join("")};function Zb(a){var a=Math.round(a),b="";1E3>a&&(b=" ");100>a&&(b=" ");10>a&&(b=" ");return b+a}function $b(a){a=Math.round(a);return(""+(100+a/1E3%60)).substring(1,3)+"."+(""+(1E3+a%1E3)).substring(1,4)}new Vb;function ac(){}var bc=0;v=ac.prototype;v.key=0;v.ob=s;v.md=s;v.qa=function(a,b,c,d,e,f){ma(a)?this.Be=o:a&&a.handleEvent&&ma(a.handleEvent)?this.Be=s:g(Error("Invalid listener argument"));this.Vb=a;this.Ve=b;this.src=c;this.type=d;this.capture=!!e;this.wd=f;this.md=s;this.key=++bc;this.ob=s};v.handleEvent=function(a){return this.Be?this.Vb.call(this.wd||this.src,a):this.Vb.handleEvent.call(this.Vb,a)};!D||ib(9);var cc=!D||ib(9),dc=D&&!gb("8");!F||gb("528");Sa&&gb("1.9b")||D&&gb("8")||Ra&&gb("9.5")||F&&gb("528");!Sa||gb("8");function ec(a,b){this.type=a;this.currentTarget=this.target=b}C(ec,Qb);v=ec.prototype;v.s=function(){delete this.type;delete this.target;delete this.currentTarget};v.Za=s;v.ac=o;v.stopPropagation=function(){this.Za=o};v.preventDefault=function(){this.ac=s};function fc(a){fc[" "](a);return a}fc[" "]=fa;function hc(a,b){a&&this.qa(a,b)}C(hc,ec);v=hc.prototype;v.target=q;v.relatedTarget=q;v.offsetX=0;v.offsetY=0;v.clientX=0;v.clientY=0;v.screenX=0;v.screenY=0;v.button=0;v.keyCode=0;v.charCode=0;v.ctrlKey=s;v.altKey=s;v.shiftKey=s;v.metaKey=s;v.ha=q;
v.qa=function(a,b){var c=this.type=a.type;ec.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(Sa){var e;a:{try{fc(d.nodeName);e=o;break a}catch(f){}e=s}e||(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.ac;delete this.Za};v.stopPropagation=function(){hc.C.stopPropagation.call(this);this.ha.stopPropagation?this.ha.stopPropagation():this.ha.cancelBubble=o};
v.preventDefault=function(){hc.C.preventDefault.call(this);var a=this.ha;if(a.preventDefault)a.preventDefault();else if(a.returnValue=s,dc)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};v.Mf=t("ha");v.s=function(){hc.C.s.call(this);this.relatedTarget=this.currentTarget=this.target=this.ha=q};var ic={},jc={},kc={},lc={};
function G(a,b,c,d,e){if(b){if(ka(b)){for(var f=0;f<b.length;f++)G(a,b[f],c,d,e);return q}var d=!!d,h=jc;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=pa(a),k;h.U++;if(h[i]){k=h[i];for(f=0;f<k.length;f++)if(h=k[f],h.Vb==c&&h.wd==e){if(h.ob)break;return k[f].key}}else k=h[i]=[],h.g++;f=mc();f.src=a;h=new ac;h.qa(c,f,a,b,d,e);c=h.key;f.key=c;k.push(h);ic[c]=h;kc[i]||(kc[i]=[]);kc[i].push(h);a.addEventListener?(a==ca||!a.ke)&&a.addEventListener(b,f,d):a.attachEvent(b in
lc?lc[b]:lc[b]="on"+b,f);return c}g(Error("Invalid event type"))}function mc(){var a=nc,b=cc?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 oc(a,b,c,d,e){if(ka(b))for(var f=0;f<b.length;f++)oc(a,b[f],c,d,e);else a=G(a,b,c,d,e),ic[a].md=o}
function pc(a,b,c,d,e){if(ka(b))for(var f=0;f<b.length;f++)pc(a,b[f],c,d,e);else{d=!!d;a:{f=jc;if(b in f&&(f=f[b],d in f&&(f=f[d],a=pa(a),f[a]))){a=f[a];break a}a=q}if(a)for(f=0;f<a.length;f++)if(a[f].Vb==c&&a[f].capture==d&&a[f].wd==e){qc(a[f].key);break}}}
function qc(a){if(!ic[a])return s;var b=ic[a];if(b.ob)return s;var c=b.src,d=b.type,e=b.Ve,f=b.capture;c.removeEventListener?(c==ca||!c.ke)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(d in lc?lc[d]:lc[d]="on"+d,e);c=pa(c);e=jc[d][f][c];if(kc[c]){var h=kc[c];ub(h,b);0==h.length&&delete kc[c]}b.ob=o;e.Ke=o;rc(d,f,c,e);delete ic[a];return o}
function rc(a,b,c,d){if(!d.Dc&&d.Ke){for(var e=0,f=0;e<d.length;e++)d[e].ob?d[e].Ve.src=q:(e!=f&&(d[f]=d[e]),f++);d.length=f;d.Ke=s;0==f&&(delete jc[a][b][c],jc[a][b].g--,0==jc[a][b].g&&(delete jc[a][b],jc[a].g--),0==jc[a].g&&delete jc[a])}}function sc(a){var b,c=0,d=b==q;b=!!b;if(a==q)jb(kc,function(a){for(var e=a.length-1;0<=e;e--){var f=a[e];if(d||b==f.capture)qc(f.key),c++}});else if(a=pa(a),kc[a])for(var a=kc[a],e=a.length-1;0<=e;e--){var f=a[e];if(d||b==f.capture)qc(f.key),c++}}
function tc(a){var b=uc,a=pa(a),c=kc[a];if(c){var d=ha(b),e=ha(n);return d&&e?(c=jc[b],!!c&&!!c[n]&&a in c[n]):!d&&!e?o:sb(c,function(a){return d&&a.type==b||e&&a.capture==n})}return s}function vc(a,b,c,d,e){var f=1,b=pa(b);if(a[b]){a.U--;a=a[b];a.Dc?a.Dc++:a.Dc=1;try{for(var h=a.length,i=0;i<h;i++){var k=a[i];k&&!k.ob&&(f&=wc(k,e)!==s)}}finally{a.Dc--,rc(c,d,b,a)}}return Boolean(f)}function wc(a,b){var c=a.handleEvent(b);a.md&&qc(a.key);return c}
function nc(a,b){if(!ic[a])return o;var c=ic[a],d=c.type,e=jc;if(!(d in e))return o;var e=e[d],f,h;if(!cc){var i;if(!(i=b))a:{i=["window","event"];for(var k=ca;f=i.shift();)if(w(k[f]))k=k[f];else{i=q;break a}i=k}f=i;i=o in e;k=s in e;if(i){if(0>f.keyCode||f.returnValue!=n)return o;a:{var p=s;if(0==f.keyCode)try{f.keyCode=-1;break a}catch(r){p=o}if(p||f.returnValue==n)f.returnValue=o}}p=new hc;p.qa(f,this);f=o;try{if(i){for(var m=[],l=p.currentTarget;l;l=l.parentNode)m.push(l);h=e[o];h.U=h.g;for(var j=
m.length-1;!p.Za&&0<=j&&h.U;j--)p.currentTarget=m[j],f&=vc(h,m[j],d,o,p);if(k){h=e[s];h.U=h.g;for(j=0;!p.Za&&j<m.length&&h.U;j++)p.currentTarget=m[j],f&=vc(h,m[j],d,s,p)}}else f=wc(c,p)}finally{m&&(m.length=0),p.Z()}return f}d=new hc(b,this);try{f=wc(c,d)}finally{d.Z()}return f}var xc=0;function yc(a){return a+"_"+xc++};function H(a){ec.call(this,a);this._className="event"}C(H,ec);var zc=yc("pan"),Ac=yc("rotate"),Bc=yc("zoom"),Cc=yc("render"),Dc=yc("resetview"),uc=yc("modified"),Ec=yc("progress"),Fc=yc("hover"),Gc=yc("hover_end");function Hc(){H.call(this,zc);this.bb=new Ic(0,0)}C(Hc,H);function Jc(){H.call(this,Ac);this.bb=new Ic(0,0)}C(Jc,H);function Kc(){H.call(this,Bc);this.wa=this.Qa=s}C(Kc,H);function Lc(){H.call(this,Cc)}C(Lc,H);function Mc(){H.call(this,Fc);this.sc=this.rc=0}C(Mc,H);
function Nc(){H.call(this,Gc)}C(Nc,H);function Oc(){H.call(this,Dc)}C(Oc,H);function Pc(){H.call(this,uc);this.Fa=new I}C(Pc,H);function Qc(){H.call(this,Ec);this.ce=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.ef=function(){return[this.x,this.y,this.b]};function M(a,b,c){this.x=a;this.y=b;this.b=c}C(M,Rc);v=M.prototype;v.d=function(){return new M(this.x,this.y,this.b)};v.Xa=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.b*this.b)};v.scale=function(a){this.x*=a;this.y*=a;this.b*=a;return this};v.B=function(){this.x=-this.x;this.y=-this.y;this.b=-this.b;return this};v.normalize=function(){return this.scale(1/this.Xa())};v.add=function(a){this.x+=a.x;this.y+=a.y;this.b+=a.b;return this};
v.ka=function(a){this.x-=a.x;this.y-=a.y;this.b-=a.b;return this};v.Mb=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,e=a.b-b.b;return Math.sqrt(c*c+d*d+e*e)}function Tc(a,b){return new M(a.x+b.x,a.y+b.y,a.b+b.b)}function Uc(a,b){return new M(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,Qb);v=Vc.prototype;v.ke=o;v.Fc=q;v.Ld=ba("Fc");v.addEventListener=function(a,b,c,d){G(this,a,b,c,d)};v.removeEventListener=function(a,b,c,d){pc(this,a,b,c,d)};
v.dispatchEvent=function(a){var b=a.type||a,c=jc;if(b in c){if(y(a))a=new ec(a,this);else if(a instanceof ec)a.target=a.target||this;else{var d=a,a=new ec(b,this);nb(a,d)}var d=1,e,c=c[b],b=o in c,f;if(b){e=[];for(f=this;f;f=f.Fc)e.push(f);f=c[o];f.U=f.g;for(var h=e.length-1;!a.Za&&0<=h&&f.U;h--)a.currentTarget=e[h],d&=vc(f,e[h],a.type,o,a)&&a.ac!=s}if(s in c)if(f=c[s],f.U=f.g,b)for(h=0;!a.Za&&h<e.length&&f.U;h++)a.currentTarget=e[h],d&=vc(f,e[h],a.type,s,a)&&a.ac!=s;else for(e=this;!a.Za&&e&&f.U;e=
e.Fc)a.currentTarget=e,d&=vc(f,e,a.type,s,a)&&a.ac!=s;a=Boolean(d)}else a=o;return a};v.s=function(){Vc.C.s.call(this);sc(this);this.Fc=q};function O(){this._className="base";this.c=s}C(O,Vc);O.prototype.className=t("_className");O.prototype.print=function(){var a=Object.keys(this),b="",c="<unknown>",d=0;for(d in a){var e="this."+a[d],f=eval(e);"this._className"==e?c=f:b+=e+": "+f+"\n"}return"== X."+c+" ==\n"+b};O.prototype.Gf=t("c");function Wc(a){a.c=s}B("X.base",O);B("X.base.prototype.className",O.prototype.className);B("X.base.prototype.print",O.prototype.print);B("X.base.prototype.dirty",O.prototype.Gf);function P(a){O.call(this);this._className="triplets";this.Ba=this.Ea=this.Aa=this.Da=this.za=this.Ca=q;this.gc=[0,0,0];this.T=[];w(a)&&a instanceof P&&(this.T=a.all().slice(),this.Ca=a.Ca,this.za=a.za,this.Da=a.Da,this.Aa=a.Aa,this.Ea=a.Ea,this.Ba=a.Ba,this.gc=a.gc.slice())}C(P,O);v=P.prototype;
v.add=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("Invalid triplet."));if(!this.Ca||a<this.Ca)this.Ca=a;if(!this.za||a>this.za)this.za=a;if(!this.Da||b<this.Da)this.Da=b;if(!this.Aa||b>this.Aa)this.Aa=b;if(!this.Ea||c<this.Ea)this.Ea=c;if(!this.Ba||c>this.Ba)this.Ba=c;this.gc=[(this.Ca+this.za)/2,(this.Da+this.Aa)/2,(this.Ea+this.Ba)/2];this.c=o;return this.T.push(a,b,c)/3};v.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]]};
v.remove=function(a){(!z(a)||3*a>this.T.length)&&g(Error("Invalid id."));this.T.splice(a,3);this.c=o};v.all=t("T");v.clear=function(){this.T=[];this.c=o};v.count=function(){return this.T.length/3};v.length=function(){return this.T.length};B("X.triplets",P);B("X.triplets.prototype.add",P.prototype.add);B("X.triplets.prototype.get",P.prototype.get);B("X.triplets.prototype.remove",P.prototype.remove);B("X.triplets.prototype.all",P.prototype.all);B("X.triplets.prototype.clear",P.prototype.clear);
B("X.triplets.prototype.count",P.prototype.count);B("X.triplets.prototype.length",P.prototype.length);function Xc(){O.call(this);this._className="parser"}C(Xc,O);v=Xc.prototype;v.parse=function(){g(Error("The function parse() should be overloaded."))};v.Zb=function(a,b){var c=this.r(a,b+2),d=this.r(a,b+3),e=(d<<1&255|c>>7)-127,c=(c&127)<<16|this.r(a,b+1)<<8|this.r(a,b);return 0==c&&-127==e?0:(1-2*(d>>7))*(1+c*Math.pow(2,-23))*Math.pow(2,e)};
function Yc(a,b,c){var d=a.r(b,c),e=a.r(b,c+1),f=(d<<1&255|e>>7)-127,a=(e&127)<<16|a.r(b,c+2)<<8|a.r(b,c+3);return 0==a&&-127==f?0:(1-2*(d>>7))*(1+a*Math.pow(2,-23))*Math.pow(2,f)}function Zc(a,b,c,d){var e=[],f=0,h=Infinity,i;for(i=0;i<d;i++){var k=a.Zb(b,c+4*i);e[i]=k;f=Math.max(f,k);h=Math.min(h,k)}return[e,f,h]}function $c(a,b,c){return(a.r(b,c+3)<<24)+(a.r(b,c+2)<<16)+(a.r(b,c+1)<<8)+a.r(b,c)}function ad(a,b,c){return(a.r(b,c)<<24)+(a.r(b,c+1)<<16)+(a.r(b,c+2)<<8)+a.r(b,c+3)}
v.Ic=function(a,b){return(this.r(a,b+1)<<8)+this.r(a,b)};v.sg=function(a,b){var c=this.r(a,b);return 127<c?c-256:c};v.r=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,e=a.W,f=0,h=f+6,i=0,k=Infinity,p;for(p=0;3>p;p++)var r=this.Ic(b,h+2*p),i=Math.max(i,r),k=Math.min(k,r);var m=Zc(this,b,f+12,3)[0];Zc(this,b,f+24,3);var l=this.Ic(b,f+36),j=this.Ic(b,f+238);Zc(this,b,f+440,16);Zc(this,b,f+956,6);for(var h=$c(this,b,f+988),f=$c(this,b,f+996),i=[],u=q,x=q,A=q,E=q,S=r=q,k=0;k<h;k++){var K=$c(this,b,f),J=new P,f=f+4;for(p=0;p<K;p++){var da=this.Zb(b,f),f=f+4,$=this.Zb(b,f),f=f+4,ea=this.Zb(b,f),f=f+4;0<l&&(Zc(this,b,f,
l),f+=4*l);da/=m[0];$/=m[1];ea/=m[2];J.add(da,$,ea)}0<j&&(f+=4*j);p=J.Ca;var K=J.za,da=J.Da,$=J.Aa,ea=J.Ea,Va=J.Ba;if(!u||p<u)u=p;if(!x||K>x)x=K;if(!A||da<A)A=da;if(!E||$>E)E=$;if(!r||ea<r)r=ea;if(!S||Va>S)S=Va;i.push(J)}f=(u+x)/2;A=(A+E)/2;r=(r+S)/2;for(k=0;k<h;k++){S=i[k];E=S.count();for(p=0;p<E-1;p++)l=S.get(p),m=S.get(p+1),c.add(l[0],l[1],l[2]),c.add(m[0],m[1],m[2]),j=l[0]-f,u=l[1]-A,x=l[2]-r,J=Math.sqrt(j*j+u*u+x*x),K=m[0]-f,da=m[1]-A,$=m[2]-r,ea=Math.sqrt(K*K+da*da+$*$),d.add(j/J,u/J,x/J),d.add(K/
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,e.add(m[0],m[1],m[2]),e.add(m[0],m[1],m[2])}a.qb(cd);c=new Pc;c.Fa=a;this.dispatchEvent(c)};B("X.parserTRK",bd);B("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,e=a.k,f=a.o,h=0,i=d%8;i--;)this.z(e,f,c[h]),h++;for(i=0.125*d^0;i--;)this.z(e,f,c[h]),h++,this.z(e,f,c[h]),h++,this.z(e,f,c[h]),h++,this.z(e,f,c[h]),h++,this.z(e,f,c[h]),h++,this.z(e,f,c[h]),h++,this.z(e,f,c[h]),h++,this.z(e,f,c[h]),h++;c=new Pc;c.Fa=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]),e=parseFloat(d[2]),d=parseFloat(d[3]);a.add(c,e,d)}else"facet"==d[0]&&(c=parseFloat(d[2]),e=parseFloat(d[3]),d=parseFloat(d[4]),b.add(c,e,d),b.add(c,e,d),b.add(c,e,d))};B("X.parserSTL",dd);B("X.parserSTL.prototype.parse",dd.prototype.parse);function Q(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]))}
Q.prototype={d:function(){return new Q(this.O,this.P,this.Q)},Ec:function(){return new Q(-this.O,-this.P,-this.Q)},Ya:function(a){return new Q(this.O+a.x(),this.P+a.y(),this.Q+a.b())},lb:function(a){return new Q(this.O-a.x(),this.P-a.y(),this.Q-a.b())},ua:function(a){return new Q(this.O*a,this.P*a,this.Q*a)},ne:function(a){return new Q(this.O/a,this.P/a,this.Q/a)},Ua:function(a){return this.O*a.x()+this.P*a.y()+this.Q*a.b()},Cd:function(a,b){return this.Ya(a.lb(this).ua(b))},length:function(){return Math.sqrt(this.Ua(this))},
sb:function(){return this.ne(this.length())},uc:function(a){return new Q(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")};B("csgVector",Q);B("csgVector.prototype.clone",Q.prototype.d);B("csgVector.prototype.plus",Q.prototype.Ya);B("csgVector.prototype.minus",Q.prototype.lb);B("csgVector.prototype.dividedBy",Q.prototype.ne);B("csgVector.prototype.times",Q.prototype.ua);B("csgVector.prototype.dot",Q.prototype.Ua);
B("csgVector.prototype.lerp",Q.prototype.Cd);B("csgVector.prototype.length",Q.prototype.length);B("csgVector.prototype.unit",Q.prototype.sb);B("csgVector.prototype.cross",Q.prototype.uc);B("csgVector.prototype.negated",Q.prototype.Ec);B("csgVector.prototype.x",Q.prototype.x);B("csgVector.prototype.y",Q.prototype.y);B("csgVector.prototype.z",Q.prototype.b);function ed(){this.Kc=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(ka(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],fd(a,a.Kc?a.Kc.call(b,""+f,e):e,c),e=",";c.push("]");break}c.push("{");d="";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],"function"!=typeof e&&(c.push(d),gd(f,c),c.push(":"),
fd(a,a.Kc?a.Kc.call(b,f,e):e,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),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return hd[a]=e+b.toString(16)}),'"')};function jd(){O.call(this);this._className="indexer";this.kd=[];this.$c={}}C(jd,O);jd.prototype.add=function(a){w(a)||g(Error("Invalid object."));var b;b=[];fd(new ed,a,b);b=b.join("");b in this.$c||(this.$c[b]=this.kd.length,this.kd.push(a));return this.$c[b]};jd.prototype.unique=t("kd");function R(a,b){this.J=new Q(a);this.w=new Q(b)}R.prototype={d:function(){return new R(this.J.d(),this.w.d())},pa:function(){this.w=this.w.Ec()},ze:function(a,b){return new R(this.J.Cd(a.J,b),this.w.Cd(a.w,b))},vg:t("J"),Fd:t("w")};B("csgVertex",R);B("csgVertex.prototype.clone",R.prototype.d);B("csgVertex.prototype.flip",R.prototype.pa);B("csgVertex.prototype.interpolate",R.prototype.ze);B("csgVertex.prototype.pos",R.prototype.vg);B("csgVertex.prototype.normal",R.prototype.Fd);function kd(a,b){this.w=a;this.tb=b}kd.prototype={d:function(){return new kd(this.w.d(),this.tb)},pa:function(){this.w=this.w.Ec();this.tb=-this.tb},ah:t("tb"),Fd:t("w")};B("csgPlane.prototype.w",kd.prototype.ah);B("csgPlane.prototype.normal",kd.prototype.Fd);function ld(a,b){this.la=a;this.cc=b;var c=a[0].J,d=a[2].J,d=a[1].J.lb(c).uc(d.lb(c)).sb();this.M=new kd(d,d.Ua(c))}
ld.prototype={d:function(){var a=this.la.map(function(a){return a.d()});return new ld(a,this.cc)},pa:function(){this.la.reverse().map(function(a){a.pa()});this.M.pa()},$g:t("la"),Ng:t("cc"),af:function(a,b,c,d,e){for(var f=0,h=[],i=0;i<this.la.length;i++){var k=a.w.Ua(this.la[i].J)-a.tb,k=-1.0E-5>k?2:1.0E-5<k?1:0,f=f|k;h.push(k)}switch(f){case 0:(0<a.w.Ua(this.M.w)?b:c).push(this);break;case 1:d.push(this);break;case 2:e.push(this);break;case 3:b=[];c=[];for(i=0;i<this.la.length;i++){var p=(i+1)%
this.la.length,k=h[i],r=h[p],f=this.la[i],p=this.la[p];2!=k&&b.push(f);1!=k&&c.push(2!=k?f.d():f);3==(k|r)&&(k=(a.tb-a.w.Ua(f.J))/a.w.Ua(p.J.lb(f.J)),k=f.ze(p,k),b.push(k),c.push(k.d()))}3<=b.length&&d.push(new ld(b,this.cc));3<=c.length&&e.push(new ld(c,this.cc))}}};B("csgPolygon",ld);B("csgPolygon.prototype.clone",ld.prototype.d);B("csgPolygon.prototype.flip",ld.prototype.pa);B("csgPolygon.prototype.vertices",ld.prototype.$g);B("csgPolygon.prototype.shared",ld.prototype.Ng);function md(a){this.D=this.F=this.M=q;this.i=[];a&&this.hb(a)}
md.prototype={d:function(){var a=new md;a.Ig(this.M&&this.M.d());a.Fg(this.F&&this.F.d());a.Bg(this.D&&this.D.d());a.bc(this.i.map(function(a){return a.d()}));return a},B:function(){for(var a=0;a<this.i.length;a++)this.i[a].pa();this.M.pa();this.F&&this.F.B();this.D&&this.D.B();a=this.F;this.F=this.D;this.D=a},od:function(a){if(!this.M)return a.slice();for(var b=[],c=[],d=0;d<a.length;d++)a[d].af(this.M,b,c,b,c);this.F&&(b=this.F.od(b));c=this.D?this.D.od(c):[];return b.concat(c)},Y:function(a){this.i=
a.od(this.i);this.F&&this.F.Y(a);this.D&&this.D.Y(a)},Ja:function(){var a=this.i.slice();this.F&&(a=a.concat(this.F.Ja()));this.D&&(a=a.concat(this.D.Ja()));return a},hb: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].af(this.M,this.i,this.i,b,c);b.length&&(this.F||(this.F=new md),this.F.hb(b));c.length&&(this.D||(this.D=new md),this.D.hb(c))}},Ig:ba("M"),Fg:ba("F"),Bg:ba("D"),Ue:t("i"),bc:ba("i")};function T(){this.i=[]}function nd(a){var b=new T;b.bc(a);return b}
T.prototype={d:function(){var a=new T;a.bc(this.i.map(function(a){return a.d()}));return a},Tg:t("i"),Pc: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.hb(a.Ja());return nd(b.Ja())},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.hb(a.Ja());b.B();return nd(b.Ja())},Bc: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.hb(a.Ja());b.B();return nd(b.Ja())},inverse:function(){var a=
this.d();a.i.map(function(a){a.pa()});return a},Ue:t("i"),bc:ba("i")};B("CSG",T);B("CSG.fromPolygons",nd);B("CSG.prototype.toPolygons",T.prototype.Tg);B("CSG.prototype.union",T.prototype.Pc);B("CSG.prototype.subtract",T.prototype.ka);B("CSG.prototype.intersect",T.prototype.Bc);B("CSG.prototype.inverse",T.prototype.inverse);B("CSG.prototype.polygons",T.prototype.Ue);B("CSG.prototype.setPolygons",T.prototype.bc);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);v=Ic.prototype;v.d=function(){return new Ic(this.x,this.y)};v.Xa=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};v.scale=function(a){this.x*=a;this.y*=a;return this};v.B=function(){this.x=-this.x;this.y=-this.y;return this};v.normalize=function(){return this.scale(1/this.Xa())};v.add=function(a){this.x+=a.x;this.y+=a.y;return this};v.ka=function(a){this.x-=a.x;this.y-=a.y;return this};
v.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};v.Mb=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?s:a.width==b.width&&a.height==b.height}v=pd.prototype;v.d=function(){return new pd(this.width,this.height)};v.toString=function(){return"("+this.width+" x "+this.height+")"};v.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};v.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
v.scale=function(a){this.width*=a;this.height*=a;return this};function rd(a,b){if(a instanceof rd)this.v=a.ef();else{var c;if(c=la(a))a:{for(var d=c=0;d<a.length;d++){if(!la(a[d])||0<c&&a[d].length!=c){c=s;break a}for(var e=0;e<a[d].length;e++)if(!z(a[d][e])){c=s;break a}0==c&&(c=a[d].length)}c=0!=c}c?this.v=wb(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.p=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 e=0;e<a.K().width;e++)b.call(c,a.v[d][e],d,e,a)}function vd(a,b){var c=new rd(a.K());ud(a,function(d,e,f){c.v[e][f]=b.call(n,d,e,f,a)});return c}function sd(a,b){for(var c=[],d=0;d<a;d++){c[d]=[];for(var e=0;e<b;e++)c[d][e]=0}return c}v=rd.prototype;
v.add=function(a){qd(this.p,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]})};v.Mb=function(a,b){if(this.p.width!=a.p.width||this.p.height!=a.p.height)return s;for(var c=b||0,d=0;d<this.p.height;d++)for(var e=0;e<this.p.width;e++)if(!(Math.abs(this.v[d][e]-a.v[d][e])<=(c||1.0E-6)))return s;return o};v.K=t("p");function wd(a,b,c){return!(0<=b&&b<a.p.height&&0<=c&&c<a.p.width)?q:a.v[b][c]}
function W(a,b,c,d){0<=b&&b<a.p.height&&0<=c&&c<a.p.width||g(Error("Index out of bounds when setting matrix value, ("+b+","+c+") in size ("+a.p.height+","+a.p.width+")"));a.v[b][c]=d}v.multiply=function(a){if(a instanceof rd)return this.p.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."))};
v.ka=function(a){qd(this.p,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]})};v.ef=t("v");v.toString=function(){var a=0;ud(this,function(b){b=(""+b).length;b>a&&(a=b)});var b=[];qb(this.v,function(c){b.push("[ ");qb(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.p.height,b.K().width);ud(c,function(a,e,f){for(var h=a=0;h<this.p.width;h++)a+=wd(this,e,h)*wd(b,h,f);W(c,e,f,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)}v=Y.prototype;v.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};
v.translate=function(a){this.p.width!=this.p.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 M&&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))};
v.rotate=function(a,b){(4!=this.K().height||this.p.width!=this.p.height)&&g(Error("Only 4x4 matrices can be rotated."));(!w(b)||!(b instanceof M))&&g(Error("Invalid axis vector."));z(a)||g(Error("Invalid angle."));var c=b.normalize(),d=Math.cos(a),e=Math.sin(a),f=td(4);W(f,0,0,d+c.x*c.x*(1-d));W(f,0,1,c.x*c.y*(1-d)-c.b*e);W(f,0,2,c.x*c.b*(1-d)+c.y*e);W(f,1,0,c.y*c.x*(1-d)+c.b*e);W(f,1,1,d+c.y*c.y*(1-d));W(f,1,2,c.y*c.b*(1-d)-c.x*e);W(f,2,0,c.b*c.x*(1-d)-c.y*e);W(f,2,1,c.b*c.y*(1-d)+c.x*e);W(f,2,2,
d+c.b*c.b*(1-d));return new Y(this.multiply(f))};v.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 M&&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 M(parseFloat(wd(a,0,0)),parseFloat(wd(a,1,0)),parseFloat(wd(a,2,0)))};v.Rg=function(a,b){var c=this.v[a];this.v[a]=this.v[b];this.v[b]=c};
v.Qg=function(a,b){for(var c=this.K(),d=0,d=0;d<c.height;d++){var e=wd(this,d,a);e||(e=0);var f=wd(this,d,b);f||(f=0);W(this,d,a,f);W(this,d,b,e)}};B("X.matrix",Y);B("X.matrix.createIdentityMatrix",zd);B("X.matrix.prototype.flatten",Y.prototype.A);B("X.matrix.prototype.translate",Y.prototype.translate);B("X.matrix.prototype.rotate",Y.prototype.rotate);B("X.matrix.prototype.multiplyByVector",Y.prototype.ca);B("X.matrix.prototype.swapRows",Y.prototype.Rg);B("X.matrix.prototype.swapCols",Y.prototype.Qg);function Ad(){O.call(this);this._className="transform";this.f=zd(4);this.ma=new Float32Array(this.f.A())}C(Ad,O);v=Ad.prototype;v.xg=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new M(0,1,0));this.ma=new Float32Array(this.f.A());this.c=o};v.yg=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new M(1,0,0));this.ma=new Float32Array(this.f.A());this.c=o};
v.zg=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new M(0,0,1));this.ma=new Float32Array(this.f.A());this.c=o};v.Vg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new M(a,0,0));this.ma=new Float32Array(this.f.A());this.c=o};v.Wg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new M(0,a,0));this.ma=new Float32Array(this.f.A());this.c=o};
v.Xg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new M(0,0,a));this.ma=new Float32Array(this.f.A());this.c=o};v.Xf=t("f");v.Ye=function(a){var b=zd(4);w(a)&&a instanceof Y&&(b=a);this.f=b;this.ma=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.ma=new Float32Array(a.f.A());a.c=o}v.Jf=function(){Bd(this,0,0)};v.Kf=function(){Bd(this,1,1)};v.Lf=function(){Bd(this,2,2)};B("X.transform",Ad);
B("X.transform.prototype.rotateX",Ad.prototype.xg);B("X.transform.prototype.rotateY",Ad.prototype.yg);B("X.transform.prototype.rotateZ",Ad.prototype.zg);B("X.transform.prototype.translateX",Ad.prototype.Vg);B("X.transform.prototype.translateY",Ad.prototype.Wg);B("X.transform.prototype.translateZ",Ad.prototype.Xg);B("X.transform.prototype.matrix",Ad.prototype.Xf);B("X.transform.prototype.setMatrix",Ad.prototype.Ye);B("X.transform.prototype.flipX",Ad.prototype.Jf);B("X.transform.prototype.flipY",Ad.prototype.Kf);
B("X.transform.prototype.flipZ",Ad.prototype.Lf);function Cd(a){O.call(this);this._className="file";this.sf=a;this.c=o}C(Cd,O);Cd.prototype.path=t("sf");function Dd(){O.call(this);this._className="texture";var a=window["X.Counter"];a.ye();this._id=a.value();this.Eb=this.Rd=this.Oa=q;this.mc=this.nc=0;this.c=o}C(Dd,O);Dd.prototype.id=t("_id");Dd.prototype.file=t("Oa");Dd.prototype.yd=t("Rd");function I(a){O.call(this);this._className="object";var b=window["X.Counter"];b.ye();this._id=b.value();this._type=Ed;this.pc=new Ad;this._color=[1,1,1];this.k=new P;this.o=new P;this.W=new P;this.Oa=this.Ra=this.S=q;this._opacity=1;this.ab=q;this._visible=o;this._lineWidth=this._pointSize=1;this._caption=q;this._magicMode=s;w(a)&&(this._type=a.type(),this.pc.Ye(new Y(a.transform().f)),this._color=Array(a.color()),this.k=new P(a.k),this.o=new P(a.o),this.W=new P(a.W),this.S=a.S,this.Ra=a.Ra,a.file()&&
(this.Oa=new Cd((new String(a.file().path())).toString())),this._opacity=a.opacity(),this.ab=a.children(),this._visible=a.kf(),this._pointSize=a.Te(),this._lineWidth=a.lineWidth(),a.caption()&&(this._caption=(new String(a.caption())).toString()),this._magicMode=a.Fe(),this.c=o);this.c=o}C(I,O);var Ed="TRIANGLES",cd="LINES";v=I.prototype;v.id=t("_id");
function Fd(a){for(var b=a.k.count(),c=[],d=0,d=0;d<b;d+=3){var e=a.k.get(d),f=a.k.get(d+1),h=a.k.get(d+2),i=a.o.get(d),k=a.o.get(d+1),p=a.o.get(d+2),r=a._color;0<a.W.length()&&(r=a.W.get(d));var m=[];m.push(new R(e,i));m.push(new R(f,k));m.push(new R(h,p));c.push(new ld(m,r))}return nd(c)}
function Gd(a,b){(!w(b)||!(b instanceof T))&&g(Error("Invalid CSG object."));a.k.clear();a.o.clear();a.W.clear();var c=new jd,d=[];rb(b.i,function(a){for(var b=[],h=a.cc,b=rb(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.pf=rb(c.unique(),function(a){return[a.J.x(),a.J.y(),a.J.b()]});a.of=rb(c.unique(),function(a){return[a.w.x(),a.w.y(),a.w.b()]});a.nf=rb(c.unique(),function(a){return!a.color?q:[a.color[0],a.color[1],a.color[2]]});rb(d,function(a){var b=
a[0],c=a[1],a=a[2],d=this.pf,k=this.of,p=this.nf;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(k[b][0],k[b][1],k[b][2]);this.o.add(k[c][0],k[c][1],k[c][2]);this.o.add(k[a][0],k[a][1],k[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.qb(Ed)}v.type=t("_type");v.qb=ba("_type");v.transform=t("pc");v.tg=t("k");v.$f=t("o");v.Bf=t("W");
v.color=t("_color");v.Sg=t("S");v.Nc=function(a){if(w(a)){if(y(a)){var b=a,c=a=new Dd;w(b)?(y(b)&&(b=new Cd(b)),c.Oa=b):c.Oa=q}a instanceof Dd||g(Error("Invalid texture."));this.S=a}else this.S=q};v.Xe=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.Tb())for(var d=this.children(),e=d.length,f=0,f=0;f<e;f++)d[f].Xe(a,b,c);this._color[0]=a;this._color[1]=b;this._color[2]=c;this.c=o};
v.Pc=function(a){(!w(a)||!(a instanceof T)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Fd(b));a=new I;Gd(a,Fd(this).Pc(b));return a};v.ka=function(a){(!w(a)||!(a instanceof T)&&!(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};v.Bc=function(a){(!w(a)||!(a instanceof T)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Fd(b));a=new I;Gd(a,Fd(this).Bc(b));return a};
v.inverse=function(a){(!w(a)||!(a instanceof T)&&!(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};v.opacity=t("_opacity");v.caption=t("_caption");v.Cg=function(a){this._caption=a;this.c=o};v.u=function(a){if(this.Tb())for(var b=this.children(),c=b.length,d=0,d=0;d<c;d++)b[d].u(a);this._visible=a;this.c=o};v.kf=t("_visible");
v.Ze=function(a){(!z(a)||1<a||0>a)&&g(Error("Invalid opacity."));if(this.Tb())for(var b=this.children(),c=b.length,d=0,d=0;d<c;d++)b[d].Ze(a);this._opacity=a;this.c=o};v.load=function(a){this.Oa=w(a)?new Cd(a):q};v.file=t("Oa");v.Xb=function(){var a=new Pc;a.Fa=this;this.dispatchEvent(a)};v.children=function(){this.ab||(this.ab=[]);return this.ab};v.Tb=function(){return!this.ab?s:0<this.ab.length};v.Gg=function(a){z(a)||g(Error("Invalid line width."));this._lineWidth=a;this.c=o};v.lineWidth=t("_lineWidth");
v.Jg=function(a){z(a)||g(Error("Invalid point size."));this._pointSize=a;this.c=o};v.Te=t("_pointSize");v.Fe=t("_magicMode");v.Hg=function(a){"boolean"!=typeof a&&g(Error("Invalid magicMode setting."));this._magicMode=a};function Hd(a,b){(!w(a)||!w(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:w(a.vc)&&w(b.vc)&&a.vc>b.vc?-1:1}B("X.object",I);B("X.object.prototype.id",I.prototype.id);
B("X.object.prototype.type",I.prototype.type);B("X.object.prototype.transform",I.prototype.transform);B("X.object.prototype.points",I.prototype.tg);B("X.object.prototype.normals",I.prototype.$f);B("X.object.prototype.texture",I.prototype.Sg);B("X.object.prototype.setTexture",I.prototype.Nc);B("X.object.prototype.colors",I.prototype.Bf);B("X.object.prototype.color",I.prototype.color);B("X.object.prototype.setColor",I.prototype.Xe);B("X.object.prototype.opacity",I.prototype.opacity);
B("X.object.prototype.setOpacity",I.prototype.Ze);B("X.object.prototype.lineWidth",I.prototype.lineWidth);B("X.object.prototype.setLineWidth",I.prototype.Gg);B("X.object.prototype.pointSize",I.prototype.Te);B("X.object.prototype.setPointSize",I.prototype.Jg);B("X.object.prototype.load",I.prototype.load);B("X.object.prototype.file",I.prototype.file);B("X.object.prototype.caption",I.prototype.caption);B("X.object.prototype.visible",I.prototype.kf);B("X.object.prototype.setCaption",I.prototype.Cg);
B("X.object.prototype.setVisible",I.prototype.u);B("X.object.prototype.magicMode",I.prototype.Fe);B("X.object.prototype.setMagicMode",I.prototype.Hg);B("X.object.prototype.intersect",I.prototype.Bc);B("X.object.prototype.inverse",I.prototype.inverse);B("X.object.prototype.subtract",I.prototype.ka);B("X.object.prototype.union",I.prototype.Pc);B("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,e=b.split("\n"),f=e.length,h=new P,i=new P;this.G=[];this.X=Ed;this.dd=this.Ha=this.xa=this.Ia=s;for(var k=0,p=f%8;p--;)this.z(h,i,e[k]),k++;for(p=0.125*f^0;p--;)this.z(h,i,e[k]),k++,this.z(h,i,e[k]),k++,this.z(h,i,e[k]),k++,this.z(h,i,e[k]),k++,this.z(h,i,e[k]),k++,this.z(h,i,e[k]),k++,this.z(h,i,e[k]),k++,this.z(h,i,e[k]),k++;if(this.X==Ed){e=i.length();k=f=this.G.length;do{var p=this.G[f-k],r=p.length,m;for(m=0;m<r;m++){var l=parseInt(p[m],10),j=
h.get(l);c.add(j[0],j[1],j[2]);l<e?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new M(j[0],j[1],j[2]),l.normalize(),d.add(l.x,l.y,l.b))}k--}while(0<k)}else if("TRIANGLE_STRIPS"==this.X){e=i.length();k=f=this.G.length;do{p=this.G[f-k];r=p.length;for(m=0;m<r;m++)l=parseInt(p[m],10),j=h.get(l),c.add(j[0],j[1],j[2]),(0==m||m==r-1)&&c.add(j[0],j[1],j[2]),l<e?(l=i.get(l),d.add(l[0],l[1],l[2]),(0==m||m==r-1)&&d.add(l[0],l[1],l[2])):(l=new M(j[0],j[1],j[2]),l.normalize(),d.add(l.x,l.y,l.b),(0==m||m==r-1)&&d.add(l.x,
l.y,l.b));k--}while(0<k)}else if(this.X==cd){e=i.length();k=f=this.G.length;do{p=this.G[f-k];r=p.length;for(m=0;m<r-1;m++){var u=parseInt(p[m],10),l=parseInt(p[m+1],10),x=h.get(u),j=h.get(l);c.add(x[0],x[1],x[2]);c.add(j[0],j[1],j[2]);u<e-1?(j=i.get(u),l=i.get(l),d.add(j[0],j[1],j[2]),d.add(l[0],l[1],l[2])):(l=new M(x[0],x[1],x[2]),l.normalize(),d.add(l.x,l.y,l.b),l=new M(j[0],j[1],j[2]),l.normalize(),d.add(l.x,l.y,l.b))}k--}while(0<k)}else if("POINTS"==this.X){e=i.length();k=f=this.G.length;do{p=
this.G[f-k];r=p.length;for(m=0;m<r;m++)l=parseInt(p[m],10),j=h.get(l),c.add(j[0],j[1],j[2]),l<e?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new M(j[0],j[1],j[2]),l.normalize(),d.add(l.x,l.y,l.b));k--}while(0<k)}else if("POLYGONS"==this.X){e=i.length();k=f=this.G.length;do{p=this.G[f-k];r=p.length;for(m=0;m<r;m++)l=parseInt(p[m],10),j=h.get(l),c.add(j[0],j[1],j[2]),l<e?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new M(j[0],j[1],j[2]),l.normalize(),d.add(l.x,l.y,l.b));k--}while(0<k)}a.qb(this.X);c=new Pc;c.Fa=
a;this.dispatchEvent(c)};
Id.prototype.z=function(a,b,c){var c=c.replace(/^\s+|\s+$/g,""),c=c.split(" "),d=c.length,e=c[0];if("POINTS"==e)this.Ia=o,this.Ha=this.xa=s;else if("VERTICES"==e)this.xa=o,this.Ha=this.Ia=s,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"==e)this.xa=o,this.Ha=this.Ia=s,this.X="TRIANGLE_STRIPS",this.G=[];else if("LINES"==e)this.xa=o,this.Ha=this.Ia=s,this.X=cd,this.G=[];else if("POLYGONS"==e)this.xa=o,this.Ha=this.Ia=s,
this.X="POLYGONS",this.G=[];else if("POINT_DATA"==e)this.Ha=o,this.xa=this.Ia=s;else if(this.Ia)if(1==d||isNaN(parseFloat(e)))this.Ia=s;else{if(3<=d){var e=parseFloat(c[0]),f=parseFloat(c[1]),h=parseFloat(c[2]);a.add(e,f,h)}6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),h=parseFloat(c[5]),a.add(e,f,h));9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.add(d,e,c))}else this.xa?1==d||isNaN(parseFloat(e))?this.xa=s:this.G.push(c.slice(1)):this.Ha&&("NORMALS"==e?this.dd=o:1==d||isNaN(parseFloat(e))?
this.dd=this.Ha=s:this.dd&&(3<=d&&(e=parseFloat(c[0]),f=parseFloat(c[1]),h=parseFloat(c[2]),b.add(e,f,h)),6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),h=parseFloat(c[5]),b.add(e,f,h)),9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),b.add(d,e,c))))};B("X.parserVTK",Id);B("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,e=new P,f;f=3;var h=0,i;do i=this.r(b,f++),h++;while(200>h&&10!=i);f++;var k=ad(this,b,f);f+=4;h=ad(this,b,f);f+=4;i=[];for(var p=0,p=0;p<k;p++){var r=Yc(this,b,f);f+=4;var m=Yc(this,b,f);f+=4;var l=Yc(this,b,f);f+=4;i[p]=0;e.add(r,m,l)}k=[];p=[];for(r=0;r<h;r++){var j=ad(this,b,f);f+=4;l=ad(this,b,f);f+=4;m=ad(this,b,f);f+=4;i[j]+=1;i[l]+=1;i[m]+=1;k.push([j,l,m]);p.push(new M(0,0,0))}for(r=0;r<h;r++){var j=k[r][0],l=k[r][1],m=k[r][2],u=e.get(j);f=
e.get(l);var x=e.get(m),u=new M(u[0],u[1],u[2]),x=new M(x[0],x[1],x[2]);f=(new M(f[0],f[1],f[2])).d().ka(u);u=x.d().ka(u);f=Uc(f,u).normalize();p[j]=p[j].add(f);p[l]=p[l].add(f);p[m]=p[m].add(f)}for(r=0;r<h;r++)j=k[r][0],l=k[r][1],m=k[r][2],u=e.get(j),f=e.get(l),x=e.get(m),c.add(u[0],u[1],u[2]),c.add(f[0],f[1],f[2]),c.add(x[0],x[1],x[2]),j=p[j].scale(1/i[j]).normalize(),l=p[l].scale(1/i[l]).normalize(),m=p[m].scale(1/i[m]).normalize(),d.add(j.x,j.y,j.b),d.add(l.x,l.y,l.b),d.add(m.x,m.y,m.b);a.qb(Ed);
c=new Pc;c.Fa=a;this.dispatchEvent(c)};B("X.parserFSM",Jd);B("X.parserFSM.prototype.parse",Jd.prototype.parse);function Kd(a){function b(){Na+=8;return ia<ja.length?ja.charCodeAt(ia++)&255:-1}function c(){var a;Na++;a=U&1;U>>=1;0==U&&(U=b(),a=U&1,U=U>>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 e(a){da++;S[K++]=a;j.push(String.fromCharCode(a));32768==K&&(K=0)}function f(){this.La=this.Ka=0;this.Cc=q;this.Ce=-1}function h(){for(;;){if(Bb[oa]>=De)return-1;if(Ee[Bb[oa]]==oa)return Bb[oa]++;Bb[oa]++}}function i(){var a=Cb[Db],b;u&&document.write("<br>len:"+
oa+" treepos:"+Db);if(17==oa)return-1;Db++;oa++;b=h();u&&document.write("<br>IsPat "+b);if(0<=b)a.Ka=b,u&&document.write("<br>b0 "+a.Ka);else if(a.Ka=32768,u&&document.write("<br>b0 "+a.Ka),i())return-1;b=h();if(0<=b)a.La=b,u&&document.write("<br>b1 "+a.La),a.Cc=q;else if(a.La=32768,u&&document.write("<br>b1 "+a.La),a.Cc=Cb[Db],a.Ce=Db,i())return-1;oa--;return 0}function k(a,b,c){u&&document.write("currentTree "+a+" numval "+b+" lengths "+c+" show 0");Cb=a;Db=0;Ee=c;De=b;for(a=0;17>a;a++)Bb[a]=0;
oa=0;if(i())return u&&window.console.log("invalid huffman tree\n"),-1;if(u){document.write("<br>Tree: "+Cb.length);for(a=0;32>a;a++)document.write("Places["+a+"].b0="+Cb[a].Ka+"<br>"),document.write("Places["+a+"].b1="+Cb[a].La+"<br>")}return 0}function p(a){for(var b,d,e=0,f=a[e];;)if(b=c(),u&&document.write("b="+b),b){if(!(f.La&32768))return u&&document.write("ret1"),f.La;f=f.Cc;b=a.length;for(d=0;d<b;d++)if(a[d]===f){e=d;break}}else{if(!(f.Ka&32768))return u&&document.write("ret2"),f.Ka;e++;f=
a[e]}}function r(){var a,h,i,m;do{a=c();h=d(2);switch(h){case 0:u&&window.console.log("Stored\n");break;case 1:u&&window.console.log("Fixed Huffman codes\n");break;case 2:u&&window.console.log("Dynamic Huffman codes\n");break;case 3:u&&window.console.log("Reserved block type!!\n");break;default:u&&window.console.log("Unexpected value %d!\n",h)}if(0==h){var l;U=1;l=b();l|=b()<<8;h=b();h|=b()<<8;for((l^~h)&65535&&document.write("BlockLen checksum mismatch\n");l--;)h=b(),e(h)}else if(1==h)for(var j;;)if(j=
$[d(7)]>>1,23<j?(j=j<<1|c(),199<j?(j-=128,j=j<<1|c()):(j-=48,143<j&&(j+=136))):j+=256,256>j)e(j);else if(256==j)break;else{j-=257;m=d(Va[j])+ea[j];j=$[d(5)]>>3;8<L[j]?(l=d(8),l|=d(L[j]-8)<<8):l=d(L[j]);l+=Eb[j];for(j=0;j<m;j++)h=S[K-l&32767],e(h)}else if(2==h){var r=Array(320);h=257+d(5);l=1+d(5);i=4+d(4);for(j=0;19>j;j++)r[j]=0;for(j=0;j<i;j++)r[N[j]]=d(3);m=qa.length;for(i=0;i<m;i++)qa[i]=new f;if(k(qa,19,r)){K=0;return}if(u){document.write("<br>distanceTree");for(j=0;j<qa.length;j++)document.write("<br>"+
qa[j].Ka+" "+qa[j].La+" "+qa[j].Cc+" "+qa[j].Ce)}m=h+l;i=0;var x=-1;for(u&&document.write("<br>n="+m+" bits: "+Na+"<br>");i<m;)if(x++,j=p(qa),u&&document.write("<br>"+x+" i:"+i+" decode: "+j+" bits "+Na+"<br>"),16>j)r[i++]=j;else if(16==j){var A;j=3+d(2);if(i+j>m){K=0;return}for(A=i?r[i-1]:0;j--;)r[i++]=A}else{j=17==j?3+d(3):11+d(7);if(i+j>m){K=0;return}for(;j--;)r[i++]=0}m=gc.length;for(i=0;i<m;i++)gc[i]=new f;if(k(gc,h,r)){K=0;return}m=gc.length;for(i=0;i<m;i++)qa[i]=new f;j=[];m=r.length;for(i=
h;i<m;i++)j[i-h]=r[i];if(k(qa,l,j)){K=0;return}for(u&&document.write("<br>literalTree");;)if(j=p(gc),256<=j){j-=256;if(0==j)break;j--;m=d(Va[j])+ea[j];j=p(qa);8<L[j]?(l=d(8),l|=d(L[j]-8)<<8):l=d(L[j]);for(l+=Eb[j];m--;)h=S[K-l&32767],e(h)}else e(j)}}while(!a);K=0;U=1}function m(){u&&window.console.log("NEXTFILE");j=[];var a=[];J=s;a[0]=b();a[1]=b();u&&window.console.log("type: "+a[0]+" "+a[1]);120==a[0]&&218==a[1]&&(u&&window.console.log("GEONExT-GZIP"),r(),u&&window.console.log(j.join("")),E[A]=
Array(2),E[A][0]=j.join(""),E[A][1]="geonext.gxt",A++);31==a[0]&&139==a[1]&&(u&&window.console.log("GZIP"),l(),u&&window.console.log(j.join("")),E[A]=Array(2),E[A][0]=j.join(""),E[A][1]="file",A++);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();u&&window.console.log("ZIP-Version: "+a[1]+" "+a[0]/10+"."+a[0]%10);x=b();x|=b()<<8;u&&window.console.log("gpflags: "+x);a=b();a|=b()<<8;u&&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;u&&window.console.log("local CRC: "+c+"\nlocal Size: "+e+"\nlocal CompSize: "+d);c=b();c|=b()<<8;d=b();d|=b()<<8;u&&window.console.log("filelen "+c);e=0;for(Za=[];c--;){var f=b();"/"==f|":"==f?e=0:e<Oa-1&&(Za[e++]=String.fromCharCode(f))}u&&window.console.log("nameBuf: "+Za);Fe||(Fe=Za);for(e=0;e<d;)b(),e++;da=0;8==a&&(r(),u&&window.console.log(j.join("")),E[A]=Array(2),E[A][0]=j.join(""),E[A][1]=Za.join(""),
A++);l()}}function l(){var a=[],c;x&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(),u&&window.console.log("CRC:"));J&&m();a[0]=b();if(8!=a[0])u&&window.console.log("Unknown compression method!");else{x=b();u&&x&-32&&window.console.log("Unknown flags set!");b();b();b();b();b();b();if(x&4){a[0]=b();a[2]=b();oa=a[0]+256*a[1];u&&window.console.log("Extra field size: "+oa);for(a=0;a<oa;a++)b()}if(x&8){a=0;for(Za=[];c=b();){if("7"==
c||":"==c)a=0;a<Oa-1&&(Za[a++]=c)}u&&window.console.log("original file name: "+Za)}if(x&16)for(;b(););x&2&&(b(),b());r();b();b();b();b();b();b();b();b();J&&m()}}var j=[],u=s,x,A=0,E=[],S=Array(32768),K=0,J=s,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],Va=[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],Eb=[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],L=[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],N=[16,17,18,0,8,7,9,6,10,
5,11,4,12,3,13,2,14,1,15],ja=a,ia=0,U=1,Na=0,Oa=256,Za=[],Fe,gc=Array(288),qa=Array(32),Db=0,Cb=q,oa=0,Bb=Array(17);Bb[0]=0;var Ee,De;Kd.prototype.Yg=function(){u&&window.console.log(ja);m();return E}};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,e,f,h,i,k,p,d=d[1].split(/\r?\n/);for(k=0,p=d.length;k<p;k++)if(e=d[k],e.match(/NRRD\d+/))this.Uf=o;else if(!e.match(/^#/)&&(i=e.match(/(.*):(.*)/)))f=i[1].trim(),e=i[2].trim(),(h=this.If[f])?h.call(this,e):this[f]=e;this.Uf||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 M(1,0,0),new M(0,
1,0),new M(0,0,1)],this.Nd)){d=[];for(i=0;2>=i;i++)d.push(!isNaN(this.Nd[i])?this.V[i].scale(this.Nd[i]):n)}i=0;i="gzip"==this.encoding||"gz"==this.encoding?(new Kd(b.substr(c))).Yg()[0][0]:b.substr(c);k=this.$a[0]*this.$a[1]*this.$a[2];c=Array(k);d=-Infinity;p=Infinity;for(e=0;e<k;e++)f=this.Hc(i,0+e*this.Gc),c[e]=f,d=Math.max(d,f),p=Math.min(p,f);a.ea=[this.$a[0],this.$a[1],this.$a[2]];a.H=[(new M(this.V[0][0],this.V[0][1],this.V[0][2])).Xa(),(new M(this.V[1][0],this.V[1][1],this.V[1][2])).Xa(),
(new M(this.V[2][0],this.V[2][1],this.V[2][2])).Xa()];a.Fb=[p,d];a.df(p,d);a.oa();k=this.$a;e=d;i=k[2];d=k[1];k=k[0];f=d*k;p=Array(i);for(h=0;h<i;h++){p[h]=Array(d);for(var r=0;r<d;r++)p[h][r]=new Uint8Array(k)}for(r=r=0;r<i;r++){h=c.slice(r*f,(r+1)*f);for(var m=new Uint8Array(4*f),l=0,j=0,u=0,l=0;l<d;l++)for(j=0;j<k;j++){var x=h[u],x=255*(x/e),A=4*u;m[A]=x;m[++A]=x;m[++A]=x;m[++A]=255;p[r][l][j]=x;u++}l=h=new Dd;l.Eb=m;l.c=o;m=h;m.nc=k;m.c=o;m=h;m.mc=d;m.c=o;a.be.children()[r].Nc(h)}for(l=0;l<d;l++){m=
new Uint8Array(4*i*k);for(r=u=0;r<i;r++)for(j=0;j<k;j++)x=p[r][l][j],A=4*u,m[A]=x,m[++A]=x,m[++A]=x,m[++A]=255,u++;c=h=new Dd;c.Eb=m;c.c=o;c=h;c.nc=k;c.c=o;c=h;c.mc=i;c.c=o;a.ae.children()[l].Nc(h)}for(j=0;j<k;j++){m=new Uint8Array(4*i*d);for(r=u=0;r<i;r++)for(l=0;l<d;l++)x=p[r][l][j],A=4*u,m[A]=x,m[++A]=x,m[++A]=x,m[++A]=255,u++;c=h=new Dd;c.Eb=m;c.c=o;c=h;c.nc=d;c.c=o;c=h;c.mc=i;c.c=o;a.$d.children()[j].Nc(h)}c=new Pc;c.Fa=a;this.dispatchEvent(c)};
Ld.prototype.If={type:function(a){switch(a){case "unsigned char":case "uint8":this.Hc=this.r;this.Gc=1;break;case "signed char":case "int8":this.Hc=this.sg;this.Gc=1;break;case "short":case "signed short":case "unsigned short":case "short int":case "int16":this.Hc=this.Ic;this.Gc=2;break;case "int":case "int32":break;case "float":this.Hc=this.Zb;this.Gc=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,e;d=a.split(/\s+/);e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(parseInt(a,10));return this.$a=e},"space directions":function(a){var b,c,d;c=a.match(/\(.*?\)/g);return this.V=function(){var a,f,h;h=[];for(a=0,f=c.length;a<f;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,e;e=[];for(c=0,d=b.length;c<d;c++)a=b[c],e.push(parseFloat(a));return this.Nd=e}};B("X.parserNRRD",Ld);B("X.parserNRRD.prototype.parse",Ld.prototype.parse);function Md(){O.call(this);this._className="loader";this.wb=q;this.Db=0}C(Md,O);function Nd(a){w(a.wb)||(a.wb=new Jb);return a.wb}function Od(a){return!w(a.wb)?o:!a.wb.pd(s)}Md.prototype.Wf=function(a){Pd(this,1.7);setTimeout(function(){Wc(a.S.file());a.Xb();Nd(this).set(a.id(),o)}.bind(this),100)};function Pd(a,b){a.Db+=b/Nd(a).$()/3;1<a.Db&&(a.Db=1);var c=new Qc;c.ce=a.Db;a.dispatchEvent(c)}Md.prototype.Ee=function(){g(Error("Could not get the file."))};
Md.prototype.Vf=function(a,b){Pd(this,1);setTimeout(function(){var c=b.file().path().split(".").pop().toLowerCase();"stl"==c?(c=new dd,oc(c,uc,this.Yb.bind(this)),c.parse(b,a.response)):"vtk"==c?(c=new Id,oc(c,uc,this.Yb.bind(this)),c.parse(b,a.response)):"trk"==c?(c=new bd,oc(c,uc,this.Yb.bind(this)),c.parse(b,a.response)):"fsm"==c?(c=new Jd,oc(c,uc,this.Yb.bind(this)),c.parse(b,a.response)):"nrrd"==c&&(c=new Ld,oc(c,uc,this.Yb.bind(this)),c.parse(b,a.response))}.bind(this),100)};
Md.prototype.Yb=function(a){Pd(this,1);setTimeout(function(){var b=a.Fa;Wc(b.file());b.Xb();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?s: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}v=Rd.prototype;v.d=function(){return new Rd(this.left,this.top,this.width,this.height)};v.toString=function(){return"("+this.left+", "+this.top+" - "+this.width+"w x "+this.height+"h)"};
v.Ae=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 s};v.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};
v.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=xb(arguments,1),e;e=c;for(var f=0,h=0;h<d.length;h++)0<=pb(e,d[h])||(e.push(d[h]),f++);e=f==d.length;a.className=c.join(" ");return e};var Ud=!D||ib(9);!Sa&&!D||D&&ib(9)||Sa&&gb("1.9.1");D&&gb("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){jb(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="',ya(d.name),'"');if(d.type){c.push(' type="',ya(d.type),'"');var e={};nb(e,d);d=e;delete d.type}c.push(">");c=c.join("")}c=a.createElement(c);d&&(y(d)?c.className=d:ka(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 e=2;e<c.length;e++){var f=c[e];la(f)&&!(na(f)&&0<f.nodeType)?qb(de(f)?wb(f):f,d):d(f)}}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(na(a))return"function"==typeof a.item||"string"==typeof a.item;if(ma(a))return"function"==typeof a.item}return s}function Wd(a){this.t=a||ca.document||document}v=Wd.prototype;
v.xc=Vd;v.e=function(a){return y(a)?this.t.getElementById(a):a};v.jb=function(a,b,c){return be(this.t,arguments)};v.createElement=function(a){return this.t.createElement(a)};v.createTextNode=function(a){return this.t.createTextNode(a)};function he(a){return"CSS1Compat"==a.t.compatMode}function ie(a){var b=a.t,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)}v.appendChild=function(a,b){a.appendChild(b)};
v.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 D&&!ib(9)&&!he(Vd(a))?a.body:a.documentElement}
function ne(a){var b=a.getBoundingClientRect();D&&(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(D&&!ib(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.t.body,e=c.t.documentElement,f=!F&&"CSS1Compat"==c.t.compatMode?c.t.documentElement:c.t.body;a=oe(a);)if((!D||0!=a.clientWidth)&&(!F||0!=a.clientHeight||a!=d)&&a!=d&&a!=e&&"visible"!=le(a,"overflow")){var h=qe(a),i;i=a;if(Sa&&!gb("1.9")){var k=parseFloat(je(i,"borderLeftWidth"));if(re(i))var p=i.offsetWidth-i.clientWidth-k-parseFloat(je(i,"borderRightWidth")),k=k+p;i=new V(k,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=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,f);c=c.t.parentWindow||c.t.defaultView||window;e=c.document;F&&!gb("500")&&!Ta?("undefined"==typeof c.innerHeight&&(c=window),e=c.innerHeight,a=c.document.documentElement.scrollHeight,c==c.top&&a<e&&(e-=15),c=new pd(c.innerWidth,e)):(c="CSS1Compat"==
e.compatMode?e.documentElement:e.body,c=new pd(c.clientWidth,c.clientHeight));b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&b.bottom>b.top&&b.right>b.left?b:q}
function qe(a){var b,c=Xd(a),d=le(a,"position"),e=Sa&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new V(0,0),h=me(c);if(a==h)return f;if(a.getBoundingClientRect)b=ne(a),a=ie(Vd(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!e)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(h),f.x=b.screenX-a.screenX,f.y=b.screenY-a.screenY;else{b=a;do{f.x+=b.offsetLeft;f.y+=b.offsetTop;b!=a&&(f.x+=b.clientLeft||0,f.y+=b.clientTop||0);
if(F&&"fixed"==le(b,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(Ra||F&&"absolute"==d)f.y-=c.body.offsetTop;for(b=a;(b=oe(b))&&b!=c.body&&b!=h;)if(f.x-=b.scrollLeft,!Ra||"TR"!=b.tagName)f.y-=b.scrollTop}return f}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,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=ue(a);b.display=c;b.position=e;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 e=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return e}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.m=[]}C(ze,Qb);var Ae=[];function Be(a,b,c,d,e){ka(c)||(Ae[0]=c,c=Ae);for(var f=0;f<c.length;f++)a.m.push(G(b,c[f],d||a,e||s,a.ba||a))}ze.prototype.Jc=function(){qb(this.m,qc);this.m.length=0};ze.prototype.s=function(){ze.C.s.call(this);this.Jc()};ze.prototype.handleEvent=function(){g(Error("EventHandler.handleEvent not implemented"))};function Ce(){}(function(a){a.qe=function(){return a.Rf||(a.Rf=new a)}})(Ce);Ce.prototype.Ed=0;Ce.qe();function Ge(a){this.ga=a||Vd()}C(Ge,Vc);v=Ge.prototype;v.Qf=Ce.qe();v.xe=q;v.Wa=s;v.h=q;v.mb=q;v.ib=q;v.Lb=q;v.bh=s;v.e=t("h");v.Ld=function(a){this.mb&&this.mb!=a&&g(Error("Method not supported"));Ge.C.Ld.call(this,a)};v.xc=t("ga");v.jb=function(){this.h=this.ga.createElement("div")};v.$b=function(a){this.pb(a)};v.pb=function(a,b){this.Wa&&g(Error("Component already rendered"));this.h||this.jb();a?a.insertBefore(this.h,b||q):this.ga.t.body.appendChild(this.h);(!this.mb||this.mb.Wa)&&this.wc()};
v.wc=function(){this.Wa=o;He(this,function(a){!a.Wa&&a.e()&&a.wc()})};v.Ob=function(){He(this,function(a){a.Wa&&a.Ob()});this.zc&&this.zc.Jc();this.Wa=s};v.s=function(){Ge.C.s.call(this);this.Wa&&this.Ob();this.zc&&(this.zc.Z(),delete this.zc);He(this,function(a){a.Z()});!this.bh&&this.h&&ee(this.h);this.mb=this.h=this.Lb=this.ib=q};v.Tb=function(){return!!this.ib&&0!=this.ib.length};function He(a,b){a.ib&&qb(a.ib,b,n)}
v.removeChild=function(a,b){if(a){var c=y(a)?a:a.xe||(a.xe=":"+(a.Qf.Ed++).toString(36)),a=this.Lb&&c?(c in this.Lb?this.Lb[c]:n)||q:q;if(c&&a){var d=this.Lb;c in d&&delete d[c];ub(this.ib,a);b&&(a.Ob(),a.h&&ee(a.h));c=a;c==q&&g(Error("Unable to set parent component"));c.mb=q;Ge.C.Ld.call(c,q)}}a||g(Error("Child is not in parent component"));return a};function Ie(){}C(Ie,Vc);v=Ie.prototype;v.Pd=0;v.Wb=0;v.Dd=100;v.pe=0;v.Od=1;v.Tf=s;v.Zf=s;v.Oc=function(a){a=Je(this,a);this.Pd!=a&&(this.Pd=a+this.pe>this.Dd?this.Dd-this.pe:a<this.Wb?this.Wb:a,!this.Tf&&!this.Zf&&this.dispatchEvent("change"))};v.yc=function(){return Je(this,this.Pd)};v.Sb=function(){return Je(this,this.Wb)};v.Rb=function(){return Je(this,this.Dd)};function Je(a,b){return a.Od==q?b:a.Wb+Math.round((b-a.Wb)/a.Od)*a.Od};function Ke(a){this.ga=a||Vd();this.nb=new Ie;G(this.nb,"change",this.Nf,s,this)}C(Ke,Ge);var Le={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};v=Ke.prototype;v.jb=function(){this.da=this.xc().jb("div","progress-bar-thumb");var a=Le[this.Pe];this.h=this.xc().jb("div",a,this.da);Me(this);this.e().setAttribute("aria-valuemin",this.Sb());this.e().setAttribute("aria-valuemax",this.Rb())};
v.wc=function(){Ke.C.wc.call(this);D&&7>Ya&&G(this.e(),"resize",this.Qc,s,this);this.Qc();var a=this.e();a.setAttribute("role","progressbar");a.Bh="progressbar";this.e().setAttribute("aria-live","polite")};v.Ob=function(){Ke.C.Ob.call(this);Ne(this)};function Ne(a){D&&7>Ya&&pc(a.e(),"resize",a.Qc,s,a)}v.yc=function(){return this.nb.yc()};v.Oc=function(a){this.nb.Oc(a);this.e()&&Me(this)};function Me(a){var b=a.yc();a.e().setAttribute("aria-valuenow",b)}v.Sb=function(){return this.nb.Sb()};v.Rb=function(){return this.nb.Rb()};
v.Pe="horizontal";v.Nf=function(){this.Qc();this.dispatchEvent("change")};v.Qc=function(){if(this.da){var a=this.Sb(),b=this.Rb(),a=(this.yc()-a)/(b-a),b=Math.round(100*a);"vertical"==this.Pe?D&&7>Ya?(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+"%"}};v.s=function(){Ne(this);Ke.C.s.call(this);this.da=q;this.nb.Z()};function Oe(a,b){w(a)||g(Error("No valid parent element."));w(b)||g(Error("Invalid initial value."));Ke.call(this);this._className="progressbar";this.Ga=a;this.ic=this.na=q;this.Na=[];this.Na=[".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.Oc(b);this.zd()}C(Oe,Ke);
Oe.prototype.zd=function(){this.Ga.style.position="relative";var a=document.getElementsByTagName("head")[0],b=ae("style");b.type="text/css";b.media="screen";var c=document.createTextNode(this.Na[0]),d=document.createTextNode(this.Na[1]),e=document.createTextNode(this.Na[2]);a.appendChild(b);b.appendChild(c);b.appendChild(d);b.appendChild(e);this.na=b;this.$b(this.Ga);a=this.e();a.style.position="absolute";a.style.top=(this.Ga.clientHeight-5)/2;a.style.left=(this.Ga.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.Ga,100),e=d.e();e.style.position="absolute";e.style.top=b;e.style.left=c;(e.firstElementChild!=n?e.firstElementChild:fe(e.firstChild)).classList.add("progress-bar-thumb-done");a.ic=d}Oe.prototype.Ad=function(){this.na&&ee(this.na);this.e()&&ee(this.e());this.ic&&ee(this.ic.e());this.ic=this.na=q};function Qe(a,b,c,d,e){(!w(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));(!w(b)||!(b instanceof Array)||3!=b.length)&&g(Error("Invalid front direction."));(!w(c)||!(c instanceof Array)||3!=c.length)&&g(Error("Invalid up direction."));z(d)||g(Error("Invalid width."));z(e)||g(Error("Invalid height."));I.call(this);this._className="slice";this.j=a;this.Sc=b;this.Sa=c;this.Kb=d;this.eb=e;this.Ra=[0,1,0,0,1,1,1,1,1,0,0,0];this.Ib=q;this.oa()}C(Qe,I);
Qe.prototype.oa=function(){this.k.clear();var a=new M(this.Sc[0],this.Sc[1],this.Sc[2]),b=new M(this.Sa[0],this.Sa[1],this.Sa[2]),c=Uc(b,a),d=new M(this.j[0],this.j[1],this.j[2]),e=new M(1,1,1);1==a.x?(e=new M(this.j[0],this.eb/2,this.Kb/2),this.Ra=[0,0,1,0,0,1,0,1,1,1,1,0]):1==a.y?(e=new M(this.Kb/2,this.j[1],this.eb/2),this.Ra=[0,0,0,1,1,0,1,0,1,1,0,1]):1==a.b&&(e=new M(this.Kb/2,this.eb/2,this.j[2]));var f=Tc(c.d().B(),b.d().B()),f=new M(f.x*e.x,f.y*e.y,f.b*e.b);f.add(d);var h=Tc(c.d().B(),b),
h=new M(h.x*e.x,h.y*e.y,h.b*e.b);h.add(d);var i=Tc(c,b.d().B()),i=new M(i.x*e.x,i.y*e.y,i.b*e.b);i.add(d);var k=i,b=Tc(c,b),b=new M(b.x*e.x,b.y*e.y,b.b*e.b);b.add(d);d=h;this.k.add(f.x,f.y,f.b);this.k.add(h.x,h.y,h.b);this.k.add(i.x,i.y,i.b);this.k.add(k.x,k.y,k.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)};B("X.slice",Qe);function Re(){O.call(this);this._className="shader";this.qc="";this.qc="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.jc="";this.jc="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,O);var Se={qh:"vertexPosition",ph:"vertexNormal",oh:"vertexColor",rh:"vertexTexturePos"},Te={sh:"view",ih:"perspective",dh:"center",hh:"objectTransform",lh:"useObjectColor",fh:"objectColor",jh:"pointSize",gh:"objectOpacity",eh:"normal",mh:"usePicking",nh:"useTexture",kh:"textureSampler",th:"volumeLowerThreshold",wh:"volumeUpperThreshold",vh:"volumeScalarMin",uh:"volumeScalarMax"};
function Ue(a){var b=Object.keys(Te);Object.keys(Se).every(function(a){a=eval("X.shaders.attributes."+a);return-1!=this.qc.search(a)||-1!=this.jc.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.qc.search(a)||-1!=this.jc.search(a)}.bind(a))||g(Error("Could not find all uniforms in the shader sources."))}B("X.shaders.attributes",Se);B("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.Wc=this._indexZ=this.Vc=this._indexY=this.Uc=this._indexX=0;this.$d=new I;this.ae=new I;this.be=new I;this._lowerThreshold=0;this._upperThreshold=1E3;this.Fb=[0,1E3];this.de=this._volumeRendering=s;this.Jb=0}C(Ve,I);v=Ve.prototype;
v.oa=function(){this.children().length=0;this.children().push(this.$d);this.children().push(this.ae);this.children().push(this.be);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 e=-b*this.H[a]+d*this.H[a],f=[[this.j[0]+e,this.j[1],this.j[2]],[this.j[0],this.j[1]+e,this.j[2]],[this.j[0],this.j[1],this.j[2]+e]],e=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]);f=new Qe(f[a],[[1,0,0],[0,1,0],[0,0,1]][a],[[0,1,0],[0,0,-1],[0,1,0]][a],h,i);f.Ib=this;f.u(d==c);e.push(f)}0==a?this.Uc=this._indexX=c:1==a?this.Vc=this._indexY=c:2==a&&(this.Wc=this._indexZ=c)}this.c=o};
v.Xb=function(){this._volumeRendering!=this.de&&(this.c=o,this.de=this._volumeRendering);if(this._volumeRendering)We(this,this.Jb);else{if(this.c){var a=this.children()[this.Jb];a.u(s)}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.Uc,this.Uc=this._indexX):1==b?(c=this._indexY,d=this.Vc,this.Vc=this._indexY):2==b&&(c=this._indexZ,d=this.Wc,this.Wc=this._indexZ);a.children()[parseInt(d,10)].u(s);a.children()[parseInt(c,10)].u(o)}}Ve.C.Xb.call(this)};v.Ff=t("ea");
v.Ag=t("Fb");v.df=function(a,b){(!w(a)||!z(a)||!w(b)||!z(b)||a>b||a<this.Fb[0]||b>this.Fb[1])&&g(Error("Invalid threshold range."));this._lowerThreshold=a;this._upperThreshold=b};v.Mg=aa();v.Dg=function(a){(!w(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.Jb)){a.children()[0].children()[parseInt(a._indexX,10)].u(s);a.children()[1].children()[parseInt(a._indexY,10)].u(s);a.children()[2].children()[parseInt(a._indexZ,10)].u(s);var c=a.children()[a.Jb];c.u(s);c=a.children()[b];c.u(o);a.Jb=b}}B("X.volume",Ve);B("X.volume.prototype.dimensions",Ve.prototype.Ff);B("X.volume.prototype.scalarRange",Ve.prototype.Ag);B("X.volume.prototype.setCenter",Ve.prototype.Dg);
B("X.volume.prototype.setVolumeRendering",Ve.prototype.Mg);B("X.volume.prototype.threshold",Ve.prototype.df);B("X.volume.prototype.modified",Ve.prototype.Xb);function Xe(a){this.Ta=a||Ye}function Ye(a,b){return""+a<""+b?-1:""+a>""+b?1:0}v=Xe.prototype;v.N=q;v.Ta=q;v.sa=q;v.ra=q;v.g=0;
v.add=function(a){if(this.N==q)return this.ra=this.sa=this.N=new Ze(a),this.g=1,o;var b=s;$e(this,function(c){var d=q;if(0<this.Ta(c.value,a)){if(d=c.left,c.left==q){var e=new Ze(a,c);c.left=e;c==this.sa&&(this.sa=e);b=o;af(this,c)}}else 0>this.Ta(c.value,a)&&(d=c.right,c.right==q&&(e=new Ze(a,c),c.right=e,c==this.ra&&(this.ra=e),b=o,af(this,c)));return d});b&&(this.g+=1);return b};
v.remove=function(a){var b=q;$e(this,function(c){var d=q;if(0<this.Ta(c.value,a))d=c.left;else if(0>this.Ta(c.value,a))d=c.right;else if(b=c.value,c.left!=q||c.right!=q){var e=q,f;if(c.left!=q){f=bf(this,c.left);if(f!=c.left){if(f.parent.right=f.left)f.left.parent=f.parent;f.left=c.left;f.left.parent=f;e=f.parent}f.parent=c.parent;f.right=c.right;f.right&&(f.right.parent=f);c==this.ra&&(this.ra=f)}else{f=cf(this,c.right);if(f!=c.right){if(f.parent.left=f.right)f.right.parent=f.parent;f.right=c.right;
f.right.parent=f;e=f.parent}f.parent=c.parent;f.left=c.left;f.left&&(f.left.parent=f);c==this.sa&&(this.sa=f)}df(c)?c.parent.left=f:ef(c)?c.parent.right=f:this.N=f;af(this,e?e:f)}else df(c)?(c.parent.left=q,c==this.sa&&(this.sa=c.parent),af(this,c.parent)):ef(c)?(c.parent.right=q,c==this.ra&&(this.ra=c.parent),af(this,c.parent)):this.clear();return d});b&&(this.g=this.N?this.g-1:0);return b};v.clear=function(){this.ra=this.sa=this.N=q;this.g=0};
v.contains=function(a){var b=s;$e(this,function(c){var d=q;0<this.Ta(c.value,a)?d=c.left:0>this.Ta(c.value,a)?d=c.right:b=o;return d});return b};v.$=t("g");v.Sb=function(){return cf(this).value};v.Rb=function(){return bf(this).value};v.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 e=d,d=d.right!=q&&d.right!=c?d.right:d.parent;c=e}}}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,e=a.right?a.right.height:0;1<b-e?(a.left.right&&(!a.left.left||a.left.left.height<a.left.right.height)&&gf(this,a.left),hf(this,a)):1<e-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;e=a.right?a.right.height:0;a.height=Math.max(b,e)+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.sa;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.ra;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){w(a)||g(Error("Invalid GL Buffer."));w(b)||g(Error("Invalid number of items."));w(c)||g(Error("Invalid item size."));O.call(this);this._className="buffer";this.R=a;this.ya=b;this.fb=c}C(jf,O);var kf=ca.window;function lf(a,b,c){ma(a)?c&&(a=va(a,c)):a&&"function"==typeof a.handleEvent?a=va(a.handleEvent,a):g(Error("Invalid listener argument"));return 2147483647<b?-1:kf.setTimeout(a,b||0)};function mf(a,b,c,d,e,f,h,i){var k,p=c.offsetParent;if(p){var r="HTML"==p.tagName||"BODY"==p.tagName;if(!r||"static"!=le(p,"position"))k=qe(p),r||(k=od(k,new V(p.scrollLeft,p.scrollTop)))}p=qe(a);r=te(a);p=new Rd(p.x,p.y,r.width,r.height);(r=pe(a))&&p.Ae(new Rd(r.left,r.top,r.right-r.left,r.bottom-r.top));var r=Vd(a),m=Vd(c);if(r.t!=m.t){var l=r.t.body,m=m.t.parentWindow||m.t.defaultView,j=new V(0,0),u=Xd(l)?Xd(l).parentWindow||Xd(l).defaultView:window,x=l;do{var A;if(u==m)A=qe(x);else{var E=x;A=
new V;if(1==E.nodeType)if(E.getBoundingClientRect)E=ne(E),A.x=E.left,A.y=E.top;else{var S=ie(Vd(E)),E=qe(E);A.x=E.x-S.x;A.y=E.y-S.y}else{var S=ma(E.Mf),K=E;E.targetTouches?K=E.targetTouches[0]:S&&E.ha.targetTouches&&(K=E.ha.targetTouches[0]);A.x=K.clientX;A.y=K.clientY}}j.x+=A.x;j.y+=A.y}while(u&&u!=m&&(x=u.frameElement)&&(u=u.parent));l=od(j,qe(l));D&&!he(r)&&(l=od(l,ie(r)));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);k&&(b=od(b,k));
e&&(b.x+=(a&2?-1:1)*e.x,b.y+=(a&1?-1:1)*e.y);var J;if(h&&(J=pe(c))&&k)J.top-=k.y,J.right-=k.x,J.bottom-=k.y,J.left-=k.x;return nf(b,c,d,f,J,h,i)}
function nf(a,b,c,d,e,f,h){var a=a.d(),i=0,k=(c&4&&re(b)?c^2:c)&-5,c=te(b),h=h?h.d():c.d();if(d||0!=k)k&2?a.x-=h.width+(d?d.right:0):d&&(a.x+=d.left),k&1?a.y-=h.height+(d?d.bottom:0):d&&(a.y+=d.top);if(f){if(e){i=a;d=0;if(65==(f&65)&&(i.x<e.left||i.x>=e.right))f&=-2;if(132==(f&132)&&(i.y<e.top||i.y>=e.bottom))f&=-5;i.x<e.left&&f&1&&(i.x=e.left,d|=1);i.x<e.left&&i.x+h.width>e.right&&f&16&&(h.width=Math.max(h.width-(i.x+h.width-e.right),0),d|=4);i.x+h.width>e.right&&f&1&&(i.x=Math.max(e.right-h.width,
e.left),d|=1);f&2&&(d|=(i.x<e.left?16:0)|(i.x+h.width>e.right?32:0));i.y<e.top&&f&4&&(i.y=e.top,d|=2);i.y>=e.top&&i.y+h.height>e.bottom&&f&32&&(h.height=Math.max(h.height-(i.y+h.height-e.bottom),0),d|=8);i.y+h.height>e.bottom&&f&4&&(i.y=Math.max(e.bottom-h.height,e.top),d|=2);f&8&&(d|=(i.y<e.top?64:0)|(i.y+h.height>e.bottom?128:0));i=d}else i=256;if(i&496)return i}f=a;e=Sa&&(Ja||Xa)&&gb("1.9");f instanceof V?(a=f.x,f=f.y):(a=f,f=n);b.style.left=se(a,e);b.style.top=se(f,e);qd(c,h)||(a=he(Vd(Xd(b))),
D&&(!a||!gb("8"))?(c=b.style,a?(D?(a=we(b,ke(b,"paddingLeft")),e=we(b,ke(b,"paddingRight")),f=we(b,ke(b,"paddingTop")),d=we(b,ke(b,"paddingBottom")),a=new Qd(f,e,d,a)):(a=je(b,"paddingLeft"),e=je(b,"paddingRight"),f=je(b,"paddingTop"),d=je(b,"paddingBottom"),a=new Qd(parseFloat(f),parseFloat(e),parseFloat(d),parseFloat(a))),D?(e=ye(b,"borderLeft"),f=ye(b,"borderRight"),d=ye(b,"borderTop"),b=ye(b,"borderBottom"),b=new Qd(d,f,b,e)):(e=je(b,"borderLeftWidth"),f=je(b,"borderRightWidth"),d=je(b,"borderTopWidth"),
b=je(b,"borderBottomWidth"),b=new Qd(parseFloat(d),parseFloat(f),parseFloat(b),parseFloat(e))),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.ie=b}C(pf,of);pf.prototype.ja=function(a,b,c){mf(this.element,this.ie,a,b,n,c)};function qf(a,b){this.ba=new ze(this);this.Kd(a||q);b&&this.qb(b)}C(qf,Vc);v=qf.prototype;v.h=q;v.zf=o;v.ee=q;v.L=s;v.Og=s;v.Bd=-1;v.Pf=s;v.Hf=o;v.rb="toggle_display";v.qb=ba("rb");v.e=t("h");v.Kd=function(a){this.L&&g(Error("Can not change this state of the popup while showing."));this.h=a};
v.u=function(a){this.dc&&this.dc.stop();this.Ub&&this.Ub.stop();if(a){if(!this.L&&this.Gd()){this.h||g(Error("Caller must call setElement before trying to show the popup"));this.ja();a=Xd(this.h);this.Pf&&Be(this.ba,a,"keydown",this.ag,o);if(this.zf)if(Be(this.ba,a,"mousedown",this.Me,o),D){var b;try{b=a.activeElement}catch(c){}for(;b&&"IFRAME"==b.nodeName;){try{var d=b.contentDocument||b.contentWindow.document}catch(e){break}a=d;b=a.activeElement}Be(this.ba,a,"mousedown",this.Me,o);Be(this.ba,a,
"deactivate",this.Le)}else Be(this.ba,a,"blur",this.Le);"toggle_display"==this.rb?(this.h.style.visibility="visible",ve(this.h,o)):"move_offscreen"==this.rb&&this.ja();this.L=o;this.dc?(oc(this.dc,"end",this.Oe,s,this),this.dc.play()):this.Oe()}}else rf(this)};v.ja=fa;function rf(a,b){if(!a.L||!a.dispatchEvent({type:"beforehide",target:b}))return s;a.ba&&a.ba.Jc();a.Ub?(oc(a.Ub,"end",wa(a.he,b),s,a),a.Ub.play()):a.he(b);return o}
v.he=function(a){"toggle_display"==this.rb?this.Og?lf(this.we,0,this):this.we():"move_offscreen"==this.rb&&(this.h.style.left="-200px",this.h.style.top="-200px");this.L=s;this.Hd(a)};v.we=function(){this.h.style.visibility="hidden";ve(this.h,s)};v.Gd=function(){return this.dispatchEvent("beforeshow")};v.Oe=function(){this.Bd=xa();this.dispatchEvent("show")};v.Hd=function(a){xa();this.dispatchEvent({type:"hide",target:a})};
v.Me=function(a){a=a.target;!ge(this.h,a)&&(!this.ee||ge(this.ee,a))&&!(150>xa()-this.Bd)&&rf(this,a)};v.ag=function(a){27==a.keyCode&&rf(this,a.target)&&(a.preventDefault(),a.stopPropagation())};v.Le=function(a){if(this.Hf){var b=Xd(this.h);if(D||Ra){if(a=b.activeElement,!a||ge(this.h,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>xa()-this.Bd||rf(this)}};v.s=function(){qf.C.s.call(this);this.ba.Z();Sb(this.dc);Sb(this.Ub);delete this.h;delete this.ba};function sf(a,b){this.qd=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.qd,c,q,d)};function tf(a,b){this.ug=4;this.Jd=b||n;qf.call(this,a)}C(tf,qf);tf.prototype.Mc=function(a){this.Jd=a||n;this.L&&this.ja()};tf.prototype.ja=function(){if(this.Jd){var a=!this.L&&"move_offscreen"!=this.rb,b=this.e();a&&(b.style.visibility="hidden",ve(b,o));this.Jd.ja(b,this.ug,this.zh);a&&ve(b,s)}};function uf(a,b,c){this.ga=c||(a?Vd(Yd(a)):Vd());tf.call(this,this.ga.jb("div",{style:"position:absolute;display:none;"}));this.rd=new V(1,1);this.Va=new Nb;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=[];v=uf.prototype;v.I=q;v.className="goog-tooltip";
v.$e=500;v.Of=0;v.xc=t("ga");function vf(a,b){b=Yd(b);a.Va.add(b);G(b,"mouseover",a.te,s,a);G(b,"mouseout",a.Ac,s,a);G(b,"mousemove",a.se,s,a);G(b,"focus",a.re,s,a);G(b,"blur",a.Ac,s,a)}v.detach=function(a){if(a)a=Yd(a),xf(this,a),this.Va.remove(a);else{for(var b=this.Va.aa(),c=0;a=b[c];c++)xf(this,a);this.Va.clear()}};function xf(a,b){pc(b,"mouseover",a.te,s,a);pc(b,"mouseout",a.Ac,s,a);pc(b,"mousemove",a.se,s,a);pc(b,"focus",a.re,s,a);pc(b,"blur",a.Ac,s,a)}
v.Kd=function(a){var b=this.e();b&&ee(b);uf.C.Kd.call(this,a);a&&(b=this.ga.t.body,b.insertBefore(a,b.lastChild))};v.Gd=function(){if(!qf.prototype.Gd.call(this))return s;if(this.anchor)for(var a,b=0;a=wf[b];b++)ge(a.e(),this.anchor)||a.u(s);0<=pb(wf,this)||wf.push(this);a=this.e();a.className=this.className;yf(this);G(a,"mouseover",this.ve,s,this);G(a,"mouseout",this.ue,s,this);zf(this);return o};
v.Hd=function(){ub(wf,this);for(var a=this.e(),b,c=0;b=wf[c];c++)b.anchor&&ge(a,b.anchor)&&b.u(s);this.Re&&Af(this.Re);pc(a,"mouseover",this.ve,s,this);pc(a,"mouseout",this.ue,s,this);this.anchor=n;if(0==(this.ta?this.L?4:1:this.kb?3:this.L?2:0))this.Lc=s;qf.prototype.Hd.call(this)};v.Je=function(a,b){this.anchor==a&&this.Va.contains(this.anchor)&&(this.Lc||!this.Ah?(this.u(s),this.L||(this.anchor=a,this.Mc(b||Bf(this,0)),this.u(o))):this.anchor=n);this.ta=n};
v.Yf=function(a){this.kb=n;a==this.anchor&&(this.I==q||this.I!=this.e()&&!this.Va.contains(this.I))&&(!this.fe||!this.fe.I)&&this.u(s)};function Cf(a,b){var c=ie(a.ga);a.rd.x=b.clientX+c.x;a.rd.y=b.clientY+c.y}v.te=function(a){var b=Df(this,a.target);this.I=b;yf(this);b!=this.anchor&&(this.anchor=b,this.ta||(this.ta=lf(va(this.Je,this,b,n),this.$e)),Ef(this),Cf(this,a))};function Df(a,b){try{for(;b&&!a.Va.contains(b);)b=b.parentNode;return b}catch(c){return q}}
v.se=function(a){Cf(this,a);this.Lc=o};v.re=function(a){this.I=a=Df(this,a.target);this.Lc=o;if(this.anchor!=a){this.anchor=a;var b=Bf(this,1);yf(this);this.ta||(this.ta=lf(va(this.Je,this,a,b),this.$e));Ef(this)}};function Bf(a,b){if(0==b){var c=a.rd.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.fe=a,a.Re=b)}
v.Ac=function(a){var b=Df(this,a.target),c=Df(this,a.relatedTarget);b!=c&&(b==this.I&&(this.I=q),zf(this),this.Lc=s,this.L&&(!a.relatedTarget||!ge(this.e(),a.relatedTarget))?Af(this):this.anchor=n)};v.ve=function(){var a=this.e();this.I!=a&&(yf(this),this.I=a)};v.ue=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.ta&&(kf.clearTimeout(a.ta),a.ta=n)}
function Af(a){if(2==(a.ta?a.L?4:1:a.kb?3:a.L?2:0))a.kb=lf(va(a.Yf,a,a.anchor),a.Of)}function yf(a){a.kb&&(kf.clearTimeout(a.kb),a.kb=n)}v.s=function(){this.u(s);zf(this);this.detach();this.e()&&ee(this.e());this.I=q;delete this.ga;uf.C.s.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.qd,a,4,c,b,9)&496&&nf(this.qd,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.ie,a,b,d,c,9)&496&&mf(this.element,2,a,1,d,c,5)};function Hf(a){this.h=a;this.De=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(D||F&&(Ka||gb("532.0")))c=40;d=F&&Ja&&0!=-a.wheelDelta%c?-a.wheelDelta:-a.wheelDelta/c;ha(a.wheelDeltaX)?(b=F&&Ja&&0!=-a.wheelDeltaX%c?-a.wheelDeltaX:-a.wheelDeltaX/c,c=F&&Ja&&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.He)&&Math.min(Math.max(b,-this.He),this.He);z(this.Ie)&&(c=Math.min(Math.max(c,-this.Ie),
this.Ie));b=new If(d,a,0,c);try{this.dispatchEvent(b)}finally{b.Z()}};Hf.prototype.s=function(){Hf.C.s.call(this);qc(this.De);delete this.De};function If(a,b,c,d){b&&this.qa(b,n);this.type="mousewheel";this.detail=a;this.sd=d}C(If,hc);D||F&&gb("525");function Jf(a){(!w(a)||!(a instanceof Element))&&g(Error("Could not add interactor to the given element."));O.call(this);this._className="interactor";this.cb=a;this.bd=this.Ud=this.Td=this.Vd=this.Sd=this.Wd=q;this.ad=o;this.rightButtonDown=this.middleButtonDown=this.leftButtonDown=s;this.Xc=new Ic(0,0);this.config={MOUSEWHEEL_ENABLED:o,MOUSECLICKS_ENABLED:o,KEYBOARD_ENABLED:o,HOVERING_ENABLED:o,CONTEXTMENU_ENABLED:s}}C(Jf,O);v=Jf.prototype;
v.qa=function(){this.config.MOUSEWHEEL_ENABLED?(this.bd=new Hf(this.cb),this.Wd=G(this.bd,"mousewheel",this.mg.bind(this))):(qc(this.Wd),this.bd=q);this.config.MOUSEWHEEL_ENABLED?(this.Sd=G(this.cb,"mousedown",this.fg.bind(this)),this.Vd=G(this.cb,"mouseup",this.kg.bind(this))):(qc(this.Sd),qc(this.Vd));this.cb.oncontextmenu=this.config.CONTEXTMENU_ENABLED?q:function(){return s};window.onkeydown=this.config.KEYBOARD_ENABLED?this.Ne.bind(this):q;qc(this.Td);qc(this.Ud);this.Td=G(this.cb,"mousemove",
this.hg.bind(this));this.Ud=G(this.cb,"mouseout",this.ig.bind(this))};v.fg=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()};v.eg=aa();
v.kg=function(a){0==a.button?this.leftButtonDown=s:1==a.button?this.middleButtonDown=s:2==a.button&&(this.rightButtonDown=s);eval("this.onMouseUp(this['leftButtonDown'],this['middleButtonDown'],this['rightButtonDown'])");Kf(this);a.preventDefault()};v.jg=aa();v.ig=function(a){this.ad=s;this.config.KEYBOARD_ENABLED&&(window.onkeydown=q);this.rightButtonDown=this.middleButtonDown=this.leftButtonDown=s;Kf(this);this.Xc=new Ic(0,0);a.preventDefault()};v.gg=aa();
v.hg=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.ad=o;this.config.KEYBOARD_ENABLED&&window.onkeydown==q&&(window.onkeydown=this.Ne.bind(this));a.preventDefault();var b=a.shiftKey,c=new Ic(a.offsetX,a.offsetY),a=this.Xc.ka(c);this.Xc=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.Tc=setTimeout(function(){Kf(this);var a=new Mc;a.rc=c.x;a.sc=c.y;this.dispatchEvent(a);
this.Tc=q}.bind(this),300));2>Math.abs(a.x)&&(a.x=0);2>Math.abs(a.y)&&(a.y=0);0!=a.Xa()&&(this.leftButtonDown&&!b?(b=new Jc,b.bb=a,b.xh=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.bb=a,this.dispatchEvent(b)):this.rightButtonDown&&(b=new Kc,b.Qa=0<a.y,b.wa=s,this.dispatchEvent(b)))};function Kf(a){a.Tc&&clearTimeout(a.Tc);a.dispatchEvent(new Nc)}v.lg=aa();
v.mg=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");Kf(this);a.preventDefault();var b=new Kc;w(a.sd)||(a.sd=0);b.Qa=0>a.sd;b.wa=o;this.dispatchEvent(b)};v.cg=aa();
v.Ne=function(a){if(this.ad){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");Kf(this);var b=a.altKey,c=a.ctrlKey,d=a.metaKey,e=a.shiftKey,f=a.keyCode;if(82==f&&!b&&!c&&!d&&!e)a.preventDefault(),a=new Oc,this.dispatchEvent(a);else if(37<=f&&40>=f&&(a.preventDefault(),a=e?new Hc:b?new Kc:new Jc))c=new Ic(0,0),37==f?(c.x=5,b&&(a.Qa=o,a.wa=s)):39==f?(c.x=-5,b&&(a.Qa=s,a.wa=s)):38==f?(c.y=5,b&&(a.Qa=o,a.wa=o)):40==f&&(c.y=-5,b&&(a.Qa=s,a.wa=o)),a.bb=c,this.dispatchEvent(a)}};B("X.interactor",Jf);
B("X.interactor.prototype.onMouseDown",Jf.prototype.eg);B("X.interactor.prototype.onMouseUp",Jf.prototype.jg);B("X.interactor.prototype.onMouseMove",Jf.prototype.gg);B("X.interactor.prototype.onMouseWheel",Jf.prototype.lg);B("X.interactor.prototype.onKey",Jf.prototype.cg);function Lf(a,b,c,d){w(a)||g(Error("No valid parent element."));(!z(b)||!z(c))&&g(Error("Invalid coordinates."));(!w(d)||!(d instanceof Jf))&&g(Error("Invalid interactor."));uf.call(this);this._className="caption";this.Ga=a;this.rc=b;this.sc=c;this.kc=d;this.na=q;this.Na=[];this.Na=[".x-tooltip {\n background: #C0C0FF;\n color: #000000;\n border: 1px solid infotext;\n padding: 1px;\n font-family: sans-serif;\n}"];oc(d,Gc,this.Ad.bind(this));this.zd()}C(Lf,uf);
Lf.prototype.zd=function(){this.Ga.style.position="relative";var a=document.getElementsByTagName("head")[0],b=ae("style");b.type="text/css";b.media="screen";var c=document.createTextNode(this.Na[0]);a.appendChild(b);b.appendChild(c);this.na=b;this.Mc(new sf(this.rc,this.sc));this.u(o);vf(this,this.Ga);this.e().classList.add("x-tooltip")};Lf.prototype.Ad=function(){this.u(s);this.na&&ee(this.na);this.e()&&ee(this.e());this.na=q};function Mf(a,b){(!z(a)||!z(b))&&g(Error("A camera needs valid width and height values."));O.call(this);this._className="camera";this.rf=45;this.lc=new M(0,0,100);this.vb=new M(0,0,0);this.Sa=new M(0,1,0);var c=Float32Array,d;d=a/b;var e=1*Math.tan(this.rf*Math.PI/360),f=-e;d=new Y([[2/(e*d-f*d),0,(e*d+f*d)/(e*d-f*d),0],[0,2/(e-f),(e+f)/(e-f),0],[0,0,-10001/9999,-2.000200020002],[0,0,-1,0]]);this.tf=new c(d.A());this.l=Nf(this,this.lc,this.vb);this.Pa=new Float32Array(this.l.A())}C(Mf,O);v=Mf.prototype;
v.rg=function(a){a instanceof Kc||g(Error("Received no valid zoom event."));a.Qa?this.lf(a.wa):this.mf(a.wa)};v.ng=function(a){a instanceof Hc||g(Error("Received no valid pan event."));this.Qe(a.bb)};v.pg=function(a){a instanceof Jc||g(Error("Received no valid rotate event."));this.rotate(a.bb)};v.view=t("l");v.Lg=function(a){(!w(a)||!(a instanceof Y))&&g(Error("Invalid view matrix."));this.l=a;this.Pa=new Float32Array(this.l.A())};v.position=t("lc");
v.Mc=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The position was invalid."));this.lc=new M(a,b,c);this.reset()};v.reset=function(){this.l=Nf(this,this.lc,this.vb);this.Pa=new Float32Array(this.l.A())};v.focus=t("vb");v.Eg=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The focus was invalid."));this.vb=new M(a,b,c);this.reset()};v.Zg=t("Sa");v.Kg=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The up-vector was invalid."));this.Sa=new M(a,b,c);this.reset()};
v.Qe=function(a){a instanceof Ic||g(Error("Invalid distance vector for pan operation."));a=new M(-a.x,a.y,0);a=zd(4).translate(a);this.l=new Y(a.multiply(this.l));this.Pa=new Float32Array(this.l.A());this.dispatchEvent(new Lc)};
v.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 M(parseFloat(wd(this.l,0,0)),parseFloat(wd(this.l,0,1)),parseFloat(wd(this.l,0,2))),b=c.rotate(b,new M(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.Pa=new Float32Array(this.l.A());this.dispatchEvent(new Lc)};
v.lf=function(a){var b=20;w(a)&&!a&&(b=1);a=new M(0,0,b);a=zd(4).translate(a);this.l=new Y(a.multiply(this.l));this.Pa=new Float32Array(this.l.A());this.dispatchEvent(new Lc)};v.mf=function(a){var b=30;w(a)&&!a&&(b=1);a=new M(0,0,-b);a=zd(4).translate(a);this.l=new Y(a.multiply(this.l));this.Pa=new Float32Array(this.l.A());this.dispatchEvent(new Lc)};
function Nf(a,b,c){(!(b instanceof M)||!(c instanceof M))&&g(Error("3D vectors required for calculating the view."));var d=zd(4),c=new M(b.x-c.x,b.y-c.y,b.b-c.b),c=c.normalize(),a=a.Sa.d();a.Mb(c)&&(a.b+=1.0E-6);var e=Uc(a,c),a=Uc(c,e),e=e.normalize(),a=a.normalize();W(d,0,0,e.x);W(d,0,1,e.y);W(d,0,2,e.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())}
B("X.camera",Mf);B("X.camera.prototype.view",Mf.prototype.view);B("X.camera.prototype.setView",Mf.prototype.Lg);B("X.camera.prototype.position",Mf.prototype.position);B("X.camera.prototype.setPosition",Mf.prototype.Mc);B("X.camera.prototype.focus",Mf.prototype.focus);B("X.camera.prototype.setFocus",Mf.prototype.Eg);B("X.camera.prototype.up",Mf.prototype.Zg);B("X.camera.prototype.setUp",Mf.prototype.Kg);B("X.camera.prototype.pan",Mf.prototype.Qe);B("X.camera.prototype.rotate",Mf.prototype.rotate);
B("X.camera.prototype.zoomIn",Mf.prototype.lf);B("X.camera.prototype.zoomOut",Mf.prototype.mf);function Z(a){w(a)||g(Error("An ID to a valid container (<div>..) is required."));a=Yd(a);(!(na(a)&&1==a.nodeType)||0==a.clientWidth||0==a.clientHeight)&&g(Error("Could not find the given container or it has an undefined size."));O.call(this);this._className="renderer";this.va=a;this.Kb=this.va.clientWidth;this.eb=this.va.clientHeight;this.kc=this.n=this.fd=this.a=this.Ma=q;this.gb=new Xe(Hd);this.jd=[];this.zb=this.Cb=this.yb=this.Bb=this.xb=this.Ab=q;this.j=[0,0,0];this.Xd=q;this.Rc=new Jb;this.Gb=
new Jb;this.Hb=new Jb;this.cd=new Jb;this.hc=new Jb;this.oc=new Jb;this.hd=new Jb;this.fa=this.Yc=q;this.Zc=s;this.config={PROGRESSBAR_ENABLED:o,PICKING_ENABLED:o,ORDERING_ENABLED:o,STATISTICS_ENABLED:s};window.console.log("XTK Release 3 -- 3/12/12 -- http://www.goXTK.com")}C(Z,O);v=Z.prototype;v.width=t("Kb");v.height=t("eb");v.canvas=function(){w(this.Ma)||(this.Ma=ae("canvas"));return this.Ma};v.Df=t("va");v.Af=t("n");v.Sf=t("kc");
function Of(a){w(a.Yc)||(a.Yc=new Md,G(Of(a),Ec,a.og.bind(a)));return a.Yc}v.og=function(a){this.fa&&this.fa.Oc(100*a.ce)};v.dg=function(a){w(a)&&a instanceof Pc&&Pf(this,a.Fa)};v.bg=function(a){if(w(a)&&a instanceof Mc){var b=a.rc,a=a.sc,c=this.get(this.Se(b,a));if(c&&(c=c.caption()))(new Lf(this.va,this.va.offsetLeft+b+10,this.va.offsetTop+a+10,this.kc)).e().innerHTML=c}};v.wg=function(){this.zb=this.Cb=this.yb=this.Bb=this.xb=this.Ab=q;this.j=[0,0,0]};
function Qf(a){a.config.PROGRESSBAR_ENABLED&&a.fa&&!a.Zd&&(Pe(a.fa),a.Zd=lf(function(){this.Zd=q;this.fa&&(this.fa.Ad(),this.fa=q);this.$b()}.bind(a),700))}v.We=function(){this.n.reset();this.pb(s,s)};
v.qa=function(){var a=this.canvas();a.width=this.width();a.height=this.height();this.va.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(),e=b.createRenderbuffer(),f=b.createTexture();b.bindTexture(b.TEXTURE_2D,f);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,e);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,f,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e);b.bindFramebuffer(b.FRAMEBUFFER,q);this.Xd=d}}catch(h){g(Error("Exception while accessing GL Context!\n"+h))}d=new Jf(a);d.qa();G(d,Dc,this.We.bind(this));G(d,Fc,this.bg.bind(this));e=new Mf(this.width(),this.height());(!w(d)||!(d instanceof Jf))&&g(Error("Could not observe the interactor."));G(d,zc,e.ng.bind(e));G(d,Ac,e.pg.bind(e));G(d,Bc,e.rg.bind(e));
G(e,Cc,this.pb.bind(this,s,s));this.Ma=a;this.a=b;this.n=e;this.kc=d;Rf(this)};
function Rf(a){var b=new Re;(!w(a.Ma)||!w(a.a)||!w(a.n))&&g(Error("Renderer was not initialized properly."));(!w(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.jc);a.a.shaderSource(d,b.qc);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)));b=a.a.createProgram();a.a.attachShader(b,d);a.a.attachShader(b,c);a.a.linkProgram(b);a.a.getProgramParameter(b,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(b)));a.a.useProgram(b);a.fd=b;Object.keys(Se).forEach(function(a){a=eval("X.shaders.attributes."+a);this.Rc.set(a,this.a.getAttribLocation(this.fd,a));this.a.enableVertexAttribArray(this.Rc.get(a))}.bind(a));
Object.keys(Te).forEach(function(a){a=eval("X.shaders.uniforms."+a);this.Gb.set(a,this.a.getUniformLocation(this.fd,a))}.bind(a))}v.add=function(a){this.jd.push(a);Pf(this,a)};
function Pf(a,b){(!w(a.Ma)||!w(a.a)||!w(a.n))&&g(Error("Renderer was not initialized properly."));(!w(b)||!(b instanceof I))&&g(Error("Illegal object."));var c=s;a.get(b.id())&&(c=o);tc(b)||G(b,uc,a.dg.bind(a));var d=b.id(),e=b.k,f=b.o,h=b.W,i=b.S,k=b.file(),p=b.transform();if(w(i)&&w(i.file())&&i.file().c)c=Of(a),w(b.S)||g(Error("Internal error during texture loading.")),d=new Image,i=b.S.file().path(),d.src=i,b.S.Rd=d,oc(d,"load",c.Wf.bind(c,b)),Nd(c).set(b.id(),s),Pd(c,0.3);else if(w(k)&&k.c)c=
Of(a),w(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.Ee.bind(c,i,b)),G(i,"error",c.Ee.bind(c,i,b)),G(i,"load",c.Vf.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(),
s);else{if(b.c&&b.Tb())for(var k=b.children(),r=k.length,m=0,m=0;m<r;m++)Pf(a,k[m]);if(0==e.count())Wc(b);else{for(k=0;a.Zc;)k++;a.Zc=o;if(e.c||p.c){r=p.f;k=r.ca(new M(e.Ca,e.Da,e.Ea));r=r.ca(new M(e.za,e.Aa,e.Ba));if(a.Ab===q||k.x<a.Ab)a.Ab=k.x;if(a.xb===q||r.x>a.xb)a.xb=r.x;if(a.Bb===q||k.y<a.Bb)a.Bb=k.y;if(a.yb===q||r.y>a.yb)a.yb=r.y;if(a.Cb===q||k.b<a.Cb)a.Cb=k.b;if(a.zb===q||r.b>a.zb)a.zb=r.b;a.j=[(a.Ab+a.xb)/2,(a.Bb+a.yb)/2,(a.Cb+a.zb)/2];Wc(p)}c&&e.c&&(p=a.Hb.get(d),w(p)&&a.a.isBuffer(p.R)&&
a.a.deleteBuffer(p.R));p=q;!c||e.c?(p=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,p),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(e.all()),a.a.STATIC_DRAW),p=new jf(p,e.count(),3),Wc(e)):p=a.Hb.get(d);Pd(Of(a),0.3);c&&f.c&&(k=a.Hb.get(d),w(k)&&a.a.isBuffer(k.R)&&a.a.deleteBuffer(k.R));k=q;!c||f.c?(k=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,k),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(f.all()),a.a.STATIC_DRAW),k=new jf(k,f.count(),3),Wc(f)):k=a.cd.get(d);Pd(Of(a),0.3);c&&
h.c&&(f=a.hc.get(d),w(f)&&a.a.isBuffer(f.R)&&a.a.deleteBuffer(f.R));f=q;0<h.length()&&(!c||h.c?(h.length()!=e.length()&&g(Error("Mismatch between points and point colors.")),e=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,e),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(h.all()),a.a.STATIC_DRAW),f=new jf(e,h.count(),3),Wc(h)):f=a.hc.get(d));Pd(Of(a),0.3);c&&w(i)&&i.c&&(h=a.oc.get(d),w(h)&&a.a.isBuffer(h.R)&&a.a.deleteBuffer(h.R));h=q;w(i)&&(!c||i.c?(h=b.Ra,w(h)||g(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),
e=a.a.createTexture(),e.yd=i.yd(),a.hd.set(i.id(),e),a.a.bindTexture(a.a.TEXTURE_2D,e),i.Eb?(a.a.texImage2D(a.a.TEXTURE_2D,0,a.a.RGBA,i.nc,i.mc,0,a.a.RGBA,a.a.UNSIGNED_BYTE,i.Eb),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,e.yd),a.a.pixelStorei(a.a.UNPACK_FLIP_Y_WEBGL,s)),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),e=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,e),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(h),a.a.STATIC_DRAW),h=new jf(e,h.length,2),Wc(i)):h=a.oc.get(d));Pd(Of(a),0.1);!c&&!a.gb.add(b)&&g(Error("Could not add object to this renderer."));a.Hb.set(d,p);a.cd.set(d,k);a.hc.set(d,f);a.oc.set(d,h);Wc(b);a.Zc=s}}}
v.$b=function(){(!this.Ma||!this.a||!this.n)&&g(Error("The renderer was not initialized properly."));w(this.Yd)||(Od(Of(this))?this.fa?(Qf(this),eval("this.onShowtime()")):this.pb(s,o):(this.config.PROGRESSBAR_ENABLED&&!this.fa&&(this.fa=new Oe(this.va,3)),this.Yd=lf(function(){this.Yd=q;this.$b()}.bind(this),100)))};v.qg=aa();v.get=function(a){w(a)||g(Error("Invalid object id."));for(var b=this.gb.aa(),c=0,d=b.length,c=0;c<d;c++)if(b[c].id()==a)return b[c];return q};
v.Se=function(a,b){if(this.config.PICKING_ENABLED){this.pb(o,s);var c=new Uint8Array(4);this.a.readPixels(a,this.eb-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);var d=Math.round(10*(c[0]/255)),e=Math.round(10*(c[1]/255)),c=Math.round(10*(c[2]/255));return 100*d+10*e+c}return-1};
v.pb=function(a,b){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.Xd):this.a.bindFramebuffer(this.a.FRAMEBUFFER,q);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var c=this.n.tf,d=this.n.Pa;this.a.uniformMatrix4fv(this.Gb.get("perspective"),s,c);this.a.uniformMatrix4fv(this.Gb.get("view"),s,d);c=this.j;this.a.uniform3f(this.Gb.get("center"),parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2]));if(this.config.ORDERING_ENABLED)a:{var e=s,c=this.gb.aa(),d=c.length,f;f=d-1;do{var h=c[f];
if(!h)break a;var i=h._opacity,k=h.Ib;h instanceof Qe&&(i=k&&k._volumeRendering?h._opacity=h.Ib._opacity:h._opacity=1);1!=i&&(e=h.k.gc,h=this.n.l.ca(h.pc.f.ca(new M(e[0],e[1],e[2]))),h=Sc(this.n.vb,h),c[f].vc=h,e=o)}while(f--);if(e){this.gb.clear();f=d-1;do this.gb.add(c[f]);while(f--)}}if(c=!a&&w(b)&&b&&this.config.STATISTICS_ENABLED)var p=0,r=0,m=0,l=0;f=this.jd.length;for(d=0;d<f;++d)if(h=this.jd[d],h instanceof Ve){var j=new M(1,0,0),j=this.n.view().ca(j),e=Sc(this.n.focus(),j),j=new M(-1,0,0),
j=this.n.view().ca(j),i=Sc(this.n.focus(),j),j=new M(0,1,0),j=this.n.view().ca(j),k=Sc(this.n.focus(),j),j=new M(0,-1,0),j=this.n.view().ca(j),u=Sc(this.n.focus(),j),j=new M(0,0,1),j=this.n.view().ca(j),x=Sc(this.n.focus(),j),j=new M(0,0,-1),j=this.n.view().ca(j),j=Sc(this.n.focus(),j),A=Math.max(e,k,x,i,u,j);A==e||A==i?We(h,0):A==k||A==u?We(h,1):(A==x||A==j)&&We(h,2)}d=this.Rc;f=d.get("vertexPosition");var h=d.get("vertexNormal"),e=d.get("vertexColor"),i=d.get("vertexTexturePos"),d=this.Gb,k=d.get("usePicking"),
u=d.get("useObjectColor"),x=d.get("objectColor"),j=d.get("objectOpacity"),A=d.get("useTexture"),E=d.get("textureSampler"),S=d.get("volumeLowerThreshold"),K=d.get("volumeUpperThreshold"),J=d.get("volumeScalarMin"),da=d.get("volumeScalarMax"),$=d.get("objectTransform"),ea=d.get("pointSize"),Va=this.gb.aa(),Eb=Va.length,d=Eb;do{var L=Va[Eb-d];if(L&&L._visible){var N=L._id,ja=L._magicMode,ia=this.Hb.get(N),U=this.cd.get(N),Na=this.hc.get(N),Oa=this.oc.get(N);this.a.bindBuffer(this.a.ARRAY_BUFFER,ia.R);
this.a.vertexAttribPointer(f,ia.fb,this.a.FLOAT,s,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,U.R);this.a.vertexAttribPointer(h,U.fb,this.a.FLOAT,s,0,0);a?this.a.uniform1i(k,o):this.a.uniform1i(k,s);Na&&!a&&!ja?(this.a.uniform1i(u,s),this.a.bindBuffer(this.a.ARRAY_BUFFER,Na.R),this.a.vertexAttribPointer(e,Na.fb,this.a.FLOAT,s,0,0)):(U=1,ja&&!a&&(U=0),this.a.uniform1i(u,U),ja=L._color,a&&(999<N&&g(Error("Id out of bounds.")),ja=Math.floor(0.01*N),U=Math.floor(0.1*N)-10*ja,ja=[ja/10,U/10,(N-100*ja-10*
U)/10]),this.a.uniform3f(x,parseFloat(ja[0]),parseFloat(ja[1]),parseFloat(ja[2])),this.a.vertexAttribPointer(e,ia.fb,this.a.FLOAT,s,0,0));this.a.uniform1f(j,parseFloat(L._opacity));L.S&&Oa&&!a?(this.a.uniform1i(A,o),this.a.activeTexture(this.a.TEXTURE0),this.a.bindTexture(this.a.TEXTURE_2D,this.hd.get(L.S._id)),this.a.uniform1i(E,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,Oa.R),this.a.vertexAttribPointer(i,Oa.fb,this.a.FLOAT,s,0,0)):(this.a.uniform1i(A,s),this.a.vertexAttribPointer(i,ia.fb,this.a.FLOAT,
s,0,0));L instanceof Qe&&L.Ib&&(N=L.Ib,this.a.uniform1f(S,N._lowerThreshold),this.a.uniform1f(K,N._upperThreshold),Oa=N.Fb,this.a.uniform1f(J,Oa[0]),this.a.uniform1f(da,Oa[1]),N._volumeRendering&&this.a.uniform1f(j,parseFloat(N._opacity)));this.a.uniformMatrix4fv($,s,L.pc.ma);N=1;"POINTS"==L._type&&(N=L._pointSize);this.a.uniform1f(ea,N);N=-1;L.type()==Ed?(N=this.a.TRIANGLES,c&&(r+=ia.ya/3)):L.type()==cd?(this.a.lineWidth(L.lineWidth()),N=this.a.LINES,c&&(m+=ia.ya/2)):"POINTS"==L.type()?(N=this.a.POINTS,
c&&(l+=ia.ya)):"TRIANGLE_STRIPS"==L.type()?(N=this.a.TRIANGLE_STRIP,c&&(r+=ia.ya/3)):"POLYGONS"==L.type()&&(N=0==ia.ya%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,c&&(r+=ia.ya/3));c&&(p+=ia.ya);this.a.drawArrays(N,0,ia.ya)}}while(--d);c&&(p="Objects: "+Eb+" | "+("Vertices: "+p+" | ")+("Triangles: "+Math.round(r)+" | "),p=p+("Lines: "+m+" | ")+("Points: "+l+" | ")+("Textures: "+this.hd.$()),window.console.log(p))};B("X.renderer",Z);B("X.renderer.prototype.width",Z.prototype.width);
B("X.renderer.prototype.height",Z.prototype.height);B("X.renderer.prototype.canvas",Z.prototype.canvas);B("X.renderer.prototype.container",Z.prototype.Df);B("X.renderer.prototype.camera",Z.prototype.Af);B("X.renderer.prototype.interactor",Z.prototype.Sf);B("X.renderer.prototype.resetBoundingBox",Z.prototype.wg);B("X.renderer.prototype.resetViewAndRender",Z.prototype.We);B("X.renderer.prototype.init",Z.prototype.qa);B("X.renderer.prototype.add",Z.prototype.add);
B("X.renderer.prototype.onShowtime",Z.prototype.qg);B("X.renderer.prototype.get",Z.prototype.get);B("X.renderer.prototype.pick",Z.prototype.Se);B("X.renderer.prototype.render",Z.prototype.$b);function Sf(a){function b(a,b){var a=a*2*Math.PI,b=b*Math.PI,e=new Q(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));h.push(new R(c.Ya(e.ua(d)),e))}this.i=[];for(var a=a||{},c=new Q(a.nd||[0,0,0]),d=a.ia||1,e=a.Md||16,a=a.Pg||8,f=[],h,i=0;i<e;i++)for(var k=0;k<a;k++)h=[],b(i/e,k/a),0<k&&b((i+1)/e,k/a),k<a-1&&b((i+1)/e,(k+1)/a),b(i/e,(k+1)/a),f.push(new ld(h));return nd(f)}C(Sf,T);B("CSG.sphere",Sf);function Tf(a,b){(!w(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.ed=b;this.gd=32;this.xf=16;this.oa()}C(Tf,I);Tf.prototype.oa=function(){Gd(this,new Sf({nd:this.j,ia:this.ed,Md:this.gd,Pg:this.xf}))};B("X.sphere",Tf);function Uf(a){function b(a,b,d){b=2*b*Math.PI;b=k.ua(Math.cos(b)).Ya(p.ua(Math.sin(b)));a=c.Ya(e.ua(a)).Ya(b.ua(f));d=b.ua(1-Math.abs(d)).Ya(h.ua(d));return new R(a,d)}this.i=[];for(var a=a||{},c=new Q(a.start||[0,-1,0]),d=new Q(a.end||[0,1,0]),e=d.lb(c),f=a.ia||1,a=a.Md||16,h=e.sb(),i=0.5<Math.abs(h.y()),k=(new Q(i,!i,0)).uc(h).sb(),p=k.uc(h).sb(),i=new R(c,h.Ec()),d=new R(d,h.sb()),r=[],m=0;m<a;m++){var l=m/a,j=(m+1)/a;r.push(new ld([i,b(0,l,-1),b(0,j,-1)]));r.push(new ld([b(0,j,0),b(0,l,0),b(1,
l,0),b(1,j,0)]));r.push(new ld([d,b(1,j,1),b(1,l,1)]))}return nd(r)}C(Uf,T);B("CSG.cylinder",Uf);function Vf(a,b,c){(!w(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid start position."));(!w(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.yf=a;this.qf=b;this.ed=c;this.gd=32;this.oa()}C(Vf,I);Vf.prototype.oa=function(){Gd(this,new Uf({start:this.yf,end:this.qf,ia:this.ed,Md:this.gd}))};B("X.cylinder",Vf);function Wf(a){this.i=[];var a=a||{},b=new Q(a.nd||[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(e){e=new Q(b.x()+c[0]*(2*!!(e&1)-1),b.y()+c[1]*(2*!!(e&2)-1),b.b()+c[2]*(2*!!(e&4)-1));return new R(e,new Q(a[1]))}))}))}C(Wf,T);B("CSG.cube",Wf);function Xf(a,b,c,d){(!w(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.uf=b;this.vf=c;this.wf=d;this.Ra=[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.oa()}C(Xf,I);Xf.prototype.oa=function(){Gd(this,new Wf({nd:this.j,ia:[this.uf,this.vf,this.wf]}))};B("X.cube",Xf);