-
Notifications
You must be signed in to change notification settings - Fork 8
/
xtk_edge.js
419 lines (419 loc) · 190 KB
/
xtk_edge.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
/*
*
* 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/google-closure-library/master/LICENSE
*
* - zlib.js, the ultimate gzip/zlib javascript implementation (https://github.com/imaya/zlib.js)
* LICENSE: https://raw.github.com/imaya/zlib.js/master/LICENSE
*
* MORE CREDITS: https://raw.github.com/xtk/X/master/LICENSE
*
*/
function n(a){throw a;}var p=void 0,q=!0,t=null,u=!1;function ba(){return function(){}}function ca(a){return function(b){this[a]=b}}function v(a){return function(){return this[a]}}var w,ga=this;function ha(){}
function ia(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 ja(a){return a!==p}function ka(a){return"array"==ia(a)}function ma(a){var b=ia(a);return"array"==b||"object"==b&&"number"==typeof a.length}function na(a){return"string"==typeof a}function x(a){return"number"==typeof a}function oa(a){return"function"==ia(a)}function pa(a){var b=typeof a;return"object"==b&&a!=t||"function"==b}function qa(a){return a[ra]||(a[ra]=++sa)}var ra="closure_uid_"+(1E9*Math.random()>>>0),sa=0;
function ta(a,b,c){return a.call.apply(a.bind,arguments)}function ua(a,b,c){a||n(Error());if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,e);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function va(a,b,c){va=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ta:ua;return va.apply(t,arguments)}
function wa(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}}var xa=Date.now||function(){return+new Date};function A(a,b){var c=a.split("."),e=ga;!(c[0]in e)&&e.execScript&&e.execScript("var "+c[0]);for(var d;c.length&&(d=c.shift());)!c.length&&ja(b)?e[d]=b:e=e[d]?e[d]:e[d]={}}
function C(a,b){function c(){}c.prototype=b.prototype;a.w=b.prototype;a.prototype=new c;a.prototype.constructor=a};var D=D||{};D.Ak=q;D.Ja=function(a){eval("X.DEV === undefined")||window.console.time(a)};D.Da=function(a){eval("X.DEV === undefined")||window.console.timeEnd(a)};window["X.counter"]=new function(){this.Wh=0;this.rk=function(){return this.Wh++}};function ya(a,b){for(var c in b){var e=b.__lookupGetter__(c),d=b.__lookupSetter__(c);c in a||(e||d?(e&&a.__defineGetter__(c,e),d&&a.__defineSetter__(c,d)):a[c]=b[c])}}var za=window.Lh;
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c?this:a||window,d.concat(e.call(arguments)))}function c(){}"function"!==typeof this&&n(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var e=Array.prototype.slice,d=e.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
for(var Aa=0,Ca=["ms","moz","webkit","o"],Da=0;Da<Ca.length&&!window.requestAnimationFrame;++Da)window.requestAnimationFrame=window[Ca[Da]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[Ca[Da]+"CancelAnimationFrame"]||window[Ca[Da]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=Date.now(),c=Math.max(0,16-(b-Aa)),e=window.setTimeout(function(){a(b+c)},c);Aa=b+c;return e});
window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});
"slice"in ArrayBuffer.prototype||(ArrayBuffer.prototype.slice=function(a,b){a===p&&n(Error("Not enough arguments."));var c=b||this.byteLength;0>a&&(a=this.byteLength+a);0>c&&(c=this.byteLength+c);c<a&&(c=a=0);0>a&&(a=0);0>c&&(c=0);a>this.byteLength&&(a=this.byteLength);c>this.byteLength&&(c=this.byteLength);for(var e=new ArrayBuffer(c-a),d=new Uint8Array(this),f=new Uint8Array(e),g=a,h=0;g<c;++g,++h)f[h]=d[g];return e});A("$",za);A("Function.prototype.bind",Function.prototype.bind);
A("window.requestAnimationFrame",window.requestAnimationFrame);A("window.cancelAnimationFrame",window.cancelAnimationFrame);var Ea=0;function Fa(){}w=Fa.prototype;w.key=0;w.yc=u;w.je=u;w.Ca=function(a,b,c,e,d,f){oa(a)?this.Vg=q:a&&a.handleEvent&&oa(a.handleEvent)?this.Vg=u:n(Error("Invalid listener argument"));this.bc=a;this.oh=b;this.src=c;this.type=e;this.capture=!!d;this.tf=f;this.je=u;this.key=++Ea;this.yc=u};w.handleEvent=function(a){return this.Vg?this.bc.call(this.tf||this.src,a):this.bc.handleEvent.call(this.bc,a)};function Ha(a,b){for(var c in a)b.call(p,a[c],c,a)}function Ia(a){var b=[],c=0,e;for(e in a)b[c++]=a[e];return b}var Ja="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ka(a,b){for(var c,e,d=1;d<arguments.length;d++){e=arguments[d];for(c in e)a[c]=e[c];for(var f=0;f<Ja.length;f++)c=Ja[f],Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=e[c])}};function La(a){if(!Ma.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Na,"&"));-1!=a.indexOf("<")&&(a=a.replace(Oa,"<"));-1!=a.indexOf(">")&&(a=a.replace(Pa,">"));-1!=a.indexOf('"')&&(a=a.replace(Qa,"""));return a}var Na=/&/g,Oa=/</g,Pa=/>/g,Qa=/\"/g,Ma=/[&<>\"]/;var Ra,Sa,Ta,Ua,Va,Wa,Xa;function Ya(){return ga.navigator?ga.navigator.userAgent:t}function Za(){return ga.navigator}Ua=Ta=Sa=Ra=u;var $a;if($a=Ya()){var ab=Za();Ra=0==$a.indexOf("Opera");Sa=!Ra&&-1!=$a.indexOf("MSIE");Ta=!Ra&&-1!=$a.indexOf("WebKit");Ua=!Ra&&!Ta&&"Gecko"==ab.product}var bb=Ra,K=Sa,db=Ua,eb=Ta,fb,gb=Za();fb=gb&&gb.platform||"";Va=-1!=fb.indexOf("Mac");Wa=-1!=fb.indexOf("Win");Xa=-1!=fb.indexOf("Linux");var hb=!!Za()&&-1!=(Za().appVersion||"").indexOf("X11");
function ib(){var a=ga.document;return a?a.documentMode:p}var kb;a:{var lb="",mb;if(bb&&ga.opera)var pb=ga.opera.version,lb="function"==typeof pb?pb():pb;else if(db?mb=/rv\:([^\);]+)(\)|;)/:K?mb=/MSIE\s+([^\);]+)(\)|;)/:eb&&(mb=/WebKit\/(\S+)/),mb)var qb=mb.exec(Ya()),lb=qb?qb[1]:"";if(K){var ub=ib();if(ub>parseFloat(lb)){kb=String(ub);break a}}kb=lb}var vb={};
function wb(a){var b;if(!(b=vb[a])){b=0;for(var c=String(kb).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=Math.max(c.length,e.length),f=0;0==b&&f<d;f++){var g=c[f]||"",h=e[f]||"",l=RegExp("(\\d*)(\\D*)","g"),j=RegExp("(\\d*)(\\D*)","g");do{var k=l.exec(g)||["","",""],m=j.exec(h)||["","",""];if(0==k[0].length&&0==m[0].length)break;b=((0==k[1].length?0:parseInt(k[1],10))<(0==m[1].length?0:parseInt(m[1],10))?-1:(0==k[1].length?0:parseInt(k[1],
10))>(0==m[1].length?0:parseInt(m[1],10))?1:0)||((0==k[2].length)<(0==m[2].length)?-1:(0==k[2].length)>(0==m[2].length)?1:0)||(k[2]<m[2]?-1:k[2]>m[2]?1:0)}while(0==b)}b=vb[a]=0<=b}return b}var xb=ga.document,yb=!xb||!K?p:ib()||("CSS1Compat"==xb.compatMode?parseInt(kb,10):5);var zb=!K||K&&9<=yb,Ab=K&&!wb("9");!eb||wb("528");db&&wb("1.9b")||K&&wb("8")||bb&&wb("9.5")||eb&&wb("528");db&&!wb("8")||K&&wb("9");var Bb=Array.prototype,Cb=Bb.indexOf?function(a,b,c){return Bb.indexOf.call(a,b,c)}:function(a,b,c){c=c==t?0:0>c?Math.max(0,a.length+c):c;if(na(a))return!na(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},Db=Bb.forEach?function(a,b,c){Bb.forEach.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=na(a)?a.split(""):a,f=0;f<e;f++)f in d&&b.call(c,d[f],f,a)},Eb=Bb.map?function(a,b,c){return Bb.map.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=Array(e),f=
na(a)?a.split(""):a,g=0;g<e;g++)g in f&&(d[g]=b.call(c,f[g],g,a));return d},Fb=Bb.some?function(a,b,c){return Bb.some.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=na(a)?a.split(""):a,f=0;f<e;f++)if(f in d&&b.call(c,d[f],f,a))return q;return u};function Gb(a,b){var c=Cb(a,b);0<=c&&Bb.splice.call(a,c,1)}function Hb(a,b,c){return 2>=arguments.length?Bb.slice.call(a,b):Bb.slice.call(a,b,c)};function Ib(){0!=Jb&&(this.yl=Error().stack,qa(this))}var Jb=0;function Lb(a,b){this.type=a;this.currentTarget=this.target=b}w=Lb.prototype;w.xc=u;w.defaultPrevented=u;w.ye=q;w.stopPropagation=function(){this.xc=q};w.preventDefault=function(){this.defaultPrevented=q;this.ye=u};function Mb(a){Mb[" "](a);return a}Mb[" "]=ha;function Nb(a,b){a&&this.Ca(a,b)}C(Nb,Lb);w=Nb.prototype;w.target=t;w.relatedTarget=t;w.offsetX=0;w.offsetY=0;w.clientX=0;w.clientY=0;w.screenX=0;w.screenY=0;w.button=0;w.keyCode=0;w.charCode=0;w.ctrlKey=u;w.altKey=u;w.shiftKey=u;w.metaKey=u;w.Wj=u;w.tb=t;
w.Ca=function(a,b){var c=this.type=a.type;Lb.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var e=a.relatedTarget;if(e){if(db){var d;a:{try{Mb(e.nodeName);d=q;break a}catch(f){}d=u}d||(e=t)}}else"mouseover"==c?e=a.fromElement:"mouseout"==c&&(e=a.toElement);this.relatedTarget=e;this.offsetX=eb||a.offsetX!==p?a.offsetX:a.layerX;this.offsetY=eb||a.offsetY!==p?a.offsetY:a.layerY;this.clientX=a.clientX!==p?a.clientX:a.pageX;this.clientY=a.clientY!==p?a.clientY:a.pageY;this.screenX=
a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.Wj=Va?a.metaKey:a.ctrlKey;this.state=a.state;this.tb=a;a.defaultPrevented&&this.preventDefault();delete this.xc};w.stopPropagation=function(){Nb.w.stopPropagation.call(this);this.tb.stopPropagation?this.tb.stopPropagation():this.tb.cancelBubble=q};
w.preventDefault=function(){Nb.w.preventDefault.call(this);var a=this.tb;if(a.preventDefault)a.preventDefault();else if(a.returnValue=u,Ab)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};w.Gi=v("tb");var Ob={},Pb={},Qb={},Rb={};function L(a,b,c,e,d){if(ka(b)){for(var f=0;f<b.length;f++)L(a,b[f],c,e,d);return t}a=Sb(a,b,c,u,e,d);b=a.key;Ob[b]=a;return b}
function Sb(a,b,c,e,d,f){b||n(Error("Invalid event type"));d=!!d;var g=Pb;b in g||(g[b]={pa:0,Na:0});g=g[b];d in g||(g[d]={pa:0,Na:0},g.pa++);var g=g[d],h=qa(a),l;g.Na++;if(g[h]){l=g[h];for(var j=0;j<l.length;j++)if(g=l[j],g.bc==c&&g.tf==f){if(g.yc)break;e||(l[j].je=u);return l[j]}}else l=g[h]=[],g.pa++;var k=Tb,m=zb?function(a){return k.call(m.src,m.bc,a)}:function(a){a=k.call(m.src,m.bc,a);if(!a)return a},j=m,g=new Fa;g.Ca(c,j,a,b,d,f);g.je=e;j.src=a;j.bc=g;l.push(g);Qb[h]||(Qb[h]=[]);Qb[h].push(g);
a.addEventListener?(a==ga||!a.customEvent_)&&a.addEventListener(b,j,d):a.attachEvent(b in Rb?Rb[b]:Rb[b]="on"+b,j);return g}function Ub(a,b,c,e,d){if(ka(b))for(var f=0;f<b.length;f++)Ub(a,b[f],c,e,d);else a=Sb(a,b,c,q,e,d),Ob[a.key]=a}function Vb(a,b,c,e,d){if(ka(b))for(var f=0;f<b.length;f++)Vb(a,b[f],c,e,d);else{e=!!e;a:{f=Pb;if(b in f&&(f=f[b],e in f&&(f=f[e],a=qa(a),f[a]))){a=f[a];break a}a=t}if(a)for(f=0;f<a.length;f++)if(a[f].bc==c&&a[f].capture==e&&a[f].tf==d){Wb(a[f].key);break}}}
function Wb(a){var b=Ob[a];if(!b||b.yc)return u;var c=b.src,e=b.type,d=b.oh,f=b.capture;c.removeEventListener?(c==ga||!c.customEvent_)&&c.removeEventListener(e,d,f):c.detachEvent&&c.detachEvent(e in Rb?Rb[e]:Rb[e]="on"+e,d);c=qa(c);Qb[c]&&(d=Qb[c],Gb(d,b),0==d.length&&delete Qb[c]);b.yc=q;if(b=Pb[e][f][c])b.fh=q,Xb(e,f,c,b);delete Ob[a];return q}
function Xb(a,b,c,e){if(!e.ue&&e.fh){for(var d=0,f=0;d<e.length;d++)e[d].yc?e[d].oh.src=t:(d!=f&&(e[f]=e[d]),f++);e.length=f;e.fh=u;0==f&&(delete Pb[a][b][c],Pb[a][b].pa--,0==Pb[a][b].pa&&(delete Pb[a][b],Pb[a].pa--),0==Pb[a].pa&&delete Pb[a])}}function Yb(a){var b=0;if(a!=t){if(a=qa(a),Qb[a]){a=Qb[a];for(var c=a.length-1;0<=c;c--)Wb(a[c].key),b++}}else Ha(Ob,function(a,c){Wb(c);b++})}
function Zb(a,b){var c=qa(a),e=Qb[c];if(e){var d=ja(b),f=ja(p);return d&&f?(e=Pb[b],!!e&&!!e[p]&&c in e[p]):!d&&!f?q:Fb(e,function(a){return d&&a.type==b||f&&a.capture==p})}return u}function $b(a,b,c,e,d){var f=1;b=qa(b);if(a[b]){var g=--a.Na,h=a[b];h.ue?h.ue++:h.ue=1;try{for(var l=h.length,j=0;j<l;j++){var k=h[j];k&&!k.yc&&(f&=ac(k,d)!==u)}}finally{a.Na=Math.max(g,a.Na),h.ue--,Xb(c,e,b,h)}}return Boolean(f)}function ac(a,b){a.je&&Wb(a.key);return a.handleEvent(b)}
function Tb(a,b){if(a.yc)return q;var c=a.type,e=Pb;if(!(c in e))return q;var e=e[c],d,f;if(!zb){var g;if(!(g=b))a:{g=["window","event"];for(var h=ga;d=g.shift();)if(h[d]!=t)h=h[d];else{g=t;break a}g=h}d=g;g=q in e;h=u in e;if(g){if(0>d.keyCode||d.returnValue!=p)return q;a:{var l=u;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(j){l=q}if(l||d.returnValue==p)d.returnValue=q}}l=new Nb;l.Ca(d,this);d=q;try{if(g){for(var k=[],m=l.currentTarget;m;m=m.parentNode)k.push(m);f=e[q];f.Na=f.pa;for(var r=k.length-
1;!l.xc&&0<=r&&f.Na;r--)l.currentTarget=k[r],d&=$b(f,k[r],c,q,l);if(h){f=e[u];f.Na=f.pa;for(r=0;!l.xc&&r<k.length&&f.Na;r++)l.currentTarget=k[r],d&=$b(f,k[r],c,u,l)}}else d=ac(a,l)}finally{k&&(k.length=0)}return d}c=new Nb(b,this);return d=ac(a,c)}var bc=0;function cc(a){return a+"_"+bc++};function dc(){Ib.call(this);this.Cl={};this.vl=this}C(dc,Ib);dc.prototype.customEvent_=q;w=dc.prototype;w.Mf=t;w.Rf=ca("Mf");w.addEventListener=function(a,b,c,e){L(this,a,b,c,e)};w.removeEventListener=function(a,b,c,e){Vb(this,a,b,c,e)};
w.dispatchEvent=function(a){var b=a.type||a,c=Pb;if(b in c){if(na(a))a=new Lb(a,this);else if(a instanceof Lb)a.target=a.target||this;else{var e=a;a=new Lb(b,this);Ka(a,e)}var e=1,d,c=c[b],b=q in c,f;if(b){d=[];for(f=this;f;f=f.Mf)d.push(f);f=c[q];f.Na=f.pa;for(var g=d.length-1;!a.xc&&0<=g&&f.Na;g--)a.currentTarget=d[g],e&=$b(f,d[g],a.type,q,a)&&a.ye!=u}if(u in c)if(f=c[u],f.Na=f.pa,b)for(g=0;!a.xc&&g<d.length&&f.Na;g++)a.currentTarget=d[g],e&=$b(f,d[g],a.type,u,a)&&a.ye!=u;else for(d=this;!a.xc&&
d&&f.Na;d=d.Mf)a.currentTarget=d,e&=$b(f,d,a.type,u,a)&&a.ye!=u;a=Boolean(e)}else a=q;return a};function M(){dc.call(this);this.g="base";this.ja=window["X.counter"].rk();this.j=u}C(M,dc);M.prototype.__defineGetter__("classname",v("g"));M.prototype.__defineGetter__("id",v("ja"));A("X.base",M);function ec(){M.call(this);this.g="indexer";this.bf=[];this.ql=[];this.Ka={}}C(ec,M);ec.prototype.add=function(a){a==t&&n(Error("Invalid object."));var b=window.JSON.stringify(a);b in this.Ka||(this.Ka[b]=this.bf.length,this.bf.push(a));return this.Ka[b]};ec.prototype.unique=v("bf");function fc(a){M.call(this);this.g="file";this.$d=a;this.j=q}C(fc,M);function gc(){this.ab=this.r=t}gc.prototype.__defineSetter__("file",function(a){if(a==t||ka(a)&&0==a.length)this.r=t;else{if(ka(a)){if(1==a.length){this.r=new fc(a[0]);return}this.r=Eb(a,function(a){var c=new P;c.r=new fc(a);return c})}else this.r=new fc(a);this.ab=t}});gc.prototype.__defineGetter__("file",function(){return!this.r?"":ka(this.r)?this.r.map(function(a){return a.r.$d}):this.r.$d});
gc.prototype.__defineGetter__("filedata",function(){return ka(this.r)?this.r.map(function(a){return a.ab}):this.ab});gc.prototype.__defineSetter__("filedata",function(a){if(a==t||ka(a)&&0==a.length)this.ab=t;if(ka(a))if(1==a.length)this.ab=a[0];else{var b=this.r.length,c;for(c=0;c<b;c++)this.r[c].ab=a[c]}else this.ab=a});function hc(a){if("function"==typeof a.Dd)return a.Dd();if(na(a))return a.split("");if(ma(a)){for(var b=[],c=a.length,e=0;e<c;e++)b.push(a[e]);return b}return Ia(a)};function ic(a,b){this.ha={};this.T=[];var c=arguments.length;if(1<c){c%2&&n(Error("Uneven number of arguments"));for(var e=0;e<c;e+=2)this.set(arguments[e],arguments[e+1])}else a&&this.df(a)}w=ic.prototype;w.pa=0;w.$f=0;w.sf=v("pa");w.Dd=function(){jc(this);for(var a=[],b=0;b<this.T.length;b++)a.push(this.ha[this.T[b]]);return a};function kc(a){for(var b=0;b<a.T.length;b++){var c=a.T[b];if(lc(a.ha,c)&&a.ha[c]==u)return q}return u}w.clear=function(){this.ha={};this.$f=this.pa=this.T.length=0};
w.remove=function(a){return lc(this.ha,a)?(delete this.ha[a],this.pa--,this.$f++,this.T.length>2*this.pa&&jc(this),q):u};function jc(a){if(a.pa!=a.T.length){for(var b=0,c=0;b<a.T.length;){var e=a.T[b];lc(a.ha,e)&&(a.T[c++]=e);b++}a.T.length=c}if(a.pa!=a.T.length){for(var d={},c=b=0;b<a.T.length;)e=a.T[b],lc(d,e)||(a.T[c++]=e,d[e]=1),b++;a.T.length=c}}w.get=function(a,b){return lc(this.ha,a)?this.ha[a]:b};w.set=function(a,b){lc(this.ha,a)||(this.pa++,this.T.push(a),this.$f++);this.ha[a]=b};
w.df=function(a){var b;if(a instanceof ic)jc(a),b=a.T.concat(),a=a.Dd();else{b=[];var c=0,e;for(e in a)b[c++]=e;a=Ia(a)}for(c=0;c<b.length;c++)this.set(b[c],a[c])};w.l=function(){return new ic(this)};w.Xf=function(){for(var a=new ic,b=0;b<this.T.length;b++){var c=this.T[b];a.set(this.ha[c],c)}return a};function lc(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function mc(){M.call(this);this.g="colortable";this.Ka=new ic;ya(this,new gc)}C(mc,M);mc.prototype.add=function(a,b,c,e,d,f){(!x(a)||!x(c)||!x(e)||!x(d)||!x(f))&&n(Error("Invalid color table entry."));this.Ka.set(a,[b,c,e,d,f]);this.j=q};mc.prototype.get=function(a){return this.Ka.get(a)};A("X.colortable.prototype.get",mc.prototype.get);function nc(a,b,c){this.x=ja(a)?a:0;this.y=ja(b)?b:0;this.d=ja(c)?c:0}nc.prototype.l=function(){return new nc(this.x,this.y,this.d)};function S(a,b,c){this.x=a;this.y=b;this.d=c}C(S,nc);w=S.prototype;w.l=function(){return new S(this.x,this.y,this.d)};w.Jb=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.d*this.d)};w.scale=function(a){this.x*=a;this.y*=a;this.d*=a;return this};w.Y=function(){this.x=-this.x;this.y=-this.y;this.d=-this.d;return this};w.normalize=function(){return this.scale(1/this.Jb())};w.add=function(a){this.x+=a.x;this.y+=a.y;this.d+=a.d;return this};
w.wa=function(a){this.x-=a.x;this.y-=a.y;this.d-=a.d;return this};function oc(a,b){var c=a.x-b.x,e=a.y-b.y,d=a.d-b.d;return Math.sqrt(c*c+e*e+d*d)}function pc(a,b){var c=a.x-b.x,e=a.y-b.y,d=a.d-b.d;return c*c+e*e+d*d}function qc(a,b){return new S(a.x+b.x,a.y+b.y,a.d+b.d)}function rc(a,b){return new S(a.y*b.d-a.d*b.y,a.d*b.x-a.x*b.d,a.x*b.y-a.y*b.x)};D.m=S;w=D.m.prototype;w.l=S.prototype.l;w.Jb=S.prototype.Jb;w.scale=S.prototype.scale;w.Y=S.prototype.Y;w.add=S.prototype.add;w.wa=S.prototype.wa;w.normalize=function(){var a=this.Jb();return 0==a?this.scale(0):this.scale(1/a)};D.m.ac=function(a,b){return a.x*b.x+a.y*b.y+a.d*b.d};D.m.tc=rc;D.m.rf=oc;D.m.te=function(a,b,c){return new S(a.x+c*(b.x-a.x),a.y+c*(b.y-a.y),a.d+c*(b.d-a.d))};D.m.prototype.__defineGetter__("xx",v("x"));D.m.prototype.__defineGetter__("yy",v("y"));
D.m.prototype.__defineGetter__("zz",v("d"));A("X.vector",D.m);A("X.vector.prototype.clone",D.m.prototype.l);A("X.vector.prototype.magnitude",D.m.prototype.Jb);A("X.vector.prototype.scale",D.m.prototype.scale);A("X.vector.prototype.invert",D.m.prototype.Y);A("X.vector.prototype.normalize",D.m.prototype.normalize);A("X.vector.prototype.add",D.m.prototype.add);A("X.vector.prototype.subtract",D.m.prototype.wa);A("X.vector.dot",D.m.ac);A("X.vector.cross",D.m.tc);A("X.vector.distance",D.m.rf);
A("X.vector.lerp",D.m.te);function sc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}sc.prototype.BYTES_PER_ELEMENT=8;sc.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};sc.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{sc.BYTES_PER_ELEMENT=8}catch(tc){}sc.prototype.BYTES_PER_ELEMENT=sc.prototype.BYTES_PER_ELEMENT;sc.prototype.set=sc.prototype.set;sc.prototype.toString=sc.prototype.toString;A("Float64Array",sc)};function uc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}uc.prototype.BYTES_PER_ELEMENT=4;uc.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};uc.prototype.toString=Array.prototype.join;"undefined"==typeof Float32Array&&(uc.BYTES_PER_ELEMENT=4,uc.prototype.BYTES_PER_ELEMENT=uc.prototype.BYTES_PER_ELEMENT,uc.prototype.set=uc.prototype.set,uc.prototype.toString=uc.prototype.toString,A("Float32Array",uc));function vc(){return new Float32Array(3)}function wc(a,b,c){var e=vc();e[0]=a;e[1]=b;e[2]=c;return e}function xc(a,b){var c=a[0],e=a[1],d=a[2],c=1/Math.sqrt(c*c+e*e+d*d);b[0]=a[0]*c;b[1]=a[1]*c;b[2]=a[2]*c};function yc(){return new Float32Array(4)}function zc(a,b,c,e){var d=yc();d[0]=a;d[1]=b;d[2]=c;d[3]=e;return d};function Ac(){return new Float32Array(16)}function Bc(){var a=Ac();a[0]=a[5]=a[10]=a[15]=1;return a}function Cc(a,b,c,e,d,f,g,h,l,j,k,m,r,s,y,z,G){a[0]=b;a[1]=c;a[2]=e;a[3]=d;a[4]=f;a[5]=g;a[6]=h;a[7]=l;a[8]=j;a[9]=k;a[10]=m;a[11]=r;a[12]=s;a[13]=y;a[14]=z;a[15]=G;return a}function Dc(a,b,c,e,d){a[12]=b;a[13]=c;a[14]=e;a[15]=d;return a}function Ec(a,b,c){b*=4;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3]}function Fc(a,b,c){b*=4;c[0]=a[b];c[1]=a[b+1];c[2]=a[b+2];c[3]=a[b+3]}
function T(a,b,c,e,d,f){a[b]=c;a[b+4]=e;a[b+8]=d;a[b+12]=f}function Gc(a,b,c){a[b]=c[0];a[b+4]=c[1];a[b+8]=c[2];a[b+12]=c[3]}function Hc(a,b,c){c[0]=a[b];c[1]=a[b+4];c[2]=a[b+8];c[3]=a[b+12]}
function Ic(a,b,c){var e=a[0],d=a[1],f=a[2],g=a[3],h=a[4],l=a[5],j=a[6],k=a[7],m=a[8],r=a[9],s=a[10],y=a[11],z=a[12],G=a[13],F=a[14];a=a[15];var H=b[0],B=b[1],E=b[2],I=b[3],N=b[4],Q=b[5],R=b[6],O=b[7],ea=b[8],J=b[9],aa=b[10],da=b[11],U=b[12],V=b[13],Ga=b[14];b=b[15];c[0]=e*H+h*B+m*E+z*I;c[1]=d*H+l*B+r*E+G*I;c[2]=f*H+j*B+s*E+F*I;c[3]=g*H+k*B+y*E+a*I;c[4]=e*N+h*Q+m*R+z*O;c[5]=d*N+l*Q+r*R+G*O;c[6]=f*N+j*Q+s*R+F*O;c[7]=g*N+k*Q+y*R+a*O;c[8]=e*ea+h*J+m*aa+z*da;c[9]=d*ea+l*J+r*aa+G*da;c[10]=f*ea+j*J+s*aa+
F*da;c[11]=g*ea+k*J+y*aa+a*da;c[12]=e*U+h*V+m*Ga+z*b;c[13]=d*U+l*V+r*Ga+G*b;c[14]=f*U+j*V+s*Ga+F*b;c[15]=g*U+k*V+y*Ga+a*b;return c}
function Jc(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],j=a[7],k=a[8],m=a[9],r=a[10],s=a[11],y=a[12],z=a[13],G=a[14],F=a[15],H=c*h-e*g,B=c*l-d*g,E=c*j-f*g,I=e*l-d*h,N=e*j-f*h,Q=d*j-f*l,R=k*z-m*y,O=k*G-r*y,ea=k*F-s*y,J=m*G-r*z,aa=m*F-s*z,da=r*F-s*G,U=H*da-B*aa+E*J+I*ea-N*O+Q*R;if(0==U)return u;U=1/U;b[0]=(h*da-l*aa+j*J)*U;b[1]=(-e*da+d*aa-f*J)*U;b[2]=(z*Q-G*N+F*I)*U;b[3]=(-m*Q+r*N-s*I)*U;b[4]=(-g*da+l*ea-j*O)*U;b[5]=(c*da-d*ea+f*O)*U;b[6]=(-y*Q+G*E-F*B)*U;b[7]=(k*Q-r*E+s*B)*U;b[8]=(g*
aa-h*ea+j*R)*U;b[9]=(-c*aa+e*ea-f*R)*U;b[10]=(y*N-z*E+F*H)*U;b[11]=(-k*N+m*E-s*H)*U;b[12]=(-g*J+h*O-l*R)*U;b[13]=(c*J-e*O+d*R)*U;b[14]=(-y*I+z*B-G*H)*U;b[15]=(k*I-m*B+r*H)*U;return q}function Kc(a,b,c){var e=b[0],d=b[1];b=b[2];c[0]=e*a[0]+d*a[4]+b*a[8]+a[12];c[1]=e*a[1]+d*a[5]+b*a[9]+a[13];c[2]=e*a[2]+d*a[6]+b*a[10]+a[14]}
function Lc(a,b,c){var e=b[0],d=b[1],f=b[2];b=b[3];c[0]=e*a[0]+d*a[4]+f*a[8]+b*a[12];c[1]=e*a[1]+d*a[5]+f*a[9]+b*a[13];c[2]=e*a[2]+d*a[6]+f*a[10]+b*a[14];c[3]=e*a[3]+d*a[7]+f*a[11]+b*a[15];return c}function Mc(a,b,c,e){return Dc(a,a[0]*b+a[4]*c+a[8]*e+a[12],a[1]*b+a[5]*c+a[9]*e+a[13],a[2]*b+a[6]*c+a[10]*e+a[14],a[3]*b+a[7]*c+a[11]*e+a[15])}new Float64Array(3);new Float64Array(3);new Float64Array(4);new Float64Array(4);new Float64Array(4);new Float64Array(16);D.f={};D.f.Yg=function(a,b,c,e){c=c.wa(b);c.normalize();e=D.m.tc(c,e);e.normalize();var d=D.m.tc(e,c);d.normalize();c.Y();T(a,0,e.x,e.y,e.d,0);T(a,1,d.x,d.y,d.d,0);T(a,2,c.x,c.y,c.d,0);Mc(a,-b.x,-b.y,-b.d);return a};D.f.ba=function(a,b,c,e){var d=1/(b*a[3]+c*a[7]+e*a[11]+a[15]);return new D.m((b*a[0]+c*a[4]+e*a[8]+a[12])*d,(b*a[1]+c*a[5]+e*a[9]+a[13])*d,(b*a[2]+c*a[6]+e*a[10]+a[14])*d)};
D.f.ok=function(a,b,c){var e=new Float32Array(4),d=new Float32Array(4);Hc(a,b,e);Hc(a,c,d);Gc(a,b,d);Gc(a,c,e);return a};D.f.nk=function(a,b,c){var e=new Float32Array(4),d=new Float32Array(4);Fc(a,b,e);Fc(a,c,d);Ec(a,b,d);Ec(a,c,e);return a};D.f.Ed=Bc;D.f.l=function(a){var b=Ac();b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};
D.f.Xf=function(a,b){if(b==a){var c=a[1],e=a[2],d=a[3],f=a[6],g=a[7],h=a[11];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=c;b[6]=a[9];b[7]=a[13];b[8]=e;b[9]=f;b[11]=a[14];b[12]=d;b[13]=g;b[14]=h}else b[0]=a[0],b[1]=a[4],b[2]=a[8],b[3]=a[12],b[4]=a[1],b[5]=a[5],b[6]=a[9],b[7]=a[13],b[8]=a[2],b[9]=a[6],b[10]=a[10],b[11]=a[14],b[12]=a[3],b[13]=a[7],b[14]=a[11],b[15]=a[15];return b};
D.f.ti=function(a){var b=a[0],c=a[1],e=a[2],d=a[3],f=a[4],g=a[5],h=a[6],l=a[7],j=a[8],k=a[9],m=a[10],r=a[11],s=a[12],y=a[13],z=a[14];a=a[15];return(b*g-c*f)*(m*a-r*z)-(b*h-e*f)*(k*a-r*y)+(b*l-d*f)*(k*z-m*y)+(c*h-e*g)*(j*a-r*s)-(c*l-d*g)*(j*z-m*s)+(e*l-d*h)*(j*y-k*s)};D.f.Y=Jc;D.f.yf=function(a,b,c,e,d){var f=b/2;b=d-e;var g=Math.sin(f);if(0==b||0==g||0==c)return a;f=Math.cos(f)/g;return Cc(a,f/c,0,0,0,0,f,0,0,0,0,-(d+e)/b,-1,0,0,-(2*e*d)/b,0)};
D.f.dj=function(a,b,c,e,d,f,g){return Cc(a,2*f/(c-b),0,0,0,0,2*f/(d-e),0,0,(c+b)/(c-b),(d+e)/(d-e),-(g+f)/(g-f),-1,0,0,-(2*g*f)/(g-f),0)};D.f.ej=function(a,b,c,e,d,f,g){return Cc(a,2/(c-b),0,0,0,0,2/(d-e),0,0,0,0,-2/(g-f),0,-(c+b)/(c-b),-(d+e)/(d-e),-(g+f)/(g-f),1)};D.f.multiply=Ic;D.f.Af=Lc;D.f.translate=Mc;D.f.scale=function(a,b,c,e){return Cc(a,a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*c,a[5]*c,a[6]*c,a[7]*c,a[8]*e,a[9]*e,a[10]*e,a[11]*e,a[12],a[13],a[14],a[15])};
D.f.rotate=function(a,b,c,e,d){var f=a[0],g=a[1],h=a[2],l=a[3],j=a[4],k=a[5],m=a[6],r=a[7],s=a[8],y=a[9],z=a[10],G=a[11],F=Math.cos(b),H=Math.sin(b),B=1-F;b=c*c*B+F;var E=c*e*B+d*H,I=c*d*B-e*H,N=c*e*B-d*H,Q=e*e*B+F,R=e*d*B+c*H,O=c*d*B+e*H;c=e*d*B-c*H;d=d*d*B+F;return Cc(a,f*b+j*E+s*I,g*b+k*E+y*I,h*b+m*E+z*I,l*b+r*E+G*I,f*N+j*Q+s*R,g*N+k*Q+y*R,h*N+m*Q+z*R,l*N+r*Q+G*R,f*O+j*c+s*d,g*O+k*c+y*d,h*O+m*c+z*d,l*O+r*c+G*d,a[12],a[13],a[14],a[15])};
D.f.ze=function(a,b){var c=a[4],e=a[5],d=a[6],f=a[7],g=a[8],h=a[9],l=a[10],j=a[11],k=Math.cos(b),m=Math.sin(b);a[4]=c*k+g*m;a[5]=e*k+h*m;a[6]=d*k+l*m;a[7]=f*k+j*m;a[8]=c*-m+g*k;a[9]=e*-m+h*k;a[10]=d*-m+l*k;a[11]=f*-m+j*k;return a};D.f.Ae=function(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[8],h=a[9],l=a[10],j=a[11],k=Math.cos(b),m=Math.sin(b);a[0]=c*k+g*-m;a[1]=e*k+h*-m;a[2]=d*k+l*-m;a[3]=f*k+j*-m;a[8]=c*m+g*k;a[9]=e*m+h*k;a[10]=d*m+l*k;a[11]=f*m+j*k;return a};
D.f.Be=function(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],j=a[7],k=Math.cos(b),m=Math.sin(b);a[0]=c*k+g*m;a[1]=e*k+h*m;a[2]=d*k+l*m;a[3]=f*k+j*m;a[4]=c*-m+g*k;a[5]=e*-m+h*k;a[6]=d*-m+l*k;a[7]=f*-m+j*k;return a};A("X.matrix.identity",D.f.Ed);A("X.matrix.clone",D.f.l);A("X.matrix.transpose",D.f.Xf);A("X.matrix.determinant",D.f.ti);A("X.matrix.invert",D.f.Y);A("X.matrix.multiply",D.f.multiply);A("X.matrix.multiplyByVector",D.f.ba);A("X.matrix.multiplyByVec4",D.f.Af);
A("X.matrix.makePerspective",D.f.yf);A("X.matrix.makeFrustum",D.f.dj);A("X.matrix.makeOrtho",D.f.ej);A("X.matrix.makeLookAt",D.f.Yg);A("X.matrix.translate",D.f.translate);A("X.matrix.scale",D.f.scale);A("X.matrix.rotate",D.f.rotate);A("X.matrix.rotateX",D.f.ze);A("X.matrix.rotateY",D.f.Ae);A("X.matrix.rotateZ",D.f.Be);A("X.matrix.swapRows",D.f.ok);A("X.matrix.swapCols",D.f.nk);function Nc(){M.call(this);this.g="transform";this.Q=D.f.Ed()}C(Nc,M);Nc.prototype.__defineGetter__("matrix",v("Q"));Nc.prototype.__defineSetter__("matrix",function(a){(a==t||!(a instanceof Float32Array))&&n(Error("Invalid matrix."));this.Q=a;this.q()});w=Nc.prototype;w.ze=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));D.f.ze(this.Q,a*Math.PI/180);this.q()};w.Ae=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));D.f.Ae(this.Q,a*Math.PI/180);this.q()};
w.Be=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));D.f.Be(this.Q,a*Math.PI/180);this.q()};w.Dh=function(a){x(a)||n(Error("Invalid distance."));D.f.translate(this.Q,a,0,0);this.q()};w.Eh=function(a){x(a)||n(Error("Invalid distance."));D.f.translate(this.Q,0,a,0);this.q()};w.Fh=function(a){x(a)||n(Error("Invalid distance."));D.f.translate(this.Q,0,0,a);this.q()};function Oc(a,b,c){a.Q[b+4*c]*=-1;a.q()}w.Bi=function(){Oc(this,0,0)};w.Ci=function(){Oc(this,1,1)};
w.Di=function(){Oc(this,2,2)};w.q=function(){this.j=q};A("X.transform",Nc);A("X.transform.prototype.rotateX",Nc.prototype.ze);A("X.transform.prototype.rotateY",Nc.prototype.Ae);A("X.transform.prototype.rotateZ",Nc.prototype.Be);A("X.transform.prototype.translateX",Nc.prototype.Dh);A("X.transform.prototype.translateY",Nc.prototype.Eh);A("X.transform.prototype.translateZ",Nc.prototype.Fh);A("X.transform.prototype.flipX",Nc.prototype.Bi);A("X.transform.prototype.flipY",Nc.prototype.Ci);
A("X.transform.prototype.flipZ",Nc.prototype.Di);A("X.transform.prototype.modified",Nc.prototype.q);function Pc(){M.call(this);this.g="texture";this.Wb=this.kb=this.r=t;this.We=this.Xe=0;this.ig=u;ya(this,new gc)}C(Pc,M);Pc.prototype.__defineSetter__("rawData",function(a){this.Wb=a;this.j=q});Pc.prototype.__defineSetter__("rawDataHeight",function(a){this.We=a;this.j=q});Pc.prototype.__defineSetter__("rawDataWidth",function(a){this.Xe=a;this.j=q});Pc.prototype.__defineSetter__("grayscale",function(a){this.ig=a;this.j=q});A("X.texture",Pc);function W(a,b){M.call(this);this.g="triplets";this.ob=Infinity;this.lb=-Infinity;this.pb=Infinity;this.mb=-Infinity;this.qb=Infinity;this.nb=-Infinity;this.Rd=[0,0,0];this.hg=q;this.C=0;this.ea=new Float32Array(a);b!=t&&(this.ea=b.ea.subarray(0,b.ea.length),this.C=this.ea.length,this.ob=b.ob,this.lb=b.lb,this.pb=b.pb,this.mb=b.mb,this.qb=b.qb,this.nb=b.nb,this.Rd=b.Rd.slice(),this.hg=u)}C(W,M);w=W.prototype;
w.add=function(a,b,c){this.ob=Math.min(this.ob,a);this.lb=Math.max(this.lb,a);this.pb=Math.min(this.pb,b);this.mb=Math.max(this.mb,b);this.qb=Math.min(this.qb,c);this.nb=Math.max(this.nb,c);this.Rd=[(this.ob+this.lb)/2,(this.pb+this.mb)/2,(this.qb+this.nb)/2];this.hg=u;this.j=q;this.ea[this.C++]=a;this.ea[this.C++]=b;this.ea[this.C++]=c;return this.C/3};w.Xa=function(){if(this.C!=this.ea.length){var a=new Float32Array(this.C);a.set(this.ea.subarray(0,this.C));this.ea=a}};
w.get=function(a){a*=3;return[this.ea[a],this.ea[a+1],this.ea[a+2]]};w.remove=function(){n(Error("Not implemented."))};w.clear=function(){this.ea=new Float32Array(this.ea.length);this.j=q};W.prototype.__defineGetter__("count",function(){this.Xa();return this.ea.length/3});W.prototype.__defineGetter__("length",function(){this.Xa();return this.ea.length});A("X.triplets",W);A("X.triplets.prototype.add",W.prototype.add);A("X.triplets.prototype.resize",W.prototype.Xa);A("X.triplets.prototype.get",W.prototype.get);
A("X.triplets.prototype.remove",W.prototype.remove);A("X.triplets.prototype.clear",W.prototype.clear);function Qc(){this.Ia=Rc;this.la=new Nc;this.z=[1,1,1];this.oc=this.H=this.qa=this.o=this.h=t;this.Nc=[];this.O=q;this.Lc=this.sd=1;this.fc=t;this.jd=u;this.za=1;this.ya=0;this.rd=q}var Rc="TRIANGLES";Qc.prototype.__defineSetter__("type",function(a){return this.Ia=a});Qc.prototype.__defineGetter__("type",v("Ia"));Qc.prototype.__defineGetter__("texture",function(){this.H||(this.H=new Pc);return this.H});Qc.prototype.__defineGetter__("transform",v("la"));Qc.prototype.__defineGetter__("points",v("h"));
Qc.prototype.__defineSetter__("points",ca("h"));Qc.prototype.__defineGetter__("normals",v("o"));Qc.prototype.__defineSetter__("normals",ca("o"));Qc.prototype.__defineGetter__("colors",v("qa"));Qc.prototype.__defineSetter__("colors",ca("qa"));Qc.prototype.__defineGetter__("color",v("z"));Qc.prototype.__defineSetter__("color",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid color."));for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e].color=a;this.z=a;this.j=q});
Qc.prototype.__defineGetter__("opacity",v("za"));Qc.prototype.__defineSetter__("opacity",function(a){(!x(a)||1<a||0>a)&&n(Error("Invalid opacity."));for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e]!=t&&(b[e].opacity=a);this.za=a;this.j=q});Qc.prototype.__defineGetter__("caption",v("fc"));Qc.prototype.__defineSetter__("caption",function(a){this.fc=a;this.j=q});Qc.prototype.__defineGetter__("visible",v("O"));
Qc.prototype.__defineSetter__("visible",function(a){for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e]!=t&&(b[e].visible=a);this.O=a;this.j=q});Qc.prototype.__defineGetter__("pointsize",v("sd"));Qc.prototype.__defineSetter__("pointsize",function(a){x(a)||n(Error("Invalid point size."));this.sd=a;this.j=q});Qc.prototype.__defineGetter__("magicmode",v("jd"));Qc.prototype.__defineSetter__("magicmode",function(a){"boolean"!=typeof a&&n(Error("Invalid magic mode setting."));this.jd=a;this.j=q});
Qc.prototype.__defineGetter__("linewidth",v("Lc"));Qc.prototype.__defineSetter__("linewidth",function(a){x(a)||n(Error("Invalid line width."));this.Lc=a;this.j=q});Qc.prototype.__defineGetter__("pickable",v("rd"));Qc.prototype.__defineSetter__("pickable",function(a){"boolean"!=typeof a&&n(Error("Invalid pickable setting."));this.rd=a;this.j=q});Qc.prototype.__defineGetter__("textureCoordinateMap",v("oc"));Qc.prototype.__defineSetter__("textureCoordinateMap",ca("tl"));function Sc(){this.ra=Infinity;this.U=this.ka=-Infinity;this.W=Infinity;this.Rb=[0,0,0];this.Pb=[1,1,1]}Sc.prototype.__defineGetter__("lowerThreshold",v("U"));Sc.prototype.__defineSetter__("lowerThreshold",ca("U"));Sc.prototype.__defineGetter__("upperThreshold",v("W"));Sc.prototype.__defineSetter__("upperThreshold",ca("W"));Sc.prototype.__defineGetter__("min",v("ra"));Sc.prototype.__defineGetter__("max",v("ka"));Sc.prototype.__defineGetter__("minColor",v("Rb"));
Sc.prototype.__defineSetter__("minColor",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid min. color."));this.Rb=a});Sc.prototype.__defineGetter__("maxColor",v("Pb"));Sc.prototype.__defineSetter__("maxColor",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid max. color."));this.Pb=a});function Tc(){M.call(this);this.g="scalars";this.dd=this.F=t;this.vg=q;this.Me=0;ya(this,new gc);ya(this,new Sc);this.Rb=[0,1,0];this.Pb=[1,0,0]}C(Tc,M);Tc.prototype.__defineGetter__("array",v("F"));Tc.prototype.__defineSetter__("array",function(a){this.dd=this.F=a;this.j=q});Tc.prototype.__defineGetter__("interpolation",v("Me"));Tc.prototype.__defineSetter__("interpolation",ca("Me"));A("X.scalars",Tc);function Y(a){M.call(this);this.g="object";this.c=[];this.G=this.xa=t;ya(this,new Qc);a!=t&&this.sc(a)}C(Y,M);
Y.prototype.sc=function(a){this.Ia=a.Ia;this.la=new Nc;this.la.Q=new Float32Array(a.la.Q);this.z=a.z.slice();a.h&&(this.h=new W(a.h.length,a.h));a.o&&(this.o=new W(a.o.length,a.o));a.qa&&(this.qa=new W(a.qa.length,a.qa));this.H=a.H;this.oc=a.oc;a.r&&(this.r=new fc((new String(a.r.$d)).toString()));this.za=a.za;this.c.length=0;var b=a.c;if(b)for(var c=b.length,e=0,e=0;e<c;e++)this.c.push(new D[b[e].g](b[e]));this.O=a.O;this.sd=a.sd;this.Lc=a.Lc;a.fc&&(this.fc=(new String(a.fc)).toString());this.jd=
a.jd;this.rd=a.rd;this.Nc=a.Nc.slice();this.j=q};Y.prototype.__defineGetter__("colortable",function(){this.xa||(this.xa=new mc);return this.xa});Y.prototype.__defineGetter__("scalars",function(){this.G||(this.G=new Tc);return this.G});Y.prototype.__defineGetter__("children",v("c"));Y.prototype.q=function(){var a=new Vc;a.D=this;this.dispatchEvent(a)};Y.prototype.remove=function(){var a=new Wc;a.D=this;this.dispatchEvent(a)};
Y.prototype.Ta=function(){Yb(this);if(0<this.c.length)for(var a=this.c,b=a.length,c=0,c=0;c<b;c++)"undefined"!=typeof a[c]&&this.c[c].Ta();this.c.length=0;this.G=this.xa=t};function Xc(a,b){(a==t||b==t||!(a instanceof Y)||!(b instanceof Y))&&n(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.za?-1:1==b.za?1:a.ya!=t&&b.ya!=t&&a.ya>b.ya?-1:1}A("X.object",Y);A("X.object.prototype.modified",Y.prototype.q);A("X.object.prototype.remove",Y.prototype.remove);
A("X.object.prototype.destroy",Y.prototype.Ta);function Yc(a,b,c){this.$a=this.Za=this.Ya=0;3==arguments.length?(this.Ya=Number(a),this.Za=Number(b),this.$a=Number(c)):a instanceof Yc?(this.Ya=Number(a.x()),this.Za=Number(a.y()),this.$a=Number(a.d())):(this.Ya=Number(a[0]),this.Za=Number(a[1]),this.$a=Number(a[2]))}
Yc.prototype={l:function(){return new Yc(this.Ya,this.Za,this.$a)},ac:function(a){return this.Ya*a.x()+this.Za*a.y()+this.$a*a.d()},te:function(a,b){return Zc(this,$c(ad(a,this),b))},length:function(){return Math.sqrt(this.ac(this))},tc:function(a){return new Yc(this.Za*a.d()-this.$a*a.y(),this.$a*a.x()-this.Ya*a.d(),this.Ya*a.y()-this.Za*a.x())},x:v("Ya"),y:v("Za"),d:v("$a")};function bd(a){var b=a.length();return new Yc(a.Ya/b,a.Za/b,a.$a/b)}
function $c(a,b){return new Yc(a.Ya*b,a.Za*b,a.$a*b)}function ad(a,b){return new Yc(a.Ya-b.x(),a.Za-b.y(),a.$a-b.d())}function Zc(a,b){return new Yc(a.Ya+b.x(),a.Za+b.y(),a.$a+b.d())}function cd(a){return new Yc(-a.Ya,-a.Za,-a.$a)};function dd(a,b){this.Wa=new Yc(a);this.va=new Yc(b)}dd.prototype={l:function(){return new dd(this.Wa.l(),this.va.l())},vc:function(){this.va=cd(this.va)}};function ed(a,b){this.va=a;this.Pd=b}ed.prototype={l:function(){return new ed(this.va.l(),this.Pd)},vc:function(){this.va=cd(this.va);this.Pd=-this.Pd}};function fd(a,b){this.Lb=a;this.Ee=b;var c=a[0].Wa,e=a[2].Wa,e=bd(ad(a[1].Wa,c).tc(ad(e,c)));this.Va=new ed(e,e.ac(c))}fd.prototype={l:function(){var a=this.Lb.map(function(a){return a.l()});return new fd(a,this.Ee)},vc:function(){this.Lb.reverse().map(function(a){a.vc()});this.Va.vc()}};
function gd(a,b,c,e,d,f){for(var g=0,h=[],l=0;l<a.Lb.length;l++){var j=b.va.ac(a.Lb[l].Wa)-b.Pd,j=-1E-5>j?2:1E-5<j?1:0,g=g|j;h.push(j)}switch(g){case 0:(0<b.va.ac(a.Va.va)?c:e).push(a);break;case 1:d.push(a);break;case 2:f.push(a);break;case 3:c=[];e=[];for(l=0;l<a.Lb.length;l++){var k=(l+1)%a.Lb.length,j=h[l],m=h[k],g=a.Lb[l],k=a.Lb[k];2!=j&&c.push(g);1!=j&&e.push(2!=j?g.l():g);3==(j|m)&&(j=(b.Pd-b.va.ac(g.Wa))/b.va.ac(ad(k.Wa,g.Wa)),j=new dd(g.Wa.te(k.Wa,j),g.va.te(k.va,j)),c.push(j),e.push(j.l()))}3<=
c.length&&d.push(new fd(c,a.Ee));3<=e.length&&f.push(new fd(e,a.Ee))}};function hd(a){this.Aa=this.Ba=this.Va=t;this.Z=[];a&&id(this,a)}hd.prototype={l:function(){var a=new hd,b=this.Va&&this.Va.l();a.Va=b;b=this.Ba&&this.Ba.l();a.Ba=b;b=this.Aa&&this.Aa.l();a.Aa=b;a.De(this.Z.map(function(a){return a.l()}));return a},Y:function(){for(var a=0;a<this.Z.length;a++)this.Z[a].vc();this.Va.vc();this.Ba&&this.Ba.Y();this.Aa&&this.Aa.Y();a=this.Ba;this.Ba=this.Aa;this.Aa=a},De:ca("Z")};
function id(a,b){if(b.length){a.Va||(a.Va=b[0].Va.l());for(var c=[],e=[],d=0;d<b.length;d++)gd(b[d],a.Va,a.Z,a.Z,c,e);c.length&&(a.Ba||(a.Ba=new hd),id(a.Ba,c));e.length&&(a.Aa||(a.Aa=new hd),id(a.Aa,e))}}function jd(a){var b=a.Z.slice();a.Ba&&(b=b.concat(jd(a.Ba)));a.Aa&&(b=b.concat(jd(a.Aa)));return b}function kd(a,b){a.Z=ld(b,a.Z);a.Ba&&kd(a.Ba,b);a.Aa&&kd(a.Aa,b)}
function ld(a,b){if(!a.Va)return b.slice();for(var c=[],e=[],d=0;d<b.length;d++)gd(b[d],a.Va,c,e,c,e);a.Ba&&(c=ld(a.Ba,c));e=a.Aa?ld(a.Aa,e):[];return c.concat(e)};function md(){this.Z=[]}function nd(a){var b=new md;b.De(a);return b}
md.prototype={l:function(){var a=new md;a.De(this.Z.map(function(a){return a.l()}));return a},Yf:function(a){var b=new hd(this.l().Z);a=new hd(a.l().Z);kd(b,a);kd(a,b);a.Y();kd(a,b);a.Y();id(b,jd(a));return nd(jd(b))},wa:function(a){var b=new hd(this.l().Z);a=new hd(a.l().Z);b.Y();kd(b,a);kd(a,b);a.Y();kd(a,b);a.Y();id(b,jd(a));b.Y();return nd(jd(b))},vf:function(a){var b=new hd(this.l().Z);a=new hd(a.l().Z);b.Y();kd(a,b);a.Y();kd(b,a);kd(a,b);id(b,jd(a));b.Y();return nd(jd(b))},inverse:function(){var a=
this.l();a.Z.map(function(a){a.vc()});return a},De:ca("Z")};function od(){}function pd(a){for(var b=a.h.count,c=[],e=0,e=0;e<b;e+=3){var d=a.h.get(e),f=a.h.get(e+1),g=a.h.get(e+2),h=a.o.get(e),l=a.o.get(e+1),j=a.o.get(e+2),k=a.z;a.qa&&0<a.qa.length&&(k=a.qa.get(e));var m=[];m.push(new dd(d,h));m.push(new dd(f,l));m.push(new dd(g,j));c.push(new fd(m,k))}return nd(c)}
function qd(a,b){(b==t||!(b instanceof md))&&n(Error("Invalid CSG object."));var c=new ec,e=[];Eb(b.Z,function(a){var b=[],g=a.Ee,b=Eb(a.Lb,function(a){a.color=g;return c.add(a)});for(a=a=2;a<b.length;a++)e.push([b[0],b[a-1],b[a]])}.bind(a));a.Vh=Eb(c.unique(),function(a){return[a.Wa.x(),a.Wa.y(),a.Wa.d()]});a.Uh=Eb(c.unique(),function(a){return[a.va.x(),a.va.y(),a.va.d()]});a.Th=Eb(c.unique(),function(a){return!a.color?t:[a.color[0],a.color[1],a.color[2]]});a.h=new W(9*e.length);a.o=new W(9*e.length);
a.qa=new W(9*e.length);Eb(e,function(a){var b=a[0],c=a[1];a=a[2];var e=this.Vh,l=this.Uh,j=this.Th;this.h.add(e[b][0],e[b][1],e[b][2]);this.h.add(e[c][0],e[c][1],e[c][2]);this.h.add(e[a][0],e[a][1],e[a][2]);this.o.add(l[b][0],l[b][1],l[b][2]);this.o.add(l[c][0],l[c][1],l[c][2]);this.o.add(l[a][0],l[a][1],l[a][2]);j[b]&&this.qa.add(j[b][0],j[b][1],j[b][2]);j[c]&&this.qa.add(j[c][0],j[c][1],j[c][2]);j[a]&&this.qa.add(j[a][0],j[a][1],j[a][2])}.bind(a));0==a.qa.C&&(a.qa=t);a.Ia=Rc}
od.prototype.Yf=function(a){(a==t||!(a instanceof md)&&!(a instanceof Y))&&n(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;ya(a,new od);qd(a,pd(this).Yf(b));return a};od.prototype.wa=function(a){(a==t||!(a instanceof md)&&!(a instanceof Y))&&n(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;ya(a,new od);qd(a,pd(this).wa(b));return a};
od.prototype.vf=function(a){(a==t||!(a instanceof md)&&!(a instanceof Y))&&n(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;ya(a,new od);qd(a,pd(this).vf(b));return a};od.prototype.inverse=function(){var a=new Y;ya(a,new od);qd(a,pd(this).inverse());return a};A("X.constructable",od);A("X.constructable.prototype.intersect",od.prototype.vf);A("X.constructable.prototype.inverse",od.prototype.inverse);A("X.constructable.prototype.subtract",od.prototype.wa);
A("X.constructable.prototype.union",od.prototype.Yf);function rd(a){Lb.call(this,a);this.g="event"}C(rd,Lb);var sd=cc("pan"),td=cc("rotate"),ud=cc("zoom"),vd=cc("scroll");cc("render");var wd=cc("resetview"),xd=cc("windowlevel"),yd=cc("modified"),zd=cc("remove"),Ad=cc("progress"),Bd=cc("hover"),Cd=cc("hover_end"),Dd=cc("computing"),Ed=cc("computing_end"),Fd=cc("computing_progress");function Gd(){rd.call(this,xd);this.Re=this.cf=0}C(Gd,rd);function Hd(){rd.call(this,sd);this.ya=new D.m(0,0,0)}C(Hd,rd);
function Id(){rd.call(this,td);this.ya=new D.m(0,0,0)}C(Id,rd);function Jd(){rd.call(this,ud);this.jb=this.wb=u}C(Jd,rd);function Kd(){rd.call(this,vd);this.V=u}C(Kd,rd);function Ld(){rd.call(this,Bd);this.he=this.ge=0}C(Ld,rd);function Md(){rd.call(this,Cd)}C(Md,rd);function Nd(){rd.call(this,wd)}C(Nd,rd);function Vc(){rd.call(this,yd);this.v=this.D=t}C(Vc,rd);function Wc(){rd.call(this,zd);this.v=this.D=t}C(Wc,rd);function Od(){rd.call(this,Ad);this.Ad=0}C(Od,rd);
function Pd(){rd.call(this,Dd);this.D=t}C(Pd,rd);function Qd(){rd.call(this,Fd);this.Ad=0}C(Qd,rd);function Rd(){rd.call(this,Ed);this.D=t}C(Rd,rd);A("X.event.events.PAN",sd);A("X.event.events.ROTATE",td);A("X.event.events.ZOOM",ud);A("X.event.events.SCROLL",vd);function Sd(){M.call(this);this.g="parser";this.K=t;this.C=0;this.Zh=0<(new Int8Array((new Int16Array([1])).buffer))[0];this.Mc=q;this.sl=-Infinity;this.rl=Infinity}C(Sd,M);Sd.prototype.parse=function(){n(Error("The function parse() should be overloaded."))};function Td(a){for(var b=Infinity,c=-Infinity,e=a.length,d=0,d=0;d<e;d++)if(!isNaN(a[d]))var f=a[d],b=Math.min(b,f),c=Math.max(c,f);return[b,c]}
function Ud(a,b,c){b===p&&(b=0);c===p&&(c=a.length);for(var e="",d=0,d=b;d<c;++d)e+=String.fromCharCode(a[d]);return e}
function Z(a,b,c){c!=t||(c=1);var e=1,d=Uint8Array;switch(b){case "schar":d=Int8Array;break;case "ushort":d=Uint16Array;e=2;break;case "sshort":d=Int16Array;e=2;break;case "uint":d=Uint32Array;e=4;break;case "sint":d=Int32Array;e=4;break;case "float":d=Float32Array;e=4;break;case "complex":d=Float64Array;e=8;break;case "double":d=Float64Array,e=8}b=new d(a.K.slice(a.C,a.C+=c*e));if(a.Zh!=a.Mc){a=b;b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(d=0;d<a.byteLength;d+=e)for(var f=d+e-1,g=d;f>
g;f--,g++){var h=b[g];b[g]=b[f];b[f]=h}b=a}return 1==c?b[0]:b}
function Vd(a,b){var c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],e=zc(0,0,0,1),d=yc();Lc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=zc(0,0,b[2]-1,1);Lc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=zc(0,b[1]-
1,0,1);Lc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=zc(b[0]-1,0,0,1);Lc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=zc(b[0]-1,b[1]-1,0,1);Lc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];
c[5]=d[2]>c[5]?d[2]:c[5];e=zc(b[0]-1,0,b[2]-1,1);Lc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=zc(0,b[1]-1,b[2]-1,1);Lc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=zc(b[0]-1,b[1]-1,b[2]-1,1);Lc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:
c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];return c}
function Wd(a,b){var c=Bc();if(!(a.length==b.length&&a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2])){var e=Math.acos(a[2]),d=vc(),f=a[0],g=a[1],h=a[2],l=b[0],j=b[1],k=b[2];d[0]=g*k-h*j;d[1]=h*l-f*k;d[2]=f*j-g*l;xc(d,d);f=Math.cos(e/2);g=Math.sin(e/2)*d[0];h=Math.sin(e/2)*d[1];e=Math.sin(e/2)*d[2];T(c,0,f*f+g*g-h*h-e*e,2*(g*h-f*e),2*(g*e+f*h),0);T(c,1,2*(g*h+f*e),f*f+h*h-g*g-e*e,2*(h*e-f*g),0);T(c,2,2*(g*e-f*h),2*(h*e+f*g),f*f+e*e-h*h-g*g,0)}e=Ac();Jc(c,e);return[c,e]}
function Xd(a,b,c,e,d,f,g,h,l){var j=new Yd;xc(c,c);for(var k=[],m=[],r=0;6>r;r++)for(var s=Math.floor(r/2),y=(s+1)%3,z=(s+2)%3,G=(4+2*s)%6,F=0;2>F;F++){var H=(2+F+2*s)%6,B=-(c[s]*(d[r]-a[s])+c[y]*(d[H]-a[y]))/c[z]+a[z];if(B>=d[G]&&B<=d[G+1]||B<=d[G]&&B>=d[G+1]){var E=[];E[s]=d[r];E[y]=d[H];E[z]=B;k.push(E)}else E=[],E[s]=d[r],E[y]=d[H],E[z]=B,m.push(E)}a=wc(0,0,1);a=Wd(c,a);d=a[0];a=a[1];s=[];for(m=0;m<k.length;++m)r=zc(k[m][0],k[m][1],k[m][2],1),y=yc(),Lc(d,r,y),s.push([y[0],y[1],y[2]]);d=wc(1,
0,0);k=vc();Kc(a,d,k);m=wc(0,1,0);d=vc();Kc(a,m,d);r=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];for(m=m=0;m<s.length;++m)s[m][0]<r[0]&&(r[0]=s[m][0]),s[m][0]>r[1]&&(r[1]=s[m][0]),s[m][1]<r[2]&&(r[2]=s[m][1]),s[m][1]>r[3]&&(r[3]=s[m][1]),s[m][2]<r[4]&&(r[4]=s[m][2]),s[m][2]>r[5]&&(r[5]=s[m][2]);m=zc(r[0]+(r[1]-r[0])/2,r[2]+(r[3]-r[2])/2,r[4]+(r[5]-r[4])/2,0);s=yc();Ic(a,m,s);y=Math.floor(r[0]);z=Math.ceil(r[1]);y==z&&z++;G=z-y;F=Math.floor(r[2]);
H=Math.ceil(r[3]);F==H&&H++;B=H-F;E=b[0];b=b[1];var m=Math.ceil(G/E),I=Math.ceil(B/b),N=new Uint8Array(4*m*I),Q=new Pc;Q.Xe=m;Q.We=I;var I=yc(),R=zc(0,0,r[4],1),O=Ac();Ic(g.Qh,a,O);for(var ea=H-1E-7,J=z-1E-7,aa=0,da=0,U=0,V=F,V=F;V<=ea;V+=b){U++;da=0;R[1]=V;for(m=y;m<=J;m+=E){da++;R[0]=m;Lc(O,R,I);var Ga=4*aa,rb=Math.floor(I[2]),sb=Math.floor(I[1]),tb=Math.floor(I[0]);if(0<=tb&&tb<g.da[0]&&0<=sb&&sb<g.da[1]&&0<=rb&&rb<g.da[2]){var jb=f[rb][sb][tb],Uc=tb=sb=rb=0;l?((jb=l.get(jb))||(jb=[0,0.61,0,0,
1]),rb=255*jb[1],sb=255*jb[2],tb=255*jb[3],Uc=255*jb[4]):(rb=sb=tb=255*((jb-g.ra)/(g.ka-g.ra)),Uc=255);N[Ga]=rb;N[++Ga]=sb;N[++Ga]=tb;N[++Ga]=Uc}else N[Ga]=0,N[++Ga]=0,N[++Ga]=0,N[++Ga]=0;aa++}}Q.Wb=N;j.H=Q;j.ei=r;j.Sh=a;j.Rh=O;j.Yh=F;j.pl=H;j.di=y;j.ul=z;j.kg=da;j.jg=U;j.Vc=E;j.L=G;j.Gc=b;j.A=B;j.u=[s[0],s[1],s[2]];j.hc=[c[0],c[1],c[2]];j.Oc=[k[0],k[1],k[2]];j.V=[d[0],d[1],d[2]];j.O=u;j.zb=g;j.Cb=g.zb!=t&&!h?u:q;j.ec=e;j.Hb();j.O=u;return j}
function Zd(a,b,c,e){var d;d=e.oa;for(var f=[],g=[],h=0;6>h;h++){var l=Math.floor(h/2),j=(l+1)%3,k=(l+2)%3,m=(2+2*l)%6,r=(4+2*l)%6,s=(d[h]-b[l])*(1/c[l]);if(Infinity!=s&&-Infinity!=s){var y=b[j]+c[j]*s,s=b[k]+c[k]*s;y>=d[m]&&y<=d[m+1]&&s>=d[r]&&s<=d[r+1]?(m=[],m[l]=d[h],m[j]=y,m[k]=s,f.push(m)):(m=[],m[l]=d[h],m[j]=y,m[k]=s,g.push(m))}}d=[f,g];b=d[0];e.b[a].k=d;d=oc(new S(b[0][0],b[0][1],b[0][2]),new S(b[1][0],b[1][1],b[1][2]));e.b[a].ol=d;f=wc(0,0,1);g=Wd(c,f)[0];h=zc(e.ad[0],e.ad[1],e.ad[2],0);
f=yc();Lc(g,h,f);g=yc();h=f[2];g[0]=c[0]*h;g[1]=c[1]*h;g[2]=c[2]*h;g[3]=c[3]*h;0.1>Math.abs(f[0])&&(f[0]=0.1);0.1>Math.abs(f[1])&&(f[1]=0.1);f[0]/=e.be;f[1]/=e.be;e.b[a].Ga=[Math.abs(f[0]),Math.abs(f[1])];e.b[a].Sc=f[2];e.b[a].B=g;d=Math.floor(Math.abs(d/f[2]));e.ud[a]=d+1;e.b[a].p=d+1;e.b[a].k[0][0][0]>e.b[a].k[0][1][0]?0<g[0]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][0]<e.b[a].k[0][1][0]?0>g[0]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=
d):e.b[a].k[0][0][1]>e.b[a].k[0][1][1]?0<g[1]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][1]<e.b[a].k[0][1][1]?0>g[1]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][2]>e.b[a].k[0][1][2]?0<g[2]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][2]<e.b[a].k[0][1][2]&&0>g[2]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d);e.b[a].Ue=-(c[0]*b[0][0]+c[1]*b[0][1]+c[2]*b[0][2])}
function $d(a,b){var c;c=b.K;for(var e=b.da,d=b.ka,f=b.ra,g=Array(e[2]),h=Array(e[2]),l=e[1]*e[0],j=0,k=0,m=0,r=0,s=0,r=0;r<e[2];r++){var y=c.subarray(r*l,(r+1)*l),s=0;h[r]=Array(e[1]);g[r]=Array(e[1]);for(m=0;m<e[1];m++){h[r][m]=new c.constructor(e[0]);g[r][m]=new c.constructor(e[0]);for(k=0;k<e[0];k++)j=y[s],h[r][m][k]=255*((j-f)/(d-f)),g[r][m][k]=j,s++}}c=[g,h];b.$=c[0];b.cg=c[1];D.Ja(a.g+".reslice");b.M=b.e!=t;b.xa&&(b.cd=b.xa.Ka);b.Tl=[0,0,0];b.s=[b.Ea[0]+(b.ib[0]-1)/2,b.Ea[1]+(b.ib[1]-1)/2,
b.Ea[2]+(b.ib[2]-1)/2];b.oa=[Math.min(b.Ea[0],b.Ea[0]+b.ib[0]-1),Math.max(b.Ea[0],b.Ea[0]+b.ib[0]-1),Math.min(b.Ea[1],b.Ea[1]+b.ib[1]-1),Math.max(b.Ea[1],b.Ea[1]+b.ib[1]-1),Math.min(b.Ea[2],b.Ea[2]+b.ib[2]-1),Math.max(b.Ea[2],b.Ea[2]+b.ib[2]-1)];b.b=[{},{},{}];c=wc(b.s[0],b.s[1],b.s[2]);b.b[0].vd=c;e=wc(1,0,0);xc(e,e);b.b[0].i=e;d=[1,0,0];b.b[0].z=d;Zd(0,c,e,b);b.c[0].c=Array(b.b[0].p);c[0]=b.b[0].k[0][0][0]+b.b[0].B[0]*Math.floor(b.b[0].p/2);c[1]=b.b[0].k[0][0][1]+b.b[0].B[1]*Math.floor(b.b[0].p/
2);c[2]=b.b[0].k[0][0][2]+b.b[0].B[2]*Math.floor(b.b[0].p/2);c=Xd(c,b.b[0].Ga,b.b[0].i,b.b[0].z,b.oa,b.$,b,b.M,b.cd);b.M&&(c.e=b.e.c[0].c[Math.floor(b.b[0].p/2)].H);b.c[0].c[Math.floor(b.b[0].p/2)]=c;b.Db=Math.floor(b.b[0].p/2);b.Hc=Math.floor(b.b[0].p/2);c=wc(b.s[0],b.s[1],b.s[2]);b.b[1].vd=c;e=wc(0,1,0);xc(e,e);b.b[1].i=e;d=[0,1,0];b.b[1].z=d;Zd(1,c,e,b);b.c[1].c=Array(b.b[1].p);c[0]=b.b[1].k[0][0][0]+b.b[1].B[0]*Math.floor(b.b[1].p/2);c[1]=b.b[1].k[0][0][1]+b.b[1].B[1]*Math.floor(b.b[1].p/2);c[2]=
b.b[1].k[0][0][2]+b.b[1].B[2]*Math.floor(b.b[1].p/2);c=Xd(c,b.b[1].Ga,b.b[1].i,b.b[1].z,b.oa,b.$,b,b.M,b.cd);b.M&&(c.e=b.e.c[1].c[Math.floor(b.b[1].p/2)].H);b.c[1].c[Math.floor(b.b[1].p/2)]=c;b.Eb=Math.floor(b.b[1].p/2);b.Ic=Math.floor(b.b[1].p/2);c=wc(b.s[0],b.s[1],b.s[2]);b.b[2].vd=c;e=wc(0,0,1);xc(e,e);b.b[2].i=e;d=[0,0.392,0.804];b.b[2].z=d;Zd(2,c,e,b);b.c[2].c=Array(b.b[2].p);c[0]=b.b[2].k[0][0][0]+b.b[2].B[0]*Math.floor(b.b[2].p/2);c[1]=b.b[2].k[0][0][1]+b.b[2].B[1]*Math.floor(b.b[2].p/2);c[2]=
b.b[2].k[0][0][2]+b.b[2].B[2]*Math.floor(b.b[2].p/2);c=Xd(c,b.b[2].Ga,b.b[2].i,b.b[2].z,b.oa,b.$,b,b.M,b.cd);b.M&&(c.e=b.e.c[2].c[Math.floor(b.b[2].p/2)].H);b.c[2].c[Math.floor(b.b[2].p/2)]=c;b.Fb=Math.floor(b.b[2].p/2);b.Jc=Math.floor(b.b[2].p/2);D.Da(a.g+".reslice");return b.$};function ae(){Sd.call(this);this.g="parserLBL"}C(ae,Sd);
ae.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");var e=b.Nc,d=e.length;0==d&&n(Error("No _pointIndices defined on the X.object."));this.K=c;var f=[],g=Z(this,"uchar",c.byteLength),h=g.length,l=u,j=0;for(c=1;c<h;c++)10==g[c-1]?(j=c,l=q):l&&32==g[c]&&(f.push(parseInt(Ud(g,j,c),10)),l=u);g=b.G.F?b.G.F:new Float32Array(d);h=f.length;for(c=0;c<h;c++)g[f[c]]=1;f=new Float32Array(3*d);for(c=h=0;c<d;c++)l=e[c],l>d&&n(Error("Could not find scalar for vertex.")),l=g[l],f[h++]=l,f[h++]=l,f[h++]=l;b.G.F=
g;b.G.dd=f;b.G.j=q;D.Da(this.g+".parse");e=new Vc;e.D=b;e.v=a;this.dispatchEvent(e)};A("X.parserLBL",ae);A("X.parserLBL.prototype.parse",ae.prototype.parse);var be;function ce(a,b){var c;c=a.className;c=na(c)&&c.match(/\S+/g)||[];for(var e=Hb(arguments,1),d=c.length+e.length,f=c,g=0;g<e.length;g++)0<=Cb(f,e[g])||f.push(e[g]);a.className=c.join(" ");return c.length==d};function de(a,b){this.width=a;this.height=b}w=de.prototype;w.l=function(){return new de(this.width,this.height)};w.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};w.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};w.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};w.scale=function(a,b){var c=x(b)?b:a;this.width*=a;this.height*=c;return this};var ee=!K||K&&9<=yb;!db&&!K||K&&K&&9<=yb||db&&wb("1.9.1");K&&wb("9");function fe(a,b){this.x=ja(a)?a:0;this.y=ja(b)?b:0}w=fe.prototype;w.l=function(){return new fe(this.x,this.y)};function ge(a,b){return new fe(a.x-b.x,a.y-b.y)}w.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};w.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};w.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};
w.translate=function(a,b){a instanceof fe?(this.x+=a.x,this.y+=a.y):(this.x+=a,x(b)&&(this.y+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.x*=a;this.y*=c;return this};function he(a){return a?new ie(je(a)):be||(be=new ie)}function ke(a){return na(a)?document.getElementById(a):a}var le={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function me(a,b,c){return ne(document,arguments)}
function ne(a,b){var c=b[0],e=b[1];if(!ee&&e&&(e.name||e.type)){c=["<",c];e.name&&c.push(' name="',La(e.name),'"');if(e.type){c.push(' type="',La(e.type),'"');var d={};Ka(d,e);delete d.type;e=d}c.push(">");c=c.join("")}var f=a.createElement(c);e&&(na(e)?f.className=e:ka(e)?ce.apply(t,[f].concat(e)):Ha(e,function(a,b){"style"==b?f.style.cssText=a:"class"==b?f.className=a:"for"==b?f.htmlFor=a:b in le?f.setAttribute(le[b],a):0==b.lastIndexOf("aria-",0)||0==b.lastIndexOf("data-",0)?f.setAttribute(b,a):
f[b]=a}));if(2<b.length){e=function(b){b&&f.appendChild(na(b)?a.createTextNode(b):b)};for(c=2;c<b.length;c++){var g=b[c];if(ma(g)&&!(pa(g)&&0<g.nodeType)){var d=Db,h;a:{if((h=g)&&"number"==typeof h.length){if(pa(h)){h="function"==typeof h.item||"string"==typeof h.item;break a}if(oa(h)){h="function"==typeof h.item;break a}}h=u}if(h)if(h=g.length,0<h){for(var l=Array(h),j=0;j<h;j++)l[j]=g[j];g=l}else g=[];d(g,e)}else e(g)}}return f}function oe(a){return"CSS1Compat"==a.compatMode}
function pe(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function qe(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}function re(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 je(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function ie(a){this.ma=a||ga.document||document}w=ie.prototype;w.oe=he;
w.t=function(a){return na(a)?this.ma.getElementById(a):a};w.Lh=ie.prototype.t;w.Wc=function(a,b,c){return ne(this.ma,arguments)};w.createElement=function(a){return this.ma.createElement(a)};w.createTextNode=function(a){return this.ma.createTextNode(String(a))};function se(a){return oe(a.ma)}
function te(a){var b=a.ma;a=!eb&&oe(b)?b.documentElement:b.body;b=b.parentWindow||b.defaultView;return K&&wb("10")&&b.pageYOffset!=a.scrollTop?new fe(a.scrollLeft,a.scrollTop):new fe(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}w.appendChild=function(a,b){a.appendChild(b)};w.contains=re;function ue(a,b,c,e){this.top=a;this.right=b;this.bottom=c;this.left=e}w=ue.prototype;w.l=function(){return new ue(this.top,this.right,this.bottom,this.left)};w.contains=function(a){return!this||!a?u:a instanceof ue?a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom:a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom};
w.ceil=function(){this.top=Math.ceil(this.top);this.right=Math.ceil(this.right);this.bottom=Math.ceil(this.bottom);this.left=Math.ceil(this.left);return this};w.floor=function(){this.top=Math.floor(this.top);this.right=Math.floor(this.right);this.bottom=Math.floor(this.bottom);this.left=Math.floor(this.left);return this};w.round=function(){this.top=Math.round(this.top);this.right=Math.round(this.right);this.bottom=Math.round(this.bottom);this.left=Math.round(this.left);return this};
w.translate=function(a,b){a instanceof fe?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(this.left+=a,this.right+=a,x(b)&&(this.top+=b,this.bottom+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.left*=a;this.right*=a;this.top*=c;this.bottom*=c;return this};function ve(a,b,c,e){this.left=a;this.top=b;this.width=c;this.height=e}w=ve.prototype;w.l=function(){return new ve(this.left,this.top,this.width,this.height)};w.Ug=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 e=Math.max(this.top,a.top);a=Math.min(this.top+this.height,a.top+a.height);if(e<=a)return this.left=b,this.top=e,this.width=c-b,this.height=a-e,q}return u};
w.contains=function(a){return a instanceof ve?this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height:a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height};function we(a,b){var c=b.x<a.left?a.left-b.x:Math.max(b.x-(a.left+a.width),0),e=b.y<a.top?a.top-b.y:Math.max(b.y-(a.top+a.height),0);return c*c+e*e}w.rf=function(a){return Math.sqrt(we(this,a))};
w.ceil=function(){this.left=Math.ceil(this.left);this.top=Math.ceil(this.top);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};w.floor=function(){this.left=Math.floor(this.left);this.top=Math.floor(this.top);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};w.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
w.translate=function(a,b){a instanceof fe?(this.left+=a.x,this.top+=a.y):(this.left+=a,x(b)&&(this.top+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.left*=a;this.width*=a;this.top*=c;this.height*=c;return this};function xe(a,b){var c=je(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,t))?c[b]||c.getPropertyValue(b)||"":""}function ye(a,b){return xe(a,b)||(a.currentStyle?a.currentStyle[b]:t)||a.style&&a.style[b]}function ze(a){a=a?je(a):document;return K&&!(K&&9<=yb)&&!se(he(a))?a.body:a.documentElement}
function Ae(a){var b=a.getBoundingClientRect();K&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function Be(a){if(K&&!(K&&8<=yb))return a.offsetParent;var b=je(a),c=ye(a,"position"),e="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=ye(a,"position"),e=e&&"static"==c&&a!=b.documentElement&&a!=b.body,!e&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return t}
function Ce(a){for(var b=new ue(0,Infinity,Infinity,0),c=he(a),e=c.ma.body,d=c.ma.documentElement,f=!eb&&oe(c.ma)?c.ma.documentElement:c.ma.body;a=Be(a);)if((!K||0!=a.clientWidth)&&(!eb||0!=a.clientHeight||a!=e)&&a!=e&&a!=d&&"visible"!=ye(a,"overflow")){var g=De(a),h;h=a;if(db&&!wb("1.9")){var l=parseFloat(xe(h,"borderLeftWidth"));if(Ee(h))var j=h.offsetWidth-h.clientWidth-l-parseFloat(xe(h,"borderRightWidth")),l=l+j;h=new fe(l,parseFloat(xe(h,"borderTopWidth")))}else h=new fe(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)}e=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,e);b.top=Math.max(b.top,f);c=(c.ma.parentWindow||c.ma.defaultView||window).document;c=oe(c)?c.documentElement:c.body;c=new de(c.clientWidth,c.clientHeight);b.right=Math.min(b.right,e+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&b.bottom>b.top&&b.right>b.left?
b:t}
function De(a){var b,c=je(a),e=ye(a,"position"),d=db&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==e&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new fe(0,0),g=ze(c);if(a==g)return f;if(a.getBoundingClientRect)b=Ae(a),a=te(he(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!d)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(eb&&"fixed"==ye(b,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(bb||eb&&"absolute"==e)f.y-=c.body.offsetTop;for(b=a;(b=Be(b))&&b!=c.body&&b!=g;)if(f.x-=b.scrollLeft,!bb||"TR"!=b.tagName)f.y-=b.scrollTop}return f}
function Fe(a){var b=new fe;if(1==a.nodeType){if(a.getBoundingClientRect){var c=Ae(a);b.x=c.left;b.y=c.top}else{var c=te(he(a)),e=De(a);b.x=e.x-c.x;b.y=e.y-c.y}if(db&&!wb(12)){var d;K?d="-ms-transform":eb?d="-webkit-transform":bb?d="-o-transform":db&&(d="-moz-transform");var f;d&&(f=ye(a,d));f||(f=ye(a,"transform"));f?(a=f.match(Ge),a=!a?new fe(0,0):new fe(parseFloat(a[1]),parseFloat(a[2]))):a=new fe(0,0);b=new fe(b.x+a.x,b.y+a.y)}}else d=oa(a.Gi),f=a,a.targetTouches?f=a.targetTouches[0]:d&&a.tb.targetTouches&&
(f=a.tb.targetTouches[0]),b.x=f.clientX,b.y=f.clientY;return b}function He(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}function Ie(a){if("none"!=ye(a,"display"))return Je(a);var b=a.style,c=b.display,e=b.visibility,d=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=Je(a);b.display=c;b.position=d;b.visibility=e;return a}
function Je(a){var b=a.offsetWidth,c=a.offsetHeight,e=eb&&!b&&!c;return(!ja(b)||e)&&a.getBoundingClientRect?(a=Ae(a),new de(a.right-a.left,a.bottom-a.top)):new de(b,c)}function Ke(a,b){a.style.display=b?"":"none"}function Ee(a){return"rtl"==ye(a,"direction")}function Le(a,b){if(/^\d+px?$/.test(b))return parseInt(b,10);var c=a.style.left,e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b;var d=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=e;return d}
function Me(a,b){var c=a.currentStyle?a.currentStyle[b]:t;return c?Le(a,c):0}var Ne={thin:2,medium:4,thick:6};function Oe(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:t))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:t;return c in Ne?Ne[c]:Le(a,c)}var Ge=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;function Pe(a,b){dc.call(this);this.I=a;var c=pa(this.I)&&1==this.I.nodeType?this.I:this.I?this.I.body:t;this.aj=!!c&&Ee(c);this.Kl=L(this.I,db?"DOMMouseScroll":"mousewheel",this,b)}C(Pe,dc);
Pe.prototype.handleEvent=function(a){var b=0,c=0,e=0;a=a.tb;if("mousewheel"==a.type){c=1;if(K||eb&&(Wa||wb("532.0")))c=40;e=Qe(-a.wheelDelta,c);ja(a.wheelDeltaX)?(b=Qe(-a.wheelDeltaX,c),c=Qe(-a.wheelDeltaY,c)):c=e}else e=a.detail,100<e?e=3:-100>e&&(e=-3),ja(a.axis)&&a.axis===a.HORIZONTAL_AXIS?b=e:c=e;x(this.Zg)&&(b=Math.min(Math.max(b,-this.Zg),this.Zg));x(this.$g)&&(c=Math.min(Math.max(c,-this.$g),this.$g));this.aj&&(b=-b);b=new Re(e,a,b,c);this.dispatchEvent(b)};
function Qe(a,b){return eb&&(Va||Xa)&&0!=a%b?a:a/b}function Re(a,b,c,e){b&&this.Ca(b,p);this.type="mousewheel";this.detail=a;this.zl=c;this.Xc=e}C(Re,Nb);K||eb&&wb("525");function Se(a){M.call(this);this.g="interactor";this.Oa=a;this.Se=this.pg=this.og=this.qg=this.ng=this.rg=t;this.Yd=q;this.Xb=this.Qb=this.xb=u;this.ua=[0,0];this.Ne=new D.m(0,0,0);this.gd=new D.m(0,0,0);this.Wg=0;this.yg=this.Wd=t;this.xg=u;this.R={MOUSEWHEEL_ENABLED:q,MOUSECLICKS_ENABLED:q,KEYBOARD_ENABLED:q,HOVERING_ENABLED:q,CONTEXTMENU_ENABLED:u,TOUCH_ENABLED:q,TOUCH_BOUNCING_ENABLED:u}}C(Se,M);Se.prototype.__defineGetter__("config",v("R"));Se.prototype.__defineGetter__("leftButtonDown",v("xb"));
Se.prototype.__defineGetter__("middleButtonDown",v("Qb"));Se.prototype.__defineGetter__("rightButtonDown",v("Xb"));
Se.prototype.Ca=function(){this.R.MOUSEWHEEL_ENABLED?(this.Se=new Pe(this.Oa),this.rg=L(this.Se,"mousewheel",this.Kd.bind(this))):(Wb(this.rg),this.Se=t);this.R.MOUSECLICKS_ENABLED?(this.ng=L(this.Oa,"mousedown",this.vj.bind(this)),this.qg=L(this.Oa,"mouseup",this.Aj.bind(this))):(Wb(this.ng),Wb(this.qg));this.Oa.oncontextmenu=this.R.CONTEXTMENU_ENABLED?t:function(){return u};window.onkeydown=this.R.KEYBOARD_ENABLED?this.ih.bind(this):t;this.R.TOUCH_ENABLED?(this.R.TOUCH_BOUNCING_ENABLED||document.body.addEventListener("touchmove",
function(a){a.preventDefault()},u),this.ci=L(this.Oa,"touchstart",this.Pj.bind(this)),this.bi=L(this.Oa,"touchmove",this.Nj.bind(this)),this.ai=L(this.Oa,"touchend",this.Jj.bind(this))):(Wb(this.ci),Wb(this.bi),Wb(this.ai));Wb(this.og);Wb(this.pg);this.og=L(this.Oa,"mousemove",this.xj.bind(this));this.pg=L(this.Oa,"mouseout",this.yj.bind(this))};
Se.prototype.vj=function(a){0==a.button?this.xb=q:1==a.button?this.Qb=q:2==a.button&&(this.Xb=q);eval("this.onMouseDown("+this.xb+","+this.Qb+","+this.Xb+")");Te(this);a.preventDefault()};Se.prototype.uj=ba();Se.prototype.Aj=function(a){0==a.button?this.xb=u:1==a.button?this.Qb=u:2==a.button&&(this.Xb=u);eval("this.onMouseUp("+this.xb+","+this.Qb+","+this.Xb+")");Te(this);a.preventDefault()};Se.prototype.__defineGetter__("mousePosition",v("ua"));w=Se.prototype;w.zj=ba();
w.yj=function(a){this.Yd=u;this.R.KEYBOARD_ENABLED&&(window.onkeydown=t);this.Xb=this.Qb=this.xb=u;Te(this);this.Ne=new D.m(0,0,0);a.preventDefault()};w.wj=ba();w.Pj=function(a){a.preventDefault();a.Ca(a.tb.targetTouches[0],a.currentTarget);eval("this.onTouchStart("+a.clientX+","+a.clientY+")");this.gd=new D.m(a.clientX,a.clientY,0);this.yg=setTimeout(this.Lj.bind(this,a),500)};w.Oj=ba();
w.Lj=function(a){eval("this.onTouchHover("+a.clientX+","+a.clientY+")");a=new Jd;a.wb=q;a.jb=this instanceof Ue;this.dispatchEvent(a);this.ce=q};w.Kj=ba();function Ve(a){clearTimeout(a.yg);if(a.ce){var b=new Jd;b.wb=u;b.jb=a instanceof Ue;a.dispatchEvent(b)}a.ce=u}w.Jj=function(a){a.preventDefault();eval("this.onTouchEnd()");Ve(this)};w.Ij=ba();
w.Nj=function(a){a.preventDefault();this.ce||Ve(this);this.touchmoveEvent=a=a.tb;eval("this.onTouchMove(this['touchmoveEvent'])");var b=a.targetTouches;if(1==b.length){a=b[0];var c=[a.clientX,a.clientY];a=new D.m(c[0],c[1],0);var b=c[0]>3*this.Oa.clientWidth/4,e=c[0]<this.Oa.clientWidth/4,d=c[1]<this.Oa.clientHeight/4,c=c[1]>3*this.Oa.clientHeight/4,c=!b&&!e&&!d&&!c,d=this.gd.wa(a);this.gd=a.l();if(this.ce)a=new Hd,5<d.x?d.x=1:-5>d.x&&(d.x=-1),5<d.y?d.y=1:-5>d.y&&(d.y=-1),a.ya=d,this.dispatchEvent(a);
else if(this instanceof We&&(b||e))a=new Kd,a.V=0>d.y,this.dispatchEvent(a);else if(this instanceof Ue||c)d.scale(3),a=new Id,a.ya=d,this.dispatchEvent(a)}else 2==b.length&&(a=b[0],b=b[1],a=[a.clientX,a.clientY],b=[b.clientX,b.clientY],a=new D.m(a[0],a[1],0),b=new D.m(b[0],b[1],0),d=pc(a,b),b=d-this.Wg,this.Wg=d,this.gd.wa(a),this.gd=a.l(),10<Math.abs(b)&&(a=new Jd,a.wb=0<b,a.jb=this instanceof Ue,this.dispatchEvent(a)))};w.Mj=ba();
w.xj=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.Yd=q;this.R.KEYBOARD_ENABLED&&window.onkeydown==t&&(window.onkeydown=this.ih.bind(this));a.preventDefault();var b=a.shiftKey;this.xg=b;this.ua=[a.offsetX,a.offsetY];var c=new D.m(this.ua[0],this.ua[1],0);a=this.Ne.wa(c);this.Ne=c.l();this.R.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.Qb||this.xb||this.Xb)&&Te(this),this.Wd=setTimeout(function(){Te(this);var a=new Ld;a.ge=c.x;a.he=c.y;this.dispatchEvent(a);
this.Wd=t}.bind(this),300));0!=a.Jb()&&(this.xb&&!b?(b=new Id,a.scale(3),b.ya=a,this.dispatchEvent(b)):this.Qb||this.xb&&b?(b=new Hd,b.ya=a,this.dispatchEvent(b)):this.Xb&&(b=new Jd,b.wb=0<a.y,b.jb=u,this.dispatchEvent(b)))};function Te(a){a.Wd&&clearTimeout(a.Wd);a.dispatchEvent(new Md)}w.Bj=ba();w.Kd=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");Te(this);a.preventDefault()};w.sj=ba();
w.ih=function(a){if(this.Yd){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");Te(this);var b=a.altKey,c=a.ctrlKey,e=a.metaKey,d=a.shiftKey,f=a.keyCode;82==f&&!b&&!c&&!e&&!d?(a.preventDefault(),a=new Nd,this.dispatchEvent(a)):37<=f&&40>=f&&(a.preventDefault(),d?a=new Hd:b?a=new Jd:(a=new Id,this instanceof We&&(a=new Kd)),a&&(c=new D.m(0,0,0),37==f?(c.x=5,a.V=u,b&&(a.V=q,a.wb=q,a.jb=u)):39==f?(c.x=-5,a.V=q,b&&(a.wb=u,a.jb=u)):38==f?(c.y=5,a.V=q,b&&(a.wb=q,a.jb=q)):40==f&&(c.y=-5,a.V=u,b&&(a.wb=
u,a.jb=q)),a.ya=c,this.dispatchEvent(a)))}};A("X.interactor",Se);A("X.interactor.prototype.init",Se.prototype.Ca);A("X.interactor.prototype.onMouseDown",Se.prototype.uj);A("X.interactor.prototype.onMouseUp",Se.prototype.zj);A("X.interactor.prototype.onMouseMove",Se.prototype.wj);A("X.interactor.prototype.onMouseWheel",Se.prototype.Bj);A("X.interactor.prototype.onKey",Se.prototype.sj);A("X.interactor.prototype.onTouchStart",Se.prototype.Oj);A("X.interactor.prototype.onTouchMove",Se.prototype.Mj);
A("X.interactor.prototype.onTouchEnd",Se.prototype.Ij);A("X.interactor.prototype.onTouchHover",Se.prototype.Kj);function We(a){Se.call(this,a);this.g="interactor2D"}C(We,Se);We.prototype.Kd=function(a){We.w.Kd.call(this,a);var b=new Kd;a.Xc==t&&(a.Xc=0);b.V=0>a.Xc;this.dispatchEvent(b)};function Yd(a){Y.call(this);this.g="slice";this.u=[0,0,0];this.hc=[0,0,1];this.V=[0,1,0];this.Oc=[1,0,0];this.A=this.L=10;this.oc=[0,1,0,0,1,1,1,1,1,0,0,0];this.e=this.zb=t;this.Cb=q;this.ec=[1,1,1];a!=t&&this.sc(a)}C(Yd,Y);Yd.prototype.sc=function(a){this.u=a.u.slice();this.hc=a.hc.slice();this.V=a.V.slice();this.L=a.L;this.A=a.A;this.zb=a.zb;this.e=a.e;this.Cb=a.Cb;this.ec=a.ec;this.Xh=a.Xh;Yd.w.sc.call(this,a)};Yd.prototype.__defineSetter__("height",ca("A"));
Yd.prototype.__defineSetter__("width",ca("L"));Yd.prototype.__defineGetter__("up",v("V"));Yd.prototype.__defineGetter__("right",v("Oc"));Yd.prototype.create=function(){this.Hb()};Yd.prototype.Ta=function(){Yd.w.Ta.call(this);this.u.length=0;this.hc.length=0;this.V.length=0;this.Oc.length=0;this.oc.length=0;this.e=this.zb=t;this.ec.length=0};
Yd.prototype.Hb=function(){var a=(new S(this.hc[0],this.hc[1],this.hc[2])).normalize(),b=new S(this.V[0],this.V[1],this.V[2]),c=new S(this.Oc[0],this.Oc[1],this.Oc[2]),e=new S(this.u[0],this.u[1],this.u[2]),d=qc(c.l().Y().scale(this.L/2),b.l().Y().scale(this.A/2)),f=new S(d.x+e.x,d.y+e.y,d.d+e.d),d=qc(c.l().Y().scale(this.L/2),b.l().scale(this.A/2)),g=new S(d.x+e.x,d.y+e.y,d.d+e.d),d=qc(c.l().scale(this.L/2),b.l().Y().scale(this.A/2)),h=new S(d.x+e.x,d.y+e.y,d.d+e.d),d=qc(c.l().scale(this.L/2),b.l().scale(this.A/
2)),b=new S(d.x+e.x,d.y+e.y,d.d+e.d);this.h=new W(18);this.o=new W(18);this.h.add(f.x,f.y,f.d);this.h.add(g.x,g.y,g.d);this.h.add(h.x,h.y,h.d);this.h.add(h.x,h.y,h.d);this.h.add(b.x,b.y,b.d);this.h.add(g.x,g.y,g.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.Cb&&(a=new Y,a.h=new W(24),a.o=new W(24),a.h.add(f.x,f.y,f.d),a.h.add(g.x,g.y,g.d),a.h.add(g.x,g.y,g.d),a.h.add(b.x,b.y,b.d),a.h.add(b.x,
b.y,b.d),a.h.add(h.x,h.y,h.d),a.h.add(h.x,h.y,h.d),a.h.add(f.x,f.y,f.d),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.z=[this.ec[0],this.ec[1],this.ec[2]],a.Ia="LINES",a.Lc=2,this.c.push(a))};A("X.slice",Yd);A("X.slice.prototype.create",Yd.prototype.create);A("X.slice.prototype.destroy",Yd.prototype.Ta);function P(a){Y.call(this);this.g="volume";this.u=[0,0,0];this.da=[10,10,10];this.oa=[1,1,1];this.ud=[10,10,10];this.rb=[1,1,1];this.kb=[];this.Jc=this.Fb=this.Ic=this.Eb=this.Hc=this.Db=0;this.lc=new Y;this.mc=new Y;this.nc=new Y;this.fe=this.Ra=u;this.X=-1;this.ee=[];this.e=t;this.Cb=q;this.ga=Infinity;this.fa=-Infinity;this.wg=q;this.be=1;this.ka=0;this.K=t;this.b=[];this.s=[0,0,0];this.ib=[0,0,0];this.ad=[0,0,0];this.$=[];this.cg=[];this.ab=t;ya(this,new gc);ya(this,new Sc);a!=t&&this.sc(a)}
C(P,Y);P.prototype.sc=function(a){this.u=a.u.slice();this.da=a.da.slice();this.rb=a.rb.slice();this.Db=a.Db;this.Hc=a.Hc;this.Eb=a.Eb;this.Ic=a.Ic;this.Fb=a.Fb;this.Jc=a.Jc;this.eg=a.eg.slice();this.lc=new Y(a.lc);this.mc=new Y(a.mc);this.nc=new Y(a.nc);this.ka=a.ka;this.K=a.K;this.Ra=a.Ra;this.fe=a.fe;this.X=a.X;this.e=a.e;this.Cb=a.Cb;P.w.sc.call(this,a)};
P.prototype.Hb=function(a){this.c.length=0;this.lc.c.length=0;this.mc.c.length=0;this.nc.c.length=0;this.c.push(this.lc);this.c.push(this.mc);this.c.push(this.nc);this.Ea=a.Bc;this.ad=a.Cc;this.ib=a.Ac;this.Dc=a.fb;this.Qh=a.hb;this.ka=a.max;this.K=a.data;this.j=q};
P.prototype.Ta=function(){P.w.Ta.call(this);this.kb.length=0;this.c.length=0;this.lc.c.length=0;this.lc.length=0;this.mc.c.length=0;this.mc.length=0;this.nc.c.length=0;this.nc.length=0;this.K=t;this.oa.length=0;this.b.length=0;this.s.length=0;this.ib.length=0;this.ad.length=0;this.$.length=0;this.cg.length=0;this.ab=t};
P.prototype.q=function(a){a="undefined"!==typeof a?a:q;if(0<this.c.length){this.Ra!=this.fe&&(!this.Ra&&-1!=this.X&&(this.c[this.X].visible=u),this.j=q,this.fe=this.Ra);if(!this.O)return;for(var b=0,b=0;3>b;b++){var c=this.c[b],e=0,d=0;0==b?(e=this.Db,d=this.Hc,this.Hc=this.Db):1==b?(e=this.Eb,d=this.Ic,this.Ic=this.Eb):2==b&&(e=this.Fb,d=this.Jc,this.Jc=this.Fb);if(this.c[b].c[parseInt(e,10)]==t){var f=vc();f[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*parseInt(e,10);f[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*
parseInt(e,10);f[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*parseInt(e,10);if(this.M){var g=Xd(f,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.e.$,this.e,this.e.M,this.e.xa.Ka);this.e.c[b].c[parseInt(e,10)]=g;this.e.c[b].q(q)}f=Xd(f,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.$,this,q,t);this.M&&(f.e=f.H,f.e=this.e.c[b].c[parseInt(e,10)].H);c.c[parseInt(e,10)]=f;this.c[b].q(q)}d=c.c[parseInt(d,10)];this.Ra||(d.visible=u);c=c.c[parseInt(e,10)];c.visible=q;c.za=1;this.Ra&&(c.c[0].O=u,b!=this.X&&
(c.visible=u,c.za=0))}this.Ra&&-1!=this.X&&Xe(this,this.X)}a&&P.w.q.call(this)};P.prototype.__defineGetter__("dimensions",v("da"));P.prototype.__defineSetter__("dimensions",ca("da"));P.prototype.__defineGetter__("spacing",v("rb"));P.prototype.__defineSetter__("spacing",ca("rb"));P.prototype.__defineGetter__("bbox",v("oa"));P.prototype.__defineGetter__("range",v("ud"));P.prototype.__defineGetter__("dimensionsRAS",v("eg"));P.prototype.__defineGetter__("volumeRendering",v("Ra"));
P.prototype.__defineSetter__("volumeRendering",function(a){this.Ra=a;this.q(u)});P.prototype.__defineGetter__("visible",v("O"));P.prototype.__defineSetter__("visible",function(a){if(a)this.O=a,this.q(u);else{for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e].visible=a;this.O=a;this.j=q}});P.prototype.__defineGetter__("center",v("u"));P.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center."));this.u=a});
P.prototype.__defineGetter__("volumeRenderingCache",v("ee"));P.prototype.__defineSetter__("volumeRenderingCache",function(a){(a==t||!ka(a)||!(3>=a.length))&&n(Error("Invalid volumeRederingCache."));this.ee=a});P.prototype.__defineGetter__("image",v("kb"));P.prototype.__defineGetter__("labelmap",function(){this.e||(this.e=new Ye(this));return this.e});P.prototype.__defineGetter__("indexX",v("Db"));P.prototype.__defineSetter__("indexX",function(a){x(a)&&(0<=a&&a<this.lc.c.length)&&(this.Db=a,this.q(u))});
P.prototype.__defineGetter__("indexY",v("Eb"));P.prototype.__defineSetter__("indexY",function(a){x(a)&&(0<=a&&a<this.mc.c.length)&&(this.Eb=a,this.q(u))});P.prototype.__defineGetter__("indexZ",v("Fb"));P.prototype.__defineSetter__("indexZ",function(a){x(a)&&(0<=a&&a<this.nc.c.length)&&(this.Fb=a,this.q(u))});P.prototype.__defineGetter__("windowLow",v("ga"));P.prototype.__defineSetter__("windowLow",ca("ga"));P.prototype.__defineGetter__("windowHigh",v("fa"));
P.prototype.__defineSetter__("windowHigh",ca("fa"));P.prototype.__defineGetter__("borders",v("Cb"));P.prototype.__defineSetter__("borders",ca("Cb"));P.prototype.__defineGetter__("reslicing",v("wg"));P.prototype.__defineSetter__("reslicing",ca("wg"));P.prototype.__defineGetter__("resolutionFactor",v("be"));P.prototype.__defineSetter__("resolutionFactor",ca("be"));P.prototype.__defineSetter__("xNormX",function(a){this.b[0].i[0]=a});P.prototype.__defineGetter__("xNormX",function(){return this.b[0].i[0]});
P.prototype.__defineSetter__("xNormY",function(a){this.b[0].i[1]=a});P.prototype.__defineGetter__("xNormY",function(){return this.b[0].i[1]});P.prototype.__defineSetter__("xNormZ",function(a){this.b[0].i[2]=a});P.prototype.__defineGetter__("xNormZ",function(){return this.b[0].i[2]});P.prototype.__defineSetter__("xColor",function(a){this.b[0].z=a});P.prototype.__defineGetter__("xColor",function(){return this.b[0].z});P.prototype.__defineSetter__("yNormX",function(a){this.b[1].i[0]=a});
P.prototype.__defineGetter__("yNormX",function(){return this.b[1].i[0]});P.prototype.__defineSetter__("yNormY",function(a){this.b[1].i[1]=a});P.prototype.__defineGetter__("yNormY",function(){return this.b[1].i[1]});P.prototype.__defineSetter__("yNormZ",function(a){this.b[1].i[2]=a});P.prototype.__defineGetter__("yNormZ",function(){return this.b[1].i[2]});P.prototype.__defineSetter__("yColor",function(a){this.b[1].z=a});P.prototype.__defineGetter__("yColor",function(){return this.b[1].z});
P.prototype.__defineSetter__("zNormX",function(a){this.b[2].i[0]=a});P.prototype.__defineGetter__("zNormX",function(){return this.b[2].i[0]});P.prototype.__defineSetter__("zNormY",function(a){this.b[2].i[1]=a});P.prototype.__defineGetter__("zNormY",function(){return this.b[2].i[1]});P.prototype.__defineSetter__("zNormZ",function(a){this.b[2].i[2]=a});P.prototype.__defineGetter__("zNormZ",function(){return this.b[2].i[2]});P.prototype.__defineSetter__("zColor",function(a){this.b[2].z=a});
P.prototype.__defineGetter__("zColor",function(){return this.b[2].z});
P.prototype.hk=function(a){this.c[a].visible=u;for(var b=0;b<this.c[a].c.length;b++)"undefined"!=typeof this.c[a].c[b]&&(this.M&&(this.e.c[a].c[b].remove(),this.e.c[a].c[b]=t),this.c[a].c[b].remove(),this.c[a].c[b]=t);xc(this.b[a].i,this.b[a].i);Zd(a,this.b[a].vd,this.b[a].i,this);this.c[a].c=[];this.c[a].c=Array(this.b[a].p);this.M&&(b=Xd(this.b[a].vd,this.b[a].Ga,this.b[a].i,this.b[a].z,this.oa,this.e.$,this.e,this.e.M,this.e.xa.Ka),this.e.c[a].c=[],this.e.c[a].c=Array(this.b[a].p),this.e.c[a].c[Math.floor(this.b[a].p/
2)]=b,this.e.c[a].q());b=Xd(this.b[a].vd,this.b[a].Ga,this.b[a].i,this.b[a].z,this.oa,this.$,this,q,t);window.console.log("modified!");this.M&&(b.e=b.H,b.e=this.e.c[a].c[Math.floor(this.b[a].p/2)].H);this.c[a].c[Math.floor(this.b[a].p/2)]=b;0==a?(this.Db=Math.floor(this.b[a].p/2),this.Hc=Math.floor(this.b[a].p/2)):1==a?(this.Eb=Math.floor(this.b[a].p/2),this.Ic=Math.floor(this.b[a].p/2)):(this.Fb=Math.floor(this.b[a].p/2),this.Jc=Math.floor(this.b[a].p/2));this.c[a].q();this.c[a].c[Math.floor(this.b[a].p/
2)].O=q};
function Xe(a,b){if(!a.Sd)if(!a.Ra||!a.j&&b==a.X)a.X=b;else if(-1==a.ee.indexOf(b)){a.ee.push(b);a.Sd=q;var c=new Pd;c.D=a;a.dispatchEvent(c);a.onComputing(b);setTimeout(function(){var a=t;0<=this.X&&(a=this.c[this.X],a.visible=u);var a=this.c[b],c=a.c.length,d=Math.floor(c/4),e;for(e=0;e<1*d;e++){if(a.c[e]==t){var j=vc();j[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*e;if(this.M){var k=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].z,
this.oa,this.e.$,this.e,this.e.M,this.e.xa.Ka);this.e.c[b].c[e]=k;this.e.c[b].q(q)}j=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.$,this,q,t);j.c[0].O=u;this.M&&(j.e=j.H,j.e=this.e.c[b].c[e].H);a.c[e]=j}a.c[e].O=q}af(this,0.25);setTimeout(function(){for(;e<2*d;e++){if(a.c[e]==t){var j=vc();j[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*e;if(this.M){var k=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.e.$,
this.e,this.e.M,this.e.xa.Ka);this.e.c[b].c[e]=k;this.e.c[b].q(q)}j=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.$,this,q,t);j.c[0].O=u;this.M&&(j.e=j.H,j.e=this.e.c[b].c[e].H);a.c[e]=j}a.c[e].O=q}af(this,0.5);setTimeout(function(){for(;e<3*d;e++){if(a.c[e]==t){var j=vc();j[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*e;if(this.M){var k=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.e.$,this.e,this.e.M,
this.e.xa.Ka);this.e.c[b].c[e]=k;this.e.c[b].q(q)}j=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.$,this,q,t);j.c[0].O=u;this.M&&(j.e=j.H,j.e=this.e.c[b].c[e].H);a.c[e]=j}a.c[e].O=q}af(this,0.75);setTimeout(function(){for(e=3*d;e<c;e++){if(a.c[e]==t){var j=vc();j[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*e;if(this.M){var k=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.e.$,this.e,this.e.M,this.e.xa.Ka);
this.e.c[b].c[e]=k;this.e.c[b].q(q)}j=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].z,this.oa,this.$,this,q,t);j.c[0].O=u;this.M&&(j.e=j.H,j.e=this.e.c[b].c[e].H);a.c[e]=j}a.c[e].O=q}af(this,1);setTimeout(function(){this.Sd&&this.c[b].q(q);this.X=b;this.j=u;if(this.Sd){var a=new Rd;a.D=this;this.dispatchEvent(a);this.onComputingEnd(b)}this.Sd=u}.bind(this),10)}.bind(this),10)}.bind(this),10)}.bind(this),10)}.bind(a),10)}else{c=a.c[a.X];c.visible=u;var c=a.c[b],e=c.c.length,d;for(d=0;d<e;d++)c.c[d].O=q;
a.X=b;a.j=u}}function af(a,b){var c=new Qd;c.Ad=b;a.dispatchEvent(c);a.onComputingProgress(100*b)}P.prototype.Ff=ba();P.prototype.Hf=ba();P.prototype.Gf=ba();A("X.volume",P);A("X.volume.prototype.modified",P.prototype.q);A("X.volume.prototype.destroy",P.prototype.Ta);A("X.volume.prototype.sliceInfoChanged",P.prototype.hk);A("X.volume.prototype.onComputing",P.prototype.Ff);A("X.volume.prototype.onComputingProgress",P.prototype.Hf);A("X.volume.prototype.onComputingEnd",P.prototype.Gf);function bf(){Sd.call(this);this.g="parserOFF"}C(bf,Sd);
bf.prototype.parse=function(a,b,c){function e(){l===d&&n(Error("End of file reached unexpectedly."));for(var a=l;a<d;++a)if(10===f[a]){var b=Ud(f,l,a);l=a+1;return b}l=d;return Ud(f,l,d-1)}D.Ja(this.g+".parse");this.K=c;var d=c.byteLength,f=Z(this,"uchar",d);c=[];b.h=new W(d);b.o=new W(d);for(var g=b.h,h=b.o,l=0,j=e(),j=("OFF"===j?e():j).split(" "),k=j[0],j=j[1];k--;){var m=e(),m=m.split(" ");c.push([parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])])}for(;j--;){var m=e(),m=m.split(" "),r=c[parseInt(m[1],
10)],k=c[parseInt(m[2],10)],m=c[parseInt(m[3],10)];g.add(r[0],r[1],r[2]);g.add(k[0],k[1],k[2]);g.add(m[0],m[1],m[2]);r=new S(r[0],r[1],r[2]);m=new S(m[0],m[1],m[2]);k=rc((new S(k[0],k[1],k[2])).wa(r),m.wa(r));k.normalize();h.add(k.x,k.y,k.d);h.add(k.x,k.y,k.d);h.add(k.x,k.y,k.d)}D.Da(this.g+".parse");c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};A("X.parserOFF",bf);A("X.parserOFF.prototype.parse",bf.prototype.parse);function cf(){Sd.call(this);this.g="parserDCM"}C(cf,Sd);
cf.prototype.parse=function(a,b,c){b.zc={};b.zc.xf=0;this.wc(c,b);if(b.r.length==t||b.ta.length==b.r.length){b.zc.xf=b.r.length;var e={};c={};for(var d=0;d<b.ta.length;d++)e.hasOwnProperty(b.ta[d].series_instance_uid)||(e[b.ta[d].series_instance_uid]=[],c[b.ta[d].series_instance_uid]={}),c[b.ta[d].series_instance_uid].hasOwnProperty(b.ta[d].sop_instance_uid)||(c[b.ta[d].series_instance_uid][b.ta[d].sop_instance_uid]=q,e[b.ta[d].series_instance_uid].push(b.ta[d]));var f=Object.keys(e)[0],d=e[f],g=
d.length;c={};var h="image_position_patient";1==g?(h="image_position_patient",e[f][0].dist=0):d[0].image_position_patient[0]!=d[1].image_position_patient[0]||d[0].image_position_patient[1]!=d[1].image_position_patient[1]||d[0].image_position_patient[2]!=d[1].image_position_patient[2]?(h="image_position_patient",e=new S(d[0].image_orientation_patient[0],d[0].image_orientation_patient[1],d[0].image_orientation_patient[2]),f=new S(d[0].image_orientation_patient[3],d[0].image_orientation_patient[4],d[0].image_orientation_patient[5]),
e=rc(e,f),d.map(function(a,b){b.dist=b.image_position_patient[0]*a.x+b.image_position_patient[1]*a.y+b.image_position_patient[2]*a.d;return b}.bind(t,e)),d.sort(function(a,b){return a.dist-b.dist})):d[0].instance_number!=d[1].instance_number?(h="instance_number",d.sort(function(a,b){return a.instance_number-b.instance_number})):window.console.log("Could not resolve the ordering mode");isNaN(d[0].pixel_spacing[0])&&(d[0].pixel_spacing[0]=1);isNaN(d[0].pixel_spacing[1])&&(d[0].pixel_spacing[1]=1);if(1<
g)switch(h){case "image_position_patient":var l=d[0].image_position_patient,e=d[1].image_position_patient,f=e[0]-l[0],j=e[1]-l[1],k=e[2]-l[2];d[0].pixel_spacing[2]=Math.sqrt(f*f+j*j+k*k);break;case "instance_number":d[0].pixel_spacing[2]=1;break;default:window.console.log("Unkown ordering mode - returning: "+h)}else d[0].pixel_spacing[2]=1;e=1;switch(h){case "image_position_patient":var l=d[0].image_position_patient,m=d[g-1].image_position_patient,f=m[0]-l[0],j=m[1]-l[1],k=m[2]-l[2],f=Math.sqrt(f*
f+j*j+k*k),e=e+Math.round(f/d[0].pixel_spacing[2]);break;case "instance_number":e+=Math.abs(d[g-1].instance_number-d[0].instance_number);break;default:window.console.log("Unkown ordering mode - returning: "+h)}l=d[0].columns*d[0].rows;f=l*e;m=t;switch(d[0].ff){case 8:m=new Uint8Array(f);break;case 16:m=new Uint16Array(f);break;case 32:m=new Uint32Array(f);default:window.console.log("Unknown number of bits allocated - using default: 32 bits")}b.rb=d[0].pixel_spacing;for(var r=0;r<g;r++){var s=d[r].data,
f=0;switch(h){case "image_position_patient":f=d[r].image_position_patient[0]-d[0].image_position_patient[0];j=d[r].image_position_patient[1]-d[0].image_position_patient[1];k=d[r].image_position_patient[2]-d[0].image_position_patient[2];f=Math.round(Math.sqrt(f*f+j*j+k*k)/d[0].pixel_spacing[2]);break;case "instance_number":f=d[r].instance_number-d[0].instance_number;break;default:window.console.log("Unkown ordering mode - returning: "+h)}m.set(s,f*l)}c.data=m;b.K=m;b.da=[d[0].columns,d[0].rows,e];
c.Al=b.da;e=Td(m);g=e[0];e=e[1];c.min=b.ra=b.ga=g;c.max=b.ka=b.fa=e;-Infinity==b.U&&(b.U=g);Infinity==b.W&&(b.W=e);j=d[0].image_position_patient;g=Ac();if("false"==b.reslicing||b.reslicing==u)T(g,0,d[0].pixel_spacing[0],0,0,0),T(g,1,0,d[0].pixel_spacing[1],0,0),T(g,2,0,0,d[0].pixel_spacing[2],0),T(g,3,0,0,0,1);else switch(h){case "image_position_patient":e=new S(d[0].image_orientation_patient[0],d[0].image_orientation_patient[1],d[0].image_orientation_patient[2]);f=new S(d[0].image_orientation_patient[3],
d[0].image_orientation_patient[4],d[0].image_orientation_patient[5]);e=rc(e,f);T(g,0,-d[0].image_orientation_patient[0]*d[0].pixel_spacing[0],-d[0].image_orientation_patient[3]*d[0].pixel_spacing[1],-e.x*d[0].pixel_spacing[2],-j[0]);T(g,1,-d[0].image_orientation_patient[1]*d[0].pixel_spacing[0],-d[0].image_orientation_patient[4]*d[0].pixel_spacing[1],-e.y*d[0].pixel_spacing[2],-j[1]);T(g,2,d[0].image_orientation_patient[2]*d[0].pixel_spacing[0],d[0].image_orientation_patient[5]*d[0].pixel_spacing[1],
e.d*d[0].pixel_spacing[2],j[2]);T(g,3,0,0,0,1);break;case "instance_number":T(g,0,-1,0,0,-j[0]);T(g,1,-0,-1,-0,-j[1]);T(g,2,0,0,1,j[2]);T(g,3,0,0,0,1);break;default:window.console.log("Unkown ordering mode - returning: "+h)}c.fb=g;c.hb=Ac();Jc(c.fb,c.hb);h=zc(0,0,0,1);d=yc();Lc(g,h,d);h=zc(1,1,1,1);e=yc();Lc(g,h,e);c.Cc=[e[0]-d[0],e[1]-d[1],e[2]-d[2]];d=Vd(g,[b.da[0],b.da[1],b.da[2]]);c.Ac=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];c.Bc=[d[0],d[2],d[4]];b.Hb(c);b.kb=$d(this,b)}c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};
function df(a,b,c,e){switch(c){case 16975:case 20819:case 20053:case 22351:c=function(a){for(var b="",c=128;1<=c;c/=2)b+=a&c?"1":"0";return b};e=a[b++];a=a[b++];e=parseInt(c((a&65280)>>8)+c(a&255)+(c((e&65280)>>8)+c(e&255)),2);4294967295==e&&(e=0);b+=e/2;break;default:b+=e/2}return b}
cf.prototype.wc=function(a,b){this.K=a;if("undefined"==typeof b.ta||b.ta==t)b.ta=[];for(var c={pixel_spacing:[0.1,0.1,Infinity],image_orientation_patient:[1,0,0,0,1,0],image_position_patient:[0,0,0],transfer_syntax_uid:"no_transfer_syntax_uid"},e=Z(this,"ushort",this.K.byteLength),d=66,f=t,g=t,h=t,l=t;d<e.length;)switch(f=e[d++],g=e[d++],h=e[d++],l=e[d++],"1.2.840.10008.1.2"==c.transfer_syntax_uid&&0==l&&(l=h),f){case 2:switch(g){case 16:for(var j="",f=f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>
8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);c.transfer_syntax_uid=j.replace(/\0/g,"");break;default:d=df(e,d,h,l)}break;case 40:switch(g){case 16:c.rows=e[d];d+=l/2;break;case 17:c.columns=e[d];d+=l/2;break;case 256:c.ff=e[d];d+=l/2;break;case 257:c.bits_stored=e[d];d+=l/2;break;case 2:c.number_of_images=e[d];d+=l/2;break;case 48:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);j=j.split("\\");c.pixel_spacing=[parseFloat(j[0]),parseFloat(j[1]),
Infinity];break;default:d=df(e,d,h,l)}break;case 32:switch(g){case 14:c.series_instance_uid="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,c.series_instance_uid+=String.fromCharCode(g),c.series_instance_uid+=String.fromCharCode(h);break;case 19:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);c.instance_number=parseInt(j,10);break;case 50:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);
j=j.split("\\");c.image_position_patient=[parseFloat(j[0]),parseFloat(j[1]),parseFloat(j[2])];break;case 55:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);j=j.split("\\");c.image_orientation_patient=[parseFloat(j[0]),parseFloat(j[1]),parseFloat(j[2]),parseFloat(j[3]),parseFloat(j[4]),parseFloat(j[5])];break;default:d=df(e,d,h,l)}break;case 65534:switch(g){default:l=0,d+=l/2}break;case 8:switch(g){case 24:c.sop_instance_uid="";for(f=0;f<l/
2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,c.sop_instance_uid+=String.fromCharCode(g),c.sop_instance_uid+=String.fromCharCode(h);break;default:d=df(e,d,h,l)}break;case 16:switch(g){case 8720:for(f=0;f<l/2;f++)d++;break;default:d=df(e,d,h,l)}break;default:d=df(e,d,h,l)}switch(c.ff){case 8:c.data=new Uint8Array(c.columns*c.rows);break;case 16:c.data=new Uint16Array(c.columns*c.rows);break;case 32:c.data=new Uint32Array(c.columns*c.rows)}this.C=this.K.byteLength-2*c.columns*c.rows;e=t;switch(c.ff){case 8:e=
Z(this,"uchar",c.columns*c.rows);break;case 16:e=Z(this,"ushort",c.columns*c.rows);break;case 32:e=Z(this,"uint",c.columns*c.rows)}c.data=e;b.ta.push(c);return b};A("X.parserDCM",cf);A("X.parserDCM.prototype.parse",cf.prototype.parse);function ef(){Sd.call(this);this.g="parserVTK"}C(ef,Sd);
ef.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");var e=b.h,d=b.o,f=new Uint8Array(c),g="";b.h=e=new W(c.byteLength);b.o=d=new W(c.byteLength);c=0;for(var h=f.length;c<h;c+=32768)g+=Ud(f,c,Math.min(c+32768,h));f=g.split("\n");g=f.length;this.yd=this.zd=t;this.ic=[];this.Pa=Rc;this.Te=this.Tb=this.Nb=this.Ub=u;c=0;for(h=g%8;h--;)ff(this,f[c]),c++;for(h=0.125*g^0;h--;)ff(this,f[c]),c++,ff(this,f[c]),c++,ff(this,f[c]),c++,ff(this,f[c]),c++,ff(this,f[c]),c++,ff(this,f[c]),c++,ff(this,f[c]),c++,
ff(this,f[c]),c++;c=this.zd;var f=this.yd,g=f.length,l=h=this.ic.length;do{var j=this.ic[h-l],k=j.length,m;for(m=0;m<k&&!("LINES"==this.Pa&&m+1>=k);m++){var r=parseInt(j[m],10),s=c.get(r);e.add(s[0],s[1],s[2]);var y=r,z=s;"LINES"==this.Pa?(y=parseInt(j[m+1],10),z=c.get(y),e.add(z[0],z[1],z[2])):"TRIANGLE_STRIPS"==this.Pa&&(0==m||m==k-1)&&e.add(s[0],s[1],s[2]);r<g?(z=f.get(r),d.add(z[0],z[1],z[2]),"LINES"==this.Pa?(y=f.get(y),d.add(y[0],y[1],y[2])):"TRIANGLE_STRIPS"==this.Pa&&(0==m||m==k-1)&&d.add(z[0],
z[1],z[2])):(y=new S(s[0],s[1],s[2]),y.normalize(),d.add(y.x,y.y,y.d),"LINES"==this.Pa?(y=new S(z[0],z[1],z[2]),y.normalize(),d.add(y.x,y.y,y.d)):"TRIANGLE_STRIPS"==this.Pa&&(0==m||m==k-1)&&d.add(y.x,y.y,y.d))}l--}while(0<l);b.Ia=this.Pa;D.Da(this.g+".parse");e=new Vc;e.D=b;e.v=a;this.dispatchEvent(e)};
function ff(a,b){b=b.replace(/^\s+|\s+$/g,"");var c=b.split(" "),e=c.length,d=c[0];switch(d){case "POINTS":a.Ub=q;a.Nb=u;a.Tb=u;c=parseInt(c[1],10);a.zd=new W(3*c);a.yd=new W(3*c);return;case "VERTICES":a.Nb=q;a.Ub=u;a.Tb=u;c=parseInt(c[1],10);3<=c?a.Pa=Rc:1==c?a.Pa="POINTS":n(Error("This VTK file is not supported!"));a.ic=[];return;case "TRIANGLE_STRIPS":a.Nb=q;a.Ub=u;a.Tb=u;a.Pa="TRIANGLE_STRIPS";a.ic=[];return;case "LINES":a.Nb=q;a.Ub=u;a.Tb=u;a.Pa="LINES";a.ic=[];return;case "POLYGONS":a.Nb=q;
a.Ub=u;a.Tb=u;a.Pa="POLYGONS";a.ic=[];return;case "POINT_DATA":a.Tb=q;a.Ub=u;a.Nb=u;return}if(a.Ub)if(1==e||isNaN(parseFloat(d)))a.Ub=u;else{if(3<=e){var d=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]);a.zd.add(d,f,g)}6<=e&&(d=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.zd.add(d,f,g));9<=e&&(e=parseFloat(c[6]),d=parseFloat(c[7]),c=parseFloat(c[8]),a.zd.add(e,d,c))}else a.Nb?1==e||isNaN(parseFloat(d))?a.Nb=u:(c=c.slice(1),a.ic.push(c)):a.Tb&&("NORMALS"==d?a.Te=q:1==e||isNaN(parseFloat(d))?
(a.Tb=u,a.Te=u):a.Te&&(3<=e&&(d=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]),a.yd.add(d,f,g)),6<=e&&(d=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.yd.add(d,f,g)),9<=e&&(e=parseFloat(c[6]),d=parseFloat(c[7]),c=parseFloat(c[8]),a.yd.add(e,d,c))))}A("X.parserVTK",ef);A("X.parserVTK.prototype.parse",ef.prototype.parse);function gf(){Sd.call(this);this.g="parserFSM";this.Mc=u}C(gf,Sd);
gf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.K=c;var e=b.h,d=b.o;b.Nc=[];var f=b.Nc;c=0;var g;do g=Z(this,"uchar"),c++;while(200>c&&10!=g);Z(this,"uchar");d=Z(this,"uint");c=Z(this,"uint");var h=Z(this,"float",3*d);g=Z(this,"uint",3*c);var l=new Uint32Array(d),j=new Float32Array(9*c);b.h=e=new W(9*c);b.o=d=new W(9*c);var k;for(k=0;k<c;k++){var m=3*k,r=g[m],s=g[m+1],y=g[m+2];f.push(r);f.push(s);f.push(y);l[r]+=1;l[s]+=1;l[y]+=1;var m=3*r,z=3*s,G=3*y,F=h[m],H=h[m+1],B=h[m+2],s=h[z],
y=h[z+1],r=h[z+2],E=h[G],I=h[G+1],N=h[G+2];e.add(F,H,B);e.add(s,y,r);e.add(E,I,N);F=new S(F,H,B);E=new S(E,I,N);s=(new S(s,y,r)).l().wa(F);y=E.l().wa(F);s=rc(s,y).normalize();j[m]+=s.x;j[m+1]+=s.y;j[m+2]+=s.d;j[z]+=s.x;j[z+1]+=s.y;j[z+2]+=s.d;j[G]+=s.x;j[G+1]+=s.y;j[G+2]+=s.d}for(k=0;k<c;k++)m=3*k,r=g[m],s=g[m+1],y=g[m+2],m=3*r,z=3*s,G=3*y,f=new S(j[z],j[z+1],j[z+2]),h=new S(j[G],j[G+1],j[G+2]),m=(new S(j[m],j[m+1],j[m+2])).scale(1/l[r]).normalize(),f=f.scale(1/l[s]).normalize(),h=h.scale(1/l[y]).normalize(),
d.add(m.x,m.y,m.d),d.add(f.x,f.y,f.d),d.add(h.x,h.y,h.d);c=Z(this,"uchar",this.K.byteLength-this.C);g=t;for(m=0;m<c.length;m++)if(99==c[m]&&114==c[m+1]&&97==c[m+2]&&115==c[m+3]){for(d=g=m+9;10!=c[m]&&m<c.length;)d++,m++;g=Ud(c.subarray(g,d)).split(" ");break}g&&(b.la.Dh(parseFloat(g[0])),b.la.Eh(parseFloat(g[1])),b.la.Fh(parseFloat(g[2])));b.Ia=Rc;D.Da(this.g+".parse");c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};A("X.parserFSM",gf);A("X.parserFSM.prototype.parse",gf.prototype.parse);var hf={kf:function(a,b,c){return hf.update(a,0,b,c)},update:function(a,b,c,e){var d=hf.Mh,f="number"===typeof c?c:c=0;e="number"===typeof e?e:a.length;b^=4294967295;for(f=e&7;f--;++c)b=b>>>8^d[(b^a[c])&255];for(f=e>>3;f--;c+=8)b=b>>>8^d[(b^a[c])&255],b=b>>>8^d[(b^a[c+1])&255],b=b>>>8^d[(b^a[c+2])&255],b=b>>>8^d[(b^a[c+3])&255],b=b>>>8^d[(b^a[c+4])&255],b=b>>>8^d[(b^a[c+5])&255],b=b>>>8^d[(b^a[c+6])&255],b=b>>>8^d[(b^a[c+7])&255];return(b^4294967295)>>>0}};
hf.Mh=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,
3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,
366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,
3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,
1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,
1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function jf(a){var b=a.length,c=0,e=Number.POSITIVE_INFINITY,d,f,g,h,l,j,k,m,r;for(m=0;m<b;++m)a[m]>c&&(c=a[m]),a[m]<e&&(e=a[m]);d=1<<c;f=new Uint32Array(d);g=1;h=0;for(l=2;g<=c;){for(m=0;m<b;++m)if(a[m]===g){j=0;k=h;for(r=0;r<g;++r)j=j<<1|k&1,k>>=1;for(r=j;r<d;r+=l)f[r]=g<<16|m;++h}++g;h<<=1;l<<=1}return[f,c,e]};function kf(a,b){this.gf=[];this.hf=32768;this.sb=this.Bd=this.N=this.Wf=0;this.input=new Uint8Array(a);this.Bg=u;this.jf=lf;this.Xa=u;if(b||!(b={}))b.index&&(this.N=b.index),b.bufferSize&&(this.hf=b.bufferSize),b.bufferType&&(this.jf=b.bufferType),b.resize&&(this.Xa=b.resize);switch(this.jf){case mf:this.na=32768;this.Ua=new Uint8Array(32768+this.hf+258);break;case lf:this.na=0;this.Ua=new Uint8Array(this.hf);this.uc=this.xi;this.Eg=this.mi;this.qf=this.ri;break;default:n(Error("invalid inflate mode"))}}
var mf=0,lf=1;
kf.prototype.Yb=function(){for(;!this.Bg;){var a=nf(this,3);a&1&&(this.Bg=q);a>>>=1;switch(a){case 0:var a=this.input,b=this.N,c=this.Ua,e=this.na,d=p,f=p,g=p,h=c.length,d=p;this.sb=this.Bd=0;d=a[b++];d===p&&n(Error("invalid uncompressed block header: LEN (first byte)"));f=d;d=a[b++];d===p&&n(Error("invalid uncompressed block header: LEN (second byte)"));f|=d<<8;d=a[b++];d===p&&n(Error("invalid uncompressed block header: NLEN (first byte)"));g=d;d=a[b++];d===p&&n(Error("invalid uncompressed block header: NLEN (second byte)"));g|=
d<<8;f===~g&&n(Error("invalid uncompressed block header: length verify"));b+f>a.length&&n(Error("input buffer is broken"));switch(this.jf){case mf:for(;e+f>c.length;)d=h-e,f-=d,c.set(a.subarray(b,b+d),e),e+=d,b+=d,this.na=e,c=this.uc(),e=this.na;break;case lf:for(;e+f>c.length;)c=this.uc({Kg:2});break;default:n(Error("invalid inflate mode"))}c.set(a.subarray(b,b+f),e);e+=f;this.N=b+=f;this.na=e;this.Ua=c;break;case 1:this.qf(of,pf);break;case 2:qf(this);break;default:n(Error("unknown BTYPE: "+a))}}return this.Eg()};
var rf=new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sf=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258]),tf=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0]),uf=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]),vf=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),wf=new Uint8Array(288),
xf,yf;xf=0;for(yf=wf.length;xf<yf;++xf)wf[xf]=143>=xf?8:255>=xf?9:279>=xf?7:8;var of=jf(wf),zf=new Uint8Array(30),Af,Bf;Af=0;for(Bf=zf.length;Af<Bf;++Af)zf[Af]=5;var pf=jf(zf);function nf(a,b){for(var c=a.Bd,e=a.sb,d=a.input,f=a.N,g;e<b;)g=d[f++],g===p&&n(Error("input buffer is broken")),c|=g<<e,e+=8;g=c&(1<<b)-1;a.Bd=c>>>b;a.sb=e-b;a.N=f;return g}
function Cf(a,b){for(var c=a.Bd,e=a.sb,d=a.input,f=a.N,g=b[0],h=b[1],l;e<h;)l=d[f++],l===p&&n(Error("input buffer is broken")),c|=l<<e,e+=8;d=g[c&(1<<h)-1];g=d>>>16;a.Bd=c>>g;a.sb=e-g;a.N=f;return d&65535}
function qf(a){function b(a,b,c){var d,e,f;for(f=0;f<a;)switch(d=Cf(this,b),d){case 16:for(d=3+nf(this,2);d--;)c[f++]=e;break;case 17:for(d=3+nf(this,3);d--;)c[f++]=0;e=0;break;case 18:for(d=11+nf(this,7);d--;)c[f++]=0;e=0;break;default:e=c[f++]=d}return c}var c=nf(a,5)+257,e=nf(a,5)+1,d=nf(a,4)+4,f=new Uint8Array(rf.length),g;for(g=0;g<d;++g)f[rf[g]]=nf(a,3);d=jf(f);f=new Uint8Array(c);g=new Uint8Array(e);a.qf(jf(b.call(a,c,d,f)),jf(b.call(a,e,d,g)))}w=kf.prototype;
w.qf=function(a,b){var c=this.Ua,e=this.na;this.Hg=a;for(var d=c.length-258,f,g,h;256!==(f=Cf(this,a));)if(256>f)e>=d&&(this.na=e,c=this.uc(),e=this.na),c[e++]=f;else{f-=257;h=sf[f];0<tf[f]&&(h+=nf(this,tf[f]));f=Cf(this,b);g=uf[f];0<vf[f]&&(g+=nf(this,vf[f]));e>=d&&(this.na=e,c=this.uc(),e=this.na);for(;h--;)c[e]=c[e++-g]}for(;8<=this.sb;)this.sb-=8,this.N--;this.na=e};
w.ri=function(a,b){var c=this.Ua,e=this.na;this.Hg=a;for(var d=c.length,f,g,h;256!==(f=Cf(this,a));)if(256>f)e>=d&&(c=this.uc(),d=c.length),c[e++]=f;else{f-=257;h=sf[f];0<tf[f]&&(h+=nf(this,tf[f]));f=Cf(this,b);g=uf[f];0<vf[f]&&(g+=nf(this,vf[f]));e+h>d&&(c=this.uc(),d=c.length);for(;h--;)c[e]=c[e++-g]}for(;8<=this.sb;)this.sb-=8,this.N--;this.na=e};
w.uc=function(){var a=new Uint8Array(this.na-32768),b=this.na-32768,c=this.Ua;a.set(c.subarray(32768,a.length));this.gf.push(a);this.Wf+=a.length;c.set(c.subarray(b,b+32768));this.na=32768;return c};w.xi=function(a){var b=this.input.length/this.N+1|0,c=this.input,e=this.Ua;a&&("number"===typeof a.Kg&&(b=a.Kg),"number"===typeof a.fi&&(b+=a.fi));2>b?(a=(c.length-this.N)/this.Hg[2],a=258*(a/2)|0,a=a<e.length?e.length+a:e.length<<1):a=e.length*b;a=new Uint8Array(a);a.set(e);return this.Ua=a};
w.Eg=function(){var a=0,b=this.Ua,c=this.gf,e,d=new Uint8Array(this.Wf+(this.na-32768)),f,g,h,l;if(0===c.length)return this.Ua.subarray(32768,this.na);f=0;for(g=c.length;f<g;++f){e=c[f];h=0;for(l=e.length;h<l;++h)d[a++]=e[h]}f=32768;for(g=this.na;f<g;++f)d[a++]=b[f];this.gf=[];return this.buffer=d};w.mi=function(){var a,b=this.na;this.Xa?(a=new Uint8Array(b),a.set(this.Ua.subarray(0,b))):a=this.Ua.subarray(0,b);return this.buffer=a};new Uint8Array(256);var Df;for(Df=0;256>Df;++Df)for(var Ef=Df,Ff=7,Ef=Ef>>>1;Ef;Ef>>>=1)--Ff;var Gf=[],Hf;for(Hf=0;288>Hf;Hf++)switch(q){case 143>=Hf:Gf.push([Hf+48,8]);break;case 255>=Hf:Gf.push([Hf-144+400,9]);break;case 279>=Hf:Gf.push([Hf-256+0,7]);break;case 287>=Hf:Gf.push([Hf-280+192,8]);break;default:n("invalid literal: "+Hf)}
function If(){var a=Jf;switch(q){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,a-
31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:n("invalid length: "+a)}}var Kf=[],Jf,Lf;
for(Jf=3;258>=Jf;Jf++)Lf=If(),Kf[Jf]=Lf[2]<<24|Lf[1]<<16|Lf[0];new Uint32Array(Kf);function Mf(){};function Nf(a){this.input=a;this.N=0;this.member=[]}
Nf.prototype.Yb=function(){for(var a=this.input.length;this.N<a;){var b=new Mf,c=p,e=p,d=p,f=c=d=p,g=p,c=c=p,h=this.input,e=this.N;b.Qg=h[e++];b.Rg=h[e++];(31!==b.Qg||139!==b.Rg)&&n(Error("invalid file signature:",b.Qg,b.Rg));b.Dg=h[e++];switch(b.Dg){case 8:break;default:n(Error("unknown compression method: "+b.Dg))}b.ne=h[e++];c=h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24;b.Nl=new Date(1E3*c);b.Yl=h[e++];b.Sl=h[e++];0<(b.ne&4)&&(b.He=h[e++]|h[e++]<<8,e+=b.He);if(0<(b.ne&8)){g=[];for(f=0;0<(c=h[e++]);)g[f++]=
String.fromCharCode(c);b.name=g.join("")}if(0<(b.ne&16)){g=[];for(f=0;0<(c=h[e++]);)g[f++]=String.fromCharCode(c);b.comment=g.join("")}0<(b.ne&2)&&(b.ni=hf.kf(h,0,e)&65535,b.ni!==(h[e++]|h[e++]<<8)&&n(Error("invalid header crc16")));c=h[h.length-4]|h[h.length-3]<<8|h[h.length-2]<<16|h[h.length-1]<<24;h.length-e-4-4<512*c&&(d=c);e=new kf(h,{index:e,bufferSize:d});b.data=d=e.Yb();e=e.N;b.xl=c=(h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24)>>>0;hf.kf(d)!==c&&n(Error("invalid CRC-32 checksum: 0x"+hf.kf(d).toString(16)+
" / 0x"+c.toString(16)));b.Gl=c=(h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24)>>>0;(d.length&4294967295)!==c&&n(Error("invalid input size: "+(d.length&4294967295)+" / "+c));this.member.push(b);this.N=e}a=this.member;b=d=e=0;for(h=a.length;b<h;++b)d+=a[b].data.length;d=new Uint8Array(d);for(b=0;b<h;++b)d.set(a[b].data,e),e+=a[b].data.length;return d};function Of(){Sd.call(this);this.g="parserMGZ";this.Mc=u}C(Of,Sd);
Of.prototype.parse=function(a,b,c,e){D.Ja(this.g+".parse");window.console.log(b);e&&(c=(new Nf(new Uint8Array(c))).Yb(),c=c.buffer);e=this.wc(c);var d=[e.Bf,e.Cf,e.Df];b.da=d;var f=e.Gh;b.rb=f;c=e.min;var g=e.max;b.ra=b.ga=c;b.ka=b.fa=g;-Infinity==b.U&&(b.U=c);Infinity==b.W&&(b.W=g);c=Ac();if("false"==b.reslicing||b.reslicing==u)T(c,0,b.rb[0],0,0,0),T(c,1,0,b.rb[1],0,0),T(c,2,0,0,b.rb[2],0),T(c,3,0,0,0,1),Dc(c,0,0,0,1);else{T(c,0,e.gb[0][0],e.gb[1][0],e.gb[2][0],0);T(c,1,e.gb[0][1],e.gb[1][1],e.gb[2][1],
0);T(c,2,e.gb[0][2],e.gb[1][2],e.gb[2][2],0);T(c,3,0,0,0,1);for(var g=d[0]/2,h=d[1]/2,d=d[2]/2,l=[0,0,0],j=0;3>j;++j)l[j]=e.gb[3][j]-(c[j+0]*f[0]*g+c[j+4]*f[1]*h+c[j+8]*f[2]*d);Dc(c,l[0],l[1],l[2],1)}e.fb=c;e.hb=Ac();Jc(e.fb,e.hb);g=zc(0,0,0,1);f=yc();Lc(c,g,f);h=zc(1,1,1,1);g=yc();Lc(c,h,g);c=Vd(c,b.da);e.Cc=[g[0]-f[0],g[1]-f[1],g[2]-f[2]];e.Ac=[c[1]-c[0]+1,c[3]-c[2]+1,c[5]-c[4]+1];e.Bc=[c[0],c[2],c[4]];b.Hb(e);D.Da(this.g+".parse");b.kb=$d(this,b);e=new Vc;e.D=b;e.v=a;this.dispatchEvent(e)};
Of.prototype.wc=function(a){this.K=a;a={version:0,Ph:0,Nh:0,Ei:0,Oh:0,Bf:0,Cf:0,Df:0,nj:0,type:0,vi:0,vh:0,Dk:t,gb:t,Gh:t,data:t,min:Infinity,max:-Infinity};a.version=Z(this,"uint");a.Bf=Z(this,"uint");a.Cf=Z(this,"uint");a.Df=Z(this,"uint");a.nj=Z(this,"uint");a.type=Z(this,"uint");a.vi=Z(this,"uint");a.vh=Z(this,"ushort");if(0<a.vh){a.Gh=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.gb=b}this.C=284;b=a.Bf*a.Cf*
a.Df;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:n(Error("Unsupported MGH/MGZ data type: "+a.type))}b=Td(a.data);a.min=b[0];a.max=b[1];this.C+16<this.K.byteLength&&(a.Ph=Z(this,"float"),a.Ei=Z(this,"float"),a.Nh=Z(this,"float"),a.Oh=Z(this,"float"));return a};A("X.parserMGZ",Of);A("X.parserMGZ.prototype.parse",Of.prototype.parse);function Pf(){Sd.call(this);this.g="parserCRV";this.Mc=u}C(Pf,Sd);
Pf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");var e=b.Nc;0==e.length&&n(Error("No _pointIndices defined on the X.object."));this.K=c;this.C=3;var d=Z(this,"uint");Z(this,"uint");Z(this,"uint");var f=0,g=0,h=0,l=0,j=0,k=0,m=0,r=0,s=0,y=0,z=0;c=Array(2);var G=Array(2),F=Z(this,"float",d),H;for(H=0;H<d;H++){var B=F[H];0==H&&(c[0]=G[0]=B);0<=B?(f++,l+=B):(g++,h+=B);s+=B;z++;G[0]=Math.max(B,G[0]);c[0]=Math.min(B,c[0]);F[H]=B}0!=f&&(j=l/f);0!=g&&(k=h/g);0!=z&&(y=s/z);for(z=s=h=l=0;z<d;z++)B=
F[z],H=0,0<=B?(H=Math.pow(B-j,2),l+=H):(H=Math.pow(B-k,2),h+=H),H=Math.pow(B-y,2),s+=H;1<f&&(m=Math.sqrt(l/(f-1)));1<g&&(r=Math.sqrt(h/(g-1)));c[1]=k-2.5*r;G[1]=j+2.5*m;d=e.length;f=new Float32Array(3*d);for(z=0;z<d;z++)g=F[e[z]],h=3*z,f[h]=g,f[h+1]=g,f[h+2]=g;b.G.ra=c[1];b.G.ka=G[1];-Infinity==b.G.U&&(b.G.U=c[1]);Infinity==b.G.W&&(b.G.W=G[1]);b.G.F=F;b.G.dd=f;b.G.j=q;D.Da(this.g+".parse");e=new Vc;e.D=b;e.v=a;this.dispatchEvent(e)};A("X.parserCRV",Pf);A("X.parserCRV.prototype.parse",Pf.prototype.parse);function Qf(a,b){var c,e;this.input=a;this.N=0;if(b||!(b={}))b.index&&(this.N=b.index),b.verify&&(this.uk=b.verify);c=a[this.N++];e=a[this.N++];switch(c&15){case 8:this.method=8;break;default:n(Error("unsupported compression method"))}0!==((c<<8)+e)%31&&n(Error("invalid fcheck flag:"+((c<<8)+e)%31));e&32&&n(Error("fdict flag is not supported"));this.wh=new kf(a,{index:this.N,bufferSize:b.bufferSize,bufferType:b.bufferType,resize:b.resize})}
Qf.prototype.Yb=function(){var a=this.input,b;b=this.wh.Yb();this.N=this.wh.N;if(this.uk){var a=(a[this.N++]<<24|a[this.N++]<<16|a[this.N++]<<8|a[this.N++])>>>0,c=b;if("string"===typeof c){var c=c.split(""),e,d;e=0;for(d=c.length;e<d;e++)c[e]=(c[e].charCodeAt(0)&255)>>>0}e=1;d=0;for(var f=c.length,g,h=0;0<f;){g=1024<f?1024:f;f-=g;do e+=c[h++],d+=e;while(--g);e%=65521;d%=65521}a!==(d<<16|e)>>>0&&n(Error("invalid adler-32 checksum"))}return b};function Rf(){Sd.call(this);this.g="parserRAW"}C(Rf,Sd);
Rf.prototype.parse=function(a,b,c,e){D.Ja(this.g+".parse");e&&(c=(new Qf(new Uint8Array(c))).Yb(),c=c.buffer);e={};e.data=new Uint8Array(c);var d=Td(e.data);c=d[0];d=d[1];e.min=b.ra=b.ga=c;e.max=b.ka=b.fa=d;-Infinity==b.U&&(b.U=c);Infinity==b.W&&(b.W=d);d=Bc();e.fb=d;e.hb=Bc();var f=zc(0,0,0,1);c=yc();Lc(d,f,c);var g=zc(1,1,1,1),f=yc();Lc(d,g,f);d=Vd(d,b.da);e.Cc=[f[0]-c[0],f[1]-c[1],f[2]-c[2]];e.Ac=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];e.Bc=[d[0],d[2],d[4]];b.Hb(e);D.Da(this.g+".parse");b.kb=$d(this,
b);e=new Vc;e.D=b;e.v=a;this.dispatchEvent(e)};A("X.parserRAW",Rf);A("X.parserRAW.prototype.parse",Rf.prototype.parse);function Sf(){Sd.call(this);this.g="parserIMAGE"}C(Sf,Sd);Sf.prototype.parse=function(a,b,c,e){c instanceof ArrayBuffer||n(Error());for(var d=new Uint8Array(c),f=d.length,g=Array(f);f--;)g[f]=String.fromCharCode(d[f]);d=window.btoa(g.join(""));f=new Image;Ub(f,"load",this.Uj.bind(this,f,a,b,c,e));f.src="data:image/"+e+";base64,"+d};Sf.prototype.Uj=function(a,b,c){b.kb=a;b.Wb=t;a=new Vc;a.D=c;a.v=b;this.dispatchEvent(a)};A("X.parserIMAGE",Sf);A("X.parserIMAGE.prototype.parse",Sf.prototype.parse);function Tf(){Sd.call(this);this.g="parserLUT"}C(Tf,Sd);
Tf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.K=c;c=Z(this,"uchar",c.byteLength);var e=c.length,d=0,f;for(f=0;f<e;f++)if(10==c[f]){var g=Ud(c,d,f),d=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)))}D.Da(this.g+".parse");c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};
A("X.parserLUT",Tf);A("X.parserLUT.prototype.parse",Tf.prototype.parse);function Uf(){Sd.call(this);this.g="parserMRC"}C(Uf,Sd);
Uf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");c=this.wc(c);var e=c.min,d=c.max;b.da=[c.Hd,c.Id,c.Jd];b.rb=[c.He/c.bh,c.Jh/c.dh,c.Kh/c.eh];b.ra=b.ga=e;b.ka=b.fa=d;-Infinity==b.U&&(b.U=e);Infinity==b.W&&(b.W=d);d=Ac();T(d,3,0,0,0,1);T(d,0,-1,0,0,c.Hd);T(d,1,0,0,-1,c.Id);T(d,2,0,-1,0,c.Jd);c.fb=d;c.hb=Ac();Jc(c.fb,c.hb);var f=zc(0,0,0,1),e=yc();Lc(d,f,e);var g=zc(1,1,1,1),f=yc();Lc(d,g,f);g=[c.Hd,c.Id,c.Jd];d=Vd(d,g);c.Cc=[f[0]-e[0],f[1]-e[1],f[2]-e[2]];c.Ac=[d[1]+d[0]+1,d[3]-d[2]+1,d[5]-
d[4]+1];c.Bc=[d[0],d[2],d[4]];b.da=g;b.Hb(c);b.kb=$d(this,b);D.Da(this.g+".parse");c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};
Uf.prototype.wc=function(a){this.K=a;a={Hd:0,Id:0,Jd:0,mode:0,Pl:0,Ql:0,Rl:0,bh:0,dh:0,eh:0,He:0,Jh:0,Kh:0,alpha:0,ii:0,Fi:0,fj:0,gj:0,hj:0,ef:0,ie:0,rc:0,Il:0,next:0,oi:0,zi:t,oj:0,qj:0,zi:t,Ti:0,Fl:0,Ri:0,bj:0,kj:0,lj:0,sk:0,tk:0,pk:t,vk:0,xk:0,yk:0,wl:0,Xl:0,ak:0,pj:0,data:t,min:Infinity,max:-Infinity,Ml:0,zh:t,Wl:t,Ul:t,orientation:t,Ol:t};this.C=0;a.Hd=Z(this,"sint");a.Id=Z(this,"sint");a.Jd=Z(this,"sint");a.mode=Z(this,"sint");var b=a.Hd*a.Id*a.Jd;this.C=1024;switch(a.mode){case 0:a.data=Z(this,
"schar",b);break;case 1:a.data=Z(this,"sshort",b);break;case 2:a.data=Z(this,"float",b);break;case 3:a.data=Z(this,"uint",b);break;case 4:a.data=Z(this,"double",b);break;case 6:a.data=Z(this,"ushort",b);break;case 16:a.data=Z(this,"uchar",b);break;default:n(Error("Unsupported MRC data type: "+a.mode))}this.C=28;a.bh=Z(this,"sint");a.dh=Z(this,"sint");a.eh=Z(this,"sint");a.He=Z(this,"float");a.Jh=Z(this,"float");a.Kh=Z(this,"float");a.alpha=Z(this,"float");a.ii=Z(this,"float");a.Fi=Z(this,"float");
a.fj=Z(this,"sint");a.gj=Z(this,"sint");a.hj=Z(this,"sint");a.ef=Z(this,"float");a.ie=Z(this,"float");a.rc=Z(this,"float");a.Hl=Z(this,"sint");a.next=Z(this,"sint");a.oi=Z(this,"short");a.oj=Z(this,"short");a.qj=Z(this,"short");a.Ti=Z(this,"sint");a.El=Z(this,"sint");a.Ri=Z(this,"short");a.bj=Z(this,"short");a.kj=Z(this,"short");a.lj=Z(this,"short");a.sk=Z(this,"short");a.tk=Z(this,"short");a.pk=Z(this,"float",6);this.C=196;a.vk=Z(this,"float");a.xk=Z(this,"float");a.yk=Z(this,"float");this.C=216;
a.ak=Z(this,"float");a.pj=Z(this,"sint");a.Jl=Z(this,"schar",10);if(0!=a.next)switch(this.C=parseInt(a.next+1024,10),a.mode){case 0:a.data=Z(this,"schar",b);break;case 1:a.data=Z(this,"sshort",b);break;case 2:a.data=Z(this,"float",b);break;case 3:a.data=Z(this,"uint",b);break;case 4:a.data=Z(this,"double",b);break;case 6:a.data=Z(this,"ushort",b);break;case 16:a.data=Z(this,"uchar",b);break;default:n(Error("Unsupported MRC data type: "+a.mode))}0>a.rc-(a.ie-a.rc)?(a.min=a.ef,a.max=a.rc+(a.rc-a.ef)):
(a.min=a.rc-(a.ie-a.rc),a.max=a.ie);return a};A("X.parserMRC",Uf);A("X.parserMRC.prototype.parse",Uf.prototype.parse);function Vf(){Sd.call(this);this.g="parserNRRD"}C(Vf,Sd);
Vf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.K=c;c=Z(this,"uchar",c.byteLength);var e=c.length,d=t,f=0,g;for(g=1;g<e;g++)if(10==c[g-1]&&10==c[g]){d=Ud(c,0,g-2);f=g+1;break}var h,l,j,k,e=d.split(/\r?\n/),d=0;for(g=e.length;d<g;d++)if(h=e[d],h.match(/NRRD\d+/))this.$i=q;else if(!h.match(/^#/)&&(k=h.match(/(.*):(.*)/)))l=k[1].trim(),h=k[2].trim(),(j=this.Ai[l])?j.call(this,h):this[l]=h;this.$i||n(Error("Not an NRRD file"));"raw"!==this.encoding&&("gzip"!==this.encoding&&"gz"!==this.encoding)&&
n(Error("Only raw or gz/gzip encoding is allowed"));if(!this.ia&&(this.ia=[new S(1,0,0),new S(0,1,0),new S(0,0,1)],this.Uf)){e=[];for(k=0;2>=k;k++)e.push(!isNaN(this.Uf[k])?this.ia[k].scale(this.Uf[k]):p)}f=c.subarray(f);if("gzip"==this.encoding||"gz"==this.encoding)f=(new Nf(new Uint8Array(f))).Yb();f=f.buffer;c={data:t,min:Infinity,max:-Infinity};c.data=new this.Mb(f);k=Td(c.data);f=c.min=k[0];k=c.max=k[1];b.ra=b.ga=f;b.ka=b.fa=k;b.da=[this.Sf[0],this.Sf[1],this.Sf[2]];e=(new S(this.ia[0][0],this.ia[0][1],
this.ia[0][2])).Jb();d=(new S(this.ia[1][0],this.ia[1][1],this.ia[1][2])).Jb();g=(new S(this.ia[2][0],this.ia[2][1],this.ia[2][2])).Jb();b.rb=[e,d,g];-Infinity==b.U&&(b.U=f);Infinity==b.W&&(b.W=k);e=k=1;"left-posterior-superior"==this.zh&&(e=k=-1);f=Bc();"false"==b.reslicing||b.reslicing==u?(T(f,0,k,0,0,0),T(f,1,0,e,0,0),T(f,2,0,0,1,0)):(T(f,0,k*this.ia[0][0],k*this.ia[1][0],k*this.ia[2][0],k*this.Tf[0]),T(f,1,e*this.ia[0][1],e*this.ia[1][1],e*this.ia[2][1],e*this.Tf[1]),T(f,2,1*this.ia[0][2],1*this.ia[1][2],
1*this.ia[2][2],1*this.Tf[2]));T(f,3,0,0,0,1);c.fb=f;c.hb=Ac();Jc(c.fb,c.hb);e=zc(0,0,0,1);k=yc();Lc(f,e,k);d=zc(1,1,1,1);e=yc();Lc(f,d,e);f=Vd(f,b.da);c.Cc=[e[0]-k[0],e[1]-k[1],e[2]-k[2]];c.Ac=[f[1]-f[0]+1,f[3]-f[2]+1,f[5]-f[4]+1];c.Bc=[f[0],f[2],f[4]];b.Hb(c);D.Da(this.g+".parse");b.kb=$d(this,b);c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};
Vf.prototype.Ai={type:function(a){switch(a){case "uchar":case "unsigned char":case "uint8":case "uint8_t":this.Mb=Uint8Array;break;case "signed char":case "int8":case "int8_t":this.Mb=Int8Array;break;case "short":case "short int":case "signed short":case "signed short int":case "int16":case "int16_t":this.Mb=Int16Array;break;case "ushort":case "unsigned short":case "unsigned short int":case "uint16":case "uint16_t":this.Mb=Uint16Array;break;case "int":case "signed int":case "int32":case "int32_t":this.Mb=
Int32Array;break;case "uint":case "unsigned int":case "uint32":case "uint32_t":this.Mb=Uint32Array;break;case "float":this.Mb=Float32Array;break;case "double":this.Mb=Float64Array;break;default:n(Error("Unsupported NRRD data type: "+a))}return this.type=a},endian:function(a){return this.Bl=a},encoding:function(a){return this.encoding=a},dimension:function(a){return this.Zb=parseInt(a,10)},sizes:function(a){var b,c,e,d;e=a.split(/\s+/);d=[];b=0;for(c=e.length;b<c;b++)a=e[b],d.push(parseInt(a,10));
return this.Sf=d},space:function(a){return this.zh=a},"space origin":function(a){return this.Tf=a.split("(")[1].split(")")[0].split(",")},"space directions":function(a){var b,c;a=a.match(/\(.*?\)/g);var e,d,f;f=[];e=0;for(d=a.length;e<d;e++)c=a[e],f.push(function(){var a,d,e,f;e=c.slice(1,-1).split(/,/);f=[];a=0;for(d=e.length;a<d;a++)b=e[a],f.push(parseFloat(b));return f}());return this.ia=f},spacings:function(a){var b;b=a.split(/\s+/);var c,e,d;d=[];c=0;for(e=b.length;c<e;c++)a=b[c],d.push(parseFloat(a));
return this.Uf=d}};A("X.parserNRRD",Vf);A("X.parserNRRD.prototype.parse",Vf.prototype.parse);function Wf(){Sd.call(this);this.g="parserSTL"}C(Wf,Sd);
Wf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.K=c;var e=b.h,d=b.o;if("solid"==Ud(Z(this,"uchar",5))){b.h=e=new W(c.byteLength);b.o=d=new W(c.byteLength);var f=e,e=d,d=Z(this,"uchar",c.byteLength-5);c=d.length;var g=u,h=u,l=0,j;for(j=0;j<c;j++)if(10==d[j]){if(g||h){var k=Ud(d,l,j).split(" "),h=parseFloat(k[0]),m=parseFloat(k[1]),k=parseFloat(k[2]);g?(e.add(h,m,k),e.add(h,m,k),e.add(h,m,k)):f.add(h,m,k);h=g=u}}else 32==d[j-1]&&(102==d[j]?(l=j+=13,g=q):118==d[j]&&(l=j+=7,h=q))}else{this.C=
80;f=Z(this,"uint");b.h=e=new W(9*f);b.o=d=new W(9*f);for(c=c=0;c<f;c++)g=Z(this,"float",12),l=g[0],j=g[1],h=g[2],d.add(l,j,h),d.add(l,j,h),d.add(l,j,h),e.add(g[3],g[4],g[5]),e.add(g[6],g[7],g[8]),e.add(g[9],g[10],g[11]),this.C+=2}D.Da(this.g+".parse");f=new Vc;f.D=b;f.v=a;this.dispatchEvent(f)};A("X.parserSTL",Wf);A("X.parserSTL.prototype.parse",Wf.prototype.parse);function Xf(){Sd.call(this);this.g="parserNII"}C(Xf,Sd);
Xf.prototype.parse=function(a,b,c){if(!Yf(c))try{c=(new Nf(new Uint8Array(c))).Yb().buffer,Yf(c)||(this.Mc=u)}catch(e){this.Mc=u}c=this.wc(c);var d=c.min,f=c.max;b.ra=b.ga=d;b.ka=b.fa=f;-Infinity==b.U&&(b.U=d);Infinity==b.W&&(b.W=f);d=Ac();T(d,3,0,0,0,1);if("false"==b.reslicing||b.reslicing==u){var g=f=1,h=1;0<c.sa[1]&&(f=c.sa[1]);0<c.sa[2]&&(g=c.sa[2]);0<c.sa[2]&&(h=c.sa[3]);0>c.sa[0]&&(h=-h);T(d,0,f,0,0,0);T(d,1,0,g,0,0);T(d,2,0,0,h,0)}else if(0<c.Of){var l=0,j=c.sh,k=c.th,m=c.uh,h=g=f=1,r=c.ph,
s=c.qh,y=c.rh,l=1-(j*j+k*k+m*m);1E-7>l?(l=1/Math.sqrt(j*j+k*k+m*m),j*=l,k*=l,m*=l,l=0):l=Math.sqrt(l);0<c.sa[1]&&(f=c.sa[1]);0<c.sa[2]&&(g=c.sa[2]);0<c.sa[2]&&(h=c.sa[3]);0>c.sa[0]&&(h=-h);T(d,0,(l*l+j*j-k*k-m*m)*f,2*(j*k-l*m)*g,2*(j*m+l*k)*h,r);T(d,1,2*(j*k+l*m)*f,(l*l+k*k-j*j-m*m)*g,2*(k*m-l*j)*h,s);T(d,2,2*(j*m-l*k)*f,2*(k*m+l*j)*g,(l*l+m*m-k*k-j*j)*h,y)}else 0<c.xh?(f=c.Ah,g=c.Bh,h=c.Ch,T(d,0,f[0],f[1],f[2],f[3]),T(d,1,g[0],g[1],g[2],g[3]),T(d,2,h[0],h[1],h[2],h[3])):0==c.Of?(T(d,0,c.sa[1],0,
0,0),T(d,1,0,c.sa[2],0,0),T(d,2,0,0,c.sa[3],0)):window.console.log("UNKNOWN METHOD IN PARSER NII");c.fb=d;c.hb=Ac();Jc(c.fb,c.hb);g=zc(0,0,0,1);f=yc();Lc(d,g,f);h=zc(1,1,1,1);g=yc();Lc(d,h,g);h=[c.Zb[1],c.Zb[2],c.Zb[3]];d=Vd(d,h);c.Cc=[g[0]-f[0],g[1]-f[1],g[2]-f[2]];c.Ac=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];c.Bc=[d[0],d[2],d[4]];b.da=h;b.Hb(c);b.kb=$d(this,b);c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};
Xf.prototype.wc=function(a){this.K=a;a={gk:0,pi:t,qi:t,yi:0,dk:0,Yj:0,ui:t,Zb:t,Wi:0,Xi:0,Yi:0,Ui:0,pf:0,ji:0,lk:0,sa:t,Hh:0,ck:0,bk:0,kk:0,ik:t,wk:t,ki:0,li:0,jk:0,qk:0,Hi:0,Ii:0,si:t,hi:t,Of:0,xh:0,sh:0,th:0,uh:0,ph:0,qh:0,rh:0,Ah:t,Bh:t,Ch:t,Vi:t,cj:t,data:t,min:Infinity,max:-Infinity};a.gk=Z(this,"uint");a.pi=Z(this,"uchar",10);a.qi=Z(this,"uchar",18);a.yi=Z(this,"uint");a.dk=Z(this,"ushort");a.Yj=Z(this,"uchar");a.ui=Z(this,"uchar");a.Zb=Z(this,"ushort",8);a.Wi=Z(this,"float");a.Xi=Z(this,"float");
a.Yi=Z(this,"float");a.Ui=Z(this,"ushort");a.pf=Z(this,"ushort");a.ji=Z(this,"ushort");a.lk=Z(this,"ushort");a.sa=Z(this,"float",8);a.Hh=Z(this,"float");a.ck=Z(this,"float");a.bk=Z(this,"float");a.kk=Z(this,"ushort");a.ik=Z(this,"uchar");a.wk=Z(this,"uchar");a.ki=Z(this,"float");a.li=Z(this,"float");a.jk=Z(this,"float");a.qk=Z(this,"float");a.Hi=Z(this,"uint",1);a.Ii=Z(this,"uint",1);a.si=Z(this,"uchar",80);a.hi=Z(this,"uchar",24);a.Of=Z(this,"ushort");a.xh=Z(this,"ushort");a.sh=Z(this,"float");a.th=
Z(this,"float");a.uh=Z(this,"float");a.ph=Z(this,"float");a.qh=Z(this,"float");a.rh=Z(this,"float");a.Ah=Z(this,"float",4);a.Bh=Z(this,"float",4);a.Ch=Z(this,"float",4);a.Vi=Z(this,"uchar",16);a.cj=Z(this,"uchar",4);this.C=parseInt(a.Hh,10);var b=a.Zb[1]*a.Zb[2]*a.Zb[3];switch(a.pf){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 32:a.data=Z(this,"complex",b);break;case 64:a.data=Z(this,"double",
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:n(Error("Unsupported NII data type: "+a.pf))}b=Td(a.data);a.min=b[0];a.max=b[1];return a};function Yf(a){var b=-1,b="undefined"==typeof DataView?(new Int32Array(a,0,1))[0]:(new DataView(a,0)).getInt32(0,q);return 348==b?q:u}A("X.parserNII",Xf);A("X.parserNII.prototype.parse",Xf.prototype.parse);function Zf(){Sd.call(this);this.g="parserTRK"}C(Zf,Sd);
Zf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");var e=b.h,d=b.o,f=b.qa;this.K=c;Z(this,"uchar",6);Z(this,"ushort",3);var g=Z(this,"float",3);Z(this,"float",3);var h=Z(this,"ushort");Z(this,"uchar",200);var l=Z(this,"ushort");Z(this,"uchar",200);c=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 j=Z(this,"uint");Z(this,"uint");var k=
Z(this,"uint"),m=0===j?Infinity:j,r=[],s=[],j=Infinity,y=-Infinity,z=t,G=t,F=t,H=t,d=e=t,B=Z(this,"uint",(this.K.byteLength-1E3)/4);this.C=k;for(var E=Z(this,"float",(this.K.byteLength-1E3)/4),I=0,k=f=0;k<m;k++){if("undefined"===typeof B[I]){m=k;break}for(var N=B[I],Q=new W(3*N),R=0,O=0;O<N;O++){var ea=E[I+3*O+O*h+1],J=E[I+3*O+O*h+2],aa=E[I+3*O+O*h+3],ea=ea/g[0],J=J/g[1],aa=aa/g[2];Q.add(ea,J,aa);if(0<O)var da=Q.get(O-1),R=R+Math.sqrt(Math.pow(ea-da[0],2)+Math.pow(J-da[1],2)+Math.pow(aa-da[2],2));
O<N-1&&(f+=6)}I+=3*N+N*h+l+1;Z(this,"float",l);O=Q.ob;N=Q.lb;ea=Q.pb;J=Q.mb;aa=Q.qb;da=Q.nb;if(!z||O<z)z=O;if(!G||N>G)G=N;if(!F||ea<F)F=ea;if(!H||J>H)H=J;if(!e||aa<e)e=aa;if(!d||da>d)d=da;r.push(Q);s.push(R)}g=(z+G)/2;h=(F+H)/2;F=(e+d)/2;l=new Float32Array(f);b.h=e=new W(f);b.o=d=new W(f);b.qa=f=new W(f);for(k=H=0;k<m;k++){z=r[k];G=z.count;R=s[k];j=Math.min(j,R);y=Math.max(y,R);for(O=0;O<G-1;O++){E=z.get(O);B=z.get(O+1);e.add(E[0],E[1],E[2]);e.add(B[0],B[1],B[2]);var I=E[0]-g,Q=E[1]-h,N=E[2]-F,ea=
Math.sqrt(I*I+Q*Q+N*N),J=B[0]-g,aa=B[1]-h,da=B[2]-F,U=Math.sqrt(J*J+aa*aa+da*da);d.add(I/ea,Q/ea,N/ea);d.add(J/U,aa/U,da/U);B=[Math.abs(B[0]-E[0]),Math.abs(B[1]-E[1]),Math.abs(B[2]-E[2])];E=Math.sqrt(B[0]*B[0]+B[1]*B[1]+B[2]*B[2]);B[0]/=E;B[1]/=E;B[2]/=E;f.add(B[0],B[1],B[2]);f.add(B[0],B[1],B[2]);l[H++]=R;l[H++]=R;l[H++]=R;l[H++]=R;l[H++]=R;l[H++]=R}}b.Ia="LINES";m=new Tc;m.ra=j;m.ka=y;m.U=j;m.W=y;m.dd=l;m.vg=u;m.j=q;b.G=m;j=u;for(k=0;16>k;k++)if(0!=c[k]){j=q;break}j==u&&(c[0]=c[5]=c[10]=c[15]=1);
D.Da(this.g+".parse");D.f.Xf(c,b.la.Q);c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};A("X.parserTRK",Zf);A("X.parserTRK.prototype.parse",Zf.prototype.parse);function $f(){Sd.call(this);this.g="parserOBJ"}C($f,Sd);
$f.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.K=c;c=c.byteLength;var e=Z(this,"uchar",c),d=[];b.h=new W(c);b.o=new W(c);var f=b.h,g=b.o,h=0,l;for(l=0;l<c;++l)if(10==e[l]){var j=Ud(e,h,l).replace(/\s{2,}/g," ").split(" ");if("v"==j[0])d.push([parseFloat(j[1]),parseFloat(j[2]),parseFloat(j[3])]);else if("f"==j[0]){var k=d[parseInt(j[1],10)-1],h=d[parseInt(j[2],10)-1],j=d[parseInt(j[3],10)-1];f.add(k[0],k[1],k[2]);f.add(h[0],h[1],h[2]);f.add(j[0],j[1],j[2]);k=new S(k[0],k[1],k[2]);j=
new S(j[0],j[1],j[2]);h=rc((new S(h[0],h[1],h[2])).wa(k),j.wa(k));h.normalize();g.add(h.x,h.y,h.d);g.add(h.x,h.y,h.d);g.add(h.x,h.y,h.d)}h=l+1}D.Da(this.g+".parse");c=new Vc;c.D=b;c.v=a;this.dispatchEvent(c)};A("X.parserOBJ",$f);A("X.parserOBJ.prototype.parse",$f.prototype.parse);function ag(){M.call(this);this.g="loader";this.Kc=new ic;this.td=0}C(ag,M);function bg(a,b){a.td+=b/a.Kc.sf()/3;a.td=Math.min(1,a.td);var c=new Od;c.Ad=a.td;a.dispatchEvent(c)}function cg(a){a=a.r.$d;var b=a.split(".").pop().toUpperCase();b==a.toUpperCase()&&(b="");b in dg||n(Error("The "+b+" file format is not supported."));return[a,b,dg[b][0],dg[b][1],dg[b][2]]}
ag.prototype.load=function(a,b){(!a||!b)&&n(Error("No container or object to load."));if(!lc(this.Kc.ha,a.ja)||this.Kc.get(a.ja)){this.Kc.set(a.ja,u);var c=cg(a)[0];if(a.ab!=t)this.parse(t,a,b);else{var e=new XMLHttpRequest;L(e,"abort",this.Jg.bind(this,e,a,b));L(e,"error",this.Jg.bind(this,e,a,b));L(e,"load",this.parse.bind(this,e,a,b));e.open("GET",c,q);e.responseType="arraybuffer";e.send(t)}}};
ag.prototype.parse=function(a,b,c){bg(this,1);setTimeout(function(){var e=cg(b),d=e[3],e=new e[2];Ub(e,yd,this.complete.bind(this));var f=b.ab;f==t&&(f=a.response,b.ab=f);e.parse(b,c,f,d)}.bind(this),100)};ag.prototype.complete=function(a){bg(this,1);setTimeout(function(){var b=a.v,c=a.D;b.r.j=u;b.j=q;c.q();this.Kc.set(b.ja,q)}.bind(this),100)};ag.prototype.Jg=function(a,b,c){n(Error("Loading failed: ",b,c))};
var dg={OBJ:[$f,t],OFF:[bf,t],STL:[Wf,t],VTK:[ef,t],TRK:[Zf,t],MRC:[Uf,t],ST:[Uf,t],FSM:[gf,t],INFLATED:[gf,t],SMOOTHWM:[gf,t],SPHERE:[gf,t],PIAL:[gf,t],ORIG:[gf,t],NRRD:[Vf,t],NII:[Xf,t],GZ:[Xf,t],DCM:[cf,t],DICOM:[cf,t],"":[cf,t],CRV:[Pf,t],LABEL:[ae,t],MGH:[Of,u],MGZ:[Of,q],RAW:[Rf,u],RZ:[Rf,q],TXT:[Tf,t],LUT:[Tf,t],PNG:[Sf,"png"],JPG:[Sf,"jpeg"],JPEG:[Sf,"jpeg"],GIF:[Sf,"gif"]};function eg(a,b){(!x(a)||!x(b))&&n(Error("A camera needs valid width and height values."));M.call(this);this.g="camera";this.jc=new D.m(0,100,0);this.Fc=new D.m(0,0,0);this.V=new D.m(0,0,1);this.L=a;this.A=b;this.n=this.ve(this.jc,this.Fc)}C(eg,M);eg.prototype.observe=function(a){(a==t||!(a instanceof Se))&&n(Error("Could not observe the interactor."));L(a,td,this.Fj.bind(this));L(a,sd,this.Cj.bind(this));L(a,ud,this.Sj.bind(this))};
eg.prototype.Fj=function(a){a instanceof Id||n(Error("Received no valid rotate event."));this.rotate(a.ya)};eg.prototype.Sj=function(a){a instanceof Jd||n(Error("Received no valid zoom event."));a.wb?this.ag(a.jb):this.bg(a.jb)};eg.prototype.Cj=function(a){a instanceof Hd||n(Error("Received no valid pan event."));this.Lf(a.ya)};eg.prototype.__defineGetter__("view",v("n"));
eg.prototype.__defineSetter__("view",function(a){(a==t||!(a instanceof Float32Array))&&n(Error("Invalid view matrix."));this.n=a});eg.prototype.__defineGetter__("position",function(){return[this.jc.x,this.jc.y,this.jc.d]});eg.prototype.__defineSetter__("position",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid position."));this.jc=new D.m(a[0],a[1],a[2]);this.reset()});eg.prototype.__defineGetter__("focus",function(){return[this.Fc.x,this.Fc.y,this.Fc.d]});
eg.prototype.__defineSetter__("focus",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid focus"));this.Fc=new D.m(a[0],a[1],a[2]);this.reset()});eg.prototype.__defineGetter__("up",function(){return[this.V.x,this.V.y,this.V.d]});eg.prototype.__defineSetter__("up",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid up vector."));this.V=new D.m(a[0],a[1],a[2]);this.reset()});w=eg.prototype;w.reset=function(){this.n=this.ve(this.jc,this.Fc)};
w.rotate=function(a){ka(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||n(Error("Invalid distance vector for rotate operation."));return a};w.Lf=function(a){ka(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||n(Error("Invalid distance vector for pan operation."));this.n[12]-=a.x;this.n[13]+=a.y};w.ag=function(a){var b=20;a!=t&&!a&&(b=1);this.n[14]+=b};w.bg=function(a){var b=20;a!=t&&!a&&(b=1);this.n[14]-=b};
w.ve=function(a,b){(!(a instanceof D.m)||!(b instanceof D.m))&&n(Error("3D vectors required for calculating the view."));return D.f.Ed()};A("X.camera",eg);A("X.camera.prototype.pan",eg.prototype.Lf);A("X.camera.prototype.rotate",eg.prototype.rotate);A("X.camera.prototype.zoomIn",eg.prototype.ag);A("X.camera.prototype.zoomOut",eg.prototype.bg);function fg(a){function b(a,b,e){b=2*b*Math.PI;b=Zc($c(l,Math.cos(b)),$c(j,Math.sin(b)));a=Zc(Zc(c,$c(d,a)),$c(b,f));e=Zc($c(b,1-Math.abs(e)),$c(g,e));return new dd(a,e)}this.Z=[];a=a||{};var c=new Yc(a.start||[0,-1,0]),e=new Yc(a.end||[0,1,0]),d=ad(e,c),f=a.Ab||1;a=a.ta||16;for(var g=bd(d),h=0.5<Math.abs(g.y()),l=bd((new Yc(h,!h,0)).tc(g)),j=bd(l.tc(g)),h=new dd(c,cd(g)),e=new dd(e,bd(g)),k=[],m=0;m<a;m++){var r=m/a,s=(m+1)/a;k.push(new fd([h,b(0,r,-1),b(0,s,-1)]));k.push(new fd([b(0,s,0),b(0,r,
0),b(1,r,0),b(1,s,0)]));k.push(new fd([e,b(1,s,1),b(1,r,1)]))}return nd(k)}C(fg,md);function gg(){Y.call(this);this.g="cylinder";this.af=[-10,-10,-10];this.Le=[10,10,10];this.kc=10;this.eb=32;ya(this,new od)}C(gg,Y);gg.prototype.__defineGetter__("start",v("af"));gg.prototype.__defineSetter__("start",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid start"));this.af=a});gg.prototype.__defineGetter__("end",v("Le"));gg.prototype.__defineSetter__("end",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid end"));this.Le=a});gg.prototype.__defineGetter__("radius",v("kc"));
gg.prototype.__defineSetter__("radius",function(a){x(a)||n(Error("Invalid radius."));this.kc=a});gg.prototype.q=function(){qd(this,new fg({start:this.af,end:this.Le,Ab:this.kc,ta:this.eb}));gg.w.q.call(this)};A("X.cylinder",gg);A("X.cylinder.prototype.modified",gg.prototype.q);function hg(a){function b(a,b){a*=2*Math.PI;b*=Math.PI;var d=new Yc(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));g.push(new dd(Zc(c,$c(d,e)),d))}this.Z=[];a=a||{};var c=new Yc(a.lf||[0,0,0]),e=a.Ab||1,d=a.ta||16;a=a.mk||8;for(var f=[],g=[],h=0;h<d;h++)for(var l=0;l<a;l++)g=[],b(h/d,l/a),0<l&&b((h+1)/d,l/a),l<a-1&&b((h+1)/d,(l+1)/a),b(h/d,(l+1)/a),f.push(new fd(g));return nd(f)}C(hg,md);function ig(){Y.call(this);this.g="sphere";this.u=[0,0,0];this.kc=5;this.eb=32;this.$h=16;ya(this,new od)}C(ig,Y);ig.prototype.__defineGetter__("center",v("u"));ig.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center"));this.u=a});ig.prototype.__defineGetter__("radius",v("kc"));ig.prototype.__defineSetter__("radius",function(a){x(a)||n(Error("Invalid radius."));this.kc=a});
ig.prototype.q=function(){qd(this,new hg({lf:this.u,Ab:this.kc,ta:this.eb,mk:this.$h}));ig.w.q.call(this)};A("X.sphere",ig);A("X.sphere.prototype.modified",ig.prototype.q);function Ye(a){P.call(this);this.g="labelmap";this.zb=a;this.$e=new Float32Array([-255,-255,-255,-255])}C(Ye,P);Ye.prototype.q=function(){var a=new Vc;a.D=this;this.dispatchEvent(a);this.zb.q()};Ye.prototype.__defineSetter__("showOnly",function(a){var b=[-1,-1,-1,-1];a!=t&&(ka(a)&&4==a.length?b=a:(this.xa||n(Error("No colortable assigned.")),b=this.xa.Ka.get(a).slice(1,5)));this.$e=new Float32Array([Math.floor(255*b[0]),Math.floor(255*b[1]),Math.floor(255*b[2]),Math.floor(255*b[3])])});
A("X.labelmap",Ye);function jg(a){this.Z=[];a=a||{};var b=new Yc(a.lf||[0,0,0]),c=!a.Ab?[1,1,1]:a.Ab.length?a.Ab:[a.Ab,a.Ab,a.Ab];return nd([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(function(a){return new fd(a[0].map(function(d){d=new Yc(b.x()+c[0]*(2*!!(d&1)-1),b.y()+c[1]*(2*!!(d&2)-1),b.d()+c[2]*(2*!!(d&4)-1));return new dd(d,new Yc(a[1]))}))}))}C(jg,md);function kg(){Y.call(this);this.g="cube";this.u=[0,0,0];this.Qe=this.Pe=this.Oe=20;this.oc=[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];ya(this,new od)}C(kg,Y);kg.prototype.__defineGetter__("center",v("u"));kg.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center"));this.u=a});kg.prototype.__defineGetter__("lengthX",v("Oe"));
kg.prototype.__defineSetter__("lengthX",function(a){x(a)||n(Error("Invalid lengthX."));this.Oe=a});kg.prototype.__defineGetter__("lengthY",v("Pe"));kg.prototype.__defineSetter__("lengthY",function(a){x(a)||n(Error("Invalid lengthY."));this.Pe=a});kg.prototype.__defineGetter__("lengthZ",v("Qe"));kg.prototype.__defineSetter__("lengthZ",function(a){x(a)||n(Error("Invalid lengthZ."));this.Qe=a});kg.prototype.q=function(){qd(this,new jg({lf:this.u,Ab:[this.Oe/2,this.Pe/2,this.Qe/2]}));kg.w.q.call(this)};
A("X.cube",kg);A("X.cube.prototype.modified",kg.prototype.q);function Ue(a){Se.call(this,a);this.g="interactor3D";this.nl=u}C(Ue,Se);Ue.prototype.Kd=function(a){Ue.w.Kd.call(this,a);var b=new Jd;a.Xc==t&&(a.Xc=0);b.wb=0>a.Xc;b.jb=q;this.dispatchEvent(b)};function lg(a){M.call(this);this.g="array";this.F=[];this.dg=a}C(lg,M);function mg(a,b,c){for(var e=0;4>e;e++)if(a[e+0]!==b[e+c])return u;return q}lg.prototype.add=function(a){this.F.push(a);return q};lg.prototype.remove=function(a){a=this.F.indexOf(a);-1<a&&this.F.splice(a,1);return q};lg.prototype.clear=function(){this.F.length=0};
function ng(a,b,c){var e=c-b;if(!(2>e)){e=b+Math.floor(e/2);ng(a,b,e);for(ng(a,e,c);b<e;++b)if(0<a.dg(a.F[b],a.F[e])){var d=a.F[b];a.F[b]=a.F[e];for(var f=a,g=e,h=c;g+1<h&&0>f.dg(f.F[g+1],d);){var l=f,j=g+1,k=l.F[g];l.F[g]=l.F[j];l.F[j]=k;++g}f.F[g]=d}}}lg.prototype.sort=function(){ng(this,0,this.F.length)};function og(a,b){eg.call(this,a,b);this.g="camera2D"}C(og,eg);og.prototype.rotate=function(a){a=og.w.rotate.call(this,a);var b=new Gd;0<a.x?b.cf--:0>a.x&&b.cf++;0<a.y?b.Re++:0>a.y&&b.Re--;this.dispatchEvent(b)};og.prototype.ag=function(a){var b=20;a!=t&&!a&&(b=0.02);this.n[14]+=b};og.prototype.bg=function(a){var b=20;a!=t&&!a&&(b=0.02);this.n[14]-=b};
og.prototype.Lf=function(a){ka(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||n(Error("Invalid distance vector for pan operation."));this.n[12]-=a.x/this.n[14];this.n[13]+=a.y/this.n[14]};function pg(a,b){eg.call(this,a,b);this.g="camera3D";this.fg=45;this.ae=D.f.yf(D.f.Ed(),this.fg,a/b,1,1E4)}C(pg,eg);pg.prototype.rotate=function(a){a=pg.w.rotate.call(this,a);var b=-a.x/5*Math.PI/180;a=-a.y/5*Math.PI/180;var c=new D.m(this.n[1],this.n[5],this.n[9]),e=new D.m(this.n[0],this.n[4],this.n[8]);c.normalize();e.normalize();D.f.rotate(this.n,b,c.x,c.y,c.d);D.f.rotate(this.n,a,e.x,e.y,e.d)};pg.prototype.ve=function(a,b){var c=pg.w.ve.call(this,a,b);D.f.Yg(c,a,b,this.V);return c};
function qg(a,b,c,e){var d=new Float32Array(4),f=new Float32Array(4),g=new Float32Array(16),h=new Float32Array(16);new Float32Array(16);D.f.multiply(a.ae,a.n,h);D.f.Y(h,g);d[0]=b;d[1]=c;d[2]=2*e-1;d[3]=1;D.f.Af(g,d,f);f[3]=1/f[3];f[0]*=f[3];f[1]*=f[3];f[2]*=f[3];return f}A("X.camera3D",pg);function rg(a){Ib.call(this);this.Ib=a;this.T=[]}C(rg,Ib);var sg=[];function tg(a,b,c,e,d){ka(c)||(sg[0]=c,c=sg);for(var f=0;f<c.length;f++){var g=L(b,c[f],e||a,d||u,a.Ib||a);a.T.push(g)}}rg.prototype.Pf=function(){Db(this.T,Wb);this.T.length=0};rg.prototype.handleEvent=function(){n(Error("EventHandler.handleEvent not implemented"))};function ug(){}ug.Lg=function(){return ug.Tg?ug.Tg:ug.Tg=new ug};ug.prototype.mj=0;ug.Lg();function vg(a){dc.call(this);this.$b=a||he();this.$j=wg}C(vg,dc);vg.prototype.Qi=ug.Lg();var wg=t;w=vg.prototype;w.Sg=t;w.Zc=u;w.I=t;w.$j=t;w.Ld=t;w.Cd=t;w.mf=t;w.t=v("I");w.Rf=function(a){this.Ld&&this.Ld!=a&&n(Error("Method not supported"));vg.w.Rf.call(this,a)};w.oe=v("$b");w.Wc=function(){this.I=this.$b.createElement("div")};w.cc=function(a){this.dc(a)};
w.dc=function(a,b){this.Zc&&n(Error("Component already rendered"));this.I||this.Wc();a?a.insertBefore(this.I,b||t):this.$b.ma.body.appendChild(this.I);(!this.Ld||this.Ld.Zc)&&this.le()};w.le=function(){function a(a){!a.Zc&&a.t()&&a.le()}this.Zc=q;this.Cd&&Db(this.Cd,a,p)};w.me=function(){function a(a){a.Zc&&a.me()}this.Cd&&Db(this.Cd,a,p);this.Ji&&this.Ji.Pf();this.Zc=u};
w.removeChild=function(a,b){if(a){var c=na(a)?a:a.Sg||(a.Sg=":"+(a.Qi.mj++).toString(36)),e;this.mf&&c?(e=this.mf,e=(c in e?e[c]:p)||t):e=t;a=e;c&&a&&(e=this.mf,c in e&&delete e[c],Gb(this.Cd,a),b&&(a.me(),a.I&&pe(a.I)),c=a,c==t&&n(Error("Unable to set parent component")),c.Ld=t,vg.w.Rf.call(c,t))}a||n(Error("Child is not in parent component"));return a};function xg(){dc.call(this)}C(xg,dc);w=xg.prototype;w.Zf=0;w.Gd=0;w.zf=100;w.Ig=0;w.Vf=1;w.Zi=u;w.jj=u;w.Od=function(a){a=yg(this,a);this.Zf!=a&&(this.Zf=a+this.Ig>this.zf?this.zf-this.Ig:a<this.Gd?this.Gd:a,!this.Zi&&!this.jj&&this.dispatchEvent("change"))};w.re=function(){return yg(this,this.Zf)};w.qe=function(){return yg(this,this.Gd)};w.pe=function(){return yg(this,this.zf)};function yg(a,b){return a.Vf==t?b:a.Gd+Math.round((b-a.Gd)/a.Vf)*a.Vf};function zg(a){vg.call(this,a);this.Md=new xg;L(this.Md,"change",this.Ki,u,this)}C(zg,vg);var Ag={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};w=zg.prototype;w.Wc=function(){this.Bb=this.oe().Wc("div","progress-bar-thumb");var a=Ag[this.mh];this.I=this.oe().Wc("div",a,this.Bb);Cg(this);a=this.qe();this.t().setAttribute("aria-valuemin",a);a=this.pe();this.t().setAttribute("aria-valuemax",a)};
w.le=function(){zg.w.le.call(this);K&&7>kb&&L(this.t(),"resize",this.Ge,u,this);this.Ge();var a=this.t();a.setAttribute("role","progressbar");a.setAttribute("aria-live","polite")};w.me=function(){zg.w.me.call(this);K&&7>kb&&Vb(this.t(),"resize",this.Ge,u,this)};w.re=function(){return this.Md.re()};w.Od=function(a){this.Md.Od(a);this.t()&&Cg(this)};function Cg(a){var b=a.re();a.t().setAttribute("aria-valuenow",b)}w.qe=function(){return this.Md.qe()};w.pe=function(){return this.Md.pe()};w.mh="horizontal";
w.Ki=function(){this.Ge();this.dispatchEvent("change")};w.Ge=function(){if(this.Bb){var a=this.qe(),b=this.pe(),a=(this.re()-a)/(b-a),b=Math.round(100*a);"vertical"==this.mh?K&&7>kb?(this.Bb.style.top=0,this.Bb.style.height="100%",b=this.Bb.offsetHeight,a=Math.round(a*b),this.Bb.style.top=b-a+"px",this.Bb.style.height=a+"px"):(this.Bb.style.top=100-b+"%",this.Bb.style.height=b+"%"):this.Bb.style.width=b+"%"}};function Dg(a,b){a==t&&n(Error("No valid parent element."));b==t&&n(Error("Invalid initial value."));zg.call(this);this.g="progressbar";this.cb=a;this.Ve="";this.Td=this.Gb=t;this.gc=[];var c;c=".progress-bar-horizontal {\n position: relative;\n border: 1px solid #949dad;\n";c+=" background: white;\n";c+=" padding: 1px;\n";c+=" overflow: hidden;\n";c+=" margin: 2px;\n";c+=" width: 100px;\n";c+=" height: 5px;\n";c+="}";var e;e=".progress-bar-thumb {\n position: relative;\n background: #F62217;\n";
e+=" overflow: hidden;\n";e+=" width: 0%;\n";e+=" height: 100%;\n";e+="}";var d;d=".progress-bar-thumb-done {\n background: #57E964;\n}";this.gc=[c,e,d];this.Od(b);this.uf()}C(Dg,zg);
Dg.prototype.uf=function(){var a=xe(this.cb,"position");if("static"==a||""==a)this.Ve=this.cb.style.position,this.cb.style.position="relative";var a=document.getElementsByTagName("head")[0],b=me("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.gc[0])),e=document.createTextNode(String(this.gc[1])),d=document.createTextNode(String(this.gc[2]));a.appendChild(b);b.appendChild(c);b.appendChild(e);b.appendChild(d);this.Gb=b;this.cc(this.cb);a=this.t();a.style.position=
"absolute";a.style.top=(this.cb.clientHeight-5)/2+"px";a.style.left=(this.cb.clientWidth-100)/2+"px";a.classList.add("xtk-progress-bar")};function Eg(a){var b=a.t().style.top,c=a.t().style.left;pe(a.t());var e=new Dg(a.cb,100),d=e.t();d.style.position="absolute";d.style.top=b;d.style.left=c;d.classList.add("xtk-progress-bar");(d.firstElementChild!=p?d.firstElementChild:qe(d.firstChild)).classList.add("progress-bar-thumb-done");a.Td=e}
Dg.prototype.Fd=function(){this.Gb&&pe(this.Gb);this.t()&&pe(this.t());this.Td&&pe(this.Td.t());this.Td=this.Gb=t;this.Ve&&(this.cb.style.position=this.Ve)};function Fg(a,b,c){oa(a)?c&&(a=va(a,c)):a&&"function"==typeof a.handleEvent?a=va(a.handleEvent,a):n(Error("Invalid listener argument"));return 2147483647<b?-1:ga.setTimeout(a,b||0)};function Gg(){M.call(this);this.g="renderer";this.v=window.document.body;this.L=this.v.clientWidth;this.A=this.v.clientHeight;this.S=this.J=this.ca=t;this.bb=new lg(Xc);this.Ha=[];this.aa=t;this.Zd=this.hd=this.Xd=u;this.a=this.Vb=this.La=t;this.R={PROGRESSBAR_ENABLED:q,INTERMEDIATE_RENDERING:u,SLICENAVIGATORS:q};this.Ie=-1;window.console.log("XTK release 10 -- 2021-12-14 14:05:35 -- http://www.goXTK.com -- @goXTK")}C(Gg,M);w=Gg.prototype;
w.Ff=function(){window.cancelAnimationFrame(this.Ie);this.R.PROGRESSBAR_ENABLED&&(this.Vb=new Dg(this.v,3))};w.Gf=function(){this.R.PROGRESSBAR_ENABLED&&this.Vb&&(Eg(this.Vb),this.Qd=Fg(function(){this.Qd=t;this.Vb&&(this.Vb.Fd(),this.Vb=t);this.hd=this.Zd=q;this.cc()}.bind(this),700))};w.Hf=function(a){this.Vb&&this.Vb.Od(100*a.Ad)};w.Dj=function(a){this.La&&this.La.Od(100*a.Ad)};w.tj=function(a){a!=t&&a instanceof Vc&&a.D&&this.vb(a.D)};w.Ej=function(a){a!=t&&a instanceof Wc&&a.D&&this.remove(a.D)};
w.Jf=function(a){(a==t||!(a instanceof Ld))&&n(Error("Invalid hover event."))};w.we=function(){this.Xa()};w.Xa=function(){var a=ke(this.v);this.L=a.clientWidth;this.A=a.clientHeight;a=ke(this.ca);a.width=this.L;a.height=this.A;"renderer3D"==this.g&&(this.a.viewport(0,0,this.L,this.A),this.J.ae=D.f.yf(D.f.Ed(),this.J.fg,this.ca.width/this.ca.height,1,1E4))};w.Kf=function(a){(a==t||!(a instanceof Kd))&&n(Error("Invalid scroll event."))};Gg.prototype.__defineGetter__("config",v("R"));
Gg.prototype.__defineGetter__("interactor",v("S"));Gg.prototype.__defineGetter__("camera",v("J"));Gg.prototype.__defineGetter__("loadingCompleted",v("hd"));Gg.prototype.__defineGetter__("container",v("v"));Gg.prototype.__defineSetter__("container",function(a){a==t&&n(Error("An ID to a valid container (<div>..) is required."));var b=a;na(b)&&(b=ke(a));pa(b)&&1==b.nodeType||n(Error("Could not find the given container."));this.v=b});w=Gg.prototype;w.Nd=function(){this.J.reset()};
w.Ca=function(a){var b=me("canvas");this.v.appendChild(b);this.L=this.v.clientWidth;this.A=this.v.clientHeight;b.width=this.L;b.height=this.A;try{var c=b.getContext(a);c||n(Error())}catch(e){var d="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.v.innerHTML='<h3 style="color:red;font-family:sans-serif;">Oooops..</h3><p style="color:red;font-family:sans-serif;">'+d+"</p>";
n(Error(d))}this.aa=new ag;L(this.aa,Ad,this.Dj.bind(this));this.ca=b;this.a=c;b=new Ue(this.ca);"2d"==a&&(b=new We(this.ca));b.Ca();L(b,wd,this.Nd.bind(this));L(b,Bd,this.Jf.bind(this));L(b,vd,this.Kf.bind(this));this.S=b;b=new pg(this.L,this.A);"2d"==a&&(b=new og(this.L,this.A));b.observe(this.S);this.J=b;L(window,"resize",this.we,u,this)};w.add=function(a){(a instanceof kg||a instanceof ig||a instanceof gg)&&a.q();this.Ha.push(a);this.vb(a)};
w.remove=function(a){(!this.ca||!this.a)&&n(Error("The renderer was not initialized properly."));if(a!=t){Yb(a);var b=this.Ha.length,c;for(c=0;c<b;c++)if(this.Ha[c].ja==a.ja)return this.Ha[c]=t,this.Ha.splice(c,1),q}return u};w.vb=function(a){(!this.ca||!this.a)&&n(Error("The renderer was not initialized properly."));a!=t&&(Zb(a,yd)||L(a,yd,this.tj.bind(this)),Zb(a,zd)||L(a,zd,this.Ej.bind(this)),Zb(a,Dd)||L(a,Dd,this.Ff.bind(this)),Zb(a,Fd)||L(a,Fd,this.Hf.bind(this)),Zb(a,Ed)||L(a,Ed,this.Gf.bind(this)))};
w.get=function(a){a==t&&n(Error("Invalid object id."));for(var b=this.bb.F,c=b.length,e=0,e=0;e<c;e++)if(b[e].ja==a)return b[e];return t};
w.cc=function(){(!this.ca||!this.a)&&n(Error("The renderer was not initialized properly."));if(this.ug==t){if(kc(this.aa.Kc)){if(this.R.PROGRESSBAR_ENABLED&&!this.La&&(this.La=new Dg(this.v,3)),this.Zd=this.hd=u,this.ug=Fg(function(){this.ug=t;this.cc()}.bind(this),100),!this.R.INTERMEDIATE_RENDERING)return}else if(!this.hd&&!this.Zd&&(this.Zd=q,eval("this.onShowtime()"),this.hd=q),this.La){this.R.PROGRESSBAR_ENABLED&&(this.La&&!this.Qd)&&(Eg(this.La),this.Qd=Fg(function(){this.Qd=t;this.La&&(this.La.Fd(),
this.La=t);this.cc()}.bind(this),700));return}this.Ie=window.requestAnimationFrame(this.cc.bind(this));eval("this.onRender()");this.dc(u,q);eval("this.afterRender()")}};w.lh=ba();w.jh=ba();w.zg=ba();w.dc=ba();
w.Ta=function(){Yb(this);Vb(window,"resize",this.we,u,this);window.cancelAnimationFrame(this.Ie);this.aa&&(delete this.aa,this.aa=t);this.La&&(this.La.Fd(),delete this.La,this.La=t);this.bb.clear();delete this.bb;this.Ha.length=0;delete this.Ha;delete this.aa;this.aa=t;delete this.J;this.J=t;delete this.S;this.S=t;delete this.a;this.a=t;pe(this.ca);delete this.ca;this.ca=t};function Hg(a,b,c,e,d,f,g,h){var l,j;if(l=c.offsetParent){var k="HTML"==l.tagName||"BODY"==l.tagName;if(!k||"static"!=ye(l,"position"))j=De(l),k||(k=(k=Ee(l))&&db?-l.scrollLeft:k&&(!K||!wb("8"))&&"visible"!=ye(l,"overflowX")?l.scrollWidth-l.clientWidth-l.scrollLeft:l.scrollLeft,j=ge(j,new fe(k,l.scrollTop)))}l=j||new fe;j=De(a);k=Ie(a);j=new ve(j.x,j.y,k.width,k.height);(k=Ce(a))&&j.Ug(new ve(k.left,k.top,k.right-k.left,k.bottom-k.top));var k=he(a),m=he(c);if(k.ma!=m.ma){var r=k.ma.body,m=m.ma.parentWindow||
m.ma.defaultView,s=new fe(0,0),y=je(r)?je(r).parentWindow||je(r).defaultView:window,z=r;do{var G=y==m?De(z):Fe(z);s.x+=G.x;s.y+=G.y}while(y&&y!=m&&(z=y.frameElement)&&(y=y.parent));r=ge(s,De(r));K&&!se(k)&&(r=ge(r,te(k)));j.left+=r.x;j.top+=r.y}a=(b&4&&Ee(a)?b^2:b)&-5;b=new fe(a&2?j.left+j.width:j.left,a&1?j.top+j.height:j.top);b=ge(b,l);d&&(b.x+=(a&2?-1:1)*d.x,b.y+=(a&1?-1:1)*d.y);var F;if(g&&(F=Ce(c)))F.top-=l.y,F.right-=l.x,F.bottom-=l.y,F.left-=l.x;return Ig(b,c,e,f,F,g,h)}
function Ig(a,b,c,e,d,f,g){a=a.l();var h=0,l=(c&4&&Ee(b)?c^2:c)&-5;c=Ie(b);g=g?g.l():c.l();if(e||0!=l)l&2?a.x-=g.width+(e?e.right:0):e&&(a.x+=e.left),l&1?a.y-=g.height+(e?e.bottom:0):e&&(a.y+=e.top);if(f){if(d){h=a;e=0;if(65==(f&65)&&(h.x<d.left||h.x>=d.right))f&=-2;if(132==(f&132)&&(h.y<d.top||h.y>=d.bottom))f&=-5;h.x<d.left&&f&1&&(h.x=d.left,e|=1);h.x<d.left&&(h.x+g.width>d.right&&f&16)&&(g.width=Math.max(g.width-(h.x+g.width-d.right),0),e|=4);h.x+g.width>d.right&&f&1&&(h.x=Math.max(d.right-g.width,
d.left),e|=1);f&2&&(e|=(h.x<d.left?16:0)|(h.x+g.width>d.right?32:0));h.y<d.top&&f&4&&(h.y=d.top,e|=2);h.y<=d.top&&(h.y+g.height<d.bottom&&f&32)&&(g.height=Math.max(g.height-(d.top-h.y),0),h.y=0,e|=8);h.y>=d.top&&(h.y+g.height>d.bottom&&f&32)&&(g.height=Math.max(g.height-(h.y+g.height-d.bottom),0),e|=8);h.y+g.height>d.bottom&&f&4&&(h.y=Math.max(d.bottom-g.height,d.top),e|=2);f&8&&(e|=(h.y<d.top?64:0)|(h.y+g.height>d.bottom?128:0));h=e}else h=256;if(h&496)return h}f=a;d=db&&(Va||hb)&&wb("1.9");f instanceof
fe?(a=f.x,f=f.y):(a=f,f=p);b.style.left=He(a,d);b.style.top=He(f,d);if(!(c==g||(!c||!g?0:c.width==g.width&&c.height==g.height)))a=se(he(je(b))),K&&(!a||!wb("8"))?(c=b.style,a?(K?(a=Me(b,"paddingLeft"),d=Me(b,"paddingRight"),f=Me(b,"paddingTop"),e=Me(b,"paddingBottom"),a=new ue(f,d,e,a)):(a=xe(b,"paddingLeft"),d=xe(b,"paddingRight"),f=xe(b,"paddingTop"),e=xe(b,"paddingBottom"),a=new ue(parseFloat(f),parseFloat(d),parseFloat(e),parseFloat(a))),K?(d=Oe(b,"borderLeft"),f=Oe(b,"borderRight"),e=Oe(b,"borderTop"),
b=Oe(b,"borderBottom"),b=new ue(e,f,b,d)):(d=xe(b,"borderLeftWidth"),f=xe(b,"borderRightWidth"),e=xe(b,"borderTopWidth"),b=xe(b,"borderBottomWidth"),b=new ue(parseFloat(e),parseFloat(f),parseFloat(b),parseFloat(d))),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,db?b.MozBoxSizing="border-box":eb?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 Jg(){}Jg.prototype.ub=ba();function Kg(a,b){this.nf=a instanceof fe?a:new fe(a,b)}C(Kg,Jg);Kg.prototype.ub=function(a,b,c,e){Hg(ze(a),0,a,b,this.nf,c,t,e)};function Lg(a,b,c){this.element=a;this.Gg=b;this.Tj=c}C(Lg,Jg);Lg.prototype.ub=function(a,b,c){Hg(this.element,this.Gg,a,b,p,c,this.Tj)};function Mg(a,b){dc.call(this);this.Ib=new rg(this);this.Qf(a||t);b&&(this.$c=b)}C(Mg,dc);w=Mg.prototype;w.I=t;w.gi=q;w.Ag=t;w.Ma=u;w.ek=u;w.wf=-1;w.Xg=-1;w.Pi=u;w.wi=q;w.$c="toggle_display";w.t=v("I");w.Qf=function(a){this.Ma&&n(Error("Can not change this state of the popup while showing."));this.I=a};
function Ng(a,b){a.Fe&&a.Fe.stop();a.se&&a.se.stop();if(b){if(!a.Ma&&a.Ef()){a.I||n(Error("Caller must call setElement before trying to show the popup"));a.ub();var c=je(a.I);a.Pi&&tg(a.Ib,c,"keydown",a.rj,q);if(a.gi)if(tg(a.Ib,c,"mousedown",a.hh,q),K){var e;try{e=c.activeElement}catch(d){}for(;e&&"IFRAME"==e.nodeName;){try{var f=e.contentDocument||e.contentWindow.document}catch(g){break}c=f;e=c.activeElement}tg(a.Ib,c,"mousedown",a.hh,q);tg(a.Ib,c,"deactivate",a.gh)}else tg(a.Ib,c,"blur",a.gh);"toggle_display"==
a.$c?(a.I.style.visibility="visible",Ke(a.I,q)):"move_offscreen"==a.$c&&a.ub();a.Ma=q;a.Fe?(Ub(a.Fe,"end",a.kh,u,a),a.Fe.play()):a.kh()}}else Og(a)}w.ub=ha;function Og(a,b){if(!a.Ma||!a.dispatchEvent({type:"beforehide",target:b}))return u;a.Ib&&a.Ib.Pf();a.Ma=u;a.Xg=xa();a.se?(Ub(a.se,"end",wa(a.Fg,b),u,a),a.se.play()):a.Fg(b);return q}w.Fg=function(a){"toggle_display"==this.$c?this.ek?Fg(this.Pg,0,this):this.Pg():"move_offscreen"==this.$c&&(this.I.style.top="-10000px");this.If(a)};
w.Pg=function(){this.I.style.visibility="hidden";Ke(this.I,u)};w.Ef=function(){return this.dispatchEvent("beforeshow")};w.kh=function(){this.wf=xa();this.Xg=-1;this.dispatchEvent("show")};w.If=function(a){this.dispatchEvent({type:"hide",target:a})};w.hh=function(a){a=a.target;!re(this.I,a)&&((!this.Ag||re(this.Ag,a))&&!(150>xa()-this.wf))&&Og(this,a)};w.rj=function(a){27==a.keyCode&&Og(this,a.target)&&(a.preventDefault(),a.stopPropagation())};
w.gh=function(a){if(this.wi){var b=je(this.I);if(K||bb){if(a=b.activeElement,!a||re(this.I,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>xa()-this.wf||Og(this)}};function Pg(a,b){this.Xj=4;this.xe=b||p;Mg.call(this,a)}C(Pg,Mg);Pg.prototype.ub=function(){if(this.xe){var a=!this.Ma&&"move_offscreen"!=this.$c,b=this.t();a&&(b.style.visibility="hidden",Ke(b,q));this.xe.ub(b,this.Xj,this.Ll);a&&Ke(b,u)}};function Qg(a){this.ha=new ic;a&&this.df(a)}function Rg(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+qa(a):b.substr(0,1)+a}w=Qg.prototype;w.sf=function(){return this.ha.sf()};w.add=function(a){this.ha.set(Rg(a),a)};w.df=function(a){a=hc(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};w.Pf=function(a){a=hc(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};w.remove=function(a){return this.ha.remove(Rg(a))};w.clear=function(){this.ha.clear()};
w.contains=function(a){a=Rg(a);return lc(this.ha.ha,a)};w.Ug=function(a){var b=new Qg;a=hc(a);for(var c=0;c<a.length;c++){var e=a[c];this.contains(e)&&b.add(e)}return b};w.Dd=function(){return this.ha.Dd()};w.l=function(){return new Qg(this)};function Sg(a,b,c){this.$b=c||(a?he(ke(a)):he());Pg.call(this,this.$b.Wc("div",{style:"position:absolute;display:none;"}));this.of=new fe(1,1);this.ke=new Qg;a&&Tg(this,a);if(b!=t)if(a=this.t(),"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(je(a).createTextNode(String(b)))}}C(Sg,Pg);var Ug=[];w=Sg.prototype;w.Sa=t;w.className="goog-tooltip";
w.yh=500;w.Oi=0;w.oe=v("$b");function Tg(a,b){b=ke(b);a.ke.add(b);L(b,"mouseover",a.Ni,u,a);L(b,"mouseout",a.Mg,u,a);L(b,"mousemove",a.Mi,u,a);L(b,"focus",a.Li,u,a);L(b,"blur",a.Mg,u,a)}w.Qf=function(a){var b=this.t();b&&pe(b);Sg.w.Qf.call(this,a);a&&(b=this.$b.ma.body,b.insertBefore(a,b.lastChild))};
w.Ef=function(){if(!Mg.prototype.Ef.call(this))return u;if(this.anchor)for(var a,b=0;a=Ug[b];b++)re(a.t(),this.anchor)||Ng(a,u);0<=Cb(Ug,this)||Ug.push(this);a=this.t();a.className=this.className;Vg(this);L(a,"mouseover",this.Og,u,this);L(a,"mouseout",this.Ng,u,this);Wg(this);return q};
w.If=function(){Gb(Ug,this);for(var a=this.t(),b,c=0;b=Ug[c];c++)b.anchor&&re(a,b.anchor)&&Ng(b,u);this.nh&&Xg(this.nh);Vb(a,"mouseover",this.Og,u,this);Vb(a,"mouseout",this.Ng,u,this);this.anchor=p;if(0==(this.Kb?this.Ma?4:1:this.Yc?3:this.Ma?2:0))this.Ce=u;Mg.prototype.If.call(this)};w.ah=function(a,b){this.anchor==a&&this.ke.contains(this.anchor)&&(this.Ce||!this.Vl?(Ng(this,u),this.Ma||(this.anchor=a,this.xe=b||Yg(this,0)||p,this.Ma&&this.ub(),Ng(this,q))):this.anchor=p);this.Kb=p};
w.ij=function(a){this.Yc=p;a==this.anchor&&(this.Sa==t||this.Sa!=this.t()&&!this.ke.contains(this.Sa))&&(!this.Cg||!this.Cg.Sa)&&Ng(this,u)};function Zg(a,b){var c=te(a.$b);a.of.x=b.clientX+c.x;a.of.y=b.clientY+c.y}w.Ni=function(a){var b=$g(this,a.target);this.Sa=b;Vg(this);b!=this.anchor&&(this.anchor=b,this.Kb||(this.Kb=Fg(va(this.ah,this,b,p),this.yh)),ah(this),Zg(this,a))};function $g(a,b){try{for(;b&&!a.ke.contains(b);)b=b.parentNode;return b}catch(c){return t}}
w.Mi=function(a){Zg(this,a);this.Ce=q};w.Li=function(a){this.Sa=a=$g(this,a.target);this.Ce=q;if(this.anchor!=a){this.anchor=a;var b=Yg(this,1);Vg(this);this.Kb||(this.Kb=Fg(va(this.ah,this,a,b),this.yh));ah(this)}};function Yg(a,b){if(0==b){var c=a.of.l();return new bh(c)}return new ch(a.Sa)}function ah(a){if(a.anchor)for(var b,c=0;b=Ug[c];c++)re(b.t(),a.anchor)&&(b.Cg=a,a.nh=b)}
w.Mg=function(a){var b=$g(this,a.target),c=$g(this,a.relatedTarget);b!=c&&(b==this.Sa&&(this.Sa=t),Wg(this),this.Ce=u,this.Ma&&(!a.relatedTarget||!re(this.t(),a.relatedTarget))?Xg(this):this.anchor=p)};w.Og=function(){var a=this.t();this.Sa!=a&&(Vg(this),this.Sa=a)};w.Ng=function(a){var b=this.t();if(this.Sa==b&&(!a.relatedTarget||!re(b,a.relatedTarget)))this.Sa=t,Xg(this)};function Wg(a){a.Kb&&(ga.clearTimeout(a.Kb),a.Kb=p)}
function Xg(a){if(2==(a.Kb?a.Ma?4:1:a.Yc?3:a.Ma?2:0))a.Yc=Fg(va(a.ij,a,a.anchor),a.Oi)}function Vg(a){a.Yc&&(ga.clearTimeout(a.Yc),a.Yc=p)}function bh(a,b){Kg.call(this,a,b)}C(bh,Kg);bh.prototype.ub=function(a,b,c){b=ze(a);b=Ce(b);c=c?new ue(c.top+10,c.right,c.bottom,c.left+10):new ue(10,0,0,10);Ig(this.nf,a,4,c,b,9)&496&&Ig(this.nf,a,4,c,b,5)};function ch(a){Lg.call(this,a,3)}C(ch,Lg);
ch.prototype.ub=function(a,b,c){var e=new fe(10,0);Hg(this.element,this.Gg,a,b,e,c,9)&496&&Hg(this.element,2,a,1,e,c,5)};function dh(a,b,c,e){a==t&&n(Error("No valid parent element."));(!x(b)||!x(c))&&n(Error("Invalid coordinates."));(e==t||!(e instanceof Se))&&n(Error("Invalid interactor."));Sg.call(this);this.g="caption";this.cb=a;this.ge=b;this.he=c;this.S=e;this.Gb=t;this.gc=[];a=".x-tooltip {\n background: #C0C0FF;\n color: #000000;\n";a+=" border: 1px solid infotext;\n";a+=" padding: 1px;\n";a+=" font-family: sans-serif;\n";a+="}";this.gc=[a];Ub(e,Cd,this.Fd.bind(this));this.uf()}C(dh,Sg);
dh.prototype.uf=function(){var a=xe(this.cb,"position");if("static"==a||""==a)this.cb.style.position="relative";var a=document.getElementsByTagName("head")[0],b=me("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.gc[0]));a.appendChild(b);b.appendChild(c);this.Gb=b;this.xe=new Kg(this.ge,this.he)||p;this.Ma&&this.ub();Ng(this,q);Tg(this,this.cb);this.t().classList.add("x-tooltip")};
dh.prototype.Fd=function(){Ng(this,u);this.Gb&&pe(this.Gb);this.t()&&pe(this.t());this.Gb=t};function eh(){M.call(this);this.g="shaders";this.de="";var a;a="precision mediump float;\n\n";a+="attribute vec3 vertexPosition;\n";a+="attribute vec3 vertexNormal;\n";a+="attribute vec3 vertexColor;\n";a+="attribute vec2 vertexTexturePos;\n";a+="attribute float vertexScalar;\n";a+="\n";a+="uniform mat4 view;\n";a+="uniform mat4 perspective;\n";a+="uniform vec3 center;\n";a+="uniform mat4 objectTransform;\n";a+="uniform bool useObjectColor;\n";a+="uniform bool useScalars;\n";a+="uniform bool scalarsReplaceMode;\n";
a+="uniform float scalarsMin;\n";a+="uniform float scalarsMax;\n";a+="uniform vec3 scalarsMinColor;\n";a+="uniform vec3 scalarsMaxColor;\n";a+="uniform float scalarsMinThreshold;\n";a+="uniform float scalarsMaxThreshold;\n";a+="uniform int scalarsInterpolation;\n";a+="uniform vec3 objectColor;\n";a+="uniform float pointSize;\n";a+="\n";a+="varying float fDiscardNow;\n";a+="varying vec4 fVertexPosition;\n";a+="varying vec3 fragmentColor;\n";a+="varying vec2 fragmentTexturePos;\n";a+="varying vec3 fVertexNormal;\n";
a+="varying vec3 fTransformedVertexNormal;\n";a+="\n";a+="void main(void) {\n";a+=" fTransformedVertexNormal = mat3(view[0].xyz,view[1].xyz,view[2].xyz) * ";a+="mat3(objectTransform[0].xyz,objectTransform[1].xyz,objectTransform[2].xyz) * ";a+="vertexNormal;\n";a+=" fVertexNormal = vertexNormal;\n";a+=" fDiscardNow = 0.0;\n";a+=" vec3 vertexPosition2 = vertexPosition - center;\n";a+=" fVertexPosition = view * objectTransform * vec4(vertexPosition2, 1.0);\n";a+=" fragmentTexturePos = vertexTexturePos;\n";
a+=" if (useScalars) {\n";a+=" float scalarValue = vertexScalar;\n";a+=" if (scalarValue < scalarsMinThreshold || scalarValue > scalarsMaxThreshold) {\n";a+=" if (scalarsReplaceMode) {\n";a+=" fragmentColor = objectColor;\n";a+=" } else {\n";a+=" fDiscardNow = 1.0;\n";a+=" }\n";a+=" } else {\n";a+=" if (scalarsReplaceMode) {\n";a+=" if (scalarsInterpolation == 1) {\n";a+=" vec3 zeroMaxColor;\n";a+=" vec3 zeroMinColor;\n";a+=
" zeroMaxColor[0] = scalarsMaxColor[0]*0.33;\n";a+=" zeroMaxColor[1] = scalarsMaxColor[1]*0.33;\n";a+=" zeroMaxColor[2] = scalarsMaxColor[2]*0.33;\n";a+=" zeroMinColor[0] = scalarsMinColor[0]*0.33;\n";a+=" zeroMinColor[1] = scalarsMinColor[1]*0.33;\n";a+=" zeroMinColor[2] = scalarsMinColor[2]*0.33;\n";a+=" if(scalarValue < 0.0) {fragmentColor = scalarValue/(scalarsMin) * scalarsMinColor + (1.0 - scalarValue/(scalarsMin)) * (zeroMinColor);}\n";
a+=" else {fragmentColor = scalarValue/(scalarsMax) * scalarsMaxColor + (1.0 - scalarValue/(scalarsMax)) * (zeroMaxColor);}\n";a+=" } else {\n";a+=" fragmentColor = scalarValue * scalarsMaxColor + (1.0 - scalarValue) * scalarsMinColor;\n";a+=" }\n";a+=" } else {\n";a+=" fragmentColor = vertexColor;\n";a+=" }\n";a+=" }\n";a+=" } else if (useObjectColor) {\n";a+=" fragmentColor = objectColor;\n";a+=" } else {\n";a+=" fragmentColor = vertexColor;\n";
a+=" }\n";a+=" gl_PointSize = pointSize;\n";a+=" gl_Position = perspective * fVertexPosition;\n";this.de=a+="}\n";this.Ud="";a="precision mediump float;\n\n";a+="uniform bool usePicking;\n";a+="uniform bool useTexture;\n";a+="uniform bool volumeTexture;\n";a+="uniform bool useLabelMapTexture;\n";a+="uniform sampler2D textureSampler;\n";a+="uniform sampler2D textureSampler2;\n";a+="uniform float objectOpacity;\n";a+="uniform float labelmapOpacity;\n";a+="uniform vec4 labelmapColor;\n";a+="uniform float volumeLowerThreshold;\n";
a+="uniform float volumeUpperThreshold;\n";a+="uniform float volumeScalarMin;\n";a+="uniform float volumeScalarMax;\n";a+="uniform vec3 volumeScalarMinColor;\n";a+="uniform vec3 volumeScalarMaxColor;\n";a+="uniform float volumeWindowLow;\n";a+="uniform float volumeWindowHigh;\n";a+="\n";a+="varying float fDiscardNow;\n";a+="varying vec4 fVertexPosition;\n";a+="varying vec3 fragmentColor;\n";a+="varying vec2 fragmentTexturePos;\n";a+="varying vec3 fVertexNormal;\n";a+="varying vec3 fTransformedVertexNormal;\n";
a+="\n";a+="void main(void) {\n";a+=" if (fDiscardNow > 0.0) {\n";a+=" discard;\n";a+=" }\n";a+=" if (usePicking) {\n";a+=" gl_FragColor = vec4(fragmentColor, 1.0);\n";a+=" } else if (useTexture) {\n";a+=" vec4 texture1 = texture2D(textureSampler,fragmentTexturePos);\n";a+=" vec4 textureSum = texture1;\n";a+=" if (volumeTexture) {\n";a+=" float _windowLow = ((volumeWindowLow - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin));\n";a+=" float _windowHigh = ((volumeWindowHigh - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin));\n";
a+=" vec3 _minrange = vec3(_windowLow,_windowLow,_windowLow);\n";a+=" vec3 _maxrange = vec3(_windowHigh,_windowHigh,_windowHigh);\n";a+=" vec3 fac = _maxrange - _minrange;\n";a+=" textureSum = vec4((textureSum.r - _minrange)/fac,1);\n";a+=" textureSum = textureSum.r * vec4(volumeScalarMaxColor,1) + (1.0 - textureSum.r) * vec4(volumeScalarMinColor,1);\n";a+=" }\n";a+=" if (useLabelMapTexture) {\n";a+=" vec4 texture2 = texture2D(textureSampler2,fragmentTexturePos);\n";a+=
" if (texture2.a > 0.0) {\n";a+=" if (labelmapColor.a != -255.0) {\n";a+=" if (all(equal(floor(texture2 * vec4(255)), labelmapColor))) {\n";a+=" if (labelmapOpacity < 1.0) {\n";a+=" textureSum = mix(texture2, textureSum, 1.0 - labelmapOpacity);\n";a+=" } else {\n";a+=" textureSum = texture2;\n";a+=" }\n";a+=" }\n";a+=" } else {\n";a+=" if (labelmapOpacity < 1.0) {\n";a+=" textureSum = mix(texture2, textureSum, 1.0 - labelmapOpacity);\n";
a+=" } else {\n";a+=" textureSum = texture2;\n";a+=" }\n";a+=" }\n";a+=" }\n";a+=" }\n";a+=" if (volumeTexture) {\n";a+=" float _volumeLowerThreshold = (volumeLowerThreshold - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin);\n";a+=" float _volumeUpperThreshold = (volumeUpperThreshold - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin);\n";a+=" if (texture1.r < _volumeLowerThreshold ||\n";a+=" texture1.r > _volumeUpperThreshold ||\n";
a+=" texture1.a == 0.0 ) {\n";a+=" discard;\n";a+=" };\n";a+=" };\n";a+=" gl_FragColor = textureSum;\n";a+=" gl_FragColor.a = objectOpacity;\n";a+=" } else {\n";a+=" vec3 nNormal = normalize(fTransformedVertexNormal);\n";a+=" if (fVertexNormal == vec3(0.0,0.0,0.0)) {\n";a+=" gl_FragColor = vec4(fragmentColor,1.0);\n";a+=" return;\n";a+=" }\n";a+=" vec3 light = vec3(0.0, 0.0, 1.0);\n";a+=" vec3 lightDirection = vec3(0,0,-10);\n";a+=" lightDirection = normalize(lightDirection);\n";
a+=" vec3 eyeDirection = normalize(-fVertexPosition.xyz);\n";a+=" vec3 reflectionDirection = reflect(-lightDirection, nNormal);\n";a+=" float specular = pow(max(dot(reflectionDirection, eyeDirection), 0.0), 10.0);\n";a+=" float diffuse = 0.8 * max(dot(nNormal, light), 0.0);\n";a+=" float ambient = 0.3;\n";a+=" gl_FragColor = vec4(fragmentColor * ambient +\n";a+=" fragmentColor * diffuse +\n";a+=" vec3(0.2, 0.2, 0.2) * specular,\n";a+=" objectOpacity);\n";
a+=" }\n";this.Ud=a+="}\n"}C(eh,M);
var fh={al:"vertexPosition",$k:"vertexNormal",Zk:"vertexColor",cl:"vertexTexturePos",bl:"vertexScalar"},gh={dl:"view",Ik:"perspective",zk:"center",Hk:"objectTransform",Vk:"useObjectColor",Fk:"objectColor",Xk:"useScalars",Rk:"scalarsReplaceMode",Ok:"scalarsMin",Lk:"scalarsMax",Pk:"scalarsMinColor",Mk:"scalarsMaxColor",Qk:"scalarsMinThreshold",Nk:"scalarsMaxThreshold",Kk:"scalarsInterpolation",Jk:"pointSize",Gk:"objectOpacity",Ek:"normal",Wk:"usePicking",Yk:"useTexture",Uk:"useLabelMapTexture",Ck:"labelmapOpacity",
Bk:"labelmapColor",Sk:"textureSampler",Tk:"textureSampler2",el:"volumeLowerThreshold",kl:"volumeUpperThreshold",hl:"volumeScalarMin",fl:"volumeScalarMax",il:"volumeScalarMinColor",gl:"volumeScalarMaxColor",ml:"volumeWindowLow",ll:"volumeWindowHigh",jl:"volumeTexture"};function hh(a,b,c){a==t&&n(Error("Invalid GL Buffer."));b==t&&n(Error("Invalid number of items."));c==t&&n(Error("Invalid item size."));M.call(this);this.g="buffer";this.P=a;this.ed=b;this.Ob=c}C(hh,M);function ih(){Gg.call(this);this.g="renderer3D";this.md=this.pd=this.ld=this.od=this.kd=this.nd=this.Ye=this.Ze=t;this.u=[0,0,0];this.bd=[0,0,0];this.sg=t;this.Je=new ic;this.xd=new ic;this.qc=new ic;this.qd=new ic;this.Ec=new ic;this.Pc=new ic;this.pc=new ic;this.wd=new ic;this.R={PROGRESSBAR_ENABLED:q,PICKING_ENABLED:q,ORDERING_ENABLED:q,STATISTICS_ENABLED:u,INTERMEDIATE_RENDERING:u}}C(ih,Gg);ih.prototype.__defineGetter__("config",v("R"));w=ih.prototype;
w.Zj=function(){this.md=this.pd=this.ld=this.od=this.kd=this.nd=t;this.u=[0,0,0]};w.Jf=function(a){ih.w.Jf.call(this,a);var b=a.ge;a=a.he;var c=this.Nf(b,a);if(c=this.get(c))if(c=c.fc){var e=Fe(this.v);(new dh(this.v,e.x+b+10,e.y+a+10,this.S)).t().innerHTML=c}};
w.Ca=function(){ih.w.Ca.call(this,"experimental-webgl");try{if(this.a.viewport(0,0,this.L,this.A),this.a.clearColor(this.bd[0],this.bd[1],this.bd[2],0),this.a.enable(this.a.BLEND),this.a.blendEquation(this.a.FUNC_ADD),this.a.blendFunc(this.a.SRC_ALPHA,this.a.ONE_MINUS_SRC_ALPHA),this.a.enable(this.a.DEPTH_TEST),this.a.depthFunc(this.a.LEQUAL),this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT),this.R.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.L,this.A,0,this.a.RGB,this.a.UNSIGNED_BYTE,t);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST);this.a.bindFramebuffer(this.a.FRAMEBUFFER,
a);this.a.bindRenderbuffer(this.a.RENDERBUFFER,b);this.a.renderbufferStorage(this.a.RENDERBUFFER,this.a.DEPTH_COMPONENT16,this.L,this.A);this.a.bindRenderbuffer(this.a.RENDERBUFFER,t);this.a.framebufferTexture2D(this.a.FRAMEBUFFER,this.a.COLOR_ATTACHMENT0,this.a.TEXTURE_2D,c,0);this.a.framebufferRenderbuffer(this.a.FRAMEBUFFER,this.a.DEPTH_ATTACHMENT,this.a.RENDERBUFFER,b);this.a.bindFramebuffer(this.a.FRAMEBUFFER,t);this.sg=a}}catch(e){n(Error("Exception while accessing GL Context!\n"+e))}a=new eh;
(this.ca==t||this.a==t||this.J==t)&&n(Error("Renderer was not initialized properly."));(a==t||!(a instanceof eh))&&n(Error("Could not add shaders."));b=Object.keys(gh);Object.keys(fh).every(function(a){a=fh[a];return-1!=this.de.search(a)||-1!=this.Ud.search(a)}.bind(a))||n(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=gh[a];return-1!=this.de.search(a)||-1!=this.Ud.search(a)}.bind(a))||n(Error("Could not find all uniforms in the shader sources."));b=this.a.createShader(this.a.FRAGMENT_SHADER);
c=this.a.createShader(this.a.VERTEX_SHADER);this.a.shaderSource(b,a.Ud);this.a.shaderSource(c,a.de);this.a.compileShader(b);this.a.compileShader(c);this.a.getShaderParameter(b,this.a.COMPILE_STATUS)||n(Error("Fragement Shader compilation failed!\n"+this.a.getShaderInfoLog(b)));this.a.getShaderParameter(c,this.a.COMPILE_STATUS)||n(Error("Vertex Shader compilation failed!\n"+this.a.getShaderInfoLog(c)));var d=this.a.createProgram();this.a.attachShader(d,c);this.a.attachShader(d,b);this.a.linkProgram(d);
this.a.getProgramParameter(d,this.a.LINK_STATUS)||n(Error("Could not create shader program!\n"+this.a.getShaderInfoLog(b)+"\n"+this.a.getShaderInfoLog(c)+"\n"+this.a.getProgramInfoLog(d)));this.a.useProgram(d);this.Ye=d;Object.keys(fh).forEach(function(a){a=fh[a];this.Je.set(a,this.a.getAttribLocation(this.Ye,a));this.a.enableVertexAttribArray(this.Je.get(a))}.bind(this));Object.keys(gh).forEach(function(a){a=gh[a];this.xd.set(a,this.a.getUniformLocation(this.Ye,a))}.bind(this));this.Ze=a};
w.vb=function(a){ih.w.vb.call(this,a);var b=u;if(a!=t){this.get(a.ja)&&(b=q);var c=a.ja,e=a.h,d=a.o,f=a.qa,g=a.H,h=a.r,l=a.la,j=a.xa,k=a.e,m=a.G;if(k!=t&&k.r!=t&&k.r.j)this.vb(k);else if(k!=t&&k.j&&this.vb(k),j!=t&&j.r!=t&&j.r.j)this.aa.load(j,a);else if(g!=t&&g.r!=t&&g.r.j)this.aa.load(g,a);else{if(h!=t&&ka(h))if(a.zc!=t){if(a.zc.xf!=h.length||!a.j)return}else{b=0;c=h.length;for(b=0;b<c;b++)this.aa.load(h[b],a);return}else{if(h!=t&&h.j){this.aa.load(a,a);return}if(m!=t&&m.r!=t&&m.r.j){this.aa.load(m,
a);return}}if(0<a.c.length){h=a.c;j=h.length;for(k=k=0;k<j;k++)this.vb(h[k])}if(e){for(h=0;this.Xd;)h++,window.console.log("Possible thread lock avoided: "+h);this.Xd=q;j=a instanceof Yd&&a.zb instanceof Ye;b&&(g!=t&&g.j)&&(h=this.pc.get(c),h!=t&&this.a.isBuffer(h.P)&&this.a.deleteBuffer(h.P));h=t;g!=t&&(!b||g.j?(h=a.oc,h==t&&n(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),k=u,g.Wb&&(k=q),this.a.pixelStorei(this.a.UNPACK_FLIP_Y_WEBGL,k),
k=this.a.createTexture(),k.Si=g.kb,this.wd.set(g.ja,k),this.a.bindTexture(this.a.TEXTURE_2D,k),g.Wb?(k=this.a.RGBA,g.ig&&(k=this.a.LUMINANCE,this.a.pixelStorei(this.a.UNPACK_ALIGNMENT,1)),this.a.texImage2D(this.a.TEXTURE_2D,0,k,g.Xe,g.We,0,k,this.a.UNSIGNED_BYTE,g.Wb)):this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,this.a.RGBA,this.a.UNSIGNED_BYTE,k.Si),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,
this.a.CLAMP_TO_EDGE),j?(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST)):(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.LINEAR),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.LINEAR)),this.a.bindTexture(this.a.TEXTURE_2D,t),k=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,k),this.a.bufferData(this.a.ARRAY_BUFFER,new Float32Array(h),
this.a.STATIC_DRAW),h=new hh(k,h.length,2),this.pc.set(c,h),g.j=u):h=this.pc.get(c));bg(this.aa,0.1);if(j)this.Xd=u,D.Da(this.g+".update"),bg(this.aa,0.9);else{if(!b||e.j||l.j){j=l.Q;g=D.f.ba(j,e.ob,e.pb,e.qb);j=D.f.ba(j,e.lb,e.mb,e.nb);if(this.nd===t||g.x<this.nd)this.nd=g.x;if(this.kd===t||j.x>this.kd)this.kd=j.x;if(this.od===t||g.y<this.od)this.od=g.y;if(this.ld===t||j.y>this.ld)this.ld=j.y;if(this.pd===t||g.d<this.pd)this.pd=g.d;if(this.md===t||j.d>this.md)this.md=j.d;this.u=[(this.nd+this.kd)/
2,(this.od+this.ld)/2,(this.pd+this.md)/2];l.j=u}b&&e.j&&(l=this.qc.get(c),l!=t&&this.a.isBuffer(l.P)&&this.a.deleteBuffer(l.P));l=t;!b||e.j?(l=this.a.createBuffer(),e.Xa(),this.a.bindBuffer(this.a.ARRAY_BUFFER,l),this.a.bufferData(this.a.ARRAY_BUFFER,e.ea,this.a.STATIC_DRAW),l=new hh(l,e.count,3),e.j=u):l=this.qc.get(c);bg(this.aa,0.3);b&&d.j&&(g=this.qc.get(c),g!=t&&this.a.isBuffer(g.P)&&this.a.deleteBuffer(g.P));g=t;!b||d.j?(g=this.a.createBuffer(),d.Xa(),this.a.bindBuffer(this.a.ARRAY_BUFFER,
g),this.a.bufferData(this.a.ARRAY_BUFFER,d.ea,this.a.STATIC_DRAW),g=new hh(g,d.count,3),d.j=u):g=this.qd.get(c);bg(this.aa,0.3);b&&(f&&f.j)&&(d=this.Ec.get(c),d!=t&&this.a.isBuffer(d.P)&&this.a.deleteBuffer(d.P));d=t;f&&(!b||f.j?(f.length!=e.length&&n(Error("Mismatch between points and point colors.")),d=this.a.createBuffer(),f.Xa(),this.a.bindBuffer(this.a.ARRAY_BUFFER,d),this.a.bufferData(this.a.ARRAY_BUFFER,f.ea,this.a.STATIC_DRAW),d=new hh(d,f.count,3),f.j=u):d=this.Ec.get(c));bg(this.aa,0.2);
b&&(m&&m.j)&&(f=this.Pc.get(c),f!=t&&this.a.isBuffer(f.P)&&this.a.deleteBuffer(f.P));f=t;m&&(f=m.dd,!b||m.j?(f.length!=e.length&&n(Error("Mismatch between points and scalars.")),e=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,e),this.a.bufferData(this.a.ARRAY_BUFFER,f,this.a.STATIC_DRAW),f=new hh(e,f.length,3),m.j=u):f=this.Pc.get(c));bg(this.aa,0.1);b||this.bb.add(a);this.qc.set(c,l);this.qd.set(c,g);this.Ec.set(c,d);this.pc.set(c,h);this.Pc.set(c,f);this.Xd=a.j=u}}else a.j=u}}};
w.fk=function(a){for(var b=this.bb.F,c=0;c<b.length;++c){var e=this.get(b[c].ja);if(e&&0<=Cb(a,e.ja)){var d,f=this.J,g=e.u[0],h=e.u[1],l=e.u[2];d=[this.ca.clientWidth,this.ca.clientHeight];var j=new Float32Array(4),k=new Float32Array(4),m=new Float32Array(16);j[0]=g;j[1]=h;j[2]=l;j[3]=1;D.f.multiply(f.ae,f.n,m);D.f.Af(m,j,k);f=k[3];0!==f&&(k[0]/=f,k[1]/=f,k[2]/=f);g=d[0];d=d[1];k[0]=g/2*k[0]+g/2;k[1]=-d/2*k[1]+d/2;k[2]=4999.5*k[2]+5000.5;k[3]=0===f?0:1/f;d=k;k=d[0];d=d[1];if(e=e.fc)(new dh(this.v,
k,d,this.S)).t().innerHTML=e}}};w.Nf=function(a,b){if(this.R.PICKING_ENABLED){this.a.bindTexture(this.a.TEXTURE_2D,t);this.dc(q,u);var c=new Uint8Array(4);this.a.readPixels(a,this.A-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);return c[0]+255*c[1]+65025*c[2]}return-1};
w.dc=function(a,b){ih.w.dc.call(this,a,b);this.a.viewport(0,0,this.L,this.A);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var c=this.bb.F,e=c.length;if(0!=e){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.sg):this.a.bindFramebuffer(this.a.FRAMEBUFFER,t);var d=this.J.ae,f=this.J.n;this.a.uniformMatrix4fv(this.xd.get("perspective"),u,d);this.a.uniformMatrix4fv(this.xd.get("view"),u,f);d=this.u;this.a.uniform3f(this.xd.get("center"),parseFloat(d[0]),parseFloat(d[1]),parseFloat(d[2]));
f=this.Ha.length;for(d=0;d<f;++d){var g=this.Ha[d];if(g instanceof P){var h=D.f.ba(this.J.n,g.s[0]+g.b[0].i[0],g.s[1]+g.b[0].i[1],g.s[2]+g.b[0].i[2]),l=D.f.ba(this.J.n,g.s[0]-g.b[0].i[0],g.s[1]-g.b[0].i[1],g.s[2]-g.b[0].i[2]),j=Math.abs(h.d-l.d),h=D.f.ba(this.J.n,g.s[0]+g.b[1].i[0],g.s[1]+g.b[1].i[1],g.s[2]+g.b[1].i[2]),l=D.f.ba(this.J.n,g.s[0]-g.b[1].i[0],g.s[1]-g.b[1].i[1],g.s[2]+-g.b[1].i[2]),k=Math.abs(h.d-l.d),h=D.f.ba(this.J.n,g.s[0]+g.b[2].i[0],g.s[1]+g.b[2].i[1],g.s[2]+g.b[2].i[2]),l=D.f.ba(this.J.n,
g.s[0]-g.b[2].i[0],g.s[1]-g.b[2].i[1],g.s[2]-g.b[2].i[2]),h=Math.max(j,k,Math.abs(h.d-l.d));h==j?Xe(g,0):h==k?Xe(g,1):Xe(g,2)}}if(this.R.ORDERING_ENABLED){j=u;f=this.Ha;g=f.length-1;do if(d=f[g],d instanceof P&&d.Ra&&-1!=d.X){var j=d.c[d.X].c,k=d.X,h=D.f.ba(this.J.n,d.s[0]+d.b[k].B[0],d.s[1]+d.b[k].B[1],d.s[2]+d.b[k].B[2]),l=D.f.ba(this.J.n,d.s[0]-d.b[k].B[0],d.s[1]-d.b[k].B[1],d.s[2]-d.b[k].B[2]),h=h.d-l.d,l=Math.max(d.Dc[d.X],Math.max(d.Dc[d.X+4],d.Dc[d.X+8])),m=Math.min(d.Dc[d.X],Math.min(d.Dc[d.X+
4],d.Dc[d.X+8]));if(0>h*(l+m))for(h=h=0;h<d.ud[k]-1;h++)j[h]&&(j[h].za=d.za,j[h].ya=d.b[k].Sc*h);else for(h=d.ud[k]-1;0<=h;h--)j[h]&&(j[h].za=d.za,j[h].ya=(d.ud[k]-1)*d.b[k].Sc-d.b[k].Sc*h);j=q}while(g--);f=this.bb.F;g=f.length-1;do if(d=f[g],d.O&&!(1==d.za||d instanceof Yd))j=d,k=d.h.Rd,d=D.f.ba(d.la.Q,k[0],k[1],k[2]),d=D.f.ba(this.J.n,d.x,d.y,d.d),d=D.m.rf(this.J.jc,d),d=Math.round(1E3*d)/1E3,j.ya=d,j=q;while(g--);j&&this.bb.sort()}if(f=!a&&b!=t&&b&&this.R.STATISTICS_ENABLED)var r=0;var d=this.Je,
g=d.get("vertexPosition"),j=d.get("vertexNormal"),k=d.get("vertexColor"),h=d.get("vertexTexturePos"),l=d.get("vertexScalar"),d=this.xd,m=d.get("usePicking"),s=d.get("useObjectColor"),y=d.get("objectColor"),z=d.get("useScalars"),G=d.get("scalarsReplaceMode"),F=d.get("scalarsMin"),H=d.get("scalarsMax"),B=d.get("scalarsMinColor"),E=d.get("scalarsMaxColor"),I=d.get("scalarsInterpolation"),N=d.get("scalarsMinThreshold"),Q=d.get("scalarsMaxThreshold"),R=d.get("objectOpacity"),O=d.get("labelmapOpacity"),
ea=d.get("labelmapColor"),J=d.get("useTexture"),aa=d.get("useLabelMapTexture"),da=d.get("textureSampler"),U=d.get("textureSampler2"),V=d.get("volumeLowerThreshold"),Ga=d.get("volumeUpperThreshold"),rb=d.get("volumeScalarMin"),sb=d.get("volumeScalarMax"),tb=d.get("volumeWindowLow"),jb=d.get("volumeWindowHigh"),Uc=d.get("volumeScalarMinColor"),mh=d.get("volumeScalarMaxColor"),Bg=d.get("volumeTexture"),nh=d.get("objectTransform"),oh=d.get("pointSize"),d=e;do{var fa=c[e-d];if(fa){var la=t;fa instanceof
Yd&&fa.zb&&(la=fa.zb);if(fa.O&&(!la||la.O)&&(!a||fa.rd)){var Ba=fa.ja,cb=fa.jd,nb=this.qc.get(Ba),ob=this.qd.get(Ba),Ze=this.Ec.get(Ba),Kb=this.Pc.get(Ba),$e=this.pc.get(Ba);this.a.bindBuffer(this.a.ARRAY_BUFFER,nb.P);this.a.vertexAttribPointer(g,nb.Ob,this.a.FLOAT,u,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,ob.P);this.a.vertexAttribPointer(j,ob.Ob,this.a.FLOAT,u,0,0);a?this.a.uniform1i(m,q):this.a.uniform1i(m,u);Ze&&!a&&!cb?(this.a.uniform1i(s,u),this.a.bindBuffer(this.a.ARRAY_BUFFER,Ze.P),this.a.vertexAttribPointer(k,
Ze.Ob,this.a.FLOAT,u,0,0)):(ob=1,cb&&!a&&(ob=0),this.a.uniform1i(s,ob),ob=fa.z,a&&(ob=[Math.floor(Ba%65025%255)/255,Math.floor(Ba%65025/255)/255,Math.floor(Ba/65025)/255]),this.a.uniform3f(y,parseFloat(ob[0]),parseFloat(ob[1]),parseFloat(ob[2])),this.a.vertexAttribPointer(k,nb.Ob,this.a.FLOAT,u,0,0));Kb&&!a&&!cb?(this.a.uniform1i(z,q),this.a.uniform1i(G,fa.G.vg),Ba=fa.G.Rb,cb=fa.G.Pb,this.a.uniform3f(B,parseFloat(Ba[0]),parseFloat(Ba[1]),parseFloat(Ba[2])),this.a.uniform3f(E,parseFloat(cb[0]),parseFloat(cb[1]),
parseFloat(cb[2])),this.a.uniform1f(N,parseFloat(fa.G.U)),this.a.uniform1f(Q,parseFloat(fa.G.W)),this.a.uniform1f(F,parseFloat(fa.G.ra)),this.a.uniform1f(H,parseFloat(fa.G.ka)),this.a.uniform1i(I,parseInt(fa.G.Me,10)),this.a.bindBuffer(this.a.ARRAY_BUFFER,Kb.P),this.a.vertexAttribPointer(l,Kb.Ob,this.a.FLOAT,u,0,0)):(this.a.uniform1i(z,u),this.a.vertexAttribPointer(l,nb.Ob,this.a.FLOAT,u,0,0));this.a.uniform1f(R,parseFloat(fa.za));fa.H&&$e&&!a?(this.a.uniform1i(J,q),this.a.activeTexture(this.a.TEXTURE0),
this.a.bindTexture(this.a.TEXTURE_2D,this.wd.get(fa.H.ja)),this.a.uniform1i(da,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,$e.P),this.a.vertexAttribPointer(h,$e.Ob,this.a.FLOAT,u,0,0),this.a.uniform1i(Bg,u)):(this.a.uniform1i(J,u),this.a.vertexAttribPointer(h,nb.Ob,this.a.FLOAT,u,0,0));la&&(this.a.uniform1i(Bg,q),this.a.uniform1f(V,la.U),this.a.uniform1f(Ga,la.W),this.a.uniform1f(rb,la.ra),this.a.uniform1f(sb,la.ka),Ba=la.Rb,cb=la.Pb,this.a.uniform3f(Uc,parseFloat(Ba[0]),parseFloat(Ba[1]),parseFloat(Ba[2])),
this.a.uniform3f(mh,parseFloat(cb[0]),parseFloat(cb[1]),parseFloat(cb[2])),this.a.uniform1f(tb,la.ga),this.a.uniform1f(jb,la.fa),Kb=la.e,this.a.uniform1i(aa,u),la.Ra?this.a.uniform1f(R,parseFloat(la.za)):Kb&&Kb.O&&(la=fa.e.ja,this.a.uniform1i(aa,q),this.a.activeTexture(this.a.TEXTURE1),this.a.bindTexture(this.a.TEXTURE_2D,this.wd.get(la)),this.a.uniform1i(U,1),this.a.uniform1f(O,Kb.za),this.a.uniform4fv(ea,Kb.$e)));this.a.uniformMatrix4fv(nh,u,fa.la.Q);la=1;"POINTS"==fa.Ia&&(la=fa.sd);this.a.uniform1f(oh,
la);la=-1;fa.Ia==Rc?(la=this.a.TRIANGLES,f&&(r+=nb.ed/3)):"LINES"==fa.Ia?(this.a.lineWidth(fa.Lc),la=this.a.LINES):"POINTS"==fa.Ia?la=this.a.POINTS:"TRIANGLE_STRIPS"==fa.Ia?(la=this.a.TRIANGLE_STRIP,f&&(r+=nb.ed/3)):"POLYGONS"==fa.Ia&&(la=0==nb.ed%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(r+=nb.ed/3));this.a.drawArrays(la,0,nb.ed)}}}while(--d);f&&Math.round(r)}};
w.remove=function(a){ih.w.remove.call(this,a);if(0<a.c.length)for(var b=a.c,c=b.length,e=0,e=0;e<c;e++)"undefined"!=typeof b[e]&&this.remove(b[e]);b=a.ja;c=this.pc.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);if(a.H&&(c=this.wd.get(a.H.ja)))this.a.deleteTexture(c),this.wd.remove(a.H.ja);c=this.qc.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);c=this.qd.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);c=this.Ec.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);
c=this.Pc.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);this.qc.remove(b);this.qd.remove(b);this.Ec.remove(b);this.pc.remove(b);this.Pc.remove(b);this.bb.remove(a);return q};w.Ta=function(){this.Ze=t;delete this.Ze;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);ih.w.Ta.call(this)};ih.prototype.__defineGetter__("bgColor",v("bd"));ih.prototype.__defineSetter__("bgColor",ca("bd"));
ih.prototype.Vj=function(a,b,c,e,d){c!=t||(c=4);e!=t||(e=2);if(d==t){d=this.Nf(a,b);if(-1==d)return t;d=this.get(d);if(!d)return t}var f=qg(this.J,2*(a/this.L)-1,2*((this.A-b)/this.A)-1,0);a=qg(this.J,2*(a/this.L)-1,2*((this.A-b)/this.A)-1,1);f[0]+=this.u[0];f[1]+=this.u[1];f[2]+=this.u[2];a[0]+=this.u[0];a[1]+=this.u[1];a[2]+=this.u[2];b=[d.h.ob,d.h.pb,d.h.qb];var g=[d.h.lb,d.h.pb,d.h.qb],h=[d.h.lb,d.h.mb,d.h.qb],l=[d.h.ob,d.h.mb,d.h.qb],j=[d.h.ob,d.h.mb,d.h.nb],k=[d.h.ob,d.h.pb,d.h.nb],m=[d.h.lb,
d.h.mb,d.h.nb],r=[d.h.lb,d.h.pb,d.h.nb];b=[D.f.ba(d.la.Q,b[0],b[1],b[2]),D.f.ba(d.la.Q,g[0],g[1],g[2]),D.f.ba(d.la.Q,h[0],h[1],h[2]),D.f.ba(d.la.Q,l[0],l[1],l[2]),D.f.ba(d.la.Q,j[0],j[1],j[2]),D.f.ba(d.la.Q,k[0],k[1],k[2]),D.f.ba(d.la.Q,m[0],m[1],m[2]),D.f.ba(d.la.Q,r[0],r[1],r[2])];var g=[Infinity,-Infinity,Infinity,-Infinity,Infinity,-Infinity],s;for(s in b)s=b[s],g=[Math.min(g[0],s.x),Math.max(g[1],s.x),Math.min(g[2],s.y),Math.max(g[3],s.y),Math.min(g[4],s.d),Math.max(g[5],s.d)];s=g;b=[];g=[];
for(h=0;6>h;h++){var l=Math.floor(h/2),j=(l+1)%3,k=(l+2)%3,r=(2+2*l)%6,y=(4+2*l)%6,z=(s[h]-f[l])*(1/a[l]);Infinity!=z&&-Infinity!=z&&(m=f[j]+a[j]*z,z=f[k]+a[k]*z,m>=s[r]&&m<=s[r+1]&&z>=s[y]&&z<=s[y+1]?(r=[],r[l]=s[h],r[j]=m,r[k]=z,b.push(r)):(r=[],r[l]=s[h],r[j]=m,r[k]=z,g.push(r)))}a=[b,g];a=a[0];if(0==a.length)return t;g=Array(2);for(s=0;2>s;s++)b=a[s],g[s]=Math.sqrt((b[0]-f[0])*(b[0]-f[0])+(b[1]-f[1])*(b[1]-f[1])+(b[2]-f[2])*(b[2]-f[2]));f=b=s=t;g[0]<g[1]?(s=a[0],b=a[1]):(s=a[1],b=a[0]);f=Math.sqrt((s[0]-
b[0])*(s[0]-b[0])+(s[1]-b[1])*(s[1]-b[1])+(s[2]-b[2])*(s[2]-b[2]));f/=c;a=s;s=[b[0]-s[0],b[1]-s[1],b[2]-s[2]];b=Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]);g=[s[0]/b,s[1]/b,s[2]/b];h=d.h.ea;l=h.length;for(s=0;s<f;s+=c){a=[a[0]+c*g[0],a[1]+c*g[1],a[2]+c*g[2]];for(b=0;b<l;b+=3)if(j=h[b],k=h[b+1],m=h[b+2],r=new D.m(j,k,m),r=D.f.ba(d.la.Q,j,k,m),Math.sqrt((a[0]-r.x)*(a[0]-r.x)+(a[1]-r.y)*(a[1]-r.y)+(a[2]-r.d)*(a[2]-r.d))<=e)return[r.x,r.y,r.d]}return t};A("X.renderer3D",ih);
A("X.renderer3D.prototype.init",ih.prototype.Ca);A("X.renderer3D.prototype.add",ih.prototype.add);A("X.renderer3D.prototype.onShowtime",ih.prototype.lh);A("X.renderer3D.prototype.onRender",ih.prototype.jh);A("X.renderer3D.prototype.get",ih.prototype.get);A("X.renderer3D.prototype.render",ih.prototype.cc);A("X.renderer3D.prototype.destroy",ih.prototype.Ta);A("X.renderer3D.prototype.remove",ih.prototype.remove);A("X.renderer3D.prototype.resetBoundingBox",ih.prototype.Zj);
A("X.renderer3D.prototype.resetViewAndRender",ih.prototype.Nd);A("X.renderer3D.prototype.pick",ih.prototype.Nf);A("X.renderer3D.prototype.pick3d",ih.prototype.Vj);A("X.renderer3D.prototype.afterRender",ih.prototype.zg);A("X.renderer3D.prototype.resize",ih.prototype.Xa);A("X.renderer3D.prototype.showAllCaptions",ih.prototype.fk);function jh(){Y.call(this);this.g="mesh";ya(this,new gc)}C(jh,Y);A("X.mesh",jh);function kh(){Y.call(this);this.g="fibers";ya(this,new gc)}C(kh,Y);A("X.fibers",kh);function lh(){Gg.call(this);this.g="renderer2D";this.Qa=t;this.Fa=-1;this.Sb=[];this.lg=this.fd=this.gg=this.Vd=t;this.Rc=this.Uc=this.Qc=this.Tc=0;this.fa=this.ga=this.W=this.U=this.Ke=-1;this.mg=new Float32Array([-255,-255,-255,-255]);this.tg=q;this.yb=1}C(lh,Gg);w=lh.prototype;w.remove=function(a){lh.w.remove.call(this,a);this.bb.remove(a);return q};w.Gj=ba();w.Qj=ba();
w.Kf=function(a){lh.w.Kf.call(this,a);var b=this.Ha[0];if(b){var c="",c=0==this.Fa?"indexX":1==this.Fa?"indexY":"indexZ";b[c]=a.V?b[c]+1:b[c]-1;eval("this.onScroll();")}};w.Rj=function(a){var b=this.Ha[0];if(b){var c=b.fa-b.ga,e=c/2,d=parseInt(c+c/15*-a.cf,10);a=parseInt(e+e/15*a.Re,10);c==d&&d++;e==a&&a++;b.ga-=parseInt(e-a,10);b.ga-=parseInt(c-d,10);b.ga=Math.max(b.ga,b.ra);b.fa-=parseInt(e-a,10);b.fa+=parseInt(c-d,10);b.fa=Math.min(b.fa,b.ka);eval("this.onWindowLevel();")}};
lh.prototype.__defineGetter__("orientation",v("Qa"));lh.prototype.__defineSetter__("orientation",function(a){a=a.toUpperCase();"AXIAL"==a?(a="Z",this.Fa=2):"SAGITTAL"==a?(a="X",this.Fa=0):"CORONAL"==a&&(a="Y",this.Fa=1);"X"!=a&&("Y"!=a&&"Z"!=a)&&n(Error("Invalid orientation."));this.Qa=a});lh.prototype.__defineGetter__("radiological",v("tg"));lh.prototype.__defineGetter__("normalizedScale",v("yb"));lh.prototype.__defineGetter__("canvasWidth",function(){return this.ca.width});
lh.prototype.__defineGetter__("canvasHeight",function(){return this.ca.height});lh.prototype.__defineGetter__("sliceWidth",v("Tc"));lh.prototype.__defineGetter__("sliceHeight",v("Qc"));lh.prototype.__defineSetter__("radiological",ca("tg"));w=lh.prototype;
w.Ca=function(){this.Qa||n(Error("No 2D orientation set."));lh.w.Ca.call(this,"2d");this.a.fillStyle="rgba(50,50,50,0)";this.a.fillRect(0,0,this.ca.width,this.ca.height);this.Vd=me("canvas");this.fd=me("canvas");this.fd.style.Dl="pixelated";L(this.J,xd,this.Rj.bind(this))};w.we=function(){lh.w.we.call(this);ph(this)};w.Nd=function(){lh.w.Nd.call(this);ph(this);var a=this.Ha[0];a&&(a.fa=a.ka,a.ga=a.ra)};w.update=function(a){this.vb(a);this.Ke=-1};
w.vb=function(a){lh.w.vb.call(this,a);var b=u;this.get(a.ja)&&(b=q);if(a instanceof P){var c=a.r,e=a.e,d=a.xa;if(e!=t&&e.r!=t&&e.r.j)this.vb(e);else if(d!=t&&d.r!=t&&d.r.j)this.aa.load(d,a);else{if(c!=t&&ka(c))if(a.zc!=t){if(a.zc.xf!=c.length)return}else{b=0;e=c.length;for(b=0;b<e;b++)this.aa.load(c[b],a);return}else if(c!=t&&c.j){this.aa.load(a,a);return}this.Fa="X"==this.Qa?0:"Y"==this.Qa?1:2;this.eb=a.c[this.Fa].c;d=t;d=0==this.Fa?a.indexX:1==this.Fa?a.indexY:a.indexZ;c=a.c[this.Fa].c[d].kg;e=
a.c[this.Fa].c[d].jg;this.Uc=a.c[this.Fa].c[d].Vc;this.Rc=a.c[this.Fa].c[d].Gc;this.Tc=c;this.Qc=e;d=this.Vd;d.width=c;d.height=e;var f=this.fd;f.width=c;f.height=e;this.gg=d.getContext("2d");this.lg=f.getContext("2d");b||(this.bb.add(a),ph(this))}}};function ph(a){var b=Math.min(a.L/(a.Tc*a.Uc),a.A/(a.Qc*a.Rc));a.J.n[14]=b}w.Hj=ba();
w.Ih=function(a,b){var c=this.Ha[0],e=this.J.n,d=t,f=this.Tc,g=this.Qc,h=t,l=t;if("Y"==this.Qa)d=this.eb[parseInt(c.indexY,10)],h=d.Vc,l=d.Gc,this.Sb[0]="rgba(255,0,0,.3)",this.Sb[1]="rgba(0,0,255,.3)";else if("Z"==this.Qa)d=this.eb[parseInt(c.indexZ,10)],h=d.Vc,l=d.Gc,this.Sb[0]="rgba(255,0,0,.3)",this.Sb[1]="rgba(0,255,0,.3)";else{d=this.eb[parseInt(c.indexX,10)];h=d.Gc;l=d.Vc;this.Sb[0]="rgba(0,255,0,.3)";this.Sb[1]="rgba(0,0,255,.3)";var j=f,f=g,g=j}var k=1*e[12],e=-1*e[13],j=[this.L/2,this.A/
2],h=f*h*this.yb,l=g*l*this.yb,m=j[0]-h/2,j=j[1]-l/2,m=m+k*this.yb,j=j+e*this.yb;return a>m&&a<m+h&&b>j&&b<j+l?(k=(a-m)/h*f,e=(b-j)/l*g,l=d.ei[4],"X"==this.Qa?(j=f-k,k=e,e=j):"Y"==this.Qa?k=f-k:"Z"==this.Qa&&(k=f-k,e=g-e),k=d.di+k*d.Vc,e=d.Yh+e*d.Gc,k=zc(k,e,l,1),f=Ac(),Lc(d.Rh,k,f),f=[Math.floor(f[0]),Math.floor(f[1]),Math.floor(f[2])],g=Ac(),Lc(d.Sh,k,g),d=Math.round((c.b[0].i[0]*g[0]+c.b[0].i[1]*g[1]+c.b[0].i[2]*g[2]+c.b[0].Ue)/c.b[0].Sc),d>=c.b[0].p?d=c.b[0].p-1:0>d&&(d=0),k=Math.round((c.b[1].i[0]*
g[0]+c.b[1].i[1]*g[1]+c.b[1].i[2]*g[2]+c.b[1].Ue)/c.b[1].Sc),k>=c.b[1].p?k=c.b[1].p-1:0>k&&(k=0),e=Math.round((c.b[2].i[0]*g[0]+c.b[2].i[1]*g[1]+c.b[2].i[2]*g[2]+c.b[2].Ue)/c.b[2].Sc),e>=c.b[2].p?e=c.b[2].p-1:0>e&&(e=0),[[d,k,e],[f[0],f[1],f[2]],[g[0],g[1],g[2]]]):t};
w.dc=function(a,b){lh.w.dc.call(this,a,b);if(0!=this.bb.F.length){var c=this.Ha[0],e=t,e=0==this.Fa?c.indexX:1==this.Fa?c.indexY:c.indexZ,d=this.eb[parseInt(e,10)].kg,f=this.eb[parseInt(e,10)].jg;this.Uc=this.eb[parseInt(e,10)].Vc;this.Rc=this.eb[parseInt(e,10)].Gc;this.Tc=d;this.Qc=f;var g=this.L,h=this.A,l=this.J.n;this.a.save();this.a.clearRect(-g,-h,2*g,2*h);this.a.restore();this.yb=Math.max(l[14],1E-4);this.a.setTransform(this.yb,0,0,this.yb,0,0);var j=1*l[12],l=-1*l[13],k=t;c.e&&(k=c.e.$e);
var m=this.eb[parseInt(e,10)],r=m.H.Wb,m=m.e,s=t;m&&(s=m.Wb);var y=this.Tc,z=this.Qc,G=this.gg,F=this.lg,H=G.getImageData(0,0,y,z),B=F.getImageData(0,0,y,z),E=H.data,I=B.data,N=E.length,Q=c.U,R=c.W,O=c.ga,ea=c.fa;if(this.Ke!=e||this.U!=Q||this.W!=R||this.ga!=O||this.fa!=ea||k&&!mg(k,this.mg,0)){var J=this.Vd;J.width=d;J.height=f;J=this.fd;J.width=d;J.height=f;d=0;do{var J=[0,0,0,0],f=[0,0,0,0],aa=r[d]/255*(c.ka-c.ra)+c.ra,da=ea-O,U=da/2+O,V=0,V=aa<U-da/2?0:aa>U+da/2?255:255*(aa-(U-da/2))/da;aa>=Q&&
aa<=R&&(J=new S(c.Rb[0],c.Rb[1],c.Rb[2]),J=(new S(c.Pb[0],c.Pb[1],c.Pb[2])).scale(V).add(J.scale(255-V)),J=[Math.floor(J.x),Math.floor(J.y),Math.floor(J.d),255],m&&(-255==k[3]?f=[s[d],s[d+1],s[d+2],s[d+3]]:mg(k,s,d)&&(f=[s[d],s[d+1],s[d+2],s[d+3]])));"X"==this.Qa?(E[d]=J[0],E[d+1]=J[1],E[d+2]=J[2],E[d+3]=J[3],I[d]=f[0],I[d+1]=f[1],I[d+2]=f[2],I[d+3]=f[3]):"Y"==this.Qa?(V=Math.floor(d/(4*y)),V=4*V*y+(4*(y-1)-(d-4*V*y)),E[V]=J[0],E[V+1]=J[1],E[V+2]=J[2],E[V+3]=J[3],I[V]=f[0],I[V+1]=f[1],I[V+2]=f[2],
I[V+3]=f[3]):(V=N-1-d,E[V-3]=J[0],E[V-2]=J[1],E[V-1]=J[2],E[V]=J[3],I[V-3]=f[0],I[V-2]=f[1],I[V-1]=f[2],I[V]=f[3]);d+=4}while(d<N);G.putImageData(H,0,0);F.putImageData(B,0,0);this.Ke=e;this.U=Q;this.W=R;this.ga=O;this.fa=ea;m&&(this.mg=k)}this.a.globalAlpha=1;this.a.translate(g/2/this.yb,h/2/this.yb);"X"==this.Qa&&(this.a.rotate(0.5*Math.PI),e=j,j=l,l=-e);j=-y*this.Uc/2+j;l=-z*this.Rc/2+l;this.a.drawImage(this.Vd,j,l,y*this.Uc,z*this.Rc);m&&c.e.O&&(this.a.globalAlpha=1,this.a.drawImage(this.fd,j,
l,y*this.Uc,z*this.Rc));if(this.R.SLICENAVIGATORS)if(this.ca.style.cursor="none",this.S.Yd&&this.S.xg&&!this.S.xb){if(j=this.S.ua,j=this.Ih(j[0],j[1]))c.Db=j[0][0],c.Eb=j[0][1],c.Fb=j[0][2],c.q(u),this.onSliceNavigation(),this.a.setTransform(1,0,0,1,0,0),this.a.beginPath(),this.a.moveTo(this.S.ua[0],0),this.a.lineTo(this.S.ua[0],this.S.ua[1]-1),this.a.moveTo(this.S.ua[0],this.S.ua[1]+1),this.a.lineTo(this.S.ua[0],this.A),this.a.strokeStyle=this.Sb[0],this.a.stroke(),this.a.closePath(),this.a.beginPath(),
this.a.moveTo(0,this.S.ua[1]),this.a.lineTo(this.S.ua[0]-1,this.S.ua[1]),this.a.moveTo(this.S.ua[0]+1,this.S.ua[1]),this.a.lineTo(this.L,this.S.ua[1]),this.a.strokeStyle=this.Sb[1],this.a.stroke(),this.a.closePath(),this.a.font="10pt Arial",this.a.textAlign="left",this.a.textBaseline="top",this.a.fillStyle="white",this.a.fillText("RAS: "+j[2][0].toFixed(2)+", "+j[2][1].toFixed(2)+", "+j[2][2].toFixed(2),0,0),y=m=l="undefined","undefined"!=typeof c.$[j[1][2].toFixed(0)]&&"undefined"!=typeof c.$[j[1][2].toFixed(0)][j[1][1].toFixed(0)]&&
(l=c.$[j[1][2].toFixed(0)][j[1][1].toFixed(0)][j[1][0].toFixed(0)],c.M&&(m=c.e.$[j[1][2].toFixed(0)][j[1][1].toFixed(0)][j[1][0].toFixed(0)],c.e.cd&&(y=c.e.cd.get(m),"undefined"!=typeof y&&(y=y[0])))),this.a.fillText("Background: "+l+" ("+j[1][0].toFixed(0)+", "+j[1][1].toFixed(0)+", "+j[1][2].toFixed(0)+")",0,15),c.M&&this.a.fillText("Labelmap: "+y+" ("+m+")",0,30)}else this.ca.style.cursor="default"}};A("X.renderer2D",lh);A("X.renderer2D.prototype.init",lh.prototype.Ca);
A("X.renderer2D.prototype.add",lh.prototype.add);A("X.renderer2D.prototype.onShowtime",lh.prototype.lh);A("X.renderer2D.prototype.onRender",lh.prototype.jh);A("X.renderer2D.prototype.onScroll",lh.prototype.Gj);A("X.renderer2D.prototype.onWindowLevel",lh.prototype.Qj);A("X.renderer2D.prototype.get",lh.prototype.get);A("X.renderer2D.prototype.resetViewAndRender",lh.prototype.Nd);A("X.renderer2D.prototype.xy2ijk",lh.prototype.Ih);A("X.renderer2D.prototype.render",lh.prototype.cc);
A("X.renderer2D.prototype.destroy",lh.prototype.Ta);A("X.renderer2D.prototype.onSliceNavigation",lh.prototype.Hj);A("X.renderer2D.prototype.afterRender",lh.prototype.zg);A("X.renderer2D.prototype.resize",lh.prototype.Xa);