-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxtk.js
More file actions
303 lines (303 loc) · 140 KB
/
xtk.js
File metadata and controls
303 lines (303 loc) · 140 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
/*
*
* xxxxxxx xxxxxxx
* x:::::x x:::::x
* x:::::x x:::::x
* x:::::xx:::::x
* x::::::::::x
* x::::::::x
* x::::::::x
* x::::::::::x
* x:::::xx:::::x
* x:::::x x:::::x
* x:::::x x:::::x
* THE xxxxxxx xxxxxxx TOOLKIT
*
* http://www.goXTK.com
*
* Copyright (c) 2012 The X Toolkit Developers <dev@goXTK.com>
*
* The X Toolkit (XTK) is licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* "Free software" is a matter of liberty, not price.
* "Free" as in "free speech", not as in "free beer".
* - Richard M. Stallman
*
* FUELED BY:
* - the wonderful Constructive Solid Geometry library by Evan Wallace (http://madebyevan.com)
* LICENSE: https://raw.github.com/xtk/X/master/lib/csg/LICENSE
*
* - parts of the Google Closure Library (http://code.google.com/closure/library)
* LICENSE: https://raw.github.com/xtk/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 i(a){throw a;}var m=void 0,n=!0,q=null,r=!1;function da(){return function(){}}function ea(a){return function(b){this[a]=b}}function t(a){return function(){return this[a]}}var u,fa=this;function ga(){}
function ha(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ia(a){return a!==m}function x(a){return a!=q}function ja(a){return"array"==ha(a)}function ka(a){var b=ha(a);return"array"==b||"object"==b&&"number"==typeof a.length}function la(a){return"string"==typeof a}function z(a){return"number"==typeof a}function ma(a){return"function"==ha(a)}function na(a){a=ha(a);return"object"==a||"array"==a||"function"==a}function oa(a){return a[qa]||(a[qa]=++ra)}
var qa="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ra=0;function sa(a,b,c){return a.call.apply(a.bind,arguments)}function ua(a,b,c){a||i(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")?sa: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 D(a,b){var c=a.split("."),d=fa;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&ia(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}function E(a,b){function c(){}c.prototype=b.prototype;a.i=b.prototype;a.prototype=new c;a.prototype.constructor=a};function Aa(a,b,c){this.Aa=this.za=this.ya=0;3==arguments.length?(this.ya=Number(a),this.za=Number(b),this.Aa=Number(c)):a instanceof Aa?(this.ya=Number(a.x()),this.za=Number(a.y()),this.Aa=Number(a.b())):(this.ya=Number(a[0]),this.za=Number(a[1]),this.Aa=Number(a[2]))}
Aa.prototype={f:function(){return new Aa(this.ya,this.za,this.Aa)},Se:function(){return new Aa(-this.ya,-this.za,-this.Aa)},rc:function(a){return new Aa(this.ya+a.x(),this.za+a.y(),this.Aa+a.b())},$c:function(a){return new Aa(this.ya-a.x(),this.za-a.y(),this.Aa-a.b())},Cb:function(a){return new Aa(this.ya*a,this.za*a,this.Aa*a)},ah:function(a){return new Aa(this.ya/a,this.za/a,this.Aa/a)},oc:function(a){return this.ya*a.x()+this.za*a.y()+this.Aa*a.b()},$f:function(a,b){return this.rc(a.$c(this).Cb(b))},
length:function(){return Math.sqrt(this.oc(this))},gd:function(){return this.ah(this.length())},Ae:function(a){return new Aa(this.za*a.b()-this.Aa*a.y(),this.Aa*a.x()-this.ya*a.b(),this.ya*a.y()-this.za*a.x())},x:t("ya"),y:t("za"),b:t("Aa")};var H=H||{};H.Pi=n;H.Ga=function(a){eval("X.DEV === undefined")||window.console.time(a)};H.Ba=function(a){eval("X.DEV === undefined")||window.console.timeEnd(a)};window["X.counter"]=new function(){this.Lg=0;this.Li=function(){return this.Lg++}};function Ba(a,b){for(var c in b){var d=b.__lookupGetter__(c),e=b.__lookupSetter__(c);d||e?(d&&a.__defineGetter__(c,d),e&&a.__defineSetter__(c,e)):a[c]=b[c]}}
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&&i(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});
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.cd;++c)window.cd=window[b[c]+"RequestAnimationFrame"],window.ve=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];window.cd||(window.cd=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g});window.ve||(window.ve=function(a){clearTimeout(a)})})();D("Function.prototype.bind",Function.prototype.bind);D("window.requestAnimationFrame",window.cd);
D("window.cancelAnimationFrame",window.ve);function Ca(a){if(!Da.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Ea,"&"));-1!=a.indexOf("<")&&(a=a.replace(Fa,"<"));-1!=a.indexOf(">")&&(a=a.replace(Ha,">"));-1!=a.indexOf('"')&&(a=a.replace(Ia,"""));return a}var Ea=/&/g,Fa=/</g,Ha=/>/g,Ia=/\"/g,Da=/[&<>\"]/;var Ja,Ka,La,Ma,Na,Oa,Pa;function Ra(){return fa.navigator?fa.navigator.userAgent:q}function Sa(){return fa.navigator}Na=Ma=La=Ka=Ja=r;var Ta;if(Ta=Ra()){var Ua=Sa();Ja=0==Ta.indexOf("Opera");Ka=!Ja&&-1!=Ta.indexOf("MSIE");Ma=(La=!Ja&&-1!=Ta.indexOf("WebKit"))&&-1!=Ta.indexOf("Mobile");Na=!Ja&&!La&&"Gecko"==Ua.product}var Va=Ja,I=Ka,Wa=Na,Xa=La,Ya=Ma,$a,ab=Sa();$a=ab&&ab.platform||"";Oa=-1!=$a.indexOf("Mac");Pa=-1!=$a.indexOf("Win");var bb=!!Sa()&&-1!=(Sa().appVersion||"").indexOf("X11"),cb;
a:{var db="",eb;if(Va&&fa.opera)var ib=fa.opera.version,db="function"==typeof ib?ib():ib;else if(Wa?eb=/rv\:([^\);]+)(\)|;)/:I?eb=/MSIE\s+([^\);]+)(\)|;)/:Xa&&(eb=/WebKit\/(\S+)/),eb)var jb=eb.exec(Ra()),db=jb?jb[1]:"";if(I){var kb,lb=fa.document;kb=lb?lb.documentMode:m;if(kb>parseFloat(db)){cb=""+kb;break a}}cb=db}var mb={};
function nb(a){var b;if(!(b=mb[a])){b=0;for(var c=(""+cb).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 g=c[f]||"",h=d[f]||"",l=RegExp("(\\d*)(\\D*)","g"),j=RegExp("(\\d*)(\\D*)","g");do{var k=l.exec(g)||["","",""],o=j.exec(h)||["","",""];if(0==k[0].length&&0==o[0].length)break;b=((0==k[1].length?0:parseInt(k[1],10))<(0==o[1].length?0:parseInt(o[1],10))?-1:(0==k[1].length?0:parseInt(k[1],
10))>(0==o[1].length?0:parseInt(o[1],10))?1:0)||((0==k[2].length)<(0==o[2].length)?-1:(0==k[2].length)>(0==o[2].length)?1:0)||(k[2]<o[2]?-1:k[2]>o[2]?1:0)}while(0==b)}b=mb[a]=0<=b}return b}var pb={};function qb(a){return pb[a]||(pb[a]=I&&document.documentMode&&document.documentMode>=a)};function rb(a,b){for(var c in a)b.call(m,a[c],c,a)}function sb(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function tb(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}var ub="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");function vb(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<ub.length;f++)c=ub[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var wb=Array.prototype,xb=wb.indexOf?function(a,b,c){return wb.indexOf.call(a,b,c)}:function(a,b,c){c=c==q?0:0>c?Math.max(0,a.length+c):c;if(la(a))return!la(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},yb=wb.forEach?function(a,b,c){wb.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=la(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},zb=wb.map?function(a,b,c){return wb.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=
la(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Ab=wb.some?function(a,b,c){return wb.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=la(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return n;return r},Bb=wb.every?function(a,b,c){return wb.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=la(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return r;return n};function Cb(a,b){var c=xb(a,b);0<=c&&wb.splice.call(a,c,1)}
function Db(a){return wb.concat.apply(wb,arguments)}function Hb(a){if(ja(a))return Db(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b}function Ib(a,b,c){return 2>=arguments.length?wb.slice.call(a,b):wb.slice.call(a,b,c)};function Jb(a){if("function"==typeof a.na)a=a.na();else if(ka(a)||la(a))a=a.length;else{var b=0,c;for(c in a)b++;a=b}return a}function Kb(a){if("function"==typeof a.Yb)return a.Yb();if(la(a))return a.split("");if(ka(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return sb(a)}
function Lb(a,b){if("function"==typeof a.every)return a.every(b,m);if(ka(a)||la(a))return Bb(a,b,m);var c;if("function"==typeof a.Wc)c=a.Wc();else if("function"!=typeof a.Yb)if(ka(a)||la(a)){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=tb(a);else c=m;for(var d=Kb(a),e=d.length,f=0;f<e;f++)if(!b.call(m,d[f],c&&c[f],a))return r;return n};var Mb="StopIteration"in fa?fa.StopIteration:Error("StopIteration");function Nb(){}Nb.prototype.next=function(){i(Mb)};Nb.prototype.xc=function(){return this};function Ob(a){if(a instanceof Nb)return a;if("function"==typeof a.xc)return a.xc(r);if(ka(a)){var b=0,c=new Nb;c.next=function(){for(;;){b>=a.length&&i(Mb);if(b in a)return a[b++];b++}};return c}i(Error("Not implemented"))}
function Pb(a,b){if(ka(a))try{yb(a,b,m)}catch(c){c!==Mb&&i(c)}else{a=Ob(a);try{for(;;)b.call(m,a.next(),m,a)}catch(d){d!==Mb&&i(d)}}};function Qb(a,b){this.C={};this.v=[];var c=arguments.length;if(1<c){c%2&&i(Error("Uneven number of arguments"));for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.se(a)}u=Qb.prototype;u.L=0;u.hd=0;u.na=t("L");u.Yb=function(){Rb(this);for(var a=[],b=0;b<this.v.length;b++)a.push(this.C[this.v[b]]);return a};u.Wc=function(){Rb(this);return this.v.concat()};u.ye=function(a){for(var b=0;b<this.v.length;b++){var c=this.v[b];if(Sb(this.C,c)&&this.C[c]==a)return n}return r};
u.Sc=function(a,b){if(this===a)return n;if(this.L!=a.na())return r;var c=b||Tb;Rb(this);for(var d,e=0;d=this.v[e];e++)if(!c(this.get(d),a.get(d)))return r;return n};function Tb(a,b){return a===b}u.clear=function(){this.C={};this.hd=this.L=this.v.length=0};u.remove=function(a){return Sb(this.C,a)?(delete this.C[a],this.L--,this.hd++,this.v.length>2*this.L&&Rb(this),n):r};
function Rb(a){if(a.L!=a.v.length){for(var b=0,c=0;b<a.v.length;){var d=a.v[b];Sb(a.C,d)&&(a.v[c++]=d);b++}a.v.length=c}if(a.L!=a.v.length){for(var e={},c=b=0;b<a.v.length;)d=a.v[b],Sb(e,d)||(a.v[c++]=d,e[d]=1),b++;a.v.length=c}}u.get=function(a,b){return Sb(this.C,a)?this.C[a]:b};u.set=function(a,b){Sb(this.C,a)||(this.L++,this.v.push(a),this.hd++);this.C[a]=b};u.se=function(a){var b;a instanceof Qb?(b=a.Wc(),a=a.Yb()):(b=tb(a),a=sb(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};u.f=function(){return new Qb(this)};
u.xc=function(a){Rb(this);var b=0,c=this.v,d=this.C,e=this.hd,f=this,g=new Nb;g.next=function(){for(;;){e!=f.hd&&i(Error("The map has changed since the iterator was created"));b>=c.length&&i(Mb);var g=c[b++];return a?g:d[g]}};return g};function Sb(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Ub(a){this.C=new Qb;a&&this.se(a)}function Vb(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+oa(a):b.substr(0,1)+a}u=Ub.prototype;u.na=function(){return this.C.na()};u.add=function(a){this.C.set(Vb(a),a)};u.se=function(a){for(var a=Kb(a),b=a.length,c=0;c<b;c++)this.add(a[c])};u.Rd=function(a){for(var a=Kb(a),b=a.length,c=0;c<b;c++)this.remove(a[c])};u.remove=function(a){return this.C.remove(Vb(a))};u.clear=function(){this.C.clear()};
u.contains=function(a){a=Vb(a);return Sb(this.C.C,a)};u.Yf=function(a){for(var b=new Ub,a=Kb(a),c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};u.Yb=function(){return this.C.Yb()};u.f=function(){return new Ub(this)};u.Sc=function(a){return this.na()==Jb(a)&&Wb(this,a)};
function Wb(a,b){var c=Jb(b);if(a.na()>c)return r;!(b instanceof Ub)&&5<c&&(b=new Ub(b));return Lb(a,function(a){if("function"==typeof b.contains)a=b.contains(a);else if("function"==typeof b.ye)a=b.ye(a);else if(ka(b)||la(b))a=0<=xb(b,a);else a:{for(var c in b)if(b[c]==a){a=n;break a}a=r}return a})}u.xc=function(){return this.C.xc(r)};function Xb(){}Xb.prototype.Kf=r;Xb.prototype.La=function(){this.Kf||(this.Kf=n,this.M())};Xb.prototype.M=function(){this.Yg&&Yb.apply(q,this.Yg)};function Zb(a){a&&"function"==typeof a.La&&a.La()}function Yb(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];ka(d)?Yb.apply(q,d):Zb(d)}};function $b(a,b){this.bg=b;this.Vc=[];a>this.bg&&i(Error("[goog.structs.SimplePool] Initial cannot be greater than max"));for(var c=0;c<a;c++)this.Vc.push(this.Dd())}E($b,Xb);u=$b.prototype;u.Hf=q;u.Jf=q;function ac(a,b){a.Vc.length<a.bg?a.Vc.push(b):a.De(b)}u.Dd=function(){return this.Hf?this.Hf():{}};u.De=function(a){if(this.Jf)this.Jf(a);else if(na(a))if(ma(a.La))a.La();else for(var b in a)delete a[b]};u.M=function(){$b.i.M.call(this);for(var a=this.Vc;a.length;)this.De(a.pop());delete this.Vc};function bc(){this.Tc=[];this.Ye=new Qb;this.xg=this.yg=this.zg=this.ug=0;this.fd=new Qb;this.Ef=this.wg=0;this.Te=1;this.Ee=new $b(0,4E3);this.Ee.Dd=function(){return new cc};this.vg=new $b(0,50);this.vg.Dd=function(){return new dc};var a=this;this.Ie=new $b(0,2E3);this.Ie.Dd=function(){return""+a.Te++};this.Ie.De=da()}function dc(){this.lf=this.time=this.count=0}
dc.prototype.toString=function(){var a=[];a.push(this.type," ",this.count," (",Math.round(10*this.time)/10," ms)");this.lf&&a.push(" [VarAlloc = ",this.lf,"]");return a.join("")};function cc(){}function ec(a,b,c,d){var e=[];-1==c?e.push(" "):e.push(fc(a.Lf-c));e.push(" ",gc(a.Lf-b));0==a.Fe?e.push(" Start "):1==a.Fe?(e.push(" Done "),e.push(fc(a.Ej-a.startTime)," ms ")):e.push(" Comment ");e.push(d,a);0<a.Hi&&e.push("[VarAlloc ",a.Hi,"] ");return e.join("")}
cc.prototype.toString=function(){return this.type==q?this.Vg:"["+this.type+"] "+this.Vg};bc.prototype.reset=function(){for(var a=0;a<this.Tc.length;a++){var b=this.Ee.id;b&&ac(this.Ie,b);ac(this.Ee,this.Tc[a])}this.Tc.length=0;this.Ye.clear();this.ug=xa();this.Ef=this.wg=this.xg=this.yg=this.zg=0;b=this.fd.Wc();for(a=0;a<b.length;a++){var c=this.fd.get(b[a]);c.count=0;c.time=0;c.lf=0;ac(this.vg,c)}this.fd.clear()};
bc.prototype.toString=function(){for(var a=[],b=-1,c=[],d=0;d<this.Tc.length;d++){var e=this.Tc[d];1==e.Fe&&c.pop();a.push(" ",ec(e,this.ug,b,c.join("")));b=e.Lf;a.push("\n");0==e.Fe&&c.push("| ")}if(0!=this.Ye.na()){var f=xa();a.push(" Unstopped timers:\n");Pb(this.Ye,function(b){a.push(" ",b," (",f-b.startTime," ms, started at ",gc(b.startTime),")\n")})}b=this.fd.Wc();for(d=0;d<b.length;d++)c=this.fd.get(b[d]),1<c.count&&a.push(" TOTAL ",c,"\n");a.push("Total tracers created ",this.wg,"\n","Total comments created ",
this.Ef,"\n","Overhead start: ",this.zg," ms\n","Overhead end: ",this.yg," ms\n","Overhead comment: ",this.xg," ms\n");return a.join("")};function fc(a){var a=Math.round(a),b="";1E3>a&&(b=" ");100>a&&(b=" ");10>a&&(b=" ");return b+a}function gc(a){a=Math.round(a);return(""+(100+a/1E3%60)).substring(1,3)+"."+(""+(1E3+a%1E3)).substring(1,4)}new bc;function hc(){}var ic=0;u=hc.prototype;u.key=0;u.tc=r;u.ue=r;u.la=function(a,b,c,d,e,f){ma(a)?this.Zf=n:a&&a.handleEvent&&ma(a.handleEvent)?this.Zf=r:i(Error("Invalid listener argument"));this.Yc=a;this.qg=b;this.src=c;this.type=d;this.capture=!!e;this.Ge=f;this.ue=r;this.key=++ic;this.tc=r};u.handleEvent=function(a){return this.Zf?this.Yc.call(this.Ge||this.src,a):this.Yc.handleEvent.call(this.Yc,a)};!I||qb(9);var jc=!I||qb(9),kc=I&&!nb("8");!Xa||nb("528");Wa&&nb("1.9b")||I&&nb("8")||Va&&nb("9.5")||Xa&&nb("528");!Wa||nb("8");function lc(a,b){this.type=a;this.currentTarget=this.target=b}E(lc,Xb);u=lc.prototype;u.M=function(){delete this.type;delete this.target;delete this.currentTarget};u.ac=r;u.dd=n;u.stopPropagation=function(){this.ac=n};u.preventDefault=function(){this.dd=r};function mc(a){mc[" "](a);return a}mc[" "]=ga;function nc(a,b){a&&this.la(a,b)}E(nc,lc);u=nc.prototype;u.target=q;u.relatedTarget=q;u.offsetX=0;u.offsetY=0;u.clientX=0;u.clientY=0;u.screenX=0;u.screenY=0;u.button=0;u.keyCode=0;u.charCode=0;u.ctrlKey=r;u.altKey=r;u.shiftKey=r;u.metaKey=r;u.Ua=q;
u.la=function(a,b){var c=this.type=a.type;lc.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(Wa){var e;a:{try{mc(d.nodeName);e=n;break a}catch(f){}e=r}e||(d=q)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=Xa||a.offsetX!==m?a.offsetX:a.layerX;this.offsetY=Xa||a.offsetY!==m?a.offsetY:a.layerY;this.clientX=a.clientX!==m?a.clientX:a.pageX;this.clientY=a.clientY!==m?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.Ua=a;delete this.dd;delete this.ac};u.stopPropagation=function(){nc.i.stopPropagation.call(this);this.Ua.stopPropagation?this.Ua.stopPropagation():this.Ua.cancelBubble=n};
u.preventDefault=function(){nc.i.preventDefault.call(this);var a=this.Ua;if(a.preventDefault)a.preventDefault();else if(a.returnValue=r,kc)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};u.kh=t("Ua");u.M=function(){nc.i.M.call(this);this.relatedTarget=this.currentTarget=this.target=this.Ua=q};var oc={},pc={},qc={},rc={};
function J(a,b,c,d,e){if(b){if(ja(b)){for(var f=0;f<b.length;f++)J(a,b[f],c,d,e);return q}var d=!!d,g=pc;b in g||(g[b]={L:0,Ea:0});g=g[b];d in g||(g[d]={L:0,Ea:0},g.L++);var g=g[d],h=oa(a),l;g.Ea++;if(g[h]){l=g[h];for(f=0;f<l.length;f++)if(g=l[f],g.Yc==c&&g.Ge==e){if(g.tc)break;return l[f].key}}else l=g[h]=[],g.L++;f=sc();f.src=a;g=new hc;g.la(c,f,a,b,d,e);c=g.key;f.key=c;l.push(g);oc[c]=g;qc[h]||(qc[h]=[]);qc[h].push(g);a.addEventListener?(a==fa||!a.If)&&a.addEventListener(b,f,d):a.attachEvent(b in
rc?rc[b]:rc[b]="on"+b,f);return c}i(Error("Invalid event type"))}function sc(){var a=tc,b=jc?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 uc(a,b,c,d,e){if(ja(b))for(var f=0;f<b.length;f++)uc(a,b[f],c,d,e);else a=J(a,b,c,d,e),oc[a].ue=n}
function vc(a,b,c,d,e){if(ja(b))for(var f=0;f<b.length;f++)vc(a,b[f],c,d,e);else{d=!!d;a:{f=pc;if(b in f&&(f=f[b],d in f&&(f=f[d],a=oa(a),f[a]))){a=f[a];break a}a=q}if(a)for(f=0;f<a.length;f++)if(a[f].Yc==c&&a[f].capture==d&&a[f].Ge==e){wc(a[f].key);break}}}
function wc(a){if(!oc[a])return r;var b=oc[a];if(b.tc)return r;var c=b.src,d=b.type,e=b.qg,f=b.capture;c.removeEventListener?(c==fa||!c.If)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(d in rc?rc[d]:rc[d]="on"+d,e);c=oa(c);e=pc[d][f][c];if(qc[c]){var g=qc[c];Cb(g,b);0==g.length&&delete qc[c]}b.tc=n;e.fg=n;xc(d,f,c,e);delete oc[a];return n}
function xc(a,b,c,d){if(!d.Nd&&d.fg){for(var e=0,f=0;e<d.length;e++)d[e].tc?d[e].qg.src=q:(e!=f&&(d[f]=d[e]),f++);d.length=f;d.fg=r;0==f&&(delete pc[a][b][c],pc[a][b].L--,0==pc[a][b].L&&(delete pc[a][b],pc[a].L--),0==pc[a].L&&delete pc[a])}}function yc(a){var b,c=0,d=b==q;b=!!b;if(a==q)rb(qc,function(a){for(var e=a.length-1;0<=e;e--){var f=a[e];if(d||b==f.capture)wc(f.key),c++}});else if(a=oa(a),qc[a])for(var a=qc[a],e=a.length-1;0<=e;e--){var f=a[e];if(d||b==f.capture)wc(f.key),c++}}
function Bc(a){var b=Cc,a=oa(a),c=qc[a];if(c){var d=ia(b),e=ia(m);return d&&e?(c=pc[b],!!c&&!!c[m]&&a in c[m]):!d&&!e?n:Ab(c,function(a){return d&&a.type==b||e&&a.capture==m})}return r}function Dc(a,b,c,d,e){var f=1,b=oa(b);if(a[b]){a.Ea--;a=a[b];a.Nd?a.Nd++:a.Nd=1;try{for(var g=a.length,h=0;h<g;h++){var l=a[h];l&&!l.tc&&(f&=Ec(l,e)!==r)}}finally{a.Nd--,xc(c,d,b,a)}}return Boolean(f)}function Ec(a,b){var c=a.handleEvent(b);a.ue&&wc(a.key);return c}
function tc(a,b){if(!oc[a])return n;var c=oc[a],d=c.type,e=pc;if(!(d in e))return n;var e=e[d],f,g;if(!jc){var h;if(!(h=b))a:{h=["window","event"];for(var l=fa;f=h.shift();)if(x(l[f]))l=l[f];else{h=q;break a}h=l}f=h;h=n in e;l=r in e;if(h){if(0>f.keyCode||f.returnValue!=m)return n;a:{var j=r;if(0==f.keyCode)try{f.keyCode=-1;break a}catch(k){j=n}if(j||f.returnValue==m)f.returnValue=n}}j=new nc;j.la(f,this);f=n;try{if(h){for(var o=[],s=j.currentTarget;s;s=s.parentNode)o.push(s);g=e[n];g.Ea=g.L;for(var p=
o.length-1;!j.ac&&0<=p&&g.Ea;p--)j.currentTarget=o[p],f&=Dc(g,o[p],d,n,j);if(l){g=e[r];g.Ea=g.L;for(p=0;!j.ac&&p<o.length&&g.Ea;p++)j.currentTarget=o[p],f&=Dc(g,o[p],d,r,j)}}else f=Ec(c,j)}finally{o&&(o.length=0),j.La()}return f}d=new nc(b,this);try{f=Ec(c,d)}finally{d.La()}return f}var Fc=0;function Gc(a){return a+"_"+Fc++};function Hc(){}E(Hc,Xb);u=Hc.prototype;u.If=n;u.Pd=q;u.af=ea("Pd");u.addEventListener=function(a,b,c,d){J(this,a,b,c,d)};u.removeEventListener=function(a,b,c,d){vc(this,a,b,c,d)};
u.dispatchEvent=function(a){var b=a.type||a,c=pc;if(b in c){if(la(a))a=new lc(a,this);else if(a instanceof lc)a.target=a.target||this;else{var d=a,a=new lc(b,this);vb(a,d)}var d=1,e,c=c[b],b=n in c,f;if(b){e=[];for(f=this;f;f=f.Pd)e.push(f);f=c[n];f.Ea=f.L;for(var g=e.length-1;!a.ac&&0<=g&&f.Ea;g--)a.currentTarget=e[g],d&=Dc(f,e[g],a.type,n,a)&&a.dd!=r}if(r in c)if(f=c[r],f.Ea=f.L,b)for(g=0;!a.ac&&g<e.length&&f.Ea;g++)a.currentTarget=e[g],d&=Dc(f,e[g],a.type,r,a)&&a.dd!=r;else for(e=this;!a.ac&&e&&
f.Ea;e=e.Pd)a.currentTarget=e,d&=Dc(f,e,a.type,r,a)&&a.dd!=r;a=Boolean(d)}else a=n;return a};u.M=function(){Hc.i.M.call(this);yc(this);this.Pd=q};function K(){this.c="base";this.pa=window["X.counter"].Li();this.e=r}E(K,Hc);K.prototype.__defineGetter__("classname",t("c"));K.prototype.__defineGetter__("id",t("pa"));D("X.base",K);function Ic(a,b){this.xa=new Aa(a);this.aa=new Aa(b)}Ic.prototype={f:function(){return new Ic(this.xa.f(),this.aa.f())},Xb:function(){this.aa=this.aa.Se()},yh:function(a,b){return new Ic(this.xa.$f(a.xa,b),this.aa.$f(a.aa,b))}};function Jc(a,b){this.aa=a;this.jd=b}Jc.prototype={f:function(){return new Jc(this.aa.f(),this.jd)},Xb:function(){this.aa=this.aa.Se();this.jd=-this.jd}};function Kc(a,b){this.hb=a;this.Vd=b;var c=a[0].xa,d=a[2].xa,d=a[1].xa.$c(c).Ae(d.$c(c)).gd();this.wa=new Jc(d,d.oc(c))}
Kc.prototype={f:function(){var a=this.hb.map(function(a){return a.f()});return new Kc(a,this.Vd)},Xb:function(){this.hb.reverse().map(function(a){a.Xb()});this.wa.Xb()},tg:function(a,b,c,d,e){for(var f=0,g=[],h=0;h<this.hb.length;h++){var l=a.aa.oc(this.hb[h].xa)-a.jd,l=-1.0E-5>l?2:1.0E-5<l?1:0,f=f|l;g.push(l)}switch(f){case 0:(0<a.aa.oc(this.wa.aa)?b:c).push(this);break;case 1:d.push(this);break;case 2:e.push(this);break;case 3:b=[];c=[];for(h=0;h<this.hb.length;h++){var j=(h+1)%this.hb.length,l=
g[h],k=g[j],f=this.hb[h],j=this.hb[j];2!=l&&b.push(f);1!=l&&c.push(2!=l?f.f():f);3==(l|k)&&(l=(a.jd-a.aa.oc(f.xa))/a.aa.oc(j.xa.$c(f.xa)),l=f.yh(j,l),b.push(l),c.push(l.f()))}3<=b.length&&d.push(new Kc(b,this.Vd));3<=c.length&&e.push(new Kc(c,this.Vd))}}};function Lc(a){this.ga=this.ha=this.wa=q;this.A=[];a&&this.kc(a)}
Lc.prototype={f:function(){var a=new Lc;a.si(this.wa&&this.wa.f());a.ri(this.ha&&this.ha.f());a.qi(this.ga&&this.ga.f());a.Td(this.A.map(function(a){return a.f()}));return a},Y:function(){for(var a=0;a<this.A.length;a++)this.A[a].Xb();this.wa.Xb();this.ha&&this.ha.Y();this.ga&&this.ga.Y();a=this.ha;this.ha=this.ga;this.ga=a},xe:function(a){if(!this.wa)return a.slice();for(var b=[],c=[],d=0;d<a.length;d++)a[d].tg(this.wa,b,c,b,c);this.ha&&(b=this.ha.xe(b));c=this.ga?this.ga.xe(c):[];return b.concat(c)},
Ka:function(a){this.A=a.xe(this.A);this.ha&&this.ha.Ka(a);this.ga&&this.ga.Ka(a)},Ab:function(){var a=this.A.slice();this.ha&&(a=a.concat(this.ha.Ab()));this.ga&&(a=a.concat(this.ga.Ab()));return a},kc:function(a){if(a.length){this.wa||(this.wa=a[0].wa.f());for(var b=[],c=[],d=0;d<a.length;d++)a[d].tg(this.wa,this.A,this.A,b,c);b.length&&(this.ha||(this.ha=new Lc),this.ha.kc(b));c.length&&(this.ga||(this.ga=new Lc),this.ga.kc(c))}},si:ea("wa"),ri:ea("ha"),qi:ea("ga"),Td:ea("A")};function Mc(){this.A=[]}function Nc(a){var b=new Mc;b.Td(a);return b}
Mc.prototype={f:function(){var a=new Mc;a.Td(this.A.map(function(a){return a.f()}));return a},hf:function(a){var b=new Lc(this.f().A),a=new Lc(a.f().A);b.Ka(a);a.Ka(b);a.Y();a.Ka(b);a.Y();b.kc(a.Ab());return Nc(b.Ab())},gb:function(a){var b=new Lc(this.f().A),a=new Lc(a.f().A);b.Y();b.Ka(a);a.Ka(b);a.Y();a.Ka(b);a.Y();b.kc(a.Ab());b.Y();return Nc(b.Ab())},Ke:function(a){var b=new Lc(this.f().A),a=new Lc(a.f().A);b.Y();a.Ka(b);a.Y();b.Ka(a);a.Ka(b);b.kc(a.Ab());b.Y();return Nc(b.Ab())},inverse:function(){var a=
this.f();a.A.map(function(a){a.Xb()});return a},Td:ea("A")};function Oc(){K.call(this);this.c="indexer";this.qe=[];this.Z={}}E(Oc,K);Oc.prototype.add=function(a){x(a)||i(Error("Invalid object."));var b=window.JSON.stringify(a);b in this.Z||(this.Z[b]=this.qe.length,this.qe.push(a));return this.Z[b]};Oc.prototype.unique=t("qe");function Pc(a){K.call(this);this.c="file";this.ke=a;this.e=n}E(Pc,K);function Qc(){this.Gb=this.s=q}Qc.prototype.__defineSetter__("file",function(a){this.s=!x(a)||a instanceof Array&&0==a.length?q:a instanceof Array?1==a.length?new Pc(a[0]):zb(a,function(a){var c=new L;c.s=new Pc(a);return c}):new Pc(a)});Qc.prototype.__defineGetter__("file",function(){return!this.s?"":this.s.ke});Qc.prototype.__defineGetter__("filedata",t("Gb"));
Qc.prototype.__defineSetter__("filedata",function(a){if(!x(a)||a instanceof Array&&0==a.length)this.Gb=q;if(a instanceof Array)if(1==a.length)this.Gb=a[0];else{var b=this.s.length,c;for(c=0;c<b;c++)this.s[c].Gb=a[c]}else this.Gb=a});function Rc(){K.call(this);this.c="colortable";this.Z=new Qb;Ba(this,new Qc)}E(Rc,K);Rc.prototype.add=function(a,b,c,d,e,f){(!z(a)||!z(c)||!z(d)||!z(e)||!z(f))&&i(Error("Invalid color table entry."));this.Z.set(a,[b,c,d,e,f]);this.e=n};function Sc(a,b,c){this.x=ia(a)?a:0;this.y=ia(b)?b:0;this.b=ia(c)?c:0}Sc.prototype.f=function(){return new Sc(this.x,this.y,this.b)};Sc.prototype.gf=function(){return[this.x,this.y,this.b]};function M(a,b,c){this.x=a;this.y=b;this.b=c}E(M,Sc);u=M.prototype;u.f=function(){return new M(this.x,this.y,this.b)};u.$b=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.b*this.b)};u.scale=function(a){this.x*=a;this.y*=a;this.b*=a;return this};u.Y=function(){this.x=-this.x;this.y=-this.y;this.b=-this.b;return this};u.normalize=function(){return this.scale(1/this.$b())};u.add=function(a){this.x+=a.x;this.y+=a.y;this.b+=a.b;return this};
u.gb=function(a){this.x-=a.x;this.y-=a.y;this.b-=a.b;return this};u.Sc=function(a){return this==a||!!a&&this.x==a.x&&this.y==a.y&&this.b==a.b};function Tc(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 Uc(a,b){return new M(a.x+b.x,a.y+b.y,a.b+b.b)}function Vc(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 Wc(a,b){this.x=ia(a)?a:0;this.y=ia(b)?b:0}Wc.prototype.f=function(){return new Wc(this.x,this.y)};function Xc(a,b){return new Wc(a.x-b.x,a.y-b.y)};function Yc(a,b){this.x=a;this.y=b}E(Yc,Wc);u=Yc.prototype;u.f=function(){return new Yc(this.x,this.y)};u.$b=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};u.scale=function(a){this.x*=a;this.y*=a;return this};u.Y=function(){this.x=-this.x;this.y=-this.y;return this};u.normalize=function(){return this.scale(1/this.$b())};u.add=function(a){this.x+=a.x;this.y+=a.y;return this};u.gb=function(a){this.x-=a.x;this.y-=a.y;return this};
u.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};u.Sc=function(a){return this==a||!!a&&this.x==a.x&&this.y==a.y};function Zc(a,b){this.width=a;this.height=b}function $c(a,b){return a==b?n:!a||!b?r:a.width==b.width&&a.height==b.height}Zc.prototype.f=function(){return new Zc(this.width,this.height)};Zc.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};Zc.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};Zc.prototype.scale=function(a){this.width*=a;this.height*=a;return this};function ad(a,b){if(a instanceof ad)this.S=a.gf();else{var c;if(c=ka(a))a:{for(var d=c=0;d<a.length;d++){if(!ka(a[d])||0<c&&a[d].length!=c){c=r;break a}for(var e=0;e<a[d].length;e++)if(!z(a[d][e])){c=r;break a}0==c&&(c=a[d].length)}c=0!=c}c?this.S=Hb(a):a instanceof Zc?this.S=bd(a.height,a.width):z(a)&&z(b)&&0<a&&0<b?this.S=bd(a,b):i(Error("Invalid argument(s) for Matrix contructor"))}this.D=new Zc(this.S[0].length,this.S.length)}
function dd(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 ad(b)}function ed(a,b,c){for(var d=0;d<a.va().height;d++)for(var e=0;e<a.va().width;e++)b.call(c,a.S[d][e],d,e,a)}function fd(a,b){var c=new ad(a.va());ed(a,function(d,e,f){c.S[e][f]=b.call(m,d,e,f,a)});return c}function bd(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}u=ad.prototype;
u.add=function(a){$c(this.D,a.va())||i(Error("Matrix summation is only supported on arrays of equal size"));return fd(this,function(b,c,d){return b+a.S[c][d]})};u.Sc=function(a,b){if(this.D.width!=a.D.width||this.D.height!=a.D.height)return r;for(var c=b||0,d=0;d<this.D.height;d++)for(var e=0;e<this.D.width;e++)if(!(Math.abs(this.S[d][e]-a.S[d][e])<=(c||1.0E-6)))return r;return n};u.va=t("D");u.T=function(a,b){return!(0<=a&&a<this.D.height&&0<=b&&b<this.D.width)?q:this.S[a][b]};
u.k=function(a,b,c){0<=a&&a<this.D.height&&0<=b&&b<this.D.width||i(Error("Index out of bounds when setting matrix value, ("+a+","+b+") in size ("+this.D.height+","+this.D.width+")"));this.S[a][b]=c};u.multiply=function(a){if(a instanceof ad)return this.D.width!=a.va().height&&i(Error("Invalid matrices for multiplication. Second matrix should have the same number of rows as the first has columns.")),gd(this,a);if(z(a))return ld(this,a);i(Error("A matrix can only be multiplied by a number or another matrix."))};
u.gb=function(a){$c(this.D,a.va())||i(Error("Matrix subtraction is only supported on arrays of equal size."));return fd(this,function(b,c,d){return b-a.S[c][d]})};u.gf=t("S");function gd(a,b){var c=new ad(a.D.height,b.va().width);ed(c,function(a,e,f){for(var g=a=0;g<this.D.width;g++)a+=this.T(e,g)*b.T(g,f);c.k(e,f,a)},a);return c}function ld(a,b){return fd(a,function(a){return a*b})};function N(a,b){ad.call(this,a,b);this.c="matrix"}E(N,ad);function md(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 N(b)}u=N.prototype;u.Da=function(){var a=[],b=this.va();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(this.T(c,d));return a};
u.translate=function(a){this.D.width!=this.D.height&&i(Error("Can not translate non-square matrix."));var b=this.va(),c=dd(b.height);a instanceof Yc&&3==b.height?(c.k(0,2,a.x),c.k(1,2,a.y)):a instanceof M&&4==b.height?(c.k(0,3,a.x),c.k(1,3,a.y),c.k(2,3,a.b)):i(Error("Translation failed."));return new N(this.multiply(c))};
u.rotate=function(a,b){(4!=this.va().height||this.D.width!=this.D.height)&&i(Error("Only 4x4 matrices can be rotated."));(!x(b)||!(b instanceof M))&&i(Error("Invalid axis vector."));z(a)||i(Error("Invalid angle."));var c=b.normalize(),d=Math.cos(a),e=Math.sin(a),f=dd(4);f.k(0,0,d+c.x*c.x*(1-d));f.k(0,1,c.x*c.y*(1-d)-c.b*e);f.k(0,2,c.x*c.b*(1-d)+c.y*e);f.k(1,0,c.y*c.x*(1-d)+c.b*e);f.k(1,1,d+c.y*c.y*(1-d));f.k(1,2,c.y*c.b*(1-d)-c.x*e);f.k(2,0,c.b*c.x*(1-d)-c.y*e);f.k(2,1,c.b*c.y*(1-d)+c.x*e);f.k(2,
2,d+c.b*c.b*(1-d));return new N(this.multiply(f))};u.Na=function(a){var b=this.va(),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):i(Error("Multiplication by vector failed."));a=this.multiply(new ad(c));return new M(parseFloat(a.T(0,0)),parseFloat(a.T(1,0)),parseFloat(a.T(2,0)))};u.Fi=function(a,b){var c=this.S[a];this.S[a]=this.S[b];this.S[b]=c};
u.Ei=function(a,b){for(var c=this.va(),d=0,d=0;d<c.height;d++){var e=this.T(d,a);e||(e=0);var f=this.T(d,b);f||(f=0);this.k(d,a,f);this.k(d,b,e)}};D("X.matrix",N);D("X.matrix.createIdentityMatrix",md);D("X.matrix.prototype.flatten",N.prototype.Da);D("X.matrix.prototype.translate",N.prototype.translate);D("X.matrix.prototype.rotate",N.prototype.rotate);D("X.matrix.prototype.toArray",N.prototype.gf);D("X.matrix.prototype.getValueAt",N.prototype.T);D("X.matrix.prototype.setValueAt",N.prototype.k);
D("X.matrix.prototype.multiplyByVector",N.prototype.Na);D("X.matrix.prototype.swapRows",N.prototype.Fi);D("X.matrix.prototype.swapCols",N.prototype.Ei);function nd(){K.call(this);this.c="transform";this.B=md(4);this.qf=new Float32Array(this.B.Da())}E(nd,K);nd.prototype.__defineGetter__("matrix",t("B"));nd.prototype.__defineSetter__("matrix",function(a){(!x(a)||!(a instanceof N))&&i(Error("Invalid matrix."));this.B=a;this.o()});u=nd.prototype;u.ki=function(a){(!z(a)||-360>a||360<a)&&i(Error("Invalid angle."));this.B=this.B.rotate(a*Math.PI/180,new M(0,1,0));this.o()};
u.li=function(a){(!z(a)||-360>a||360<a)&&i(Error("Invalid angle."));this.B=this.B.rotate(a*Math.PI/180,new M(1,0,0));this.o()};u.mi=function(a){(!z(a)||-360>a||360<a)&&i(Error("Invalid angle."));this.B=this.B.rotate(a*Math.PI/180,new M(0,0,1));this.o()};u.Ii=function(a){z(a)||i(Error("Invalid distance."));this.B=this.B.translate(new M(a,0,0));this.o()};u.Ji=function(a){z(a)||i(Error("Invalid distance."));this.B=this.B.translate(new M(0,a,0));this.o()};
u.Ki=function(a){z(a)||i(Error("Invalid distance."));this.B=this.B.translate(new M(0,0,a));this.o()};function od(a,b,c){var d=a.B.T(b,c);d||(d=0);a.B.k(b,c,-1*d);a.o()}u.gh=function(){od(this,0,0)};u.hh=function(){od(this,1,1)};u.ih=function(){od(this,2,2)};u.o=function(){this.qf=new Float32Array(this.B.Da());this.e=n};D("X.transform",nd);D("X.transform.prototype.rotateX",nd.prototype.ki);D("X.transform.prototype.rotateY",nd.prototype.li);D("X.transform.prototype.rotateZ",nd.prototype.mi);
D("X.transform.prototype.translateX",nd.prototype.Ii);D("X.transform.prototype.translateY",nd.prototype.Ji);D("X.transform.prototype.translateZ",nd.prototype.Ki);D("X.transform.prototype.flipX",nd.prototype.gh);D("X.transform.prototype.flipY",nd.prototype.hh);D("X.transform.prototype.flipZ",nd.prototype.ih);D("X.transform.prototype.modified",nd.prototype.o);function pd(){K.call(this);this.c="texture";this.ta=this.lb=this.s=q;this.wb=this.xb=0;Ba(this,new Qc)}E(pd,K);D("X.texture",pd);function Q(a,b){K.call(this);this.c="fasttriplets";this.Ob=Infinity;this.Lb=-Infinity;this.Pb=Infinity;this.Mb=-Infinity;this.Qb=Infinity;this.Nb=-Infinity;this.kd=[0,0,0];this.w=0;this.I=new Float32Array(a);x(b)&&(this.I=b.I.subarray(0,b.I.length),this.w=this.I.length,this.Ob=b.Ob,this.Lb=b.Lb,this.Pb=b.Pb,this.Mb=b.Mb,this.Qb=b.Qb,this.Nb=b.Nb,this.kd=b.kd.slice())}E(Q,K);u=Q.prototype;
u.add=function(a,b,c){this.Ob=Math.min(this.Ob,a);this.Lb=Math.max(this.Lb,a);this.Pb=Math.min(this.Pb,b);this.Mb=Math.max(this.Mb,b);this.Qb=Math.min(this.Qb,c);this.Nb=Math.max(this.Nb,c);this.kd=[(this.Ob+this.Lb)/2,(this.Pb+this.Mb)/2,(this.Qb+this.Nb)/2];this.e=n;this.I[this.w++]=a;this.I[this.w++]=b;this.I[this.w++]=c;return this.w/3};u.vc=function(){if(this.w!=this.I.length){var a=new Float32Array(this.w);a.set(this.I.subarray(0,this.w));this.I=a}};
u.get=function(a){a*=3;return[this.I[a],this.I[a+1],this.I[a+2]]};u.remove=function(){i(Error("Not implemented."))};u.clear=function(){this.I=new Float32Array(this.I.length);this.e=n};Q.prototype.__defineGetter__("count",function(){this.vc();return this.I.length/3});Q.prototype.__defineGetter__("length",function(){this.vc();return this.I.length});D("X.triplets",Q);D("X.triplets.prototype.add",Q.prototype.add);D("X.triplets.prototype.resize",Q.prototype.vc);D("X.triplets.prototype.get",Q.prototype.get);
D("X.triplets.prototype.remove",Q.prototype.remove);D("X.triplets.prototype.clear",Q.prototype.clear);function U(){this.ka=qd;this.Ub=new nd;this.Eb=[1,1,1];this.Tb=this.z=this.U=this.h=this.g=q;this.Jc=[];this.Ia=n;this.jc=this.Kc=1;this.ec=q;this.Cc=r;this.X=1;this.W=0}var qd="TRIANGLES";U.prototype.__defineSetter__("type",function(a){return this.ka=a});U.prototype.__defineGetter__("type",t("ka"));U.prototype.__defineGetter__("texture",function(){this.z||(this.z=new pd);return this.z});U.prototype.__defineGetter__("transform",t("Ub"));U.prototype.__defineGetter__("points",t("g"));
U.prototype.__defineSetter__("points",ea("g"));U.prototype.__defineGetter__("normals",t("h"));U.prototype.__defineSetter__("normals",ea("h"));U.prototype.__defineGetter__("colors",t("U"));U.prototype.__defineSetter__("colors",ea("U"));U.prototype.__defineGetter__("color",t("Eb"));U.prototype.__defineSetter__("color",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid color."));for(var b=this.d,c=b.length,d=0,d=0;d<c;d++)b[d].color=a;this.Eb=a;this.e=n});
U.prototype.__defineGetter__("opacity",t("X"));U.prototype.__defineSetter__("opacity",function(a){(!z(a)||1<a||0>a)&&i(Error("Invalid opacity."));for(var b=this.d,c=b.length,d=0,d=0;d<c;d++)b[d].opacity=a;this.X=a;this.e=n});U.prototype.__defineGetter__("caption",t("ec"));U.prototype.__defineSetter__("caption",function(a){this.ec=a;this.e=n});U.prototype.__defineGetter__("visible",t("Ia"));
U.prototype.__defineSetter__("visible",function(a){for(var b=this.d,c=b.length,d=0,d=0;d<c;d++)b[d].visible=a;this.Ia=a;this.e=n});U.prototype.__defineGetter__("pointsize",t("Kc"));U.prototype.__defineSetter__("pointsize",function(a){z(a)||i(Error("Invalid point size."));this.Kc=a;this.e=n});U.prototype.__defineGetter__("magicmode",t("Cc"));U.prototype.__defineSetter__("magicmode",function(a){"boolean"!=typeof a&&i(Error("Invalid magic mode setting."));this.Cc=a;this.e=n});
U.prototype.__defineGetter__("linewidth",t("jc"));U.prototype.__defineSetter__("linewidth",function(a){z(a)||i(Error("Invalid line width."));this.jc=a;this.e=n});function rd(){this.Ha=Infinity;this.ca=this.qa=-Infinity;this.da=Infinity;this.tb=[0,0,0];this.rb=[1,1,1]}rd.prototype.__defineGetter__("lowerThreshold",t("ca"));rd.prototype.__defineSetter__("lowerThreshold",ea("ca"));rd.prototype.__defineGetter__("upperThreshold",t("da"));rd.prototype.__defineSetter__("upperThreshold",ea("da"));rd.prototype.__defineGetter__("min",t("Ha"));rd.prototype.__defineGetter__("max",t("qa"));rd.prototype.__defineGetter__("minColor",t("tb"));
rd.prototype.__defineSetter__("minColor",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid min. color."));this.tb=a});rd.prototype.__defineGetter__("maxColor",t("rb"));rd.prototype.__defineSetter__("maxColor",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid max. color."));this.rb=a});function sd(){K.call(this);this.c="scalars";this.yc=this.u=q;this.Af=n;Ba(this,new Qc);Ba(this,new rd);this.tb=[0,1,0];this.rb=[1,0,0]}E(sd,K);sd.prototype.__defineGetter__("array",t("u"));sd.prototype.__defineSetter__("array",function(a){this.yc=this.u=a;this.e=n});D("X.scalars",sd);function V(a){K.call(this);this.c="object";this.d=[];this.t=this.O=q;Ba(this,new U);x(a)&&this.Vb(a)}E(V,K);
V.prototype.Vb=function(a){this.ka=a.ka;this.Ub=new nd;this.Ub.B=new N(a.Ub.B.S);this.Eb=a.Eb.slice();a.g&&(this.g=new Q(a.g.length,a.g));a.h&&(this.h=new Q(a.h.length,a.h));a.U&&(this.U=new Q(a.U.length,a.U));this.z=a.z;this.Tb=a.Tb;a.s&&(this.s=new Pc((new String(a.s.ke)).toString()));this.X=a.X;this.d.length=0;var b=a.d;if(b)for(var c=b.length,d=0,d=0;d<c;d++)this.d.push(new H[b[d].c](b[d]));this.Ia=a.Ia;this.Kc=a.Kc;this.jc=a.jc;a.ec&&(this.ec=(new String(a.ec)).toString());this.Cc=a.Cc;this.Jc=
a.Jc.slice();this.e=n};V.prototype.__defineGetter__("colortable",function(){this.O||(this.O=new Rc);return this.O});V.prototype.__defineGetter__("scalars",function(){this.t||(this.t=new sd);return this.t});V.prototype.__defineGetter__("children",t("d"));V.prototype.o=function(){var a=new td;a.$=this;this.dispatchEvent(a)};
function ud(a,b){(!x(a)||!x(b)||!(a instanceof V)||!(b instanceof V))&&i(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.X?-1:1==b.X?1:x(a.W)&&x(b.W)&&a.W>b.W?-1:1}D("X.object",V);D("X.object.prototype.modified",V.prototype.o);function vd(){}function wd(a){for(var b=a.g.count,c=[],d=0,d=0;d<b;d+=3){var e=a.g.get(d),f=a.g.get(d+1),g=a.g.get(d+2),h=a.h.get(d),l=a.h.get(d+1),j=a.h.get(d+2),k=a.Eb;a.U&&0<a.U.length&&(k=a.U.get(d));var o=[];o.push(new Ic(e,h));o.push(new Ic(f,l));o.push(new Ic(g,j));c.push(new Kc(o,k))}return Nc(c)}
function xd(a,b){(!x(b)||!(b instanceof Mc))&&i(Error("Invalid CSG object."));var c=new Oc,d=[];zb(b.A,function(a){for(var b=[],g=a.Vd,b=zb(a.hb,function(a){a.color=g;return c.add(a)}),a=a=2;a<b.length;a++)d.push([b[0],b[a-1],b[a]])}.bind(a));a.Kg=zb(c.unique(),function(a){return[a.xa.x(),a.xa.y(),a.xa.b()]});a.Jg=zb(c.unique(),function(a){return[a.aa.x(),a.aa.y(),a.aa.b()]});a.Ig=zb(c.unique(),function(a){return!a.color?q:[a.color[0],a.color[1],a.color[2]]});a.g=new Q(9*d.length);a.h=new Q(9*d.length);
a.U=new Q(9*d.length);zb(d,function(a){var b=a[0],c=a[1],a=a[2],d=this.Kg,l=this.Jg,j=this.Ig;this.g.add(d[b][0],d[b][1],d[b][2]);this.g.add(d[c][0],d[c][1],d[c][2]);this.g.add(d[a][0],d[a][1],d[a][2]);this.h.add(l[b][0],l[b][1],l[b][2]);this.h.add(l[c][0],l[c][1],l[c][2]);this.h.add(l[a][0],l[a][1],l[a][2]);j[b]&&this.U.add(j[b][0],j[b][1],j[b][2]);j[c]&&this.U.add(j[c][0],j[c][1],j[c][2]);j[a]&&this.U.add(j[a][0],j[a][1],j[a][2])}.bind(a));0==a.U.w&&(a.U=q);a.ka=qd}
vd.prototype.hf=function(a){(!x(a)||!(a instanceof Mc)&&!(a instanceof V))&&i(Error("Invalid object."));var b=a;a instanceof V&&(b=wd(b));a=new V;Ba(a,new vd);xd(a,wd(this).hf(b));return a};vd.prototype.gb=function(a){(!x(a)||!(a instanceof Mc)&&!(a instanceof V))&&i(Error("Invalid object."));var b=a;a instanceof V&&(b=wd(b));a=new V;Ba(a,new vd);xd(a,wd(this).gb(b));return a};
vd.prototype.Ke=function(a){(!x(a)||!(a instanceof Mc)&&!(a instanceof V))&&i(Error("Invalid object."));var b=a;a instanceof V&&(b=wd(b));a=new V;Ba(a,new vd);xd(a,wd(this).Ke(b));return a};vd.prototype.inverse=function(){var a=new V;Ba(a,new vd);xd(a,wd(this).inverse());return a};D("X.constructable",vd);D("X.constructable.prototype.intersect",vd.prototype.Ke);D("X.constructable.prototype.inverse",vd.prototype.inverse);D("X.constructable.prototype.subtract",vd.prototype.gb);
D("X.constructable.prototype.union",vd.prototype.hf);function yd(a){lc.call(this,a);this.c="event"}E(yd,lc);var zd=Gc("pan"),Ad=Gc("rotate"),Bd=Gc("zoom"),Cd=Gc("scroll");Gc("render");var Dd=Gc("resetview"),Ed=Gc("windowlevel"),Cc=Gc("modified"),Fd=Gc("progress"),Gd=Gc("hover"),Hd=Gc("hover_end");function Id(){yd.call(this,Ed);this.ee=this.re=0}E(Id,yd);function Jd(){yd.call(this,zd);this.W=new Yc(0,0)}E(Jd,yd);function Kd(){yd.call(this,Ad);this.W=new Yc(0,0)}E(Kd,yd);function Ld(){yd.call(this,Bd);this.jb=this.Jb=r}E(Ld,yd);
function Md(){yd.call(this,Cd);this.J=r}E(Md,yd);function Nd(){yd.call(this,Gd);this.zd=this.yd=0}E(Nd,yd);function Od(){yd.call(this,Hd)}E(Od,yd);function Pd(){yd.call(this,Dd)}E(Pd,yd);function td(){yd.call(this,Cc);this.r=this.$=q}E(td,yd);function Qd(){yd.call(this,Fd);this.Bf=0}E(Qd,yd);function W(){K.call(this);this.c="parser";this.ba=q;this.w=0;this.Ng=0<(new Int8Array((new Int16Array([1])).buffer))[0];this.od=n}E(W,K);W.prototype.parse=function(){i(Error("The function parse() should be overloaded."))};function Rd(a){for(var b=Infinity,c=-Infinity,d=a.length,e=0,e=0;e<d;e++)var f=a[e],b=Math.min(b,f),c=Math.max(c,f);return[b,c]}
function Y(a,b,c){x(c)||(c=1);var d=1,e=Uint8Array;switch(b){case "schar":e=Int8Array;break;case "ushort":e=Uint16Array;d=2;break;case "sshort":e=Int16Array;d=2;break;case "uint":e=Uint32Array;d=4;break;case "sint":e=Int32Array;d=4;break;case "float":e=Float32Array,d=4}b=new e(a.ba.slice(a.w,a.w+=c*d));if(a.Ng!=a.od){a=b;b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(e=0;e<a.byteLength;e+=d)for(var f=e+d-1,g=e;f>g;f--,g++){var h=b[g];b[g]=b[f];b[f]=h}b=a}return 1==c?b[0]:b}
function Sd(a,b,c){H.Ga(a.c+".reslice");for(var d=b.G,e=c.max,f=c.data,g=d[2],h=d[1],d=d[0],l=b.n!=q,j=h*d,k=Array(g),o=0,s=0,p=0,w=0,v=0,A=4*j,s=0;s<g;s++){k[s]=Array(h);for(var C=f.subarray(s*j,(s+1)*j),y=new Uint8Array(A),p=v=0;p<h;p++){k[s][p]=new c.data.constructor(d);for(w=0;w<d;w++){var o=C[v],B=0,F=0,P=0,G=0;b.O?((G=b.O.Z.get(Math.floor(o)))||(G=b.O.Z.get(b.O.Z.na()-1)),B=255*G[1],F=255*G[2],P=255*G[3],G=255*G[4]):(B=F=P=255*(o/e),G=255);var O=4*v;y[O]=B;y[++O]=F;y[++O]=P;y[++O]=G;k[s][p][w]=
255*(o/e);v++}}o=new pd;o.ta=y;o.xb=d;o.wb=h;C=b.ab.d[s];C.z=o;l&&(C.n=b.n.ab.d[s].z)}d!=h?l?b.O?(Td(g,d,h,k,e,b.O,b.R,b.n.R),Td(g,h,d,k,e,b.O,b.Q,b.n.Q)):(Ud(g,d,h,k,b.R,b.n.R),Ud(g,h,d,k,b.Q,b.n.Q)):b.O?(Td(g,d,h,k,e,b.O,b.R,q),Td(g,h,d,k,e,b.O,b.Q,q)):(Ud(g,d,h,k,b.R,q),Ud(g,h,d,k,b.Q,q)):l?b.O?Vd(g,d,h,k,e,b.O,b.Q,b.n.Q,b.R,b.n.R):Yd(g,d,h,k,b.Q,b.n.Q,b.R,b.n.R):b.O?Vd(g,d,h,k,e,b.O,b.Q,q,b.R,q):Yd(g,d,h,k,b.Q,q,b.R,q);H.Ba(a.c+".reslice");return k}
function Ud(a,b,c,d,e,f){for(var g=4*a*b,h=0,h=0;h<c;h++){for(var l=new Uint8Array(g),j=0,k=0,j=0;j<a;j++)for(var o=0,s=d[j],o=0;o<b;o++){var p=s[o][h],w=p,v=p,A=4*k;l[A]=p;l[++A]=w;l[++A]=v;l[++A]=255;k++}j=new pd;j.ta=l;j.xb=b;j.wb=a;l=e.d[h];l.z=j;f&&(l.n=f.d[h].z)}}
function Td(a,b,c,d,e,f,g,h){for(var l=4*a*b,j=0,j=0;j<c;j++){for(var k=new Uint8Array(l),o=0,s=0,o=0;o<a;o++)for(var p=d[o],w=0,w=0;w<b;w++){var v=f.Z.get(Math.floor(e*p[w][j]/255));v||(v=f.Z.get(f.Z.na()-1));var A=255*v[2],C=255*v[3],y=255*v[4],B=4*s;k[B]=255*v[1];k[++B]=A;k[++B]=C;k[++B]=y;s++}o=new pd;o.ta=k;o.xb=b;o.wb=a;k=g.d[j];k.z=o;h&&(k.n=h.d[j].z)}}
function Yd(a,b,c,d,e,f,g,h){for(var l=4*a*b,j=0,j=0;j<c;j++){for(var k=new Uint8Array(l),o=new Uint8Array(l),s=0,p=0,p=0;p<a;p++)for(var w=d[p],v=0,v=0;v<b;v++){var A=w[v][j],C=A,y=A,B=4*s;k[B]=A;k[++B]=C;k[++B]=y;k[++B]=255;y=C=A=B=w[j][v];B=4*s;o[B]=A;o[++B]=C;o[++B]=y;o[++B]=255;s++}s=new pd;s.ta=k;s.xb=b;s.wb=a;k=e.d[j];k.z=s;f&&(k.n=f.d[j].z);k=new pd;k.ta=o;k.xb=b;k.wb=a;o=g.d[j];o.z=k;h&&(o.n=h.d[j].z)}}
function Vd(a,b,c,d,e,f,g,h,l,j){for(var k=4*a*b,o=0,o=0;o<c;o++){for(var s=new Uint8Array(k),p=new Uint8Array(k),w=0,v=0,v=0;v<a;v++)for(var A=d[v],C=0,C=0;C<b;C++){var y=f.Z.get(Math.floor(e*A[C][o]/255));y||(y=f.Z.get(f.Z.na()-1));var B=255*y[2],F=255*y[3],P=255*y[4],G=4*w;s[G]=255*y[1];s[++G]=B;s[++G]=F;s[++G]=P;(G=f.Z.get(Math.floor(e*A[o][C]/255)))||(G=f.Z.get(f.Z.na()-1));y=255*G[1];B=255*G[2];F=255*G[3];P=255*G[4];G=4*w;p[G]=y;p[++G]=B;p[++G]=F;p[++G]=P;w++}w=new pd;w.ta=s;w.xb=b;w.wb=a;s=
g.d[o];s.z=w;h&&(s.n=h.d[o].z);s=new pd;s.ta=p;s.xb=b;s.wb=a;p=l.d[o];p.z=s;j&&(p.n=j.d[o].z)}};function Zd(){W.call(this);this.c="parserLBL"}E(Zd,W);
Zd.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");var d=b.Jc,e=d.length;0==e&&i(Error("No _pointIndices defined on the X.object."));this.ba=c;for(var f=[],g=Y(this,"uchar",c.byteLength),h=g.length,l=r,j=0,c=1;c<h;c++)10==g[c-1]?(j=c,l=n):l&&32==g[c]&&(l=parseInt(String.fromCharCode.apply(q,g.subarray(j,c)),10),f.push(l),l=r);g=b.t.u?b.t.u:new Float32Array(e);h=f.length;for(c=0;c<h;c++)g[f[c]]=1;f=new Float32Array(3*e);for(c=h=0;c<e;c++)j=d[c],j>e&&i(Error("Could not find scalar for vertex.")),
j=g[j],f[h++]=j,f[h++]=j,f[h++]=j;b.t.u=g;b.t.yc=f;b.t.e=n;H.Ba(this.c+".parse");d=new td;d.$=b;d.r=a;this.dispatchEvent(d)};D("X.parserLBL",Zd);D("X.parserLBL.prototype.parse",Zd.prototype.parse);function $d(a){this.p=a;this.ag=J(this.p,Wa?"DOMMouseScroll":"mousewheel",this)}E($d,Hc);
$d.prototype.handleEvent=function(a){var b=0,c=0,d=0,a=a.Ua;if("mousewheel"==a.type){c=1;if(I||Xa&&(Pa||nb("532.0")))c=40;d=Xa&&Oa&&0!=-a.wheelDelta%c?-a.wheelDelta:-a.wheelDelta/c;ia(a.wheelDeltaX)?(b=Xa&&Oa&&0!=-a.wheelDeltaX%c?-a.wheelDeltaX:-a.wheelDeltaX/c,c=Xa&&Oa&&0!=-a.wheelDeltaY%c?-a.wheelDeltaY:-a.wheelDeltaY/c):c=d}else d=a.detail,100<d?d=3:-100>d&&(d=-3),ia(a.axis)&&a.axis===a.HORIZONTAL_AXIS?b=d:c=d;z(this.cg)&&Math.min(Math.max(b,-this.cg),this.cg);z(this.dg)&&(c=Math.min(Math.max(c,
-this.dg),this.dg));b=new ae(d,a,0,c);try{this.dispatchEvent(b)}finally{b.La()}};$d.prototype.M=function(){$d.i.M.call(this);wc(this.ag);delete this.ag};function ae(a,b,c,d){b&&this.la(b,m);this.type="mousewheel";this.detail=a;this.nc=d}E(ae,nc);I||Xa&&nb("525");var be;function ce(a,b){var c;c=(c=a.className)&&"function"==typeof c.split?c.split(/\s+/):[];var d=Ib(arguments,1),e;e=c;for(var f=0,g=0;g<d.length;g++)0<=xb(e,d[g])||(e.push(d[g]),f++);e=f==d.length;a.className=c.join(" ");return e};var de=!I||qb(9);!Wa&&!I||I&&qb(9)||Wa&&nb("1.9.1");I&&nb("9");function ee(a){return a?new fe(ge(a)):be||(be=new fe)}function he(a){return la(a)?document.getElementById(a):a}function ie(a,b){rb(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in je?a.setAttribute(je[d],b):0==d.lastIndexOf("aria-",0)?a.setAttribute(d,b):a[d]=b})}
var je={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"};function ke(a,b,c){return le(document,arguments)}
function le(a,b){var c=b[0],d=b[1];if(!de&&d&&(d.name||d.type)){c=["<",c];d.name&&c.push(' name="',Ca(d.name),'"');if(d.type){c.push(' type="',Ca(d.type),'"');var e={};vb(e,d);d=e;delete d.type}c.push(">");c=c.join("")}c=a.createElement(c);d&&(la(d)?c.className=d:ja(d)?ce.apply(q,[c].concat(d)):ie(c,d));2<b.length&&me(a,c,b);return c}
function me(a,b,c){function d(c){c&&b.appendChild(la(c)?a.createTextNode(c):c)}for(var e=2;e<c.length;e++){var f=c[e];ka(f)&&!(na(f)&&0<f.nodeType)?yb(ne(f)?Hb(f):f,d):d(f)}}function oe(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function pe(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}
function qe(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 ge(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function ne(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 r}function fe(a){this.N=a||fa.document||document}u=fe.prototype;
u.Gd=ee;u.j=function(a){return la(a)?this.N.getElementById(a):a};u.lc=function(a,b,c){return le(this.N,arguments)};u.createElement=function(a){return this.N.createElement(a)};u.createTextNode=function(a){return this.N.createTextNode(a)};function re(a){return"CSS1Compat"==a.N.compatMode}function se(a){var b=a.N,a=!Xa&&"CSS1Compat"==b.compatMode?b.documentElement:b.body,b=b.parentWindow||b.defaultView;return new Wc(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}u.appendChild=function(a,b){a.appendChild(b)};
u.contains=qe;function Z(a){(!x(a)||!(a instanceof Element))&&i(Error("Could not add interactor to the given element."));K.call(this);this.c="interactor";this.fc=a;this.ge=this.uf=this.tf=this.vf=this.sf=this.wf=q;this.fe=n;this.yb=this.sb=this.Ya=r;this.rd=[0,0];this.ae=new Yc(0,0);this.V={MOUSEWHEEL_ENABLED:n,MOUSECLICKS_ENABLED:n,KEYBOARD_ENABLED:n,HOVERING_ENABLED:n,CONTEXTMENU_ENABLED:r}}E(Z,K);Z.prototype.__defineGetter__("config",t("V"));Z.prototype.__defineGetter__("leftButtonDown",t("Ya"));
Z.prototype.__defineGetter__("middleButtonDown",t("sb"));Z.prototype.__defineGetter__("rightButtonDown",t("yb"));
Z.prototype.la=function(){this.V.MOUSEWHEEL_ENABLED?(this.ge=new $d(this.fc),this.wf=J(this.ge,"mousewheel",this.ad.bind(this))):(wc(this.wf),this.ge=q);this.V.MOUSECLICKS_ENABLED?(this.sf=J(this.fc,"mousedown",this.Kh.bind(this)),this.vf=J(this.fc,"mouseup",this.Ph.bind(this))):(wc(this.sf),wc(this.vf));this.fc.oncontextmenu=this.V.CONTEXTMENU_ENABLED?q:function(){return r};window.onkeydown=this.V.KEYBOARD_ENABLED?this.ig.bind(this):q;wc(this.tf);wc(this.uf);this.tf=J(this.fc,"mousemove",this.Mh.bind(this));
this.uf=J(this.fc,"mouseout",this.Nh.bind(this))};Z.prototype.Kh=function(a){0==a.button?this.Ya=n:1==a.button?this.sb=n:2==a.button&&(this.yb=n);eval("this.onMouseDown("+this.Ya+","+this.sb+","+this.yb+")");te(this);a.preventDefault()};Z.prototype.Jh=da();Z.prototype.Ph=function(a){0==a.button?this.Ya=r:1==a.button?this.sb=r:2==a.button&&(this.yb=r);eval("this.onMouseUp("+this.Ya+","+this.sb+","+this.yb+")");te(this);a.preventDefault()};Z.prototype.__defineGetter__("mousePosition",t("rd"));u=Z.prototype;
u.Oh=da();u.Nh=function(a){this.fe=r;this.V.KEYBOARD_ENABLED&&(window.onkeydown=q);this.yb=this.sb=this.Ya=r;te(this);this.ae=new Yc(0,0);a.preventDefault()};u.Lh=da();
u.Mh=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.fe=n;this.V.KEYBOARD_ENABLED&&window.onkeydown==q&&(window.onkeydown=this.ig.bind(this));a.preventDefault();var b=a.shiftKey;this.rd=[a.offsetX,a.offsetY];var c=new Yc(this.rd[0],this.rd[1]),a=this.ae.gb(c);this.ae=c.f();this.V.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.sb||this.Ya||this.yb)&&te(this),this.He=setTimeout(function(){te(this);var a=new Nd;a.yd=c.x;a.zd=c.y;this.dispatchEvent(a);
this.He=q}.bind(this),300));2>Math.abs(a.x)&&(a.x=0);2>Math.abs(a.y)&&(a.y=0);0!=a.$b()&&(this.Ya&&!b?(b=new Kd,b.W=a,this.dispatchEvent(b)):this.sb||this.Ya&&b?(b=new Jd,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.W=a,this.dispatchEvent(b)):this.yb&&(b=new Ld,b.Jb=0<a.y,b.jb=r,this.dispatchEvent(b)))};function te(a){a.He&&clearTimeout(a.He);a.dispatchEvent(new Od)}u.Qh=da();u.ad=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");te(this);a.preventDefault()};
u.Hh=da();
u.ig=function(a){if(this.fe){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");te(this);var b=a.altKey,c=a.ctrlKey,d=a.metaKey,e=a.shiftKey,f=a.keyCode;82==f&&!b&&!c&&!d&&!e?(a.preventDefault(),a=new Pd,this.dispatchEvent(a)):37<=f&&40>=f&&(a.preventDefault(),e?a=new Jd:b?a=new Ld:(a=new Kd,this instanceof ue&&(a=new Md)),a&&(c=new Yc(0,0),37==f?(c.x=5,a.J=r,b&&(a.J=n,a.Jb=n,a.jb=r)):39==f?(c.x=-5,a.J=n,b&&(a.Jb=r,a.jb=r)):38==f?(c.y=5,a.J=n,b&&(a.Jb=n,a.jb=n)):40==f&&(c.y=-5,a.J=r,b&&(a.Jb=r,
a.jb=n)),a.W=c,this.dispatchEvent(a)))}};D("X.interactor",Z);D("X.interactor.prototype.init",Z.prototype.la);D("X.interactor.prototype.onMouseDown",Z.prototype.Jh);D("X.interactor.prototype.onMouseUp",Z.prototype.Oh);D("X.interactor.prototype.onMouseMove",Z.prototype.Lh);D("X.interactor.prototype.onMouseWheel",Z.prototype.Qh);D("X.interactor.prototype.onKey",Z.prototype.Hh);function ue(a){Z.call(this,a);this.c="interactor2D"}E(ue,Z);ue.prototype.ad=function(a){ue.i.ad.call(this,a);var b=new Md;x(a.nc)||(a.nc=0);b.J=0>a.nc;this.dispatchEvent(b)};function we(a){V.call(this);this.c="slice";this.l=[0,0,0];this.hc=[0,0,1];this.J=[0,1,0];this.F=this.K=10;this.Tb=[0,1,0,0,1,1,1,1,1,0,0,0];this.n=this.cb=q;this.Qa=n;this.dc=[1,1,1];x(a)&&this.Vb(a)}E(we,V);we.prototype.Vb=function(a){this.l=a.l.slice();this.hc=a.hc.slice();this.J=a.J.slice();this.K=a.K;this.F=a.F;this.cb=a.cb;this.n=a.n;this.Qa=a.Qa;this.dc=a.dc;this.Mg=a.Mg;we.i.Vb.call(this,a)};
we.prototype.mc=function(){var a=new M(this.hc[0],this.hc[1],this.hc[2]),b=new M(this.J[0],this.J[1],this.J[2]),c=Vc(b,a),d=new M(this.l[0],this.l[1],this.l[2]),e=new M(1,1,1);1==a.x?(e=new M(this.l[0],this.F/2,this.K/2),this.Tb=[0,0,1,0,0,1,0,1,1,1,1,0]):1==a.y?(e=new M(this.K/2,this.l[1],this.F/2),this.Tb=[0,0,0,1,1,0,1,0,1,1,0,1]):1==a.b&&(e=new M(this.K/2,this.F/2,this.l[2]));var f=Uc(c.f().Y(),b.f().Y()),f=new M(f.x*e.x,f.y*e.y,f.b*e.b);f.add(d);var g=Uc(c.f().Y(),b),g=new M(g.x*e.x,g.y*e.y,
g.b*e.b);g.add(d);var h=Uc(c,b.f().Y()),h=new M(h.x*e.x,h.y*e.y,h.b*e.b);h.add(d);var l=h,b=Uc(c,b),b=new M(b.x*e.x,b.y*e.y,b.b*e.b);b.add(d);d=g;this.g=new Q(18);this.h=new Q(18);this.g.add(f.x,f.y,f.b);this.g.add(g.x,g.y,g.b);this.g.add(h.x,h.y,h.b);this.g.add(l.x,l.y,l.b);this.g.add(b.x,b.y,b.b);this.g.add(d.x,d.y,d.b);this.h.add(a.x,a.y,a.b);this.h.add(a.x,a.y,a.b);this.h.add(a.x,a.y,a.b);this.h.add(a.x,a.y,a.b);this.h.add(a.x,a.y,a.b);this.h.add(a.x,a.y,a.b);this.Qa&&(a=new V,a.g=new Q(24),a.h=
new Q(24),a.g.add(f.x,f.y,f.b),a.g.add(g.x,g.y,g.b),a.g.add(g.x,g.y,g.b),a.g.add(b.x,b.y,b.b),a.g.add(b.x,b.y,b.b),a.g.add(h.x,h.y,h.b),a.g.add(h.x,h.y,h.b),a.g.add(f.x,f.y,f.b),a.h.add(0,0,0),a.h.add(0,0,0),a.h.add(0,0,0),a.h.add(0,0,0),a.h.add(0,0,0),a.h.add(0,0,0),a.h.add(0,0,0),a.h.add(0,0,0),a.Eb=[this.dc[0],this.dc[1],this.dc[2]],a.ka="LINES",a.jc=2,this.d.push(a))};D("X.slice",we);function L(a){V.call(this);this.c="volume";this.l=[0,0,0];this.G=[10,10,10];this.H=[1,1,1];this.lb=[];this.Bc=this.ob=this.Ac=this.nb=this.zc=this.mb=0;this.Q=new V;this.R=new V;this.ab=new V;this.xd=this.Ja=r;this.zb=0;this.n=q;this.Qa=n;this.fa=Infinity;this.ea=-Infinity;Ba(this,new Qc);Ba(this,new rd);x(a)&&this.Vb(a)}E(L,V);
L.prototype.Vb=function(a){window.console.log(a);this.l=a.l.slice();this.G=a.G.slice();this.H=a.H.slice();this.mb=a.mb;this.zc=a.zc;this.nb=a.nb;this.Ac=a.Ac;this.ob=a.ob;this.Bc=a.Bc;this.Q=new V(a.Q);this.R=new V(a.R);this.ab=new V(a.ab);this.Ja=a.Ja;this.xd=a.xd;this.zb=a.zb;this.n=a.n;this.Qa=a.Qa;L.i.Vb.call(this,a)};
L.prototype.mc=function(){this.d.length=0;this.Q.d.length=0;this.R.d.length=0;this.ab.d.length=0;this.d.push(this.Q);this.d.push(this.R);this.d.push(this.ab);for(var a=0,a=0;3>a;a++){for(var b=(this.G[a]-1)/2,c=b,d=0,d=0;d<this.G[a];d++){var e=-b*this.H[a]+d*this.H[a],f=[[this.l[0]+e,this.l[1],this.l[2]],[this.l[0],this.l[1]+e,this.l[2]],[this.l[0],this.l[1],this.l[2]+e]],e=this.d[a].d,g=0,h=0,l=[1,1,1],j=this.Qa;0==a?(g=this.G[2]*this.H[2]-this.H[2],h=this.G[1]*this.H[1]-this.H[1],l=[1,1,0]):1==
a?(g=this.G[0]*this.H[0]-this.H[0],h=this.G[2]*this.H[2]-this.H[2],l=[1,0,0]):2==a&&(g=this.G[0]*this.H[0]-this.H[0],h=this.G[1]*this.H[1]-this.H[1],l=[0,1,0]);x(this.cb)&&(j=r);var k=new we,o=k,f=f[a],s=[[1,0,0],[0,1,0],[0,0,1]][a],p=[[0,1,0],[0,0,-1],[0,1,0]][a];(!x(f)||!(f instanceof Array)||3!=f.length)&&i(Error("Invalid center."));(!x(s)||!(s instanceof Array)||3!=s.length)&&i(Error("Invalid front direction."));(!x(p)||!(p instanceof Array)||3!=p.length)&&i(Error("Invalid up direction."));z(g)||
i(Error("Invalid width."));z(h)||i(Error("Invalid height."));var w=r;x(j)&&(w=j);j=[1,1,1];x(l)&&(j=l);o.l=f;o.hc=s;o.J=p;o.K=g;o.F=h;o.Qa=w;o.dc=j;o.mc();k.cb=this;k.visible=d==Math.floor(c);e.push(k)}0==a?this.zc=this.mb=c:1==a?this.Ac=this.nb=c:2==a&&(this.Bc=this.ob=c)}this.e=n};
L.prototype.o=function(a){a="undefined"!==typeof a?a:n;if(0<this.d.length)if(this.Ja!=this.xd&&(this.Ja?(this.d[0].d[parseInt(this.mb,10)].visible=r,this.d[1].d[parseInt(this.nb,10)].visible=r,this.d[2].d[parseInt(this.ob,10)].visible=r):this.d[this.zb].visible=r,this.e=n,this.xd=this.Ja),this.Ja)xe(this,this.zb);else for(var b=0,b=0;3>b;b++){var c=this.d[b],d=0,e=0;0==b?(d=this.mb,e=this.zc,this.zc=this.mb):1==b?(d=this.nb,e=this.Ac,this.Ac=this.nb):2==b&&(d=this.ob,e=this.Bc,this.Bc=this.ob);c.d[parseInt(e,
10)].visible=r;c=c.d[parseInt(d,10)];c.visible=n;c.X=1}a&&L.i.o.call(this)};L.prototype.__defineGetter__("dimensions",t("G"));L.prototype.__defineGetter__("volumeRendering",t("Ja"));L.prototype.__defineSetter__("volumeRendering",function(a){this.Ja=a;this.o(r)});L.prototype.__defineSetter__("visible",ea("Ia"));L.prototype.__defineGetter__("center",t("l"));L.prototype.__defineSetter__("center",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid center."));this.l=a});
L.prototype.__defineGetter__("image",function(){for(var a=this.qa,b=this.G[0],c=this.G[1],d=this.G[2],e=Array(d),f=0,f=0;f<d;f++){e[f]=Array(c);for(var g=0,g=0;g<c;g++){e[f][g]=Array(b);for(var h=0,h=0;h<b;h++)e[f][g][h]=a*this.lb[f][g][h]/255}}return e});L.prototype.__defineGetter__("labelmap",function(){this.n||(this.n=new ye(this));return this.n});L.prototype.__defineGetter__("indexX",t("mb"));L.prototype.__defineSetter__("indexX",function(a){z(a)&&0<=a&&a<this.Q.d.length&&(this.mb=a,this.o(r))});
L.prototype.__defineGetter__("indexY",t("nb"));L.prototype.__defineSetter__("indexY",function(a){z(a)&&0<=a&&a<this.R.d.length&&(this.nb=a,this.o(r))});L.prototype.__defineGetter__("indexZ",t("ob"));L.prototype.__defineSetter__("indexZ",function(a){z(a)&&0<=a&&a<this.ab.d.length&&(this.ob=a,this.o(r))});L.prototype.__defineGetter__("windowLow",t("fa"));L.prototype.__defineSetter__("windowLow",ea("fa"));L.prototype.__defineGetter__("windowHigh",t("ea"));L.prototype.__defineSetter__("windowHigh",ea("ea"));
L.prototype.__defineGetter__("borders",t("Qa"));L.prototype.__defineSetter__("borders",ea("Qa"));function xe(a,b){if(a.Ja&&(a.e||b!=a.zb)){var c=a.d[a.zb];c.visible=r;var c=a.d[b],d=c.d.length,e;for(e=0;e<d;e++)c.d[e].Ia=n;a.zb=b;a.e=r}}D("X.volume",L);D("X.volume.prototype.modified",L.prototype.o);function ze(){W.call(this);this.c="parserSTL"}E(ze,W);
ze.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");this.ba=c;var d=b.g,e=b.h;if("solid"==String.fromCharCode.apply(q,Y(this,"uchar",5))){b.g=d=new Q(c.byteLength);b.h=e=new Q(c.byteLength);var f=d,d=e,e=Y(this,"uchar",c.byteLength-5),c=e.length,g=r,h=r,l=0,j;for(j=0;j<c;j++)if(10==e[j]){if(g||h){var k=String.fromCharCode.apply(q,e.subarray(l,j)).split(" "),h=parseFloat(k[0]),o=parseFloat(k[1]),k=parseFloat(k[2]);g?(d.add(h,o,k),d.add(h,o,k),d.add(h,o,k)):f.add(h,o,k);h=g=r}}else 32==e[j-1]&&
(102==e[j]?(l=j+=13,g=n):118==e[j]&&(l=j+=7,h=n))}else{this.w=80;f=Y(this,"uint");b.g=d=new Q(9*f);b.h=e=new Q(9*f);for(c=c=0;c<f;c++)g=Y(this,"float",12),l=g[0],j=g[1],h=g[2],e.add(l,j,h),e.add(l,j,h),e.add(l,j,h),d.add(g[3],g[4],g[5]),d.add(g[6],g[7],g[8]),d.add(g[9],g[10],g[11]),this.w+=2}H.Ba(this.c+".parse");f=new td;f.$=b;f.r=a;this.dispatchEvent(f)};D("X.parserSTL",ze);D("X.parserSTL.prototype.parse",ze.prototype.parse);function Ae(a){function b(){zc+=8;return fb<ta.length?ta[fb++]:-1}function c(){var a;zc++;a=Ga&1;Ga>>=1;0==Ga&&(Ga=b(),a=Ga&1,Ga=Ga>>1|128);return a}function d(a){for(var b=0,d=a;d--;)b=b<<1|c();a&&(b=G[b]>>8-a);return b}function e(a){y[B++]=a;if(P==w-1){var b=new Uint8Array(2*w);b.set(p);p=b;w*=2}p[P++]=a;32768==B&&(B=0)}function f(){this.Bd=this.Ad=0;this.Le=q}function g(){for(;;){if(gb[ya]>=hd)return-1;if(id[gb[ya]]==ya)return gb[ya]++;gb[ya]++}}function h(){var a=Ac[Eb],b;if(17==ya)return-1;Eb++;
ya++;b=g();if(0<=b)a.Ad=b;else if(a.Ad=32768,h())return-1;b=g();if(0<=b)a.Bd=b,a.Le=q;else if(a.Bd=32768,a.Le=Ac[Eb],a.Aj=Eb,h())return-1;ya--;return 0}function l(a,b,c){Ac=a;Eb=0;id=c;hd=b;for(a=0;17>a;a++)gb[a]=0;ya=0;return h()?-1:0}function j(a){for(var b,d,e=0,f=a[e];;)if(b=c()){if(!(f.Bd&32768))return f.Bd;f=f.Le;b=a.length;for(d=0;d<b;d++)if(a[d]===f){e=d;break}}else{if(!(f.Ad&32768))return f.Ad;e++;f=a[e]}}function k(){var a,g,h,k,o;do if(a=c(),h=d(2),0==h){Ga=1;h=b();h|=b()<<8;for(b(),b();h--;)g=
b(),e(g)}else if(1==h)for(;;)if(h=G[d(7)]>>1,23<h?(h=h<<1|c(),199<h?(h-=128,h=h<<1|c()):(h-=48,143<h&&(h+=136))):h+=256,256>h)e(h);else if(256==h)break;else{var p;h-=257;o=d(S[h])+O[h];h=G[d(5)]>>3;8<aa[h]?(p=d(8),p|=d(aa[h]-8)<<8):p=d(aa[h]);p+=ca[h];for(h=0;h<o;h++)g=y[B-p&32767],e(g)}else if(2==h){var s=Array(320);g=257+d(5);p=1+d(5);k=4+d(4);for(h=0;19>h;h++)s[h]=0;for(h=0;h<k;h++)s[ba[h]]=d(3);o=hb.length;for(k=0;k<o;k++)hb[k]=new f;if(l(hb,19,s)){B=0;return}o=g+p;k=0;for(var v=-1;k<o;)if(v++,
h=j(hb),16>h)s[k++]=h;else if(16==h){var w;h=3+d(2);if(k+h>o){B=0;return}for(w=k?s[k-1]:0;h--;)s[k++]=w}else{h=17==h?3+d(3):11+d(7);if(k+h>o){B=0;return}for(;h--;)s[k++]=0}o=Gb.length;for(k=0;k<o;k++)Gb[k]=new f;if(l(Gb,g,s)){B=0;return}o=Gb.length;for(k=0;k<o;k++)hb[k]=new f;h=[];for(k=g;k<s.length;k++)h[k-g]=s[k];if(l(hb,p,h)){B=0;return}for(;;)if(h=j(Gb),256<=h){h-=256;if(0==h)break;h--;o=d(S[h])+O[h];h=j(hb);8<aa[h]?(p=d(8),p|=d(aa[h]-8)<<8):p=d(aa[h]);for(p+=ca[h];o--;)g=y[B-p&32767],e(g)}else e(h)}while(!a);
B=0;Ga=1}function o(){var a=[],c;v&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());F&&s(ta.byteLength);a[0]=b();if(8==a[0]){v=b();b();b();b();b();b();b();if(v&4){a[0]=b();a[2]=b();ya=a[0]+256*a[1];for(a=0;a<ya;a++)b()}if(v&8){a=0;for(ob=[];c=b();){if("7"==c||":"==c)a=0;a<jd-1&&(ob[a++]=c)}}if(v&16)for(;b(););v&2&&(b(),b());k();b();b();b();b();b();b();b();b();F&&s(ta.byteLength)}}function s(a){w=a;p=new Uint8Array(a);
a=[];F=r;a[0]=b();a[1]=b();120==a[0]&&218==a[1]&&(k(),C[A]=Array(2),C[A][0]=p,C[A][1]="geonext.gxt",A++);31==a[0]&&139==a[1]&&(o(),C[A]=Array(2),C[A][0]=p,C[A][1]="file",A++);if(80==a[0]&&75==a[1]&&(F=n,a[2]=b(),a[3]=b(),3==a[2]&&4==a[3])){a[0]=b();a[1]=b();v=b();v|=b()<<8;a=b();a|=b()<<8;b();b();b();b();b();b();b();b();b();b();b();b();b();b();b();b();var c=b(),c=c|b()<<8,d=b(),d=d|b()<<8,e=0;for(ob=[];c--;){var f=b();"/"==f|":"==f?e=0:e<jd-1&&(ob[e++]=String.fromCharCode(f))}kd||(kd=ob);for(e=0;e<
d;)b(),e++;P=0;8==a&&(k(),C[A]=Array(2),C[A][0]=p,C[A][1]=ob.join(""),A++);o()}}var p=q,w=0,v,A=0,C=[],y=Array(32768),B=0,F=r,P=0,G=[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],O=[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],S=[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],ca=[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],aa=[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],ba=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ta=a,fb=0,Ga=1,zc=0,jd=256,ob=[],kd,Gb=Array(288),hb=Array(32),
Eb=0,Ac=q,ya=0,gb=Array(17);gb[0]=0;var id,hd;Ae.prototype.jf=function(){s(ta.byteLength);return p}};function Be(){W.call(this);this.c="parserDCM"}E(Be,W);Be.prototype.parse=function(a,b,c){c=this.bd(c,b);if(c.Md==c.Va){var d=c.df.length,e,f=0;for(e=0;e<d;e++){var g=c.df[e];g!==m&&(g*=c.ib,g=c.Rc.subarray(g,g+c.ib),c.data.set(g,f*c.ib),f++)}b.G=[c.ua[0],c.ua[1],c.ua[2]];b.H=[c.eb[0],c.eb[1],c.eb[2]];e=Rd(c.data);d=e[0];e=e[1];c.min=b.Ha=b.fa=d;c.max=b.qa=b.ea=e;-Infinity==b.ca&&(b.ca=d);Infinity==b.da&&(b.da=e);b.mc();b.lb=Sd(this,b,c)}c=new td;c.$=b;c.r=a;this.dispatchEvent(c)};
Be.prototype.bd=function(a,b){this.ba=a;if(x(b.cc)){d=b.cc;f=d.Xf;h=d.Wf;this.w=2*f;var c=Y(this,"uchar",h),c=parseInt(String.fromCharCode.apply(q,c),10);d.ua[2]++}else{var d={rows:0,cols:0,eb:q,te:0,Sg:0,Va:1,Fh:1,Xf:0,Wf:0,Md:0,ib:0,Rc:q,Ze:0,df:[],data:q,min:Infinity,max:-Infinity};d.Va=b.s.length;x(d.Va)||(d.Va=1);for(var e=Y(this,"ushort",this.ba.byteLength),f=66,g=h=q,h=q,c="",l=7;0<l;)if(h=e[f++],40==h)switch(g=e[f++],f++,h=e[f++],g){case 16:d.rows=e[f++];l--;break;case 17:d.cols=e[f++];l--;
break;case 256:d.te=e[f++];l--;break;case 257:d.Sg=e[f++];l--;break;case 2:d.Fh=e[f++];l--;break;case 48:for(var g="",j=0,j=0;j<h/2;j++)var k=e[f++],o=k&255,k=(k&65280)>>8,g=g+String.fromCharCode(o),g=g+String.fromCharCode(k);g=g.split("\\");d.eb=[parseInt(g[0],10),parseInt(g[1],10),1];l--}else if(32==h&&(g=e[f++],19==g)){f++;h=e[f++];d.Xf=f;d.Wf=h;for(j=0;j<h/2;j++)k=e[f++],o=k&255,k=(k&65280)>>8,c+=String.fromCharCode(o),c+=String.fromCharCode(k),c=parseInt(c,10);l--}b.cc=d;d.ua=[d.cols,d.rows,
1];d.ib=d.rows*d.cols;switch(d.te){case 8:d.Rc=new Uint8Array(d.cols*d.rows*d.Va);d.data=new Uint8Array(d.cols*d.rows*d.Va);break;case 16:d.Rc=new Uint16Array(d.cols*d.rows*d.Va);d.data=new Uint16Array(d.cols*d.rows*d.Va);break;case 32:d.Rc=new Uint32Array(d.cols*d.rows*d.Va),d.data=new Uint32Array(d.cols*d.rows*d.Va)}}this.w=this.ba.byteLength-2*d.ib;e=q;switch(d.te){case 8:e=Y(this,"uchar",d.ib);break;case 16:e=Y(this,"ushort",d.ib);break;case 32:e=Y(this,"uint",d.ib)}d.df[c]=d.Ze;d.Rc.set(e,d.Ze*
d.ib);d.Ze++;++d.Md;return d};D("X.parserDCM",Be);D("X.parserDCM.prototype.parse",Be.prototype.parse);function Ce(){W.call(this);this.c="parserVTK"}E(Ce,W);
Ce.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");var d=b.g,e=b.h,f=new Uint8Array(c),g="";b.g=d=new Q(c.byteLength);b.h=e=new Q(c.byteLength);for(var c=0,h=f.length;c<h;c+=32768)g+=String.fromCharCode.apply(q,f.subarray(c,Math.min(c+32768,h)));f=g.split("\n");g=f.length;this.Nc=this.Oc=q;this.Hb=[];this.ra=qd;this.ie=this.ub=this.kb=this.vb=r;c=0;for(h=g%8;h--;)De(this,f[c]),c++;for(h=0.125*g^0;h--;)De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++,
De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++;var c=this.Oc,f=this.Nc,g=f.length,l=h=this.Hb.length;do{var j=this.Hb[h-l],k=j.length,o;for(o=0;o<k&&!("LINES"==this.ra&&o+1>=k);o++){var s=parseInt(j[o],10),p=c.get(s);d.add(p[0],p[1],p[2]);var w=s,v=p;"LINES"==this.ra?(w=parseInt(j[o+1],10),v=c.get(w),d.add(v[0],v[1],v[2])):"TRIANGLE_STRIPS"==this.ra&&(0==o||o==k-1)&&d.add(p[0],p[1],p[2]);s<g?(v=f.get(s),e.add(v[0],v[1],v[2]),"LINES"==this.ra?(w=f.get(w),e.add(w[0],w[1],w[2])):"TRIANGLE_STRIPS"==
this.ra&&(0==o||o==k-1)&&e.add(v[0],v[1],v[2])):(w=new M(p[0],p[1],p[2]),w.normalize(),e.add(w.x,w.y,w.b),"LINES"==this.ra?(w=new M(v[0],v[1],v[2]),w.normalize(),e.add(w.x,w.y,w.b)):"TRIANGLE_STRIPS"==this.ra&&(0==o||o==k-1)&&e.add(w.x,w.y,w.b))}l--}while(0<l);b.ka=this.ra;H.Ba(this.c+".parse");d=new td;d.$=b;d.r=a;this.dispatchEvent(d)};
function De(a,b){var b=b.replace(/^\s+|\s+$/g,""),c=b.split(" "),d=c.length,e=c[0];switch(e){case "POINTS":a.vb=n;a.kb=r;a.ub=r;c=parseInt(c[1],10);a.Oc=new Q(3*c);a.Nc=new Q(3*c);return;case "VERTICES":a.kb=n;a.vb=r;a.ub=r;c=parseInt(c[1],10);3<=c?a.ra=qd:1==c?a.ra="POINTS":i(Error("This VTK file is not supported!"));a.Hb=[];return;case "TRIANGLE_STRIPS":a.kb=n;a.vb=r;a.ub=r;a.ra="TRIANGLE_STRIPS";a.Hb=[];return;case "LINES":a.kb=n;a.vb=r;a.ub=r;a.ra="LINES";a.Hb=[];return;case "POLYGONS":a.kb=n;
a.vb=r;a.ub=r;a.ra="POLYGONS";a.Hb=[];return;case "POINT_DATA":a.ub=n;a.vb=r;a.kb=r;return}if(a.vb)if(1==d||isNaN(parseFloat(e)))a.vb=r;else{if(3<=d){var e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]);a.Oc.add(e,f,g)}6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.Oc.add(e,f,g));9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.Oc.add(d,e,c))}else a.kb?1==d||isNaN(parseFloat(e))?a.kb=r:a.Hb.push(c.slice(1)):a.ub&&("NORMALS"==e?a.ie=n:1==d||isNaN(parseFloat(e))?
(a.ub=r,a.ie=r):a.ie&&(3<=d&&(e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]),a.Nc.add(e,f,g)),6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.Nc.add(e,f,g)),9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.Nc.add(d,e,c))))}D("X.parserVTK",Ce);D("X.parserVTK.prototype.parse",Ce.prototype.parse);function Ee(){W.call(this);this.c="parserFSM";this.od=r}E(Ee,W);
Ee.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");this.ba=c;var d=b.g,e=b.h,f=b.Jc,c=0,g;do g=Y(this,"uchar"),c++;while(200>c&&10!=g);Y(this,"uchar");var e=Y(this,"uint"),c=Y(this,"uint"),h=Y(this,"float",3*e);g=Y(this,"uint",3*c);var l=new Uint32Array(e),j=new Float32Array(9*c);b.g=d=new Q(9*c);b.h=e=new Q(9*c);var k;for(k=0;k<c;k++){var o=3*k,s=g[o],p=g[o+1],w=g[o+2];f.push(s);f.push(p);f.push(w);l[s]+=1;l[p]+=1;l[w]+=1;var o=3*s,v=3*p,A=3*w,C=h[o],y=h[o+1],B=h[o+2],p=h[v],w=h[v+1],s=h[v+
2],F=h[A],P=h[A+1],G=h[A+2];d.add(C,y,B);d.add(p,w,s);d.add(F,P,G);C=new M(C,y,B);F=new M(F,P,G);p=(new M(p,w,s)).f().gb(C);w=F.f().gb(C);p=Vc(p,w).normalize();j[o]+=p.x;j[o+1]+=p.y;j[o+2]+=p.b;j[v]+=p.x;j[v+1]+=p.y;j[v+2]+=p.b;j[A]+=p.x;j[A+1]+=p.y;j[A+2]+=p.b}for(k=0;k<c;k++)o=3*k,s=g[o],p=g[o+1],w=g[o+2],o=3*s,v=3*p,A=3*w,f=new M(j[v],j[v+1],j[v+2]),h=new M(j[A],j[A+1],j[A+2]),o=(new M(j[o],j[o+1],j[o+2])).scale(1/l[s]).normalize(),f=f.scale(1/l[p]).normalize(),h=h.scale(1/l[w]).normalize(),e.add(o.x,
o.y,o.b),e.add(f.x,f.y,f.b),e.add(h.x,h.y,h.b);b.ka=qd;H.Ba(this.c+".parse");c=new td;c.$=b;c.r=a;this.dispatchEvent(c)};D("X.parserFSM",Ee);D("X.parserFSM.prototype.parse",Ee.prototype.parse);function Fe(){W.call(this);this.c="parserMGZ";this.od=r}E(Fe,W);Fe.prototype.parse=function(a,b,c,d){H.Ga(this.c+".parse");var e=c;d&&(e=(new Ae(new Uint8Array(c))).jf(),e=e.buffer);c=this.bd(e);b.G=[c.Pe,c.Qe,c.Re];b.H=c.Ag;d=c.min;e=c.max;b.Ha=b.fa=d;b.qa=b.ea=e;-Infinity==b.ca&&(b.ca=d);Infinity==b.da&&(b.da=e);b.mc();H.Ba(this.c+".parse");b.lb=Sd(this,b,c);c=new td;c.$=b;c.r=a;this.dispatchEvent(c)};
Fe.prototype.bd=function(a){this.ba=a;a={version:0,Hg:0,Fg:0,jh:0,Gg:0,Pe:0,Qe:0,Re:0,Eh:0,type:0,bh:0,rg:0,Ri:q,Eg:q,Ag:q,data:q,min:Infinity,max:-Infinity};a.version=Y(this,"uint");a.Pe=Y(this,"uint");a.Qe=Y(this,"uint");a.Re=Y(this,"uint");a.Eh=Y(this,"uint");a.type=Y(this,"uint");a.bh=Y(this,"uint");a.rg=Y(this,"ushort");if(0<a.rg){a.Ag=Y(this,"float",3);var b=[];b.push(Y(this,"float",3));b.push(Y(this,"float",3));b.push(Y(this,"float",3));b.push(Y(this,"float",3));a.Eg=b}this.w=284;b=a.Pe*a.Qe*
a.Re;switch(a.type){case 0:a.data=Y(this,"uchar",b);break;case 1:a.data=Y(this,"uint",b);break;case 3:a.data=Y(this,"float",b);break;case 4:a.data=Y(this,"ushort",b);break;default:i(Error("Unsupported MGH/MGZ data type: "+a.type))}b=Rd(a.data);a.min=b[0];a.max=b[1];this.w+16<this.ba.byteLength&&(a.Hg=Y(this,"float"),a.jh=Y(this,"float"),a.Fg=Y(this,"float"),a.Gg=Y(this,"float"));return a};D("X.parserMGZ",Fe);D("X.parserMGZ.prototype.parse",Fe.prototype.parse);function Ge(){W.call(this);this.c="parserCRV";this.od=r}E(Ge,W);
Ge.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");var d=b.Jc;0==d.length&&i(Error("No _pointIndices defined on the X.object."));this.ba=c;this.w=3;var e=Y(this,"uint");Y(this,"uint");Y(this,"uint");var f=0,g=0,h=0,l=0,j=0,k=0,o=0,s=0,p=0,w=0,v=0,c=Array(2),A=Array(2),C=Y(this,"float",e),y;for(y=0;y<e;y++){var B=C[y];0==y&&(c[0]=A[0]=B);0<=B?(f++,l+=B):(g++,h+=B);p+=B;v++;A[0]=Math.max(B,A[0]);c[0]=Math.min(B,c[0]);C[y]=B}0!=f&&(j=l/f);0!=g&&(k=h/g);0!=v&&(w=p/v);for(v=p=h=l=0;v<e;v++)B=C[v],
y=0,0<=B?(y=Math.pow(B-j,2),l+=y):(y=Math.pow(B-k,2),h+=y),y=Math.pow(B-w,2),p+=y;1<f&&(o=Math.sqrt(l/(f-1)));1<g&&(s=Math.sqrt(h/(g-1)));c[1]=k-2.5*s;A[1]=j+2.5*o;e=d.length;f=new Float32Array(3*e);for(v=0;v<e;v++)g=C[d[v]],h=3*v,f[h]=g,f[h+1]=g,f[h+2]=g;b.t.Ha=c[1];b.t.qa=A[1];-Infinity==b.t.ca&&(b.t.ca=c[1]);Infinity==b.t.da&&(b.t.da=A[1]);b.t.u=C;b.t.yc=f;b.t.e=n;H.Ba(this.c+".parse");d=new td;d.$=b;d.r=a;this.dispatchEvent(d)};D("X.parserCRV",Ge);D("X.parserCRV.prototype.parse",Ge.prototype.parse);function He(){W.call(this);this.c="parserTRK"}E(He,W);
He.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");var d=b.g,e=b.h,f=b.U;this.ba=c;Y(this,"uchar",6);Y(this,"ushort",3);var g=Y(this,"float",3);Y(this,"float",3);Y(this,"ushort");Y(this,"uchar",200);Y(this,"ushort");Y(this,"uchar",200);Y(this,"float",16);Y(this,"uchar",444);Y(this,"uchar",4);Y(this,"uchar",4);Y(this,"float",6);Y(this,"uchar",2);Y(this,"uchar");Y(this,"uchar");Y(this,"uchar");Y(this,"uchar");Y(this,"uchar");Y(this,"uchar");var h=Y(this,"uint");Y(this,"uint");var l=Y(this,"uint"),
j=[],k=[],c=Infinity,o=-Infinity,s=q,p=q,w=q,v=q,e=d=q,A=Y(this,"uint",(this.ba.byteLength-1E3)/4);this.w=l;for(var C=Y(this,"float",(this.ba.byteLength-1E3)/4),y=0,l=f=0;l<h;l++){for(var B=A[y],F=new Q(3*B),P=0,G=0;G<B;G++){var O=C[y+3*G+1],S=C[y+3*G+2],ca=C[y+3*G+3],O=O/g[0],S=S/g[1],ca=ca/g[2];F.add(O,S,ca);if(0<G)var aa=F.get(G-1),P=P+Math.sqrt(Math.pow(O-aa[0],2)+Math.pow(S-aa[1],2)+Math.pow(ca-aa[2],2));G<B-1&&(f+=6)}y+=3*B+1;G=F.Ob;B=F.Lb;O=F.Pb;S=F.Mb;ca=F.Qb;aa=F.Nb;if(!s||G<s)s=G;if(!p||
B>p)p=B;if(!w||O<w)w=O;if(!v||S>v)v=S;if(!d||ca<d)d=ca;if(!e||aa>e)e=aa;j.push(F);k.push(P)}g=(s+p)/2;w=(w+v)/2;s=(d+e)/2;v=new Float32Array(f);b.g=d=new Q(f);b.h=e=new Q(f);b.U=f=new Q(f);for(l=p=0;l<h;l++){A=j[l];C=A.count;P=k[l];c=Math.min(c,P);o=Math.max(o,P);for(G=0;G<C-1;G++){F=A.get(G);y=A.get(G+1);d.add(F[0],F[1],F[2]);d.add(y[0],y[1],y[2]);var B=F[0]-g,O=F[1]-w,S=F[2]-s,ca=Math.sqrt(B*B+O*O+S*S),aa=y[0]-g,ba=y[1]-w,ta=y[2]-s,fb=Math.sqrt(aa*aa+ba*ba+ta*ta);e.add(B/ca,O/ca,S/ca);e.add(aa/
fb,ba/fb,ta/fb);y=[Math.abs(y[0]-F[0]),Math.abs(y[1]-F[1]),Math.abs(y[2]-F[2])];F=Math.sqrt(y[0]*y[0]+y[1]*y[1]+y[2]*y[2]);y[0]/=F;y[1]/=F;y[2]/=F;f.add(y[0],y[1],y[2]);f.add(y[0],y[1],y[2]);v[p++]=P;v[p++]=P;v[p++]=P;v[p++]=P;v[p++]=P;v[p++]=P}}b.ka="LINES";h=new sd;h.Ha=c;h.qa=o;h.ca=c;h.da=o;h.yc=v;h.Af=r;h.e=n;b.t=h;H.Ba(this.c+".parse");c=new td;c.$=b;c.r=a;this.dispatchEvent(c)};D("X.parserTRK",He);D("X.parserTRK.prototype.parse",He.prototype.parse);function Ie(){W.call(this);this.c="parserIMAGE"}E(Ie,W);Ie.prototype.parse=function(a,b,c,d){c instanceof ArrayBuffer||i(Error());for(var e=new Uint8Array(c),f=e.length,g=Array(f);f--;)g[f]=String.fromCharCode(e[f]);e=window.btoa(g.join(""));f=new Image;uc(f,"load",this.Zh.bind(this,f,a,b,c,d));f.src="data:image/"+d+";base64,"+e};Ie.prototype.Zh=function(a,b,c){b.lb=a;b.ta=q;a=new td;a.$=c;a.r=b;this.dispatchEvent(a)};D("X.parserIMAGE",Ie);D("X.parserIMAGE.prototype.parse",Ie.prototype.parse);function Je(){W.call(this);this.c="parserLUT"}E(Je,W);
Je.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");this.ba=c;var c=Y(this,"uchar",c.byteLength),d=c.length,e=0,f;for(f=0;f<d;f++)if(10==c[f]){var g=String.fromCharCode.apply(q,c.subarray(e,f)),e=f+1,g=g.replace(/^\s+|\s+$/g,"");"#"!=g[0]&&(g=g.split(" "),g=g.filter(function(a){return""!=a}),6==g.length&&(g[2]=parseInt(g[2],10)/255,g[3]=parseInt(g[3],10)/255,g[4]=parseInt(g[4],10)/255,g[5]=parseInt(g[5],10)/255,a.add(parseInt(g[0],10),g[1],g[2],g[3],g[4],g[5],10)))}H.Ba(this.c+".parse");c=new td;
c.$=b;c.r=a;this.dispatchEvent(c)};D("X.parserLUT",Je);D("X.parserLUT.prototype.parse",Je.prototype.parse);function Ke(){W.call(this);this.c="parserNRRD"}E(Ke,W);
Ke.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");this.ba=c;var c=Y(this,"uchar",c.byteLength),d=c.length,e=q,f=0,g;for(g=1;g<d;g++)if(10==c[g-1]&&10==c[g]){e=String.fromCharCode.apply(q,c.subarray(0,g-2));f=g+1;break}var h,l,j,k,d=e.split(/\r?\n/);for(e=0,g=d.length;e<g;e++)if(h=d[e],h.match(/NRRD\d+/))this.Ah=n;else if(!h.match(/^#/)&&(k=h.match(/(.*):(.*)/)))l=k[1].trim(),h=k[2].trim(),(j=this.fh[l])?j.call(this,h):this[l]=h;this.Ah||i(Error("Not an NRRD file"));"raw"!==this.encoding&&"gzip"!==
this.encoding&&"gz"!==this.encoding&&i(Error("Only raw or gz/gzip encoding is allowed"));if(!this.Fa&&(this.Fa=[new M(1,0,0),new M(0,1,0),new M(0,0,1)],this.ef)){d=[];for(k=0;2>=k;k++)d.push(!isNaN(this.ef[k])?this.Fa[k].scale(this.ef[k]):m)}f=c.subarray(f);if("gzip"==this.encoding||"gz"==this.encoding)f=(new Ae(f)).jf();f=f.buffer;c={data:q,min:Infinity,max:-Infinity};c.data=new this.Db(f);k=Rd(c.data);f=c.min=k[0];k=c.max=k[1];b.G=[this.bf[0],this.bf[1],this.bf[2]];b.H=[(new M(this.Fa[0][0],this.Fa[0][1],
this.Fa[0][2])).$b(),(new M(this.Fa[1][0],this.Fa[1][1],this.Fa[1][2])).$b(),(new M(this.Fa[2][0],this.Fa[2][1],this.Fa[2][2])).$b()];b.Ha=b.fa=f;b.qa=b.ea=k;-Infinity==b.ca&&(b.ca=f);Infinity==b.da&&(b.da=k);b.mc();H.Ba(this.c+".parse");b.lb=Sd(this,b,c);c=new td;c.$=b;c.r=a;this.dispatchEvent(c)};
Ke.prototype.fh={type:function(a){switch(a){case "uchar":case "unsigned char":case "uint8":case "uint8_t":this.Db=Uint8Array;break;case "signed char":case "int8":case "int8_t":this.Db=Int8Array;break;case "short":case "short int":case "signed short":case "signed short int":case "int16":case "int16_t":this.Db=Int16Array;break;case "ushort":case "unsigned short":case "unsigned short int":case "uint16":case "uint16_t":this.Db=Uint16Array;break;case "int":case "signed int":case "int32":case "int32_t":this.Db=
Int32Array;break;case "uint":case "unsigned int":case "uint32":case "uint32_t":this.Db=Uint32Array;break;case "float":this.Db=Float32Array;break;default:i(Error("Unsupported NRRD data type: "+a))}return this.type=a},endian:function(a){return a},encoding:function(a){return this.encoding=a},dimension:function(a){return this.ua=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.bf=e},"space directions":function(a){var b,
c,d;c=a.match(/\(.*?\)/g);return this.Fa=function(){var a,f,g;g=[];for(a=0,f=c.length;a<f;a++)d=c[a],g.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 g}()},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.ef=e}};D("X.parserNRRD",Ke);D("X.parserNRRD.prototype.parse",Ke.prototype.parse);function Le(){W.call(this);this.c="parserNII"}E(Le,W);Le.prototype.parse=function(a,b,c){H.Ga(this.c+".parse");var d=c;348!=(new Uint32Array(c,0,1))[0]&&(d=(new Ae(new Uint8Array(c))).jf(),d=d.buffer);c=this.bd(d);b.G=[c.ua[1],c.ua[2],c.ua[3]];b.H=[c.eb[1],c.eb[2],c.eb[3]];var d=c.min,e=c.max;b.Ha=b.fa=d;b.qa=b.ea=e;-Infinity==b.ca&&(b.ca=d);Infinity==b.da&&(b.da=e);b.mc();H.Ba(this.c+".parse");b.lb=Sd(this,b,c);c=new td;c.$=b;c.r=a;this.dispatchEvent(c)};
Le.prototype.bd=function(a){this.ba=a;a={vi:0,Wg:q,Xg:q,eh:0,pi:0,hi:0,$g:q,ua:q,vh:0,wh:0,xh:0,th:0,Ce:0,Rg:0,zi:0,eb:q,Bg:0,oi:0,ni:0,yi:0,wi:q,Ni:q,Tg:0,Ug:0,xi:0,Gi:0,lh:0,mh:0,Zg:q,Qg:q,ai:0,ti:0,ei:0,fi:0,gi:0,bi:0,ci:0,di:0,Ai:q,Bi:q,Ci:q,uh:q,Bh:q,data:q,min:Infinity,max:-Infinity};a.vi=Y(this,"uint");a.Wg=Y(this,"uchar",10);a.Xg=Y(this,"uchar",18);a.eh=Y(this,"uint");a.pi=Y(this,"ushort");a.hi=Y(this,"uchar");a.$g=Y(this,"uchar");a.ua=Y(this,"ushort",8);a.vh=Y(this,"float");a.wh=Y(this,"float");
a.xh=Y(this,"float");a.th=Y(this,"ushort");a.Ce=Y(this,"ushort");a.Rg=Y(this,"ushort");a.zi=Y(this,"ushort");a.eb=Y(this,"float",8);a.Bg=Y(this,"float");a.oi=Y(this,"float");a.ni=Y(this,"float");a.yi=Y(this,"ushort");a.wi=Y(this,"uchar");a.Ni=Y(this,"uchar");a.Tg=Y(this,"float");a.Ug=Y(this,"float");a.xi=Y(this,"float");a.Gi=Y(this,"float");a.lh=Y(this,"uint",1);a.mh=Y(this,"uint",1);a.Zg=Y(this,"uchar",80);a.Qg=Y(this,"uchar",24);a.ai=Y(this,"ushort");a.ti=Y(this,"ushort");a.ei=Y(this,"float");a.fi=
Y(this,"float");a.gi=Y(this,"float");a.bi=Y(this,"float");a.ci=Y(this,"float");a.di=Y(this,"float");a.Ai=Y(this,"float",4);a.Bi=Y(this,"float",4);a.Ci=Y(this,"float",4);a.uh=Y(this,"uchar",16);a.Bh=Y(this,"uchar",4);this.w=parseInt(a.Bg,10);var b=a.ua[1]*a.ua[2]*a.ua[3];switch(a.Ce){case 2:a.data=Y(this,"uchar",b);break;case 4:a.data=Y(this,"sshort",b);break;case 8:a.data=Y(this,"sint",b);break;case 16:a.data=Y(this,"float",b);break;case 256:a.data=Y(this,"schar",b);break;case 512:a.data=Y(this,"ushort",
b);break;case 768:a.data=Y(this,"uint",b);break;default:i(Error("Unsupported NII data type: "+a.Ce))}b=Rd(a.data);a.min=b[0];a.max=b[1];return a};D("X.parserNII",Le);D("X.parserNII.prototype.parse",Le.prototype.parse);function Me(){K.call(this);this.c="loader";this.ic=new Qb;this.Lc=0}E(Me,K);function Ne(a,b){a.Lc+=b/a.ic.na()/3;a.Lc=Math.min(1,a.Lc);var c=new Qd;c.Bf=a.Lc;a.dispatchEvent(c)}function Oe(a){var a=a.s.ke,b=a.split(".").pop().toUpperCase();b==a.toUpperCase()&&(b="");b in Pe||i(Error("The "+b+" file format is not supported."));return[a,b,Pe[b][0],Pe[b][1],Pe[b][2]]}
Me.prototype.load=function(a,b){(!a||!b)&&i(Error("No container or object to load."));if(!Sb(this.ic.C,a.pa)||this.ic.get(a.pa)){this.ic.set(a.pa,r);var c=Oe(a)[0];if(a.Gb!=q)this.parse(q,a,b);else{var d=new XMLHttpRequest;J(d,"abort",this.Nf.bind(this,d,a,b));J(d,"error",this.Nf.bind(this,d,a,b));J(d,"load",this.parse.bind(this,d,a,b));d.open("GET",c,n);d.responseType="arraybuffer";d.send(q)}}};
Me.prototype.parse=function(a,b,c){Ne(this,1);setTimeout(function(){var d=Oe(b),e=d[3],d=new d[2];uc(d,Cc,this.complete.bind(this));var f=b.Gb;f==q&&(f=a.response);d.parse(b,c,f,e)}.bind(this),100)};Me.prototype.complete=function(a){Ne(this,1);setTimeout(function(){var b=a.r,c=a.$;b.s.e=r;b.e=n;c.o();this.ic.set(b.pa,n)}.bind(this),100)};Me.prototype.Nf=function(a,b,c){i(Error("Loading failed: ",b,c))};
var Pe={STL:[ze,q],VTK:[Ce,q],TRK:[He,q],FSM:[Ee,q],INFLATED:[Ee,q],SMOOTHWM:[Ee,q],SPHERE:[Ee,q],PIAL:[Ee,q],ORIG:[Ee,q],NRRD:[Ke,q],NII:[Le,q],GZ:[Le,q],DCM:[Be,q],DICOM:[Be,q],"":[Be,q],CRV:[Ge,q],LABEL:[Zd,q],MGH:[Fe,r],MGZ:[Fe,n],TXT:[Je,q],LUT:[Je,q],PNG:[Ie,"png"],JPG:[Ie,"jpeg"],JPEG:[Ie,"jpeg"],GIF:[Ie,"gif"]};function Qe(a,b){(!z(a)||!z(b))&&i(Error("A camera needs valid width and height values."));K.call(this);this.c="camera";this.sa=new M(0,0,100);this.gc=new M(0,0,0);this.J=new M(0,1,0);this.m=this.Od(this.sa,this.gc);this.Ib=new Float32Array(this.m.Da())}E(Qe,K);Qe.prototype.Uh=function(a){a instanceof Kd||i(Error("Received no valid rotate event."));this.rotate(a.W)};Qe.prototype.Yh=function(a){a instanceof Ld||i(Error("Received no valid zoom event."));a.Jb?this.Cg(a.jb):this.Dg(a.jb)};
Qe.prototype.Rh=function(a){a instanceof Jd||i(Error("Received no valid pan event."));this.ng(a.W)};Qe.prototype.__defineGetter__("view",t("m"));Qe.prototype.__defineSetter__("view",function(a){(!x(a)||!(a instanceof N))&&i(Error("Invalid view matrix."));this.m=a;this.Ib=new Float32Array(this.m.Da())});Qe.prototype.__defineGetter__("position",function(){return[this.sa.x,this.sa.y,this.sa.b]});
Qe.prototype.__defineSetter__("position",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid position."));this.sa=new M(a[0],a[1],a[2]);this.reset()});Qe.prototype.__defineGetter__("focus",function(){return[this.gc.x,this.gc.y,this.gc.b]});Qe.prototype.__defineSetter__("focus",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid focus"));this.gc=new M(a[0],a[1],a[2]);this.reset()});Qe.prototype.__defineGetter__("up",function(){return[this.J.x,this.J.y,this.J.b]});
Qe.prototype.__defineSetter__("up",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid up vector."));this.J=new M(a[0],a[1],a[2]);this.reset()});u=Qe.prototype;u.reset=function(){this.m=this.Od(this.sa,this.gc);this.Ib=new Float32Array(this.m.Da())};u.rotate=function(a){a instanceof Array&&2==a.length?a=new Yc(a[0],a[1]):a instanceof Yc||i(Error("Invalid distance vector for rotate operation."));return a};
u.ng=function(a){a instanceof Array&&2==a.length?a=new Yc(a[0],a[1]):a instanceof Yc||i(Error("Invalid distance vector for pan operation."));a=new M(-a.x,a.y,0);a=md(4).translate(a);this.m=new N(a.multiply(this.m));this.Ib=new Float32Array(this.m.Da())};u.Cg=function(a){var b=20;x(a)&&!a&&(b=1);a=new M(0,0,b);a=md(4).translate(a);this.m=new N(a.multiply(this.m));this.Ib=new Float32Array(this.m.Da())};
u.Dg=function(a){var b=30;x(a)&&!a&&(b=1);a=new M(0,0,-b);a=md(4).translate(a);this.m=new N(a.multiply(this.m));this.Ib=new Float32Array(this.m.Da())};u.Od=function(a,b){(!(a instanceof M)||!(b instanceof M))&&i(Error("3D vectors required for calculating the view."));return md(4)};D("X.camera",Qe);D("X.camera.prototype.pan",Qe.prototype.ng);D("X.camera.prototype.rotate",Qe.prototype.rotate);D("X.camera.prototype.zoomIn",Qe.prototype.Cg);D("X.camera.prototype.zoomOut",Qe.prototype.Dg);function Re(a){function b(a,b,d){b=2*b*Math.PI;b=l.Cb(Math.cos(b)).rc(j.Cb(Math.sin(b)));a=c.rc(e.Cb(a)).rc(b.Cb(f));d=b.Cb(1-Math.abs(d)).rc(g.Cb(d));return new Ic(a,d)}this.A=[];for(var a=a||{},c=new Aa(a.start||[0,-1,0]),d=new Aa(a.end||[0,1,0]),e=d.$c(c),f=a.Wa||1,a=a.cf||16,g=e.gd(),h=0.5<Math.abs(g.y()),l=(new Aa(h,!h,0)).Ae(g).gd(),j=l.Ae(g).gd(),h=new Ic(c,g.Se()),d=new Ic(d,g.gd()),k=[],o=0;o<a;o++){var s=o/a,p=(o+1)/a;k.push(new Kc([h,b(0,s,-1),b(0,p,-1)]));k.push(new Kc([b(0,p,0),b(0,s,
0),b(1,s,0),b(1,p,0)]));k.push(new Kc([d,b(1,p,1),b(1,s,1)]))}return Nc(k)}E(Re,Mc);function Se(){V.call(this);this.c="cylinder";this.pe=[-10,-10,-10];this.Yd=[10,10,10];this.Rb=10;this.Sb=32;Ba(this,new vd)}E(Se,V);Se.prototype.__defineGetter__("start",t("pe"));Se.prototype.__defineSetter__("start",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid start"));this.pe=a});Se.prototype.__defineGetter__("end",t("Yd"));Se.prototype.__defineSetter__("end",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid end"));this.Yd=a});
Se.prototype.__defineGetter__("radius",t("Rb"));Se.prototype.__defineSetter__("radius",function(a){z(a)||i(Error("Invalid radius."));this.Rb=a});Se.prototype.o=function(){xd(this,new Re({start:this.pe,end:this.Yd,Wa:this.Rb,cf:this.Sb}));Se.i.o.call(this)};D("X.cylinder",Se);D("X.cylinder.prototype.modified",Se.prototype.o);function Te(a){function b(a,b){var a=a*2*Math.PI,b=b*Math.PI,e=new Aa(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));g.push(new Ic(c.rc(e.Cb(d)),e))}this.A=[];for(var a=a||{},c=new Aa(a.we||[0,0,0]),d=a.Wa||1,e=a.cf||16,a=a.Di||8,f=[],g=[],h=0;h<e;h++)for(var l=0;l<a;l++)g=[],b(h/e,l/a),0<l&&b((h+1)/e,l/a),l<a-1&&b((h+1)/e,(l+1)/a),b(h/e,(l+1)/a),f.push(new Kc(g));return Nc(f)}E(Te,Mc);function Ue(){V.call(this);this.c="sphere";this.l=[0,0,0];this.Rb=5;this.Sb=32;this.Og=16;Ba(this,new vd)}E(Ue,V);Ue.prototype.__defineGetter__("center",t("l"));Ue.prototype.__defineSetter__("center",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid center"));this.l=a});Ue.prototype.__defineGetter__("radius",t("Rb"));Ue.prototype.__defineSetter__("radius",function(a){z(a)||i(Error("Invalid radius."));this.Rb=a});
Ue.prototype.o=function(){xd(this,new Te({we:this.l,Wa:this.Rb,cf:this.Sb,Di:this.Og}));Ue.i.o.call(this)};D("X.sphere",Ue);D("X.sphere.prototype.modified",Ue.prototype.o);function ye(a){L.call(this);this.c="labelmap";this.cb=a}E(ye,L);ye.prototype.o=function(){var a=new td;a.$=this;this.dispatchEvent(a);this.cb.o()};D("X.labelmap",ye);function Ve(a){this.A=[];var a=a||{},b=new Aa(a.we||[0,0,0]),c=!a.Wa?[1,1,1]:a.Wa.length?a.Wa:[a.Wa,a.Wa,a.Wa];return Nc([[[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 Kc(a[0].map(function(e){e=new Aa(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 Ic(e,new Aa(a[1]))}))}))}E(Ve,Mc);function We(){V.call(this);this.c="cube";this.l=[0,0,0];this.de=this.ce=this.be=20;this.Tb=[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];Ba(this,new vd)}E(We,V);We.prototype.__defineGetter__("center",t("l"));We.prototype.__defineSetter__("center",function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&i(Error("Invalid center"));this.l=a});We.prototype.__defineGetter__("lengthX",t("be"));
We.prototype.__defineSetter__("lengthX",function(a){z(a)||i(Error("Invalid lengthX."));this.be=a});We.prototype.__defineGetter__("lengthY",t("ce"));We.prototype.__defineSetter__("lengthY",function(a){z(a)||i(Error("Invalid lengthY."));this.ce=a});We.prototype.__defineGetter__("lengthZ",t("de"));We.prototype.__defineSetter__("lengthZ",function(a){z(a)||i(Error("Invalid lengthZ."));this.de=a});We.prototype.o=function(){xd(this,new Ve({we:this.l,Wa:[this.be/2,this.ce/2,this.de/2]}));We.i.o.call(this)};
D("X.cube",We);D("X.cube.prototype.modified",We.prototype.o);function Xe(a){Z.call(this,a);this.c="interactor3D"}E(Xe,Z);Xe.prototype.ad=function(a){Xe.i.ad.call(this,a);var b=new Ld;x(a.nc)||(a.nc=0);b.Jb=0>a.nc;b.jb=n;this.dispatchEvent(b)};function Ye(a){K.call(this);this.c="array";this.u=[];this.nf=a}E(Ye,K);Ye.prototype.add=function(a){this.u.push(a);return n};Ye.prototype.clear=function(){this.u.length=0};function Ze(a,b,c){var d=c-b;if(!(2>d)){d=b+Math.floor(d/2);Ze(a,b,d);for(Ze(a,d,c);b<d;++b)if(0<a.nf(a.u[b],a.u[d])){var e=a.u[b];a.u[b]=a.u[d];for(var f=a,g=d,h=c;g+1<h&&0>f.nf(f.u[g+1],e);){var l=f,j=g+1,k=l.u[g];l.u[g]=l.u[j];l.u[j]=k;++g}f.u[g]=e}}}Ye.prototype.sort=function(){Ze(this,0,this.u.length)};function $e(a,b){Qe.call(this,a,b);this.c="camera2D"}E($e,Qe);$e.prototype.rotate=function(a){var a=$e.i.rotate.call(this,a),b=new Id;0<a.x?b.re--:0>a.x&&b.re++;0<a.y?b.ee++:0>a.y&&b.ee--;this.dispatchEvent(b)};function af(a,b){Qe.call(this,a,b);this.c="camera3D";this.of=45;this.xf=new Float32Array(bf(this.of,a/b).Da())}E(af,Qe);function bf(a,b){var c=1*Math.tan(a*Math.PI/360),d=-c;return new N([[2/(c*b-d*b),0,(c*b+d*b)/(c*b-d*b),0],[0,2/(c-d),(c+d)/(c-d),0],[0,0,-10001/9999,-2.000200020002],[0,0,-1,0]])}
af.prototype.rotate=function(a){var a=af.i.rotate.call(this,a),b=-a.x/5*Math.PI/180,a=-a.y/5*Math.PI/180,c=md(4),d=new M(parseFloat(this.m.T(0,0)),parseFloat(this.m.T(0,1)),parseFloat(this.m.T(0,2))),b=c.rotate(b,new M(parseFloat(this.m.T(1,0)),parseFloat(this.m.T(1,1)),parseFloat(this.m.T(1,2)))),a=c.rotate(a,d);this.m=new N(this.m.multiply(a.multiply(b)));this.Ib=new Float32Array(this.m.Da())};
af.prototype.Od=function(a,b){af.i.Od.call(this,a,b);var c=md(4),d=new M(a.x-b.x,a.y-b.y,a.b-b.b),d=d.normalize(),e=this.J.f();e.Sc(d)&&(e.b+=1.0E-6);var f=Vc(e,d),e=Vc(d,f),f=f.normalize(),e=e.normalize();c.k(0,0,f.x);c.k(0,1,f.y);c.k(0,2,f.b);c.k(0,3,0);c.k(1,0,e.x);c.k(1,1,e.y);c.k(1,2,e.b);c.k(1,3,0);c.k(2,0,d.x);c.k(2,1,d.y);c.k(2,2,d.b);c.k(2,3,0);c.k(3,0,0);c.k(3,1,0);c.k(3,2,0);c.k(3,3,1);d=a.f();return c.translate(d.Y())};D("X.camera3D",af);function cf(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}cf.prototype.f=function(){return new cf(this.top,this.right,this.bottom,this.left)};cf.prototype.contains=function(a){return!this||!a?r:a instanceof cf?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 df(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}df.prototype.f=function(){return new df(this.left,this.top,this.width,this.height)};df.prototype.Yf=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,n}return r};
df.prototype.contains=function(a){return a instanceof df?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};df.prototype.va=function(){return new Zc(this.width,this.height)};function ef(a,b){var c=ge(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,q))?c[b]||c.getPropertyValue(b):""}function ff(a,b){return a.currentStyle?a.currentStyle[b]:q}function gf(a,b){return ef(a,b)||ff(a,b)||a.style&&a.style[b]}function hf(a){a=a?9==a.nodeType?a:ge(a):document;return I&&!qb(9)&&!re(ee(a))?a.body:a.documentElement}
function jf(a){var b=a.getBoundingClientRect();I&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function kf(a){if(I&&!qb(8))return a.offsetParent;for(var b=ge(a),c=gf(a,"position"),d="fixed"==c||"absolute"==c,a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=gf(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 lf(a){for(var b=new cf(0,Infinity,Infinity,0),c=ee(a),d=c.N.body,e=c.N.documentElement,f=!Xa&&"CSS1Compat"==c.N.compatMode?c.N.documentElement:c.N.body;a=kf(a);)if((!I||0!=a.clientWidth)&&(!Xa||0!=a.clientHeight||a!=d)&&a!=d&&a!=e&&"visible"!=gf(a,"overflow")){var g=mf(a),h;h=a;if(Wa&&!nb("1.9")){var l=parseFloat(ef(h,"borderLeftWidth"));if(nf(h))var j=h.offsetWidth-h.clientWidth-l-parseFloat(ef(h,"borderRightWidth")),l=l+j;h=new Wc(l,parseFloat(ef(h,"borderTopWidth")))}else h=new Wc(h.clientLeft,
h.clientTop);g.x+=h.x;g.y+=h.y;b.top=Math.max(b.top,g.y);b.right=Math.min(b.right,g.x+a.clientWidth);b.bottom=Math.min(b.bottom,g.y+a.clientHeight);b.left=Math.max(b.left,g.x)}d=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,f);c=c.N.parentWindow||c.N.defaultView||window;e=c.document;Xa&&!nb("500")&&!Ya?("undefined"==typeof c.innerHeight&&(c=window),e=c.innerHeight,a=c.document.documentElement.scrollHeight,c==c.top&&a<e&&(e-=15),c=new Zc(c.innerWidth,e)):(c="CSS1Compat"==
e.compatMode?e.documentElement:e.body,c=new Zc(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 mf(a){var b,c=ge(a),d=gf(a,"position"),e=Wa&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new Wc(0,0),g=hf(c);if(a==g)return f;if(a.getBoundingClientRect)b=jf(a),a=se(ee(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!e)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(g),f.x=b.screenX-a.screenX,f.y=b.screenY-a.screenY;else{b=a;do{f.x+=b.offsetLeft;f.y+=b.offsetTop;b!=a&&(f.x+=b.clientLeft||0,f.y+=b.clientTop||0);
if(Xa&&"fixed"==gf(b,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(Va||Xa&&"absolute"==d)f.y-=c.body.offsetTop;for(b=a;(b=kf(b))&&b!=c.body&&b!=g;)if(f.x-=b.scrollLeft,!Va||"TR"!=b.tagName)f.y-=b.scrollTop}return f}function of(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}
function pf(a){if("none"!=gf(a,"display"))return qf(a);var b=a.style,c=b.display,d=b.visibility,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=qf(a);b.display=c;b.position=e;b.visibility=d;return a}function qf(a){var b=a.offsetWidth,c=a.offsetHeight,d=Xa&&!b&&!c;return(!ia(b)||d)&&a.getBoundingClientRect?(a=jf(a),new Zc(a.right-a.left,a.bottom-a.top)):new Zc(b,c)}function rf(a,b){a.style.display=b?"":"none"}function nf(a){return"rtl"==gf(a,"direction")}
function sf(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 tf={thin:2,medium:4,thick:6};function uf(a,b){if("none"==ff(a,b+"Style"))return 0;var c=ff(a,b+"Width");return c in tf?tf[c]:sf(a,c)};function vf(a){this.Ma=a;this.v=[]}E(vf,Xb);var wf=[];function xf(a,b,c,d,e){ja(c)||(wf[0]=c,c=wf);for(var f=0;f<c.length;f++)a.v.push(J(b,c[f],d||a,e||r,a.Ma||a))}vf.prototype.Rd=function(){yb(this.v,wc);this.v.length=0};vf.prototype.M=function(){vf.i.M.call(this);this.Rd()};vf.prototype.handleEvent=function(){i(Error("EventHandler.handleEvent not implemented"))};function yf(){}(function(a){a.Of=function(){return a.sh||(a.sh=new a)}})(yf);yf.prototype.Te=0;yf.Of();function zf(a){this.Ta=a||ee()}E(zf,Hc);u=zf.prototype;u.qh=yf.Of();u.Vf=q;u.Zb=r;u.p=q;u.qc=q;u.Cd=q;u.Qc=q;u.Mi=r;u.j=t("p");u.af=function(a){this.qc&&this.qc!=a&&i(Error("Method not supported"));zf.i.af.call(this,a)};u.Gd=t("Ta");u.lc=function(){this.p=this.Ta.createElement("div")};u.bc=function(a){this.Bb(a)};u.Bb=function(a,b){this.Zb&&i(Error("Component already rendered"));this.p||this.lc();a?a.insertBefore(this.p,b||q):this.Ta.N.body.appendChild(this.p);(!this.qc||this.qc.Zb)&&this.Fd()};
u.Fd=function(){this.Zb=n;Af(this,function(a){!a.Zb&&a.j()&&a.Fd()})};u.Uc=function(){Af(this,function(a){a.Zb&&a.Uc()});this.Kd&&this.Kd.Rd();this.Zb=r};u.M=function(){zf.i.M.call(this);this.Zb&&this.Uc();this.Kd&&(this.Kd.La(),delete this.Kd);Af(this,function(a){a.La()});!this.Mi&&this.p&&oe(this.p);this.qc=this.p=this.Qc=this.Cd=q};function Af(a,b){a.Cd&&yb(a.Cd,b,m)}
u.removeChild=function(a,b){if(a){var c=la(a)?a:a.Vf||(a.Vf=":"+(a.qh.Te++).toString(36)),a=this.Qc&&c?(c in this.Qc?this.Qc[c]:m)||q:q;if(c&&a){var d=this.Qc;c in d&&delete d[c];Cb(this.Cd,a);b&&(a.Uc(),a.p&&oe(a.p));c=a;c==q&&i(Error("Unable to set parent component"));c.qc=q;zf.i.af.call(c,q)}}a||i(Error("Child is not in parent component"));return a};function Bf(){}E(Bf,Hc);u=Bf.prototype;u.kf=0;u.Zc=0;u.Oe=100;u.Mf=0;u.ff=1;u.zh=r;u.Dh=r;u.Ud=function(a){a=Cf(this,a);this.kf!=a&&(this.kf=a+this.Mf>this.Oe?this.Oe-this.Mf:a<this.Zc?this.Zc:a,!this.zh&&!this.Dh&&this.dispatchEvent("change"))};u.Jd=function(){return Cf(this,this.kf)};u.Id=function(){return Cf(this,this.Zc)};u.Hd=function(){return Cf(this,this.Oe)};function Cf(a,b){return a.ff==q?b:a.Zc+Math.round((b-a.Zc)/a.ff)*a.ff};function Df(a){this.Ta=a||ee();this.sc=new Bf;J(this.sc,"change",this.nh,r,this)}E(Df,zf);var Ef={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};u=Df.prototype;u.lc=function(){this.Pa=this.Gd().lc("div","progress-bar-thumb");var a=Ef[this.mg];this.p=this.Gd().lc("div",a,this.Pa);Ff(this);this.j().setAttribute("aria-valuemin",this.Id());this.j().setAttribute("aria-valuemax",this.Hd())};
u.Fd=function(){Df.i.Fd.call(this);I&&7>cb&&J(this.j(),"resize",this.Wd,r,this);this.Wd();var a=this.j();a.setAttribute("role","progressbar");a.Dj="progressbar";this.j().setAttribute("aria-live","polite")};u.Uc=function(){Df.i.Uc.call(this);Gf(this)};function Gf(a){I&&7>cb&&vc(a.j(),"resize",a.Wd,r,a)}u.Jd=function(){return this.sc.Jd()};u.Ud=function(a){this.sc.Ud(a);this.j()&&Ff(this)};function Ff(a){var b=a.Jd();a.j().setAttribute("aria-valuenow",b)}u.Id=function(){return this.sc.Id()};u.Hd=function(){return this.sc.Hd()};
u.mg="horizontal";u.nh=function(){this.Wd();this.dispatchEvent("change")};u.Wd=function(){if(this.Pa){var a=this.Id(),b=this.Hd(),a=(this.Jd()-a)/(b-a),b=Math.round(100*a);"vertical"==this.mg?I&&7>cb?(this.Pa.style.top=0,this.Pa.style.height="100%",b=this.Pa.offsetHeight,a=Math.round(a*b),this.Pa.style.top=b-a+"px",this.Pa.style.height=a+"px"):(this.Pa.style.top=100-b+"%",this.Pa.style.height=b+"%"):this.Pa.style.width=b+"%"}};u.M=function(){Gf(this);Df.i.M.call(this);this.Pa=q;this.sc.La()};function Hf(a,b){x(a)||i(Error("No valid parent element."));x(b)||i(Error("Invalid initial value."));Df.call(this);this.c="progressbar";this.Ca=a;this.md=this.bb=q;this.Fb=[];this.Fb=[".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.Ud(b);this.Je()}E(Hf,Df);
Hf.prototype.Je=function(){if("static"==this.Ca.style.position||""==this.Ca.style.position)this.Ca.style.position="relative";var a=document.getElementsByTagName("head")[0],b=ke("style");b.type="text/css";b.media="screen";var c=document.createTextNode(this.Fb[0]),d=document.createTextNode(this.Fb[1]),e=document.createTextNode(this.Fb[2]);a.appendChild(b);b.appendChild(c);b.appendChild(d);b.appendChild(e);this.bb=b;this.bc(this.Ca);a=this.j();a.style.position="absolute";a.style.top=(this.Ca.clientHeight-
5)/2;a.style.left=(this.Ca.clientWidth-100)/2;a.classList.add("xtk-progress-bar")};function If(a){var b=a.j().style.top,c=a.j().style.left;oe(a.j());var d=new Hf(a.Ca,100),e=d.j();e.style.position="absolute";e.style.top=b;e.style.left=c;e.classList.add("xtk-progress-bar");(e.firstElementChild!=m?e.firstElementChild:pe(e.firstChild)).classList.add("progress-bar-thumb-done");a.md=d}Hf.prototype.Me=function(){this.bb&&oe(this.bb);this.j()&&oe(this.j());this.md&&oe(this.md.j());this.md=this.bb=q};var Jf=fa.window;function Kf(a,b,c){ma(a)?c&&(a=va(a,c)):a&&"function"==typeof a.handleEvent?a=va(a.handleEvent,a):i(Error("Invalid listener argument"));return 2147483647<b?-1:Jf.setTimeout(a,b||0)};function Lf(){K.call(this);this.c="renderer";this.r=window.document.body;this.K=this.r.clientWidth;this.F=this.r.clientHeight;this.Kb=this.q=this.ia=q;this.Za=new Ye(ud);this.Sa=[];this.P=q;this.je=this.pd=this.qd=r;this.a=this.Ra=q;this.V={PROGRESSBAR_ENABLED:n};window.console.log("XTK Release pre8 -- 08/17/12 -- http://www.goXTK.com -- @goXTK")}E(Lf,K);u=Lf.prototype;u.Sh=function(a){this.Ra&&this.Ra.Ud(100*a.Bf)};u.Ih=function(a){x(a)&&a instanceof td&&a.$&&this.Xa(a.$)};
u.We=function(a){(!x(a)||!(a instanceof Nd))&&i(Error("Invalid hover event."))};u.Th=function(){var a=he(this.r);this.K=a.clientWidth;this.F=a.clientHeight;a=he(this.ia);a.width=this.K;a.height=this.F;this instanceof Mf&&(this.a.viewport(0,0,this.K,this.F),this.q.xf=new Float32Array(bf(this.q.of,this.ia.width/this.ia.height).Da()));this.uc()};u.Xe=function(a){(!x(a)||!(a instanceof Md))&&i(Error("Invalid scroll event."))};Lf.prototype.__defineGetter__("config",t("V"));
Lf.prototype.__defineGetter__("interactor",t("Kb"));Lf.prototype.__defineGetter__("camera",t("q"));Lf.prototype.__defineGetter__("loadingCompleted",t("pd"));Lf.prototype.__defineGetter__("container",t("r"));Lf.prototype.__defineSetter__("container",function(a){x(a)||i(Error("An ID to a valid container (<div>..) is required."));var b=a;la(b)&&(b=he(a));na(b)&&1==b.nodeType||i(Error("Could not find the given container."));this.r=b});u=Lf.prototype;u.uc=function(){this.q.reset()};
function Nf(a){a.V.PROGRESSBAR_ENABLED&&a.Ra&&!a.mf&&(If(a.Ra),a.mf=Kf(function(){this.mf=q;this.Ra&&(this.Ra.Me(),this.Ra=q);this.bc()}.bind(a),700))}
u.la=function(a){var b=ke("canvas");this.r.appendChild(b);this.K=this.r.clientWidth;this.F=this.r.clientHeight;b.width=this.K;b.height=this.F;try{var c=b.getContext(a);c||i(Error())}catch(d){var e="Sorry, "+a+' context is <strong>not supported</strong> on this machine! See <a href="http://crash.goXTK.com" target="_blank">http://crash.goXTK.com</a> for requirements..';this.r.innerHTML='<h3 style="color:red;font-family:sans-serif;">Oooops..</h3><p style="color:red;font-family:sans-serif;">'+e+"</p>";
i(Error(e))}this.P=new Me;J(this.P,Fd,this.Sh.bind(this));this.ia=b;this.a=c;b=new Xe(this.ia);"2d"==a&&(b=new ue(this.ia));b.la();J(b,Dd,this.uc.bind(this));J(b,Gd,this.We.bind(this));J(b,Cd,this.Xe.bind(this));this.Kb=b;b=new af(this.K,this.F);"2d"==a&&(b=new $e(this.K,this.F));a=b;c=this.Kb;(!x(c)||!(c instanceof Z))&&i(Error("Could not observe the interactor."));J(c,Ad,a.Uh.bind(a));J(c,zd,a.Rh.bind(a));J(c,Bd,a.Yh.bind(a));this.q=b;J(window,"resize",this.Th,r,this)};
u.add=function(a){(a instanceof We||a instanceof Ue||a instanceof Se)&&a.o();this.Sa.push(a);this.Xa(a)};u.Xa=function(a){(!this.ia||!this.a)&&i(Error("The renderer was not initialized properly."));x(a)||(window.console.log(a),i(Error("Illegal object.")));Bc(a)||J(a,Cc,this.Ih.bind(this))};u.get=function(a){x(a)||i(Error("Invalid object id."));for(var b=this.Za.u,c=b.length,d=0,d=0;d<c;d++)if(b[d].pa==a)return b[d];return q};
u.bc=function(){(!this.ia||!this.a)&&i(Error("The renderer was not initialized properly."));x(this.zf)||(this.P.ic.ye(r)?(this.V.PROGRESSBAR_ENABLED&&!this.Ra&&(this.Ra=new Hf(this.r,3)),this.je=this.pd=r,this.zf=Kf(function(){this.zf=q;this.bc()}.bind(this),100)):(!this.pd&&!this.je&&(this.je=n,eval("this.onShowtime()"),this.pd=n),this.Ra?Nf(this):(window.cd(this.bc.bind(this),this.ia),eval("this.onRender()"),this.Bb(r,n))))};u.lg=da();u.jg=da();u.Bb=da();
u.Ed=function(){this.Za.clear();delete this.Za;this.Sa.length=0;delete this.Sa;delete this.P;this.P=q;delete this.q;this.q=q;delete this.Kb;this.Kb=q;delete this.a;this.a=q;oe(this.ia);delete this.ia;this.ia=q};function Of(){K.call(this);this.c="shaders";this.wd="";this.wd="precision mediump float;\n\nattribute vec3 vertexPosition;\nattribute vec3 vertexNormal;\nattribute vec3 vertexColor;\nattribute vec2 vertexTexturePos;\nattribute float vertexScalar;\n\nuniform mat4 view;\nuniform mat4 perspective;\nuniform vec3 center;\nuniform mat4 objectTransform;\nuniform bool useObjectColor;\nuniform bool useScalars;\nuniform bool scalarsReplaceMode;\nuniform float scalarsMin;\nuniform float scalarsMax;\nuniform vec3 scalarsMinColor;\nuniform vec3 scalarsMaxColor;\nuniform float scalarsMinThreshold;\nuniform float scalarsMaxThreshold;\nuniform vec3 objectColor;\nuniform float pointSize;\n\nvarying float fDiscardNow;\nvarying vec4 fVertexPosition;\nvarying vec3 fragmentColor;\nvarying vec2 fragmentTexturePos;\nvarying vec3 fVertexNormal;\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 fVertexNormal = vertexNormal;\n fDiscardNow = 0.0;\n vec3 vertexPosition2 = vertexPosition - center;\n fVertexPosition = view * objectTransform * vec4(vertexPosition2, 1.0);\n fragmentTexturePos = vertexTexturePos;\n if (useScalars) {\n float scalarValue = vertexScalar;\n if (scalarValue < scalarsMinThreshold || scalarValue > scalarsMaxThreshold) {\n if (scalarsReplaceMode) {\n fragmentColor = objectColor;\n } else {\n fDiscardNow = 1.0;\n }\n } else {\n if (scalarsReplaceMode) {\n fragmentColor = scalarValue * scalarsMaxColor + (1.0 - scalarValue) * scalarsMinColor;\n } else {\n fragmentColor = vertexColor;\n }\n }\n } else if (useObjectColor) {\n fragmentColor = objectColor;\n } else {\n fragmentColor = vertexColor;\n }\n gl_PointSize = pointSize;\n gl_Position = perspective * fVertexPosition;\n}\n";
this.nd="";this.nd="precision mediump float;\n\nuniform bool usePicking;\nuniform bool useTexture;\nuniform bool volumeTexture;\nuniform bool useLabelMapTexture;\nuniform sampler2D textureSampler;\nuniform sampler2D textureSampler2;\nuniform float objectOpacity;\nuniform float labelmapOpacity;\nuniform float volumeLowerThreshold;\nuniform float volumeUpperThreshold;\nuniform float volumeScalarMin;\nuniform float volumeScalarMax;\nuniform vec3 volumeScalarMinColor;\nuniform vec3 volumeScalarMaxColor;\nuniform float volumeWindowLow;\nuniform float volumeWindowHigh;\n\nvarying float fDiscardNow;\nvarying vec4 fVertexPosition;\nvarying vec3 fragmentColor;\nvarying vec2 fragmentTexturePos;\nvarying vec3 fVertexNormal;\nvarying vec3 fTransformedVertexNormal;\n\nvoid main(void) {\n if (fDiscardNow > 0.0) {\n discard;\n }\n if (usePicking) {\n gl_FragColor = vec4(fragmentColor, 1.0);\n } else if (useTexture) {\n vec4 texture1 = texture2D(textureSampler,fragmentTexturePos);\n vec4 textureSum = texture1;\n if (volumeTexture) {\n float _windowLow = (volumeWindowLow / volumeScalarMax);\n float _windowHigh = (volumeWindowHigh / volumeScalarMax);\n vec3 _minrange = vec3(_windowLow,_windowLow,_windowLow);\n vec3 _maxrange = vec3(_windowHigh,_windowHigh,_windowHigh);\n vec3 fac = _maxrange - _minrange;\n textureSum = vec4((textureSum.r - _minrange)/fac,1);\n textureSum = textureSum.r * vec4(volumeScalarMaxColor,1) + (1.0 - textureSum.r) * vec4(volumeScalarMinColor,1);\n }\n if (useLabelMapTexture) {\n vec4 texture2 = texture2D(textureSampler2,fragmentTexturePos);\n if (texture2.a > 0.0) {\n if (labelmapOpacity < 1.0) {\n textureSum = mix(texture2, textureSum, 1.0 - labelmapOpacity);\n } else {\n textureSum = texture2;\n }\n }\n }\n if (volumeTexture) {\n float _volumeLowerThreshold = (volumeLowerThreshold / volumeScalarMax);\n float _volumeUpperThreshold = (volumeUpperThreshold / volumeScalarMax);\n if (texture1.r < _volumeLowerThreshold ||\n texture1.r > _volumeUpperThreshold) {\n discard;\n };\n };\n gl_FragColor = textureSum;\n gl_FragColor.a = objectOpacity;\n } else {\n vec3 nNormal = normalize(fTransformedVertexNormal);\n if (fVertexNormal == vec3(0.0,0.0,0.0)) {\n gl_FragColor = vec4(fragmentColor,1.0);\n return;\n }\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"}
E(Of,K);
var Pf={nj:"vertexPosition",mj:"vertexNormal",lj:"vertexColor",pj:"vertexTexturePos",oj:"vertexScalar"},Qf={qj:"view",Wi:"perspective",Oi:"center",Vi:"objectTransform",hj:"useObjectColor",Ti:"objectColor",jj:"useScalars",dj:"scalarsReplaceMode",aj:"scalarsMin",Yi:"scalarsMax",bj:"scalarsMinColor",Zi:"scalarsMaxColor",cj:"scalarsMinThreshold",$i:"scalarsMaxThreshold",Xi:"pointSize",Ui:"objectOpacity",Si:"normal",ij:"usePicking",kj:"useTexture",gj:"useLabelMapTexture",Qi:"labelmapOpacity",ej:"textureSampler",fj:"textureSampler2",
rj:"volumeLowerThreshold",xj:"volumeUpperThreshold",uj:"volumeScalarMin",sj:"volumeScalarMax",vj:"volumeScalarMinColor",tj:"volumeScalarMaxColor",zj:"volumeWindowLow",yj:"volumeWindowHigh",wj:"volumeTexture"};
function Rf(a){var b=Object.keys(Qf);Object.keys(Pf).every(function(a){a=Pf[a];return-1!=this.wd.search(a)||-1!=this.nd.search(a)}.bind(a))||i(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=Qf[a];return-1!=this.wd.search(a)||-1!=this.nd.search(a)}.bind(a))||i(Error("Could not find all uniforms in the shader sources."))};function Sf(a,b,c){x(a)||i(Error("Invalid GL Buffer."));x(b)||i(Error("Invalid number of items."));x(c)||i(Error("Invalid item size."));K.call(this);this.c="buffer";this.ja=a;this.pb=b;this.qb=c}E(Sf,K);function Tf(a,b,c,d,e,f,g,h){var l,j=c.offsetParent;if(j){var k="HTML"==j.tagName||"BODY"==j.tagName;if(!k||"static"!=gf(j,"position"))l=mf(j),k||(l=Xc(l,new Wc(j.scrollLeft,j.scrollTop)))}j=mf(a);k=pf(a);j=new df(j.x,j.y,k.width,k.height);(k=lf(a))&&j.Yf(new df(k.left,k.top,k.right-k.left,k.bottom-k.top));var k=ee(a),o=ee(c);if(k.N!=o.N){var s=k.N.body,o=o.N.parentWindow||o.N.defaultView,p=new Wc(0,0),w=ge(s)?ge(s).parentWindow||ge(s).defaultView:window,v=s;do{var A;if(w==o)A=mf(v);else{var C=v;
A=new Wc;if(1==C.nodeType)if(C.getBoundingClientRect)C=jf(C),A.x=C.left,A.y=C.top;else{var y=se(ee(C)),C=mf(C);A.x=C.x-y.x;A.y=C.y-y.y}else{var y=ma(C.kh),B=C;C.targetTouches?B=C.targetTouches[0]:y&&C.Ua.targetTouches&&(B=C.Ua.targetTouches[0]);A.x=B.clientX;A.y=B.clientY}}p.x+=A.x;p.y+=A.y}while(w&&w!=o&&(v=w.frameElement)&&(w=w.parent));s=Xc(p,mf(s));I&&!re(k)&&(s=Xc(s,se(k)));j.left+=s.x;j.top+=s.y}a=(b&4&&nf(a)?b^2:b)&-5;b=new Wc(a&2?j.left+j.width:j.left,a&1?j.top+j.height:j.top);l&&(b=Xc(b,
l));e&&(b.x+=(a&2?-1:1)*e.x,b.y+=(a&1?-1:1)*e.y);var F;if(g&&(F=lf(c))&&l)F.top-=l.y,F.right-=l.x,F.bottom-=l.y,F.left-=l.x;return Uf(b,c,d,f,F,g,h)}
function Uf(a,b,c,d,e,f,g){var a=a.f(),h=0,l=(c&4&&nf(b)?c^2:c)&-5,c=pf(b),g=g?g.f():c.f();if(d||0!=l)l&2?a.x-=g.width+(d?d.right:0):d&&(a.x+=d.left),l&1?a.y-=g.height+(d?d.bottom:0):d&&(a.y+=d.top);if(f){if(e){h=a;d=0;if(65==(f&65)&&(h.x<e.left||h.x>=e.right))f&=-2;if(132==(f&132)&&(h.y<e.top||h.y>=e.bottom))f&=-5;h.x<e.left&&f&1&&(h.x=e.left,d|=1);h.x<e.left&&h.x+g.width>e.right&&f&16&&(g.width=Math.max(g.width-(h.x+g.width-e.right),0),d|=4);h.x+g.width>e.right&&f&1&&(h.x=Math.max(e.right-g.width,
e.left),d|=1);f&2&&(d|=(h.x<e.left?16:0)|(h.x+g.width>e.right?32:0));h.y<e.top&&f&4&&(h.y=e.top,d|=2);h.y>=e.top&&h.y+g.height>e.bottom&&f&32&&(g.height=Math.max(g.height-(h.y+g.height-e.bottom),0),d|=8);h.y+g.height>e.bottom&&f&4&&(h.y=Math.max(e.bottom-g.height,e.top),d|=2);f&8&&(d|=(h.y<e.top?64:0)|(h.y+g.height>e.bottom?128:0));h=d}else h=256;if(h&496)return h}f=a;e=Wa&&(Oa||bb)&&nb("1.9");f instanceof Wc?(a=f.x,f=f.y):(a=f,f=m);b.style.left=of(a,e);b.style.top=of(f,e);$c(c,g)||(a=re(ee(ge(b))),
I&&(!a||!nb("8"))?(c=b.style,a?(I?(a=sf(b,ff(b,"paddingLeft")),e=sf(b,ff(b,"paddingRight")),f=sf(b,ff(b,"paddingTop")),d=sf(b,ff(b,"paddingBottom")),a=new cf(f,e,d,a)):(a=ef(b,"paddingLeft"),e=ef(b,"paddingRight"),f=ef(b,"paddingTop"),d=ef(b,"paddingBottom"),a=new cf(parseFloat(f),parseFloat(e),parseFloat(d),parseFloat(a))),I?(e=uf(b,"borderLeft"),f=uf(b,"borderRight"),d=uf(b,"borderTop"),b=uf(b,"borderBottom"),b=new cf(d,f,b,e)):(e=ef(b,"borderLeftWidth"),f=ef(b,"borderRightWidth"),d=ef(b,"borderTopWidth"),
b=ef(b,"borderBottomWidth"),b=new cf(parseFloat(d),parseFloat(f),parseFloat(b),parseFloat(e))),c.pixelWidth=g.width-b.left-a.left-a.right-b.right,c.pixelHeight=g.height-b.top-a.top-a.bottom-b.bottom):(c.pixelWidth=g.width,c.pixelHeight=g.height)):(b=b.style,Wa?b.MozBoxSizing="border-box":Xa?b.WebkitBoxSizing="border-box":b.boxSizing="border-box",b.width=Math.max(g.width,0)+"px",b.height=Math.max(g.height,0)+"px"));return h};function Vf(){}Vf.prototype.Oa=da();function Wf(a,b){this.element=a;this.Gf=b}E(Wf,Vf);Wf.prototype.Oa=function(a,b,c){Tf(this.element,this.Gf,a,b,m,c)};function Xf(a,b){this.Ma=new vf(this);this.$e(a||q);b&&(this.wc=b)}E(Xf,Hc);u=Xf.prototype;u.p=q;u.Pg=n;u.Cf=q;u.oa=r;u.ui=r;u.Ne=-1;u.ph=r;u.dh=n;u.wc="toggle_display";u.j=t("p");u.$e=function(a){this.oa&&i(Error("Can not change this state of the popup while showing."));this.p=a};
function Yf(a,b){a.ed&&a.ed.stop();a.Xc&&a.Xc.stop();if(b){if(!a.oa&&a.Ue()){a.p||i(Error("Caller must call setElement before trying to show the popup"));a.Oa();var c=ge(a.p);a.ph&&xf(a.Ma,c,"keydown",a.Gh,n);if(a.Pg)if(xf(a.Ma,c,"mousedown",a.hg,n),I){var d;try{d=c.activeElement}catch(e){}for(;d&&"IFRAME"==d.nodeName;){try{var f=d.contentDocument||d.contentWindow.document}catch(g){break}c=f;d=c.activeElement}xf(a.Ma,c,"mousedown",a.hg,n);xf(a.Ma,c,"deactivate",a.gg)}else xf(a.Ma,c,"blur",a.gg);"toggle_display"==
a.wc?(a.p.style.visibility="visible",rf(a.p,n)):"move_offscreen"==a.wc&&a.Oa();a.oa=n;a.ed?(uc(a.ed,"end",a.kg,r,a),a.ed.play()):a.kg()}}else Zf(a)}u.Oa=ga;function Zf(a,b){if(!a.oa||!a.dispatchEvent({type:"beforehide",target:b}))return r;a.Ma&&a.Ma.Rd();a.Xc?(uc(a.Xc,"end",wa(a.Ff,b),r,a),a.Xc.play()):a.Ff(b);return n}u.Ff=function(a){"toggle_display"==this.wc?this.ui?Kf(this.Uf,0,this):this.Uf():"move_offscreen"==this.wc&&(this.p.style.left="-200px",this.p.style.top="-200px");this.oa=r;this.Ve(a)};
u.Uf=function(){this.p.style.visibility="hidden";rf(this.p,r)};u.Ue=function(){return this.dispatchEvent("beforeshow")};u.kg=function(){this.Ne=xa();this.dispatchEvent("show")};u.Ve=function(a){xa();this.dispatchEvent({type:"hide",target:a})};u.hg=function(a){a=a.target;!qe(this.p,a)&&(!this.Cf||qe(this.Cf,a))&&!(150>xa()-this.Ne)&&Zf(this,a)};u.Gh=function(a){27==a.keyCode&&Zf(this,a.target)&&(a.preventDefault(),a.stopPropagation())};
u.gg=function(a){if(this.dh){var b=ge(this.p);if(I||Va){if(a=b.activeElement,!a||qe(this.p,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>xa()-this.Ne||Zf(this)}};u.M=function(){Xf.i.M.call(this);this.Ma.La();Zb(this.ed);Zb(this.Xc);delete this.p;delete this.Ma};function $f(a,b){this.ze=a instanceof Wc?a:new Wc(a,b)}E($f,Vf);$f.prototype.Oa=function(a,b,c,d){Tf(hf(a),0,a,b,this.ze,c,q,d)};function ag(a,b){this.$h=4;this.Qd=b||m;Xf.call(this,a)}E(ag,Xf);ag.prototype.Oa=function(){if(this.Qd){var a=!this.oa&&"move_offscreen"!=this.wc,b=this.j();a&&(b.style.visibility="hidden",rf(b,n));this.Qd.Oa(b,this.$h,this.Bj);a&&rf(b,r)}};function bg(a,b,c){this.Ta=c||(a?ee(he(a)):ee());ag.call(this,this.Ta.lc("div",{style:"position:absolute;display:none;"}));this.Be=new Wc(1,1);this.Wb=new Ub;a&&cg(this,a);if(b!=q)if(a=this.j(),"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(ge(a).createTextNode(b))}}E(bg,ag);var dg=[];u=bg.prototype;u.ma=q;u.className="goog-tooltip";
u.sg=500;u.oh=0;u.Gd=t("Ta");function cg(a,b){b=he(b);a.Wb.add(b);J(b,"mouseover",a.Rf,r,a);J(b,"mouseout",a.Ld,r,a);J(b,"mousemove",a.Qf,r,a);J(b,"focus",a.Pf,r,a);J(b,"blur",a.Ld,r,a)}u.detach=function(a){if(a)a=he(a),eg(this,a),this.Wb.remove(a);else{for(var b=this.Wb.Yb(),c=0;a=b[c];c++)eg(this,a);this.Wb.clear()}};function eg(a,b){vc(b,"mouseover",a.Rf,r,a);vc(b,"mouseout",a.Ld,r,a);vc(b,"mousemove",a.Qf,r,a);vc(b,"focus",a.Pf,r,a);vc(b,"blur",a.Ld,r,a)}
u.$e=function(a){var b=this.j();b&&oe(b);bg.i.$e.call(this,a);a&&(b=this.Ta.N.body,b.insertBefore(a,b.lastChild))};u.Ue=function(){if(!Xf.prototype.Ue.call(this))return r;if(this.anchor)for(var a,b=0;a=dg[b];b++)qe(a.j(),this.anchor)||Yf(a,r);0<=xb(dg,this)||dg.push(this);a=this.j();a.className=this.className;fg(this);J(a,"mouseover",this.Tf,r,this);J(a,"mouseout",this.Sf,r,this);gg(this);return n};
u.Ve=function(){Cb(dg,this);for(var a=this.j(),b,c=0;b=dg[c];c++)b.anchor&&qe(a,b.anchor)&&Yf(b,r);this.og&&hg(this.og);vc(a,"mouseover",this.Tf,r,this);vc(a,"mouseout",this.Sf,r,this);this.anchor=m;if(0==(this.fb?this.oa?4:1:this.pc?3:this.oa?2:0))this.Sd=r;Xf.prototype.Ve.call(this)};u.eg=function(a,b){this.anchor==a&&this.Wb.contains(this.anchor)&&(this.Sd||!this.Cj?(Yf(this,r),this.oa||(this.anchor=a,this.Qd=b||ig(this,0)||m,this.oa&&this.Oa(),Yf(this,n))):this.anchor=m);this.fb=m};
u.Ch=function(a){this.pc=m;a==this.anchor&&(this.ma==q||this.ma!=this.j()&&!this.Wb.contains(this.ma))&&(!this.Df||!this.Df.ma)&&Yf(this,r)};function jg(a,b){var c=se(a.Ta);a.Be.x=b.clientX+c.x;a.Be.y=b.clientY+c.y}u.Rf=function(a){var b=kg(this,a.target);this.ma=b;fg(this);b!=this.anchor&&(this.anchor=b,this.fb||(this.fb=Kf(va(this.eg,this,b,m),this.sg)),lg(this),jg(this,a))};function kg(a,b){try{for(;b&&!a.Wb.contains(b);)b=b.parentNode;return b}catch(c){return q}}
u.Qf=function(a){jg(this,a);this.Sd=n};u.Pf=function(a){this.ma=a=kg(this,a.target);this.Sd=n;if(this.anchor!=a){this.anchor=a;var b=ig(this,1);fg(this);this.fb||(this.fb=Kf(va(this.eg,this,a,b),this.sg));lg(this)}};function ig(a,b){if(0==b){var c=a.Be.f();return new mg(c)}return new ng(a.ma)}function lg(a){if(a.anchor)for(var b,c=0;b=dg[c];c++)qe(b.j(),a.anchor)&&(b.Df=a,a.og=b)}
u.Ld=function(a){var b=kg(this,a.target),c=kg(this,a.relatedTarget);b!=c&&(b==this.ma&&(this.ma=q),gg(this),this.Sd=r,this.oa&&(!a.relatedTarget||!qe(this.j(),a.relatedTarget))?hg(this):this.anchor=m)};u.Tf=function(){var a=this.j();this.ma!=a&&(fg(this),this.ma=a)};u.Sf=function(a){var b=this.j();if(this.ma==b&&(!a.relatedTarget||!qe(b,a.relatedTarget)))this.ma=q,hg(this)};function gg(a){a.fb&&(Jf.clearTimeout(a.fb),a.fb=m)}
function hg(a){if(2==(a.fb?a.oa?4:1:a.pc?3:a.oa?2:0))a.pc=Kf(va(a.Ch,a,a.anchor),a.oh)}function fg(a){a.pc&&(Jf.clearTimeout(a.pc),a.pc=m)}u.M=function(){Yf(this,r);gg(this);this.detach();this.j()&&oe(this.j());this.ma=q;delete this.Ta;bg.i.M.call(this)};function mg(a,b){$f.call(this,a,b)}E(mg,$f);mg.prototype.Oa=function(a,b,c){b=hf(a);b=lf(b);c=c?new cf(c.top+10,c.right,c.bottom,c.left+10):new cf(10,0,0,10);Uf(this.ze,a,4,c,b,9)&496&&Uf(this.ze,a,4,c,b,5)};function ng(a){Wf.call(this,a,3)}
E(ng,Wf);ng.prototype.Oa=function(a,b,c){var d=new Wc(10,0);Tf(this.element,this.Gf,a,b,d,c,9)&496&&Tf(this.element,2,a,1,d,c,5)};function og(a,b,c,d){x(a)||i(Error("No valid parent element."));(!z(b)||!z(c))&&i(Error("Invalid coordinates."));(!x(d)||!(d instanceof Z))&&i(Error("Invalid interactor."));bg.call(this);this.c="caption";this.Ca=a;this.yd=b;this.zd=c;this.Kb=d;this.bb=q;this.Fb=[];this.Fb=[".x-tooltip {\n background: #C0C0FF;\n color: #000000;\n border: 1px solid infotext;\n padding: 1px;\n font-family: sans-serif;\n}"];uc(d,Hd,this.Me.bind(this));this.Je()}E(og,bg);
og.prototype.Je=function(){if("static"==this.Ca.style.position||""==this.Ca.style.position)this.Ca.style.position="relative";var a=document.getElementsByTagName("head")[0],b=ke("style");b.type="text/css";b.media="screen";var c=document.createTextNode(this.Fb[0]);a.appendChild(b);b.appendChild(c);this.bb=b;this.Qd=new $f(this.yd,this.zd)||m;this.oa&&this.Oa();Yf(this,n);cg(this,this.Ca);this.j().classList.add("x-tooltip")};
og.prototype.Me=function(){Yf(this,r);this.bb&&oe(this.bb);this.j()&&oe(this.j());this.bb=q};function Mf(){Lf.call(this);this.c="renderer3D";this.Fc=this.Ic=this.Ec=this.Hc=this.Dc=this.Gc=this.le=this.me=q;this.l=[0,0,0];this.yf=q;this.Xd=new Qb;this.Mc=new Qb;this.Pc=new Qb;this.he=new Qb;this.ld=new Qb;this.td=new Qb;this.ud=new Qb;this.vd=new Qb;this.V={PROGRESSBAR_ENABLED:n,PICKING_ENABLED:n,ORDERING_ENABLED:n,STATISTICS_ENABLED:r}}E(Mf,Lf);Mf.prototype.__defineGetter__("config",t("V"));u=Mf.prototype;u.ii=function(){this.Fc=this.Ic=this.Ec=this.Hc=this.Dc=this.Gc=q;this.l=[0,0,0]};
u.We=function(a){Mf.i.We.call(this,a);var b=a.yd,a=a.zd,c=this.get(this.pg(b,a));if(c&&(c=c.ec))(new og(this.r,this.r.offsetLeft+b+10,this.r.offsetTop+a+10,this.Kb)).j().innerHTML=c};
u.la=function(){Mf.i.la.call(this,"experimental-webgl");try{if(this.a.viewport(0,0,this.K,this.F),this.a.clearColor(0,0,0,0),this.a.enable(this.a.BLEND),this.a.blendEquation(this.a.FUNC_ADD),this.a.blendFunc(this.a.SRC_ALPHA,this.a.ONE_MINUS_SRC_ALPHA),this.a.enable(this.a.DEPTH_TEST),this.a.depthFunc(this.a.LEQUAL),this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT),this.V.PICKING_ENABLED){var a=this.a.createFramebuffer(),b=this.a.createRenderbuffer(),c=this.a.createTexture();this.a.bindTexture(this.a.TEXTURE_2D,
c);this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGB,this.K,this.F,0,this.a.RGB,this.a.UNSIGNED_BYTE,q);this.a.bindFramebuffer(this.a.FRAMEBUFFER,a);this.a.bindRenderbuffer(this.a.RENDERBUFFER,b);this.a.renderbufferStorage(this.a.RENDERBUFFER,this.a.DEPTH_COMPONENT16,this.K,this.F);this.a.bindRenderbuffer(this.a.RENDERBUFFER,q);this.a.framebufferTexture2D(this.a.FRAMEBUFFER,this.a.COLOR_ATTACHMENT0,this.a.TEXTURE_2D,c,0);this.a.framebufferRenderbuffer(this.a.FRAMEBUFFER,this.a.DEPTH_ATTACHMENT,this.a.RENDERBUFFER,
b);this.a.bindFramebuffer(this.a.FRAMEBUFFER,q);this.yf=a}}catch(d){i(Error("Exception while accessing GL Context!\n"+d))}pg(this)};
function pg(a){var b=new Of;(!x(a.ia)||!x(a.a)||!x(a.q))&&i(Error("Renderer was not initialized properly."));(!x(b)||!(b instanceof Of))&&i(Error("Could not add shaders."));Rf(b);var c=a.a.createShader(a.a.FRAGMENT_SHADER),d=a.a.createShader(a.a.VERTEX_SHADER);a.a.shaderSource(c,b.nd);a.a.shaderSource(d,b.wd);a.a.compileShader(c);a.a.compileShader(d);a.a.getShaderParameter(c,a.a.COMPILE_STATUS)||i(Error("Fragement Shader compilation failed!\n"+a.a.getShaderInfoLog(c)));a.a.getShaderParameter(d,a.a.COMPILE_STATUS)||
i(Error("Vertex Shader compilation failed!\n"+a.a.getShaderInfoLog(d)));var e=a.a.createProgram();a.a.attachShader(e,d);a.a.attachShader(e,c);a.a.linkProgram(e);a.a.getProgramParameter(e,a.a.LINK_STATUS)||i(Error("Could not create shader program!\n"+a.a.getShaderInfoLog(c)+"\n"+a.a.getShaderInfoLog(d)+"\n"+a.a.getProgramInfoLog(e)));a.a.useProgram(e);a.le=e;Object.keys(Pf).forEach(function(a){a=Pf[a];this.Xd.set(a,this.a.getAttribLocation(this.le,a));this.a.enableVertexAttribArray(this.Xd.get(a))}.bind(a));
Object.keys(Qf).forEach(function(a){a=Qf[a];this.Mc.set(a,this.a.getUniformLocation(this.le,a))}.bind(a));a.me=b}
u.Xa=function(a){Mf.i.Xa.call(this,a);var b=r;this.get(a.pa)&&(b=n);var c=a.pa,d=a.g,e=a.h,f=a.U,g=a.z,h=a.s,l=a.Ub,j=a.O,k=a.n,o=a.t;if(x(k)&&x(k.s)&&k.s.e)this.Xa(k);else if(x(k)&&k.e&&this.Xa(k),x(j)&&x(j.s)&&j.s.e)this.P.load(j,a);else if(x(g)&&x(g.s)&&g.s.e)this.P.load(g,a);else{if(x(h)&&h instanceof Array)if(x(a.cc)){if(a.cc.Md!=h.length||!a.e)return}else{b=0;c=h.length;for(b=0;b<c;b++)this.P.load(h[b],a);return}else{if(x(h)&&h.e){this.P.load(a,a);return}if(x(o)&&x(o.s)&&o.s.e){this.P.load(o,
a);return}}if(0<a.d.length){h=a.d;j=h.length;for(k=k=0;k<j;k++)this.Xa(h[k])}if(d){for(h=0;this.qd;)h++,window.console.log("Possible thread lock avoided: "+h);this.qd=n;j=a instanceof we&&a.cb instanceof ye;b&&x(g)&&g.e&&(h=this.ud.get(c),x(h)&&this.a.isBuffer(h.ja)&&this.a.deleteBuffer(h.ja));h=q;x(g)&&(!b||g.e?(h=a.Tb,x(h)||i(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),k=r,g.ta&&(k=n),this.a.pixelStorei(this.a.UNPACK_FLIP_Y_WEBGL,k),
k=this.a.createTexture(),k.rh=g.lb,this.vd.set(g.pa,k),this.a.bindTexture(this.a.TEXTURE_2D,k),g.ta?this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,g.xb,g.wb,0,this.a.RGBA,this.a.UNSIGNED_BYTE,g.ta):this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,this.a.RGBA,this.a.UNSIGNED_BYTE,k.rh),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,this.a.CLAMP_TO_EDGE),j?(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,
this.a.NEAREST),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST)):(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.LINEAR),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.LINEAR)),this.a.bindTexture(this.a.TEXTURE_2D,q),k=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,k),this.a.bufferData(this.a.ARRAY_BUFFER,new Float32Array(h),this.a.STATIC_DRAW),h=new Sf(k,h.length,2),g.e=r):h=this.ud.get(c));Ne(this.P,
0.1);if(j)this.qd=r,H.Ba(this.c+".update"),Ne(this.P,0.9);else{if(!b||d.e||l.e){j=l.B;g=j.Na(new M(d.Ob,d.Pb,d.Qb));j=j.Na(new M(d.Lb,d.Mb,d.Nb));if(this.Gc===q||g.x<this.Gc)this.Gc=g.x;if(this.Dc===q||j.x>this.Dc)this.Dc=j.x;if(this.Hc===q||g.y<this.Hc)this.Hc=g.y;if(this.Ec===q||j.y>this.Ec)this.Ec=j.y;if(this.Ic===q||g.b<this.Ic)this.Ic=g.b;if(this.Fc===q||j.b>this.Fc)this.Fc=j.b;this.l=[(this.Gc+this.Dc)/2,(this.Hc+this.Ec)/2,(this.Ic+this.Fc)/2];l.e=r}b&&d.e&&(l=this.Pc.get(c),x(l)&&this.a.isBuffer(l.ja)&&
this.a.deleteBuffer(l.ja));l=q;!b||d.e?(l=this.a.createBuffer(),d.vc(),this.a.bindBuffer(this.a.ARRAY_BUFFER,l),this.a.bufferData(this.a.ARRAY_BUFFER,d.I,this.a.STATIC_DRAW),l=new Sf(l,d.count,3),d.e=r):l=this.Pc.get(c);Ne(this.P,0.3);b&&e.e&&(g=this.Pc.get(c),x(g)&&this.a.isBuffer(g.ja)&&this.a.deleteBuffer(g.ja));g=q;!b||e.e?(g=this.a.createBuffer(),e.vc(),this.a.bindBuffer(this.a.ARRAY_BUFFER,g),this.a.bufferData(this.a.ARRAY_BUFFER,e.I,this.a.STATIC_DRAW),g=new Sf(g,e.count,3),e.e=r):g=this.he.get(c);
Ne(this.P,0.3);b&&f&&f.e&&(e=this.ld.get(c),x(e)&&this.a.isBuffer(e.ja)&&this.a.deleteBuffer(e.ja));e=q;f&&(!b||f.e?(f.length!=d.length&&i(Error("Mismatch between points and point colors.")),e=this.a.createBuffer(),f.vc(),this.a.bindBuffer(this.a.ARRAY_BUFFER,e),this.a.bufferData(this.a.ARRAY_BUFFER,f.I,this.a.STATIC_DRAW),e=new Sf(e,f.count,3),f.e=r):e=this.ld.get(c));Ne(this.P,0.2);b&&o&&o.e&&(f=this.td.get(c),x(f)&&this.a.isBuffer(f.ja)&&this.a.deleteBuffer(f.ja));f=q;o&&(f=o.yc,!b||o.e?(f.length!=
d.length&&i(Error("Mismatch between points and scalars.")),d=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,d),this.a.bufferData(this.a.ARRAY_BUFFER,f,this.a.STATIC_DRAW),f=new Sf(d,f.length,3),o.e=r):f=this.td.get(c));Ne(this.P,0.1);b||this.Za.add(a);this.Pc.set(c,l);this.he.set(c,g);this.ld.set(c,e);this.ud.set(c,h);this.td.set(c,f);this.qd=a.e=r}}else a.e=r}};function qg(a,b){var c=b.g.kd,c=a.q.m.Na(b.Ub.B.Na(new M(c[0],c[1],c[2]))),c=Tc(a.q.sa,c);return Math.round(1E3*c)/1E3}
u.pg=function(a,b){if(this.V.PICKING_ENABLED){this.Bb(n,r);var c=new Uint8Array(4);this.a.readPixels(a,this.F-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);return c[0]+255*c[1]+65025*c[2]}return-1};
u.Bb=function(a,b){Mf.i.Bb.call(this,a,b);var c=this.Za.u,d=c.length;if(0!=d){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.yf):this.a.bindFramebuffer(this.a.FRAMEBUFFER,q);this.a.viewport(0,0,this.K,this.F);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var e=this.q.xf,f=this.q.Ib;this.a.uniformMatrix4fv(this.Mc.get("perspective"),r,e);this.a.uniformMatrix4fv(this.Mc.get("view"),r,f);e=this.l;this.a.uniform3f(this.Mc.get("center"),parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]));
f=this.Sa.length;for(e=0;e<f;++e){var g=this.Sa[e];if(g instanceof L){var h=new M(1,0,0),h=this.q.m.Na(h),l=Tc(this.q.sa,h),h=new M(-1,0,0),h=this.q.m.Na(h),j=Tc(this.q.sa,h),h=new M(0,1,0),h=this.q.m.Na(h),k=Tc(this.q.sa,h),h=new M(0,-1,0),h=this.q.m.Na(h),o=Tc(this.q.sa,h),h=new M(0,0,1),h=this.q.m.Na(h),s=Tc(this.q.sa,h),h=new M(0,0,-1),h=this.q.m.Na(h),h=Tc(this.q.sa,h),p=Math.max(l,k,s,j,o,h);p==l||p==j?xe(g,0):p==k||p==o?xe(g,1):(p==s||p==h)&&xe(g,2)}}if(this.V.ORDERING_ENABLED){l=r;f=this.Sa;
g=f.length-1;do if(e=f[g],e instanceof L&&e.Ja){j=e.zb;l=e.Q.d;1==j?l=e.R.d:2==j&&(l=e.ab.d);j=l.length;k=l[0];k.W=qg(this,k);k.X=e.X;o=l[j-1];o.W=qg(this,o);o.X=e.X;o=Math.round(1E3*((o.W-k.W)/j))/1E3;for(s=s=1;s<j-1;s++)h=Math.round(1E3*(k.W+s*o))/1E3,l[s].W=h,l[s].X=e.X;l=n}while(g--);f=this.Za.u;g=f.length-1;do if(e=f[g],e.Ia&&!(1==e.X||e instanceof we))e.W=qg(this,e),l=n;while(g--);l&&this.Za.sort()}if(f=!a&&x(b)&&b&&this.V.STATISTICS_ENABLED)var w=0,v=0,A=0,C=0;var e=this.Xd,g=e.get("vertexPosition"),
l=e.get("vertexNormal"),j=e.get("vertexColor"),k=e.get("vertexTexturePos"),o=e.get("vertexScalar"),e=this.Mc,s=e.get("usePicking"),h=e.get("useObjectColor"),p=e.get("objectColor"),y=e.get("useScalars"),B=e.get("scalarsReplaceMode"),F=e.get("scalarsMin"),P=e.get("scalarsMax"),G=e.get("scalarsMinColor"),O=e.get("scalarsMaxColor"),S=e.get("scalarsMinThreshold"),ca=e.get("scalarsMaxThreshold"),aa=e.get("objectOpacity"),ba=e.get("labelmapOpacity"),ta=e.get("useTexture"),fb=e.get("useLabelMapTexture"),
Ga=e.get("textureSampler"),zc=e.get("textureSampler2"),jd=e.get("volumeLowerThreshold"),ob=e.get("volumeUpperThreshold"),kd=e.get("volumeScalarMin"),Gb=e.get("volumeScalarMax"),hb=e.get("volumeWindowLow"),Eb=e.get("volumeWindowHigh"),Ac=e.get("volumeScalarMinColor"),ya=e.get("volumeScalarMaxColor"),gb=e.get("volumeTexture"),id=e.get("objectTransform"),hd=e.get("pointSize"),e=d;do{var R=c[d-e];if(R){var T=q;R instanceof we&&R.cb&&(T=R.cb);if(R.Ia&&(!T||T.Ia)){var pa=R.pa,Qa=R.Cc,za=this.Pc.get(pa),
Za=this.he.get(pa),Wd=this.ld.get(pa),Fb=this.td.get(pa),Xd=this.ud.get(pa);this.a.bindBuffer(this.a.ARRAY_BUFFER,za.ja);this.a.vertexAttribPointer(g,za.qb,this.a.FLOAT,r,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,Za.ja);this.a.vertexAttribPointer(l,Za.qb,this.a.FLOAT,r,0,0);a?this.a.uniform1i(s,n):this.a.uniform1i(s,r);Wd&&!a&&!Qa?(this.a.uniform1i(h,r),this.a.bindBuffer(this.a.ARRAY_BUFFER,Wd.ja),this.a.vertexAttribPointer(j,Wd.qb,this.a.FLOAT,r,0,0)):(Za=1,Qa&&!a&&(Za=0),this.a.uniform1i(h,Za),
Za=R.Eb,a&&(Za=[Math.floor(pa%65025%255)/255,Math.floor(pa%65025/255)/255,Math.floor(pa/65025)/255]),this.a.uniform3f(p,parseFloat(Za[0]),parseFloat(Za[1]),parseFloat(Za[2])),this.a.vertexAttribPointer(j,za.qb,this.a.FLOAT,r,0,0));Fb&&!a&&!Qa?(this.a.uniform1i(y,n),this.a.uniform1i(B,R.t.Af),pa=R.t.tb,Qa=R.t.rb,this.a.uniform3f(G,parseFloat(pa[0]),parseFloat(pa[1]),parseFloat(pa[2])),this.a.uniform3f(O,parseFloat(Qa[0]),parseFloat(Qa[1]),parseFloat(Qa[2])),this.a.uniform1f(S,parseFloat(R.t.ca)),this.a.uniform1f(ca,
parseFloat(R.t.da)),this.a.uniform1f(F,parseFloat(R.t.Ha)),this.a.uniform1f(P,parseFloat(R.t.qa)),this.a.bindBuffer(this.a.ARRAY_BUFFER,Fb.ja),this.a.vertexAttribPointer(o,Fb.qb,this.a.FLOAT,r,0,0)):(this.a.uniform1i(y,r),this.a.vertexAttribPointer(o,za.qb,this.a.FLOAT,r,0,0));this.a.uniform1f(aa,parseFloat(R.X));R.z&&Xd&&!a?(this.a.uniform1i(ta,n),this.a.activeTexture(this.a.TEXTURE0),this.a.bindTexture(this.a.TEXTURE_2D,this.vd.get(R.z.pa)),this.a.uniform1i(Ga,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,
Xd.ja),this.a.vertexAttribPointer(k,Xd.qb,this.a.FLOAT,r,0,0),this.a.uniform1i(gb,r)):(this.a.uniform1i(ta,r),this.a.vertexAttribPointer(k,za.qb,this.a.FLOAT,r,0,0));T&&(this.a.uniform1i(gb,n),this.a.uniform1f(jd,T.ca),this.a.uniform1f(ob,T.da),this.a.uniform1f(kd,T.Ha),this.a.uniform1f(Gb,T.qa),pa=T.tb,Qa=T.rb,this.a.uniform3f(Ac,parseFloat(pa[0]),parseFloat(pa[1]),parseFloat(pa[2])),this.a.uniform3f(ya,parseFloat(Qa[0]),parseFloat(Qa[1]),parseFloat(Qa[2])),this.a.uniform1f(hb,T.fa),this.a.uniform1f(Eb,
T.ea),Fb=T.n,this.a.uniform1i(fb,r),T.Ja?this.a.uniform1f(aa,parseFloat(T.X)):Fb&&Fb.Ia&&(T=R.n.pa,this.a.uniform1i(fb,n),this.a.activeTexture(this.a.TEXTURE1),this.a.bindTexture(this.a.TEXTURE_2D,this.vd.get(T)),this.a.uniform1i(zc,1),this.a.uniform1f(ba,Fb.X)));this.a.uniformMatrix4fv(id,r,R.Ub.qf);T=1;"POINTS"==R.ka&&(T=R.Kc);this.a.uniform1f(hd,T);T=-1;R.ka==qd?(T=this.a.TRIANGLES,f&&(v+=za.pb/3)):"LINES"==R.ka?(this.a.lineWidth(R.jc),T=this.a.LINES,f&&(A+=za.pb/2)):"POINTS"==R.ka?(T=this.a.POINTS,
f&&(C+=za.pb)):"TRIANGLE_STRIPS"==R.ka?(T=this.a.TRIANGLE_STRIP,f&&(v+=za.pb/3)):"POLYGONS"==R.ka&&(T=0==za.pb%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(v+=za.pb/3));f&&(w+=za.pb);this.a.drawArrays(T,0,za.pb)}}}while(--e);f&&(c="Objects: "+d+" | "+("Vertices: "+w+" | ")+("Triangles: "+Math.round(v)+" | "),c=c+("Lines: "+A+" | ")+("Points: "+C+" | ")+("Textures: "+this.vd.na()),window.console.log(c))}};
u.Ed=function(){this.me=q;delete this.me;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);Mf.i.Ed.call(this)};D("X.renderer3D",Mf);D("X.renderer3D.prototype.init",Mf.prototype.la);D("X.renderer3D.prototype.add",Mf.prototype.add);D("X.renderer3D.prototype.onShowtime",Mf.prototype.lg);D("X.renderer3D.prototype.onRender",Mf.prototype.jg);D("X.renderer3D.prototype.get",Mf.prototype.get);D("X.renderer3D.prototype.render",Mf.prototype.bc);D("X.renderer3D.prototype.destroy",Mf.prototype.Ed);
D("X.renderer3D.prototype.resetBoundingBox",Mf.prototype.ii);D("X.renderer3D.prototype.resetViewAndRender",Mf.prototype.uc);D("X.renderer3D.prototype.pick",Mf.prototype.pg);function $(){Lf.call(this);this.c="renderer2D";this.rf=this.$d=this.pf=this.Zd=this.$a=q;this.sd=this.ne=this.oe=0}E($,Lf);$.prototype.Vh=da();$.prototype.Wh=da();$.prototype.Xe=function(a){$.i.Xe.call(this,a);var b=this.Sa[0];if(b){var c=this.$a;b["index"+c]=a.J?b["index"+c]+1:b["index"+c]-1;eval("this.onScroll();")}};
$.prototype.Xh=function(a){var b=this.Sa[0];if(b){var c=b.ea-b.fa,d=c/2,e=parseInt(c+c/15*-a.re,10),a=parseInt(d+d/15*a.ee,10);c==e&&e++;d==a&&a++;b.fa-=parseInt(d-a,10);b.fa-=parseInt(c-e,10);b.fa=Math.max(b.fa,b.Ha);b.ea-=parseInt(d-a,10);b.ea+=parseInt(c-e,10);b.ea=Math.min(b.ea,b.qa);eval("this.onWindowLevel();")}};$.prototype.__defineGetter__("orientation",t("$a"));
$.prototype.__defineSetter__("orientation",function(a){a=a.toUpperCase();"X"!=a&&"Y"!=a&&"Z"!=a&&i(Error("Invalid orientation."));this.$a=a});u=$.prototype;u.la=function(){this.$a||i(Error("No 2D orientation set."));$.i.la.call(this,"2d");this.a.fillStyle="rgba(0,0,0,0)";this.a.fillRect(0,0,this.ia.width,this.ia.height);this.Zd=ke("canvas");this.$d=ke("canvas");J(this.q,Ed,this.Xh.bind(this))};u.rotate=function(){this.sd++};u.ji=function(){this.sd--};
u.uc=function(){$.i.uc.call(this);rg(this);var a=this.Sa[0];a&&(a.ea=a.qa,a.fa=a.Ha)};
u.Xa=function(a){$.i.Xa.call(this,a);var b=r;this.get(a.pa)&&(b=n);var c=a.s,d=a.n,e=a.O;if(x(d)&&x(d.s)&&d.s.e)this.Xa(d);else if(x(e)&&x(e.s)&&e.s.e)this.P.load(e,a);else{if(x(c)&&c instanceof Array)if(x(a.cc)){if(a.cc.Md!=c.length||b&&!a.e)return}else{b=0;d=c.length;for(b=0;b<d;b++)this.P.load(c[b],a);return}else if(x(c)&&c.e){this.P.load(a,a);return}d=c=0;e=a.G;"X"==this.$a?(this.Sb=a.Q.d,c=e[2],d=e[1]):"Y"==this.$a?(this.Sb=a.R.d,c=e[0],d=e[2]):"Z"==this.$a&&(this.Sb=a.ab.d,c=e[0],d=e[1]);"X"==
this.$a&&(e=d,d=c,c=e);this.oe=c;this.ne=d;e=this.Zd;e.width=c;e.height=d;var f=this.$d;f.width=c;f.height=d;this.pf=e.getContext("2d");this.rf=f.getContext("2d");b||(this.Za.add(a),rg(this))}};function rg(a){var b=Math.min(a.K/a.oe,a.F/a.ne);a.q.m.k(2,3,10*b-10)}
u.Bb=function(a,b){$.i.Bb.call(this,a,b);if(0!=this.Za.u.length){var c=this.K,d=this.F,e=this.q.m;this.a.save();this.a.clearRect(-c,-d,2*c,2*d);this.a.restore();var f=1*e.T(0,3),g=-1*e.T(1,3),h=Math.max(1+e.T(2,3)/10,0.6);this.a.setTransform(h,0,0,h,f,g);var e=this.Sa[0],l=this.Sb[parseInt(e["index"+this.$a],10)],j=l.z.ta,l=l.n,k=q;l&&(k=l.ta);var o=this.oe,s=this.ne,p=this.pf,w=this.rf,v=p.getImageData(0,0,o,s),A=w.getImageData(0,0,o,s),C=v.data,y=A.data,B=C.length,F=e.qa,P=e.ca,G=e.da,O=0;do{var S=
[0,0,0,0],ca=[0,0,0,0],aa=j[O]/255*F,ba=j[O],ta=e.fa/F,ba=(ba/255-ta)/(e.ea/F-ta),ba=255*ba;aa>=P&&aa<=G&&(S=new M(e.tb[0],e.tb[1],e.tb[2]),S=(new M(e.rb[0],e.rb[1],e.rb[2])).scale(ba).add(S.scale(255-ba)),S=[Math.floor(S.x),Math.floor(S.y),Math.floor(S.b),255],l&&(ca=[k[O],k[O+1],k[O+2],k[O+3]]));ba=B-1-O;C[ba-3]=S[0];C[ba-2]=S[1];C[ba-1]=S[2];C[ba]=S[3];y[ba-3]=ca[0];y[ba-2]=ca[1];y[ba-1]=ca[2];y[ba]=ca[3];O+=4}while(O<B);p.putImageData(v,0,0);w.putImageData(A,0,0);this.a.globalAlpha=1;this.a.translate(c/
2/h,d/2/h);this.a.rotate(0.5*Math.PI*this.sd);switch(this.sd%4){case 1:c=f;f=g;g=-c;break;case 2:f*=-1;g*=-1;break;case 3:c=f,f=-g,g=c}f=-o/2+f;g=-s/2+g;this.a.drawImage(this.Zd,f,g);l&&e.n.Ia&&(this.a.globalAlpha=e.n.X,this.a.drawImage(this.$d,f,g))}};D("X.renderer2D",$);D("X.renderer2D.prototype.init",$.prototype.la);D("X.renderer2D.prototype.add",$.prototype.add);D("X.renderer2D.prototype.onShowtime",$.prototype.lg);D("X.renderer2D.prototype.onRender",$.prototype.jg);
D("X.renderer2D.prototype.onScroll",$.prototype.Vh);D("X.renderer2D.prototype.onWindowLevel",$.prototype.Wh);D("X.renderer2D.prototype.get",$.prototype.get);D("X.renderer2D.prototype.rotate",$.prototype.rotate);D("X.renderer2D.prototype.rotateCounter",$.prototype.ji);D("X.renderer2D.prototype.resetViewAndRender",$.prototype.uc);D("X.renderer2D.prototype.render",$.prototype.bc);D("X.renderer2D.prototype.destroy",$.prototype.Ed);function sg(){V.call(this);this.c="fibers";Ba(this,new Qc)}E(sg,V);D("X.fibers",sg);function tg(){V.call(this);this.c="mesh";Ba(this,new Qc)}E(tg,V);D("X.mesh",tg);