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