-
Notifications
You must be signed in to change notification settings - Fork 8
/
xtk_release_1.js
executable file
·742 lines (742 loc) · 327 KB
/
xtk_release_1.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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
/*
*
* 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
*
*
*
*
*
*
*/
var COMPILED=!0,goog=goog||{};goog.global=this;goog.DEBUG=!0;goog.LOCALE="en";goog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a];for(var b=a;(b=b.substring(0,b.lastIndexOf(".")))&&!goog.getObjectByName(b);)goog.implicitNamespaces_[b]=!0}goog.exportPath_(a)};goog.setTestOnly=function(a){if(COMPILED&&!goog.DEBUG)throw a=a||"",Error("Importing test-only code into non-debug environment"+a?": "+a:".");};
if(!COMPILED)goog.isProvided_=function(a){return!goog.implicitNamespaces_[a]&&!!goog.getObjectByName(a)},goog.implicitNamespaces_={};goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;!(a[0]in c)&&c.execScript&&c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&goog.isDef(b)?c[d]=b:c=c[d]?c[d]:c[d]={}};goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e;e=c.shift();)if(goog.isDefAndNotNull(d[e]))d=d[e];else return null;return d};
goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};goog.addDependency=function(a,b,c){if(!COMPILED){for(var d,a=a.replace(/\\/g,"/"),e=goog.dependencies_,f=0;d=b[f];f++)e.nameToPath[d]=a,a in e.pathToNames||(e.pathToNames[a]={}),e.pathToNames[a][d]=!0;for(d=0;b=c[d];d++)a in e.requires||(e.requires[a]={}),e.requires[a][b]=!0}};goog.ENABLE_DEBUG_LOADER=!0;
goog.require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LOADER){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=!0;goog.writeScripts_();return}}a="goog.require could not find: "+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}};goog.basePath="";goog.nullFunction=function(){};goog.identityFunction=function(a){return a};goog.abstractMethod=function(){throw Error("unimplemented abstract method");};
goog.addSingletonGetter=function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a)}};
if(!COMPILED&&goog.ENABLE_DEBUG_LOADER)goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return"undefined"!=typeof a&&"write"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName("script"),b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?"),
d=-1==d?c.length:d;if("base.js"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}},goog.importScript_=function(a){var b=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[a]&&b(a)&&(goog.dependencies_.written[a]=!0)},goog.writeScriptTag_=function(a){return goog.inHtmlDocument_()?(goog.global.document.write('<script type="text/javascript" src="'+a+'"><\/script>'),!0):!1},goog.writeScripts_=function(){function a(e){if(!(e in d.written)){if(!(e in d.visited)&&(d.visited[e]=
!0,e in d.requires))for(var g in d.requires[e])if(!goog.isProvided_(g))if(g in d.nameToPath)a(d.nameToPath[g]);else throw Error("Undefined nameToPath for "+g);e in c||(c[e]=!0,b.push(e))}}var b=[],c={},d=goog.dependencies_,e;for(e in goog.included_)d.written[e]||a(e);for(e=0;e<b.length;e++)if(b[e])goog.importScript_(goog.basePath+b[e]);else throw Error("Undefined script input");},goog.getPathFromDeps_=function(a){return a in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[a]:null},goog.findBasePath_(),
goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js");
goog.typeOf=function(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};goog.propertyIsEnumerableCustom_=function(a,b){if(b in a)for(var c in a)if(c==b&&Object.prototype.hasOwnProperty.call(a,b))return!0;return!1};goog.propertyIsEnumerable_=function(a,b){return a instanceof Object?Object.prototype.propertyIsEnumerable.call(a,b):goog.propertyIsEnumerableCustom_(a,b)};goog.isDef=function(a){return void 0!==a};goog.isNull=function(a){return null===a};
goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return"array"==goog.typeOf(a)};goog.isArrayLike=function(a){var b=goog.typeOf(a);return"array"==b||"object"==b&&"number"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&"function"==typeof a.getFullYear};goog.isString=function(a){return"string"==typeof a};goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a};
goog.isFunction=function(a){return"function"==goog.typeOf(a)};goog.isObject=function(a){a=goog.typeOf(a);return"object"==a||"array"==a||"function"==a};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.removeUid=function(a){"removeAttribute"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};goog.UID_PROPERTY_="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36);goog.uidCounter_=0;
goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if(a.clone)return a.clone();var b="array"==b?[]:{},c;for(c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};
goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}};goog.bind=function(a,b,c){goog.bind=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bindNative_:goog.bindJs_;return goog.bind.apply(null,arguments)};
goog.partial=function(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)}};goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=Date.now||function(){return+new Date};
goog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,"JavaScript");else if(goog.global.eval){if(null==goog.evalWorksForGlobals_)goog.global.eval("var _et_ = 1;"),"undefined"!=typeof goog.global._et_?(delete goog.global._et_,goog.evalWorksForGlobals_=!0):goog.evalWorksForGlobals_=!1;if(goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement("script");c.type="text/javascript";c.defer=!1;c.appendChild(b.createTextNode(a));b.body.appendChild(c);
b.body.removeChild(c)}}else throw Error("goog.globalEval not available");};goog.evalWorksForGlobals_=null;goog.getCssName=function(a,b){var c=function(a){return goog.cssNameMapping_[a]||a},d;d=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?c:function(a){for(var a=a.split("-"),b=[],d=0;d<a.length;d++)b.push(c(a[d]));return b.join("-")}:function(a){return a};return b?a+"-"+d(b):d(a)};goog.setCssNameMapping=function(a,b){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=b};
if(!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING)goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING;goog.getMsg=function(a,b){var c=b||{},d;for(d in c)var e=(""+c[d]).replace(/\$/g,"$$$$"),a=a.replace(RegExp("\\{\\$"+d+"\\}","gi"),e);return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};goog.exportProperty=function(a,b,c){a[b]=c};goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};
goog.base=function(a,b,c){var d=arguments.callee.caller;if(d.superClass_)return d.superClass_.constructor.apply(a,Array.prototype.slice.call(arguments,1));for(var e=Array.prototype.slice.call(arguments,2),f=!1,g=a.constructor;g;g=g.superClass_&&g.superClass_.constructor)if(g.prototype[b]===d)f=!0;else if(f)return g.prototype[b].apply(a,e);if(a[b]===d)return a.constructor.prototype[b].apply(a,e);throw Error("goog.base called from a method of one name to a method of a different name");};
goog.scope=function(a){a.call(goog.global)};var __uniqueIdCounter=0,X=X||{};X.uniqueId=function(){return++__uniqueIdCounter};if(!Function.prototype.bind)Function.prototype.bind=function(a){if("function"!==typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice,c=b.call(arguments,1),d=this,e=function(){},f=function(){return d.apply(this instanceof e?this:a||window,c.concat(b.call(arguments)))};e.prototype=this.prototype;f.prototype=new e;return f};
goog.exportSymbol("Function.prototype.bind",Function.prototype.bind);goog.string={};goog.string.Unicode={NBSP:"\u00a0"};goog.string.startsWith=function(a,b){return 0==a.lastIndexOf(b,0)};goog.string.endsWith=function(a,b){var c=a.length-b.length;return 0<=c&&a.indexOf(b,c)==c};goog.string.caseInsensitiveStartsWith=function(a,b){return 0==goog.string.caseInsensitiveCompare(b,a.substr(0,b.length))};goog.string.caseInsensitiveEndsWith=function(a,b){return 0==goog.string.caseInsensitiveCompare(b,a.substr(a.length-b.length,b.length))};
goog.string.subs=function(a,b){for(var c=1;c<arguments.length;c++)var d=(""+arguments[c]).replace(/\$/g,"$$$$"),a=a.replace(/\%s/,d);return a};goog.string.collapseWhitespace=function(a){return a.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")};goog.string.isEmpty=function(a){return/^[\s\xa0]*$/.test(a)};goog.string.isEmptySafe=function(a){return goog.string.isEmpty(goog.string.makeSafe(a))};goog.string.isBreakingWhitespace=function(a){return!/[^\t\n\r ]/.test(a)};goog.string.isAlpha=function(a){return!/[^a-zA-Z]/.test(a)};
goog.string.isNumeric=function(a){return!/[^0-9]/.test(a)};goog.string.isAlphaNumeric=function(a){return!/[^a-zA-Z0-9]/.test(a)};goog.string.isSpace=function(a){return" "==a};goog.string.isUnicodeChar=function(a){return 1==a.length&&" "<=a&&"~">=a||"\u0080"<=a&&"\ufffd">=a};goog.string.stripNewlines=function(a){return a.replace(/(\r\n|\r|\n)+/g," ")};goog.string.canonicalizeNewlines=function(a){return a.replace(/(\r\n|\r|\n)/g,"\n")};
goog.string.normalizeWhitespace=function(a){return a.replace(/\xa0|\s/g," ")};goog.string.normalizeSpaces=function(a){return a.replace(/\xa0|[ \t]+/g," ")};goog.string.collapseBreakingSpaces=function(a){return a.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")};goog.string.trim=function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};goog.string.trimLeft=function(a){return a.replace(/^[\s\xa0]+/,"")};goog.string.trimRight=function(a){return a.replace(/[\s\xa0]+$/,"")};
goog.string.caseInsensitiveCompare=function(a,b){var c=(""+a).toLowerCase(),d=(""+b).toLowerCase();return c<d?-1:c==d?0:1};goog.string.numerateCompareRegExp_=/(\.\d+)|(\d+)|(\D+)/g;
goog.string.numerateCompare=function(a,b){if(a==b)return 0;if(!a)return-1;if(!b)return 1;for(var c=a.toLowerCase().match(goog.string.numerateCompareRegExp_),d=b.toLowerCase().match(goog.string.numerateCompareRegExp_),e=Math.min(c.length,d.length),f=0;f<e;f++){var g=c[f],h=d[f];if(g!=h){c=parseInt(g,10);return!isNaN(c)&&(d=parseInt(h,10),!isNaN(d)&&c-d)?c-d:g<h?-1:1}}return c.length!=d.length?c.length-d.length:a<b?-1:1};goog.string.encodeUriRegExp_=/^[a-zA-Z0-9\-_.!~*'()]*$/;
goog.string.urlEncode=function(a){a=""+a;return!goog.string.encodeUriRegExp_.test(a)?encodeURIComponent(a):a};goog.string.urlDecode=function(a){return decodeURIComponent(a.replace(/\+/g," "))};goog.string.newLineToBr=function(a,b){return a.replace(/(\r\n|\r|\n)/g,b?"<br />":"<br>")};
goog.string.htmlEscape=function(a,b){if(b)return a.replace(goog.string.amperRe_,"&").replace(goog.string.ltRe_,"<").replace(goog.string.gtRe_,">").replace(goog.string.quotRe_,""");if(!goog.string.allRe_.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(goog.string.amperRe_,"&"));-1!=a.indexOf("<")&&(a=a.replace(goog.string.ltRe_,"<"));-1!=a.indexOf(">")&&(a=a.replace(goog.string.gtRe_,">"));-1!=a.indexOf('"')&&(a=a.replace(goog.string.quotRe_,"""));return a};
goog.string.amperRe_=/&/g;goog.string.ltRe_=/</g;goog.string.gtRe_=/>/g;goog.string.quotRe_=/\"/g;goog.string.allRe_=/[&<>\"]/;goog.string.unescapeEntities=function(a){return goog.string.contains(a,"&")?"document"in goog.global?goog.string.unescapeEntitiesUsingDom_(a):goog.string.unescapePureXmlEntities_(a):a};
goog.string.unescapeEntitiesUsingDom_=function(a){var b={"&":"&","<":"<",">":">",""":'"'},c=document.createElement("div");return a.replace(goog.string.HTML_ENTITY_PATTERN_,function(a,e){var f=b[a];if(f)return f;if("#"==e.charAt(0)){var g=Number("0"+e.substr(1));isNaN(g)||(f=String.fromCharCode(g))}if(!f)c.innerHTML=a+" ",f=c.firstChild.nodeValue.slice(0,-1);return b[a]=f})};
goog.string.unescapePureXmlEntities_=function(a){return a.replace(/&([^;]+);/g,function(a,c){switch(c){case "amp":return"&";case "lt":return"<";case "gt":return">";case "quot":return'"';default:if("#"==c.charAt(0)){var d=Number("0"+c.substr(1));if(!isNaN(d))return String.fromCharCode(d)}return a}})};goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g;goog.string.whitespaceEscape=function(a,b){return goog.string.newLineToBr(a.replace(/ /g,"  "),b)};
goog.string.stripQuotes=function(a,b){for(var c=b.length,d=0;d<c;d++){var e=1==c?b:b.charAt(d);if(a.charAt(0)==e&&a.charAt(a.length-1)==e)return a.substring(1,a.length-1)}return a};goog.string.truncate=function(a,b,c){c&&(a=goog.string.unescapeEntities(a));a.length>b&&(a=a.substring(0,b-3)+"...");c&&(a=goog.string.htmlEscape(a));return a};
goog.string.truncateMiddle=function(a,b,c,d){c&&(a=goog.string.unescapeEntities(a));if(d&&a.length>b){d>b&&(d=b);var e=a.length-d,a=a.substring(0,b-d)+"..."+a.substring(e)}else a.length>b&&(d=Math.floor(b/2),e=a.length-d,a=a.substring(0,d+b%2)+"..."+a.substring(e));c&&(a=goog.string.htmlEscape(a));return a};goog.string.specialEscapeChars_={"\x00":"\\0","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\u000b":"\\x0B",'"':'\\"',"\\":"\\\\"};goog.string.jsEscapeCache_={"'":"\\'"};
goog.string.quote=function(a){a=""+a;if(a.quote)return a.quote();for(var b=['"'],c=0;c<a.length;c++){var d=a.charAt(c),e=d.charCodeAt(0);b[c+1]=goog.string.specialEscapeChars_[d]||(31<e&&127>e?d:goog.string.escapeChar(d))}b.push('"');return b.join("")};goog.string.escapeString=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=goog.string.escapeChar(a.charAt(c));return b.join("")};
goog.string.escapeChar=function(a){if(a in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[a];if(a in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[a]=goog.string.specialEscapeChars_[a];var b=a,c=a.charCodeAt(0);if(31<c&&127>c)b=a;else{if(256>c){if(b="\\x",16>c||256<c)b+="0"}else b="\\u",4096>c&&(b+="0");b+=c.toString(16).toUpperCase()}return goog.string.jsEscapeCache_[a]=b};goog.string.toMap=function(a){for(var b={},c=0;c<a.length;c++)b[a.charAt(c)]=!0;return b};
goog.string.contains=function(a,b){return-1!=a.indexOf(b)};goog.string.countOf=function(a,b){return a&&b?a.split(b).length-1:0};goog.string.removeAt=function(a,b,c){var d=a;0<=b&&b<a.length&&0<c&&(d=a.substr(0,b)+a.substr(b+c,a.length-b-c));return d};goog.string.remove=function(a,b){var c=RegExp(goog.string.regExpEscape(b),"");return a.replace(c,"")};goog.string.removeAll=function(a,b){var c=RegExp(goog.string.regExpEscape(b),"g");return a.replace(c,"")};
goog.string.regExpEscape=function(a){return(""+a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")};goog.string.repeat=function(a,b){return Array(b+1).join(a)};goog.string.padNumber=function(a,b,c){a=goog.isDef(c)?a.toFixed(c):""+a;c=a.indexOf(".");if(-1==c)c=a.length;return goog.string.repeat("0",Math.max(0,b-c))+a};goog.string.makeSafe=function(a){return null==a?"":""+a};goog.string.buildString=function(a){return Array.prototype.join.call(arguments,"")};
goog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)};
goog.string.compareVersions=function(a,b){for(var c=0,d=goog.string.trim(""+a).split("."),e=goog.string.trim(""+b).split("."),f=Math.max(d.length,e.length),g=0;0==c&&g<f;g++){var h=d[g]||"",i=e[g]||"",j=RegExp("(\\d*)(\\D*)","g"),k=RegExp("(\\d*)(\\D*)","g");do{var l=j.exec(h)||["","",""],m=k.exec(i)||["","",""];if(0==l[0].length&&0==m[0].length)break;var c=0==l[1].length?0:parseInt(l[1],10),n=0==m[1].length?0:parseInt(m[1],10),c=goog.string.compareElements_(c,n)||goog.string.compareElements_(0==
l[2].length,0==m[2].length)||goog.string.compareElements_(l[2],m[2])}while(0==c)}return c};goog.string.compareElements_=function(a,b){return a<b?-1:a>b?1:0};goog.string.HASHCODE_MAX_=4294967296;goog.string.hashCode=function(a){for(var b=0,c=0;c<a.length;++c)b=31*b+a.charCodeAt(c),b%=goog.string.HASHCODE_MAX_;return b};goog.string.uniqueStringCounter_=2147483648*Math.random()|0;goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++};
goog.string.toNumber=function(a){var b=Number(a);return 0==b&&goog.string.isEmpty(a)?NaN:b};goog.string.toCamelCaseCache_={};goog.string.toCamelCase=function(a){return goog.string.toCamelCaseCache_[a]||(goog.string.toCamelCaseCache_[a]=(""+a).replace(/\-([a-z])/g,function(a,c){return c.toUpperCase()}))};goog.string.toSelectorCaseCache_={};goog.string.toSelectorCase=function(a){return goog.string.toSelectorCaseCache_[a]||(goog.string.toSelectorCaseCache_[a]=(""+a).replace(/([A-Z])/g,"-$1").toLowerCase())};goog.userAgent={};goog.userAgent.ASSUME_IE=!1;goog.userAgent.ASSUME_GECKO=!1;goog.userAgent.ASSUME_WEBKIT=!1;goog.userAgent.ASSUME_MOBILE_WEBKIT=!1;goog.userAgent.ASSUME_OPERA=!1;goog.userAgent.ASSUME_ANY_VERSION=!1;goog.userAgent.BROWSER_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_GECKO||goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_OPERA;
goog.userAgent.getUserAgentString=function(){return goog.global.navigator?goog.global.navigator.userAgent:null};goog.userAgent.getNavigator=function(){return goog.global.navigator};
goog.userAgent.init_=function(){goog.userAgent.detectedOpera_=!1;goog.userAgent.detectedIe_=!1;goog.userAgent.detectedWebkit_=!1;goog.userAgent.detectedMobile_=!1;goog.userAgent.detectedGecko_=!1;var a;if(!goog.userAgent.BROWSER_KNOWN_&&(a=goog.userAgent.getUserAgentString())){var b=goog.userAgent.getNavigator();goog.userAgent.detectedOpera_=0==a.indexOf("Opera");goog.userAgent.detectedIe_=!goog.userAgent.detectedOpera_&&-1!=a.indexOf("MSIE");goog.userAgent.detectedWebkit_=!goog.userAgent.detectedOpera_&&
-1!=a.indexOf("WebKit");goog.userAgent.detectedMobile_=goog.userAgent.detectedWebkit_&&-1!=a.indexOf("Mobile");goog.userAgent.detectedGecko_=!goog.userAgent.detectedOpera_&&!goog.userAgent.detectedWebkit_&&"Gecko"==b.product}};goog.userAgent.BROWSER_KNOWN_||goog.userAgent.init_();goog.userAgent.OPERA=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_OPERA:goog.userAgent.detectedOpera_;goog.userAgent.IE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_IE:goog.userAgent.detectedIe_;
goog.userAgent.GECKO=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_GECKO:goog.userAgent.detectedGecko_;goog.userAgent.WEBKIT=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_MOBILE_WEBKIT:goog.userAgent.detectedWebkit_;goog.userAgent.MOBILE=goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.detectedMobile_;goog.userAgent.SAFARI=goog.userAgent.WEBKIT;goog.userAgent.determinePlatform_=function(){var a=goog.userAgent.getNavigator();return a&&a.platform||""};
goog.userAgent.PLATFORM=goog.userAgent.determinePlatform_();goog.userAgent.ASSUME_MAC=!1;goog.userAgent.ASSUME_WINDOWS=!1;goog.userAgent.ASSUME_LINUX=!1;goog.userAgent.ASSUME_X11=!1;goog.userAgent.PLATFORM_KNOWN_=goog.userAgent.ASSUME_MAC||goog.userAgent.ASSUME_WINDOWS||goog.userAgent.ASSUME_LINUX||goog.userAgent.ASSUME_X11;
goog.userAgent.initPlatform_=function(){goog.userAgent.detectedMac_=goog.string.contains(goog.userAgent.PLATFORM,"Mac");goog.userAgent.detectedWindows_=goog.string.contains(goog.userAgent.PLATFORM,"Win");goog.userAgent.detectedLinux_=goog.string.contains(goog.userAgent.PLATFORM,"Linux");goog.userAgent.detectedX11_=!!goog.userAgent.getNavigator()&&goog.string.contains(goog.userAgent.getNavigator().appVersion||"","X11")};goog.userAgent.PLATFORM_KNOWN_||goog.userAgent.initPlatform_();
goog.userAgent.MAC=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_MAC:goog.userAgent.detectedMac_;goog.userAgent.WINDOWS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_WINDOWS:goog.userAgent.detectedWindows_;goog.userAgent.LINUX=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_LINUX:goog.userAgent.detectedLinux_;goog.userAgent.X11=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_X11:goog.userAgent.detectedX11_;
goog.userAgent.determineVersion_=function(){var a="",b;goog.userAgent.OPERA&&goog.global.opera?(a=goog.global.opera.version,a="function"==typeof a?a():a):(goog.userAgent.GECKO?b=/rv\:([^\);]+)(\)|;)/:goog.userAgent.IE?b=/MSIE\s+([^\);]+)(\)|;)/:goog.userAgent.WEBKIT&&(b=/WebKit\/(\S+)/),b&&(a=(a=b.exec(goog.userAgent.getUserAgentString()))?a[1]:""));return goog.userAgent.IE&&(b=goog.userAgent.getDocumentMode_(),b>parseFloat(a))?""+b:a};
goog.userAgent.getDocumentMode_=function(){var a=goog.global.document;return a?a.documentMode:void 0};goog.userAgent.VERSION=goog.userAgent.determineVersion_();goog.userAgent.compare=function(a,b){return goog.string.compareVersions(a,b)};goog.userAgent.isVersionCache_={};goog.userAgent.isVersion=function(a){return goog.userAgent.ASSUME_ANY_VERSION||goog.userAgent.isVersionCache_[a]||(goog.userAgent.isVersionCache_[a]=0<=goog.string.compareVersions(goog.userAgent.VERSION,a))};
goog.userAgent.isDocumentModeCache_={};goog.userAgent.isDocumentMode=function(a){return goog.userAgent.isDocumentModeCache_[a]||(goog.userAgent.isDocumentModeCache_[a]=goog.userAgent.IE&&document.documentMode&&document.documentMode>=a)};goog.structs={};goog.structs.Collection=function(){};goog.object={};goog.object.forEach=function(a,b,c){for(var d in a)b.call(c,a[d],d,a)};goog.object.filter=function(a,b,c){var d={},e;for(e in a)b.call(c,a[e],e,a)&&(d[e]=a[e]);return d};goog.object.map=function(a,b,c){var d={},e;for(e in a)d[e]=b.call(c,a[e],e,a);return d};goog.object.some=function(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return!0;return!1};goog.object.every=function(a,b,c){for(var d in a)if(!b.call(c,a[d],d,a))return!1;return!0};
goog.object.getCount=function(a){var b=0,c;for(c in a)b++;return b};goog.object.getAnyKey=function(a){for(var b in a)return b};goog.object.getAnyValue=function(a){for(var b in a)return a[b]};goog.object.contains=function(a,b){return goog.object.containsValue(a,b)};goog.object.getValues=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b};goog.object.getKeys=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b};
goog.object.getValueByKeys=function(a,b){for(var c=goog.isArrayLike(b),d=c?b:arguments,c=c?0:1;c<d.length&&!(a=a[d[c]],!goog.isDef(a));c++);return a};goog.object.containsKey=function(a,b){return b in a};goog.object.containsValue=function(a,b){for(var c in a)if(a[c]==b)return!0;return!1};goog.object.findKey=function(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return d};goog.object.findValue=function(a,b,c){return(b=goog.object.findKey(a,b,c))&&a[b]};
goog.object.isEmpty=function(a){for(var b in a)return!1;return!0};goog.object.clear=function(a){for(var b in a)delete a[b]};goog.object.remove=function(a,b){var c;(c=b in a)&&delete a[b];return c};goog.object.add=function(a,b,c){if(b in a)throw Error('The object already contains the key "'+b+'"');goog.object.set(a,b,c)};goog.object.get=function(a,b,c){return b in a?a[b]:c};goog.object.set=function(a,b,c){a[b]=c};goog.object.setIfUndefined=function(a,b,c){return b in a?a[b]:a[b]=c};
goog.object.clone=function(a){var b={},c;for(c in a)b[c]=a[c];return b};goog.object.unsafeClone=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if(a.clone)return a.clone();var b="array"==b?[]:{},c;for(c in a)b[c]=goog.object.unsafeClone(a[c]);return b}return a};goog.object.transpose=function(a){var b={},c;for(c in a)b[a[c]]=c;return b};goog.object.PROTOTYPE_FIELDS_="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
goog.object.extend=function(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<goog.object.PROTOTYPE_FIELDS_.length;f++)c=goog.object.PROTOTYPE_FIELDS_[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};
goog.object.create=function(a){var b=arguments.length;if(1==b&&goog.isArray(arguments[0]))return goog.object.create.apply(null,arguments[0]);if(b%2)throw Error("Uneven number of arguments");for(var c={},d=0;d<b;d+=2)c[arguments[d]]=arguments[d+1];return c};goog.object.createSet=function(a){var b=arguments.length;if(1==b&&goog.isArray(arguments[0]))return goog.object.createSet.apply(null,arguments[0]);for(var c={},d=0;d<b;d++)c[arguments[d]]=!0;return c};goog.debug={};goog.debug.Error=function(a){this.stack=Error().stack||"";if(a)this.message=""+a};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name="CustomError";goog.asserts={};goog.asserts.ENABLE_ASSERTS=goog.DEBUG;goog.asserts.AssertionError=function(a,b){b.unshift(a);goog.debug.Error.call(this,goog.string.subs.apply(null,b));b.shift();this.messagePattern=a};goog.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name="AssertionError";goog.asserts.doAssertFailure_=function(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);throw new goog.asserts.AssertionError(""+e,f||[]);};
goog.asserts.assert=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!a&&goog.asserts.doAssertFailure_("",null,b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.fail=function(a,b){if(goog.asserts.ENABLE_ASSERTS)throw new goog.asserts.AssertionError("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};
goog.asserts.assertNumber=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(a)&&goog.asserts.doAssertFailure_("Expected number but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertString=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isString(a)&&goog.asserts.doAssertFailure_("Expected string but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
goog.asserts.assertFunction=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(a)&&goog.asserts.doAssertFailure_("Expected function but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertObject=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isObject(a)&&goog.asserts.doAssertFailure_("Expected object but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
goog.asserts.assertArray=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isArray(a)&&goog.asserts.doAssertFailure_("Expected array but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertBoolean=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(a)&&goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};
goog.asserts.assertInstanceof=function(a,b,c,d){goog.asserts.ENABLE_ASSERTS&&!(a instanceof b)&&goog.asserts.doAssertFailure_("instanceof check failed.",null,c,Array.prototype.slice.call(arguments,3))};goog.array={};goog.NATIVE_ARRAY_PROTOTYPES=!0;goog.array.peek=function(a){return a[a.length-1]};goog.array.ARRAY_PROTOTYPE_=Array.prototype;
goog.array.indexOf=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.indexOf?function(a,b,c){goog.asserts.assert(null!=a.length);return goog.array.ARRAY_PROTOTYPE_.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(goog.isString(a))return!goog.isString(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};
goog.array.lastIndexOf=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.lastIndexOf?function(a,b,c){goog.asserts.assert(null!=a.length);return goog.array.ARRAY_PROTOTYPE_.lastIndexOf.call(a,b,null==c?a.length-1:c)}:function(a,b,c){c=null==c?a.length-1:c;0>c&&(c=Math.max(0,a.length+c));if(goog.isString(a))return!goog.isString(b)||1!=b.length?-1:a.lastIndexOf(b,c);for(;0<=c;c--)if(c in a&&a[c]===b)return c;return-1};
goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.forEach?function(a,b,c){goog.asserts.assert(null!=a.length);goog.array.ARRAY_PROTOTYPE_.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)};goog.array.forEachRight=function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(""):a,d=d-1;0<=d;--d)d in e&&b.call(c,e[d],d,a)};
goog.array.filter=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.filter?function(a,b,c){goog.asserts.assert(null!=a.length);return goog.array.ARRAY_PROTOTYPE_.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=goog.isString(a)?a.split(""):a,h=0;h<d;h++)if(h in g){var i=g[h];b.call(c,i,h,a)&&(e[f++]=i)}return e};
goog.array.map=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.map?function(a,b,c){goog.asserts.assert(null!=a.length);return goog.array.ARRAY_PROTOTYPE_.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=goog.isString(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e};goog.array.reduce=function(a,b,c,d){if(a.reduce)return d?a.reduce(goog.bind(b,d),c):a.reduce(b,c);var e=c;goog.array.forEach(a,function(c,g){e=b.call(d,e,c,g,a)});return e};
goog.array.reduceRight=function(a,b,c,d){if(a.reduceRight)return d?a.reduceRight(goog.bind(b,d),c):a.reduceRight(b,c);var e=c;goog.array.forEachRight(a,function(c,g){e=b.call(d,e,c,g,a)});return e};
goog.array.some=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.some?function(a,b,c){goog.asserts.assert(null!=a.length);return goog.array.ARRAY_PROTOTYPE_.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return!0;return!1};
goog.array.every=goog.NATIVE_ARRAY_PROTOTYPES&&goog.array.ARRAY_PROTOTYPE_.every?function(a,b,c){goog.asserts.assert(null!=a.length);return goog.array.ARRAY_PROTOTYPE_.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};goog.array.find=function(a,b,c){b=goog.array.findIndex(a,b,c);return 0>b?null:goog.isString(a)?a.charAt(b):a[b]};
goog.array.findIndex=function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1};goog.array.findRight=function(a,b,c){b=goog.array.findIndexRight(a,b,c);return 0>b?null:goog.isString(a)?a.charAt(b):a[b]};goog.array.findIndexRight=function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(""):a,d=d-1;0<=d;d--)if(d in e&&b.call(c,e[d],d,a))return d;return-1};goog.array.contains=function(a,b){return 0<=goog.array.indexOf(a,b)};
goog.array.isEmpty=function(a){return 0==a.length};goog.array.clear=function(a){if(!goog.isArray(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0};goog.array.insert=function(a,b){goog.array.contains(a,b)||a.push(b)};goog.array.insertAt=function(a,b,c){goog.array.splice(a,c,0,b)};goog.array.insertArrayAt=function(a,b,c){goog.partial(goog.array.splice,a,c,0).apply(null,b)};
goog.array.insertBefore=function(a,b,c){var d;2==arguments.length||0>(d=goog.array.indexOf(a,c))?a.push(b):goog.array.insertAt(a,b,d)};goog.array.remove=function(a,b){var c=goog.array.indexOf(a,b),d;(d=0<=c)&&goog.array.removeAt(a,c);return d};goog.array.removeAt=function(a,b){goog.asserts.assert(null!=a.length);return 1==goog.array.ARRAY_PROTOTYPE_.splice.call(a,b,1).length};goog.array.removeIf=function(a,b,c){b=goog.array.findIndex(a,b,c);return 0<=b?(goog.array.removeAt(a,b),!0):!1};
goog.array.concat=function(a){return goog.array.ARRAY_PROTOTYPE_.concat.apply(goog.array.ARRAY_PROTOTYPE_,arguments)};goog.array.clone=function(a){if(goog.isArray(a))return goog.array.concat(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b};goog.array.toArray=function(a){return goog.isArray(a)?goog.array.concat(a):goog.array.clone(a)};
goog.array.extend=function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c],e;if(goog.isArray(d)||(e=goog.isArrayLike(d))&&d.hasOwnProperty("callee"))a.push.apply(a,d);else if(e)for(var f=a.length,g=d.length,h=0;h<g;h++)a[f+h]=d[h];else a.push(d)}};goog.array.splice=function(a,b,c,d){goog.asserts.assert(null!=a.length);return goog.array.ARRAY_PROTOTYPE_.splice.apply(a,goog.array.slice(arguments,1))};
goog.array.slice=function(a,b,c){goog.asserts.assert(null!=a.length);return 2>=arguments.length?goog.array.ARRAY_PROTOTYPE_.slice.call(a,b):goog.array.ARRAY_PROTOTYPE_.slice.call(a,b,c)};goog.array.removeDuplicates=function(a,b){for(var c=b||a,d={},e=0,f=0;f<a.length;){var g=a[f++],h=goog.isObject(g)?"o"+goog.getUid(g):(typeof g).charAt(0)+g;Object.prototype.hasOwnProperty.call(d,h)||(d[h]=!0,c[e++]=g)}c.length=e};
goog.array.binarySearch=function(a,b,c){return goog.array.binarySearch_(a,c||goog.array.defaultCompare,!1,b)};goog.array.binarySelect=function(a,b,c){return goog.array.binarySearch_(a,b,!0,void 0,c)};goog.array.binarySearch_=function(a,b,c,d,e){for(var f=0,g=a.length,h;f<g;){var i=f+g>>1,j;j=c?b.call(e,a[i],i,a):b(d,a[i]);0<j?f=i+1:(g=i,h=!j)}return h?f:~f};goog.array.sort=function(a,b){goog.asserts.assert(null!=a.length);goog.array.ARRAY_PROTOTYPE_.sort.call(a,b||goog.array.defaultCompare)};
goog.array.stableSort=function(a,b){for(var c=0;c<a.length;c++)a[c]={index:c,value:a[c]};var d=b||goog.array.defaultCompare;goog.array.sort(a,function(a,b){return d(a.value,b.value)||a.index-b.index});for(c=0;c<a.length;c++)a[c]=a[c].value};goog.array.sortObjectsByKey=function(a,b,c){var d=c||goog.array.defaultCompare;goog.array.sort(a,function(a,c){return d(a[b],c[b])})};
goog.array.isSorted=function(a,b,c){for(var b=b||goog.array.defaultCompare,d=1;d<a.length;d++){var e=b(a[d-1],a[d]);if(0<e||0==e&&c)return!1}return!0};goog.array.equals=function(a,b,c){if(!goog.isArrayLike(a)||!goog.isArrayLike(b)||a.length!=b.length)return!1;for(var d=a.length,c=c||goog.array.defaultCompareEquality,e=0;e<d;e++)if(!c(a[e],b[e]))return!1;return!0};goog.array.compare=function(a,b,c){return goog.array.equals(a,b,c)};
goog.array.compare3=function(a,b,c){for(var c=c||goog.array.defaultCompare,d=Math.min(a.length,b.length),e=0;e<d;e++){var f=c(a[e],b[e]);if(0!=f)return f}return goog.array.defaultCompare(a.length,b.length)};goog.array.defaultCompare=function(a,b){return a>b?1:a<b?-1:0};goog.array.defaultCompareEquality=function(a,b){return a===b};goog.array.binaryInsert=function(a,b,c){c=goog.array.binarySearch(a,b,c);return 0>c?(goog.array.insertAt(a,b,-(c+1)),!0):!1};
goog.array.binaryRemove=function(a,b,c){b=goog.array.binarySearch(a,b,c);return 0<=b?goog.array.removeAt(a,b):!1};goog.array.bucket=function(a,b){for(var c={},d=0;d<a.length;d++){var e=a[d],f=b(e,d,a);goog.isDef(f)&&(c[f]||(c[f]=[])).push(e)}return c};goog.array.repeat=function(a,b){for(var c=[],d=0;d<b;d++)c[d]=a;return c};goog.array.flatten=function(a){for(var b=[],c=0;c<arguments.length;c++){var d=arguments[c];goog.isArray(d)?b.push.apply(b,goog.array.flatten.apply(null,d)):b.push(d)}return b};
goog.array.rotate=function(a,b){goog.asserts.assert(null!=a.length);a.length&&(b%=a.length,0<b?goog.array.ARRAY_PROTOTYPE_.unshift.apply(a,a.splice(-b,b)):0>b&&goog.array.ARRAY_PROTOTYPE_.push.apply(a,a.splice(0,-b)));return a};goog.array.zip=function(a){if(!arguments.length)return[];for(var b=[],c=0;;c++){for(var d=[],e=0;e<arguments.length;e++){var f=arguments[e];if(c>=f.length)return b;d.push(f[c])}b.push(d)}};
goog.array.shuffle=function(a,b){for(var c=b||Math.random,d=a.length-1;0<d;d--){var e=Math.floor(c()*(d+1)),f=a[d];a[d]=a[e];a[e]=f}};goog.structs.getCount=function(a){return"function"==typeof a.getCount?a.getCount():goog.isArrayLike(a)||goog.isString(a)?a.length:goog.object.getCount(a)};goog.structs.getValues=function(a){if("function"==typeof a.getValues)return a.getValues();if(goog.isString(a))return a.split("");if(goog.isArrayLike(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return goog.object.getValues(a)};
goog.structs.getKeys=function(a){if("function"==typeof a.getKeys)return a.getKeys();if("function"!=typeof a.getValues){if(goog.isArrayLike(a)||goog.isString(a)){for(var b=[],a=a.length,c=0;c<a;c++)b.push(c);return b}return goog.object.getKeys(a)}};goog.structs.contains=function(a,b){return"function"==typeof a.contains?a.contains(b):"function"==typeof a.containsValue?a.containsValue(b):goog.isArrayLike(a)||goog.isString(a)?goog.array.contains(a,b):goog.object.containsValue(a,b)};
goog.structs.isEmpty=function(a){return"function"==typeof a.isEmpty?a.isEmpty():goog.isArrayLike(a)||goog.isString(a)?goog.array.isEmpty(a):goog.object.isEmpty(a)};goog.structs.clear=function(a){"function"==typeof a.clear?a.clear():goog.isArrayLike(a)?goog.array.clear(a):goog.object.clear(a)};
goog.structs.forEach=function(a,b,c){if("function"==typeof a.forEach)a.forEach(b,c);else if(goog.isArrayLike(a)||goog.isString(a))goog.array.forEach(a,b,c);else for(var d=goog.structs.getKeys(a),e=goog.structs.getValues(a),f=e.length,g=0;g<f;g++)b.call(c,e[g],d&&d[g],a)};
goog.structs.filter=function(a,b,c){if("function"==typeof a.filter)return a.filter(b,c);if(goog.isArrayLike(a)||goog.isString(a))return goog.array.filter(a,b,c);var d,e=goog.structs.getKeys(a),f=goog.structs.getValues(a),g=f.length;if(e){d={};for(var h=0;h<g;h++)b.call(c,f[h],e[h],a)&&(d[e[h]]=f[h])}else{d=[];for(h=0;h<g;h++)b.call(c,f[h],void 0,a)&&d.push(f[h])}return d};
goog.structs.map=function(a,b,c){if("function"==typeof a.map)return a.map(b,c);if(goog.isArrayLike(a)||goog.isString(a))return goog.array.map(a,b,c);var d,e=goog.structs.getKeys(a),f=goog.structs.getValues(a),g=f.length;if(e){d={};for(var h=0;h<g;h++)d[e[h]]=b.call(c,f[h],e[h],a)}else{d=[];for(h=0;h<g;h++)d[h]=b.call(c,f[h],void 0,a)}return d};
goog.structs.some=function(a,b,c){if("function"==typeof a.some)return a.some(b,c);if(goog.isArrayLike(a)||goog.isString(a))return goog.array.some(a,b,c);for(var d=goog.structs.getKeys(a),e=goog.structs.getValues(a),f=e.length,g=0;g<f;g++)if(b.call(c,e[g],d&&d[g],a))return!0;return!1};
goog.structs.every=function(a,b,c){if("function"==typeof a.every)return a.every(b,c);if(goog.isArrayLike(a)||goog.isString(a))return goog.array.every(a,b,c);for(var d=goog.structs.getKeys(a),e=goog.structs.getValues(a),f=e.length,g=0;g<f;g++)if(!b.call(c,e[g],d&&d[g],a))return!1;return!0};goog.iter={};goog.iter.StopIteration="StopIteration"in goog.global?goog.global.StopIteration:Error("StopIteration");goog.iter.Iterator=function(){};goog.iter.Iterator.prototype.next=function(){throw goog.iter.StopIteration;};goog.iter.Iterator.prototype.__iterator__=function(){return this};
goog.iter.toIterator=function(a){if(a instanceof goog.iter.Iterator)return a;if("function"==typeof a.__iterator__)return a.__iterator__(!1);if(goog.isArrayLike(a)){var b=0,c=new goog.iter.Iterator;c.next=function(){for(;;){if(b>=a.length)throw goog.iter.StopIteration;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");};
goog.iter.forEach=function(a,b,c){if(goog.isArrayLike(a))try{goog.array.forEach(a,b,c)}catch(d){if(d!==goog.iter.StopIteration)throw d;}else{a=goog.iter.toIterator(a);try{for(;;)b.call(c,a.next(),void 0,a)}catch(e){if(e!==goog.iter.StopIteration)throw e;}}};goog.iter.filter=function(a,b,c){var a=goog.iter.toIterator(a),d=new goog.iter.Iterator;d.next=function(){for(;;){var d=a.next();if(b.call(c,d,void 0,a))return d}};return d};
goog.iter.range=function(a,b,c){var d=0,e=a,f=c||1;1<arguments.length&&(d=a,e=b);if(0==f)throw Error("Range step argument must not be zero");var g=new goog.iter.Iterator;g.next=function(){if(0<f&&d>=e||0>f&&d<=e)throw goog.iter.StopIteration;var a=d;d+=f;return a};return g};goog.iter.join=function(a,b){return goog.iter.toArray(a).join(b)};goog.iter.map=function(a,b,c){var a=goog.iter.toIterator(a),d=new goog.iter.Iterator;d.next=function(){for(;;){var d=a.next();return b.call(c,d,void 0,a)}};return d};
goog.iter.reduce=function(a,b,c,d){var e=c;goog.iter.forEach(a,function(a){e=b.call(d,e,a)});return e};goog.iter.some=function(a,b,c){a=goog.iter.toIterator(a);try{for(;;)if(b.call(c,a.next(),void 0,a))return!0}catch(d){if(d!==goog.iter.StopIteration)throw d;}return!1};goog.iter.every=function(a,b,c){a=goog.iter.toIterator(a);try{for(;;)if(!b.call(c,a.next(),void 0,a))return!1}catch(d){if(d!==goog.iter.StopIteration)throw d;}return!0};
goog.iter.chain=function(a){var b=arguments,c=b.length,d=0,e=new goog.iter.Iterator;e.next=function(){try{if(d>=c)throw goog.iter.StopIteration;return goog.iter.toIterator(b[d]).next()}catch(a){if(a!==goog.iter.StopIteration||d>=c)throw a;d++;return this.next()}};return e};goog.iter.dropWhile=function(a,b,c){var a=goog.iter.toIterator(a),d=new goog.iter.Iterator,e=!0;d.next=function(){for(;;){var d=a.next();if(!e||!b.call(c,d,void 0,a))return e=!1,d}};return d};
goog.iter.takeWhile=function(a,b,c){var a=goog.iter.toIterator(a),d=new goog.iter.Iterator,e=!0;d.next=function(){for(;;)if(e){var d=a.next();if(b.call(c,d,void 0,a))return d;e=!1}else throw goog.iter.StopIteration;};return d};goog.iter.toArray=function(a){if(goog.isArrayLike(a))return goog.array.toArray(a);var a=goog.iter.toIterator(a),b=[];goog.iter.forEach(a,function(a){b.push(a)});return b};
goog.iter.equals=function(a,b){var a=goog.iter.toIterator(a),b=goog.iter.toIterator(b),c,d;try{for(;;){c=d=!1;var e=a.next();c=!0;var f=b.next();d=!0;if(e!=f)break}}catch(g){if(g!==goog.iter.StopIteration)throw g;if(c&&!d)return!1;if(!d)try{b.next()}catch(h){if(h!==goog.iter.StopIteration)throw h;return!0}}return!1};goog.iter.nextOrValue=function(a,b){try{return goog.iter.toIterator(a).next()}catch(c){if(c!=goog.iter.StopIteration)throw c;return b}};
goog.iter.product=function(a){if(goog.array.some(arguments,function(a){return!a.length})||!arguments.length)return new goog.iter.Iterator;var b=new goog.iter.Iterator,c=arguments,d=goog.array.repeat(0,c.length);b.next=function(){if(d){for(var a=goog.array.map(d,function(a,b){return c[b][a]}),b=d.length-1;0<=b;b--){goog.asserts.assert(d);if(d[b]<c[b].length-1){d[b]++;break}if(0==b){d=null;break}d[b]=0}return a}throw goog.iter.StopIteration;};return b};
goog.iter.cycle=function(a){var b=goog.iter.toIterator(a),c=[],d=0,a=new goog.iter.Iterator,e=!1;a.next=function(){var a=null;if(!e)try{return a=b.next(),c.push(a),a}catch(g){if(g!=goog.iter.StopIteration||goog.array.isEmpty(c))throw g;e=!0}a=c[d];d=(d+1)%c.length;return a};return a};goog.structs.Map=function(a,b){this.map_={};this.keys_=[];var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.addAll(a)};goog.structs.Map.prototype.count_=0;goog.structs.Map.prototype.version_=0;goog.structs.Map.prototype.getCount=function(){return this.count_};
goog.structs.Map.prototype.getValues=function(){this.cleanupKeysArray_();for(var a=[],b=0;b<this.keys_.length;b++)a.push(this.map_[this.keys_[b]]);return a};goog.structs.Map.prototype.getKeys=function(){this.cleanupKeysArray_();return this.keys_.concat()};goog.structs.Map.prototype.containsKey=function(a){return goog.structs.Map.hasKey_(this.map_,a)};
goog.structs.Map.prototype.containsValue=function(a){for(var b=0;b<this.keys_.length;b++){var c=this.keys_[b];if(goog.structs.Map.hasKey_(this.map_,c)&&this.map_[c]==a)return!0}return!1};goog.structs.Map.prototype.equals=function(a,b){if(this===a)return!0;if(this.count_!=a.getCount())return!1;var c=b||goog.structs.Map.defaultEquals;this.cleanupKeysArray_();for(var d,e=0;d=this.keys_[e];e++)if(!c(this.get(d),a.get(d)))return!1;return!0};goog.structs.Map.defaultEquals=function(a,b){return a===b};
goog.structs.Map.prototype.isEmpty=function(){return 0==this.count_};goog.structs.Map.prototype.clear=function(){this.map_={};this.version_=this.count_=this.keys_.length=0};goog.structs.Map.prototype.remove=function(a){return goog.structs.Map.hasKey_(this.map_,a)?(delete this.map_[a],this.count_--,this.version_++,this.keys_.length>2*this.count_&&this.cleanupKeysArray_(),!0):!1};
goog.structs.Map.prototype.cleanupKeysArray_=function(){if(this.count_!=this.keys_.length){for(var a=0,b=0;a<this.keys_.length;){var c=this.keys_[a];goog.structs.Map.hasKey_(this.map_,c)&&(this.keys_[b++]=c);a++}this.keys_.length=b}if(this.count_!=this.keys_.length){for(var d={},b=a=0;a<this.keys_.length;)c=this.keys_[a],goog.structs.Map.hasKey_(d,c)||(this.keys_[b++]=c,d[c]=1),a++;this.keys_.length=b}};
goog.structs.Map.prototype.get=function(a,b){return goog.structs.Map.hasKey_(this.map_,a)?this.map_[a]:b};goog.structs.Map.prototype.set=function(a,b){goog.structs.Map.hasKey_(this.map_,a)||(this.count_++,this.keys_.push(a),this.version_++);this.map_[a]=b};goog.structs.Map.prototype.addAll=function(a){var b;a instanceof goog.structs.Map?(b=a.getKeys(),a=a.getValues()):(b=goog.object.getKeys(a),a=goog.object.getValues(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};
goog.structs.Map.prototype.clone=function(){return new goog.structs.Map(this)};goog.structs.Map.prototype.transpose=function(){for(var a=new goog.structs.Map,b=0;b<this.keys_.length;b++){var c=this.keys_[b];a.set(this.map_[c],c)}return a};goog.structs.Map.prototype.toObject=function(){this.cleanupKeysArray_();for(var a={},b=0;b<this.keys_.length;b++){var c=this.keys_[b];a[c]=this.map_[c]}return a};goog.structs.Map.prototype.getKeyIterator=function(){return this.__iterator__(!0)};
goog.structs.Map.prototype.getValueIterator=function(){return this.__iterator__(!1)};goog.structs.Map.prototype.__iterator__=function(a){this.cleanupKeysArray_();var b=0,c=this.keys_,d=this.map_,e=this.version_,f=this,g=new goog.iter.Iterator;g.next=function(){for(;;){if(e!=f.version_)throw Error("The map has changed since the iterator was created");if(b>=c.length)throw goog.iter.StopIteration;var g=c[b++];return a?g:d[g]}};return g};
goog.structs.Map.hasKey_=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};goog.structs.Set=function(a){this.map_=new goog.structs.Map;a&&this.addAll(a)};goog.structs.Set.getKey_=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+goog.getUid(a):b.substr(0,1)+a};goog.structs.Set.prototype.getCount=function(){return this.map_.getCount()};goog.structs.Set.prototype.add=function(a){this.map_.set(goog.structs.Set.getKey_(a),a)};goog.structs.Set.prototype.addAll=function(a){for(var a=goog.structs.getValues(a),b=a.length,c=0;c<b;c++)this.add(a[c])};
goog.structs.Set.prototype.removeAll=function(a){for(var a=goog.structs.getValues(a),b=a.length,c=0;c<b;c++)this.remove(a[c])};goog.structs.Set.prototype.remove=function(a){return this.map_.remove(goog.structs.Set.getKey_(a))};goog.structs.Set.prototype.clear=function(){this.map_.clear()};goog.structs.Set.prototype.isEmpty=function(){return this.map_.isEmpty()};goog.structs.Set.prototype.contains=function(a){return this.map_.containsKey(goog.structs.Set.getKey_(a))};
goog.structs.Set.prototype.containsAll=function(a){return goog.structs.every(a,this.contains,this)};goog.structs.Set.prototype.intersection=function(a){for(var b=new goog.structs.Set,a=goog.structs.getValues(a),c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};goog.structs.Set.prototype.difference=function(a){var b=this.clone();b.removeAll(a);return b};goog.structs.Set.prototype.getValues=function(){return this.map_.getValues()};goog.structs.Set.prototype.clone=function(){return new goog.structs.Set(this)};
goog.structs.Set.prototype.equals=function(a){return this.getCount()==goog.structs.getCount(a)&&this.isSubsetOf(a)};goog.structs.Set.prototype.isSubsetOf=function(a){var b=goog.structs.getCount(a);if(this.getCount()>b)return!1;!(a instanceof goog.structs.Set)&&5<b&&(a=new goog.structs.Set(a));return goog.structs.every(this,function(b){return goog.structs.contains(a,b)})};goog.structs.Set.prototype.__iterator__=function(){return this.map_.__iterator__(!1)};goog.debug.catchErrors=function(a,b,c){var c=c||goog.global,d=c.onerror,e=!!b;goog.userAgent.WEBKIT&&!goog.userAgent.isVersion("535.3")&&(e=!e);c.onerror=function(b,c,h){d&&d(b,c,h);a({message:b,fileName:c,line:h});return e}};goog.debug.expose=function(a,b){if("undefined"==typeof a)return"undefined";if(null==a)return"NULL";var c=[],d;for(d in a)if(b||!goog.isFunction(a[d])){var e=d+" = ";try{e+=a[d]}catch(f){e+="*** "+f+" ***"}c.push(e)}return c.join("\n")};
goog.debug.deepExpose=function(a,b){var c=new goog.structs.Set,d=[],e=function(a,g){var h=g+" ";try{if(goog.isDef(a))if(goog.isNull(a))d.push("NULL");else if(goog.isString(a))d.push('"'+a.replace(/\n/g,"\n"+g)+'"');else if(goog.isFunction(a))d.push((""+a).replace(/\n/g,"\n"+g));else if(goog.isObject(a))if(c.contains(a))d.push("*** reference loop detected ***");else{c.add(a);d.push("{");for(var i in a)if(b||!goog.isFunction(a[i]))d.push("\n"),d.push(h),d.push(i+" = "),e(a[i],h);d.push("\n"+g+"}")}else d.push(a);
else d.push("undefined")}catch(j){d.push("*** "+j+" ***")}};e(a,"");return d.join("")};goog.debug.exposeArray=function(a){for(var b=[],c=0;c<a.length;c++)goog.isArray(a[c])?b.push(goog.debug.exposeArray(a[c])):b.push(a[c]);return"[ "+b.join(", ")+" ]"};
goog.debug.exposeException=function(a,b){try{var c=goog.debug.normalizeErrorObject(a);return"Message: "+goog.string.htmlEscape(c.message)+'\nUrl: <a href="view-source:'+c.fileName+'" target="_new">'+c.fileName+"</a>\nLine: "+c.lineNumber+"\n\nBrowser stack:\n"+goog.string.htmlEscape(c.stack+"-> ")+"[end]\n\nJS stack traversal:\n"+goog.string.htmlEscape(goog.debug.getStacktrace(b)+"-> ")}catch(d){return"Exception trying to expose exception! You win, we lose. "+d}};
goog.debug.normalizeErrorObject=function(a){var b=goog.getObjectByName("window.location.href");if(goog.isString(a))return{message:a,name:"Unknown error",lineNumber:"Not available",fileName:b,stack:"Not available"};var c,d,e=!1;try{c=a.lineNumber||a.line||"Not available"}catch(f){c="Not available",e=!0}try{d=a.fileName||a.filename||a.sourceURL||b}catch(g){d="Not available",e=!0}return e||!a.lineNumber||!a.fileName||!a.stack?{message:a.message,name:a.name,lineNumber:c,fileName:d,stack:a.stack||"Not available"}:
a};goog.debug.enhanceError=function(a,b){var c="string"==typeof a?Error(a):a;if(!c.stack)c.stack=goog.debug.getStacktrace(arguments.callee.caller);if(b){for(var d=0;c["message"+d];)++d;c["message"+d]=""+b}return c};
goog.debug.getStacktraceSimple=function(a){for(var b=[],c=arguments.callee.caller,d=0;c&&(!a||d<a);){b.push(goog.debug.getFunctionName(c));b.push("()\n");try{c=c.caller}catch(e){b.push("[exception trying to get caller]\n");break}d++;if(d>=goog.debug.MAX_STACK_DEPTH){b.push("[...long stack...]");break}}a&&d>=a?b.push("[...reached max depth limit...]"):b.push("[end]");return b.join("")};goog.debug.MAX_STACK_DEPTH=50;
goog.debug.getStacktrace=function(a){return goog.debug.getStacktraceHelper_(a||arguments.callee.caller,[])};
goog.debug.getStacktraceHelper_=function(a,b){var c=[];if(goog.array.contains(b,a))c.push("[...circular reference...]");else if(a&&b.length<goog.debug.MAX_STACK_DEPTH){c.push(goog.debug.getFunctionName(a)+"(");for(var d=a.arguments,e=0;e<d.length;e++){0<e&&c.push(", ");var f;f=d[e];switch(typeof f){case "object":f=f?"object":"null";break;case "string":break;case "number":f=""+f;break;case "boolean":f=f?"true":"false";break;case "function":f=(f=goog.debug.getFunctionName(f))?f:"[fn]";break;default:f=
typeof f}40<f.length&&(f=f.substr(0,40)+"...");c.push(f)}b.push(a);c.push(")\n");try{c.push(goog.debug.getStacktraceHelper_(a.caller,b))}catch(g){c.push("[exception trying to get caller]\n")}}else a?c.push("[...long stack...]"):c.push("[end]");return c.join("")};goog.debug.setFunctionResolver=function(a){goog.debug.fnNameResolver_=a};
goog.debug.getFunctionName=function(a){if(goog.debug.fnNameCache_[a])return goog.debug.fnNameCache_[a];if(goog.debug.fnNameResolver_){var b=goog.debug.fnNameResolver_(a);if(b)return goog.debug.fnNameCache_[a]=b}a=""+a;goog.debug.fnNameCache_[a]||(b=/function ([^\(]+)/.exec(a),goog.debug.fnNameCache_[a]=b?b[1]:"[Anonymous]");return goog.debug.fnNameCache_[a]};
goog.debug.makeWhitespaceVisible=function(a){return a.replace(/ /g,"[_]").replace(/\f/g,"[f]").replace(/\n/g,"[n]\n").replace(/\r/g,"[r]").replace(/\t/g,"[t]")};goog.debug.fnNameCache_={};goog.disposable={};goog.disposable.IDisposable=function(){};goog.Disposable=function(){goog.Disposable.ENABLE_MONITORING&&(goog.Disposable.instances_[goog.getUid(this)]=this)};goog.Disposable.ENABLE_MONITORING=!1;goog.Disposable.instances_={};goog.Disposable.getUndisposedObjects=function(){var a=[],b;for(b in goog.Disposable.instances_)goog.Disposable.instances_.hasOwnProperty(b)&&a.push(goog.Disposable.instances_[Number(b)]);return a};goog.Disposable.clearUndisposedObjects=function(){goog.Disposable.instances_={}};goog.Disposable.prototype.disposed_=!1;
goog.Disposable.prototype.isDisposed=function(){return this.disposed_};goog.Disposable.prototype.getDisposed=goog.Disposable.prototype.isDisposed;goog.Disposable.prototype.dispose=function(){if(!this.disposed_&&(this.disposed_=!0,this.disposeInternal(),goog.Disposable.ENABLE_MONITORING)){var a=goog.getUid(this);if(!goog.Disposable.instances_.hasOwnProperty(a))throw Error(this+" did not call the goog.Disposable base constructor or was disposed of after a clearUndisposedObjects call");delete goog.Disposable.instances_[a]}};
goog.Disposable.prototype.registerDisposable=function(a){if(!this.dependentDisposables_)this.dependentDisposables_=[];this.dependentDisposables_.push(a)};goog.Disposable.prototype.disposeInternal=function(){this.dependentDisposables_&&goog.disposeAll.apply(null,this.dependentDisposables_)};goog.dispose=function(a){a&&"function"==typeof a.dispose&&a.dispose()};goog.disposeAll=function(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];goog.isArrayLike(d)?goog.disposeAll.apply(null,d):goog.dispose(d)}};goog.structs.SimplePool=function(a,b){goog.Disposable.call(this);this.maxCount_=b;this.freeQueue_=[];this.createInitial_(a)};goog.inherits(goog.structs.SimplePool,goog.Disposable);goog.structs.SimplePool.prototype.createObjectFn_=null;goog.structs.SimplePool.prototype.disposeObjectFn_=null;goog.structs.SimplePool.prototype.setCreateObjectFn=function(a){this.createObjectFn_=a};goog.structs.SimplePool.prototype.setDisposeObjectFn=function(a){this.disposeObjectFn_=a};
goog.structs.SimplePool.prototype.getObject=function(){return this.freeQueue_.length?this.freeQueue_.pop():this.createObject()};goog.structs.SimplePool.prototype.releaseObject=function(a){this.freeQueue_.length<this.maxCount_?this.freeQueue_.push(a):this.disposeObject(a)};goog.structs.SimplePool.prototype.createInitial_=function(a){if(a>this.maxCount_)throw Error("[goog.structs.SimplePool] Initial cannot be greater than max");for(var b=0;b<a;b++)this.freeQueue_.push(this.createObject())};
goog.structs.SimplePool.prototype.createObject=function(){return this.createObjectFn_?this.createObjectFn_():{}};goog.structs.SimplePool.prototype.disposeObject=function(a){if(this.disposeObjectFn_)this.disposeObjectFn_(a);else if(goog.isObject(a))if(goog.isFunction(a.dispose))a.dispose();else for(var b in a)delete a[b]};
goog.structs.SimplePool.prototype.disposeInternal=function(){goog.structs.SimplePool.superClass_.disposeInternal.call(this);for(var a=this.freeQueue_;a.length;)this.disposeObject(a.pop());delete this.freeQueue_};goog.debug.LogRecord=function(a,b,c,d,e){this.reset(a,b,c,d,e)};goog.debug.LogRecord.prototype.sequenceNumber_=0;goog.debug.LogRecord.prototype.exception_=null;goog.debug.LogRecord.prototype.exceptionText_=null;goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS=!0;goog.debug.LogRecord.nextSequenceNumber_=0;
goog.debug.LogRecord.prototype.reset=function(a,b,c,d,e){if(goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS)this.sequenceNumber_="number"==typeof e?e:goog.debug.LogRecord.nextSequenceNumber_++;this.time_=d||goog.now();this.level_=a;this.msg_=b;this.loggerName_=c;delete this.exception_;delete this.exceptionText_};goog.debug.LogRecord.prototype.getLoggerName=function(){return this.loggerName_};goog.debug.LogRecord.prototype.getException=function(){return this.exception_};
goog.debug.LogRecord.prototype.setException=function(a){this.exception_=a};goog.debug.LogRecord.prototype.getExceptionText=function(){return this.exceptionText_};goog.debug.LogRecord.prototype.setExceptionText=function(a){this.exceptionText_=a};goog.debug.LogRecord.prototype.setLoggerName=function(a){this.loggerName_=a};goog.debug.LogRecord.prototype.getLevel=function(){return this.level_};goog.debug.LogRecord.prototype.setLevel=function(a){this.level_=a};
goog.debug.LogRecord.prototype.getMessage=function(){return this.msg_};goog.debug.LogRecord.prototype.setMessage=function(a){this.msg_=a};goog.debug.LogRecord.prototype.getMillis=function(){return this.time_};goog.debug.LogRecord.prototype.setMillis=function(a){this.time_=a};goog.debug.LogRecord.prototype.getSequenceNumber=function(){return this.sequenceNumber_};goog.debug.LogBuffer=function(){goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(),"Cannot use goog.debug.LogBuffer without defining goog.debug.LogBuffer.CAPACITY.");this.clear()};goog.debug.LogBuffer.getInstance=function(){if(!goog.debug.LogBuffer.instance_)goog.debug.LogBuffer.instance_=new goog.debug.LogBuffer;return goog.debug.LogBuffer.instance_};goog.debug.LogBuffer.CAPACITY=0;
goog.debug.LogBuffer.prototype.addRecord=function(a,b,c){var d=(this.curIndex_+1)%goog.debug.LogBuffer.CAPACITY;this.curIndex_=d;if(this.isFull_)return d=this.buffer_[d],d.reset(a,b,c),d;this.isFull_=d==goog.debug.LogBuffer.CAPACITY-1;return this.buffer_[d]=new goog.debug.LogRecord(a,b,c)};goog.debug.LogBuffer.isBufferingEnabled=function(){return 0<goog.debug.LogBuffer.CAPACITY};
goog.debug.LogBuffer.prototype.clear=function(){this.buffer_=Array(goog.debug.LogBuffer.CAPACITY);this.curIndex_=-1;this.isFull_=!1};goog.debug.LogBuffer.prototype.forEachRecord=function(a){var b=this.buffer_;if(b[0]){var c=this.curIndex_,d=this.isFull_?c:-1;do d=(d+1)%goog.debug.LogBuffer.CAPACITY,a(b[d]);while(d!=c)}};goog.debug.Logger=function(a){this.name_=a};goog.debug.Logger.prototype.parent_=null;goog.debug.Logger.prototype.level_=null;goog.debug.Logger.prototype.children_=null;goog.debug.Logger.prototype.handlers_=null;goog.debug.Logger.ENABLE_HIERARCHY=!0;if(!goog.debug.Logger.ENABLE_HIERARCHY)goog.debug.Logger.rootHandlers_=[];goog.debug.Logger.Level=function(a,b){this.name=a;this.value=b};goog.debug.Logger.Level.prototype.toString=function(){return this.name};
goog.debug.Logger.Level.OFF=new goog.debug.Logger.Level("OFF",Infinity);goog.debug.Logger.Level.SHOUT=new goog.debug.Logger.Level("SHOUT",1200);goog.debug.Logger.Level.SEVERE=new goog.debug.Logger.Level("SEVERE",1E3);goog.debug.Logger.Level.WARNING=new goog.debug.Logger.Level("WARNING",900);goog.debug.Logger.Level.INFO=new goog.debug.Logger.Level("INFO",800);goog.debug.Logger.Level.CONFIG=new goog.debug.Logger.Level("CONFIG",700);goog.debug.Logger.Level.FINE=new goog.debug.Logger.Level("FINE",500);
goog.debug.Logger.Level.FINER=new goog.debug.Logger.Level("FINER",400);goog.debug.Logger.Level.FINEST=new goog.debug.Logger.Level("FINEST",300);goog.debug.Logger.Level.ALL=new goog.debug.Logger.Level("ALL",0);
goog.debug.Logger.Level.PREDEFINED_LEVELS=[goog.debug.Logger.Level.OFF,goog.debug.Logger.Level.SHOUT,goog.debug.Logger.Level.SEVERE,goog.debug.Logger.Level.WARNING,goog.debug.Logger.Level.INFO,goog.debug.Logger.Level.CONFIG,goog.debug.Logger.Level.FINE,goog.debug.Logger.Level.FINER,goog.debug.Logger.Level.FINEST,goog.debug.Logger.Level.ALL];goog.debug.Logger.Level.predefinedLevelsCache_=null;
goog.debug.Logger.Level.createPredefinedLevelsCache_=function(){goog.debug.Logger.Level.predefinedLevelsCache_={};for(var a=0,b;b=goog.debug.Logger.Level.PREDEFINED_LEVELS[a];a++)goog.debug.Logger.Level.predefinedLevelsCache_[b.value]=b,goog.debug.Logger.Level.predefinedLevelsCache_[b.name]=b};
goog.debug.Logger.Level.getPredefinedLevel=function(a){goog.debug.Logger.Level.predefinedLevelsCache_||goog.debug.Logger.Level.createPredefinedLevelsCache_();return goog.debug.Logger.Level.predefinedLevelsCache_[a]||null};
goog.debug.Logger.Level.getPredefinedLevelByValue=function(a){goog.debug.Logger.Level.predefinedLevelsCache_||goog.debug.Logger.Level.createPredefinedLevelsCache_();if(a in goog.debug.Logger.Level.predefinedLevelsCache_)return goog.debug.Logger.Level.predefinedLevelsCache_[a];for(var b=0;b<goog.debug.Logger.Level.PREDEFINED_LEVELS.length;++b){var c=goog.debug.Logger.Level.PREDEFINED_LEVELS[b];if(c.value<=a)return c}return null};goog.debug.Logger.getLogger=function(a){return goog.debug.LogManager.getLogger(a)};
goog.debug.Logger.logToProfilers=function(a){goog.global.console&&(goog.global.console.timeStamp?goog.global.console.timeStamp(a):goog.global.console.markTimeline&&goog.global.console.markTimeline(a));goog.global.msWriteProfilerMark&&goog.global.msWriteProfilerMark(a)};goog.debug.Logger.prototype.getName=function(){return this.name_};
goog.debug.Logger.prototype.addHandler=function(a){if(goog.debug.Logger.ENABLE_HIERARCHY){if(!this.handlers_)this.handlers_=[];this.handlers_.push(a)}else goog.asserts.assert(!this.name_,"Cannot call addHandler on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."),goog.debug.Logger.rootHandlers_.push(a)};goog.debug.Logger.prototype.removeHandler=function(a){var b=goog.debug.Logger.ENABLE_HIERARCHY?this.handlers_:goog.debug.Logger.rootHandlers_;return!!b&&goog.array.remove(b,a)};
goog.debug.Logger.prototype.getParent=function(){return this.parent_};goog.debug.Logger.prototype.getChildren=function(){if(!this.children_)this.children_={};return this.children_};goog.debug.Logger.prototype.setLevel=function(a){goog.debug.Logger.ENABLE_HIERARCHY?this.level_=a:(goog.asserts.assert(!this.name_,"Cannot call setLevel() on a non-root logger when goog.debug.Logger.ENABLE_HIERARCHY is false."),goog.debug.Logger.rootLevel_=a)};goog.debug.Logger.prototype.getLevel=function(){return this.level_};
goog.debug.Logger.prototype.getEffectiveLevel=function(){if(!goog.debug.Logger.ENABLE_HIERARCHY)return goog.debug.Logger.rootLevel_;if(this.level_)return this.level_;if(this.parent_)return this.parent_.getEffectiveLevel();goog.asserts.fail("Root logger has no level set.");return null};goog.debug.Logger.prototype.isLoggable=function(a){return a.value>=this.getEffectiveLevel().value};goog.debug.Logger.prototype.log=function(a,b,c){this.isLoggable(a)&&this.doLogRecord_(this.getLogRecord(a,b,c))};
goog.debug.Logger.prototype.getLogRecord=function(a,b,c){var d=goog.debug.LogBuffer.isBufferingEnabled()?goog.debug.LogBuffer.getInstance().addRecord(a,b,this.name_):new goog.debug.LogRecord(a,""+b,this.name_);c&&(d.setException(c),d.setExceptionText(goog.debug.exposeException(c,arguments.callee.caller)));return d};goog.debug.Logger.prototype.shout=function(a,b){this.log(goog.debug.Logger.Level.SHOUT,a,b)};
goog.debug.Logger.prototype.severe=function(a,b){this.log(goog.debug.Logger.Level.SEVERE,a,b)};goog.debug.Logger.prototype.warning=function(a,b){this.log(goog.debug.Logger.Level.WARNING,a,b)};goog.debug.Logger.prototype.info=function(a,b){this.log(goog.debug.Logger.Level.INFO,a,b)};goog.debug.Logger.prototype.config=function(a,b){this.log(goog.debug.Logger.Level.CONFIG,a,b)};goog.debug.Logger.prototype.fine=function(a,b){this.log(goog.debug.Logger.Level.FINE,a,b)};
goog.debug.Logger.prototype.finer=function(a,b){this.log(goog.debug.Logger.Level.FINER,a,b)};goog.debug.Logger.prototype.finest=function(a,b){this.log(goog.debug.Logger.Level.FINEST,a,b)};goog.debug.Logger.prototype.logRecord=function(a){this.isLoggable(a.getLevel())&&this.doLogRecord_(a)};
goog.debug.Logger.prototype.doLogRecord_=function(a){goog.debug.Logger.logToProfilers("log:"+a.getMessage());if(goog.debug.Logger.ENABLE_HIERARCHY)for(var b=this;b;)b.callPublish_(a),b=b.getParent();else for(var b=0,c;c=goog.debug.Logger.rootHandlers_[b++];)c(a)};goog.debug.Logger.prototype.callPublish_=function(a){if(this.handlers_)for(var b=0,c;c=this.handlers_[b];b++)c(a)};goog.debug.Logger.prototype.setParent_=function(a){this.parent_=a};
goog.debug.Logger.prototype.addChild_=function(a,b){this.getChildren()[a]=b};goog.debug.LogManager={};goog.debug.LogManager.loggers_={};goog.debug.LogManager.rootLogger_=null;goog.debug.LogManager.initialize=function(){if(!goog.debug.LogManager.rootLogger_)goog.debug.LogManager.rootLogger_=new goog.debug.Logger(""),goog.debug.LogManager.loggers_[""]=goog.debug.LogManager.rootLogger_,goog.debug.LogManager.rootLogger_.setLevel(goog.debug.Logger.Level.CONFIG)};goog.debug.LogManager.getLoggers=function(){return goog.debug.LogManager.loggers_};
goog.debug.LogManager.getRoot=function(){goog.debug.LogManager.initialize();return goog.debug.LogManager.rootLogger_};goog.debug.LogManager.getLogger=function(a){goog.debug.LogManager.initialize();return goog.debug.LogManager.loggers_[a]||goog.debug.LogManager.createLogger_(a)};goog.debug.LogManager.createFunctionForCatchErrors=function(a){return function(b){(a||goog.debug.LogManager.getRoot()).severe("Error: "+b.message+" ("+b.fileName+" @ Line: "+b.line+")")}};
goog.debug.LogManager.createLogger_=function(a){var b=new goog.debug.Logger(a);if(goog.debug.Logger.ENABLE_HIERARCHY){var c=a.lastIndexOf("."),d=a.substr(0,c),c=a.substr(c+1),d=goog.debug.LogManager.getLogger(d);d.addChild_(c,b);b.setParent_(d)}return goog.debug.LogManager.loggers_[a]=b};goog.debug.Trace_=function(){this.events_=[];this.outstandingEvents_=new goog.structs.Map;this.tracerOverheadComment_=this.tracerOverheadEnd_=this.tracerOverheadStart_=this.startTime_=0;this.stats_=new goog.structs.Map;this.commentCount_=this.tracerCount_=0;this.nextId_=1;this.eventPool_=new goog.structs.SimplePool(0,4E3);this.eventPool_.createObject=function(){return new goog.debug.Trace_.Event_};this.statPool_=new goog.structs.SimplePool(0,50);this.statPool_.createObject=function(){return new goog.debug.Trace_.Stat_};
var a=this;this.idPool_=new goog.structs.SimplePool(0,2E3);this.idPool_.createObject=function(){return""+a.nextId_++};this.idPool_.disposeObject=function(){};this.defaultThreshold_=3};goog.debug.Trace_.prototype.logger_=goog.debug.Logger.getLogger("goog.debug.Trace");goog.debug.Trace_.prototype.MAX_TRACE_SIZE=1E3;goog.debug.Trace_.EventType={START:0,STOP:1,COMMENT:2};goog.debug.Trace_.Stat_=function(){this.varAlloc=this.time=this.count=0};
goog.debug.Trace_.Stat_.prototype.toString=function(){var a=[];a.push(this.type," ",this.count," (",Math.round(10*this.time)/10," ms)");this.varAlloc&&a.push(" [VarAlloc = ",this.varAlloc,"]");return a.join("")};goog.debug.Trace_.Event_=function(){};
goog.debug.Trace_.Event_.prototype.toTraceString=function(a,b,c){var d=[];-1==b?d.push(" "):d.push(goog.debug.Trace_.longToPaddedString_(this.eventTime-b));d.push(" ",goog.debug.Trace_.formatTime_(this.eventTime-a));this.eventType==goog.debug.Trace_.EventType.START?d.push(" Start "):this.eventType==goog.debug.Trace_.EventType.STOP?(d.push(" Done "),d.push(goog.debug.Trace_.longToPaddedString_(this.stopTime-this.startTime)," ms ")):d.push(" Comment ");d.push(c,this);0<this.totalVarAlloc&&
d.push("[VarAlloc ",this.totalVarAlloc,"] ");return d.join("")};goog.debug.Trace_.Event_.prototype.toString=function(){return null==this.type?this.comment:"["+this.type+"] "+this.comment};goog.debug.Trace_.prototype.setStartTime=function(a){this.startTime_=a};goog.debug.Trace_.prototype.initCurrentTrace=function(a){this.reset(a)};goog.debug.Trace_.prototype.clearCurrentTrace=function(){this.reset(0)};
goog.debug.Trace_.prototype.reset=function(a){this.defaultThreshold_=a;for(a=0;a<this.events_.length;a++){var b=this.eventPool_.id;b&&this.idPool_.releaseObject(b);this.eventPool_.releaseObject(this.events_[a])}this.events_.length=0;this.outstandingEvents_.clear();this.startTime_=goog.debug.Trace_.now();this.commentCount_=this.tracerCount_=this.tracerOverheadComment_=this.tracerOverheadEnd_=this.tracerOverheadStart_=0;b=this.stats_.getKeys();for(a=0;a<b.length;a++){var c=this.stats_.get(b[a]);c.count=
0;c.time=0;c.varAlloc=0;this.statPool_.releaseObject(c)}this.stats_.clear()};
goog.debug.Trace_.prototype.startTracer=function(a,b){var c=goog.debug.Trace_.now(),d=this.getTotalVarAlloc(),e=this.outstandingEvents_.getCount();if(this.events_.length+e>this.MAX_TRACE_SIZE){this.logger_.warning("Giant thread trace. Clearing to avoid memory leak.");if(this.events_.length>this.MAX_TRACE_SIZE/2){for(var f=0;f<this.events_.length;f++){var g=this.events_[f];g.id&&this.idPool_.releaseObject(g.id);this.eventPool_.releaseObject(g)}this.events_.length=0}e>this.MAX_TRACE_SIZE/2&&this.outstandingEvents_.clear()}goog.debug.Logger.logToProfilers("Start : "+
a);g=this.eventPool_.getObject();g.totalVarAlloc=d;g.eventType=goog.debug.Trace_.EventType.START;g.id=Number(this.idPool_.getObject());g.comment=a;g.type=b;this.events_.push(g);this.outstandingEvents_.set(""+g.id,g);this.tracerCount_++;d=goog.debug.Trace_.now();g.startTime=g.eventTime=d;this.tracerOverheadStart_+=d-c;return g.id};
goog.debug.Trace_.prototype.stopTracer=function(a,b){var c=goog.debug.Trace_.now(),d;d=0===b?0:b?b:this.defaultThreshold_;var e=this.outstandingEvents_.get(""+a);if(null==e)return null;this.outstandingEvents_.remove(""+a);var f,g=c-e.startTime;if(g<d)for(d=this.events_.length-1;0<=d;d--){if(this.events_[d]==e){this.events_.splice(d,1);this.idPool_.releaseObject(e.id);this.eventPool_.releaseObject(e);break}}else f=this.eventPool_.getObject(),f.eventType=goog.debug.Trace_.EventType.STOP,f.startTime=
e.startTime,f.comment=e.comment,f.type=e.type,f.stopTime=f.eventTime=c,this.events_.push(f);d=e.type;var h=null;d&&(h=this.getStat_(d),h.count++,h.time+=g);if(f)goog.debug.Logger.logToProfilers("Stop : "+f.comment),f.totalVarAlloc=this.getTotalVarAlloc(),h&&(h.varAlloc+=f.totalVarAlloc-e.totalVarAlloc);this.tracerOverheadEnd_+=goog.debug.Trace_.now()-c;return g};goog.debug.Trace_.prototype.setGcTracer=function(a){this.gcTracer_=a};
goog.debug.Trace_.prototype.getTotalVarAlloc=function(){var a=this.gcTracer_;return a&&a.isTracing()?a.totalVarAlloc:-1};
goog.debug.Trace_.prototype.addComment=function(a,b,c){var d=goog.debug.Trace_.now(),e=c?c:d,f=this.eventPool_.getObject();f.eventType=goog.debug.Trace_.EventType.COMMENT;f.eventTime=e;f.type=b;f.comment=a;f.totalVarAlloc=this.getTotalVarAlloc();this.commentCount_++;if(c){a=this.events_.length;for(b=0;b<a;b++)if(this.events_[b].eventTime>e){goog.array.insertAt(this.events_,f,b);break}b==a&&this.events_.push(f)}else this.events_.push(f);(e=f.type)&&this.getStat_(e).count++;this.tracerOverheadComment_+=
goog.debug.Trace_.now()-d};goog.debug.Trace_.prototype.getStat_=function(a){var b=this.stats_.get(a);if(!b)b=this.statPool_.getObject(),b.type=a,this.stats_.set(a,b);return b};goog.debug.Trace_.prototype.getFormattedTrace=function(){return this.toString()};
goog.debug.Trace_.prototype.toString=function(){for(var a=[],b=-1,c=[],d=0;d<this.events_.length;d++){var e=this.events_[d];e.eventType==goog.debug.Trace_.EventType.STOP&&c.pop();a.push(" ",e.toTraceString(this.startTime_,b,c.join("")));b=e.eventTime;a.push("\n");e.eventType==goog.debug.Trace_.EventType.START&&c.push("| ")}if(0!=this.outstandingEvents_.getCount()){var f=goog.debug.Trace_.now();a.push(" Unstopped timers:\n");goog.iter.forEach(this.outstandingEvents_,function(b){a.push(" ",b," (",
f-b.startTime," ms, started at ",goog.debug.Trace_.formatTime_(b.startTime),")\n")})}b=this.stats_.getKeys();for(d=0;d<b.length;d++)c=this.stats_.get(b[d]),1<c.count&&a.push(" TOTAL ",c,"\n");a.push("Total tracers created ",this.tracerCount_,"\n","Total comments created ",this.commentCount_,"\n","Overhead start: ",this.tracerOverheadStart_," ms\n","Overhead end: ",this.tracerOverheadEnd_," ms\n","Overhead comment: ",this.tracerOverheadComment_," ms\n");return a.join("")};
goog.debug.Trace_.longToPaddedString_=function(a){var a=Math.round(a),b="";1E3>a&&(b=" ");100>a&&(b=" ");10>a&&(b=" ");return b+a};goog.debug.Trace_.formatTime_=function(a){var a=Math.round(a),b=a%1E3;return(""+(100+a/1E3%60)).substring(1,3)+"."+(""+(1E3+b)).substring(1,4)};goog.debug.Trace_.now=function(){return goog.now()};goog.debug.Trace=new goog.debug.Trace_;goog.debug.entryPointRegistry={};goog.debug.EntryPointMonitor=function(){};goog.debug.entryPointRegistry.refList_=[];goog.debug.entryPointRegistry.monitors_=[];goog.debug.entryPointRegistry.monitorsMayExist_=!1;goog.debug.entryPointRegistry.register=function(a){goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length]=a;if(goog.debug.entryPointRegistry.monitorsMayExist_)for(var b=goog.debug.entryPointRegistry.monitors_,c=0;c<b.length;c++)a(goog.bind(b[c].wrap,b[c]))};
goog.debug.entryPointRegistry.monitorAll=function(a){goog.debug.entryPointRegistry.monitorsMayExist_=!0;for(var b=goog.bind(a.wrap,a),c=0;c<goog.debug.entryPointRegistry.refList_.length;c++)goog.debug.entryPointRegistry.refList_[c](b);goog.debug.entryPointRegistry.monitors_.push(a)};
goog.debug.entryPointRegistry.unmonitorAllIfPossible=function(a){var b=goog.debug.entryPointRegistry.monitors_;goog.asserts.assert(a==b[b.length-1],"Only the most recent monitor can be unwrapped.");for(var a=goog.bind(a.unwrap,a),c=0;c<goog.debug.entryPointRegistry.refList_.length;c++)goog.debug.entryPointRegistry.refList_[c](a);b.length--};goog.debug.ErrorHandler=function(a){goog.Disposable.call(this);this.errorHandlerFn_=a};goog.inherits(goog.debug.ErrorHandler,goog.Disposable);goog.debug.ErrorHandler.prototype.addTracersToProtectedFunctions_=!1;goog.debug.ErrorHandler.prototype.setAddTracersToProtectedFunctions=function(a){this.addTracersToProtectedFunctions_=a};goog.debug.ErrorHandler.prototype.wrap=function(a){return this.protectEntryPoint(goog.asserts.assertFunction(a))};
goog.debug.ErrorHandler.prototype.unwrap=function(a){goog.asserts.assertFunction(a);return a[this.getFunctionIndex_(!1)]||a};goog.debug.ErrorHandler.prototype.getStackTraceHolder_=function(a){var b=[];b.push("##PE_STACK_START##");b.push(a.replace(/(\r\n|\r|\n)/g,"##STACK_BR##"));b.push("##PE_STACK_END##");return b.join("")};goog.debug.ErrorHandler.prototype.getFunctionIndex_=function(a){return(a?"__wrapper_":"__protected_")+goog.getUid(this)+"__"};
goog.debug.ErrorHandler.prototype.protectEntryPoint=function(a){var b=this.getFunctionIndex_(!0);a[b]||((a[b]=this.getProtectedFunction(a))[this.getFunctionIndex_(!1)]=a);return a[b]};
goog.debug.ErrorHandler.prototype.getProtectedFunction=function(a){var b=this,c=this.addTracersToProtectedFunctions_;if(c)var d=goog.debug.getStacktraceSimple(15);var e=function(){if(b.isDisposed())return a.apply(this,arguments);if(c)var e=goog.debug.Trace.startTracer("protectedEntryPoint: "+b.getStackTraceHolder_(d));try{return a.apply(this,arguments)}catch(g){throw b.errorHandlerFn_(g),new goog.debug.ErrorHandler.ProtectedFunctionError(g);}finally{c&&goog.debug.Trace.stopTracer(e)}};e[this.getFunctionIndex_(!1)]=
a;return e};goog.debug.ErrorHandler.prototype.protectWindowSetTimeout=function(){this.protectWindowFunctionsHelper_("setTimeout")};goog.debug.ErrorHandler.prototype.protectWindowSetInterval=function(){this.protectWindowFunctionsHelper_("setInterval")};
goog.debug.ErrorHandler.prototype.protectWindowFunctionsHelper_=function(a){var b=goog.getObjectByName("window"),c=b[a],d=this;b[a]=function(a,b){goog.isString(a)&&(a=goog.partial(goog.globalEval,a));a=d.protectEntryPoint(a);return c.call?c.call(this,a,b):c(a,b)};b[a][this.getFunctionIndex_(!1)]=c};goog.debug.ErrorHandler.prototype.disposeInternal=function(){var a=goog.getObjectByName("window");a.setTimeout=this.unwrap(a.setTimeout);a.setInterval=this.unwrap(a.setInterval);goog.debug.ErrorHandler.superClass_.disposeInternal.call(this)};
goog.debug.ErrorHandler.ProtectedFunctionError=function(a){goog.debug.Error.call(this,goog.debug.ErrorHandler.ProtectedFunctionError.MESSAGE_PREFIX+(a&&a.message?""+a.message:""+a));this.cause=a};goog.inherits(goog.debug.ErrorHandler.ProtectedFunctionError,goog.debug.Error);goog.debug.ErrorHandler.ProtectedFunctionError.MESSAGE_PREFIX="Error in protected function: ";goog.debug.errorHandlerWeakDep={protectEntryPoint:function(a){return a}};goog.events={};goog.events.Listener=function(){};goog.events.Listener.counter_=0;goog.events.Listener.prototype.key=0;goog.events.Listener.prototype.removed=!1;goog.events.Listener.prototype.callOnce=!1;
goog.events.Listener.prototype.init=function(a,b,c,d,e,f){if(goog.isFunction(a))this.isFunctionListener_=!0;else if(a&&a.handleEvent&&goog.isFunction(a.handleEvent))this.isFunctionListener_=!1;else throw Error("Invalid listener argument");this.listener=a;this.proxy=b;this.src=c;this.type=d;this.capture=!!e;this.handler=f;this.callOnce=!1;this.key=++goog.events.Listener.counter_;this.removed=!1};
goog.events.Listener.prototype.handleEvent=function(a){return this.isFunctionListener_?this.listener.call(this.handler||this.src,a):this.listener.handleEvent.call(this.listener,a)};goog.events.BrowserFeature={HAS_W3C_BUTTON:!goog.userAgent.IE||goog.userAgent.isDocumentMode(9),HAS_W3C_EVENT_SUPPORT:!goog.userAgent.IE||goog.userAgent.isDocumentMode(9),SET_KEY_CODE_TO_PREVENT_DEFAULT:goog.userAgent.IE&&!goog.userAgent.isVersion("8"),HAS_NAVIGATOR_ONLINE_PROPERTY:!goog.userAgent.WEBKIT||goog.userAgent.isVersion("528"),HAS_HTML5_NETWORK_EVENT_SUPPORT:goog.userAgent.GECKO&&goog.userAgent.isVersion("1.9b")||goog.userAgent.IE&&goog.userAgent.isVersion("8")||goog.userAgent.OPERA&&goog.userAgent.isVersion("9.5")||
goog.userAgent.WEBKIT&&goog.userAgent.isVersion("528"),HTML5_NETWORK_EVENTS_FIRE_ON_WINDOW:!goog.userAgent.GECKO||goog.userAgent.isVersion("8")};goog.events.EventWrapper=function(){};goog.events.EventWrapper.prototype.listen=function(){};goog.events.EventWrapper.prototype.unlisten=function(){};goog.events.EventType={CLICK:"click",DBLCLICK:"dblclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",SELECTSTART:"selectstart",KEYPRESS:"keypress",KEYDOWN:"keydown",KEYUP:"keyup",BLUR:"blur",FOCUS:"focus",DEACTIVATE:"deactivate",FOCUSIN:goog.userAgent.IE?"focusin":"DOMFocusIn",FOCUSOUT:goog.userAgent.IE?"focusout":"DOMFocusOut",CHANGE:"change",SELECT:"select",SUBMIT:"submit",INPUT:"input",PROPERTYCHANGE:"propertychange",DRAGSTART:"dragstart",
DRAGENTER:"dragenter",DRAGOVER:"dragover",DRAGLEAVE:"dragleave",DROP:"drop",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",TOUCHCANCEL:"touchcancel",CONTEXTMENU:"contextmenu",ERROR:"error",HELP:"help",LOAD:"load",LOSECAPTURE:"losecapture",READYSTATECHANGE:"readystatechange",RESIZE:"resize",SCROLL:"scroll",UNLOAD:"unload",HASHCHANGE:"hashchange",PAGEHIDE:"pagehide",PAGESHOW:"pageshow",POPSTATE:"popstate",COPY:"copy",PASTE:"paste",CUT:"cut",BEFORECOPY:"beforecopy",BEFORECUT:"beforecut",
BEFOREPASTE:"beforepaste",MESSAGE:"message",CONNECT:"connect",TRANSITIONEND:goog.userAgent.WEBKIT?"webkitTransitionEnd":goog.userAgent.OPERA?"oTransitionEnd":"transitionend"};goog.events.Event=function(a,b){goog.Disposable.call(this);this.type=a;this.currentTarget=this.target=b};goog.inherits(goog.events.Event,goog.Disposable);goog.events.Event.prototype.disposeInternal=function(){delete this.type;delete this.target;delete this.currentTarget};goog.events.Event.prototype.propagationStopped_=!1;goog.events.Event.prototype.returnValue_=!0;goog.events.Event.prototype.stopPropagation=function(){this.propagationStopped_=!0};
goog.events.Event.prototype.preventDefault=function(){this.returnValue_=!1};goog.events.Event.stopPropagation=function(a){a.stopPropagation()};goog.events.Event.preventDefault=function(a){a.preventDefault()};goog.reflect={};goog.reflect.object=function(a,b){return b};goog.reflect.sinkValue=function(a){goog.reflect.sinkValue[" "](a);return a};goog.reflect.sinkValue[" "]=goog.nullFunction;goog.reflect.canAccessProperty=function(a,b){try{return goog.reflect.sinkValue(a[b]),!0}catch(c){}return!1};goog.events.BrowserEvent=function(a,b){a&&this.init(a,b)};goog.inherits(goog.events.BrowserEvent,goog.events.Event);goog.events.BrowserEvent.MouseButton={LEFT:0,MIDDLE:1,RIGHT:2};goog.events.BrowserEvent.IEButtonMap=[1,4,2];goog.events.BrowserEvent.prototype.target=null;goog.events.BrowserEvent.prototype.relatedTarget=null;goog.events.BrowserEvent.prototype.offsetX=0;goog.events.BrowserEvent.prototype.offsetY=0;goog.events.BrowserEvent.prototype.clientX=0;
goog.events.BrowserEvent.prototype.clientY=0;goog.events.BrowserEvent.prototype.screenX=0;goog.events.BrowserEvent.prototype.screenY=0;goog.events.BrowserEvent.prototype.button=0;goog.events.BrowserEvent.prototype.keyCode=0;goog.events.BrowserEvent.prototype.charCode=0;goog.events.BrowserEvent.prototype.ctrlKey=!1;goog.events.BrowserEvent.prototype.altKey=!1;goog.events.BrowserEvent.prototype.shiftKey=!1;goog.events.BrowserEvent.prototype.metaKey=!1;
goog.events.BrowserEvent.prototype.platformModifierKey=!1;goog.events.BrowserEvent.prototype.event_=null;
goog.events.BrowserEvent.prototype.init=function(a,b){var c=this.type=a.type;goog.events.Event.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d)goog.userAgent.GECKO&&(goog.reflect.canAccessProperty(d,"nodeName")||(d=null));else if(c==goog.events.EventType.MOUSEOVER)d=a.fromElement;else if(c==goog.events.EventType.MOUSEOUT)d=a.toElement;this.relatedTarget=d;this.offsetX=goog.userAgent.WEBKIT||void 0!==a.offsetX?a.offsetX:a.layerX;this.offsetY=goog.userAgent.WEBKIT||
void 0!==a.offsetY?a.offsetY:a.layerY;this.clientX=void 0!==a.clientX?a.clientX:a.pageX;this.clientY=void 0!==a.clientY?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.platformModifierKey=goog.userAgent.MAC?a.metaKey:a.ctrlKey;this.state=a.state;this.event_=a;delete this.returnValue_;
delete this.propagationStopped_};goog.events.BrowserEvent.prototype.isButton=function(a){return goog.events.BrowserFeature.HAS_W3C_BUTTON?this.event_.button==a:"click"==this.type?a==goog.events.BrowserEvent.MouseButton.LEFT:!!(this.event_.button&goog.events.BrowserEvent.IEButtonMap[a])};goog.events.BrowserEvent.prototype.isMouseActionButton=function(){return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT)&&!(goog.userAgent.WEBKIT&&goog.userAgent.MAC&&this.ctrlKey)};
goog.events.BrowserEvent.prototype.stopPropagation=function(){goog.events.BrowserEvent.superClass_.stopPropagation.call(this);this.event_.stopPropagation?this.event_.stopPropagation():this.event_.cancelBubble=!0};
goog.events.BrowserEvent.prototype.preventDefault=function(){goog.events.BrowserEvent.superClass_.preventDefault.call(this);var a=this.event_;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};goog.events.BrowserEvent.prototype.getBrowserEvent=function(){return this.event_};
goog.events.BrowserEvent.prototype.disposeInternal=function(){goog.events.BrowserEvent.superClass_.disposeInternal.call(this);this.relatedTarget=this.currentTarget=this.target=this.event_=null};goog.events.ASSUME_GOOD_GC=!1;goog.events.listeners_={};goog.events.listenerTree_={};goog.events.sources_={};goog.events.onString_="on";goog.events.onStringMap_={};goog.events.keySeparator_="_";
goog.events.listen=function(a,b,c,d,e){if(b){if(goog.isArray(b)){for(var f=0;f<b.length;f++)goog.events.listen(a,b[f],c,d,e);return null}var d=!!d,g=goog.events.listenerTree_;b in g||(g[b]={count_:0,remaining_:0});g=g[b];d in g||(g[d]={count_:0,remaining_:0},g.count_++);var g=g[d],h=goog.getUid(a),i;g.remaining_++;if(g[h]){i=g[h];for(f=0;f<i.length;f++)if(g=i[f],g.listener==c&&g.handler==e){if(g.removed)break;return i[f].key}}else i=g[h]=[],g.count_++;f=goog.events.getProxy();f.src=a;g=new goog.events.Listener;
g.init(c,f,a,b,d,e);c=g.key;f.key=c;i.push(g);goog.events.listeners_[c]=g;goog.events.sources_[h]||(goog.events.sources_[h]=[]);goog.events.sources_[h].push(g);a.addEventListener?(a==goog.global||!a.customEvent_)&&a.addEventListener(b,f,d):a.attachEvent(goog.events.getOnString_(b),f);return c}throw Error("Invalid event type");};
goog.events.getProxy=function(){var a=goog.events.handleBrowserEvent_,b=goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT?function(c){return a.call(b.src,b.key,c)}:function(c){c=a.call(b.src,b.key,c);if(!c)return c};return b};goog.events.listenOnce=function(a,b,c,d,e){if(goog.isArray(b)){for(var f=0;f<b.length;f++)goog.events.listenOnce(a,b[f],c,d,e);return null}a=goog.events.listen(a,b,c,d,e);goog.events.listeners_[a].callOnce=!0;return a};
goog.events.listenWithWrapper=function(a,b,c,d,e){b.listen(a,c,d,e)};goog.events.unlisten=function(a,b,c,d,e){if(goog.isArray(b)){for(var f=0;f<b.length;f++)goog.events.unlisten(a,b[f],c,d,e);return null}d=!!d;a=goog.events.getListeners_(a,b,d);if(!a)return!1;for(f=0;f<a.length;f++)if(a[f].listener==c&&a[f].capture==d&&a[f].handler==e)return goog.events.unlistenByKey(a[f].key);return!1};
goog.events.unlistenByKey=function(a){if(!goog.events.listeners_[a])return!1;var b=goog.events.listeners_[a];if(b.removed)return!1;var c=b.src,d=b.type,e=b.proxy,f=b.capture;c.removeEventListener?(c==goog.global||!c.customEvent_)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(goog.events.getOnString_(d),e);c=goog.getUid(c);e=goog.events.listenerTree_[d][f][c];if(goog.events.sources_[c]){var g=goog.events.sources_[c];goog.array.remove(g,b);0==g.length&&delete goog.events.sources_[c]}b.removed=
!0;e.needsCleanup_=!0;goog.events.cleanUp_(d,f,c,e);delete goog.events.listeners_[a];return!0};goog.events.unlistenWithWrapper=function(a,b,c,d,e){b.unlisten(a,c,d,e)};
goog.events.cleanUp_=function(a,b,c,d){if(!d.locked_&&d.needsCleanup_){for(var e=0,f=0;e<d.length;e++)d[e].removed?d[e].proxy.src=null:(e!=f&&(d[f]=d[e]),f++);d.length=f;d.needsCleanup_=!1;0==f&&(delete goog.events.listenerTree_[a][b][c],goog.events.listenerTree_[a][b].count_--,0==goog.events.listenerTree_[a][b].count_&&(delete goog.events.listenerTree_[a][b],goog.events.listenerTree_[a].count_--),0==goog.events.listenerTree_[a].count_&&delete goog.events.listenerTree_[a])}};
goog.events.removeAll=function(a,b,c){var d=0,e=null==b,f=null==c,c=!!c;if(null==a)goog.object.forEach(goog.events.sources_,function(a){for(var g=a.length-1;0<=g;g--){var h=a[g];if((e||b==h.type)&&(f||c==h.capture))goog.events.unlistenByKey(h.key),d++}});else if(a=goog.getUid(a),goog.events.sources_[a])for(var a=goog.events.sources_[a],g=a.length-1;0<=g;g--){var h=a[g];if((e||b==h.type)&&(f||c==h.capture))goog.events.unlistenByKey(h.key),d++}return d};
goog.events.getListeners=function(a,b,c){return goog.events.getListeners_(a,b,c)||[]};goog.events.getListeners_=function(a,b,c){var d=goog.events.listenerTree_;return b in d&&(d=d[b],c in d&&(d=d[c],a=goog.getUid(a),d[a]))?d[a]:null};goog.events.getListener=function(a,b,c,d,e){d=!!d;if(a=goog.events.getListeners_(a,b,d))for(b=0;b<a.length;b++)if(!a[b].removed&&a[b].listener==c&&a[b].capture==d&&a[b].handler==e)return a[b];return null};
goog.events.hasListener=function(a,b,c){var a=goog.getUid(a),d=goog.events.sources_[a];if(d){var e=goog.isDef(b),f=goog.isDef(c);return e&&f?(d=goog.events.listenerTree_[b],!!d&&!!d[c]&&a in d[c]):!e&&!f?!0:goog.array.some(d,function(a){return e&&a.type==b||f&&a.capture==c})}return!1};goog.events.expose=function(a){var b=[],c;for(c in a)a[c]&&a[c].id?b.push(c+" = "+a[c]+" ("+a[c].id+")"):b.push(c+" = "+a[c]);return b.join("\n")};
goog.events.getOnString_=function(a){return a in goog.events.onStringMap_?goog.events.onStringMap_[a]:goog.events.onStringMap_[a]=goog.events.onString_+a};goog.events.fireListeners=function(a,b,c,d){var e=goog.events.listenerTree_;return b in e&&(e=e[b],c in e)?goog.events.fireListeners_(e[c],a,b,c,d):!0};
goog.events.fireListeners_=function(a,b,c,d,e){var f=1,b=goog.getUid(b);if(a[b]){a.remaining_--;a=a[b];a.locked_?a.locked_++:a.locked_=1;try{for(var g=a.length,h=0;h<g;h++){var i=a[h];i&&!i.removed&&(f&=!1!==goog.events.fireListener(i,e))}}finally{a.locked_--,goog.events.cleanUp_(c,d,b,a)}}return Boolean(f)};goog.events.fireListener=function(a,b){var c=a.handleEvent(b);a.callOnce&&goog.events.unlistenByKey(a.key);return c};goog.events.getTotalListenerCount=function(){return goog.object.getCount(goog.events.listeners_)};
goog.events.dispatchEvent=function(a,b){var c=b.type||b,d=goog.events.listenerTree_;if(!(c in d))return!0;if(goog.isString(b))b=new goog.events.Event(b,a);else if(b instanceof goog.events.Event)b.target=b.target||a;else{var e=b,b=new goog.events.Event(c,a);goog.object.extend(b,e)}var e=1,f,d=d[c],c=!0 in d,g;if(c){f=[];for(g=a;g;g=g.getParentEventTarget())f.push(g);g=d[!0];g.remaining_=g.count_;for(var h=f.length-1;!b.propagationStopped_&&0<=h&&g.remaining_;h--)b.currentTarget=f[h],e&=goog.events.fireListeners_(g,
f[h],b.type,!0,b)&&!1!=b.returnValue_}if(!1 in d)if(g=d[!1],g.remaining_=g.count_,c)for(h=0;!b.propagationStopped_&&h<f.length&&g.remaining_;h++)b.currentTarget=f[h],e&=goog.events.fireListeners_(g,f[h],b.type,!1,b)&&!1!=b.returnValue_;else for(d=a;!b.propagationStopped_&&d&&g.remaining_;d=d.getParentEventTarget())b.currentTarget=d,e&=goog.events.fireListeners_(g,d,b.type,!1,b)&&!1!=b.returnValue_;return Boolean(e)};
goog.events.protectBrowserEventEntryPoint=function(a){goog.events.handleBrowserEvent_=a.protectEntryPoint(goog.events.handleBrowserEvent_)};
goog.events.handleBrowserEvent_=function(a,b){if(!goog.events.listeners_[a])return!0;var c=goog.events.listeners_[a],d=c.type,e=goog.events.listenerTree_;if(!(d in e))return!0;var e=e[d],f,g;if(!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT){f=b||goog.getObjectByName("window.event");var h=!0 in e,i=!1 in e;if(h){if(goog.events.isMarkedIeEvent_(f))return!0;goog.events.markIeEvent_(f)}var j=new goog.events.BrowserEvent;j.init(f,this);f=!0;try{if(h){for(var k=[],l=j.currentTarget;l;l=l.parentNode)k.push(l);
g=e[!0];g.remaining_=g.count_;for(var m=k.length-1;!j.propagationStopped_&&0<=m&&g.remaining_;m--)j.currentTarget=k[m],f&=goog.events.fireListeners_(g,k[m],d,!0,j);if(i){g=e[!1];g.remaining_=g.count_;for(m=0;!j.propagationStopped_&&m<k.length&&g.remaining_;m++)j.currentTarget=k[m],f&=goog.events.fireListeners_(g,k[m],d,!1,j)}}else f=goog.events.fireListener(c,j)}finally{if(k)k.length=0;j.dispose()}return f}d=new goog.events.BrowserEvent(b,this);try{f=goog.events.fireListener(c,d)}finally{d.dispose()}return f};
goog.events.markIeEvent_=function(a){var b=!1;if(0==a.keyCode)try{a.keyCode=-1;return}catch(c){b=!0}if(b||void 0==a.returnValue)a.returnValue=!0};goog.events.isMarkedIeEvent_=function(a){return 0>a.keyCode||void 0!=a.returnValue};goog.events.uniqueIdCounter_=0;goog.events.getUniqueId=function(a){return a+"_"+goog.events.uniqueIdCounter_++};goog.debug.entryPointRegistry.register(function(a){goog.events.handleBrowserEvent_=a(goog.events.handleBrowserEvent_)});X.event=function(a){goog.events.Event.call(this,a);this._className="event"};goog.inherits(X.event,goog.events.Event);X.event.uniqueId=function(a){return goog.events.getUniqueId(a)};X.event.events={PAN:X.event.uniqueId("pan"),ROTATE:X.event.uniqueId("rotate"),ZOOM:X.event.uniqueId("zoom"),RENDER:X.event.uniqueId("render"),RESETVIEW:X.event.uniqueId("resetview"),MODIFIED:X.event.uniqueId("modified"),PROGRESS:X.event.uniqueId("progress"),HOVER:X.event.uniqueId("hover"),HOVER_END:X.event.uniqueId("hover_end")};
X.event.PanEvent=function(){X.event.call(this,X.event.events.PAN);this._distance=new goog.math.Vec2(0,0)};goog.inherits(X.event.PanEvent,X.event);X.event.RotateEvent=function(){X.event.call(this,X.event.events.ROTATE);this._distance=new goog.math.Vec2(0,0);this._angle=0};goog.inherits(X.event.RotateEvent,X.event);X.event.ZoomEvent=function(){X.event.call(this,X.event.events.ZOOM);this._fast=this._in=!1};goog.inherits(X.event.ZoomEvent,X.event);
X.event.RenderEvent=function(){X.event.call(this,X.event.events.RENDER);this._timestamp=Date.now()};goog.inherits(X.event.RenderEvent,X.event);X.event.HoverEvent=function(){X.event.call(this,X.event.events.HOVER);this._y=this._x=0};goog.inherits(X.event.HoverEvent,X.event);X.event.HoverEndEvent=function(){X.event.call(this,X.event.events.HOVER_END)};goog.inherits(X.event.HoverEndEvent,X.event);X.event.ResetViewEvent=function(){X.event.call(this,X.event.events.RESETVIEW)};
goog.inherits(X.event.ResetViewEvent,X.event);X.event.ModifiedEvent=function(){X.event.call(this,X.event.events.MODIFIED);this._object=new X.object};goog.inherits(X.event.ModifiedEvent,X.event);X.event.ProgressEvent=function(){X.event.call(this,X.event.events.PROGRESS);this._value=0};goog.inherits(X.event.ProgressEvent,X.event);goog.exportSymbol("X.event",X.event);goog.exportSymbol("X.event.events",X.event.events);goog.exportSymbol("X.event.uniqueId",X.event.uniqueId);
goog.exportSymbol("X.event.PanEvent",X.event.PanEvent);goog.exportSymbol("X.event.RotateEvent",X.event.RotateEvent);goog.exportSymbol("X.event.ZoomEvent",X.event.ZoomEvent);goog.exportSymbol("X.event.RenderEvent",X.event.RenderEvent);goog.exportSymbol("X.event.ResetViewEvent",X.event.ResetViewEvent);goog.exportSymbol("X.event.ModifiedEvent",X.event.ModifiedEvent);goog.exportSymbol("X.event.HoverEvent",X.event.HoverEvent);goog.exportSymbol("X.event.ProgressEvent",X.event.ProgressEvent);goog.math={};goog.math.randomInt=function(a){return Math.floor(Math.random()*a)};goog.math.uniformRandom=function(a,b){return a+Math.random()*(b-a)};goog.math.clamp=function(a,b,c){return Math.min(Math.max(a,b),c)};goog.math.modulo=function(a,b){var c=a%b;return 0>c*b?c+b:c};goog.math.lerp=function(a,b,c){return a+c*(b-a)};goog.math.nearlyEquals=function(a,b,c){return Math.abs(a-b)<=(c||1.0E-6)};goog.math.standardAngle=function(a){return goog.math.modulo(a,360)};
goog.math.toRadians=function(a){return a*Math.PI/180};goog.math.toDegrees=function(a){return 180*a/Math.PI};goog.math.angleDx=function(a,b){return b*Math.cos(goog.math.toRadians(a))};goog.math.angleDy=function(a,b){return b*Math.sin(goog.math.toRadians(a))};goog.math.angle=function(a,b,c,d){return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(d-b,c-a)))};goog.math.angleDifference=function(a,b){var c=goog.math.standardAngle(b)-goog.math.standardAngle(a);180<c?c-=360:-180>=c&&(c=360+c);return c};
goog.math.sign=function(a){return 0==a?0:0>a?-1:1};goog.math.longestCommonSubsequence=function(a,b,c,d){for(var c=c||function(a,b){return a==b},d=d||function(b){return a[b]},e=a.length,f=b.length,g=[],h=0;h<e+1;h++)g[h]=[],g[h][0]=0;for(var i=0;i<f+1;i++)g[0][i]=0;for(h=1;h<=e;h++)for(i=1;i<=e;i++)g[h][i]=c(a[h-1],b[i-1])?g[h-1][i-1]+1:Math.max(g[h-1][i],g[h][i-1]);for(var j=[],h=e,i=f;0<h&&0<i;)c(a[h-1],b[i-1])?(j.unshift(d(h-1,i-1)),h--,i--):g[h-1][i]>g[h][i-1]?h--:i--;return j};
goog.math.sum=function(a){return goog.array.reduce(arguments,function(a,c){return a+c},0)};goog.math.average=function(a){return goog.math.sum.apply(null,arguments)/arguments.length};goog.math.standardDeviation=function(a){var b=arguments.length;if(2>b)return 0;var c=goog.math.average.apply(null,arguments),b=goog.math.sum.apply(null,goog.array.map(arguments,function(a){return Math.pow(a-c,2)}))/(b-1);return Math.sqrt(b)};goog.math.isInt=function(a){return isFinite(a)&&0==a%1};
goog.math.isFiniteNumber=function(a){return isFinite(a)&&!isNaN(a)};goog.math.Coordinate3=function(a,b,c){this.x=goog.isDef(a)?a:0;this.y=goog.isDef(b)?b:0;this.z=goog.isDef(c)?c:0};goog.math.Coordinate3.prototype.clone=function(){return new goog.math.Coordinate3(this.x,this.y,this.z)};if(goog.DEBUG)goog.math.Coordinate3.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};goog.math.Coordinate3.equals=function(a,b){return a==b?!0:!a||!b?!1:a.x==b.x&&a.y==b.y&&a.z==b.z};
goog.math.Coordinate3.distance=function(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.z-b.z;return Math.sqrt(c*c+d*d+e*e)};goog.math.Coordinate3.squaredDistance=function(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.z-b.z;return c*c+d*d+e*e};goog.math.Coordinate3.difference=function(a,b){return new goog.math.Coordinate3(a.x-b.x,a.y-b.y,a.z-b.z)};goog.math.Coordinate3.prototype.toArray=function(){return[this.x,this.y,this.z]};
goog.math.Coordinate3.fromArray=function(a){if(3>=a.length)return new goog.math.Coordinate3(a[0],a[1],a[2]);throw Error("Conversion from an array requires an array of length 3");};goog.math.Vec3=function(a,b,c){this.x=a;this.y=b;this.z=c};goog.inherits(goog.math.Vec3,goog.math.Coordinate3);goog.math.Vec3.randomUnit=function(){var a=2*Math.random()*Math.PI,b=2*Math.random()*Math.PI,b=Math.cos(b),c=Math.sqrt(1-b*b)*Math.cos(a),a=Math.sqrt(1-b*b)*Math.sin(a);return new goog.math.Vec3(c,a,b)};goog.math.Vec3.random=function(){return goog.math.Vec3.randomUnit().scale(Math.random())};goog.math.Vec3.fromCoordinate3=function(a){return new goog.math.Vec3(a.x,a.y,a.z)};
goog.math.Vec3.prototype.clone=function(){return new goog.math.Vec3(this.x,this.y,this.z)};goog.math.Vec3.prototype.magnitude=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)};goog.math.Vec3.prototype.squaredMagnitude=function(){return this.x*this.x+this.y*this.y+this.z*this.z};goog.math.Vec3.prototype.scale=function(a){this.x*=a;this.y*=a;this.z*=a;return this};goog.math.Vec3.prototype.invert=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this};
goog.math.Vec3.prototype.normalize=function(){return this.scale(1/this.magnitude())};goog.math.Vec3.prototype.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this};goog.math.Vec3.prototype.subtract=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this};goog.math.Vec3.prototype.equals=function(a){return this==a||!!a&&this.x==a.x&&this.y==a.y&&this.z==a.z};goog.math.Vec3.distance=goog.math.Coordinate3.distance;goog.math.Vec3.squaredDistance=goog.math.Coordinate3.squaredDistance;
goog.math.Vec3.equals=goog.math.Coordinate3.equals;goog.math.Vec3.sum=function(a,b){return new goog.math.Vec3(a.x+b.x,a.y+b.y,a.z+b.z)};goog.math.Vec3.difference=function(a,b){return new goog.math.Vec3(a.x-b.x,a.y-b.y,a.z-b.z)};goog.math.Vec3.dot=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z};goog.math.Vec3.cross=function(a,b){return new goog.math.Vec3(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x)};
goog.math.Vec3.lerp=function(a,b,c){return new goog.math.Vec3(goog.math.lerp(a.x,b.x,c),goog.math.lerp(a.y,b.y,c),goog.math.lerp(a.z,b.z,c))};goog.events.EventTarget=function(){goog.Disposable.call(this)};goog.inherits(goog.events.EventTarget,goog.Disposable);goog.events.EventTarget.prototype.customEvent_=!0;goog.events.EventTarget.prototype.parentEventTarget_=null;goog.events.EventTarget.prototype.getParentEventTarget=function(){return this.parentEventTarget_};goog.events.EventTarget.prototype.setParentEventTarget=function(a){this.parentEventTarget_=a};
goog.events.EventTarget.prototype.addEventListener=function(a,b,c,d){goog.events.listen(this,a,b,c,d)};goog.events.EventTarget.prototype.removeEventListener=function(a,b,c,d){goog.events.unlisten(this,a,b,c,d)};goog.events.EventTarget.prototype.dispatchEvent=function(a){return goog.events.dispatchEvent(this,a)};goog.events.EventTarget.prototype.disposeInternal=function(){goog.events.EventTarget.superClass_.disposeInternal.call(this);goog.events.removeAll(this);this.parentEventTarget_=null};X.base=function(){goog.events.EventTarget.call(this);this._className="base";this._dirty=!1};goog.inherits(X.base,goog.events.EventTarget);X.base.prototype.className=function(){return this._className};X.base.prototype.id=function(){return this._id};X.base.prototype.print=function(){var a=Object.keys(this),b="",c="<unknown>",d=0;for(d in a){var e="this."+a[d],f=eval(e);"this._className"==e?c=f:b+=e+": "+f+"\n"}return"== X."+c+" ==\n"+b};X.base.prototype.dirty=function(){return this._dirty};
X.base.prototype.setClean=function(){this._dirty=!1};goog.exportSymbol("X.base",X.base);goog.exportSymbol("X.base.prototype.className",X.base.prototype.className);goog.exportSymbol("X.base.prototype.print",X.base.prototype.print);goog.exportSymbol("X.base.prototype.dirty",X.base.prototype.dirty);goog.exportSymbol("X.base.prototype.setClean",X.base.prototype.setClean);X.exception=function(a){var b="Unknown error!";goog.isDefAndNotNull(a)&&(b=a);X.base.call(this);this._className="exception";this._message="Fatal: "+b;this._stackTrace_=Error().stack};goog.inherits(X.exception,X.base);goog.exportSymbol("X.exception",X.exception);X.triplets=function(a){X.base.call(this);this._className="triplets";this._maxC=this._minC=this._maxB=this._minB=this._maxA=this._minA=null;this._triplets_=[];if(goog.isDefAndNotNull(a))this._triplets_=a};goog.inherits(X.triplets,X.base);
X.triplets.prototype.add=function(a,b,c){if(!goog.isNumber(a)||!goog.isNumber(b)||!goog.isNumber(c))throw new X.exception("Invalid triplet.");if(!this._minA||a<this._minA)this._minA=a;if(!this._maxA||a>this._maxA)this._maxA=a;if(!this._minB||b<this._minB)this._minB=b;if(!this._maxB||b>this._maxB)this._maxB=b;if(!this._minC||c<this._minC)this._minC=c;if(!this._maxC||c>this._maxC)this._maxC=c;this._dirty=!0;return this._triplets_.push(a,b,c)/3};
X.triplets.prototype.get=function(a){if(!goog.isNumber(a)||3*a>this._triplets_.length)throw new X.exception("Invalid id.");a*=3;return[this._triplets_[a],this._triplets_[a+1],this._triplets_[a+2]]};X.triplets.prototype.remove=function(a){if(!goog.isNumber(a)||3*a>this._triplets_.length)throw new X.exception("Invalid id.");this._triplets_.splice(a,3);this._dirty=!0};X.triplets.prototype.all=function(){return this._triplets_};X.triplets.prototype.clear=function(){this._triplets_=[];this._dirty=!0};
X.triplets.prototype.count=function(){return this._triplets_.length/3};X.triplets.prototype.length=function(){return this._triplets_.length};X.triplets.prototype.minA=function(){return this._minA};X.triplets.prototype.maxA=function(){return this._maxA};X.triplets.prototype.minB=function(){return this._minB};X.triplets.prototype.maxB=function(){return this._maxB};X.triplets.prototype.minC=function(){return this._minC};X.triplets.prototype.maxC=function(){return this._maxC};
goog.exportSymbol("X.triplets",X.triplets);goog.exportSymbol("X.triplets.prototype.add",X.triplets.prototype.add);goog.exportSymbol("X.triplets.prototype.get",X.triplets.prototype.get);goog.exportSymbol("X.triplets.prototype.remove",X.triplets.prototype.remove);goog.exportSymbol("X.triplets.prototype.all",X.triplets.prototype.all);goog.exportSymbol("X.triplets.prototype.clear",X.triplets.prototype.clear);goog.exportSymbol("X.triplets.prototype.count",X.triplets.prototype.count);
goog.exportSymbol("X.triplets.prototype.length",X.triplets.prototype.length);X.parser=function(){X.base.call(this);this._className="parser"};goog.inherits(X.parser,X.base);X.parser.extensions={STL:"STL",VTK:"VTK",TRK:"TRK"};X.parser.prototype.parse=function(){throw new X.exception("The function parse() should be overloaded!");};X.parser.prototype.parseString=function(a,b,c){return a.substr(b,c)};
X.parser.prototype.parseFloat32=function(a,b){var c=this.parseUChar8(a,b),d=this.parseUChar8(a,b+1),e=this.parseUChar8(a,b+2),f=this.parseUChar8(a,b+3),g=(f<<1&255|e>>7)-127,c=(e&127)<<16|d<<8|c;return 0==c&&-127==g?0:(1-2*(f>>7))*(1+c*Math.pow(2,-23))*Math.pow(2,g)};
X.parser.prototype.parseFloat32EndianSwapped=function(a,b){var c=this.parseUChar8(a,b),d=this.parseUChar8(a,b+1),e=this.parseUChar8(a,b+2),f=this.parseUChar8(a,b+3),g=(c<<1&255|d>>7)-127,d=(d&127)<<16|e<<8|f;return 0==d&&-127==g?0:(1-2*(c>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,g)};X.parser.prototype.parseFloat32Array=function(a,b,c){var d=[],e;for(e=0;e<c;e++){var f=this.parseFloat32(a,b+4*e);d[e]=f}return d};
X.parser.prototype.parseUInt32=function(a,b){var c=this.parseUChar8(a,b),d=this.parseUChar8(a,b+1),e=this.parseUChar8(a,b+2);return(this.parseUChar8(a,b+3)<<24)+(e<<16)+(d<<8)+c};X.parser.prototype.parseUInt32EndianSwapped=function(a,b){var c=this.parseUChar8(a,b),d=this.parseUChar8(a,b+1),e=this.parseUChar8(a,b+2),f=this.parseUChar8(a,b+3);return(c<<24)+(d<<16)+(e<<8)+f};
X.parser.prototype.parseUInt24EndianSwapped=function(a,b){var c=this.parseUChar8(a,b),d=this.parseUChar8(a,b+1),e=this.parseUChar8(a,b+2);return(c<<16)+(d<<8)+e&16777215};X.parser.prototype.parseUInt16=function(a,b){var c=this.parseUChar8(a,b);return(this.parseUChar8(a,b+1)<<8)+c};X.parser.prototype.parseUInt16Array=function(a,b,c){var d=[],e;for(e=0;e<c;e++){var f=this.parseUInt16(a,b+2*e);d[e]=f}return d};
X.parser.prototype.parseSChar8=function(a,b){var c=this.parseUChar8(a,b);return 127<c?c-256:c};X.parser.prototype.parseUChar8=function(a,b){return a.charCodeAt(b)&255};goog.exportSymbol("X.parser",X.parser);goog.exportSymbol("X.parser.extensions",X.parser.extensions);goog.exportSymbol("X.parser.prototype.parse",X.parser.prototype.parse);X.parserTRK=function(){X.parser.call(this);this._className="parserTRK"};goog.inherits(X.parserTRK,X.parser);
X.parserTRK.prototype.parse=function(a,b){var c=a.points(),d=a.normals(),e=a.colors(),f=0;this.parseString(b,f,6);this.parseUInt16Array(b,f+6,3);var g=this.parseFloat32Array(b,f+12,3);this.parseFloat32Array(b,f+24,3);var h=this.parseUInt16(b,f+36);this.parseString(b,f+38,200);var i=this.parseUInt16(b,f+238);this.parseString(b,f+240,200);this.parseFloat32Array(b,f+440,16);this.parseString(b,f+504,444);this.parseString(b,f+948,4);this.parseString(b,f+952,4);this.parseFloat32Array(b,f+956,6);this.parseString(b,
f+980,2);this.parseUChar8(b,f+982);this.parseUChar8(b,f+983);this.parseUChar8(b,f+984);this.parseUChar8(b,f+985);this.parseUChar8(b,f+986);this.parseUChar8(b,f+987);var j=this.parseUInt32(b,f+988);this.parseUInt32(b,f+992);var f=this.parseUInt32(b,f+996),k=[],l=null,m=null,n=null,x=null,v=null,t=null,w;for(w=0;w<j;w++){for(var u=this.parseUInt32(b,f),o=new X.triplets,f=f+4,p=0;p<u;p++){var q=this.parseFloat32(b,f),f=f+4,r=this.parseFloat32(b,f),f=f+4,s=this.parseFloat32(b,f),f=f+4;0<h&&(this.parseFloat32Array(b,
f,h),f+=4*h);q/=g[0];r/=g[1];s/=g[2];o.add(q,r,s)}0<i&&(f+=4*i);var p=o.minA(),u=o.maxA(),q=o.minB(),r=o.maxB(),s=o.minC(),y=o.maxC();if(!l||p<l)l=p;if(!m||u>m)m=u;if(!n||q<n)n=q;if(!x||r>x)x=r;if(!v||s<v)v=s;if(!t||y>t)t=y;k.push(o)}f=(l+m)/2;n=(n+x)/2;v=(v+t)/2;for(w=0;w<j;w++){t=k[w];x=t.count();for(p=0;p<x-1;p++)h=t.get(p),g=t.get(p+1),c.add(h[0],h[1],h[2]),c.add(g[0],g[1],g[2]),i=h[0]-f,l=h[1]-n,m=h[2]-v,o=Math.sqrt(i*i+l*l+m*m),u=g[0]-f,q=g[1]-n,r=g[2]-v,s=Math.sqrt(u*u+q*q+r*r),d.add(i/o,l/
o,m/o),d.add(u/s,q/s,r/s),g=[Math.abs(g[0]-h[0]),Math.abs(g[1]-h[1]),Math.abs(g[2]-h[2])],h=Math.sqrt(g[0]*g[0]+g[1]*g[1]+g[2]*g[2]),g[0]/=h,g[1]/=h,g[2]/=h,e.add(g[0],g[1],g[2]),e.add(g[0],g[1],g[2])}a.setType(X.object.types.LINES);c=new X.event.ModifiedEvent;c._object=a;this.dispatchEvent(c)};goog.exportSymbol("X.parserTRK",X.parserTRK);goog.exportSymbol("X.parserTRK.prototype.parse",X.parserTRK.prototype.parse);X.parserSTL=function(){X.parser.call(this);this._className="parserSTL"};goog.inherits(X.parserSTL,X.parser);
X.parserSTL.prototype.parse=function(a,b){for(var c=b.split("\n"),d=c.length,e=a.points(),f=a.normals(),g=0,h=d%8;h--;)this.parseLine(e,f,c[g]),g++;for(h=0.125*d^0;h--;)this.parseLine(e,f,c[g]),g++,this.parseLine(e,f,c[g]),g++,this.parseLine(e,f,c[g]),g++,this.parseLine(e,f,c[g]),g++,this.parseLine(e,f,c[g]),g++,this.parseLine(e,f,c[g]),g++,this.parseLine(e,f,c[g]),g++,this.parseLine(e,f,c[g]),g++;c=new X.event.ModifiedEvent;c._object=a;this.dispatchEvent(c)};
X.parserSTL.prototype.parseLine=function(a,b,c){var c=c.replace(/^\s+|\s+$/g,""),d=c.split(" ");if("vertex"==d[0]){var c=parseFloat(d[1]),e=parseFloat(d[2]),d=parseFloat(d[3]);a.add(c,e,d)}else"facet"==d[0]&&(c=parseFloat(d[2]),e=parseFloat(d[3]),d=parseFloat(d[4]),b.add(c,e,d),b.add(c,e,d),b.add(c,e,d))};goog.exportSymbol("X.parserSTL",X.parserSTL);goog.exportSymbol("X.parserSTL.prototype.parse",X.parserSTL.prototype.parse);goog.exportSymbol("X.parserSTL.prototype.parseLine",X.parserSTL.prototype.parseLine);goog.json={};goog.json.isValid_=function(a){return/^\s*$/.test(a)?!1:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x10-\x1f\x80-\x9f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,""))};goog.json.parse=function(a){a=""+a;if(goog.json.isValid_(a))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);};goog.json.unsafeParse=function(a){return eval("("+a+")")};
goog.json.serialize=function(a,b){return(new goog.json.Serializer(b)).serialize(a)};goog.json.Serializer=function(a){this.replacer_=a};goog.json.Serializer.prototype.serialize=function(a){var b=[];this.serialize_(a,b);return b.join("")};
goog.json.Serializer.prototype.serialize_=function(a,b){switch(typeof a){case "string":this.serializeString_(a,b);break;case "number":this.serializeNumber_(a,b);break;case "boolean":b.push(a);break;case "undefined":b.push("null");break;case "object":if(null==a){b.push("null");break}if(goog.isArray(a)){this.serializeArray_(a,b);break}this.serializeObject_(a,b);break;case "function":break;default:throw Error("Unknown type: "+typeof a);}};
goog.json.Serializer.charToJsonCharCache_={'"':'\\"',"\\":"\\\\","/":"\\/","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\u000b":"\\u000b"};goog.json.Serializer.charsToReplace_=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
goog.json.Serializer.prototype.serializeString_=function(a,b){b.push('"',a.replace(goog.json.Serializer.charsToReplace_,function(a){if(a in goog.json.Serializer.charToJsonCharCache_)return goog.json.Serializer.charToJsonCharCache_[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return goog.json.Serializer.charToJsonCharCache_[a]=e+b.toString(16)}),'"')};goog.json.Serializer.prototype.serializeNumber_=function(a,b){b.push(isFinite(a)&&!isNaN(a)?a:"null")};
goog.json.Serializer.prototype.serializeArray_=function(a,b){var c=a.length;b.push("[");for(var d="",e=0;e<c;e++)b.push(d),d=a[e],this.serialize_(this.replacer_?this.replacer_.call(a,""+e,d):d,b),d=",";b.push("]")};
goog.json.Serializer.prototype.serializeObject_=function(a,b){b.push("{");var c="",d;for(d in a)if(Object.prototype.hasOwnProperty.call(a,d)){var e=a[d];"function"!=typeof e&&(b.push(c),this.serializeString_(d,b),b.push(":"),this.serialize_(this.replacer_?this.replacer_.call(a,d,e):e,b),c=",")}b.push("}")};X.indexer=function(){X.base.call(this);this._className="indexer";this._unique=[];this._indices=[];this._map={}};goog.inherits(X.indexer,X.base);X.indexer.prototype.add=function(a){if(!goog.isDefAndNotNull(a))throw new X.exception("Invalid object.");var b=goog.json.serialize(a);if(!(b in this._map))this._map[b]=this._unique.length,this._unique.push(a);return this._map[b]};X.indexer.prototype.unique=function(){return this._unique};goog.exportSymbol("X.indexer",X.indexer);
goog.exportSymbol("X.indexer.prototype.add",X.indexer.prototype.add);goog.exportSymbol("X.indexer.prototype.unique",X.indexer.prototype.unique);var CSG=function(){this.polygons=[]};CSG.fromPolygons=function(a){var b=new CSG;b.polygons=a;return b};
CSG.prototype={clone:function(){var a=new CSG;a.polygons=this.polygons.map(function(a){return a.clone()});return a},toPolygons:function(){return this.polygons},union:function(a){var b=new CSG.Node(this.clone().polygons),a=new CSG.Node(a.clone().polygons);b.clipTo(a);a.clipTo(b);a.invert();a.clipTo(b);a.invert();b.build(a.allPolygons());return CSG.fromPolygons(b.allPolygons())},subtract:function(a){var b=new CSG.Node(this.clone().polygons),a=new CSG.Node(a.clone().polygons);b.invert();b.clipTo(a);
a.clipTo(b);a.invert();a.clipTo(b);a.invert();b.build(a.allPolygons());b.invert();return CSG.fromPolygons(b.allPolygons())},intersect:function(a){var b=new CSG.Node(this.clone().polygons),a=new CSG.Node(a.clone().polygons);b.invert();a.clipTo(b);a.invert();b.clipTo(a);a.clipTo(b);b.build(a.allPolygons());b.invert();return CSG.fromPolygons(b.allPolygons())},inverse:function(){var a=this.clone();a.polygons.map(function(a){a.flip()});return a}};
CSG.cube=function(a){var a=a||{},b=new CSG.Vector(a.center||[0,0,0]),c=!a.radius?[1,1,1]:a.radius.length?a.radius:[a.radius,a.radius,a.radius];return CSG.fromPolygons([[[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 CSG.Polygon(a[0].map(function(e){e=new CSG.Vector(b.x+c[0]*(2*!!(e&1)-1),b.y+c[1]*(2*!!(e&2)-1),b.z+c[2]*(2*!!(e&4)-1));return new CSG.Vertex(e,new CSG.Vector(a[1]))}))}))};
CSG.sphere=function(a){function b(a,b){var a=a*2*Math.PI,b=b*Math.PI,e=new CSG.Vector(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));g.push(new CSG.Vertex(c.plus(e.times(d)),e))}for(var a=a||{},c=new CSG.Vector(a.center||[0,0,0]),d=a.radius||1,e=a.slices||16,a=a.stacks||8,f=[],g,h=0;h<e;h++)for(var i=0;i<a;i++)g=[],b(h/e,i/a),0<i&&b((h+1)/e,i/a),i<a-1&&b((h+1)/e,(i+1)/a),b(h/e,(i+1)/a),f.push(new CSG.Polygon(g));return CSG.fromPolygons(f)};
CSG.cylinder=function(a){function b(a,b,d){b=2*b*Math.PI;b=i.times(Math.cos(b)).plus(j.times(Math.sin(b)));a=c.plus(e.times(a)).plus(b.times(f));d=b.times(1-Math.abs(d)).plus(g.times(d));return new CSG.Vertex(a,d)}for(var a=a||{},c=new CSG.Vector(a.start||[0,-1,0]),d=new CSG.Vector(a.end||[0,1,0]),e=d.minus(c),f=a.radius||1,a=a.slices||16,g=e.unit(),h=0.5<Math.abs(g.y),i=(new CSG.Vector(h,!h,0)).cross(g).unit(),j=i.cross(g).unit(),h=new CSG.Vertex(c,g.negated()),d=new CSG.Vertex(d,g.unit()),k=[],
l=0;l<a;l++){var m=l/a,n=(l+1)/a;k.push(new CSG.Polygon([h,b(0,m,-1),b(0,n,-1)]));k.push(new CSG.Polygon([b(0,n,0),b(0,m,0),b(1,m,0),b(1,n,0)]));k.push(new CSG.Polygon([d,b(1,n,1),b(1,m,1)]))}return CSG.fromPolygons(k)};CSG.Vector=function(a,b,c){3==arguments.length?(this.x=a,this.y=b,this.z=c):"x"in a&&"y"in a&&"z"in a?(this.x=a.x,this.y=a.y,this.z=a.z):(this.x=a[0],this.y=a[1],this.z=a[2])};
CSG.Vector.prototype={clone:function(){return new CSG.Vector(this.x,this.y,this.z)},negated:function(){return new CSG.Vector(-this.x,-this.y,-this.z)},plus:function(a){return new CSG.Vector(this.x+a.x,this.y+a.y,this.z+a.z)},minus:function(a){return new CSG.Vector(this.x-a.x,this.y-a.y,this.z-a.z)},times:function(a){return new CSG.Vector(this.x*a,this.y*a,this.z*a)},dividedBy:function(a){return new CSG.Vector(this.x/a,this.y/a,this.z/a)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lerp:function(a,
b){return this.plus(a.minus(this).times(b))},length:function(){return Math.sqrt(this.dot(this))},unit:function(){return this.dividedBy(this.length())},cross:function(a){return new CSG.Vector(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)}};CSG.Vertex=function(a,b){this.pos=new CSG.Vector(a);this.normal=new CSG.Vector(b)};
CSG.Vertex.prototype={clone:function(){return new CSG.Vertex(this.pos.clone(),this.normal.clone())},flip:function(){this.normal=this.normal.negated()},interpolate:function(a,b){return new CSG.Vertex(this.pos.lerp(a.pos,b),this.normal.lerp(a.normal,b))}};CSG.Plane=function(a,b){this.normal=a;this.w=b};CSG.Plane.EPSILON=1.0E-5;CSG.Plane.fromPoints=function(a,b,c){b=b.minus(a).cross(c.minus(a)).unit();return new CSG.Plane(b,b.dot(a))};
CSG.Plane.prototype={clone:function(){return new CSG.Plane(this.normal.clone(),this.w)},flip:function(){this.normal=this.normal.negated();this.w=-this.w},splitPolygon:function(a,b,c,d,e){for(var f=0,g=[],h=0;h<a.vertices.length;h++){var i=this.normal.dot(a.vertices[h].pos)-this.w,i=i<-CSG.Plane.EPSILON?2:i>CSG.Plane.EPSILON?1:0,f=f|i;g.push(i)}switch(f){case 0:(0<this.normal.dot(a.plane.normal)?b:c).push(a);break;case 1:d.push(a);break;case 2:e.push(a);break;case 3:b=[];c=[];for(h=0;h<a.vertices.length;h++){var j=
(h+1)%a.vertices.length,i=g[h],k=g[j],f=a.vertices[h],j=a.vertices[j];2!=i&&b.push(f);1!=i&&c.push(2!=i?f.clone():f);3==(i|k)&&(i=(this.w-this.normal.dot(f.pos))/this.normal.dot(j.pos.minus(f.pos)),i=f.interpolate(j,i),b.push(i),c.push(i.clone()))}3<=b.length&&d.push(new CSG.Polygon(b,a.shared));3<=c.length&&e.push(new CSG.Polygon(c,a.shared))}}};CSG.Polygon=function(a,b){this.vertices=a;this.shared=b;this.plane=CSG.Plane.fromPoints(a[0].pos,a[1].pos,a[2].pos)};
CSG.Polygon.prototype={clone:function(){var a=this.vertices.map(function(a){return a.clone()});return new CSG.Polygon(a,this.shared)},flip:function(){this.vertices.reverse().map(function(a){a.flip()});this.plane.flip()}};CSG.Node=function(a){this.back=this.front=this.plane=null;this.polygons=[];a&&this.build(a)};
CSG.Node.prototype={clone:function(){var a=new CSG.Node;a.plane=this.plane&&this.plane.clone();a.front=this.front&&this.front.clone();a.back=this.back&&this.back.clone();a.polygons=this.polygons.map(function(a){return a.clone()});return a},invert:function(){for(var a=0;a<this.polygons.length;a++)this.polygons[a].flip();this.plane.flip();this.front&&this.front.invert();this.back&&this.back.invert();a=this.front;this.front=this.back;this.back=a},clipPolygons:function(a){if(!this.plane)return a.slice();
for(var b=[],c=[],d=0;d<a.length;d++)this.plane.splitPolygon(a[d],b,c,b,c);this.front&&(b=this.front.clipPolygons(b));c=this.back?this.back.clipPolygons(c):[];return b.concat(c)},clipTo:function(a){this.polygons=a.clipPolygons(this.polygons);this.front&&this.front.clipTo(a);this.back&&this.back.clipTo(a)},allPolygons:function(){var a=this.polygons.slice();this.front&&(a=a.concat(this.front.allPolygons()));this.back&&(a=a.concat(this.back.allPolygons()));return a},build:function(a){if(a.length){if(!this.plane)this.plane=
a[0].plane.clone();for(var b=[],c=[],d=0;d<a.length;d++)this.plane.splitPolygon(a[d],this.polygons,this.polygons,b,c);if(b.length){if(!this.front)this.front=new CSG.Node;this.front.build(b)}if(c.length){if(!this.back)this.back=new CSG.Node;this.back.build(c)}}}};goog.math.Coordinate=function(a,b){this.x=goog.isDef(a)?a:0;this.y=goog.isDef(b)?b:0};goog.math.Coordinate.prototype.clone=function(){return new goog.math.Coordinate(this.x,this.y)};if(goog.DEBUG)goog.math.Coordinate.prototype.toString=function(){return"("+this.x+", "+this.y+")"};goog.math.Coordinate.equals=function(a,b){return a==b?!0:!a||!b?!1:a.x==b.x&&a.y==b.y};goog.math.Coordinate.distance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)};
goog.math.Coordinate.squaredDistance=function(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d};goog.math.Coordinate.difference=function(a,b){return new goog.math.Coordinate(a.x-b.x,a.y-b.y)};goog.math.Coordinate.sum=function(a,b){return new goog.math.Coordinate(a.x+b.x,a.y+b.y)};goog.math.Vec2=function(a,b){this.x=a;this.y=b};goog.inherits(goog.math.Vec2,goog.math.Coordinate);goog.math.Vec2.randomUnit=function(){var a=2*Math.random()*Math.PI;return new goog.math.Vec2(Math.cos(a),Math.sin(a))};goog.math.Vec2.random=function(){var a=Math.sqrt(Math.random()),b=2*Math.random()*Math.PI;return new goog.math.Vec2(Math.cos(b)*a,Math.sin(b)*a)};goog.math.Vec2.fromCoordinate=function(a){return new goog.math.Vec2(a.x,a.y)};
goog.math.Vec2.prototype.clone=function(){return new goog.math.Vec2(this.x,this.y)};goog.math.Vec2.prototype.magnitude=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};goog.math.Vec2.prototype.squaredMagnitude=function(){return this.x*this.x+this.y*this.y};goog.math.Vec2.prototype.scale=function(a){this.x*=a;this.y*=a;return this};goog.math.Vec2.prototype.invert=function(){this.x=-this.x;this.y=-this.y;return this};goog.math.Vec2.prototype.normalize=function(){return this.scale(1/this.magnitude())};
goog.math.Vec2.prototype.add=function(a){this.x+=a.x;this.y+=a.y;return this};goog.math.Vec2.prototype.subtract=function(a){this.x-=a.x;this.y-=a.y;return this};goog.math.Vec2.prototype.rotate=function(a){var b=Math.cos(a),a=Math.sin(a),c=this.y*b+this.x*a;this.x=this.x*b-this.y*a;this.y=c;return this};goog.math.Vec2.rotateAroundPoint=function(a,b,c){return a.clone().subtract(b).rotate(c).add(b)};goog.math.Vec2.prototype.equals=function(a){return this==a||!!a&&this.x==a.x&&this.y==a.y};
goog.math.Vec2.distance=goog.math.Coordinate.distance;goog.math.Vec2.squaredDistance=goog.math.Coordinate.squaredDistance;goog.math.Vec2.equals=goog.math.Coordinate.equals;goog.math.Vec2.sum=function(a,b){return new goog.math.Vec2(a.x+b.x,a.y+b.y)};goog.math.Vec2.difference=function(a,b){return new goog.math.Vec2(a.x-b.x,a.y-b.y)};goog.math.Vec2.dot=function(a,b){return a.x*b.x+a.y*b.y};
goog.math.Vec2.lerp=function(a,b,c){return new goog.math.Vec2(goog.math.lerp(a.x,b.x,c),goog.math.lerp(a.y,b.y,c))};goog.math.Size=function(a,b){this.width=a;this.height=b};goog.math.Size.equals=function(a,b){return a==b?!0:!a||!b?!1:a.width==b.width&&a.height==b.height};goog.math.Size.prototype.clone=function(){return new goog.math.Size(this.width,this.height)};if(goog.DEBUG)goog.math.Size.prototype.toString=function(){return"("+this.width+" x "+this.height+")"};goog.math.Size.prototype.getLongest=function(){return Math.max(this.width,this.height)};
goog.math.Size.prototype.getShortest=function(){return Math.min(this.width,this.height)};goog.math.Size.prototype.area=function(){return this.width*this.height};goog.math.Size.prototype.perimeter=function(){return 2*(this.width+this.height)};goog.math.Size.prototype.aspectRatio=function(){return this.width/this.height};goog.math.Size.prototype.isEmpty=function(){return!this.area()};goog.math.Size.prototype.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};
goog.math.Size.prototype.fitsInside=function(a){return this.width<=a.width&&this.height<=a.height};goog.math.Size.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};goog.math.Size.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};goog.math.Size.prototype.scale=function(a){this.width*=a;this.height*=a;return this};
goog.math.Size.prototype.scaleToFit=function(a){return this.scale(this.aspectRatio()>a.aspectRatio()?a.width/this.width:a.height/this.height)};goog.math.Matrix=function(a,b){if(a instanceof goog.math.Matrix)this.array_=a.toArray();else if(goog.isArrayLike(a)&&goog.math.Matrix.isValidArray(a))this.array_=goog.array.clone(a);else if(a instanceof goog.math.Size)this.array_=goog.math.Matrix.createZeroPaddedArray_(a.height,a.width);else if(goog.isNumber(a)&&goog.isNumber(b)&&0<a&&0<b)this.array_=goog.math.Matrix.createZeroPaddedArray_(a,b);else throw Error("Invalid argument(s) for Matrix contructor");this.size_=new goog.math.Size(this.array_[0].length,
this.array_.length)};goog.math.Matrix.createIdentityMatrix=function(a){for(var b=[],c=0;c<a;c++){b[c]=[];for(var d=0;d<a;d++)b[c][d]=c==d?1:0}return new goog.math.Matrix(b)};goog.math.Matrix.forEach=function(a,b,c){for(var d=0;d<a.getSize().height;d++)for(var e=0;e<a.getSize().width;e++)b.call(c,a.array_[d][e],d,e,a)};
goog.math.Matrix.isValidArray=function(a){for(var b=0,c=0;c<a.length;c++){if(!goog.isArrayLike(a[c])||0<b&&a[c].length!=b)return!1;for(var d=0;d<a[c].length;d++)if(!goog.isNumber(a[c][d]))return!1;if(0==b)b=a[c].length}return 0!=b};goog.math.Matrix.map=function(a,b,c){var d=new goog.math.Matrix(a.getSize());goog.math.Matrix.forEach(a,function(e,f,g){d.array_[f][g]=b.call(c,e,f,g,a)});return d};
goog.math.Matrix.createZeroPaddedArray_=function(a,b){for(var c=[],d=0;d<a;d++){c[d]=[];for(var e=0;e<b;e++)c[d][e]=0}return c};goog.math.Matrix.prototype.add=function(a){if(!goog.math.Size.equals(this.size_,a.getSize()))throw Error("Matrix summation is only supported on arrays of equal size");return goog.math.Matrix.map(this,function(b,c,d){return b+a.array_[c][d]})};
goog.math.Matrix.prototype.appendColumns=function(a){if(this.size_.height!=a.getSize().height)throw Error("The given matrix has height "+a.size_.height+", but needs to have height "+this.size_.height+".");var b=new goog.math.Matrix(this.size_.height,this.size_.width+a.size_.width);goog.math.Matrix.forEach(this,function(a,d,e){b.array_[d][e]=a});goog.math.Matrix.forEach(a,function(a,d,e){b.array_[d][this.size_.width+e]=a},this);return b};
goog.math.Matrix.prototype.appendRows=function(a){if(this.size_.width!=a.getSize().width)throw Error("The given matrix has width "+a.size_.width+", but needs to have width "+this.size_.width+".");var b=new goog.math.Matrix(this.size_.height+a.size_.height,this.size_.width);goog.math.Matrix.forEach(this,function(a,d,e){b.array_[d][e]=a});goog.math.Matrix.forEach(a,function(a,d,e){b.array_[this.size_.height+d][e]=a},this);return b};
goog.math.Matrix.prototype.equals=function(a,b){if(this.size_.width!=a.size_.width||this.size_.height!=a.size_.height)return!1;for(var c=b||0,d=0;d<this.size_.height;d++)for(var e=0;e<this.size_.width;e++)if(!goog.math.nearlyEquals(this.array_[d][e],a.array_[d][e],c))return!1;return!0};goog.math.Matrix.prototype.getDeterminant=function(){if(!this.isSquare())throw Error("A determinant can only be take on a square matrix");return this.getDeterminant_()};
goog.math.Matrix.prototype.getInverse=function(){if(!this.isSquare())throw Error("An inverse can only be taken on a square matrix.");var a=goog.math.Matrix.createIdentityMatrix(this.size_.height),b=this.appendColumns(a).getReducedRowEchelonForm();return!b.getSubmatrixByCoordinates_(0,0,a.size_.width-1,a.size_.height-1).equals(a)?null:b.getSubmatrixByCoordinates_(0,a.size_.width)};
goog.math.Matrix.prototype.getReducedRowEchelonForm=function(){for(var a=new goog.math.Matrix(this),b=0,c=0;c<a.size_.height&&!(b>=a.size_.width);c++){for(var d=c;0==a.array_[d][b];)if(d++,d==a.size_.height&&(d=c,b++,b==a.size_.width))return a;this.swapRows_(d,c);for(var d=a.array_[c][b],e=b;e<a.size_.width;e++)a.array_[c][e]/=d;for(d=0;d<a.size_.height;d++)if(d!=c)for(var f=a.array_[d][b],e=b;e<a.size_.width;e++)a.array_[d][e]-=f*a.array_[c][e];b++}return a};goog.math.Matrix.prototype.getSize=function(){return this.size_};
goog.math.Matrix.prototype.getTranspose=function(){var a=new goog.math.Matrix(this.size_.width,this.size_.height);goog.math.Matrix.forEach(this,function(b,c,d){a.array_[d][c]=b});return a};goog.math.Matrix.prototype.getValueAt=function(a,b){return!this.isInBounds_(a,b)?null:this.array_[a][b]};goog.math.Matrix.prototype.isSquare=function(){return this.size_.width==this.size_.height};
goog.math.Matrix.prototype.setValueAt=function(a,b,c){if(!this.isInBounds_(a,b))throw Error("Index out of bounds when setting matrix value, ("+a+","+b+") in size ("+this.size_.height+","+this.size_.width+")");this.array_[a][b]=c};
goog.math.Matrix.prototype.multiply=function(a){if(a instanceof goog.math.Matrix){if(this.size_.width!=a.getSize().height)throw Error("Invalid matrices for multiplication. Second matrix should have the same number of rows as the first has columns.");return this.matrixMultiply_(a)}if(goog.isNumber(a))return this.scalarMultiply_(a);throw Error("A matrix can only be multiplied by a number or another matrix.");};
goog.math.Matrix.prototype.subtract=function(a){if(!goog.math.Size.equals(this.size_,a.getSize()))throw Error("Matrix subtraction is only supported on arrays of equal size.");return goog.math.Matrix.map(this,function(b,c,d){return b-a.array_[c][d]})};goog.math.Matrix.prototype.toArray=function(){return this.array_};
if(goog.DEBUG)goog.math.Matrix.prototype.toString=function(){var a=0;goog.math.Matrix.forEach(this,function(b){b=(""+b).length;b>a&&(a=b)});var b=[];goog.array.forEach(this.array_,function(c){b.push("[ ");goog.array.forEach(c,function(c){c=""+c;b.push(goog.string.repeat(" ",a-c.length)+c+" ")});b.push("]\n")});return b.join("")};goog.math.Matrix.prototype.getCofactor_=function(a,b){return(0==a+b%2?1:-1)*this.getMinor_(a,b)};
goog.math.Matrix.prototype.getDeterminant_=function(){if(1==this.getSize().area())return this.array_[0][0];for(var a=0,b=0;b<this.size_.width;b++)a+=this.array_[0][b]*this.getCofactor_(0,b);return a};goog.math.Matrix.prototype.getMinor_=function(a,b){return this.getSubmatrixByDeletion_(a,b).getDeterminant_()};
goog.math.Matrix.prototype.getSubmatrixByCoordinates_=function(a,b,c,d){var e=new goog.math.Matrix((c?c:this.size_.height-1)-a+1,(d?d:this.size_.width-1)-b+1);goog.math.Matrix.forEach(e,function(c,d,h){e.array_[d][h]=this.array_[a+d][b+h]},this);return e};goog.math.Matrix.prototype.getSubmatrixByDeletion_=function(a,b){var c=new goog.math.Matrix(this.size_.width-1,this.size_.height-1);goog.math.Matrix.forEach(c,function(d,e,f){c.setValueAt(e,f,this.array_[e>=a?e+1:e][f>=b?f+1:f])},this);return c};
goog.math.Matrix.prototype.isInBounds_=function(a,b){return 0<=a&&a<this.size_.height&&0<=b&&b<this.size_.width};goog.math.Matrix.prototype.matrixMultiply_=function(a){var b=new goog.math.Matrix(this.size_.height,a.getSize().width);goog.math.Matrix.forEach(b,function(c,d,e){for(var f=c=0;f<this.size_.width;f++)c+=this.getValueAt(d,f)*a.getValueAt(f,e);b.setValueAt(d,e,c)},this);return b};goog.math.Matrix.prototype.scalarMultiply_=function(a){return goog.math.Matrix.map(this,function(b){return b*a})};
goog.math.Matrix.prototype.swapRows_=function(a,b){var c=this.array_[a];this.array_[a]=this.array_[b];this.array_[b]=c};X.matrix=function(a,b){goog.math.Matrix.call(this,a,b);this._className="matrix"};goog.inherits(X.matrix,goog.math.Matrix);X.matrix.createIdentityMatrix=function(a){for(var b=[],c=0;c<a;c++){b[c]=[];for(var d=0;d<a;d++)b[c][d]=c==d?1:0}return new X.matrix(b)};X.matrix.prototype.flatten=function(){var a=[],b=this.getSize();if(0==b.height||0==b.width)return[];var c,d;for(d=0;d<b.height;d++)for(c=0;c<b.width;c++)a.push(this.getValueAt(c,d));return a};
X.matrix.prototype.translate=function(a){if(!this.isSquare())throw new X.exception("Can not translate non-square matrix!");var b=this.getSize(),c=goog.math.Matrix.createIdentityMatrix(b.height);if(a instanceof goog.math.Vec2&&3==b.height)c.setValueAt(0,2,a.x),c.setValueAt(1,2,a.y);else if(a instanceof goog.math.Vec3&&4==b.height)c.setValueAt(0,3,a.x),c.setValueAt(1,3,a.y),c.setValueAt(2,3,a.z);else throw new X.exception("Translation failed!");return new X.matrix(this.multiply(c))};
X.matrix.prototype.rotate=function(a,b){if(4!=this.getSize().height||!this.isSquare())throw new X.exception("Only 4x4 matrices can be rotated!");if(!goog.isDefAndNotNull(b)||!(b instanceof goog.math.Vec3))throw new X.exception("Invalid axis vector!");if(!goog.isNumber(a))throw new X.exception("Invalid angle!");var c=b.normalize(),d=Math.cos(a),e=Math.sin(a),f=goog.math.Matrix.createIdentityMatrix(4);f.setValueAt(0,0,d+c.x*c.x*(1-d));f.setValueAt(0,1,c.x*c.y*(1-d)-c.z*e);f.setValueAt(0,2,c.x*c.z*(1-
d)+c.y*e);f.setValueAt(1,0,c.y*c.x*(1-d)+c.z*e);f.setValueAt(1,1,d+c.y*c.y*(1-d));f.setValueAt(1,2,c.y*c.z*(1-d)-c.x*e);f.setValueAt(2,0,c.z*c.x*(1-d)-c.y*e);f.setValueAt(2,1,c.z*c.y*(1-d)+c.x*e);f.setValueAt(2,2,d+c.z*c.z*(1-d));return new X.matrix(this.multiply(f))};
X.matrix.prototype.multiplyByVector=function(a){var b=this.getSize(),c=Array(b.width),d;for(d=0;d<c.length;d++)c[d]=Array(1),c[d][0]=1;if(a instanceof goog.math.Vec2&&2<=b.width)c[0][0]=a.x,c[1][0]=a.y;else if(a instanceof goog.math.Vec3&&3<=b.width)c[0][0]=a.x,c[1][0]=a.y,c[2][0]=a.z;else throw new X.exception("Multiplication by vector failed!");a=this.multiply(new goog.math.Matrix(c));return 3<=a.getSize().height?new goog.math.Vec3(parseFloat(a.getValueAt(0,0)),parseFloat(a.getValueAt(1,0)),parseFloat(a.getValueAt(2,
0))):new goog.math.Vec2(parseFloat(a.getValueAt(0,0)),parseFloat(a.getValueAt(1,0)))};goog.exportSymbol("X.matrix",X.matrix);goog.exportSymbol("X.matrix.createIdentityMatrix",X.matrix.createIdentityMatrix);goog.exportSymbol("X.matrix.prototype.flatten",X.matrix.prototype.flatten);goog.exportSymbol("X.matrix.prototype.translate",X.matrix.prototype.translate);goog.exportSymbol("X.matrix.prototype.rotate",X.matrix.prototype.rotate);goog.exportSymbol("X.matrix.prototype.multiplyByVector",X.matrix.prototype.multiplyByVector);X.transform=function(){X.base.call(this);this._className="transform";this._matrix=X.matrix.createIdentityMatrix(4);this._glMatrix=new Float32Array(this._matrix.flatten())};goog.inherits(X.transform,X.base);X.transform.prototype.rotateX=function(a){if(!goog.isNumber(a)||-360>a||360<a)throw new X.exception("Invalid angle!");this._matrix=this._matrix.rotate(a*Math.PI/180,new goog.math.Vec3(0,1,0));this._glMatrix=new Float32Array(this._matrix.flatten());this._dirty=!0};
X.transform.prototype.rotateY=function(a){if(!goog.isNumber(a)||-360>a||360<a)throw new X.exception("Invalid angle!");this._matrix=this._matrix.rotate(a*Math.PI/180,new goog.math.Vec3(1,0,0));this._glMatrix=new Float32Array(this._matrix.flatten());this._dirty=!0};
X.transform.prototype.rotateZ=function(a){if(!goog.isNumber(a)||-360>a||360<a)throw new X.exception("Invalid angle!");this._matrix=this._matrix.rotate(a*Math.PI/180,new goog.math.Vec3(0,0,1));this._glMatrix=new Float32Array(this._matrix.flatten());this._dirty=!0};
X.transform.prototype.translateX=function(a){if(!goog.isNumber(a))throw new X.exception("Invalid distance!");this._matrix=this._matrix.translate(new goog.math.Vec3(a,0,0));this._glMatrix=new Float32Array(this._matrix.flatten());this._dirty=!0};X.transform.prototype.translateY=function(a){if(!goog.isNumber(a))throw new X.exception("Invalid distance!");this._matrix=this._matrix.translate(new goog.math.Vec3(0,a,0));this._glMatrix=new Float32Array(this._matrix.flatten());this._dirty=!0};
X.transform.prototype.translateZ=function(a){if(!goog.isNumber(a))throw new X.exception("Invalid distance!");this._matrix=this._matrix.translate(new goog.math.Vec3(0,0,a));this._glMatrix=new Float32Array(this._matrix.flatten());this._dirty=!0};X.transform.prototype.matrix=function(){return this._matrix};X.transform.prototype.glMatrix=function(){return this._glMatrix};goog.exportSymbol("X.transform",X.transform);goog.exportSymbol("X.transform.prototype.rotateX",X.transform.prototype.rotateX);
goog.exportSymbol("X.transform.prototype.rotateY",X.transform.prototype.rotateY);goog.exportSymbol("X.transform.prototype.rotateZ",X.transform.prototype.rotateZ);goog.exportSymbol("X.transform.prototype.translateX",X.transform.prototype.translateX);goog.exportSymbol("X.transform.prototype.translateY",X.transform.prototype.translateY);goog.exportSymbol("X.transform.prototype.translateZ",X.transform.prototype.translateZ);goog.exportSymbol("X.transform.prototype.matrix",X.transform.prototype.matrix);X.file=function(){X.base.call(this);this._className="file";this._path=null};goog.inherits(X.file,X.base);X.file.prototype.path=function(){return this._path};X.file.prototype.setPath=function(a){this._path=a;this._dirty=!0};goog.exportSymbol("X.file",X.file);goog.exportSymbol("X.file.prototype.path",X.file.prototype.path);goog.exportSymbol("X.file.prototype.setPath",X.file.prototype.setPath);X.texture=function(a){if(!goog.isDefAndNotNull(a))throw new X.exception("Missing image file for the texture.");X.base.call(this);this._className="texture";this._file=a;this._filter=X.texture.filters.SHARP;this._image=null;this._dirty=!0};goog.inherits(X.texture,X.base);X.texture.filters={SHARP:"SHARP",SMOOTH:"SMOOTH"};X.texture.prototype.file=function(){return this._file};X.texture.prototype.image=function(){return this._image};X.texture.prototype.setImage=function(a){this._image=a};
goog.exportSymbol("X.texture",X.texture);goog.exportSymbol("X.texture.filters",X.texture.filters);goog.exportSymbol("X.texture.prototype.file",X.texture.prototype.file);X.object=function(){X.base.call(this);this._className="object";this._id=X.uniqueId();this._type=X.object.types.TRIANGLES;this._transform=new X.transform;this._color=[1,1,1];this._points=new X.triplets;this._normals=new X.triplets;this._colors=new X.triplets;this._file=this._textureCoordinateMap=this._texture=null;this._opacity=1;this._children=null;this._visible=!0;this._lineWidth=1;this._caption=null;this._magicMode=!1};goog.inherits(X.object,X.base);
X.object.types={TRIANGLES:"TRIANGLES",TRIANGLE_STRIPS:"TRIANGLE_STRIPS",LINES:"LINES",POLYGONS:"POLYGONS"};X.object.prototype.id=function(){return this._id};
X.object.prototype.toCSG=function(){for(var a=this._points.count(),b=[],c=0,c=0;c<a;c+=3){var d=this._points.get(c),e=this._points.get(c+1),f=this._points.get(c+2),g=this._normals.get(c),h=this._normals.get(c+1),i=this._normals.get(c+2),j=this._color;0<this._colors.length()&&(j=this._colors.get(c));var k=[];k.push(new CSG.Vertex(d,g));k.push(new CSG.Vertex(e,h));k.push(new CSG.Vertex(f,i));b.push(new CSG.Polygon(k,j))}return CSG.fromPolygons(b)};
X.object.prototype.fromCSG=function(a){if(!goog.isDefAndNotNull(a)||!(a instanceof CSG))throw new X.exception("Invalid CSG object.");this._points.clear();this._normals.clear();this._colors.clear();var b=new X.indexer,c=[];a.toPolygons().map(function(a){for(var e=a.vertices.map(function(c){c.color=a.shared;return b.add(c)}),f=2,f=2;f<e.length;f++)c.push([e[0],e[f-1],e[f]])}.bind(this));this.__vertices=b.unique().map(function(a){return[a.pos.x,a.pos.y,a.pos.z]});this.__normals=b.unique().map(function(a){return[a.normal.x,
a.normal.y,a.normal.z]});this.__colors=b.unique().map(function(a){return!a.color?null:[a.color[0],a.color[1],a.color[2]]});c.map(function(a){var b=a[0],c=a[1],a=a[2],g=this.__vertices,h=this.__normals,i=this.__colors;this._points.add(g[b][0],g[b][1],g[b][2]);this._points.add(g[c][0],g[c][1],g[c][2]);this._points.add(g[a][0],g[a][1],g[a][2]);this._normals.add(h[b][0],h[b][1],h[b][2]);this._normals.add(h[c][0],h[c][1],h[c][2]);this._normals.add(h[a][0],h[a][1],h[a][2]);i[b]&&this._colors.add(i[b][0],
i[b][1],i[b][2]);i[c]&&this._colors.add(i[c][0],i[c][1],i[c][2]);i[a]&&this._colors.add(i[a][0],i[a][1],i[a][2])}.bind(this));this.setType(X.object.types.TRIANGLES)};X.object.prototype.type=function(){return this._type};X.object.prototype.setType=function(a){this._type=a};X.object.prototype.transform=function(){return this._transform};X.object.prototype.points=function(){return this._points};X.object.prototype.normals=function(){return this._normals};X.object.prototype.colors=function(){return this._colors};
X.object.prototype.color=function(){return this._color};X.object.prototype.texture=function(){return this._texture};X.object.prototype.setTexture=function(a){if(goog.isDefAndNotNull(a)){goog.isString(a)&&(a=new X.texture(a));if(!(a instanceof X.texture))throw new X.exception("Invalid texture.");this._texture=a}else this._texture=null};X.object.prototype.textureCoordinateMap=function(){return this._textureCoordinateMap};
X.object.prototype.setColor=function(a,b,c){if(!goog.isNumber(a)&&0>a&&1<a||!goog.isNumber(b)&&0>b&&1<b||!goog.isNumber(c)&&0>c&&1<c)throw new X.exception("Invalid color.");if(this.hasChildren())for(var d=this.children(),e=d.length,f=0,f=0;f<e;f++)d[f].setColor(a,b,c);this._color[0]=a;this._color[1]=b;this._color[2]=c;this._dirty=!0};
X.object.prototype.union=function(a){if(!goog.isDefAndNotNull(a)||!(a instanceof CSG)&&!(a instanceof X.object))throw new X.exception("Invalid object.");var b=a;a instanceof X.object&&(b=b.toCSG());a=new X.object;a.fromCSG(this.toCSG().union(b));return a};
X.object.prototype.subtract=function(a){if(!goog.isDefAndNotNull(a)||!(a instanceof CSG)&&!(a instanceof X.object))throw new X.exception("Invalid object.");var b=a;a instanceof X.object&&(b=b.toCSG());a=new X.object;a.fromCSG(this.toCSG().subtract(b));return a};
X.object.prototype.intersect=function(a){if(!goog.isDefAndNotNull(a)||!(a instanceof CSG)&&!(a instanceof X.object))throw new X.exception("Invalid object.");var b=a;a instanceof X.object&&(b=b.toCSG());a=new X.object;a.fromCSG(this.toCSG().intersect(b));return a};
X.object.prototype.inverse=function(a){if(!goog.isDefAndNotNull(a)||!(a instanceof CSG)&&!(a instanceof X.object))throw new X.exception("Invalid object.");var b=a;a instanceof X.object&&(b=b.toCSG());a=new X.object;a.fromCSG(this.toCSG().inverse(b));return a};X.object.prototype.opacity=function(){return this._opacity};X.object.prototype.caption=function(){return this._caption};X.object.prototype.setCaption=function(a){this._caption=a;this._dirty=!0};
X.object.prototype.setVisible=function(a){if(this.hasChildren())for(var b=this.children(),c=b.length,d=0,d=0;d<c;d++)b[d].setVisible(a);this._visible=a;this._dirty=!0};X.object.prototype.visible=function(){return this._visible};X.object.prototype.setOpacity=function(a){if(!goog.isNumber(a)||1<a||0>a)throw new X.exception("Invalid opacity.");this._opacity=a;this._dirty=!0};
X.object.prototype.load=function(a){if(goog.isDefAndNotNull(a)){if(!this._file)this._file=new X.file;this._file.setPath(a)}else this._file=null};X.object.prototype.file=function(){return this._file};X.object.prototype.modified=function(){var a=new X.event.ModifiedEvent;a._object=this;this.dispatchEvent(a)};X.object.prototype.children=function(){if(!this._children)this._children=[];return this._children};X.object.prototype.hasChildren=function(){return!this._children?!1:0<this._children.length};
X.object.prototype.setLineWidth=function(a){if(!goog.isNumber(a))throw new X.exception("Invalid line width!");this._lineWidth=a;this._dirty=!0};X.object.prototype.lineWidth=function(){return this._lineWidth};X.object.prototype.magicMode=function(){return this._magicMode};X.object.prototype.setMagicMode=function(a){if(!goog.isBoolean(a))throw new X.exception("Invalid magicMode setting.");this._magicMode=a};goog.exportSymbol("X.object",X.object);goog.exportSymbol("X.object.prototype.id",X.object.prototype.id);
goog.exportSymbol("X.object.prototype.type",X.object.prototype.type);goog.exportSymbol("X.object.prototype.transform",X.object.prototype.transform);goog.exportSymbol("X.object.prototype.points",X.object.prototype.points);goog.exportSymbol("X.object.prototype.normals",X.object.prototype.normals);goog.exportSymbol("X.object.prototype.texture",X.object.prototype.texture);goog.exportSymbol("X.object.prototype.setTexture",X.object.prototype.setTexture);goog.exportSymbol("X.object.prototype.colors",X.object.prototype.colors);
goog.exportSymbol("X.object.prototype.color",X.object.prototype.color);goog.exportSymbol("X.object.prototype.setColor",X.object.prototype.setColor);goog.exportSymbol("X.object.prototype.opacity",X.object.prototype.opacity);goog.exportSymbol("X.object.prototype.setOpacity",X.object.prototype.setOpacity);goog.exportSymbol("X.object.prototype.load",X.object.prototype.load);goog.exportSymbol("X.object.prototype.file",X.object.prototype.file);X.parserVTK=function(){X.parser.call(this);this._className="parserVTK"};goog.inherits(X.parserVTK,X.parser);
X.parserVTK.prototype.parse=function(a,b){var c=a.points(),d=a.normals(),e=b.split("\n"),f=e.length,g=new X.triplets,h=new X.triplets;this._geometries=[];this._objectType=X.object.types.TRIANGLES;this._normalsMode=this._pointDataMode=this._geometryMode=this._pointsMode=!1;for(var i=0,j=f%8;j--;)this.parseLine(g,h,e[i]),i++;for(j=0.125*f^0;j--;)this.parseLine(g,h,e[i]),i++,this.parseLine(g,h,e[i]),i++,this.parseLine(g,h,e[i]),i++,this.parseLine(g,h,e[i]),i++,this.parseLine(g,h,e[i]),i++,this.parseLine(g,
h,e[i]),i++,this.parseLine(g,h,e[i]),i++,this.parseLine(g,h,e[i]),i++;this._objectType==X.object.types.TRIANGLES?this.configureTriangles(g,h,c,d):this._objectType==X.object.types.TRIANGLE_STRIPS?this.configureTriangleStrips(g,h,c,d):this._objectType==X.object.types.LINES?this.configureLines(g,h,c,d):this._objectType==X.object.types.POLYGONS&&this.configurePolygons(g,h,c,d);a.setType(this._objectType);c=new X.event.ModifiedEvent;c._object=a;this.dispatchEvent(c)};
X.parserVTK.prototype.parseLine=function(a,b,c){var c=c.replace(/^\s+|\s+$/g,""),c=c.split(" "),d=c.length,e=c[0];if("POINTS"==e)this._pointsMode=!0,this._pointDataMode=this._geometryMode=!1;else if("VERTICES"==e)this._geometryMode=!0,this._pointDataMode=this._pointsMode=!1,this._objectType=X.object.types.TRIANGLES,this._geometries=[];else if("TRIANGLE_STRIPS"==e)this._geometryMode=!0,this._pointDataMode=this._pointsMode=!1,this._objectType=X.object.types.TRIANGLE_STRIPS,this._geometries=[];else if("LINES"==
e)this._geometryMode=!0,this._pointDataMode=this._pointsMode=!1,this._objectType=X.object.types.LINES,this._geometries=[];else if("POLYGONS"==e)this._geometryMode=!0,this._pointDataMode=this._pointsMode=!1,this._objectType=X.object.types.POLYGONS,this._geometries=[];else if("POINT_DATA"==e)this._pointDataMode=!0,this._geometryMode=this._pointsMode=!1;else if(this._pointsMode)if(1==d||isNaN(parseFloat(e)))this._pointsMode=!1;else{if(3<=d){var e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]);
a.add(e,f,g)}6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.add(e,f,g));9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.add(d,e,c))}else if(this._geometryMode)1==d||isNaN(parseFloat(e))?this._geometryMode=!1:this._geometries.push(c.slice(1));else if(this._pointDataMode)"NORMALS"==e?this._normalsMode=!0:1==d||isNaN(parseFloat(e))?this._normalsMode=this._pointDataMode=!1:this._normalsMode&&(3<=d&&(e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]),b.add(e,
f,g)),6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),b.add(e,f,g)),9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),b.add(d,e,c)))};X.parserVTK.prototype.configureTriangles=function(a,b,c,d){var e=b.length(),f=this._geometries.length,g=f;do{var h=this._geometries[f-g],i=h.length,j;for(j=0;j<i;j++){var k=parseInt(h[j],10),l=a.get(k);c.add(l[0],l[1],l[2]);k<e?(k=b.get(k),d.add(k[0],k[1],k[2])):d.add(1,1,1)}g--}while(0<g)};
X.parserVTK.prototype.configureTriangleStrips=function(a,b,c,d){var e=b.length(),f=this._geometries.length,g=f;do{var h=this._geometries[f-g],i=h.length,j;for(j=0;j<i;j++){var k=parseInt(h[j],10),l=a.get(k);c.add(l[0],l[1],l[2]);(0==j||j==i-1)&&c.add(l[0],l[1],l[2]);k<e?(k=b.get(k),d.add(k[0],k[1],k[2]),(0==j||j==i-1)&&d.add(k[0],k[1],k[2])):(d.add(1,1,1),(0==j||j==i-1)&&d.add(1,1,1))}g--}while(0<g)};
X.parserVTK.prototype.configureLines=function(a,b,c,d){var e=b.length(),f=this._geometries.length,g=f;do{var h=this._geometries[f-g],i=h.length,j;for(j=0;j<i-1;j++){var k=parseInt(h[j],10),l=parseInt(h[j+1],10),m=a.get(k),n=a.get(l);c.add(m[0],m[1],m[2]);c.add(n[0],n[1],n[2]);k<e-1?(k=b.get(k),l=b.get(l),d.add(k[0],k[1],k[2]),d.add(l[0],l[1],l[2])):(d.add(1,1,1),d.add(1,1,1))}g--}while(0<g)};
X.parserVTK.prototype.configurePolygons=function(a,b,c,d){var e=b.length(),f=this._geometries.length,g=f;do{var h=this._geometries[f-g],i=h.length,j;for(j=0;j<i;j++){var k=parseInt(h[j],10),l=a.get(k);c.add(l[0],l[1],l[2]);k<e?(k=b.get(k),d.add(k[0],k[1],k[2])):d.add(1,1,1)}g--}while(0<g)};goog.exportSymbol("X.parserVTK",X.parserVTK);goog.exportSymbol("X.parserVTK.prototype.parse",X.parserVTK.prototype.parse);goog.exportSymbol("X.parserVTK.prototype.parseLine",X.parserVTK.prototype.parseLine);X.loader=function(){X.base.call(this);this._className="loader";this._jobs_=null;this._progress_=0};goog.inherits(X.loader,X.base);X.loader.prototype.jobs_=function(){if(!goog.isDefAndNotNull(this._jobs_))this._jobs_=new goog.structs.Map;return this._jobs_};X.loader.prototype.completed=function(){return!goog.isDefAndNotNull(this._jobs_)?!0:!this._jobs_.containsValue(!1)};
X.loader.prototype.loadTexture=function(a){if(!goog.isDefAndNotNull(a.texture()))throw new X.exception("Internal error during texture loading.");var b=new Image,c=a.texture().file();b.src=c;a.texture().setImage(b);goog.events.listenOnce(b,goog.events.EventType.LOAD,this.loadTextureCompleted.bind(this,a));this.jobs_().set(a.id(),!1);this.addProgress(0.3)};
X.loader.prototype.loadTextureCompleted=function(a){this.addProgress(1.7);setTimeout(function(){a.texture().setClean();a.modified();this.jobs_().set(a.id(),!0)}.bind(this),100)};
X.loader.prototype.loadFile=function(a){if(!goog.isDefAndNotNull(a.file()))throw new X.exception("Internal error during file loading.");a.points().clear();a.normals().clear();var b=a.file().path(),c=b.split(".").pop(),c=c.toUpperCase();if(!(c in X.parser.extensions))throw new X.exception("The "+c+" file format is not supported!");c=new XMLHttpRequest;goog.events.listen(c,"abort",this.loadFileFailed.bind(this,c,a));goog.events.listen(c,"error",this.loadFileFailed.bind(this,c,a));goog.events.listen(c,
"load",this.loadFileCompleted.bind(this,c,a));c.open("GET",b,!0);c.overrideMimeType("text/plain; charset=x-user-defined");c.setRequestHeader("Content-Type","text/plain");c.send(null);this.jobs_().set(a.id(),!1)};X.loader.prototype.addProgress=function(a){this._progress_+=a/this.jobs_().getCount()/3;if(1<this._progress_)this._progress_=1;a=new X.event.ProgressEvent;a._value=this._progress_;this.dispatchEvent(a)};X.loader.prototype.progress=function(){return this._progress_};
X.loader.prototype.loadFileFailed=function(){throw new X.exception("Could not get the file.");};
X.loader.prototype.loadFileCompleted=function(a,b){this.addProgress(1);setTimeout(function(){var c=b.file().path().split(".").pop();"stl"==c?(c=new X.parserSTL,goog.events.listenOnce(c,X.event.events.MODIFIED,this.parseFileCompleted.bind(this)),c.parse(b,a.response)):"vtk"==c?(c=new X.parserVTK,goog.events.listenOnce(c,X.event.events.MODIFIED,this.parseFileCompleted.bind(this)),c.parse(b,a.response)):"trk"==c&&(c=new X.parserTRK,goog.events.listenOnce(c,X.event.events.MODIFIED,this.parseFileCompleted.bind(this)),
c.parse(b,a.response))}.bind(this),100)};X.loader.prototype.parseFileCompleted=function(a){this.addProgress(1);setTimeout(function(){var b=a._object;b.file().setClean();b.modified();this.jobs_().set(b.id(),!0)}.bind(this),100)};goog.exportSymbol("X.loader",X.loader);X.shaders=function(){X.base.call(this);this._className="shader";this._vertexshaderSource="";var a;this._vertexshaderSource="precision mediump float;\n\nattribute vec3 vertexPosition;\nattribute vec3 vertexNormal;\nattribute vec3 vertexColor;\nattribute vec2 vertexTexturePos;\n\nuniform mat4 view;\nuniform mat4 perspective;\nuniform vec3 center;\nuniform mat4 objectTransform;\nuniform bool useObjectColor;\nuniform vec3 objectColor;\n\nvarying vec4 fVertexPosition;\nvarying vec3 fragmentColor;\nvarying vec2 fragmentTexturePos;\nvarying vec3 fTransformedVertexNormal;\n\nvoid main(void) {\n fTransformedVertexNormal = mat3(view[0].xyz,view[1].xyz,view[2].xyz) * mat3(objectTransform[0].xyz,objectTransform[1].xyz,objectTransform[2].xyz) * vertexNormal;\n vec3 vertexPosition2 = vertexPosition - center;\n fVertexPosition = view * objectTransform * vec4(vertexPosition2, 1.0);\n fragmentTexturePos = vertexTexturePos;\n if (useObjectColor) {\n fragmentColor = objectColor;\n } else {\n fragmentColor = vertexColor;\n }\n gl_Position = perspective * fVertexPosition;\n}\n";
this._fragmentshaderSource="";this._fragmentshaderSource="precision mediump float;\n\nuniform bool usePicking;\nuniform bool useTexture;\nuniform sampler2D textureSampler;\nuniform float objectOpacity;\n\nvarying vec4 fVertexPosition;\nvarying vec3 fragmentColor;\nvarying vec2 fragmentTexturePos;\nvarying vec3 fTransformedVertexNormal;\n\nvoid main(void) {\n if (usePicking) {\n gl_FragColor = vec4(fragmentColor, 1.0);\n } else if (useTexture) {\n gl_FragColor = texture2D(textureSampler, vec2(fragmentTexturePos.s,fragmentTexturePos.t));\n } else {\n vec3 nNormal = normalize(fTransformedVertexNormal);\n vec3 light = vec3(0.0, 0.0, 1.0);\n vec3 lightDirection = vec3(0,0,-10);\n lightDirection = normalize(lightDirection);\n vec3 eyeDirection = normalize(-fVertexPosition.xyz);\n vec3 reflectionDirection = reflect(-lightDirection, nNormal);\n float specular = pow(max(dot(reflectionDirection, eyeDirection), 0.0), 10.0);\n float diffuse = 0.8 * max(dot(nNormal, light), 0.0);\n float ambient = 0.3;\n gl_FragColor = vec4(fragmentColor * ambient +\n fragmentColor * diffuse +\n vec3(0.2, 0.2, 0.2) * specular,\n objectOpacity);\n }\n}\n"};
goog.inherits(X.shaders,X.base);X.shaders.attributes={VERTEXPOSITION:"vertexPosition",VERTEXNORMAL:"vertexNormal",VERTEXCOLOR:"vertexColor",VERTEXTEXTUREPOS:"vertexTexturePos"};X.shaders.uniforms={VIEW:"view",PERSPECTIVE:"perspective",CENTER:"center",OBJECTTRANSFORM:"objectTransform",USEOBJECTCOLOR:"useObjectColor",OBJECTCOLOR:"objectColor",OBJECTOPACITY:"objectOpacity",NORMAL:"normal",USEPICKING:"usePicking",USETEXTURE:"useTexture",TEXTURESAMPLER:"textureSampler"};X.shaders.prototype.vertex=function(){return this._vertexshaderSource};
X.shaders.prototype.fragment=function(){return this._fragmentshaderSource};
X.shaders.prototype.validate=function(){var a=Object.keys(X.shaders.attributes),b=Object.keys(X.shaders.uniforms);if(!a.every(function(a){a=eval("X.shaders.attributes."+a);return-1!=this._vertexshaderSource.search(a)||-1!=this._fragmentshaderSource.search(a)}.bind(this)))throw new X.exception("Could not find all attributes in the shader sources!");if(!b.every(function(a){a=eval("X.shaders.uniforms."+a);return-1!=this._vertexshaderSource.search(a)||-1!=this._fragmentshaderSource.search(a)}.bind(this)))throw new X.exception("Could not find all uniforms in the shader sources!");
return!0};goog.exportSymbol("X.shaders",X.shaders);goog.exportSymbol("X.shaders.attributes",X.shaders.attributes);goog.exportSymbol("X.shaders.uniforms",X.shaders.uniforms);goog.exportSymbol("X.shaders.prototype.vertex",X.shaders.prototype.vertex);goog.exportSymbol("X.shaders.prototype.fragment",X.shaders.prototype.fragment);goog.exportSymbol("X.shaders.prototype.validate",X.shaders.prototype.validate);goog.events.EventHandler=function(a){goog.Disposable.call(this);this.handler_=a;this.keys_=[]};goog.inherits(goog.events.EventHandler,goog.Disposable);goog.events.EventHandler.typeArray_=[];goog.events.EventHandler.prototype.listen=function(a,b,c,d,e){if(!goog.isArray(b))goog.events.EventHandler.typeArray_[0]=b,b=goog.events.EventHandler.typeArray_;for(var f=0;f<b.length;f++)this.keys_.push(goog.events.listen(a,b[f],c||this,d||!1,e||this.handler_||this));return this};
goog.events.EventHandler.prototype.listenOnce=function(a,b,c,d,e){if(goog.isArray(b))for(var f=0;f<b.length;f++)this.listenOnce(a,b[f],c,d,e);else this.keys_.push(goog.events.listenOnce(a,b,c||this,d,e||this.handler_||this));return this};goog.events.EventHandler.prototype.listenWithWrapper=function(a,b,c,d,e){b.listen(a,c,d,e||this.handler_,this);return this};goog.events.EventHandler.prototype.getListenerCount=function(){return this.keys_.length};
goog.events.EventHandler.prototype.unlisten=function(a,b,c,d,e){if(goog.isArray(b))for(var f=0;f<b.length;f++)this.unlisten(a,b[f],c,d,e);else if(a=goog.events.getListener(a,b,c||this,d,e||this.handler_||this))a=a.key,goog.events.unlistenByKey(a),goog.array.remove(this.keys_,a);return this};goog.events.EventHandler.prototype.unlistenWithWrapper=function(a,b,c,d,e){b.unlisten(a,c,d,e||this.handler_,this);return this};
goog.events.EventHandler.prototype.removeAll=function(){goog.array.forEach(this.keys_,goog.events.unlistenByKey);this.keys_.length=0};goog.events.EventHandler.prototype.disposeInternal=function(){goog.events.EventHandler.superClass_.disposeInternal.call(this);this.removeAll()};goog.events.EventHandler.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented");};goog.math.Box=function(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d};goog.math.Box.boundingBox=function(a){for(var b=new goog.math.Box(arguments[0].y,arguments[0].x,arguments[0].y,arguments[0].x),c=1;c<arguments.length;c++){var d=arguments[c];b.top=Math.min(b.top,d.y);b.right=Math.max(b.right,d.x);b.bottom=Math.max(b.bottom,d.y);b.left=Math.min(b.left,d.x)}return b};goog.math.Box.prototype.clone=function(){return new goog.math.Box(this.top,this.right,this.bottom,this.left)};
if(goog.DEBUG)goog.math.Box.prototype.toString=function(){return"("+this.top+"t, "+this.right+"r, "+this.bottom+"b, "+this.left+"l)"};goog.math.Box.prototype.contains=function(a){return goog.math.Box.contains(this,a)};goog.math.Box.prototype.expand=function(a,b,c,d){goog.isObject(a)?(this.top-=a.top,this.right+=a.right,this.bottom+=a.bottom,this.left-=a.left):(this.top-=a,this.right+=b,this.bottom+=c,this.left-=d);return this};
goog.math.Box.prototype.expandToInclude=function(a){this.left=Math.min(this.left,a.left);this.top=Math.min(this.top,a.top);this.right=Math.max(this.right,a.right);this.bottom=Math.max(this.bottom,a.bottom)};goog.math.Box.equals=function(a,b){return a==b?!0:!a||!b?!1:a.top==b.top&&a.right==b.right&&a.bottom==b.bottom&&a.left==b.left};
goog.math.Box.contains=function(a,b){return!a||!b?!1:b instanceof goog.math.Box?b.left>=a.left&&b.right<=a.right&&b.top>=a.top&&b.bottom<=a.bottom:b.x>=a.left&&b.x<=a.right&&b.y>=a.top&&b.y<=a.bottom};goog.math.Box.distance=function(a,b){return b.x>=a.left&&b.x<=a.right?b.y>=a.top&&b.y<=a.bottom?0:b.y<a.top?a.top-b.y:b.y-a.bottom:b.y>=a.top&&b.y<=a.bottom?b.x<a.left?a.left-b.x:b.x-a.right:goog.math.Coordinate.distance(b,new goog.math.Coordinate(b.x<a.left?a.left:a.right,b.y<a.top?a.top:a.bottom))};
goog.math.Box.intersects=function(a,b){return a.left<=b.right&&b.left<=a.right&&a.top<=b.bottom&&b.top<=a.bottom};goog.math.Box.intersectsWithPadding=function(a,b,c){return a.left<=b.right+c&&b.left<=a.right+c&&a.top<=b.bottom+c&&b.top<=a.bottom+c};goog.math.Rect=function(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d};goog.math.Rect.prototype.clone=function(){return new goog.math.Rect(this.left,this.top,this.width,this.height)};goog.math.Rect.prototype.toBox=function(){return new goog.math.Box(this.top,this.left+this.width,this.top+this.height,this.left)};goog.math.Rect.createFromBox=function(a){return new goog.math.Rect(a.left,a.top,a.right-a.left,a.bottom-a.top)};
if(goog.DEBUG)goog.math.Rect.prototype.toString=function(){return"("+this.left+", "+this.top+" - "+this.width+"w x "+this.height+"h)"};goog.math.Rect.equals=function(a,b){return a==b?!0:!a||!b?!1:a.left==b.left&&a.width==b.width&&a.top==b.top&&a.height==b.height};
goog.math.Rect.prototype.intersection=function(a){var b=Math.max(this.left,a.left),c=Math.min(this.left+this.width,a.left+a.width);if(b<=c){var d=Math.max(this.top,a.top),a=Math.min(this.top+this.height,a.top+a.height);if(d<=a)return this.left=b,this.top=d,this.width=c-b,this.height=a-d,!0}return!1};
goog.math.Rect.intersection=function(a,b){var c=Math.max(a.left,b.left),d=Math.min(a.left+a.width,b.left+b.width);if(c<=d){var e=Math.max(a.top,b.top),f=Math.min(a.top+a.height,b.top+b.height);if(e<=f)return new goog.math.Rect(c,e,d-c,f-e)}return null};goog.math.Rect.intersects=function(a,b){return a.left<=b.left+b.width&&b.left<=a.left+a.width&&a.top<=b.top+b.height&&b.top<=a.top+a.height};goog.math.Rect.prototype.intersects=function(a){return goog.math.Rect.intersects(this,a)};
goog.math.Rect.difference=function(a,b){var c=goog.math.Rect.intersection(a,b);if(!c||!c.height||!c.width)return[a.clone()];var c=[],d=a.top,e=a.height,f=a.left+a.width,g=a.top+a.height,h=b.left+b.width,i=b.top+b.height;if(b.top>a.top)c.push(new goog.math.Rect(a.left,a.top,a.width,b.top-a.top)),d=b.top,e-=b.top-a.top;i<g&&(c.push(new goog.math.Rect(a.left,i,a.width,g-i)),e=i-d);b.left>a.left&&c.push(new goog.math.Rect(a.left,d,b.left-a.left,e));h<f&&c.push(new goog.math.Rect(h,d,f-h,e));return c};
goog.math.Rect.prototype.difference=function(a){return goog.math.Rect.difference(this,a)};goog.math.Rect.prototype.boundingRect=function(a){var b=Math.max(this.left+this.width,a.left+a.width),c=Math.max(this.top+this.height,a.top+a.height);this.left=Math.min(this.left,a.left);this.top=Math.min(this.top,a.top);this.width=b-this.left;this.height=c-this.top};goog.math.Rect.boundingRect=function(a,b){if(!a||!b)return null;var c=a.clone();c.boundingRect(b);return c};
goog.math.Rect.prototype.contains=function(a){return a instanceof goog.math.Rect?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};goog.math.Rect.prototype.getSize=function(){return new goog.math.Size(this.width,this.height)};goog.dom={};goog.dom.classes={};goog.dom.classes.set=function(a,b){a.className=b};goog.dom.classes.get=function(a){return(a=a.className)&&"function"==typeof a.split?a.split(/\s+/):[]};goog.dom.classes.add=function(a,b){var c=goog.dom.classes.get(a),d=goog.array.slice(arguments,1),d=goog.dom.classes.add_(c,d);a.className=c.join(" ");return d};goog.dom.classes.remove=function(a,b){var c=goog.dom.classes.get(a),d=goog.array.slice(arguments,1),d=goog.dom.classes.remove_(c,d);a.className=c.join(" ");return d};
goog.dom.classes.add_=function(a,b){for(var c=0,d=0;d<b.length;d++)goog.array.contains(a,b[d])||(a.push(b[d]),c++);return c==b.length};goog.dom.classes.remove_=function(a,b){for(var c=0,d=0;d<a.length;d++)goog.array.contains(b,a[d])&&(goog.array.splice(a,d--,1),c++);return c==b.length};goog.dom.classes.swap=function(a,b,c){for(var d=goog.dom.classes.get(a),e=!1,f=0;f<d.length;f++)d[f]==b&&(goog.array.splice(d,f--,1),e=!0);if(e)d.push(c),a.className=d.join(" ");return e};
goog.dom.classes.addRemove=function(a,b,c){var d=goog.dom.classes.get(a);goog.isString(b)?goog.array.remove(d,b):goog.isArray(b)&&goog.dom.classes.remove_(d,b);goog.isString(c)&&!goog.array.contains(d,c)?d.push(c):goog.isArray(c)&&goog.dom.classes.add_(d,c);a.className=d.join(" ")};goog.dom.classes.has=function(a,b){return goog.array.contains(goog.dom.classes.get(a),b)};goog.dom.classes.enable=function(a,b,c){c?goog.dom.classes.add(a,b):goog.dom.classes.remove(a,b)};
goog.dom.classes.toggle=function(a,b){var c=!goog.dom.classes.has(a,b);goog.dom.classes.enable(a,b,c);return c};goog.dom.TagName={A:"A",ABBR:"ABBR",ACRONYM:"ACRONYM",ADDRESS:"ADDRESS",APPLET:"APPLET",AREA:"AREA",B:"B",BASE:"BASE",BASEFONT:"BASEFONT",BDO:"BDO",BIG:"BIG",BLOCKQUOTE:"BLOCKQUOTE",BODY:"BODY",BR:"BR",BUTTON:"BUTTON",CANVAS:"CANVAS",CAPTION:"CAPTION",CENTER:"CENTER",CITE:"CITE",CODE:"CODE",COL:"COL",COLGROUP:"COLGROUP",DD:"DD",DEL:"DEL",DFN:"DFN",DIR:"DIR",DIV:"DIV",DL:"DL",DT:"DT",EM:"EM",FIELDSET:"FIELDSET",FONT:"FONT",FORM:"FORM",FRAME:"FRAME",FRAMESET:"FRAMESET",H1:"H1",H2:"H2",H3:"H3",H4:"H4",
H5:"H5",H6:"H6",HEAD:"HEAD",HR:"HR",HTML:"HTML",I:"I",IFRAME:"IFRAME",IMG:"IMG",INPUT:"INPUT",INS:"INS",ISINDEX:"ISINDEX",KBD:"KBD",LABEL:"LABEL",LEGEND:"LEGEND",LI:"LI",LINK:"LINK",MAP:"MAP",MENU:"MENU",META:"META",NOFRAMES:"NOFRAMES",NOSCRIPT:"NOSCRIPT",OBJECT:"OBJECT",OL:"OL",OPTGROUP:"OPTGROUP",OPTION:"OPTION",P:"P",PARAM:"PARAM",PRE:"PRE",Q:"Q",S:"S",SAMP:"SAMP",SCRIPT:"SCRIPT",SELECT:"SELECT",SMALL:"SMALL",SPAN:"SPAN",STRIKE:"STRIKE",STRONG:"STRONG",STYLE:"STYLE",SUB:"SUB",SUP:"SUP",TABLE:"TABLE",
TBODY:"TBODY",TD:"TD",TEXTAREA:"TEXTAREA",TFOOT:"TFOOT",TH:"TH",THEAD:"THEAD",TITLE:"TITLE",TR:"TR",TT:"TT",U:"U",UL:"UL",VAR:"VAR"};goog.dom.BrowserFeature={CAN_ADD_NAME_OR_TYPE_ATTRIBUTES:!goog.userAgent.IE||goog.userAgent.isDocumentMode(9),CAN_USE_CHILDREN_ATTRIBUTE:!goog.userAgent.GECKO&&!goog.userAgent.IE||goog.userAgent.IE&&goog.userAgent.isDocumentMode(9)||goog.userAgent.GECKO&&goog.userAgent.isVersion("1.9.1"),CAN_USE_INNER_TEXT:goog.userAgent.IE&&!goog.userAgent.isVersion("9"),CAN_USE_PARENT_ELEMENT_PROPERTY:goog.userAgent.IE||goog.userAgent.OPERA||goog.userAgent.WEBKIT,INNER_HTML_NEEDS_SCOPED_ELEMENT:goog.userAgent.IE};goog.dom.ASSUME_QUIRKS_MODE=!1;goog.dom.ASSUME_STANDARDS_MODE=!1;goog.dom.COMPAT_MODE_KNOWN_=goog.dom.ASSUME_QUIRKS_MODE||goog.dom.ASSUME_STANDARDS_MODE;goog.dom.NodeType={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12};goog.dom.getDomHelper=function(a){return a?new goog.dom.DomHelper(goog.dom.getOwnerDocument(a)):goog.dom.defaultDomHelper_||(goog.dom.defaultDomHelper_=new goog.dom.DomHelper)};
goog.dom.getDocument=function(){return document};goog.dom.getElement=function(a){return goog.isString(a)?document.getElementById(a):a};goog.dom.$=goog.dom.getElement;goog.dom.getElementsByTagNameAndClass=function(a,b,c){return goog.dom.getElementsByTagNameAndClass_(document,a,b,c)};
goog.dom.getElementsByClass=function(a,b){var c=b||document;return goog.dom.canUseQuerySelector_(c)?c.querySelectorAll("."+a):c.getElementsByClassName?c.getElementsByClassName(a):goog.dom.getElementsByTagNameAndClass_(document,"*",a,b)};goog.dom.getElementByClass=function(a,b){var c=b||document,d=null;return(d=goog.dom.canUseQuerySelector_(c)?c.querySelector("."+a):goog.dom.getElementsByClass(a,b)[0])||null};
goog.dom.canUseQuerySelector_=function(a){return a.querySelectorAll&&a.querySelector&&(!goog.userAgent.WEBKIT||goog.dom.isCss1CompatMode_(document)||goog.userAgent.isVersion("528"))};
goog.dom.getElementsByTagNameAndClass_=function(a,b,c,d){a=d||a;b=b&&"*"!=b?b.toUpperCase():"";if(goog.dom.canUseQuerySelector_(a)&&(b||c))return a.querySelectorAll(b+(c?"."+c:""));if(c&&a.getElementsByClassName){a=a.getElementsByClassName(c);if(b){for(var d={},e=0,f=0,g;g=a[f];f++)b==g.nodeName&&(d[e++]=g);d.length=e;return d}return a}a=a.getElementsByTagName(b||"*");if(c){d={};for(f=e=0;g=a[f];f++)b=g.className,"function"==typeof b.split&&goog.array.contains(b.split(/\s+/),c)&&(d[e++]=g);d.length=
e;return d}return a};goog.dom.$$=goog.dom.getElementsByTagNameAndClass;goog.dom.setProperties=function(a,b){goog.object.forEach(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in goog.dom.DIRECT_ATTRIBUTE_MAP_?a.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[d],b):goog.string.startsWith(d,"aria-")?a.setAttribute(d,b):a[d]=b})};
goog.dom.DIRECT_ATTRIBUTE_MAP_={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"};goog.dom.getViewportSize=function(a){return goog.dom.getViewportSize_(a||window)};
goog.dom.getViewportSize_=function(a){var b=a.document;if(goog.userAgent.WEBKIT&&!goog.userAgent.isVersion("500")&&!goog.userAgent.MOBILE){"undefined"==typeof a.innerHeight&&(a=window);var b=a.innerHeight,c=a.document.documentElement.scrollHeight;a==a.top&&c<b&&(b-=15);return new goog.math.Size(a.innerWidth,b)}a=goog.dom.isCss1CompatMode_(b)?b.documentElement:b.body;return new goog.math.Size(a.clientWidth,a.clientHeight)};goog.dom.getDocumentHeight=function(){return goog.dom.getDocumentHeight_(window)};
goog.dom.getDocumentHeight_=function(a){var b=a.document,c=0;if(b){var a=goog.dom.getViewportSize_(a).height,c=b.body,d=b.documentElement;if(goog.dom.isCss1CompatMode_(b)&&d.scrollHeight)c=d.scrollHeight!=a?d.scrollHeight:d.offsetHeight;else{var b=d.scrollHeight,e=d.offsetHeight;if(d.clientHeight!=e)b=c.scrollHeight,e=c.offsetHeight;c=b>a?b>e?b:e:b<e?b:e}}return c};goog.dom.getPageScroll=function(a){return goog.dom.getDomHelper((a||goog.global||window).document).getDocumentScroll()};
goog.dom.getDocumentScroll=function(){return goog.dom.getDocumentScroll_(document)};goog.dom.getDocumentScroll_=function(a){var b=goog.dom.getDocumentScrollElement_(a),a=goog.dom.getWindow_(a);return new goog.math.Coordinate(a.pageXOffset||b.scrollLeft,a.pageYOffset||b.scrollTop)};goog.dom.getDocumentScrollElement=function(){return goog.dom.getDocumentScrollElement_(document)};
goog.dom.getDocumentScrollElement_=function(a){return!goog.userAgent.WEBKIT&&goog.dom.isCss1CompatMode_(a)?a.documentElement:a.body};goog.dom.getWindow=function(a){return a?goog.dom.getWindow_(a):window};goog.dom.getWindow_=function(a){return a.parentWindow||a.defaultView};goog.dom.createDom=function(a,b,c){return goog.dom.createDom_(document,arguments)};
goog.dom.createDom_=function(a,b){var c=b[0],d=b[1];if(!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES&&d&&(d.name||d.type)){c=["<",c];d.name&&c.push(' name="',goog.string.htmlEscape(d.name),'"');if(d.type){c.push(' type="',goog.string.htmlEscape(d.type),'"');var e={};goog.object.extend(e,d);d=e;delete d.type}c.push(">");c=c.join("")}c=a.createElement(c);if(d)goog.isString(d)?c.className=d:goog.isArray(d)?goog.dom.classes.add.apply(null,[c].concat(d)):goog.dom.setProperties(c,d);2<b.length&&
goog.dom.append_(a,c,b,2);return c};goog.dom.append_=function(a,b,c,d){function e(c){c&&b.appendChild(goog.isString(c)?a.createTextNode(c):c)}for(;d<c.length;d++){var f=c[d];goog.isArrayLike(f)&&!goog.dom.isNodeLike(f)?goog.array.forEach(goog.dom.isNodeList(f)?goog.array.clone(f):f,e):e(f)}};goog.dom.$dom=goog.dom.createDom;goog.dom.createElement=function(a){return document.createElement(a)};goog.dom.createTextNode=function(a){return document.createTextNode(a)};
goog.dom.createTable=function(a,b,c){return goog.dom.createTable_(document,a,b,!!c)};goog.dom.createTable_=function(a,b,c,d){for(var e=["<tr>"],f=0;f<c;f++)e.push(d?"<td> </td>":"<td></td>");e.push("</tr>");e=e.join("");c=["<table>"];for(f=0;f<b;f++)c.push(e);c.push("</table>");a=a.createElement(goog.dom.TagName.DIV);a.innerHTML=c.join("");return a.removeChild(a.firstChild)};goog.dom.htmlToDocumentFragment=function(a){return goog.dom.htmlToDocumentFragment_(document,a)};
goog.dom.htmlToDocumentFragment_=function(a,b){var c=a.createElement("div");goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT?(c.innerHTML="<br>"+b,c.removeChild(c.firstChild)):c.innerHTML=b;if(1==c.childNodes.length)return c.removeChild(c.firstChild);for(var d=a.createDocumentFragment();c.firstChild;)d.appendChild(c.firstChild);return d};goog.dom.getCompatMode=function(){return goog.dom.isCss1CompatMode()?"CSS1Compat":"BackCompat"};goog.dom.isCss1CompatMode=function(){return goog.dom.isCss1CompatMode_(document)};
goog.dom.isCss1CompatMode_=function(a){return goog.dom.COMPAT_MODE_KNOWN_?goog.dom.ASSUME_STANDARDS_MODE:"CSS1Compat"==a.compatMode};goog.dom.canHaveChildren=function(a){if(a.nodeType!=goog.dom.NodeType.ELEMENT)return!1;switch(a.tagName){case goog.dom.TagName.APPLET:case goog.dom.TagName.AREA:case goog.dom.TagName.BASE:case goog.dom.TagName.BR:case goog.dom.TagName.COL:case goog.dom.TagName.FRAME:case goog.dom.TagName.HR:case goog.dom.TagName.IMG:case goog.dom.TagName.INPUT:case goog.dom.TagName.IFRAME:case goog.dom.TagName.ISINDEX:case goog.dom.TagName.LINK:case goog.dom.TagName.NOFRAMES:case goog.dom.TagName.NOSCRIPT:case goog.dom.TagName.META:case goog.dom.TagName.OBJECT:case goog.dom.TagName.PARAM:case goog.dom.TagName.SCRIPT:case goog.dom.TagName.STYLE:return!1}return!0};
goog.dom.appendChild=function(a,b){a.appendChild(b)};goog.dom.append=function(a,b){goog.dom.append_(goog.dom.getOwnerDocument(a),a,arguments,1)};goog.dom.removeChildren=function(a){for(var b;b=a.firstChild;)a.removeChild(b)};goog.dom.insertSiblingBefore=function(a,b){b.parentNode&&b.parentNode.insertBefore(a,b)};goog.dom.insertSiblingAfter=function(a,b){b.parentNode&&b.parentNode.insertBefore(a,b.nextSibling)};goog.dom.insertChildAt=function(a,b,c){a.insertBefore(b,a.childNodes[c]||null)};
goog.dom.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};goog.dom.replaceNode=function(a,b){var c=b.parentNode;c&&c.replaceChild(a,b)};goog.dom.flattenElement=function(a){var b,c=a.parentNode;if(c&&c.nodeType!=goog.dom.NodeType.DOCUMENT_FRAGMENT){if(a.removeNode)return a.removeNode(!1);for(;b=a.firstChild;)c.insertBefore(b,a);return goog.dom.removeNode(a)}};
goog.dom.getChildren=function(a){return goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE&&void 0!=a.children?a.children:goog.array.filter(a.childNodes,function(a){return a.nodeType==goog.dom.NodeType.ELEMENT})};goog.dom.getFirstElementChild=function(a){return void 0!=a.firstElementChild?a.firstElementChild:goog.dom.getNextElementNode_(a.firstChild,!0)};goog.dom.getLastElementChild=function(a){return void 0!=a.lastElementChild?a.lastElementChild:goog.dom.getNextElementNode_(a.lastChild,!1)};
goog.dom.getNextElementSibling=function(a){return void 0!=a.nextElementSibling?a.nextElementSibling:goog.dom.getNextElementNode_(a.nextSibling,!0)};goog.dom.getPreviousElementSibling=function(a){return void 0!=a.previousElementSibling?a.previousElementSibling:goog.dom.getNextElementNode_(a.previousSibling,!1)};goog.dom.getNextElementNode_=function(a,b){for(;a&&a.nodeType!=goog.dom.NodeType.ELEMENT;)a=b?a.nextSibling:a.previousSibling;return a};
goog.dom.getNextNode=function(a){if(!a)return null;if(a.firstChild)return a.firstChild;for(;a&&!a.nextSibling;)a=a.parentNode;return a?a.nextSibling:null};goog.dom.getPreviousNode=function(a){if(!a)return null;if(!a.previousSibling)return a.parentNode;for(a=a.previousSibling;a&&a.lastChild;)a=a.lastChild;return a};goog.dom.isNodeLike=function(a){return goog.isObject(a)&&0<a.nodeType};goog.dom.isElement=function(a){return goog.isObject(a)&&a.nodeType==goog.dom.NodeType.ELEMENT};
goog.dom.isWindow=function(a){return goog.isObject(a)&&a.window==a};goog.dom.getParentElement=function(a){if(goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY)return a.parentElement;a=a.parentNode;return goog.dom.isElement(a)?a:null};goog.dom.contains=function(a,b){if(a.contains&&b.nodeType==goog.dom.NodeType.ELEMENT)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};
goog.dom.compareNodeOrder=function(a,b){if(a==b)return 0;if(a.compareDocumentPosition)return a.compareDocumentPosition(b)&2?1:-1;if("sourceIndex"in a||a.parentNode&&"sourceIndex"in a.parentNode){var c=a.nodeType==goog.dom.NodeType.ELEMENT,d=b.nodeType==goog.dom.NodeType.ELEMENT;if(c&&d)return a.sourceIndex-b.sourceIndex;var e=a.parentNode,f=b.parentNode;return e==f?goog.dom.compareSiblingOrder_(a,b):!c&&goog.dom.contains(e,b)?-1*goog.dom.compareParentsDescendantNodeIe_(a,b):!d&&goog.dom.contains(f,
a)?goog.dom.compareParentsDescendantNodeIe_(b,a):(c?a.sourceIndex:e.sourceIndex)-(d?b.sourceIndex:f.sourceIndex)}d=goog.dom.getOwnerDocument(a);c=d.createRange();c.selectNode(a);c.collapse(!0);d=d.createRange();d.selectNode(b);d.collapse(!0);return c.compareBoundaryPoints(goog.global.Range.START_TO_END,d)};goog.dom.compareParentsDescendantNodeIe_=function(a,b){var c=a.parentNode;if(c==b)return-1;for(var d=b;d.parentNode!=c;)d=d.parentNode;return goog.dom.compareSiblingOrder_(d,a)};
goog.dom.compareSiblingOrder_=function(a,b){for(var c=b;c=c.previousSibling;)if(c==a)return-1;return 1};goog.dom.findCommonAncestor=function(a){var b,c=arguments.length;if(c){if(1==c)return arguments[0]}else return null;var d=[],e=Infinity;for(b=0;b<c;b++){for(var f=[],g=arguments[b];g;)f.unshift(g),g=g.parentNode;d.push(f);e=Math.min(e,f.length)}f=null;for(b=0;b<e;b++){for(var g=d[0][b],h=1;h<c;h++)if(g!=d[h][b])return f;f=g}return f};
goog.dom.getOwnerDocument=function(a){return a.nodeType==goog.dom.NodeType.DOCUMENT?a:a.ownerDocument||a.document};goog.dom.getFrameContentDocument=function(a){return a.contentDocument||a.contentWindow.document};goog.dom.getFrameContentWindow=function(a){return a.contentWindow||goog.dom.getWindow_(goog.dom.getFrameContentDocument(a))};
goog.dom.setTextContent=function(a,b){if("textContent"in a)a.textContent=b;else if(a.firstChild&&a.firstChild.nodeType==goog.dom.NodeType.TEXT){for(;a.lastChild!=a.firstChild;)a.removeChild(a.lastChild);a.firstChild.data=b}else{goog.dom.removeChildren(a);var c=goog.dom.getOwnerDocument(a);a.appendChild(c.createTextNode(b))}};goog.dom.getOuterHtml=function(a){if("outerHTML"in a)return a.outerHTML;var b=goog.dom.getOwnerDocument(a).createElement("div");b.appendChild(a.cloneNode(!0));return b.innerHTML};
goog.dom.findNode=function(a,b){var c=[];return goog.dom.findNodes_(a,b,c,!0)?c[0]:void 0};goog.dom.findNodes=function(a,b){var c=[];goog.dom.findNodes_(a,b,c,!1);return c};goog.dom.findNodes_=function(a,b,c,d){if(null!=a)for(a=a.firstChild;a;){if(b(a)&&(c.push(a),d)||goog.dom.findNodes_(a,b,c,d))return!0;a=a.nextSibling}return!1};goog.dom.TAGS_TO_IGNORE_={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1};goog.dom.PREDEFINED_TAG_VALUES_={IMG:" ",BR:"\n"};
goog.dom.isFocusableTabIndex=function(a){var b=a.getAttributeNode("tabindex");return b&&b.specified?(a=a.tabIndex,goog.isNumber(a)&&0<=a&&32768>a):!1};goog.dom.setFocusableTabIndex=function(a,b){b?a.tabIndex=0:(a.tabIndex=-1,a.removeAttribute("tabIndex"))};
goog.dom.getTextContent=function(a){if(goog.dom.BrowserFeature.CAN_USE_INNER_TEXT&&"innerText"in a)a=goog.string.canonicalizeNewlines(a.innerText);else{var b=[];goog.dom.getTextContent_(a,b,!0);a=b.join("")}a=a.replace(/ \xAD /g," ").replace(/\xAD/g,"");a=a.replace(/\u200B/g,"");goog.dom.BrowserFeature.CAN_USE_INNER_TEXT||(a=a.replace(/ +/g," "));" "!=a&&(a=a.replace(/^\s*/,""));return a};goog.dom.getRawTextContent=function(a){var b=[];goog.dom.getTextContent_(a,b,!1);return b.join("")};
goog.dom.getTextContent_=function(a,b,c){if(!(a.nodeName in goog.dom.TAGS_TO_IGNORE_))if(a.nodeType==goog.dom.NodeType.TEXT)c?b.push((""+a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):b.push(a.nodeValue);else if(a.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)b.push(goog.dom.PREDEFINED_TAG_VALUES_[a.nodeName]);else for(a=a.firstChild;a;)goog.dom.getTextContent_(a,b,c),a=a.nextSibling};goog.dom.getNodeTextLength=function(a){return goog.dom.getTextContent(a).length};
goog.dom.getNodeTextOffset=function(a,b){for(var c=b||goog.dom.getOwnerDocument(a).body,d=[];a&&a!=c;){for(var e=a;e=e.previousSibling;)d.unshift(goog.dom.getTextContent(e));a=a.parentNode}return goog.string.trimLeft(d.join("")).replace(/ +/g," ").length};
goog.dom.getNodeAtOffset=function(a,b,c){for(var a=[a],d=0,e;0<a.length&&d<b;)if(e=a.pop(),!(e.nodeName in goog.dom.TAGS_TO_IGNORE_))if(e.nodeType==goog.dom.NodeType.TEXT)var f=e.nodeValue.replace(/(\r\n|\r|\n)/g,"").replace(/ +/g," "),d=d+f.length;else if(e.nodeName in goog.dom.PREDEFINED_TAG_VALUES_)d+=goog.dom.PREDEFINED_TAG_VALUES_[e.nodeName].length;else for(f=e.childNodes.length-1;0<=f;f--)a.push(e.childNodes[f]);if(goog.isObject(c))c.remainder=e?e.nodeValue.length+b-d-1:0,c.node=e;return e};
goog.dom.isNodeList=function(a){if(a&&"number"==typeof a.length){if(goog.isObject(a))return"function"==typeof a.item||"string"==typeof a.item;if(goog.isFunction(a))return"function"==typeof a.item}return!1};goog.dom.getAncestorByTagNameAndClass=function(a,b,c){var d=b?b.toUpperCase():null;return goog.dom.getAncestor(a,function(a){return(!d||a.nodeName==d)&&(!c||goog.dom.classes.has(a,c))},!0)};goog.dom.getAncestorByClass=function(a,b){return goog.dom.getAncestorByTagNameAndClass(a,null,b)};
goog.dom.getAncestor=function(a,b,c,d){if(!c)a=a.parentNode;for(var c=null==d,e=0;a&&(c||e<=d);){if(b(a))return a;a=a.parentNode;e++}return null};goog.dom.getActiveElement=function(a){try{return a&&a.activeElement}catch(b){}return null};goog.dom.DomHelper=function(a){this.document_=a||goog.global.document||document};goog.dom.DomHelper.prototype.getDomHelper=goog.dom.getDomHelper;goog.dom.DomHelper.prototype.setDocument=function(a){this.document_=a};goog.dom.DomHelper.prototype.getDocument=function(){return this.document_};
goog.dom.DomHelper.prototype.getElement=function(a){return goog.isString(a)?this.document_.getElementById(a):a};goog.dom.DomHelper.prototype.$=goog.dom.DomHelper.prototype.getElement;goog.dom.DomHelper.prototype.getElementsByTagNameAndClass=function(a,b,c){return goog.dom.getElementsByTagNameAndClass_(this.document_,a,b,c)};goog.dom.DomHelper.prototype.getElementsByClass=function(a,b){return goog.dom.getElementsByClass(a,b||this.document_)};
goog.dom.DomHelper.prototype.getElementByClass=function(a,b){return goog.dom.getElementByClass(a,b||this.document_)};goog.dom.DomHelper.prototype.$$=goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;goog.dom.DomHelper.prototype.setProperties=goog.dom.setProperties;goog.dom.DomHelper.prototype.getViewportSize=function(a){return goog.dom.getViewportSize(a||this.getWindow())};goog.dom.DomHelper.prototype.getDocumentHeight=function(){return goog.dom.getDocumentHeight_(this.getWindow())};
goog.dom.DomHelper.prototype.createDom=function(a,b,c){return goog.dom.createDom_(this.document_,arguments)};goog.dom.DomHelper.prototype.$dom=goog.dom.DomHelper.prototype.createDom;goog.dom.DomHelper.prototype.createElement=function(a){return this.document_.createElement(a)};goog.dom.DomHelper.prototype.createTextNode=function(a){return this.document_.createTextNode(a)};goog.dom.DomHelper.prototype.createTable=function(a,b,c){return goog.dom.createTable_(this.document_,a,b,!!c)};
goog.dom.DomHelper.prototype.htmlToDocumentFragment=function(a){return goog.dom.htmlToDocumentFragment_(this.document_,a)};goog.dom.DomHelper.prototype.getCompatMode=function(){return this.isCss1CompatMode()?"CSS1Compat":"BackCompat"};goog.dom.DomHelper.prototype.isCss1CompatMode=function(){return goog.dom.isCss1CompatMode_(this.document_)};goog.dom.DomHelper.prototype.getWindow=function(){return goog.dom.getWindow_(this.document_)};goog.dom.DomHelper.prototype.getDocumentScrollElement=function(){return goog.dom.getDocumentScrollElement_(this.document_)};
goog.dom.DomHelper.prototype.getDocumentScroll=function(){return goog.dom.getDocumentScroll_(this.document_)};goog.dom.DomHelper.prototype.appendChild=goog.dom.appendChild;goog.dom.DomHelper.prototype.append=goog.dom.append;goog.dom.DomHelper.prototype.removeChildren=goog.dom.removeChildren;goog.dom.DomHelper.prototype.insertSiblingBefore=goog.dom.insertSiblingBefore;goog.dom.DomHelper.prototype.insertSiblingAfter=goog.dom.insertSiblingAfter;goog.dom.DomHelper.prototype.removeNode=goog.dom.removeNode;
goog.dom.DomHelper.prototype.replaceNode=goog.dom.replaceNode;goog.dom.DomHelper.prototype.flattenElement=goog.dom.flattenElement;goog.dom.DomHelper.prototype.getFirstElementChild=goog.dom.getFirstElementChild;goog.dom.DomHelper.prototype.getLastElementChild=goog.dom.getLastElementChild;goog.dom.DomHelper.prototype.getNextElementSibling=goog.dom.getNextElementSibling;goog.dom.DomHelper.prototype.getPreviousElementSibling=goog.dom.getPreviousElementSibling;
goog.dom.DomHelper.prototype.getNextNode=goog.dom.getNextNode;goog.dom.DomHelper.prototype.getPreviousNode=goog.dom.getPreviousNode;goog.dom.DomHelper.prototype.isNodeLike=goog.dom.isNodeLike;goog.dom.DomHelper.prototype.contains=goog.dom.contains;goog.dom.DomHelper.prototype.getOwnerDocument=goog.dom.getOwnerDocument;goog.dom.DomHelper.prototype.getFrameContentDocument=goog.dom.getFrameContentDocument;goog.dom.DomHelper.prototype.getFrameContentWindow=goog.dom.getFrameContentWindow;
goog.dom.DomHelper.prototype.setTextContent=goog.dom.setTextContent;goog.dom.DomHelper.prototype.findNode=goog.dom.findNode;goog.dom.DomHelper.prototype.findNodes=goog.dom.findNodes;goog.dom.DomHelper.prototype.getTextContent=goog.dom.getTextContent;goog.dom.DomHelper.prototype.getNodeTextLength=goog.dom.getNodeTextLength;goog.dom.DomHelper.prototype.getNodeTextOffset=goog.dom.getNodeTextOffset;goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass=goog.dom.getAncestorByTagNameAndClass;
goog.dom.DomHelper.prototype.getAncestorByClass=goog.dom.getAncestorByClass;goog.dom.DomHelper.prototype.getAncestor=goog.dom.getAncestor;goog.fx={};goog.fx.Dragger=function(a,b,c){goog.events.EventTarget.call(this);this.target=a;this.handle=b||a;this.limits=c||new goog.math.Rect(NaN,NaN,NaN,NaN);this.document_=goog.dom.getOwnerDocument(a);this.eventHandler_=new goog.events.EventHandler(this);goog.events.listen(this.handle,[goog.events.EventType.TOUCHSTART,goog.events.EventType.MOUSEDOWN],this.startDrag,!1,this)};goog.inherits(goog.fx.Dragger,goog.events.EventTarget);
goog.fx.Dragger.HAS_SET_CAPTURE_=goog.userAgent.IE||goog.userAgent.GECKO&&goog.userAgent.isVersion("1.9.3");goog.fx.Dragger.EventType={EARLY_CANCEL:"earlycancel",START:"start",BEFOREDRAG:"beforedrag",DRAG:"drag",END:"end"};goog.fx.Dragger.prototype.clientX=0;goog.fx.Dragger.prototype.clientY=0;goog.fx.Dragger.prototype.screenX=0;goog.fx.Dragger.prototype.screenY=0;goog.fx.Dragger.prototype.startX=0;goog.fx.Dragger.prototype.startY=0;goog.fx.Dragger.prototype.deltaX=0;
goog.fx.Dragger.prototype.deltaY=0;goog.fx.Dragger.prototype.enabled_=!0;goog.fx.Dragger.prototype.dragging_=!1;goog.fx.Dragger.prototype.hysteresisDistanceSquared_=0;goog.fx.Dragger.prototype.mouseDownTime_=0;goog.fx.Dragger.prototype.ieDragStartCancellingOn_=!1;goog.fx.Dragger.prototype.getHandler=function(){return this.eventHandler_};goog.fx.Dragger.prototype.setLimits=function(a){this.limits=a||new goog.math.Rect(NaN,NaN,NaN,NaN)};
goog.fx.Dragger.prototype.setHysteresis=function(a){this.hysteresisDistanceSquared_=Math.pow(a,2)};goog.fx.Dragger.prototype.getHysteresis=function(){return Math.sqrt(this.hysteresisDistanceSquared_)};goog.fx.Dragger.prototype.setScrollTarget=function(a){this.scrollTarget_=a};goog.fx.Dragger.prototype.setCancelIeDragStart=function(a){this.ieDragStartCancellingOn_=a};goog.fx.Dragger.prototype.getEnabled=function(){return this.enabled_};
goog.fx.Dragger.prototype.setEnabled=function(a){this.enabled_=a};goog.fx.Dragger.prototype.disposeInternal=function(){goog.fx.Dragger.superClass_.disposeInternal.call(this);goog.events.unlisten(this.handle,[goog.events.EventType.TOUCHSTART,goog.events.EventType.MOUSEDOWN],this.startDrag,!1,this);this.eventHandler_.dispose();delete this.target;delete this.handle;delete this.eventHandler_};
goog.fx.Dragger.prototype.startDrag=function(a){var b=a.type==goog.events.EventType.MOUSEDOWN;if(this.enabled_&&!this.dragging_&&(!b||a.isMouseActionButton())){this.maybeReinitTouchEvent_(a);if(0==this.hysteresisDistanceSquared_)if(this.initializeDrag_(a),this.dragging_)a.preventDefault();else return;else a.preventDefault();this.setupDragHandlers();this.clientX=this.startX=a.clientX;this.clientY=this.startY=a.clientY;this.screenX=a.screenX;this.screenY=a.screenY;this.deltaX=this.target.offsetLeft;
this.deltaY=this.target.offsetTop;this.pageScroll=goog.dom.getDomHelper(this.document_).getDocumentScroll();this.mouseDownTime_=goog.now()}else this.dispatchEvent(goog.fx.Dragger.EventType.EARLY_CANCEL)};
goog.fx.Dragger.prototype.setupDragHandlers=function(){var a=this.document_,b=a.documentElement,c=!goog.fx.Dragger.HAS_SET_CAPTURE_;this.eventHandler_.listen(a,[goog.events.EventType.TOUCHMOVE,goog.events.EventType.MOUSEMOVE],this.handleMove_,c);this.eventHandler_.listen(a,[goog.events.EventType.TOUCHEND,goog.events.EventType.MOUSEUP],this.endDrag,c);goog.fx.Dragger.HAS_SET_CAPTURE_?(b.setCapture(!1),this.eventHandler_.listen(b,goog.events.EventType.LOSECAPTURE,this.endDrag)):this.eventHandler_.listen(goog.dom.getWindow(a),
goog.events.EventType.BLUR,this.endDrag);goog.userAgent.IE&&this.ieDragStartCancellingOn_&&this.eventHandler_.listen(a,goog.events.EventType.DRAGSTART,goog.events.Event.preventDefault);this.scrollTarget_&&this.eventHandler_.listen(this.scrollTarget_,goog.events.EventType.SCROLL,this.onScroll_,c)};goog.fx.Dragger.prototype.initializeDrag_=function(a){if(!1!==this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.START,this,a.clientX,a.clientY,a)))this.dragging_=!0};
goog.fx.Dragger.prototype.endDrag=function(a,b){this.eventHandler_.removeAll();goog.fx.Dragger.HAS_SET_CAPTURE_&&this.document_.releaseCapture();var c=this.limitX(this.deltaX),d=this.limitY(this.deltaY);this.dragging_?(this.maybeReinitTouchEvent_(a),this.dragging_=!1,this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.END,this,a.clientX,a.clientY,a,c,d,b||a.type==goog.events.EventType.TOUCHCANCEL))):this.dispatchEvent(goog.fx.Dragger.EventType.EARLY_CANCEL);(a.type==goog.events.EventType.TOUCHEND||
a.type==goog.events.EventType.TOUCHCANCEL)&&a.preventDefault()};goog.fx.Dragger.prototype.endDragCancel=function(a){this.endDrag(a,!0)};goog.fx.Dragger.prototype.maybeReinitTouchEvent_=function(a){var b=a.type;b==goog.events.EventType.TOUCHSTART||b==goog.events.EventType.TOUCHMOVE?a.init(a.getBrowserEvent().targetTouches[0],a.currentTarget):(b==goog.events.EventType.TOUCHEND||b==goog.events.EventType.TOUCHCANCEL)&&a.init(a.getBrowserEvent().changedTouches[0],a.currentTarget)};
goog.fx.Dragger.prototype.handleMove_=function(a){if(this.enabled_){this.maybeReinitTouchEvent_(a);var b=a.clientX-this.clientX,c=a.clientY-this.clientY;this.clientX=a.clientX;this.clientY=a.clientY;this.screenX=a.screenX;this.screenY=a.screenY;if(!this.dragging_){var d=this.startX-this.clientX,e=this.startY-this.clientY;if(d*d+e*e>this.hysteresisDistanceSquared_&&(this.initializeDrag_(a),!this.dragging_)){this.endDrag(a);return}}c=this.calculatePosition_(b,c);b=c.x;c=c.y;this.dragging_&&!1!==this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.BEFOREDRAG,
this,a.clientX,a.clientY,a,b,c))&&(this.doDrag(a,b,c,!1),a.preventDefault())}};goog.fx.Dragger.prototype.calculatePosition_=function(a,b){var c=goog.dom.getDomHelper(this.document_).getDocumentScroll(),a=a+(c.x-this.pageScroll.x),b=b+(c.y-this.pageScroll.y);this.pageScroll=c;this.deltaX+=a;this.deltaY+=b;var c=this.limitX(this.deltaX),d=this.limitY(this.deltaY);return new goog.math.Coordinate(c,d)};
goog.fx.Dragger.prototype.onScroll_=function(a){var b=this.calculatePosition_(0,0);a.clientX=this.clientX;a.clientY=this.clientY;this.doDrag(a,b.x,b.y,!0)};goog.fx.Dragger.prototype.doDrag=function(a,b,c){this.defaultAction(b,c);this.dispatchEvent(new goog.fx.DragEvent(goog.fx.Dragger.EventType.DRAG,this,a.clientX,a.clientY,a,b,c))};
goog.fx.Dragger.prototype.limitX=function(a){var b=this.limits,c=!isNaN(b.left)?b.left:null,b=!isNaN(b.width)?b.width:0;return Math.min(null!=c?c+b:Infinity,Math.max(null!=c?c:-Infinity,a))};goog.fx.Dragger.prototype.limitY=function(a){var b=this.limits,c=!isNaN(b.top)?b.top:null,b=!isNaN(b.height)?b.height:0;return Math.min(null!=c?c+b:Infinity,Math.max(null!=c?c:-Infinity,a))};goog.fx.Dragger.prototype.defaultAction=function(a,b){this.target.style.left=a+"px";this.target.style.top=b+"px"};
goog.fx.DragEvent=function(a,b,c,d,e,f,g,h){goog.events.Event.call(this,a);this.clientX=c;this.clientY=d;this.browserEvent=e;this.left=goog.isDef(f)?f:b.deltaX;this.top=goog.isDef(g)?g:b.deltaY;this.dragger=b;this.dragCanceled=!!h};goog.inherits(goog.fx.DragEvent,goog.events.Event);goog.style={};goog.style.setStyle=function(a,b,c){goog.isString(b)?goog.style.setStyle_(a,c,b):goog.object.forEach(b,goog.partial(goog.style.setStyle_,a))};goog.style.setStyle_=function(a,b,c){a.style[goog.string.toCamelCase(c)]=b};goog.style.getStyle=function(a,b){return a.style[goog.string.toCamelCase(b)]||""};
goog.style.getComputedStyle=function(a,b){var c=goog.dom.getOwnerDocument(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,null))?c[b]||c.getPropertyValue(b):""};goog.style.getCascadedStyle=function(a,b){return a.currentStyle?a.currentStyle[b]:null};goog.style.getStyle_=function(a,b){return goog.style.getComputedStyle(a,b)||goog.style.getCascadedStyle(a,b)||a.style&&a.style[b]};goog.style.getComputedPosition=function(a){return goog.style.getStyle_(a,"position")};
goog.style.getBackgroundColor=function(a){return goog.style.getStyle_(a,"backgroundColor")};goog.style.getComputedOverflowX=function(a){return goog.style.getStyle_(a,"overflowX")};goog.style.getComputedOverflowY=function(a){return goog.style.getStyle_(a,"overflowY")};goog.style.getComputedZIndex=function(a){return goog.style.getStyle_(a,"zIndex")};goog.style.getComputedTextAlign=function(a){return goog.style.getStyle_(a,"textAlign")};
goog.style.getComputedCursor=function(a){return goog.style.getStyle_(a,"cursor")};goog.style.setPosition=function(a,b,c){var d,e=goog.userAgent.GECKO&&(goog.userAgent.MAC||goog.userAgent.X11)&&goog.userAgent.isVersion("1.9");b instanceof goog.math.Coordinate?(d=b.x,b=b.y):(d=b,b=c);a.style.left=goog.style.getPixelStyleValue_(d,e);a.style.top=goog.style.getPixelStyleValue_(b,e)};goog.style.getPosition=function(a){return new goog.math.Coordinate(a.offsetLeft,a.offsetTop)};
goog.style.getClientViewportElement=function(a){a=a?a.nodeType==goog.dom.NodeType.DOCUMENT?a:goog.dom.getOwnerDocument(a):goog.dom.getDocument();return goog.userAgent.IE&&!goog.userAgent.isDocumentMode(9)&&!goog.dom.getDomHelper(a).isCss1CompatMode()?a.body:a.documentElement};
goog.style.getBoundingClientRect_=function(a){var b=a.getBoundingClientRect();if(goog.userAgent.IE)a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop;return b};
goog.style.getOffsetParent=function(a){if(goog.userAgent.IE&&!goog.userAgent.isDocumentMode(8))return a.offsetParent;for(var b=goog.dom.getOwnerDocument(a),c=goog.style.getStyle_(a,"position"),d="fixed"==c||"absolute"==c,a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=goog.style.getStyle_(a,"position"),d=d&&"static"==c&&a!=b.documentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return null};
goog.style.getVisibleRectForElement=function(a){for(var b=new goog.math.Box(0,Infinity,Infinity,0),c=goog.dom.getDomHelper(a),d=c.getDocument().body,e=c.getDocument().documentElement,f=c.getDocumentScrollElement();a=goog.style.getOffsetParent(a);)if((!goog.userAgent.IE||0!=a.clientWidth)&&(!goog.userAgent.WEBKIT||0!=a.clientHeight||a!=d)&&a!=d&&a!=e&&"visible"!=goog.style.getStyle_(a,"overflow")){var g=goog.style.getPageOffset(a),h=goog.style.getClientLeftTop(a);g.x+=h.x;g.y+=h.y;b.top=Math.max(b.top,
g.y);b.right=Math.min(b.right,g.x+a.clientWidth);b.bottom=Math.min(b.bottom,g.y+a.clientHeight);b.left=Math.max(b.left,g.x)}d=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,f);c=c.getViewportSize();b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&b.bottom>b.top&&b.right>b.left?b:null};
goog.style.scrollIntoContainerView=function(a,b,c){var d=goog.style.getPageOffset(a),e=goog.style.getPageOffset(b),f=goog.style.getBorderBox(b),g=d.x-e.x-f.left,d=d.y-e.y-f.top,e=b.clientWidth-a.offsetWidth,a=b.clientHeight-a.offsetHeight;c?(b.scrollLeft+=g-e/2,b.scrollTop+=d-a/2):(b.scrollLeft+=Math.min(g,Math.max(g-e,0)),b.scrollTop+=Math.min(d,Math.max(d-a,0)))};
goog.style.getClientLeftTop=function(a){if(goog.userAgent.GECKO&&!goog.userAgent.isVersion("1.9")){var b=parseFloat(goog.style.getComputedStyle(a,"borderLeftWidth"));if(goog.style.isRightToLeft(a))var c=a.offsetWidth-a.clientWidth-b-parseFloat(goog.style.getComputedStyle(a,"borderRightWidth")),b=b+c;return new goog.math.Coordinate(b,parseFloat(goog.style.getComputedStyle(a,"borderTopWidth")))}return new goog.math.Coordinate(a.clientLeft,a.clientTop)};
goog.style.getPageOffset=function(a){var b,c=goog.dom.getOwnerDocument(a),d=goog.style.getStyle_(a,"position"),e=goog.userAgent.GECKO&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new goog.math.Coordinate(0,0),g=goog.style.getClientViewportElement(c);if(a==g)return f;if(a.getBoundingClientRect)b=goog.style.getBoundingClientRect_(a),a=goog.dom.getDomHelper(c).getDocumentScroll(),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&
!e)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(g),f.x=b.screenX-a.screenX,f.y=b.screenY-a.screenY;else{b=a;do{f.x+=b.offsetLeft;f.y+=b.offsetTop;b!=a&&(f.x+=b.clientLeft||0,f.y+=b.clientTop||0);if(goog.userAgent.WEBKIT&&"fixed"==goog.style.getComputedPosition(b)){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(goog.userAgent.OPERA||goog.userAgent.WEBKIT&&"absolute"==d)f.y-=c.body.offsetTop;for(b=a;(b=goog.style.getOffsetParent(b))&&b!=c.body&&b!=g;)if(f.x-=b.scrollLeft,
!goog.userAgent.OPERA||"TR"!=b.tagName)f.y-=b.scrollTop}return f};goog.style.getPageOffsetLeft=function(a){return goog.style.getPageOffset(a).x};goog.style.getPageOffsetTop=function(a){return goog.style.getPageOffset(a).y};goog.style.getFramedPageOffset=function(a,b){var c=new goog.math.Coordinate(0,0),d=goog.dom.getWindow(goog.dom.getOwnerDocument(a)),e=a;do{var f=d==b?goog.style.getPageOffset(e):goog.style.getClientPosition(e);c.x+=f.x;c.y+=f.y}while(d&&d!=b&&(e=d.frameElement)&&(d=d.parent));return c};
goog.style.translateRectForAnotherFrame=function(a,b,c){if(b.getDocument()!=c.getDocument()){var d=b.getDocument().body,c=goog.style.getFramedPageOffset(d,c.getWindow()),c=goog.math.Coordinate.difference(c,goog.style.getPageOffset(d));goog.userAgent.IE&&!b.isCss1CompatMode()&&(c=goog.math.Coordinate.difference(c,b.getDocumentScroll()));a.left+=c.x;a.top+=c.y}};
goog.style.getRelativePosition=function(a,b){var c=goog.style.getClientPosition(a),d=goog.style.getClientPosition(b);return new goog.math.Coordinate(c.x-d.x,c.y-d.y)};
goog.style.getClientPosition=function(a){var b=new goog.math.Coordinate;if(a.nodeType==goog.dom.NodeType.ELEMENT)if(a.getBoundingClientRect)a=goog.style.getBoundingClientRect_(a),b.x=a.left,b.y=a.top;else{var c=goog.dom.getDomHelper(a).getDocumentScroll(),a=goog.style.getPageOffset(a);b.x=a.x-c.x;b.y=a.y-c.y}else{var c=goog.isFunction(a.getBrowserEvent),d=a;a.targetTouches?d=a.targetTouches[0]:c&&a.getBrowserEvent().targetTouches&&(d=a.getBrowserEvent().targetTouches[0]);b.x=d.clientX;b.y=d.clientY}return b};
goog.style.setPageOffset=function(a,b,c){var d=goog.style.getPageOffset(a);if(b instanceof goog.math.Coordinate)c=b.y,b=b.x;goog.style.setPosition(a,a.offsetLeft+(b-d.x),a.offsetTop+(c-d.y))};goog.style.setSize=function(a,b,c){if(b instanceof goog.math.Size)c=b.height,b=b.width;else if(void 0==c)throw Error("missing height argument");goog.style.setWidth(a,b);goog.style.setHeight(a,c)};goog.style.getPixelStyleValue_=function(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a};
goog.style.setHeight=function(a,b){a.style.height=goog.style.getPixelStyleValue_(b,!0)};goog.style.setWidth=function(a,b){a.style.width=goog.style.getPixelStyleValue_(b,!0)};goog.style.getSize=function(a){if("none"!=goog.style.getStyle_(a,"display"))return goog.style.getSizeWithDisplay_(a);var b=a.style,c=b.display,d=b.visibility,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=goog.style.getSizeWithDisplay_(a);b.display=c;b.position=e;b.visibility=d;return a};
goog.style.getSizeWithDisplay_=function(a){var b=a.offsetWidth,c=a.offsetHeight,d=goog.userAgent.WEBKIT&&!b&&!c;return(!goog.isDef(b)||d)&&a.getBoundingClientRect?(a=goog.style.getBoundingClientRect_(a),new goog.math.Size(a.right-a.left,a.bottom-a.top)):new goog.math.Size(b,c)};goog.style.getBounds=function(a){var b=goog.style.getPageOffset(a),a=goog.style.getSize(a);return new goog.math.Rect(b.x,b.y,a.width,a.height)};goog.style.toCamelCase=function(a){return goog.string.toCamelCase(""+a)};
goog.style.toSelectorCase=function(a){return goog.string.toSelectorCase(a)};goog.style.getOpacity=function(a){var b=a.style,a="";"opacity"in b?a=b.opacity:"MozOpacity"in b?a=b.MozOpacity:"filter"in b&&(b=b.filter.match(/alpha\(opacity=([\d.]+)\)/))&&(a=""+b[1]/100);return""==a?a:Number(a)};goog.style.setOpacity=function(a,b){var c=a.style;if("opacity"in c)c.opacity=b;else if("MozOpacity"in c)c.MozOpacity=b;else if("filter"in c)c.filter=""===b?"":"alpha(opacity="+100*b+")"};
goog.style.setTransparentBackgroundImage=function(a,b){var c=a.style;goog.userAgent.IE&&!goog.userAgent.isVersion("8")?c.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+b+'", sizingMethod="crop")':(c.backgroundImage="url("+b+")",c.backgroundPosition="top left",c.backgroundRepeat="no-repeat")};goog.style.clearTransparentBackgroundImage=function(a){a=a.style;"filter"in a?a.filter="":a.backgroundImage="none"};goog.style.showElement=function(a,b){a.style.display=b?"":"none"};
goog.style.isElementShown=function(a){return"none"!=a.style.display};goog.style.installStyles=function(a,b){var c=goog.dom.getDomHelper(b),d=null;if(goog.userAgent.IE)d=c.getDocument().createStyleSheet(),goog.style.setStyles(d,a);else{var e=c.getElementsByTagNameAndClass("head")[0];e||(d=c.getElementsByTagNameAndClass("body")[0],e=c.createDom("head"),d.parentNode.insertBefore(e,d));d=c.createDom("style");goog.style.setStyles(d,a);c.appendChild(e,d)}return d};
goog.style.uninstallStyles=function(a){goog.dom.removeNode(a.ownerNode||a.owningElement||a)};goog.style.setStyles=function(a,b){goog.userAgent.IE?a.cssText=b:a[goog.userAgent.WEBKIT?"innerText":"innerHTML"]=b};goog.style.setPreWrap=function(a){a=a.style;goog.userAgent.IE&&!goog.userAgent.isVersion("8")?(a.whiteSpace="pre",a.wordWrap="break-word"):a.whiteSpace=goog.userAgent.GECKO?"-moz-pre-wrap":"pre-wrap"};
goog.style.setInlineBlock=function(a){a=a.style;a.position="relative";goog.userAgent.IE&&!goog.userAgent.isVersion("8")?(a.zoom="1",a.display="inline"):a.display=goog.userAgent.GECKO?goog.userAgent.isVersion("1.9a")?"inline-block":"-moz-inline-box":"inline-block"};goog.style.isRightToLeft=function(a){return"rtl"==goog.style.getStyle_(a,"direction")};goog.style.unselectableStyle_=goog.userAgent.GECKO?"MozUserSelect":goog.userAgent.WEBKIT?"WebkitUserSelect":null;
goog.style.isUnselectable=function(a){return goog.style.unselectableStyle_?"none"==a.style[goog.style.unselectableStyle_].toLowerCase():goog.userAgent.IE||goog.userAgent.OPERA?"on"==a.getAttribute("unselectable"):!1};
goog.style.setUnselectable=function(a,b,c){var c=!c?a.getElementsByTagName("*"):null,d=goog.style.unselectableStyle_;if(d){if(b=b?"none":"",a.style[d]=b,c)for(var a=0,e;e=c[a];a++)e.style[d]=b}else if(goog.userAgent.IE||goog.userAgent.OPERA)if(b=b?"on":"",a.setAttribute("unselectable",b),c)for(a=0;e=c[a];a++)e.setAttribute("unselectable",b)};goog.style.getBorderBoxSize=function(a){return new goog.math.Size(a.offsetWidth,a.offsetHeight)};
goog.style.setBorderBoxSize=function(a,b){var c=goog.dom.getOwnerDocument(a),d=goog.dom.getDomHelper(c).isCss1CompatMode();if(goog.userAgent.IE&&(!d||!goog.userAgent.isVersion("8")))if(c=a.style,d){var d=goog.style.getPaddingBox(a),e=goog.style.getBorderBox(a);c.pixelWidth=b.width-e.left-d.left-d.right-e.right;c.pixelHeight=b.height-e.top-d.top-d.bottom-e.bottom}else c.pixelWidth=b.width,c.pixelHeight=b.height;else goog.style.setBoxSizingSize_(a,b,"border-box")};
goog.style.getContentBoxSize=function(a){var b=goog.dom.getOwnerDocument(a),c=goog.userAgent.IE&&a.currentStyle;if(c&&goog.dom.getDomHelper(b).isCss1CompatMode()&&"auto"!=c.width&&"auto"!=c.height&&!c.boxSizing)return b=goog.style.getIePixelValue_(a,c.width,"width","pixelWidth"),a=goog.style.getIePixelValue_(a,c.height,"height","pixelHeight"),new goog.math.Size(b,a);c=goog.style.getBorderBoxSize(a);b=goog.style.getPaddingBox(a);a=goog.style.getBorderBox(a);return new goog.math.Size(c.width-a.left-
b.left-b.right-a.right,c.height-a.top-b.top-b.bottom-a.bottom)};
goog.style.setContentBoxSize=function(a,b){var c=goog.dom.getOwnerDocument(a),d=goog.dom.getDomHelper(c).isCss1CompatMode();if(goog.userAgent.IE&&(!d||!goog.userAgent.isVersion("8")))if(c=a.style,d)c.pixelWidth=b.width,c.pixelHeight=b.height;else{var d=goog.style.getPaddingBox(a),e=goog.style.getBorderBox(a);c.pixelWidth=b.width+e.left+d.left+d.right+e.right;c.pixelHeight=b.height+e.top+d.top+d.bottom+e.bottom}else goog.style.setBoxSizingSize_(a,b,"content-box")};
goog.style.setBoxSizingSize_=function(a,b,c){a=a.style;goog.userAgent.GECKO?a.MozBoxSizing=c:goog.userAgent.WEBKIT?a.WebkitBoxSizing=c:a.boxSizing=c;a.width=Math.max(b.width,0)+"px";a.height=Math.max(b.height,0)+"px"};goog.style.getIePixelValue_=function(a,b,c,d){if(/^\d+px?$/.test(b))return parseInt(b,10);var e=a.style[c],f=a.runtimeStyle[c];a.runtimeStyle[c]=a.currentStyle[c];a.style[c]=b;b=a.style[d];a.style[c]=e;a.runtimeStyle[c]=f;return b};
goog.style.getIePixelDistance_=function(a,b){return goog.style.getIePixelValue_(a,goog.style.getCascadedStyle(a,b),"left","pixelLeft")};
goog.style.getBox_=function(a,b){if(goog.userAgent.IE){var c=goog.style.getIePixelDistance_(a,b+"Left"),d=goog.style.getIePixelDistance_(a,b+"Right"),e=goog.style.getIePixelDistance_(a,b+"Top"),f=goog.style.getIePixelDistance_(a,b+"Bottom");return new goog.math.Box(e,d,f,c)}c=goog.style.getComputedStyle(a,b+"Left");d=goog.style.getComputedStyle(a,b+"Right");e=goog.style.getComputedStyle(a,b+"Top");f=goog.style.getComputedStyle(a,b+"Bottom");return new goog.math.Box(parseFloat(e),parseFloat(d),parseFloat(f),
parseFloat(c))};goog.style.getPaddingBox=function(a){return goog.style.getBox_(a,"padding")};goog.style.getMarginBox=function(a){return goog.style.getBox_(a,"margin")};goog.style.ieBorderWidthKeywords_={thin:2,medium:4,thick:6};
goog.style.getIePixelBorder_=function(a,b){if("none"==goog.style.getCascadedStyle(a,b+"Style"))return 0;var c=goog.style.getCascadedStyle(a,b+"Width");return c in goog.style.ieBorderWidthKeywords_?goog.style.ieBorderWidthKeywords_[c]:goog.style.getIePixelValue_(a,c,"left","pixelLeft")};
goog.style.getBorderBox=function(a){if(goog.userAgent.IE){var b=goog.style.getIePixelBorder_(a,"borderLeft"),c=goog.style.getIePixelBorder_(a,"borderRight"),d=goog.style.getIePixelBorder_(a,"borderTop"),a=goog.style.getIePixelBorder_(a,"borderBottom");return new goog.math.Box(d,c,a,b)}b=goog.style.getComputedStyle(a,"borderLeftWidth");c=goog.style.getComputedStyle(a,"borderRightWidth");d=goog.style.getComputedStyle(a,"borderTopWidth");a=goog.style.getComputedStyle(a,"borderBottomWidth");return new goog.math.Box(parseFloat(d),
parseFloat(c),parseFloat(a),parseFloat(b))};goog.style.getFontFamily=function(a){var b=goog.dom.getOwnerDocument(a),c="";if(b.body.createTextRange){b=b.body.createTextRange();b.moveToElementText(a);try{c=b.queryCommandValue("FontName")}catch(d){c=""}}c||(c=goog.style.getStyle_(a,"fontFamily"));a=c.split(",");1<a.length&&(c=a[0]);return goog.string.stripQuotes(c,"\"'")};goog.style.lengthUnitRegex_=/[^\d]+$/;
goog.style.getLengthUnits=function(a){return(a=a.match(goog.style.lengthUnitRegex_))&&a[0]||null};goog.style.ABSOLUTE_CSS_LENGTH_UNITS_={cm:1,"in":1,mm:1,pc:1,pt:1};goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_={em:1,ex:1};
goog.style.getFontSize=function(a){var b=goog.style.getStyle_(a,"fontSize"),c=goog.style.getLengthUnits(b);if(b&&"px"==c)return parseInt(b,10);if(goog.userAgent.IE){if(c in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_)return goog.style.getIePixelValue_(a,b,"left","pixelLeft");if(a.parentNode&&a.parentNode.nodeType==goog.dom.NodeType.ELEMENT&&c in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_)return a=a.parentNode,c=goog.style.getStyle_(a,"fontSize"),goog.style.getIePixelValue_(a,b==c?"1em":b,"left","pixelLeft")}c=
goog.dom.createDom("span",{style:"visibility:hidden;position:absolute;line-height:0;padding:0;margin:0;border:0;height:1em;"});goog.dom.appendChild(a,c);b=c.offsetHeight;goog.dom.removeNode(c);return b};goog.style.parseStyleAttribute=function(a){var b={};goog.array.forEach(a.split(/\s*;\s*/),function(a){a=a.split(/\s*:\s*/);2==a.length&&(b[goog.string.toCamelCase(a[0].toLowerCase())]=a[1])});return b};
goog.style.toStyleAttribute=function(a){var b=[];goog.object.forEach(a,function(a,d){b.push(goog.string.toSelectorCase(d),":",a,";")});return b.join("")};goog.style.setFloat=function(a,b){a.style[goog.userAgent.IE?"styleFloat":"cssFloat"]=b};goog.style.getFloat=function(a){return a.style[goog.userAgent.IE?"styleFloat":"cssFloat"]||""};
goog.style.getScrollbarWidth=function(a){var b=goog.dom.createElement("div");if(a)b.className=a;b.style.cssText="visiblity:hidden;overflow:auto;position:absolute;top:0;width:100px;height:100px";a=goog.dom.createElement("div");goog.style.setSize(a,"200px","200px");b.appendChild(a);goog.dom.appendChild(goog.dom.getDocument().body,b);a=b.offsetWidth-b.clientWidth;goog.dom.removeNode(b);return a};goog.ui={};goog.ui.IdGenerator=function(){};goog.addSingletonGetter(goog.ui.IdGenerator);goog.ui.IdGenerator.prototype.nextId_=0;goog.ui.IdGenerator.prototype.getNextUniqueId=function(){return":"+(this.nextId_++).toString(36)};goog.ui.IdGenerator.instance=goog.ui.IdGenerator.getInstance();goog.ui.Component=function(a){goog.events.EventTarget.call(this);this.dom_=a||goog.dom.getDomHelper();this.rightToLeft_=goog.ui.Component.defaultRightToLeft_};goog.inherits(goog.ui.Component,goog.events.EventTarget);goog.ui.Component.prototype.idGenerator_=goog.ui.IdGenerator.getInstance();goog.ui.Component.defaultRightToLeft_=null;
goog.ui.Component.EventType={BEFORE_SHOW:"beforeshow",SHOW:"show",HIDE:"hide",DISABLE:"disable",ENABLE:"enable",HIGHLIGHT:"highlight",UNHIGHLIGHT:"unhighlight",ACTIVATE:"activate",DEACTIVATE:"deactivate",SELECT:"select",UNSELECT:"unselect",CHECK:"check",UNCHECK:"uncheck",FOCUS:"focus",BLUR:"blur",OPEN:"open",CLOSE:"close",ENTER:"enter",LEAVE:"leave",ACTION:"action",CHANGE:"change"};
goog.ui.Component.Error={NOT_SUPPORTED:"Method not supported",DECORATE_INVALID:"Invalid element to decorate",ALREADY_RENDERED:"Component already rendered",PARENT_UNABLE_TO_BE_SET:"Unable to set parent component",CHILD_INDEX_OUT_OF_BOUNDS:"Child component index out of bounds",NOT_OUR_CHILD:"Child is not in parent component",NOT_IN_DOCUMENT:"Operation not supported while component is not in document",STATE_INVALID:"Invalid component state"};
goog.ui.Component.State={ALL:255,DISABLED:1,HOVER:2,ACTIVE:4,SELECTED:8,CHECKED:16,FOCUSED:32,OPENED:64};
goog.ui.Component.getStateTransitionEvent=function(a,b){switch(a){case goog.ui.Component.State.DISABLED:return b?goog.ui.Component.EventType.DISABLE:goog.ui.Component.EventType.ENABLE;case goog.ui.Component.State.HOVER:return b?goog.ui.Component.EventType.HIGHLIGHT:goog.ui.Component.EventType.UNHIGHLIGHT;case goog.ui.Component.State.ACTIVE:return b?goog.ui.Component.EventType.ACTIVATE:goog.ui.Component.EventType.DEACTIVATE;case goog.ui.Component.State.SELECTED:return b?goog.ui.Component.EventType.SELECT:
goog.ui.Component.EventType.UNSELECT;case goog.ui.Component.State.CHECKED:return b?goog.ui.Component.EventType.CHECK:goog.ui.Component.EventType.UNCHECK;case goog.ui.Component.State.FOCUSED:return b?goog.ui.Component.EventType.FOCUS:goog.ui.Component.EventType.BLUR;case goog.ui.Component.State.OPENED:return b?goog.ui.Component.EventType.OPEN:goog.ui.Component.EventType.CLOSE}throw Error(goog.ui.Component.Error.STATE_INVALID);};
goog.ui.Component.setDefaultRightToLeft=function(a){goog.ui.Component.defaultRightToLeft_=a};goog.ui.Component.prototype.id_=null;goog.ui.Component.prototype.inDocument_=!1;goog.ui.Component.prototype.element_=null;goog.ui.Component.prototype.rightToLeft_=null;goog.ui.Component.prototype.model_=null;goog.ui.Component.prototype.parent_=null;goog.ui.Component.prototype.children_=null;goog.ui.Component.prototype.childIndex_=null;goog.ui.Component.prototype.wasDecorated_=!1;
goog.ui.Component.prototype.getId=function(){return this.id_||(this.id_=this.idGenerator_.getNextUniqueId())};goog.ui.Component.prototype.setId=function(a){this.parent_&&this.parent_.childIndex_&&(goog.object.remove(this.parent_.childIndex_,this.id_),goog.object.add(this.parent_.childIndex_,a,this));this.id_=a};goog.ui.Component.prototype.getElement=function(){return this.element_};goog.ui.Component.prototype.setElementInternal=function(a){this.element_=a};
goog.ui.Component.prototype.getElementsByClass=function(a){return this.element_?this.dom_.getElementsByClass(a,this.element_):[]};goog.ui.Component.prototype.getElementByClass=function(a){return this.element_?this.dom_.getElementByClass(a,this.element_):null};goog.ui.Component.prototype.getHandler=function(){return this.googUiComponentHandler_||(this.googUiComponentHandler_=new goog.events.EventHandler(this))};
goog.ui.Component.prototype.setParent=function(a){if(this==a)throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);if(a&&this.parent_&&this.id_&&this.parent_.getChild(this.id_)&&this.parent_!=a)throw Error(goog.ui.Component.Error.PARENT_UNABLE_TO_BE_SET);this.parent_=a;goog.ui.Component.superClass_.setParentEventTarget.call(this,a)};goog.ui.Component.prototype.getParent=function(){return this.parent_};
goog.ui.Component.prototype.setParentEventTarget=function(a){if(this.parent_&&this.parent_!=a)throw Error(goog.ui.Component.Error.NOT_SUPPORTED);goog.ui.Component.superClass_.setParentEventTarget.call(this,a)};goog.ui.Component.prototype.getDomHelper=function(){return this.dom_};goog.ui.Component.prototype.isInDocument=function(){return this.inDocument_};goog.ui.Component.prototype.createDom=function(){this.element_=this.dom_.createElement("div")};goog.ui.Component.prototype.render=function(a){this.render_(a)};
goog.ui.Component.prototype.renderBefore=function(a){this.render_(a.parentNode,a)};goog.ui.Component.prototype.render_=function(a,b){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.element_||this.createDom();a?a.insertBefore(this.element_,b||null):this.dom_.getDocument().body.appendChild(this.element_);(!this.parent_||this.parent_.isInDocument())&&this.enterDocument()};
goog.ui.Component.prototype.decorate=function(a){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);if(a&&this.canDecorate(a)){this.wasDecorated_=!0;if(!this.dom_||this.dom_.getDocument()!=goog.dom.getOwnerDocument(a))this.dom_=goog.dom.getDomHelper(a);this.decorateInternal(a);this.enterDocument()}else throw Error(goog.ui.Component.Error.DECORATE_INVALID);};goog.ui.Component.prototype.canDecorate=function(){return!0};goog.ui.Component.prototype.wasDecorated=function(){return this.wasDecorated_};
goog.ui.Component.prototype.decorateInternal=function(a){this.element_=a};goog.ui.Component.prototype.enterDocument=function(){this.inDocument_=!0;this.forEachChild(function(a){!a.isInDocument()&&a.getElement()&&a.enterDocument()})};goog.ui.Component.prototype.exitDocument=function(){this.forEachChild(function(a){a.isInDocument()&&a.exitDocument()});this.googUiComponentHandler_&&this.googUiComponentHandler_.removeAll();this.inDocument_=!1};
goog.ui.Component.prototype.disposeInternal=function(){goog.ui.Component.superClass_.disposeInternal.call(this);this.inDocument_&&this.exitDocument();this.googUiComponentHandler_&&(this.googUiComponentHandler_.dispose(),delete this.googUiComponentHandler_);this.forEachChild(function(a){a.dispose()});!this.wasDecorated_&&this.element_&&goog.dom.removeNode(this.element_);this.parent_=this.model_=this.element_=this.childIndex_=this.children_=null};
goog.ui.Component.prototype.makeId=function(a){return this.getId()+"."+a};goog.ui.Component.prototype.makeIds=function(a){var b={},c;for(c in a)b[c]=this.makeId(a[c]);return b};goog.ui.Component.prototype.getModel=function(){return this.model_};goog.ui.Component.prototype.setModel=function(a){this.model_=a};goog.ui.Component.prototype.getFragmentFromId=function(a){return a.substring(this.getId().length+1)};
goog.ui.Component.prototype.getElementByFragment=function(a){if(!this.inDocument_)throw Error(goog.ui.Component.Error.NOT_IN_DOCUMENT);return this.dom_.getElement(this.makeId(a))};goog.ui.Component.prototype.addChild=function(a,b){this.addChildAt(a,this.getChildCount(),b)};
goog.ui.Component.prototype.addChildAt=function(a,b,c){if(a.inDocument_&&(c||!this.inDocument_))throw Error(goog.ui.Component.Error.ALREADY_RENDERED);if(0>b||b>this.getChildCount())throw Error(goog.ui.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS);if(!this.childIndex_||!this.children_)this.childIndex_={},this.children_=[];a.getParent()==this?(goog.object.set(this.childIndex_,a.getId(),a),goog.array.remove(this.children_,a)):goog.object.add(this.childIndex_,a.getId(),a);a.setParent(this);goog.array.insertAt(this.children_,
a,b);a.inDocument_&&this.inDocument_&&a.getParent()==this?(c=this.getContentElement(),c.insertBefore(a.getElement(),c.childNodes[b]||null)):c?(this.element_||this.createDom(),b=this.getChildAt(b+1),a.render_(this.getContentElement(),b?b.element_:null)):this.inDocument_&&!a.inDocument_&&a.element_&&a.enterDocument()};goog.ui.Component.prototype.getContentElement=function(){return this.element_};
goog.ui.Component.prototype.isRightToLeft=function(){if(null==this.rightToLeft_)this.rightToLeft_=goog.style.isRightToLeft(this.inDocument_?this.element_:this.dom_.getDocument().body);return this.rightToLeft_};goog.ui.Component.prototype.setRightToLeft=function(a){if(this.inDocument_)throw Error(goog.ui.Component.Error.ALREADY_RENDERED);this.rightToLeft_=a};goog.ui.Component.prototype.hasChildren=function(){return!!this.children_&&0!=this.children_.length};
goog.ui.Component.prototype.getChildCount=function(){return this.children_?this.children_.length:0};goog.ui.Component.prototype.getChildIds=function(){var a=[];this.forEachChild(function(b){a.push(b.getId())});return a};goog.ui.Component.prototype.getChild=function(a){return this.childIndex_&&a?goog.object.get(this.childIndex_,a)||null:null};goog.ui.Component.prototype.getChildAt=function(a){return this.children_?this.children_[a]||null:null};
goog.ui.Component.prototype.forEachChild=function(a,b){this.children_&&goog.array.forEach(this.children_,a,b)};goog.ui.Component.prototype.indexOfChild=function(a){return this.children_&&a?goog.array.indexOf(this.children_,a):-1};
goog.ui.Component.prototype.removeChild=function(a,b){if(a){var c=goog.isString(a)?a:a.getId(),a=this.getChild(c);c&&a&&(goog.object.remove(this.childIndex_,c),goog.array.remove(this.children_,a),b&&(a.exitDocument(),a.element_&&goog.dom.removeNode(a.element_)),a.setParent(null))}if(!a)throw Error(goog.ui.Component.Error.NOT_OUR_CHILD);return a};goog.ui.Component.prototype.removeChildAt=function(a,b){return this.removeChild(this.getChildAt(a),b)};
goog.ui.Component.prototype.removeChildren=function(a){for(;this.hasChildren();)this.removeChildAt(0,a)};goog.Timer=function(a,b){goog.events.EventTarget.call(this);this.interval_=a||1;this.timerObject_=b||goog.Timer.defaultTimerObject;this.boundTick_=goog.bind(this.tick_,this);this.last_=goog.now()};goog.inherits(goog.Timer,goog.events.EventTarget);goog.Timer.MAX_TIMEOUT_=2147483647;goog.Timer.prototype.enabled=!1;goog.Timer.defaultTimerObject=goog.global.window;goog.Timer.intervalScale=0.8;goog.Timer.prototype.timer_=null;goog.Timer.prototype.getInterval=function(){return this.interval_};
goog.Timer.prototype.setInterval=function(a){this.interval_=a;this.timer_&&this.enabled?(this.stop(),this.start()):this.timer_&&this.stop()};goog.Timer.prototype.tick_=function(){if(this.enabled){var a=goog.now()-this.last_;if(0<a&&a<this.interval_*goog.Timer.intervalScale)this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_-a);else if(this.dispatchTick(),this.enabled)this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_),this.last_=goog.now()}};
goog.Timer.prototype.dispatchTick=function(){this.dispatchEvent(goog.Timer.TICK)};goog.Timer.prototype.start=function(){this.enabled=!0;if(!this.timer_)this.timer_=this.timerObject_.setTimeout(this.boundTick_,this.interval_),this.last_=goog.now()};goog.Timer.prototype.stop=function(){this.enabled=!1;if(this.timer_)this.timerObject_.clearTimeout(this.timer_),this.timer_=null};goog.Timer.prototype.disposeInternal=function(){goog.Timer.superClass_.disposeInternal.call(this);this.stop();delete this.timerObject_};
goog.Timer.TICK="tick";goog.Timer.callOnce=function(a,b,c){if(goog.isFunction(a))c&&(a=goog.bind(a,c));else if(a&&"function"==typeof a.handleEvent)a=goog.bind(a.handleEvent,a);else throw Error("Invalid listener argument");return b>goog.Timer.MAX_TIMEOUT_?-1:goog.Timer.defaultTimerObject.setTimeout(a,b||0)};goog.Timer.clear=function(a){goog.Timer.defaultTimerObject.clearTimeout(a)};goog.events.KeyCodes={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,FF_SEMICOLON:59,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,
CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SCROLL_LOCK:145,FIRST_MEDIA_KEY:166,LAST_MEDIA_KEY:183,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,TILDE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,
BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,PHANTOM:255};
goog.events.KeyCodes.isTextModifyingKeyEvent=function(a){if(a.altKey&&!a.ctrlKey||a.metaKey||a.keyCode>=goog.events.KeyCodes.F1&&a.keyCode<=goog.events.KeyCodes.F12)return!1;switch(a.keyCode){case goog.events.KeyCodes.ALT:case goog.events.KeyCodes.CAPS_LOCK:case goog.events.KeyCodes.CONTEXT_MENU:case goog.events.KeyCodes.CTRL:case goog.events.KeyCodes.DOWN:case goog.events.KeyCodes.END:case goog.events.KeyCodes.ESC:case goog.events.KeyCodes.HOME:case goog.events.KeyCodes.INSERT:case goog.events.KeyCodes.LEFT:case goog.events.KeyCodes.MAC_FF_META:case goog.events.KeyCodes.META:case goog.events.KeyCodes.NUMLOCK:case goog.events.KeyCodes.NUM_CENTER:case goog.events.KeyCodes.PAGE_DOWN:case goog.events.KeyCodes.PAGE_UP:case goog.events.KeyCodes.PAUSE:case goog.events.KeyCodes.PHANTOM:case goog.events.KeyCodes.PRINT_SCREEN:case goog.events.KeyCodes.RIGHT:case goog.events.KeyCodes.SCROLL_LOCK:case goog.events.KeyCodes.SHIFT:case goog.events.KeyCodes.UP:case goog.events.KeyCodes.WIN_KEY:case goog.events.KeyCodes.WIN_KEY_RIGHT:return!1;default:return a.keyCode<
goog.events.KeyCodes.FIRST_MEDIA_KEY||a.keyCode>goog.events.KeyCodes.LAST_MEDIA_KEY}};
goog.events.KeyCodes.firesKeyPressEvent=function(a,b,c,d,e){if(!goog.userAgent.IE&&(!goog.userAgent.WEBKIT||!goog.userAgent.isVersion("525")))return!0;if(goog.userAgent.MAC&&e)return goog.events.KeyCodes.isCharacterKey(a);if(e&&!d||!c&&(b==goog.events.KeyCodes.CTRL||b==goog.events.KeyCodes.ALT)||goog.userAgent.IE&&d&&b==a)return!1;switch(a){case goog.events.KeyCodes.ENTER:return!(goog.userAgent.IE&&goog.userAgent.isDocumentMode(9));case goog.events.KeyCodes.ESC:return!goog.userAgent.WEBKIT}return goog.events.KeyCodes.isCharacterKey(a)};
goog.events.KeyCodes.isCharacterKey=function(a){if(a>=goog.events.KeyCodes.ZERO&&a<=goog.events.KeyCodes.NINE||a>=goog.events.KeyCodes.NUM_ZERO&&a<=goog.events.KeyCodes.NUM_MULTIPLY||a>=goog.events.KeyCodes.A&&a<=goog.events.KeyCodes.Z||goog.userAgent.WEBKIT&&0==a)return!0;switch(a){case goog.events.KeyCodes.SPACE:case goog.events.KeyCodes.QUESTION_MARK:case goog.events.KeyCodes.NUM_PLUS:case goog.events.KeyCodes.NUM_MINUS:case goog.events.KeyCodes.NUM_PERIOD:case goog.events.KeyCodes.NUM_DIVISION:case goog.events.KeyCodes.SEMICOLON:case goog.events.KeyCodes.FF_SEMICOLON:case goog.events.KeyCodes.DASH:case goog.events.KeyCodes.EQUALS:case goog.events.KeyCodes.COMMA:case goog.events.KeyCodes.PERIOD:case goog.events.KeyCodes.SLASH:case goog.events.KeyCodes.APOSTROPHE:case goog.events.KeyCodes.SINGLE_QUOTE:case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:case goog.events.KeyCodes.BACKSLASH:case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:return!0;
default:return!1}};goog.fx.Transition=function(){};goog.fx.Transition.EventType={PLAY:"play",BEGIN:"begin",RESUME:"resume",END:"end",STOP:"stop",FINISH:"finish",PAUSE:"pause"};goog.ui.PopupBase=function(a,b){goog.events.EventTarget.call(this);this.handler_=new goog.events.EventHandler(this);this.setElement(a||null);b&&this.setType(b)};goog.inherits(goog.ui.PopupBase,goog.events.EventTarget);goog.ui.PopupBase.Type={TOGGLE_DISPLAY:"toggle_display",MOVE_OFFSCREEN:"move_offscreen"};goog.ui.PopupBase.prototype.element_=null;goog.ui.PopupBase.prototype.autoHide_=!0;goog.ui.PopupBase.prototype.autoHideRegion_=null;goog.ui.PopupBase.prototype.isVisible_=!1;
goog.ui.PopupBase.prototype.shouldHideAsync_=!1;goog.ui.PopupBase.prototype.lastShowTime_=-1;goog.ui.PopupBase.prototype.lastHideTime_=-1;goog.ui.PopupBase.prototype.hideOnEscape_=!1;goog.ui.PopupBase.prototype.enableCrossIframeDismissal_=!0;goog.ui.PopupBase.prototype.type_=goog.ui.PopupBase.Type.TOGGLE_DISPLAY;goog.ui.PopupBase.EventType={BEFORE_SHOW:"beforeshow",SHOW:"show",BEFORE_HIDE:"beforehide",HIDE:"hide"};goog.ui.PopupBase.DEBOUNCE_DELAY_MS=150;goog.ui.PopupBase.prototype.getType=function(){return this.type_};
goog.ui.PopupBase.prototype.setType=function(a){this.type_=a};goog.ui.PopupBase.prototype.shouldHideAsync=function(){return this.shouldHideAsync_};goog.ui.PopupBase.prototype.setShouldHideAsync=function(a){this.shouldHideAsync_=a};goog.ui.PopupBase.prototype.getElement=function(){return this.element_};goog.ui.PopupBase.prototype.setElement=function(a){this.ensureNotVisible_();this.element_=a};goog.ui.PopupBase.prototype.getAutoHide=function(){return this.autoHide_};
goog.ui.PopupBase.prototype.setAutoHide=function(a){this.ensureNotVisible_();this.autoHide_=a};goog.ui.PopupBase.prototype.getHideOnEscape=function(){return this.hideOnEscape_};goog.ui.PopupBase.prototype.setHideOnEscape=function(a){this.ensureNotVisible_();this.hideOnEscape_=a};goog.ui.PopupBase.prototype.getEnableCrossIframeDismissal=function(){return this.enableCrossIframeDismissal_};goog.ui.PopupBase.prototype.setEnableCrossIframeDismissal=function(a){this.enableCrossIframeDismissal_=a};
goog.ui.PopupBase.prototype.getAutoHideRegion=function(){return this.autoHideRegion_};goog.ui.PopupBase.prototype.setAutoHideRegion=function(a){this.autoHideRegion_=a};goog.ui.PopupBase.prototype.setTransition=function(a,b){this.showTransition_=a;this.hideTransition_=b};goog.ui.PopupBase.prototype.getLastShowTime=function(){return this.lastShowTime_};goog.ui.PopupBase.prototype.getLastHideTime=function(){return this.lastHideTime_};
goog.ui.PopupBase.prototype.ensureNotVisible_=function(){if(this.isVisible_)throw Error("Can not change this state of the popup while showing.");};goog.ui.PopupBase.prototype.isVisible=function(){return this.isVisible_};goog.ui.PopupBase.prototype.isOrWasRecentlyVisible=function(){return this.isVisible_||goog.now()-this.lastHideTime_<goog.ui.PopupBase.DEBOUNCE_DELAY_MS};
goog.ui.PopupBase.prototype.setVisible=function(a){this.showTransition_&&this.showTransition_.stop();this.hideTransition_&&this.hideTransition_.stop();a?this.show_():this.hide_()};goog.ui.PopupBase.prototype.reposition=goog.nullFunction;
goog.ui.PopupBase.prototype.show_=function(){if(!this.isVisible_&&this.onBeforeShow()){if(!this.element_)throw Error("Caller must call setElement before trying to show the popup");this.reposition();var a=goog.dom.getOwnerDocument(this.element_);this.hideOnEscape_&&this.handler_.listen(a,goog.events.EventType.KEYDOWN,this.onDocumentKeyDown_,!0);if(this.autoHide_)if(this.handler_.listen(a,goog.events.EventType.MOUSEDOWN,this.onDocumentMouseDown_,!0),goog.userAgent.IE){var b;try{b=a.activeElement}catch(c){}for(;b&&
"IFRAME"==b.nodeName;){try{var d=goog.dom.getFrameContentDocument(b)}catch(e){break}a=d;b=a.activeElement}this.handler_.listen(a,goog.events.EventType.MOUSEDOWN,this.onDocumentMouseDown_,!0);this.handler_.listen(a,goog.events.EventType.DEACTIVATE,this.onDocumentBlur_)}else this.handler_.listen(a,goog.events.EventType.BLUR,this.onDocumentBlur_);this.type_==goog.ui.PopupBase.Type.TOGGLE_DISPLAY?this.showPopupElement():this.type_==goog.ui.PopupBase.Type.MOVE_OFFSCREEN&&this.reposition();this.isVisible_=
!0;if(this.showTransition_)goog.events.listenOnce(this.showTransition_,goog.fx.Transition.EventType.END,this.onShow_,!1,this),this.showTransition_.play();else this.onShow_()}};
goog.ui.PopupBase.prototype.hide_=function(a){if(!this.isVisible_||!this.onBeforeHide_(a))return!1;this.handler_&&this.handler_.removeAll();this.hideTransition_?(goog.events.listenOnce(this.hideTransition_,goog.fx.Transition.EventType.END,goog.partial(this.continueHidingPopup_,a),!1,this),this.hideTransition_.play()):this.continueHidingPopup_(a);return!0};
goog.ui.PopupBase.prototype.continueHidingPopup_=function(a){this.type_==goog.ui.PopupBase.Type.TOGGLE_DISPLAY?this.shouldHideAsync_?goog.Timer.callOnce(this.hidePopupElement_,0,this):this.hidePopupElement_():this.type_==goog.ui.PopupBase.Type.MOVE_OFFSCREEN&&this.moveOffscreen_();this.isVisible_=!1;this.onHide_(a)};goog.ui.PopupBase.prototype.showPopupElement=function(){this.element_.style.visibility="visible";goog.style.showElement(this.element_,!0)};
goog.ui.PopupBase.prototype.hidePopupElement_=function(){this.element_.style.visibility="hidden";goog.style.showElement(this.element_,!1)};goog.ui.PopupBase.prototype.moveOffscreen_=function(){this.element_.style.left="-200px";this.element_.style.top="-200px"};goog.ui.PopupBase.prototype.onBeforeShow=function(){return this.dispatchEvent(goog.ui.PopupBase.EventType.BEFORE_SHOW)};goog.ui.PopupBase.prototype.onShow_=function(){this.lastShowTime_=goog.now();this.lastHideTime_=-1;this.dispatchEvent(goog.ui.PopupBase.EventType.SHOW)};
goog.ui.PopupBase.prototype.onBeforeHide_=function(a){return this.dispatchEvent({type:goog.ui.PopupBase.EventType.BEFORE_HIDE,target:a})};goog.ui.PopupBase.prototype.onHide_=function(a){this.lastHideTime_=goog.now();this.dispatchEvent({type:goog.ui.PopupBase.EventType.HIDE,target:a})};goog.ui.PopupBase.prototype.onDocumentMouseDown_=function(a){a=a.target;!goog.dom.contains(this.element_,a)&&(!this.autoHideRegion_||goog.dom.contains(this.autoHideRegion_,a))&&!this.shouldDebounce_()&&this.hide_(a)};
goog.ui.PopupBase.prototype.onDocumentKeyDown_=function(a){a.keyCode==goog.events.KeyCodes.ESC&&this.hide_(a.target)&&(a.preventDefault(),a.stopPropagation())};goog.ui.PopupBase.prototype.onDocumentBlur_=function(a){if(this.enableCrossIframeDismissal_){var b=goog.dom.getOwnerDocument(this.element_);if(goog.userAgent.IE||goog.userAgent.OPERA){if(a=b.activeElement,!a||goog.dom.contains(this.element_,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;this.shouldDebounce_()||this.hide_()}};
goog.ui.PopupBase.prototype.shouldDebounce_=function(){return goog.now()-this.lastShowTime_<goog.ui.PopupBase.DEBOUNCE_DELAY_MS};goog.ui.PopupBase.prototype.disposeInternal=function(){goog.ui.PopupBase.superClass_.disposeInternal.call(this);this.handler_.dispose();goog.dispose(this.showTransition_);goog.dispose(this.hideTransition_);delete this.element_;delete this.handler_};goog.events.FocusHandler=function(a){goog.events.EventTarget.call(this);this.element_=a;a=goog.userAgent.IE?"focusout":"blur";this.listenKeyIn_=goog.events.listen(this.element_,goog.userAgent.IE?"focusin":"focus",this,!goog.userAgent.IE);this.listenKeyOut_=goog.events.listen(this.element_,a,this,!goog.userAgent.IE)};goog.inherits(goog.events.FocusHandler,goog.events.EventTarget);goog.events.FocusHandler.EventType={FOCUSIN:"focusin",FOCUSOUT:"focusout"};
goog.events.FocusHandler.prototype.handleEvent=function(a){var b=a.getBrowserEvent(),b=new goog.events.BrowserEvent(b);b.type="focusin"==a.type||"focus"==a.type?goog.events.FocusHandler.EventType.FOCUSIN:goog.events.FocusHandler.EventType.FOCUSOUT;try{this.dispatchEvent(b)}finally{b.dispose()}};
goog.events.FocusHandler.prototype.disposeInternal=function(){goog.events.FocusHandler.superClass_.disposeInternal.call(this);goog.events.unlistenByKey(this.listenKeyIn_);goog.events.unlistenByKey(this.listenKeyOut_);delete this.element_};goog.dom.iframe={};goog.dom.iframe.BLANK_SOURCE='javascript:""';goog.dom.iframe.STYLES_="border:0;vertical-align:bottom;";goog.dom.iframe.createBlank=function(a,b){return a.createDom("iframe",{frameborder:0,style:goog.dom.iframe.STYLES_+(b||""),src:goog.dom.iframe.BLANK_SOURCE})};goog.dom.iframe.writeContent=function(a,b){var c=goog.dom.getFrameContentDocument(a);c.open();c.write(b);c.close()};
goog.dom.iframe.createWithContent=function(a,b,c,d,e){var f=goog.dom.getDomHelper(a),g=[];e||g.push("<!DOCTYPE html>");g.push("<html><head>",b,"</head><body>",c,"</body></html>");b=goog.dom.iframe.createBlank(f,d);a.appendChild(b);goog.dom.iframe.writeContent(b,g.join(""));return b};goog.ui.ModalPopup=function(a,b){goog.ui.Component.call(this,b);this.useIframeMask_=!!a};goog.inherits(goog.ui.ModalPopup,goog.ui.Component);goog.ui.ModalPopup.prototype.focusHandler_=null;goog.ui.ModalPopup.prototype.visible_=!1;goog.ui.ModalPopup.prototype.bgEl_=null;goog.ui.ModalPopup.prototype.bgIframeEl_=null;goog.ui.ModalPopup.prototype.tabCatcherElement_=null;goog.ui.ModalPopup.prototype.getCssClass=function(){return"goog-modalpopup"};goog.ui.ModalPopup.prototype.getBackgroundIframe=function(){return this.bgIframeEl_};
goog.ui.ModalPopup.prototype.getBackgroundElement=function(){return this.bgEl_};goog.ui.ModalPopup.prototype.createDom=function(){goog.ui.ModalPopup.superClass_.createDom.call(this);var a=this.getElement();goog.dom.classes.add(a,this.getCssClass());goog.dom.setFocusableTabIndex(a,!0);goog.style.showElement(a,!1);this.manageBackgroundDom_();this.createTabCatcher_()};
goog.ui.ModalPopup.prototype.manageBackgroundDom_=function(){if(this.useIframeMask_&&!this.bgIframeEl_)this.bgIframeEl_=goog.dom.iframe.createBlank(this.getDomHelper()),this.bgIframeEl_.className=this.getCssClass()+"-bg",goog.style.showElement(this.bgIframeEl_,!1),goog.style.setOpacity(this.bgIframeEl_,0);if(!this.bgEl_)this.bgEl_=this.getDomHelper().createDom("div",this.getCssClass()+"-bg"),goog.style.showElement(this.bgEl_,!1)};
goog.ui.ModalPopup.prototype.createTabCatcher_=function(){if(!this.tabCatcherElement_)this.tabCatcherElement_=this.getDomHelper().createElement("span"),goog.style.showElement(this.tabCatcherElement_,!1),goog.dom.setFocusableTabIndex(this.tabCatcherElement_,!0),this.tabCatcherElement_.style.position="absolute"};
goog.ui.ModalPopup.prototype.renderBackground_=function(){goog.asserts.assert(!!this.bgEl_,"Background element must not be null.");this.bgIframeEl_&&goog.dom.insertSiblingBefore(this.bgIframeEl_,this.getElement());goog.dom.insertSiblingBefore(this.bgEl_,this.getElement())};goog.ui.ModalPopup.prototype.canDecorate=function(a){return!!a&&a.tagName==goog.dom.TagName.DIV};
goog.ui.ModalPopup.prototype.decorateInternal=function(a){goog.ui.ModalPopup.superClass_.decorateInternal.call(this,a);goog.dom.classes.add(this.getElement(),this.getCssClass());this.manageBackgroundDom_();this.createTabCatcher_();goog.style.showElement(this.getElement(),!1)};
goog.ui.ModalPopup.prototype.enterDocument=function(){this.renderBackground_();goog.ui.ModalPopup.superClass_.enterDocument.call(this);goog.dom.insertSiblingAfter(this.tabCatcherElement_,this.getElement());this.focusHandler_=new goog.events.FocusHandler(this.getDomHelper().getDocument());this.getHandler().listen(this.focusHandler_,goog.events.FocusHandler.EventType.FOCUSIN,this.onFocus_)};
goog.ui.ModalPopup.prototype.exitDocument=function(){this.isVisible()&&this.setVisible(!1);goog.dispose(this.focusHandler_);goog.ui.ModalPopup.superClass_.exitDocument.call(this);goog.dom.removeNode(this.bgIframeEl_);goog.dom.removeNode(this.bgEl_);goog.dom.removeNode(this.tabCatcherElement_)};goog.ui.ModalPopup.prototype.setVisible=function(a){goog.asserts.assert(this.isInDocument(),"ModalPopup must be rendered first.");a!=this.visible_&&(a?this.show_():this.hide_())};
goog.ui.ModalPopup.prototype.show_=function(){if(this.dispatchEvent(goog.ui.PopupBase.EventType.BEFORE_SHOW))this.resizeBackground_(),this.reposition(),this.getHandler().listen(this.getDomHelper().getWindow(),goog.events.EventType.RESIZE,this.resizeBackground_),this.showPopupElement_(!0),this.focus(),this.visible_=!0,this.dispatchEvent(goog.ui.PopupBase.EventType.SHOW)};
goog.ui.ModalPopup.prototype.hide_=function(){if(this.dispatchEvent(goog.ui.PopupBase.EventType.BEFORE_HIDE))this.getHandler().unlisten(this.getDomHelper().getWindow(),goog.events.EventType.RESIZE,this.resizeBackground_),this.showPopupElement_(!1),this.visible_=!1,this.dispatchEvent(goog.ui.PopupBase.EventType.HIDE)};
goog.ui.ModalPopup.prototype.showPopupElement_=function(a){this.bgIframeEl_&&goog.style.showElement(this.bgIframeEl_,a);this.bgEl_&&goog.style.showElement(this.bgEl_,a);goog.style.showElement(this.getElement(),a);goog.style.showElement(this.tabCatcherElement_,a)};goog.ui.ModalPopup.prototype.isVisible=function(){return this.visible_};goog.ui.ModalPopup.prototype.focus=function(){this.focusElement_()};
goog.ui.ModalPopup.prototype.resizeBackground_=function(){this.bgIframeEl_&&goog.style.showElement(this.bgIframeEl_,!1);this.bgEl_&&goog.style.showElement(this.bgEl_,!1);var a=this.getDomHelper().getDocument(),b=goog.dom.getWindow(a)||window,c=goog.dom.getViewportSize(b),b=Math.max(a.body.scrollWidth,c.width),a=Math.max(a.body.scrollHeight,c.height);this.bgIframeEl_&&(goog.style.showElement(this.bgIframeEl_,!0),goog.style.setSize(this.bgIframeEl_,b,a));this.bgEl_&&(goog.style.showElement(this.bgEl_,
!0),goog.style.setSize(this.bgEl_,b,a))};
goog.ui.ModalPopup.prototype.reposition=function(){var a=this.getDomHelper().getDocument(),b=goog.dom.getWindow(a)||window;if("fixed"==goog.style.getComputedPosition(this.getElement()))var c=a=0;else c=this.getDomHelper().getDocumentScroll(),a=c.x,c=c.y;var d=goog.style.getSize(this.getElement()),b=goog.dom.getViewportSize(b),a=Math.max(a+b.width/2-d.width/2,0),c=Math.max(c+b.height/2-d.height/2,0);goog.style.setPosition(this.getElement(),a,c);goog.style.setPosition(this.tabCatcherElement_,a,c)};
goog.ui.ModalPopup.prototype.onFocus_=function(a){a.target==this.tabCatcherElement_&&goog.Timer.callOnce(this.focusElement_,0,this)};goog.ui.ModalPopup.prototype.focusElement_=function(){try{goog.userAgent.IE&&this.getDomHelper().getDocument().body.focus(),this.getElement().focus()}catch(a){}};goog.dom.a11y={};
goog.dom.a11y.State={ACTIVEDESCENDANT:"activedescendant",ATOMIC:"atomic",AUTOCOMPLETE:"autocomplete",BUSY:"busy",CHECKED:"checked",CONTROLS:"controls",DESCRIBEDBY:"describedby",DISABLED:"disabled",DROPEFFECT:"dropeffect",EXPANDED:"expanded",FLOWTO:"flowto",GRABBED:"grabbed",HASPOPUP:"haspopup",HIDDEN:"hidden",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",LIVE:"live",MULTILINE:"multiline",MULTISELECTABLE:"multiselectable",ORIENTATION:"orientation",OWNS:"owns",POSINSET:"posinset",
PRESSED:"pressed",READONLY:"readonly",RELEVANT:"relevant",REQUIRED:"required",SELECTED:"selected",SETSIZE:"setsize",SORT:"sort",VALUEMAX:"valuemax",VALUEMIN:"valuemin",VALUENOW:"valuenow",VALUETEXT:"valuetext"};
goog.dom.a11y.Role={ALERT:"alert",ALERTDIALOG:"alertdialog",APPLICATION:"application",ARTICLE:"article",BANNER:"banner",BUTTON:"button",CHECKBOX:"checkbox",COLUMNHEADER:"columnheader",COMBOBOX:"combobox",COMPLEMENTARY:"complementary",DIALOG:"dialog",DIRECTORY:"directory",DOCUMENT:"document",FORM:"form",GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",HEADING:"heading",IMG:"img",LINK:"link",LIST:"list",LISTBOX:"listbox",LISTITEM:"listitem",LOG:"log",MAIN:"main",MARQUEE:"marquee",MATH:"math",MENU:"menu",
MENUBAR:"menubar",MENU_ITEM:"menuitem",MENU_ITEM_CHECKBOX:"menuitemcheckbox",MENU_ITEM_RADIO:"menuitemradio",NAVIGATION:"navigation",NOTE:"note",OPTION:"option",PRESENTATION:"presentation",PROGRESSBAR:"progressbar",RADIO:"radio",RADIOGROUP:"radiogroup",REGION:"region",ROW:"row",ROWGROUP:"rowgroup",ROWHEADER:"rowheader",SCROLLBAR:"scrollbar",SEARCH:"search",SEPARATOR:"separator",SLIDER:"slider",SPINBUTTON:"spinbutton",STATUS:"status",TAB:"tab",TAB_LIST:"tablist",TAB_PANEL:"tabpanel",TEXTBOX:"textbox",
TIMER:"timer",TOOLBAR:"toolbar",TOOLTIP:"tooltip",TREE:"tree",TREEGRID:"treegrid",TREEITEM:"treeitem"};goog.dom.a11y.LivePriority={OFF:"off",POLITE:"polite",ASSERTIVE:"assertive"};goog.dom.a11y.setRole=function(a,b){a.setAttribute("role",b);a.roleName=b};goog.dom.a11y.getRole=function(a){return a.roleName||""};goog.dom.a11y.setState=function(a,b,c){a.setAttribute("aria-"+b,c)};goog.dom.a11y.getState=function(a,b){var c=a.getAttribute("aria-"+b);return!0===c||!1===c?c?"true":"false":c?""+c:""};
goog.dom.a11y.getActiveDescendant=function(a){var b=goog.dom.a11y.getState(a,goog.dom.a11y.State.ACTIVEDESCENDANT);return goog.dom.getOwnerDocument(a).getElementById(b)};goog.dom.a11y.setActiveDescendant=function(a,b){goog.dom.a11y.setState(a,goog.dom.a11y.State.ACTIVEDESCENDANT,b?b.id:"")};goog.dom.a11y.Announcer=function(a){goog.Disposable.call(this);this.domHelper_=a;this.liveRegions_={}};goog.inherits(goog.dom.a11y.Announcer,goog.Disposable);
goog.dom.a11y.Announcer.prototype.disposeInternal=function(){goog.object.forEach(this.liveRegions_,this.domHelper_.removeNode,this.domHelper_);this.domHelper_=this.liveRegions_=null;goog.dom.a11y.Announcer.superClass_.disposeInternal.call(this)};goog.dom.a11y.Announcer.prototype.say=function(a,b){goog.dom.setTextContent(this.getLiveRegion_(b||goog.dom.a11y.LivePriority.POLITE),a)};
goog.dom.a11y.Announcer.prototype.getLiveRegion_=function(a){if(this.liveRegions_[a])return this.liveRegions_[a];var b;b=this.domHelper_.createElement("div");b.style.position="absolute";b.style.top="-1000px";goog.dom.a11y.setState(b,"live",a);goog.dom.a11y.setState(b,"atomic","true");this.domHelper_.getDocument().body.appendChild(b);return this.liveRegions_[a]=b};goog.ui.Dialog=function(a,b,c){goog.ui.ModalPopup.call(this,b,c);this.class_=a||"modal-dialog";this.buttons_=goog.ui.Dialog.ButtonSet.createOkCancel()};goog.inherits(goog.ui.Dialog,goog.ui.ModalPopup);goog.ui.Dialog.prototype.escapeToCancel_=!0;goog.ui.Dialog.prototype.hasTitleCloseButton_=!0;goog.ui.Dialog.prototype.modal_=!0;goog.ui.Dialog.prototype.draggable_=!0;goog.ui.Dialog.prototype.backgroundElementOpacity_=0.5;goog.ui.Dialog.prototype.title_="";goog.ui.Dialog.prototype.content_="";
goog.ui.Dialog.prototype.dragger_=null;goog.ui.Dialog.prototype.disposeOnHide_=!1;goog.ui.Dialog.prototype.titleEl_=null;goog.ui.Dialog.prototype.titleTextEl_=null;goog.ui.Dialog.prototype.titleId_=null;goog.ui.Dialog.prototype.titleCloseEl_=null;goog.ui.Dialog.prototype.contentEl_=null;goog.ui.Dialog.prototype.buttonEl_=null;goog.ui.Dialog.prototype.getCssClass=function(){return this.class_};
goog.ui.Dialog.prototype.setTitle=function(a){this.title_=a;this.titleTextEl_&&goog.dom.setTextContent(this.titleTextEl_,a)};goog.ui.Dialog.prototype.getTitle=function(){return this.title_};goog.ui.Dialog.prototype.setContent=function(a){this.content_=a;if(this.contentEl_)this.contentEl_.innerHTML=a};goog.ui.Dialog.prototype.getContent=function(){return this.content_};goog.ui.Dialog.prototype.renderIfNoDom_=function(){this.getElement()||this.render()};
goog.ui.Dialog.prototype.getContentElement=function(){this.renderIfNoDom_();return this.contentEl_};goog.ui.Dialog.prototype.getTitleElement=function(){this.renderIfNoDom_();return this.titleEl_};goog.ui.Dialog.prototype.getTitleTextElement=function(){this.renderIfNoDom_();return this.titleTextEl_};goog.ui.Dialog.prototype.getTitleCloseElement=function(){this.renderIfNoDom_();return this.titleCloseEl_};goog.ui.Dialog.prototype.getButtonElement=function(){this.renderIfNoDom_();return this.buttonEl_};
goog.ui.Dialog.prototype.getDialogElement=function(){this.renderIfNoDom_();return this.getElement()};goog.ui.Dialog.prototype.getBackgroundElement=function(){this.renderIfNoDom_();return goog.ui.Dialog.superClass_.getBackgroundElement.call(this)};goog.ui.Dialog.prototype.getBackgroundElementOpacity=function(){return this.backgroundElementOpacity_};
goog.ui.Dialog.prototype.setBackgroundElementOpacity=function(a){this.backgroundElementOpacity_=a;this.getElement()&&(a=this.getBackgroundElement())&&goog.style.setOpacity(a,this.backgroundElementOpacity_)};goog.ui.Dialog.prototype.setModal=function(a){a!=this.modal_&&this.setModalInternal_(a)};
goog.ui.Dialog.prototype.setModalInternal_=function(a){this.modal_=a;if(this.isInDocument()){var b=this.getDomHelper(),c=this.getBackgroundElement(),d=this.getBackgroundIframe();a?(d&&b.insertSiblingBefore(d,this.getElement()),b.insertSiblingBefore(c,this.getElement())):(b.removeNode(d),b.removeNode(c))}};goog.ui.Dialog.prototype.getModal=function(){return this.modal_};goog.ui.Dialog.prototype.getClass=function(){return this.getCssClass()};
goog.ui.Dialog.prototype.setDraggable=function(a){this.draggable_=a;this.setDraggingEnabled_(a&&this.isInDocument())};goog.ui.Dialog.prototype.createDragger=function(){return new goog.fx.Dragger(this.getElement(),this.titleEl_)};goog.ui.Dialog.prototype.getDraggable=function(){return this.draggable_};
goog.ui.Dialog.prototype.setDraggingEnabled_=function(a){this.getElement()&&goog.dom.classes.enable(this.titleEl_,this.class_+"-title-draggable",a);if(a&&!this.dragger_)this.dragger_=this.createDragger(),goog.dom.classes.add(this.titleEl_,this.class_+"-title-draggable"),goog.events.listen(this.dragger_,goog.fx.Dragger.EventType.START,this.setDraggerLimits_,!1,this);else if(!a&&this.dragger_)this.dragger_.dispose(),this.dragger_=null};
goog.ui.Dialog.prototype.createDom=function(){goog.ui.Dialog.superClass_.createDom.call(this);var a=this.getElement();goog.asserts.assert(a,"getElement() returns null");var b=this.getDomHelper();this.titleEl_=b.createDom("div",{className:this.class_+"-title",id:this.getId()},this.titleTextEl_=b.createDom("span",this.class_+"-title-text",this.title_),this.titleCloseEl_=b.createDom("span",this.class_+"-title-close"));goog.dom.append(a,this.titleEl_,this.contentEl_=b.createDom("div",this.class_+"-content"),
this.buttonEl_=b.createDom("div",this.class_+"-buttons"));this.titleId_=this.titleEl_.id;goog.dom.a11y.setRole(a,"dialog");goog.dom.a11y.setState(a,"labelledby",this.titleId_||"");if(this.content_)this.contentEl_.innerHTML=this.content_;goog.style.showElement(this.titleCloseEl_,this.hasTitleCloseButton_);this.buttons_&&this.buttons_.attachToElement(this.buttonEl_);goog.style.showElement(this.buttonEl_,!!this.buttons_);this.setBackgroundElementOpacity(this.backgroundElementOpacity_)};
goog.ui.Dialog.prototype.decorateInternal=function(a){goog.ui.Dialog.superClass_.decorateInternal.call(this,a);a=this.class_+"-content";if(this.contentEl_=goog.dom.getElementsByTagNameAndClass(null,a,this.getElement())[0])this.content_=this.contentEl_.innerHTML;else{this.contentEl_=this.getDomHelper().createDom("div",a);if(this.content_)this.contentEl_.innerHTML=this.content_;this.getElement().appendChild(this.contentEl_)}var a=this.class_+"-title",b=this.class_+"-title-text",c=this.class_+"-title-close";
(this.titleEl_=goog.dom.getElementsByTagNameAndClass(null,a,this.getElement())[0])?(this.titleTextEl_=goog.dom.getElementsByTagNameAndClass(null,b,this.titleEl_)[0],this.titleCloseEl_=goog.dom.getElementsByTagNameAndClass(null,c,this.titleEl_)[0]):(this.titleEl_=this.getDomHelper().createDom("div",a),this.getElement().insertBefore(this.titleEl_,this.contentEl_));this.titleTextEl_?this.title_=goog.dom.getTextContent(this.titleTextEl_):(this.titleTextEl_=this.getDomHelper().createDom("span",b,this.title_),
this.titleEl_.appendChild(this.titleTextEl_));goog.dom.a11y.setState(this.getElement(),"labelledby",this.titleId_||"");if(!this.titleCloseEl_)this.titleCloseEl_=this.getDomHelper().createDom("span",c),this.titleEl_.appendChild(this.titleCloseEl_);goog.style.showElement(this.titleCloseEl_,this.hasTitleCloseButton_);a=this.class_+"-buttons";(this.buttonEl_=goog.dom.getElementsByTagNameAndClass(null,a,this.getElement())[0])?(this.buttons_=new goog.ui.Dialog.ButtonSet(this.getDomHelper()),this.buttons_.decorate(this.buttonEl_)):
(this.buttonEl_=this.getDomHelper().createDom("div",a),this.getElement().appendChild(this.buttonEl_),this.buttons_&&this.buttons_.attachToElement(this.buttonEl_),goog.style.showElement(this.buttonEl_,!!this.buttons_));this.setBackgroundElementOpacity(this.backgroundElementOpacity_)};
goog.ui.Dialog.prototype.enterDocument=function(){goog.ui.Dialog.superClass_.enterDocument.call(this);this.getHandler().listen(this,[goog.ui.PopupBase.EventType.SHOW,goog.ui.PopupBase.EventType.HIDE],this.setVisibleInternal_);this.setDraggingEnabled_(this.draggable_);this.getHandler().listen(this.titleCloseEl_,goog.events.EventType.CLICK,this.onTitleCloseClick_);goog.dom.a11y.setRole(this.getElement(),"dialog");""!==this.titleTextEl_.id&&goog.dom.a11y.setState(this.getElement(),"labelledby",this.titleTextEl_.id);
this.modal_||this.setModalInternal_(!1)};goog.ui.Dialog.prototype.exitDocument=function(){this.isVisible()&&this.setVisible(!1);this.setDraggingEnabled_(!1);goog.ui.Dialog.superClass_.exitDocument.call(this)};goog.ui.Dialog.prototype.setVisible=function(a){a!=this.isVisible()&&(this.isInDocument()||this.render(),goog.ui.Dialog.superClass_.setVisible.call(this,a))};
goog.ui.Dialog.prototype.setVisibleInternal_=function(a){a.target==this&&(this.isVisible()?(this.getHandler().listen(this.getElement(),goog.events.EventType.KEYDOWN,this.onKey_).listen(this.getElement(),goog.events.EventType.KEYPRESS,this.onKey_),this.dispatchEvent(goog.ui.Dialog.EventType.AFTER_SHOW),this.getHandler().listen(this.buttonEl_,goog.events.EventType.CLICK,this.onButtonClick_)):(this.getHandler().unlisten(this.getElement(),goog.events.EventType.KEYDOWN,this.onKey_).unlisten(this.getElement(),
goog.events.EventType.KEYPRESS,this.onKey_).unlisten(this.buttonEl_,goog.events.EventType.CLICK,this.onButtonClick_),this.dispatchEvent(goog.ui.Dialog.EventType.AFTER_HIDE),this.disposeOnHide_&&this.dispose()))};
goog.ui.Dialog.prototype.focus=function(){goog.ui.Dialog.superClass_.focus.call(this);if(this.getButtonSet()){var a=this.getButtonSet().getDefault();if(a)for(var b=this.getDomHelper().getDocument(),c=this.buttonEl_.getElementsByTagName("button"),d=0,e;e=c[d];d++)if(e.name==a){try{if(goog.userAgent.WEBKIT||goog.userAgent.OPERA){var f=b.createElement("input");f.style.cssText="position:fixed;width:0;height:0;left:0;top:0;";this.getElement().appendChild(f);f.focus();this.getElement().removeChild(f)}e.focus()}catch(g){}break}}};
goog.ui.Dialog.prototype.setDraggerLimits_=function(){var a=this.getDomHelper().getDocument(),b=goog.dom.getWindow(a)||window,b=goog.dom.getViewportSize(b),c=Math.max(a.body.scrollWidth,b.width),a=Math.max(a.body.scrollHeight,b.height),d=goog.style.getSize(this.getElement());"fixed"==goog.style.getComputedPosition(this.getElement())?this.dragger_.setLimits(new goog.math.Rect(0,0,Math.max(0,b.width-d.width),Math.max(0,b.height-d.height))):this.dragger_.setLimits(new goog.math.Rect(0,0,c-d.width,a-
d.height))};goog.ui.Dialog.prototype.onTitleCloseClick_=function(){if(this.hasTitleCloseButton_){var a=this.getButtonSet(),b=a&&a.getCancel();b?(a=a.get(b),this.dispatchEvent(new goog.ui.Dialog.Event(b,a))&&this.setVisible(!1)):this.setVisible(!1)}};goog.ui.Dialog.prototype.getHasTitleCloseButton=function(){return this.hasTitleCloseButton_};goog.ui.Dialog.prototype.setHasTitleCloseButton=function(a){this.hasTitleCloseButton_=a;this.titleCloseEl_&&goog.style.showElement(this.titleCloseEl_,this.hasTitleCloseButton_)};
goog.ui.Dialog.prototype.isEscapeToCancel=function(){return this.escapeToCancel_};goog.ui.Dialog.prototype.setEscapeToCancel=function(a){this.escapeToCancel_=a};goog.ui.Dialog.prototype.setDisposeOnHide=function(a){this.disposeOnHide_=a};goog.ui.Dialog.prototype.getDisposeOnHide=function(){return this.disposeOnHide_};goog.ui.Dialog.prototype.disposeInternal=function(){this.buttonEl_=this.titleCloseEl_=null;goog.ui.Dialog.superClass_.disposeInternal.call(this)};
goog.ui.Dialog.prototype.setButtonSet=function(a){this.buttons_=a;if(this.buttonEl_)this.buttons_?this.buttons_.attachToElement(this.buttonEl_):this.buttonEl_.innerHTML="",goog.style.showElement(this.buttonEl_,!!this.buttons_)};goog.ui.Dialog.prototype.getButtonSet=function(){return this.buttons_};goog.ui.Dialog.prototype.onButtonClick_=function(a){if((a=this.findParentButton_(a.target))&&!a.disabled){var a=a.name,b=this.getButtonSet().get(a);this.dispatchEvent(new goog.ui.Dialog.Event(a,b))&&this.setVisible(!1)}};
goog.ui.Dialog.prototype.findParentButton_=function(a){for(;null!=a&&a!=this.buttonEl_;){if("BUTTON"==a.tagName)return a;a=a.parentNode}return null};
goog.ui.Dialog.prototype.onKey_=function(a){var b=!1,c=!1,d=this.getButtonSet(),e=a.target;if(a.type==goog.events.EventType.KEYDOWN)if(this.escapeToCancel_&&a.keyCode==goog.events.KeyCodes.ESC){var f=d&&d.getCancel(),e="SELECT"==e.tagName&&!e.disabled;f&&!e?(c=!0,b=d.get(f),b=this.dispatchEvent(new goog.ui.Dialog.Event(f,b))):e||(b=!0)}else a.keyCode==goog.events.KeyCodes.TAB&&a.shiftKey&&e==this.getElement()&&(c=!0);else if(a.keyCode==goog.events.KeyCodes.ENTER){if("BUTTON"==e.tagName)f=e.name;else if(d){var g=
d.getDefault(),h=g&&d.getButton(g),e=("TEXTAREA"==e.tagName||"SELECT"==e.tagName)&&!e.disabled;h&&!h.disabled&&!e&&(f=g)}f&&d&&(c=!0,b=this.dispatchEvent(new goog.ui.Dialog.Event(f,""+d.get(f))))}if(b||c)a.stopPropagation(),a.preventDefault();b&&this.setVisible(!1)};goog.ui.Dialog.Event=function(a,b){this.type=goog.ui.Dialog.EventType.SELECT;this.key=a;this.caption=b};goog.inherits(goog.ui.Dialog.Event,goog.events.Event);goog.ui.Dialog.SELECT_EVENT="dialogselect";
goog.ui.Dialog.EventType={SELECT:"dialogselect",AFTER_HIDE:"afterhide",AFTER_SHOW:"aftershow"};goog.ui.Dialog.ButtonSet=function(a){this.dom_=a||goog.dom.getDomHelper();goog.structs.Map.call(this)};goog.inherits(goog.ui.Dialog.ButtonSet,goog.structs.Map);goog.ui.Dialog.ButtonSet.prototype.class_="goog-buttonset";goog.ui.Dialog.ButtonSet.prototype.defaultButton_=null;goog.ui.Dialog.ButtonSet.prototype.element_=null;goog.ui.Dialog.ButtonSet.prototype.cancelButton_=null;
goog.ui.Dialog.ButtonSet.prototype.set=function(a,b,c,d){goog.structs.Map.prototype.set.call(this,a,b);if(c)this.defaultButton_=a;if(d)this.cancelButton_=a;return this};goog.ui.Dialog.ButtonSet.prototype.addButton=function(a,b,c){return this.set(a.key,a.caption,b,c)};goog.ui.Dialog.ButtonSet.prototype.attachToElement=function(a){this.element_=a;this.render()};
goog.ui.Dialog.ButtonSet.prototype.render=function(){if(this.element_){this.element_.innerHTML="";var a=goog.dom.getDomHelper(this.element_);goog.structs.forEach(this,function(b,c){var d=a.createDom("button",{name:c},b);if(c==this.defaultButton_)d.className=this.class_+"-default";this.element_.appendChild(d)},this)}};
goog.ui.Dialog.ButtonSet.prototype.decorate=function(a){if(a&&a.nodeType==goog.dom.NodeType.ELEMENT){this.element_=a;for(var a=this.element_.getElementsByTagName("button"),b=0,c,d,e;c=a[b];b++)if(d=c.name||c.id,e=goog.dom.getTextContent(c)||c.value,d){var f=0==b;this.set(d,e,f,c.name==goog.ui.Dialog.DefaultButtonKeys.CANCEL);f&&goog.dom.classes.add(c,this.class_+"-default")}}};goog.ui.Dialog.ButtonSet.prototype.getElement=function(){return this.element_};
goog.ui.Dialog.ButtonSet.prototype.getDomHelper=function(){return this.dom_};goog.ui.Dialog.ButtonSet.prototype.setDefault=function(a){this.defaultButton_=a};goog.ui.Dialog.ButtonSet.prototype.getDefault=function(){return this.defaultButton_};goog.ui.Dialog.ButtonSet.prototype.setCancel=function(a){this.cancelButton_=a};goog.ui.Dialog.ButtonSet.prototype.getCancel=function(){return this.cancelButton_};
goog.ui.Dialog.ButtonSet.prototype.getButton=function(a){for(var b=this.getAllButtons(),c=0,d;d=b[c];c++)if(d.name==a||d.id==a)return d;return null};goog.ui.Dialog.ButtonSet.prototype.getAllButtons=function(){return this.element_.getElementsByTagName(goog.dom.TagName.BUTTON)};goog.ui.Dialog.ButtonSet.prototype.setButtonEnabled=function(a,b){var c=this.getButton(a);if(c)c.disabled=!b};
goog.ui.Dialog.ButtonSet.prototype.setAllButtonsEnabled=function(a){for(var b=this.getAllButtons(),c=0,d;d=b[c];c++)d.disabled=!a};goog.ui.Dialog.DefaultButtonKeys={OK:"ok",CANCEL:"cancel",YES:"yes",NO:"no",SAVE:"save",CONTINUE:"continue"};goog.ui.Dialog.MSG_DIALOG_OK_=goog.getMsg("OK");goog.ui.Dialog.MSG_DIALOG_CANCEL_=goog.getMsg("Cancel");goog.ui.Dialog.MSG_DIALOG_YES_=goog.getMsg("Yes");goog.ui.Dialog.MSG_DIALOG_NO_=goog.getMsg("No");goog.ui.Dialog.MSG_DIALOG_SAVE_=goog.getMsg("Save");
goog.ui.Dialog.MSG_DIALOG_CONTINUE_=goog.getMsg("Continue");goog.ui.Dialog.DefaultButtonCaptions={OK:goog.ui.Dialog.MSG_DIALOG_OK_,CANCEL:goog.ui.Dialog.MSG_DIALOG_CANCEL_,YES:goog.ui.Dialog.MSG_DIALOG_YES_,NO:goog.ui.Dialog.MSG_DIALOG_NO_,SAVE:goog.ui.Dialog.MSG_DIALOG_SAVE_,CONTINUE:goog.ui.Dialog.MSG_DIALOG_CONTINUE_};
goog.ui.Dialog.ButtonSet.DefaultButtons={OK:{key:goog.ui.Dialog.DefaultButtonKeys.OK,caption:goog.ui.Dialog.DefaultButtonCaptions.OK},CANCEL:{key:goog.ui.Dialog.DefaultButtonKeys.CANCEL,caption:goog.ui.Dialog.DefaultButtonCaptions.CANCEL},YES:{key:goog.ui.Dialog.DefaultButtonKeys.YES,caption:goog.ui.Dialog.DefaultButtonCaptions.YES},NO:{key:goog.ui.Dialog.DefaultButtonKeys.NO,caption:goog.ui.Dialog.DefaultButtonCaptions.NO},SAVE:{key:goog.ui.Dialog.DefaultButtonKeys.SAVE,caption:goog.ui.Dialog.DefaultButtonCaptions.SAVE},
CONTINUE:{key:goog.ui.Dialog.DefaultButtonKeys.CONTINUE,caption:goog.ui.Dialog.DefaultButtonCaptions.CONTINUE}};goog.ui.Dialog.ButtonSet.createOk=function(){return(new goog.ui.Dialog.ButtonSet).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.OK,!0,!0)};goog.ui.Dialog.ButtonSet.createOkCancel=function(){return(new goog.ui.Dialog.ButtonSet).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.OK,!0).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.CANCEL,!1,!0)};
goog.ui.Dialog.ButtonSet.createYesNo=function(){return(new goog.ui.Dialog.ButtonSet).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.YES,!0).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.NO,!1,!0)};goog.ui.Dialog.ButtonSet.createYesNoCancel=function(){return(new goog.ui.Dialog.ButtonSet).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.YES).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.NO,!0).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.CANCEL,!1,!0)};
goog.ui.Dialog.ButtonSet.createContinueSaveCancel=function(){return(new goog.ui.Dialog.ButtonSet).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.CONTINUE).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.SAVE).addButton(goog.ui.Dialog.ButtonSet.DefaultButtons.CANCEL,!0,!0)};
(function(){if("undefined"!=typeof document)goog.ui.Dialog.ButtonSet.OK=goog.ui.Dialog.ButtonSet.createOk(),goog.ui.Dialog.ButtonSet.OK_CANCEL=goog.ui.Dialog.ButtonSet.createOkCancel(),goog.ui.Dialog.ButtonSet.YES_NO=goog.ui.Dialog.ButtonSet.createYesNo(),goog.ui.Dialog.ButtonSet.YES_NO_CANCEL=goog.ui.Dialog.ButtonSet.createYesNoCancel(),goog.ui.Dialog.ButtonSet.CONTINUE_SAVE_CANCEL=goog.ui.Dialog.ButtonSet.createContinueSaveCancel()})();goog.ui.RangeModel=function(){goog.events.EventTarget.call(this)};goog.inherits(goog.ui.RangeModel,goog.events.EventTarget);goog.ui.RangeModel.prototype.value_=0;goog.ui.RangeModel.prototype.minimum_=0;goog.ui.RangeModel.prototype.maximum_=100;goog.ui.RangeModel.prototype.extent_=0;goog.ui.RangeModel.prototype.step_=1;goog.ui.RangeModel.prototype.isChanging_=!1;goog.ui.RangeModel.prototype.mute_=!1;goog.ui.RangeModel.prototype.setMute=function(a){this.mute_=a};
goog.ui.RangeModel.prototype.setValue=function(a){a=this.roundToStepWithMin(a);if(this.value_!=a)this.value_=a+this.extent_>this.maximum_?this.maximum_-this.extent_:a<this.minimum_?this.minimum_:a,!this.isChanging_&&!this.mute_&&this.dispatchEvent(goog.ui.Component.EventType.CHANGE)};goog.ui.RangeModel.prototype.getValue=function(){return this.roundToStepWithMin(this.value_)};
goog.ui.RangeModel.prototype.setExtent=function(a){a=this.roundToStepWithMin(a);if(this.extent_!=a)this.extent_=0>a?0:this.value_+a>this.maximum_?this.maximum_-this.value_:a,!this.isChanging_&&!this.mute_&&this.dispatchEvent(goog.ui.Component.EventType.CHANGE)};goog.ui.RangeModel.prototype.getExtent=function(){return this.roundToStep(this.extent_)};
goog.ui.RangeModel.prototype.setMinimum=function(a){if(this.minimum_!=a){var b=this.isChanging_;this.isChanging_=!0;this.minimum_=a;if(a+this.extent_>this.maximum_)this.extent_=this.maximum_-this.minimum_;a>this.value_&&this.setValue(a);if(a>this.maximum_)this.extent_=0,this.setMaximum(a),this.setValue(a);this.isChanging_=b;!this.isChanging_&&!this.mute_&&this.dispatchEvent(goog.ui.Component.EventType.CHANGE)}};goog.ui.RangeModel.prototype.getMinimum=function(){return this.roundToStepWithMin(this.minimum_)};
goog.ui.RangeModel.prototype.setMaximum=function(a){a=this.roundToStepWithMin(a);if(this.maximum_!=a){var b=this.isChanging_;this.isChanging_=!0;this.maximum_=a;a<this.value_+this.extent_&&this.setValue(a-this.extent_);if(a<this.minimum_)this.extent_=0,this.setMinimum(a),this.setValue(this.maximum_);if(a<this.minimum_+this.extent_)this.extent_=this.maximum_-this.minimum_;this.isChanging_=b;!this.isChanging_&&!this.mute_&&this.dispatchEvent(goog.ui.Component.EventType.CHANGE)}};
goog.ui.RangeModel.prototype.getMaximum=function(){return this.roundToStepWithMin(this.maximum_)};goog.ui.RangeModel.prototype.getStep=function(){return this.step_};goog.ui.RangeModel.prototype.setStep=function(a){if(this.step_!=a)this.step_=a,a=this.isChanging_,this.isChanging_=!0,this.setMaximum(this.getMaximum()),this.setExtent(this.getExtent()),this.setValue(this.getValue()),this.isChanging_=a,!this.isChanging_&&!this.mute_&&this.dispatchEvent(goog.ui.Component.EventType.CHANGE)};
goog.ui.RangeModel.prototype.roundToStepWithMin=function(a){return null==this.step_?a:this.minimum_+Math.round((a-this.minimum_)/this.step_)*this.step_};goog.ui.RangeModel.prototype.roundToStep=function(a){return null==this.step_?a:Math.round(a/this.step_)*this.step_};goog.ui.ProgressBar=function(a){goog.ui.Component.call(this,a);this.rangeModel_=new goog.ui.RangeModel;goog.events.listen(this.rangeModel_,goog.ui.Component.EventType.CHANGE,this.handleChange_,!1,this)};goog.inherits(goog.ui.ProgressBar,goog.ui.Component);goog.ui.ProgressBar.Orientation={VERTICAL:"vertical",HORIZONTAL:"horizontal"};goog.ui.ProgressBar.ORIENTATION_TO_CSS_NAME_={};goog.ui.ProgressBar.ORIENTATION_TO_CSS_NAME_[goog.ui.ProgressBar.Orientation.VERTICAL]="progress-bar-vertical";
goog.ui.ProgressBar.ORIENTATION_TO_CSS_NAME_[goog.ui.ProgressBar.Orientation.HORIZONTAL]="progress-bar-horizontal";goog.ui.ProgressBar.prototype.createDom=function(){this.thumbElement_=this.createThumb_();var a=goog.ui.ProgressBar.ORIENTATION_TO_CSS_NAME_[this.orientation_];this.setElementInternal(this.getDomHelper().createDom("div",a,this.thumbElement_));this.setValueState_();this.setMinimumState_();this.setMaximumState_()};
goog.ui.ProgressBar.prototype.enterDocument=function(){goog.ui.ProgressBar.superClass_.enterDocument.call(this);this.attachEvents_();this.updateUi_();goog.dom.a11y.setRole(this.getElement(),"progressbar");goog.dom.a11y.setState(this.getElement(),"live","polite")};goog.ui.ProgressBar.prototype.exitDocument=function(){goog.ui.ProgressBar.superClass_.exitDocument.call(this);this.detachEvents_()};goog.ui.ProgressBar.prototype.createThumb_=function(){return this.getDomHelper().createDom("div","progress-bar-thumb")};
goog.ui.ProgressBar.prototype.attachEvents_=function(){goog.userAgent.IE&&7>goog.userAgent.VERSION&&goog.events.listen(this.getElement(),goog.events.EventType.RESIZE,this.updateUi_,!1,this)};goog.ui.ProgressBar.prototype.detachEvents_=function(){goog.userAgent.IE&&7>goog.userAgent.VERSION&&goog.events.unlisten(this.getElement(),goog.events.EventType.RESIZE,this.updateUi_,!1,this)};
goog.ui.ProgressBar.prototype.decorateInternal=function(a){goog.ui.ProgressBar.superClass_.decorateInternal.call(this,a);goog.dom.classes.add(this.getElement(),goog.ui.ProgressBar.ORIENTATION_TO_CSS_NAME_[this.orientation_]);a=goog.dom.getElementsByTagNameAndClass(null,"progress-bar-thumb",this.getElement())[0];a||(a=this.createThumb_(),this.getElement().appendChild(a));this.thumbElement_=a};goog.ui.ProgressBar.prototype.getValue=function(){return this.rangeModel_.getValue()};
goog.ui.ProgressBar.prototype.setValue=function(a){this.rangeModel_.setValue(a);this.getElement()&&this.setValueState_()};goog.ui.ProgressBar.prototype.setValueState_=function(){goog.dom.a11y.setState(this.getElement(),"valuenow",this.getValue())};goog.ui.ProgressBar.prototype.getMinimum=function(){return this.rangeModel_.getMinimum()};goog.ui.ProgressBar.prototype.setMinimum=function(a){this.rangeModel_.setMinimum(a);this.getElement()&&this.setMinimumState_()};
goog.ui.ProgressBar.prototype.setMinimumState_=function(){goog.dom.a11y.setState(this.getElement(),"valuemin",this.getMinimum())};goog.ui.ProgressBar.prototype.getMaximum=function(){return this.rangeModel_.getMaximum()};goog.ui.ProgressBar.prototype.setMaximum=function(a){this.rangeModel_.setMaximum(a);this.getElement()&&this.setMaximumState_()};goog.ui.ProgressBar.prototype.setMaximumState_=function(){goog.dom.a11y.setState(this.getElement(),"valuemax",this.getMaximum())};
goog.ui.ProgressBar.prototype.orientation_=goog.ui.ProgressBar.Orientation.HORIZONTAL;goog.ui.ProgressBar.prototype.handleChange_=function(){this.updateUi_();this.dispatchEvent(goog.ui.Component.EventType.CHANGE)};
goog.ui.ProgressBar.prototype.updateUi_=function(){if(this.thumbElement_){var a=this.getMinimum(),b=this.getMaximum(),a=(this.getValue()-a)/(b-a),b=Math.round(100*a);this.orientation_==goog.ui.ProgressBar.Orientation.VERTICAL?goog.userAgent.IE&&7>goog.userAgent.VERSION?(this.thumbElement_.style.top=0,this.thumbElement_.style.height="100%",b=this.thumbElement_.offsetHeight,a=Math.round(a*b),this.thumbElement_.style.top=b-a+"px",this.thumbElement_.style.height=a+"px"):(this.thumbElement_.style.top=
100-b+"%",this.thumbElement_.style.height=b+"%"):this.thumbElement_.style.width=b+"%"}};goog.ui.ProgressBar.prototype.initializeUi_=function(){var a=this.thumbElement_.style;this.orientation_==goog.ui.ProgressBar.Orientation.VERTICAL?(a.left=0,a.width="100%"):(a.top=a.left=0,a.height="100%")};
goog.ui.ProgressBar.prototype.setOrientation=function(a){if(this.orientation_!=a){var b=goog.ui.ProgressBar.ORIENTATION_TO_CSS_NAME_[this.orientation_],c=goog.ui.ProgressBar.ORIENTATION_TO_CSS_NAME_[a];this.orientation_=a;this.getElement()&&(goog.dom.classes.swap(this.getElement(),b,c),this.initializeUi_(),this.updateUi_())}};goog.ui.ProgressBar.prototype.getOrientation=function(){return this.orientation_};
goog.ui.ProgressBar.prototype.disposeInternal=function(){this.detachEvents_();goog.ui.ProgressBar.superClass_.disposeInternal.call(this);this.thumbElement_=null;this.rangeModel_.dispose()};goog.ui.ProgressBar.prototype.getStep=function(){return this.rangeModel_.getStep()};goog.ui.ProgressBar.prototype.setStep=function(a){this.rangeModel_.setStep(a)};X.progressbar=function(a,b){if(!goog.isDefAndNotNull(a))throw new X.exception("No valid parent element!");if(!goog.isDefAndNotNull(b))throw new X.exception("Invalid initial value!");goog.ui.ProgressBar.call(this);this._className="progressbar";this._parent=a;this._doneProgressBar=this._style=null;this._css=[];var c;this._css=[".progress-bar-horizontal {\n position: relative;\n border: 1px solid #949dad;\n background: white;\n padding: 1px;\n overflow: hidden;\n margin: 2px;\n width: 100px;\n height: 5px;\n}",
".progress-bar-thumb {\n position: relative;\n background: #F62217;\n overflow: hidden;\n width: 0%;\n height: 100%;\n}",".progress-bar-thumb-done {\n background: #57E964;\n}"];this.setValue(b);this.init_()};goog.inherits(X.progressbar,goog.ui.ProgressBar);
X.progressbar.prototype.init_=function(){this._parent.style.position="relative";var a=goog.dom.getDocument().getElementsByTagName("head")[0],b=goog.dom.createDom("style");b.type="text/css";b.media="screen";var c=goog.dom.createTextNode(this._css[0]),d=goog.dom.createTextNode(this._css[1]),e=goog.dom.createTextNode(this._css[2]);goog.dom.appendChild(a,b);goog.dom.appendChild(b,c);goog.dom.appendChild(b,d);goog.dom.appendChild(b,e);this._style=b;this.render(this._parent);a=this.getElement();a.style.position=
"absolute";a.style.top=(this._parent.clientHeight-5)/2;a.style.left=(this._parent.clientWidth-100)/2};X.progressbar.prototype.done=function(){var a=this.getElement().style.top,b=this.getElement().style.left;goog.dom.removeNode(this.getElement());var c=new X.progressbar(this._parent,100),d=c.getElement();d.style.position="absolute";d.style.top=a;d.style.left=b;goog.dom.getFirstElementChild(d).classList.add("progress-bar-thumb-done");this._doneProgressBar=c};
X.progressbar.prototype.kill=function(){this._style&&goog.dom.removeNode(this._style);this.getElement()&&goog.dom.removeNode(this.getElement());this._doneProgressBar&&goog.dom.removeNode(this._doneProgressBar.getElement());this._doneProgressBar=this._style=null};goog.exportSymbol("X.progressbar",X.progressbar);goog.exportSymbol("X.progressbar.prototype.done",X.progressbar.prototype.done);goog.exportSymbol("X.progressbar.prototype.kill",X.progressbar.prototype.kill);X.buffer=function(a,b,c){if(!goog.isDefAndNotNull(a))throw new X.exception("Invalid GL Buffer!");if(!goog.isDefAndNotNull(b))throw new X.exception("Invalid number of items!");if(!goog.isDefAndNotNull(c))throw new X.exception("Invalid item size!");X.base.call(this);this._className="buffer";this._glBuffer=a;this._itemCount=b;this._itemSize=c};goog.inherits(X.buffer,X.base);X.buffer.prototype.glBuffer=function(){return this._glBuffer};X.buffer.prototype.itemCount=function(){return this._itemCount};
X.buffer.prototype.itemSize=function(){return this._itemSize};goog.exportSymbol("X.buffer",X.buffer);goog.exportSymbol("X.buffer.prototype.glBuffer",X.buffer.prototype.glBuffer);goog.exportSymbol("X.buffer.prototype.itemCount",X.buffer.prototype.itemCount);goog.exportSymbol("X.buffer.prototype.itemSize",X.buffer.prototype.itemSize);goog.positioning={};goog.positioning.Corner={TOP_LEFT:0,TOP_RIGHT:2,BOTTOM_LEFT:1,BOTTOM_RIGHT:3,TOP_START:4,TOP_END:6,BOTTOM_START:5,BOTTOM_END:7};goog.positioning.CornerBit={BOTTOM:1,RIGHT:2,FLIP_RTL:4};goog.positioning.Overflow={IGNORE:0,ADJUST_X:1,FAIL_X:2,ADJUST_Y:4,FAIL_Y:8,RESIZE_WIDTH:16,RESIZE_HEIGHT:32,ADJUST_X_EXCEPT_OFFSCREEN:65,ADJUST_Y_EXCEPT_OFFSCREEN:132};
goog.positioning.OverflowStatus={NONE:0,ADJUSTED_X:1,ADJUSTED_Y:2,WIDTH_ADJUSTED:4,HEIGHT_ADJUSTED:8,FAILED_LEFT:16,FAILED_RIGHT:32,FAILED_TOP:64,FAILED_BOTTOM:128,FAILED_OUTSIDE_VIEWPORT:256};goog.positioning.OverflowStatus.FAILED=goog.positioning.OverflowStatus.FAILED_LEFT|goog.positioning.OverflowStatus.FAILED_RIGHT|goog.positioning.OverflowStatus.FAILED_TOP|goog.positioning.OverflowStatus.FAILED_BOTTOM|goog.positioning.OverflowStatus.FAILED_OUTSIDE_VIEWPORT;
goog.positioning.OverflowStatus.FAILED_HORIZONTAL=goog.positioning.OverflowStatus.FAILED_LEFT|goog.positioning.OverflowStatus.FAILED_RIGHT;goog.positioning.OverflowStatus.FAILED_VERTICAL=goog.positioning.OverflowStatus.FAILED_TOP|goog.positioning.OverflowStatus.FAILED_BOTTOM;
goog.positioning.positionAtAnchor=function(a,b,c,d,e,f,g,h){var i,j=c.offsetParent;if(j){var k=j.tagName==goog.dom.TagName.HTML||j.tagName==goog.dom.TagName.BODY;if(!k||"static"!=goog.style.getComputedPosition(j))i=goog.style.getPageOffset(j),k||(i=goog.math.Coordinate.difference(i,new goog.math.Coordinate(j.scrollLeft,j.scrollTop)))}j=goog.positioning.getVisiblePart_(a);goog.style.translateRectForAnotherFrame(j,goog.dom.getDomHelper(a),goog.dom.getDomHelper(c));a=goog.positioning.getEffectiveCorner(a,
b);b=new goog.math.Coordinate(a&goog.positioning.CornerBit.RIGHT?j.left+j.width:j.left,a&goog.positioning.CornerBit.BOTTOM?j.top+j.height:j.top);i&&(b=goog.math.Coordinate.difference(b,i));e&&(b.x+=(a&goog.positioning.CornerBit.RIGHT?-1:1)*e.x,b.y+=(a&goog.positioning.CornerBit.BOTTOM?-1:1)*e.y);var l;if(g&&(l=goog.style.getVisibleRectForElement(c))&&i)l.top-=i.y,l.right-=i.x,l.bottom-=i.y,l.left-=i.x;return goog.positioning.positionAtCoordinate(b,c,d,f,l,g,h)};
goog.positioning.getVisiblePart_=function(a){var b=goog.style.getBounds(a);(a=goog.style.getVisibleRectForElement(a))&&b.intersection(goog.math.Rect.createFromBox(a));return b};
goog.positioning.positionAtCoordinate=function(a,b,c,d,e,f,g){var a=a.clone(),h=goog.positioning.OverflowStatus.NONE,c=goog.positioning.getEffectiveCorner(b,c),i=goog.style.getSize(b),g=g?g.clone():i.clone();if(d||c!=goog.positioning.Corner.TOP_LEFT)c&goog.positioning.CornerBit.RIGHT?a.x-=g.width+(d?d.right:0):d&&(a.x+=d.left),c&goog.positioning.CornerBit.BOTTOM?a.y-=g.height+(d?d.bottom:0):d&&(a.y+=d.top);if(f&&(h=e?goog.positioning.adjustForViewport_(a,g,e,f):goog.positioning.OverflowStatus.FAILED_OUTSIDE_VIEWPORT,
h&goog.positioning.OverflowStatus.FAILED))return h;goog.style.setPosition(b,a);goog.math.Size.equals(i,g)||goog.style.setBorderBoxSize(b,g);return h};
goog.positioning.adjustForViewport_=function(a,b,c,d){var e=goog.positioning.OverflowStatus.NONE,f=goog.positioning.Overflow.ADJUST_X_EXCEPT_OFFSCREEN,g=goog.positioning.Overflow.ADJUST_Y_EXCEPT_OFFSCREEN;if((d&f)==f&&(a.x<c.left||a.x>=c.right))d&=~goog.positioning.Overflow.ADJUST_X;if((d&g)==g&&(a.y<c.top||a.y>=c.bottom))d&=~goog.positioning.Overflow.ADJUST_Y;if(a.x<c.left&&d&goog.positioning.Overflow.ADJUST_X)a.x=c.left,e|=goog.positioning.OverflowStatus.ADJUSTED_X;if(a.x<c.left&&a.x+b.width>c.right&&
d&goog.positioning.Overflow.RESIZE_WIDTH)b.width=Math.max(b.width-(a.x+b.width-c.right),0),e|=goog.positioning.OverflowStatus.WIDTH_ADJUSTED;if(a.x+b.width>c.right&&d&goog.positioning.Overflow.ADJUST_X)a.x=Math.max(c.right-b.width,c.left),e|=goog.positioning.OverflowStatus.ADJUSTED_X;d&goog.positioning.Overflow.FAIL_X&&(e|=(a.x<c.left?goog.positioning.OverflowStatus.FAILED_LEFT:0)|(a.x+b.width>c.right?goog.positioning.OverflowStatus.FAILED_RIGHT:0));if(a.y<c.top&&d&goog.positioning.Overflow.ADJUST_Y)a.y=
c.top,e|=goog.positioning.OverflowStatus.ADJUSTED_Y;if(a.y>=c.top&&a.y+b.height>c.bottom&&d&goog.positioning.Overflow.RESIZE_HEIGHT)b.height=Math.max(b.height-(a.y+b.height-c.bottom),0),e|=goog.positioning.OverflowStatus.HEIGHT_ADJUSTED;if(a.y+b.height>c.bottom&&d&goog.positioning.Overflow.ADJUST_Y)a.y=Math.max(c.bottom-b.height,c.top),e|=goog.positioning.OverflowStatus.ADJUSTED_Y;d&goog.positioning.Overflow.FAIL_Y&&(e|=(a.y<c.top?goog.positioning.OverflowStatus.FAILED_TOP:0)|(a.y+b.height>c.bottom?
goog.positioning.OverflowStatus.FAILED_BOTTOM:0));return e};goog.positioning.getEffectiveCorner=function(a,b){return(b&goog.positioning.CornerBit.FLIP_RTL&&goog.style.isRightToLeft(a)?b^goog.positioning.CornerBit.RIGHT:b)&~goog.positioning.CornerBit.FLIP_RTL};goog.positioning.flipCornerHorizontal=function(a){return a^goog.positioning.CornerBit.RIGHT};goog.positioning.flipCornerVertical=function(a){return a^goog.positioning.CornerBit.BOTTOM};
goog.positioning.flipCorner=function(a){return a^goog.positioning.CornerBit.BOTTOM^goog.positioning.CornerBit.RIGHT};goog.positioning.AbstractPosition=function(){};goog.positioning.AbstractPosition.prototype.reposition=function(){};goog.positioning.ViewportPosition=function(a,b){this.coordinate=a instanceof goog.math.Coordinate?a:new goog.math.Coordinate(a,b)};goog.inherits(goog.positioning.ViewportPosition,goog.positioning.AbstractPosition);goog.positioning.ViewportPosition.prototype.reposition=function(a,b,c,d){goog.positioning.positionAtAnchor(goog.style.getClientViewportElement(a),goog.positioning.Corner.TOP_LEFT,a,b,this.coordinate,c,null,d)};goog.positioning.AnchoredPosition=function(a,b){this.element=a;this.corner=b};goog.inherits(goog.positioning.AnchoredPosition,goog.positioning.AbstractPosition);goog.positioning.AnchoredPosition.prototype.reposition=function(a,b,c){goog.positioning.positionAtAnchor(this.element,this.corner,a,b,void 0,c)};goog.positioning.ClientPosition=function(a,b){this.coordinate=a instanceof goog.math.Coordinate?a:new goog.math.Coordinate(a,b)};goog.inherits(goog.positioning.ClientPosition,goog.positioning.AbstractPosition);goog.positioning.ClientPosition.prototype.reposition=function(a,b,c,d){var e=goog.style.getClientViewportElement(a),f=new goog.math.Coordinate(this.coordinate.x+e.scrollLeft,this.coordinate.y+e.scrollTop);goog.positioning.positionAtAnchor(e,goog.positioning.Corner.TOP_LEFT,a,b,f,c,null,d)};goog.positioning.ViewportClientPosition=function(a,b){goog.positioning.ClientPosition.call(this,a,b)};goog.inherits(goog.positioning.ViewportClientPosition,goog.positioning.ClientPosition);goog.positioning.ViewportClientPosition.prototype.lastResortOverflow_=0;goog.positioning.ViewportClientPosition.prototype.setLastResortOverflow=function(a){this.lastResortOverflow_=a};
goog.positioning.ViewportClientPosition.prototype.reposition=function(a,b,c,d){var e=goog.style.getClientViewportElement(a),e=goog.style.getVisibleRectForElement(e),f=goog.dom.getDomHelper(a).getDocumentScrollElement(),f=new goog.math.Coordinate(this.coordinate.x+f.scrollLeft,this.coordinate.y+f.scrollTop),g=goog.positioning.Overflow.FAIL_X|goog.positioning.Overflow.FAIL_Y,h=b,i=goog.positioning.positionAtCoordinate(f,a,h,c,e,g,d);if(0!=(i&goog.positioning.OverflowStatus.FAILED)){if(i&goog.positioning.OverflowStatus.FAILED_LEFT||
i&goog.positioning.OverflowStatus.FAILED_RIGHT)h=goog.positioning.flipCornerHorizontal(h);if(i&goog.positioning.OverflowStatus.FAILED_TOP||i&goog.positioning.OverflowStatus.FAILED_BOTTOM)h=goog.positioning.flipCornerVertical(h);i=goog.positioning.positionAtCoordinate(f,a,h,c,e,g,d);0!=(i&goog.positioning.OverflowStatus.FAILED)&&goog.positioning.positionAtCoordinate(f,a,b,c,e,this.lastResortOverflow_,d)}};goog.positioning.AbsolutePosition=function(a,b){this.coordinate=a instanceof goog.math.Coordinate?a:new goog.math.Coordinate(a,b)};goog.inherits(goog.positioning.AbsolutePosition,goog.positioning.AbstractPosition);goog.positioning.AbsolutePosition.prototype.reposition=function(a,b,c,d){goog.positioning.positionAtCoordinate(this.coordinate,a,b,c,null,null,d)};goog.functions={};goog.functions.constant=function(a){return function(){return a}};goog.functions.FALSE=goog.functions.constant(!1);goog.functions.TRUE=goog.functions.constant(!0);goog.functions.NULL=goog.functions.constant(null);goog.functions.identity=function(a){return a};goog.functions.error=function(a){return function(){throw Error(a);}};goog.functions.lock=function(a){return function(){return a.call(this)}};goog.functions.withReturnValue=function(a,b){return goog.functions.sequence(a,goog.functions.constant(b))};
goog.functions.compose=function(a){var b=arguments,c=b.length;return function(){var a;c&&(a=b[c-1].apply(this,arguments));for(var e=c-2;0<=e;e--)a=b[e].call(this,a);return a}};goog.functions.sequence=function(a){var b=arguments,c=b.length;return function(){for(var a,e=0;e<c;e++)a=b[e].apply(this,arguments);return a}};goog.functions.and=function(a){var b=arguments,c=b.length;return function(){for(var a=0;a<c;a++)if(!b[a].apply(this,arguments))return!1;return!0}};
goog.functions.or=function(a){var b=arguments,c=b.length;return function(){for(var a=0;a<c;a++)if(b[a].apply(this,arguments))return!0;return!1}};goog.functions.not=function(a){return function(){return!a.apply(this,arguments)}};goog.functions.create=function(a,b){var c=function(){};c.prototype=a.prototype;c=new c;a.apply(c,Array.prototype.slice.call(arguments,1));return c};goog.positioning.AnchoredViewportPosition=function(a,b,c){goog.positioning.AnchoredPosition.call(this,a,b);this.adjust_=c};goog.inherits(goog.positioning.AnchoredViewportPosition,goog.positioning.AnchoredPosition);goog.positioning.AnchoredViewportPosition.prototype.getLastResortOverflow=function(){return goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.ADJUST_Y};
goog.positioning.AnchoredViewportPosition.prototype.reposition=function(a,b,c,d){var e=goog.positioning.positionAtAnchor(this.element,this.corner,a,b,null,c,goog.positioning.Overflow.FAIL_X|goog.positioning.Overflow.FAIL_Y,d);if(e&goog.positioning.OverflowStatus.FAILED){var f=this.correctCorner_(e,this.corner),b=this.correctCorner_(e,b),e=goog.positioning.positionAtAnchor(this.element,f,a,b,null,c,goog.positioning.Overflow.FAIL_X|goog.positioning.Overflow.FAIL_Y,d);e&goog.positioning.OverflowStatus.FAILED&&
(f=this.correctCorner_(e,f),b=this.correctCorner_(e,b),this.adjust_?goog.positioning.positionAtAnchor(this.element,f,a,b,null,c,this.getLastResortOverflow(),d):goog.positioning.positionAtAnchor(this.element,f,a,b,null,c,goog.positioning.Overflow.IGNORE,d))}};
goog.positioning.AnchoredViewportPosition.prototype.correctCorner_=function(a,b){a&goog.positioning.OverflowStatus.FAILED_HORIZONTAL&&(b=goog.positioning.flipCornerHorizontal(b));a&goog.positioning.OverflowStatus.FAILED_VERTICAL&&(b=goog.positioning.flipCornerVertical(b));return b};goog.ui.Popup=function(a,b){this.popupCorner_=goog.positioning.Corner.TOP_START;this.position_=b||void 0;goog.ui.PopupBase.call(this,a)};goog.inherits(goog.ui.Popup,goog.ui.PopupBase);goog.ui.Popup.Corner=goog.positioning.Corner;goog.ui.Popup.Overflow=goog.positioning.Overflow;goog.ui.Popup.prototype.getPinnedCorner=function(){return this.popupCorner_};goog.ui.Popup.prototype.setPinnedCorner=function(a){this.popupCorner_=a;this.isVisible()&&this.reposition()};
goog.ui.Popup.prototype.getPosition=function(){return this.position_||null};goog.ui.Popup.prototype.setPosition=function(a){this.position_=a||void 0;this.isVisible()&&this.reposition()};goog.ui.Popup.prototype.getMargin=function(){return this.margin_||null};goog.ui.Popup.prototype.setMargin=function(a,b,c,d){this.margin_=null==a||a instanceof goog.math.Box?a:new goog.math.Box(a,b,c,d);this.isVisible()&&this.reposition()};
goog.ui.Popup.prototype.reposition=function(){if(this.position_){var a=!this.isVisible()&&this.getType()!=goog.ui.PopupBase.Type.MOVE_OFFSCREEN,b=this.getElement();if(a)b.style.visibility="hidden",goog.style.showElement(b,!0);this.position_.reposition(b,this.popupCorner_,this.margin_);a&&goog.style.showElement(b,!1)}};goog.ui.Popup.positionPopup=function(a,b,c,d,e,f,g){return 0==(goog.positioning.positionAtAnchor(a,b,c,d,e,f,g)&goog.positioning.OverflowStatus.FAILED)};
goog.ui.Popup.positionAtCoordinate=function(a,b,c,d){goog.positioning.positionAtCoordinate(a,b,c,d);return!0};goog.ui.Popup.AnchoredPosition=goog.positioning.AnchoredPosition;goog.ui.Popup.AnchoredViewPortPosition=goog.positioning.AnchoredViewportPosition;goog.ui.Popup.AbsolutePosition=goog.positioning.AbsolutePosition;goog.ui.Popup.ViewPortPosition=goog.positioning.ViewportPosition;goog.ui.Popup.ClientPosition=goog.positioning.ClientPosition;goog.ui.Popup.ViewPortClientPosition=goog.positioning.ViewportClientPosition;goog.ui.Tooltip=function(a,b,c){this.dom_=c||(a?goog.dom.getDomHelper(goog.dom.getElement(a)):goog.dom.getDomHelper());goog.ui.Popup.call(this,this.dom_.createDom("div",{style:"position:absolute;display:none;"}));this.cursorPosition=new goog.math.Coordinate(1,1);this.elements_=new goog.structs.Set;a&&this.attach(a);null!=b&&this.setText(b)};goog.inherits(goog.ui.Tooltip,goog.ui.Popup);goog.ui.Tooltip.activeInstances_=[];goog.ui.Tooltip.prototype.activeEl_=null;
goog.ui.Tooltip.prototype.className="goog-tooltip";goog.ui.Tooltip.prototype.showDelayMs_=500;goog.ui.Tooltip.prototype.hideDelayMs_=0;goog.ui.Tooltip.State={INACTIVE:0,WAITING_TO_SHOW:1,SHOWING:2,WAITING_TO_HIDE:3,UPDATING:4};goog.ui.Tooltip.Activation={CURSOR:0,FOCUS:1};goog.ui.Tooltip.prototype.getDomHelper=function(){return this.dom_};goog.ui.Tooltip.prototype.getChildTooltip=function(){return this.childTooltip_};
goog.ui.Tooltip.prototype.attach=function(a){a=goog.dom.getElement(a);this.elements_.add(a);goog.events.listen(a,goog.events.EventType.MOUSEOVER,this.handleMouseOver,!1,this);goog.events.listen(a,goog.events.EventType.MOUSEOUT,this.handleMouseOutAndBlur,!1,this);goog.events.listen(a,goog.events.EventType.MOUSEMOVE,this.handleMouseMove,!1,this);goog.events.listen(a,goog.events.EventType.FOCUS,this.handleFocus,!1,this);goog.events.listen(a,goog.events.EventType.BLUR,this.handleMouseOutAndBlur,!1,this)};
goog.ui.Tooltip.prototype.detach=function(a){if(a)a=goog.dom.getElement(a),this.detachElement_(a),this.elements_.remove(a);else{for(var b=this.elements_.getValues(),c=0;a=b[c];c++)this.detachElement_(a);this.elements_.clear()}};
goog.ui.Tooltip.prototype.detachElement_=function(a){goog.events.unlisten(a,goog.events.EventType.MOUSEOVER,this.handleMouseOver,!1,this);goog.events.unlisten(a,goog.events.EventType.MOUSEOUT,this.handleMouseOutAndBlur,!1,this);goog.events.unlisten(a,goog.events.EventType.MOUSEMOVE,this.handleMouseMove,!1,this);goog.events.unlisten(a,goog.events.EventType.FOCUS,this.handleFocus,!1,this);goog.events.unlisten(a,goog.events.EventType.BLUR,this.handleMouseOutAndBlur,!1,this)};
goog.ui.Tooltip.prototype.setShowDelayMs=function(a){this.showDelayMs_=a};goog.ui.Tooltip.prototype.getShowDelayMs=function(){return this.showDelayMs_};goog.ui.Tooltip.prototype.setHideDelayMs=function(a){this.hideDelayMs_=a};goog.ui.Tooltip.prototype.getHideDelayMs=function(){return this.hideDelayMs_};goog.ui.Tooltip.prototype.setText=function(a){goog.dom.setTextContent(this.getElement(),a)};goog.ui.Tooltip.prototype.setHtml=function(a){this.getElement().innerHTML=a};
goog.ui.Tooltip.prototype.setElement=function(a){var b=this.getElement();b&&goog.dom.removeNode(b);goog.ui.Tooltip.superClass_.setElement.call(this,a);if(a)b=this.dom_.getDocument().body,b.insertBefore(a,b.lastChild)};goog.ui.Tooltip.prototype.getText=function(){return goog.dom.getTextContent(this.getElement())};goog.ui.Tooltip.prototype.getHtml=function(){return this.getElement().innerHTML};
goog.ui.Tooltip.prototype.getState=function(){return this.showTimer?this.isVisible()?goog.ui.Tooltip.State.UPDATING:goog.ui.Tooltip.State.WAITING_TO_SHOW:this.hideTimer?goog.ui.Tooltip.State.WAITING_TO_HIDE:this.isVisible()?goog.ui.Tooltip.State.SHOWING:goog.ui.Tooltip.State.INACTIVE};goog.ui.Tooltip.prototype.setRequireInteraction=function(a){this.requireInteraction_=a};
goog.ui.Tooltip.prototype.isCoordinateInTooltip=function(a){if(!this.isVisible())return!1;var b=goog.style.getPageOffset(this.getElement()),c=goog.style.getSize(this.getElement());return b.x<=a.x&&a.x<=b.x+c.width&&b.y<=a.y&&a.y<=b.y+c.height};
goog.ui.Tooltip.prototype.onBeforeShow=function(){if(!goog.ui.PopupBase.prototype.onBeforeShow.call(this))return!1;if(this.anchor)for(var a,b=0;a=goog.ui.Tooltip.activeInstances_[b];b++)goog.dom.contains(a.getElement(),this.anchor)||a.setVisible(!1);goog.array.insert(goog.ui.Tooltip.activeInstances_,this);a=this.getElement();a.className=this.className;this.clearHideTimer();goog.events.listen(a,goog.events.EventType.MOUSEOVER,this.handleTooltipMouseOver,!1,this);goog.events.listen(a,goog.events.EventType.MOUSEOUT,
this.handleTooltipMouseOut,!1,this);this.clearShowTimer();return!0};
goog.ui.Tooltip.prototype.onHide_=function(){goog.array.remove(goog.ui.Tooltip.activeInstances_,this);for(var a=this.getElement(),b,c=0;b=goog.ui.Tooltip.activeInstances_[c];c++)b.anchor&&goog.dom.contains(a,b.anchor)&&b.setVisible(!1);this.parentTooltip_&&this.parentTooltip_.startHideTimer();goog.events.unlisten(a,goog.events.EventType.MOUSEOVER,this.handleTooltipMouseOver,!1,this);goog.events.unlisten(a,goog.events.EventType.MOUSEOUT,this.handleTooltipMouseOut,!1,this);this.anchor=void 0;if(this.getState()==
goog.ui.Tooltip.State.INACTIVE)this.seenInteraction_=!1;goog.ui.PopupBase.prototype.onHide_.call(this)};goog.ui.Tooltip.prototype.maybeShow=function(a,b){if(this.anchor==a&&this.elements_.contains(this.anchor))this.seenInteraction_||!this.requireInteraction_?(this.setVisible(!1),this.isVisible()||this.positionAndShow_(a,b)):this.anchor=void 0;this.showTimer=void 0};goog.ui.Tooltip.prototype.getElements=function(){return this.elements_};goog.ui.Tooltip.prototype.getActiveElement=function(){return this.activeEl_};
goog.ui.Tooltip.prototype.setActiveElement=function(a){this.activeEl_=a};goog.ui.Tooltip.prototype.showForElement=function(a,b){this.attach(a);this.activeEl_=a;this.positionAndShow_(a,b)};goog.ui.Tooltip.prototype.positionAndShow_=function(a,b){this.anchor=a;this.setPosition(b||this.getPositioningStrategy(goog.ui.Tooltip.Activation.CURSOR));this.setVisible(!0)};
goog.ui.Tooltip.prototype.maybeHide=function(a){this.hideTimer=void 0;a==this.anchor&&(null==this.activeEl_||this.activeEl_!=this.getElement()&&!this.elements_.contains(this.activeEl_))&&!this.hasActiveChild()&&this.setVisible(!1)};goog.ui.Tooltip.prototype.hasActiveChild=function(){return!(!this.childTooltip_||!this.childTooltip_.activeEl_)};
goog.ui.Tooltip.prototype.saveCursorPosition_=function(a){var b=this.dom_.getDocumentScroll();this.cursorPosition.x=a.clientX+b.x;this.cursorPosition.y=a.clientY+b.y};goog.ui.Tooltip.prototype.handleMouseOver=function(a){var b=this.getAnchorFromElement(a.target);this.activeEl_=b;this.clearHideTimer();if(b!=this.anchor)this.anchor=b,this.startShowTimer(b),this.checkForParentTooltip_(),this.saveCursorPosition_(a)};
goog.ui.Tooltip.prototype.getAnchorFromElement=function(a){try{for(;a&&!this.elements_.contains(a);)a=a.parentNode;return a}catch(b){return null}};goog.ui.Tooltip.prototype.handleMouseMove=function(a){this.saveCursorPosition_(a);this.seenInteraction_=!0};
goog.ui.Tooltip.prototype.handleFocus=function(a){this.activeEl_=a=this.getAnchorFromElement(a.target);this.seenInteraction_=!0;if(this.anchor!=a){this.anchor=a;var b=this.getPositioningStrategy(goog.ui.Tooltip.Activation.FOCUS);this.clearHideTimer();this.startShowTimer(a,b);this.checkForParentTooltip_()}};goog.ui.Tooltip.prototype.getPositioningStrategy=function(a){return a==goog.ui.Tooltip.Activation.CURSOR?(a=this.cursorPosition.clone(),new goog.ui.Tooltip.CursorTooltipPosition(a)):new goog.ui.Tooltip.ElementTooltipPosition(this.activeEl_)};
goog.ui.Tooltip.prototype.checkForParentTooltip_=function(){if(this.anchor)for(var a,b=0;a=goog.ui.Tooltip.activeInstances_[b];b++)if(goog.dom.contains(a.getElement(),this.anchor))a.childTooltip_=this,this.parentTooltip_=a};
goog.ui.Tooltip.prototype.handleMouseOutAndBlur=function(a){var b=this.getAnchorFromElement(a.target),c=this.getAnchorFromElement(a.relatedTarget);if(b!=c){if(b==this.activeEl_)this.activeEl_=null;this.clearShowTimer();this.seenInteraction_=!1;this.isVisible()&&(!a.relatedTarget||!goog.dom.contains(this.getElement(),a.relatedTarget))?this.startHideTimer():this.anchor=void 0}};
goog.ui.Tooltip.prototype.handleTooltipMouseOver=function(){var a=this.getElement();if(this.activeEl_!=a)this.clearHideTimer(),this.activeEl_=a};goog.ui.Tooltip.prototype.handleTooltipMouseOut=function(a){var b=this.getElement();if(this.activeEl_==b&&(!a.relatedTarget||!goog.dom.contains(b,a.relatedTarget)))this.activeEl_=null,this.startHideTimer()};goog.ui.Tooltip.prototype.startShowTimer=function(a,b){if(!this.showTimer)this.showTimer=goog.Timer.callOnce(goog.bind(this.maybeShow,this,a,b),this.showDelayMs_)};
goog.ui.Tooltip.prototype.clearShowTimer=function(){if(this.showTimer)goog.Timer.clear(this.showTimer),this.showTimer=void 0};goog.ui.Tooltip.prototype.startHideTimer=function(){if(this.getState()==goog.ui.Tooltip.State.SHOWING)this.hideTimer=goog.Timer.callOnce(goog.bind(this.maybeHide,this,this.anchor),this.getHideDelayMs())};goog.ui.Tooltip.prototype.clearHideTimer=function(){if(this.hideTimer)goog.Timer.clear(this.hideTimer),this.hideTimer=void 0};
goog.ui.Tooltip.prototype.disposeInternal=function(){this.setVisible(!1);this.clearShowTimer();this.detach();this.getElement()&&goog.dom.removeNode(this.getElement());this.activeEl_=null;delete this.dom_;goog.ui.Tooltip.superClass_.disposeInternal.call(this)};goog.ui.Tooltip.CursorTooltipPosition=function(a,b){goog.positioning.ViewportPosition.call(this,a,b)};goog.inherits(goog.ui.Tooltip.CursorTooltipPosition,goog.positioning.ViewportPosition);
goog.ui.Tooltip.CursorTooltipPosition.prototype.reposition=function(a,b,c){b=goog.style.getClientViewportElement(a);b=goog.style.getVisibleRectForElement(b);c=c?new goog.math.Box(c.top+10,c.right,c.bottom,c.left+10):new goog.math.Box(10,0,0,10);goog.positioning.positionAtCoordinate(this.coordinate,a,goog.positioning.Corner.TOP_START,c,b,goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.FAIL_Y)&goog.positioning.OverflowStatus.FAILED&&goog.positioning.positionAtCoordinate(this.coordinate,
a,goog.positioning.Corner.TOP_START,c,b,goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.ADJUST_Y)};goog.ui.Tooltip.ElementTooltipPosition=function(a){goog.positioning.AnchoredPosition.call(this,a,goog.positioning.Corner.BOTTOM_RIGHT)};goog.inherits(goog.ui.Tooltip.ElementTooltipPosition,goog.positioning.AnchoredPosition);
goog.ui.Tooltip.ElementTooltipPosition.prototype.reposition=function(a,b,c){var d=new goog.math.Coordinate(10,0);goog.positioning.positionAtAnchor(this.element,this.corner,a,b,d,c,goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.FAIL_Y)&goog.positioning.OverflowStatus.FAILED&&goog.positioning.positionAtAnchor(this.element,goog.positioning.Corner.TOP_RIGHT,a,goog.positioning.Corner.BOTTOM_LEFT,d,c,goog.positioning.Overflow.ADJUST_X|goog.positioning.Overflow.ADJUST_Y)};goog.events.MouseWheelHandler=function(a){goog.events.EventTarget.call(this);this.element_=a;this.listenKey_=goog.events.listen(this.element_,goog.userAgent.GECKO?"DOMMouseScroll":"mousewheel",this)};goog.inherits(goog.events.MouseWheelHandler,goog.events.EventTarget);goog.events.MouseWheelHandler.EventType={MOUSEWHEEL:"mousewheel"};goog.events.MouseWheelHandler.prototype.setMaxDeltaX=function(a){this.maxDeltaX_=a};goog.events.MouseWheelHandler.prototype.setMaxDeltaY=function(a){this.maxDeltaY_=a};
goog.events.MouseWheelHandler.prototype.handleEvent=function(a){var b=0,c=0,d=0,a=a.getBrowserEvent();if("mousewheel"==a.type){c=1;if(goog.userAgent.IE||goog.userAgent.WEBKIT&&(goog.userAgent.WINDOWS||goog.userAgent.isVersion("532.0")))c=40;d=goog.events.MouseWheelHandler.smartScale_(-a.wheelDelta,c);goog.isDef(a.wheelDeltaX)?(b=goog.events.MouseWheelHandler.smartScale_(-a.wheelDeltaX,c),c=goog.events.MouseWheelHandler.smartScale_(-a.wheelDeltaY,c)):c=d}else d=a.detail,100<d?d=3:-100>d&&(d=-3),goog.isDef(a.axis)&&
a.axis===a.HORIZONTAL_AXIS?b=d:c=d;goog.isNumber(this.maxDeltaX_)&&(b=goog.math.clamp(b,-this.maxDeltaX_,this.maxDeltaX_));goog.isNumber(this.maxDeltaY_)&&(c=goog.math.clamp(c,-this.maxDeltaY_,this.maxDeltaY_));b=new goog.events.MouseWheelEvent(d,a,b,c);try{this.dispatchEvent(b)}finally{b.dispose()}};goog.events.MouseWheelHandler.smartScale_=function(a,b){return goog.userAgent.WEBKIT&&goog.userAgent.MAC&&0!=a%b?a:a/b};
goog.events.MouseWheelHandler.prototype.disposeInternal=function(){goog.events.MouseWheelHandler.superClass_.disposeInternal.call(this);goog.events.unlistenByKey(this.listenKey_);delete this.listenKey_};goog.events.MouseWheelEvent=function(a,b,c,d){goog.events.BrowserEvent.call(this,b);this.type=goog.events.MouseWheelHandler.EventType.MOUSEWHEEL;this.detail=a;this.deltaX=c;this.deltaY=d};goog.inherits(goog.events.MouseWheelEvent,goog.events.BrowserEvent);goog.events.KeyHandler=function(a,b){goog.events.EventTarget.call(this);a&&this.attach(a,b)};goog.inherits(goog.events.KeyHandler,goog.events.EventTarget);goog.events.KeyHandler.prototype.element_=null;goog.events.KeyHandler.prototype.keyPressKey_=null;goog.events.KeyHandler.prototype.keyDownKey_=null;goog.events.KeyHandler.prototype.keyUpKey_=null;goog.events.KeyHandler.prototype.lastKey_=-1;goog.events.KeyHandler.prototype.keyCode_=-1;goog.events.KeyHandler.EventType={KEY:"key"};
goog.events.KeyHandler.safariKey_={3:goog.events.KeyCodes.ENTER,12:goog.events.KeyCodes.NUMLOCK,63232:goog.events.KeyCodes.UP,63233:goog.events.KeyCodes.DOWN,63234:goog.events.KeyCodes.LEFT,63235:goog.events.KeyCodes.RIGHT,63236:goog.events.KeyCodes.F1,63237:goog.events.KeyCodes.F2,63238:goog.events.KeyCodes.F3,63239:goog.events.KeyCodes.F4,63240:goog.events.KeyCodes.F5,63241:goog.events.KeyCodes.F6,63242:goog.events.KeyCodes.F7,63243:goog.events.KeyCodes.F8,63244:goog.events.KeyCodes.F9,63245:goog.events.KeyCodes.F10,
63246:goog.events.KeyCodes.F11,63247:goog.events.KeyCodes.F12,63248:goog.events.KeyCodes.PRINT_SCREEN,63272:goog.events.KeyCodes.DELETE,63273:goog.events.KeyCodes.HOME,63275:goog.events.KeyCodes.END,63276:goog.events.KeyCodes.PAGE_UP,63277:goog.events.KeyCodes.PAGE_DOWN,63289:goog.events.KeyCodes.NUMLOCK,63302:goog.events.KeyCodes.INSERT};
goog.events.KeyHandler.keyIdentifier_={Up:goog.events.KeyCodes.UP,Down:goog.events.KeyCodes.DOWN,Left:goog.events.KeyCodes.LEFT,Right:goog.events.KeyCodes.RIGHT,Enter:goog.events.KeyCodes.ENTER,F1:goog.events.KeyCodes.F1,F2:goog.events.KeyCodes.F2,F3:goog.events.KeyCodes.F3,F4:goog.events.KeyCodes.F4,F5:goog.events.KeyCodes.F5,F6:goog.events.KeyCodes.F6,F7:goog.events.KeyCodes.F7,F8:goog.events.KeyCodes.F8,F9:goog.events.KeyCodes.F9,F10:goog.events.KeyCodes.F10,F11:goog.events.KeyCodes.F11,F12:goog.events.KeyCodes.F12,
"U+007F":goog.events.KeyCodes.DELETE,Home:goog.events.KeyCodes.HOME,End:goog.events.KeyCodes.END,PageUp:goog.events.KeyCodes.PAGE_UP,PageDown:goog.events.KeyCodes.PAGE_DOWN,Insert:goog.events.KeyCodes.INSERT};goog.events.KeyHandler.mozKeyCodeToKeyCodeMap_={61:187,59:186};goog.events.KeyHandler.USES_KEYDOWN_=goog.userAgent.IE||goog.userAgent.WEBKIT&&goog.userAgent.isVersion("525");
goog.events.KeyHandler.prototype.handleKeyDown_=function(a){if(goog.userAgent.WEBKIT&&(this.lastKey_==goog.events.KeyCodes.CTRL&&!a.ctrlKey||this.lastKey_==goog.events.KeyCodes.ALT&&!a.altKey))this.keyCode_=this.lastKey_=-1;goog.events.KeyHandler.USES_KEYDOWN_&&!goog.events.KeyCodes.firesKeyPressEvent(a.keyCode,this.lastKey_,a.shiftKey,a.ctrlKey,a.altKey)?this.handleEvent(a):this.keyCode_=goog.userAgent.GECKO&&a.keyCode in goog.events.KeyHandler.mozKeyCodeToKeyCodeMap_?goog.events.KeyHandler.mozKeyCodeToKeyCodeMap_[a.keyCode]:
a.keyCode};goog.events.KeyHandler.prototype.handleKeyup_=function(){this.keyCode_=this.lastKey_=-1};
goog.events.KeyHandler.prototype.handleEvent=function(a){var b=a.getBrowserEvent(),c,d;if(goog.userAgent.IE&&a.type==goog.events.EventType.KEYPRESS)c=this.keyCode_,d=c!=goog.events.KeyCodes.ENTER&&c!=goog.events.KeyCodes.ESC?b.keyCode:0;else if(goog.userAgent.WEBKIT&&a.type==goog.events.EventType.KEYPRESS)c=this.keyCode_,d=0<=b.charCode&&63232>b.charCode&&goog.events.KeyCodes.isCharacterKey(c)?b.charCode:0;else if(goog.userAgent.OPERA)c=this.keyCode_,d=goog.events.KeyCodes.isCharacterKey(c)?b.keyCode:
0;else if(c=b.keyCode||this.keyCode_,d=b.charCode||0,goog.userAgent.MAC&&d==goog.events.KeyCodes.QUESTION_MARK&&!c)c=goog.events.KeyCodes.SLASH;var e=c,f=b.keyIdentifier;c?63232<=c&&c in goog.events.KeyHandler.safariKey_?e=goog.events.KeyHandler.safariKey_[c]:25==c&&a.shiftKey&&(e=9):f&&f in goog.events.KeyHandler.keyIdentifier_&&(e=goog.events.KeyHandler.keyIdentifier_[f]);a=e==this.lastKey_;this.lastKey_=e;b=new goog.events.KeyEvent(e,d,a,b);try{this.dispatchEvent(b)}finally{b.dispose()}};
goog.events.KeyHandler.prototype.getElement=function(){return this.element_};goog.events.KeyHandler.prototype.attach=function(a,b){this.keyUpKey_&&this.detach();this.element_=a;this.keyPressKey_=goog.events.listen(this.element_,goog.events.EventType.KEYPRESS,this,b);this.keyDownKey_=goog.events.listen(this.element_,goog.events.EventType.KEYDOWN,this.handleKeyDown_,b,this);this.keyUpKey_=goog.events.listen(this.element_,goog.events.EventType.KEYUP,this.handleKeyup_,b,this)};
goog.events.KeyHandler.prototype.detach=function(){if(this.keyPressKey_)goog.events.unlistenByKey(this.keyPressKey_),goog.events.unlistenByKey(this.keyDownKey_),goog.events.unlistenByKey(this.keyUpKey_),this.keyUpKey_=this.keyDownKey_=this.keyPressKey_=null;this.element_=null;this.keyCode_=this.lastKey_=-1};goog.events.KeyHandler.prototype.disposeInternal=function(){goog.events.KeyHandler.superClass_.disposeInternal.call(this);this.detach()};
goog.events.KeyEvent=function(a,b,c,d){goog.events.BrowserEvent.call(this,d);this.type=goog.events.KeyHandler.EventType.KEY;this.keyCode=a;this.charCode=b;this.repeat=c};goog.inherits(goog.events.KeyEvent,goog.events.BrowserEvent);X.interactor=function(a){if(!goog.isDefAndNotNull(a)||!(a instanceof Element))throw new X.exception("Could not add interactor to the given element.");X.base.call(this);this._className="interactor";this._element=a;this._mouseWheelHandler=this._mouseOutListener=this._mouseMoveListener=this._mouseUpListener=this._mouseDownListener=this._mouseWheelListener=null;this._mouseInside=!0;this._rightButtonDown=this._middleButtonDown=this._leftButtonDown=!1;this._lastMousePosition=new goog.math.Vec2(0,0)};
goog.inherits(X.interactor,X.base);X.interactor.prototype.config={MOUSEWHEEL_ENABLED:!0,MOUSECLICKS_ENABLED:!0,KEYBOARD_ENABLED:!0,HOVERING_ENABLED:!0,CONTEXTMENU_ENABLED:!1};
X.interactor.prototype.init=function(){this.config.MOUSEWHEEL_ENABLED?(this._mouseWheelHandler=new goog.events.MouseWheelHandler(this._element),this._mouseWheelListener=goog.events.listen(this._mouseWheelHandler,goog.events.MouseWheelHandler.EventType.MOUSEWHEEL,this.onMouseWheel.bind(this))):(goog.events.unlistenByKey(this._mouseWheelListener),this._mouseWheelHandler=null);this.config.MOUSECLICKS_ENABLED?(this._mouseDownListener=goog.events.listen(this._element,goog.events.EventType.MOUSEDOWN,this.onMouseDown.bind(this)),
this._mouseUpListener=goog.events.listen(this._element,goog.events.EventType.MOUSEUP,this.onMouseUp.bind(this))):(goog.events.unlistenByKey(this._mouseDownListener),goog.events.unlistenByKey(this._mouseUpListener));this._element.oncontextmenu=this.config.CONTEXTMENU_ENABLED?null:function(){return!1};window.onkeydown=this.config.KEYBOARD_ENABLED?this.onKey.bind(this):null;goog.events.unlistenByKey(this._mouseMoveListener);goog.events.unlistenByKey(this._mouseOutListener);this._mouseMoveListener=goog.events.listen(this._element,
goog.events.EventType.MOUSEMOVE,this.onMouseMovementInside.bind(this));this._mouseOutListener=goog.events.listen(this._element,goog.events.EventType.MOUSEOUT,this.onMouseMovementOutside.bind(this))};
X.interactor.prototype.onMouseDown=function(a){if(a.button==goog.events.BrowserEvent.MouseButton.LEFT)this._leftButtonDown=!0;else if(a.button==goog.events.BrowserEvent.MouseButton.MIDDLE)this._middleButtonDown=!0;else if(a.button==goog.events.BrowserEvent.MouseButton.RIGHT)this._rightButtonDown=!0;this.hoverEnd_();a.preventDefault()};
X.interactor.prototype.onMouseUp=function(a){if(a.button==goog.events.BrowserEvent.MouseButton.LEFT)this._leftButtonDown=!1;else if(a.button==goog.events.BrowserEvent.MouseButton.MIDDLE)this._middleButtonDown=!1;else if(a.button==goog.events.BrowserEvent.MouseButton.RIGHT)this._rightButtonDown=!1;this.hoverEnd_();a.preventDefault()};
X.interactor.prototype.onMouseMovementOutside=function(a){this._mouseInside=!1;if(this.config.KEYBOARD_ENABLED)window.onkeydown=null;this._rightButtonDown=this._middleButtonDown=this._leftButtonDown=!1;this.hoverEnd_();this._lastMousePosition=new goog.math.Vec2(0,0);a.preventDefault()};
X.interactor.prototype.onMouseMovementInside=function(a){this.dispatchEvent("mouseup");this._mouseInside=!0;if(this.config.KEYBOARD_ENABLED&&null==window.onkeydown)window.onkeydown=this.onKey.bind(this);a.preventDefault();var b=a.shiftKey,c=new goog.math.Vec2(a.offsetX,a.offsetY),a=this._lastMousePosition.subtract(c);this._lastMousePosition=c.clone();if(this.config.HOVERING_ENABLED)(0<Math.abs(a.x)||0<Math.abs(a.y)||this._middleButtonDown||this._leftButtonDown||this._rightButtonDown)&&this.hoverEnd_(),
this._hoverTrigger=setTimeout(function(){this.hoverEnd_();var a=new X.event.HoverEvent;a._x=c.x;a._y=c.y;this.dispatchEvent(a);this._hoverTrigger=null}.bind(this),700);if(2>Math.abs(a.x))a.x=0;if(2>Math.abs(a.y))a.y=0;if(0!=a.magnitude())if(this._leftButtonDown&&!b)b=new X.event.RotateEvent,b._distance=a,b._angle=0,this.dispatchEvent(b);else if(this._middleButtonDown||this._leftButtonDown&&b){b=new X.event.PanEvent;if(5<a.x)a.x=5;else if(-5>a.x)a.x=-5;if(5<a.y)a.y=5;else if(-5>a.y)a.y=-5;b._distance=
a;this.dispatchEvent(b)}else if(this._rightButtonDown)b=new X.event.ZoomEvent,b._in=0<a.y,b._fast=!1,this.dispatchEvent(b)};X.interactor.prototype.hoverEnd_=function(){this._hoverTrigger&&clearTimeout(this._hoverTrigger);this.dispatchEvent(new X.event.HoverEndEvent)};X.interactor.prototype.onMouseWheel=function(a){this.hoverEnd_();a.preventDefault();var b=new X.event.ZoomEvent;if(!goog.isDefAndNotNull(a.deltaY))a.deltaY=0;b._in=0>a.deltaY;b._fast=!0;this.dispatchEvent(b)};
X.interactor.prototype.onKey=function(a){if(this._mouseInside){this.hoverEnd_();var b=a.altKey,c=a.ctrlKey,d=a.metaKey,e=a.shiftKey,f=a.keyCode;if(82==f&&!b&&!c&&!d&&!e)a.preventDefault(),a=new X.event.ResetViewEvent,this.dispatchEvent(a);else if(37<=f&&40>=f&&(a.preventDefault(),a=e?new X.event.PanEvent:b?new X.event.ZoomEvent:new X.event.RotateEvent)){c=new goog.math.Vec2(0,0);if(37==f){if(c.x=5,b)a._in=!0,a._fast=!1}else if(39==f){if(c.x=-5,b)a._in=!1,a._fast=!1}else if(38==f){if(c.y=5,b)a._in=
!0,a._fast=!0}else if(40==f&&(c.y=-5,b))a._in=!1,a._fast=!0;a._distance=c;this.dispatchEvent(a)}}};goog.exportSymbol("X.interactor",X.interactor);goog.exportSymbol("X.interactor.prototype.config",X.interactor.prototype.config);goog.exportSymbol("X.interactor.prototype.init",X.interactor.prototype.init);goog.exportSymbol("X.interactor.prototype.onMouseDown",X.interactor.prototype.onMouseDown);goog.exportSymbol("X.interactor.prototype.onMouseUp",X.interactor.prototype.onMouseUp);
goog.exportSymbol("X.interactor.prototype.onMouseMovementOutside",X.interactor.prototype.onMouseMovementOutside);goog.exportSymbol("X.interactor.prototype.onMouseMovementInside",X.interactor.prototype.onMouseMovementInside);goog.exportSymbol("X.interactor.prototype.onMouseWheel",X.interactor.prototype.onMouseWheel);goog.exportSymbol("X.interactor.prototype.onKey",X.interactor.prototype.onKey);X.caption=function(a,b,c,d){if(!goog.isDefAndNotNull(a))throw new X.exception("No valid parent element!");if(!goog.isNumber(b)||!goog.isNumber(c))throw new X.exception("Invalid coordinates.");if(!goog.isDefAndNotNull(d)||!(d instanceof X.interactor))throw new X.exception("Invalid interactor.");goog.ui.Tooltip.call(this);this._className="caption";this._parent=a;this._x=b;this._y=c;this._interactor=d;this._style=null;this._css=[];this._css=[".x-tooltip {\n background: #C0C0FF;\n color: #000000;\n border: 1px solid infotext;\n padding: 1px;\n font-family: sans-serif;\n}"];
goog.events.listenOnce(d,X.event.events.HOVER_END,this.kill.bind(this));this.init_()};goog.inherits(X.caption,goog.ui.Tooltip);
X.caption.prototype.init_=function(){this._parent.style.position="relative";var a=goog.dom.getDocument().getElementsByTagName("head")[0],b=goog.dom.createDom("style");b.type="text/css";b.media="screen";var c=goog.dom.createTextNode(this._css[0]);goog.dom.appendChild(a,b);goog.dom.appendChild(b,c);this._style=b;this.setPosition(new goog.positioning.ViewportPosition(this._x,this._y));this.setVisible(!0);this.attach(this._parent);this.getElement().classList.add("x-tooltip")};
X.caption.prototype.kill=function(){this.setVisible(!1);this._style&&goog.dom.removeNode(this._style);this.getElement()&&goog.dom.removeNode(this.getElement());this._style=null};goog.exportSymbol("X.caption",X.caption);goog.exportSymbol("X.caption.prototype.kill",X.caption.prototype.kill);X.camera=function(a,b){if(!goog.isNumber(a)||!goog.isNumber(b))throw new X.exception("A camera needs valid width and height values.");X.base.call(this);this._className="camera";this._fieldOfView=45;this._position=new goog.math.Vec3(0,0,100);this._focus=new goog.math.Vec3(0,0,0);this._up=new goog.math.Vec3(0,1,0);this._perspective=new Float32Array(this.calculatePerspective_(this._fieldOfView,a/b,1,1E4).flatten());this._view=this.lookAt_(this._position,this._focus);this._glView=new Float32Array(this._view.flatten())};
goog.inherits(X.camera,X.base);X.camera.prototype.observe=function(a){if(!goog.isDefAndNotNull(a)||!(a instanceof X.interactor))throw new X.exception("Could not observe the interactor.");goog.events.listen(a,X.event.events.PAN,this.onPan.bind(this));goog.events.listen(a,X.event.events.ROTATE,this.onRotate.bind(this));goog.events.listen(a,X.event.events.ZOOM,this.onZoom.bind(this))};
X.camera.prototype.onZoom=function(a){if(!(a instanceof X.event.ZoomEvent))throw new X.exception("Received no valid zoom event!");a._in?this.zoomIn(a._fast):this.zoomOut(a._fast)};X.camera.prototype.onPan=function(a){if(!(a instanceof X.event.PanEvent))throw new X.exception("Received no valid pan event!");this.pan(a._distance)};X.camera.prototype.onRotate=function(a){if(!(a instanceof X.event.RotateEvent))throw new X.exception("Received no valid rotate event!");this.rotate(a._distance)};
X.camera.prototype.perspective=function(){return this._perspective};X.camera.prototype.view=function(){return this._view};X.camera.prototype.glView=function(){return this._glView};X.camera.prototype.position=function(){return this._position};X.camera.prototype.setPosition=function(a,b,c){if(!goog.isNumber(a)||!goog.isNumber(b)||!goog.isNumber(c))throw new X.exception("The position was invalid.");this._position=new goog.math.Vec3(a,b,c);this.reset()};
X.camera.prototype.reset=function(){this._view=this.lookAt_(this._position,this._focus);this._glView=new Float32Array(this._view.flatten())};X.camera.prototype.focus=function(){return this._focus};X.camera.prototype.setFocus=function(a,b,c){if(!goog.isNumber(a)||!goog.isNumber(b)||!goog.isNumber(c))throw new X.exception("The focus was invalid.");this._focus=new goog.math.Vec3(a,b,c);this.reset()};X.camera.prototype.up=function(){return this._up};
X.camera.prototype.setUp=function(a,b,c){if(!goog.isNumber(a)||!goog.isNumber(b)||!goog.isNumber(c))throw new X.exception("The up-vector was invalid.");this._up=new goog.math.Vec3(a,b,c);this.reset()};X.camera.prototype.calculatePerspective_=function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.calculateViewingFrustum_(e*b,a*b,e,a,c,d)};
X.camera.prototype.calculateViewingFrustum_=function(a,b,c,d,e,f){return new X.matrix([[2*e/(b-a),0,(b+a)/(b-a),0],[0,2*e/(d-c),(d+c)/(d-c),0],[0,0,-(f+e)/(f-e),-2*f*e/(f-e)],[0,0,-1,0]])};
X.camera.prototype.pan=function(a){if(!(a instanceof goog.math.Vec2))throw new X.exception("Invalid distance vector for pan operation.");a=new goog.math.Vec3(-a.x,a.y,0);a=X.matrix.createIdentityMatrix(4).translate(a);this._view=new X.matrix(a.multiply(this._view));this._glView=new Float32Array(this._view.flatten());this.dispatchEvent(new X.event.RenderEvent)};
X.camera.prototype.rotate=function(a){if(!(a instanceof goog.math.Vec2))throw new X.exception("Invalid distance vector for rotate operation.");var b=-a.x/5*Math.PI/180,a=-a.y/5*Math.PI/180,c=X.matrix.createIdentityMatrix(4),d=new goog.math.Vec3(parseFloat(this._view.getValueAt(0,0)),parseFloat(this._view.getValueAt(0,1)),parseFloat(this._view.getValueAt(0,2))),e=new goog.math.Vec3(parseFloat(this._view.getValueAt(1,0)),parseFloat(this._view.getValueAt(1,1)),parseFloat(this._view.getValueAt(1,2))),
b=c.rotate(b,e),a=c.rotate(a,d);this._view=new X.matrix(this._view.multiply(a.multiply(b)));this._glView=new Float32Array(this._view.flatten());this.dispatchEvent(new X.event.RenderEvent)};X.camera.prototype.zoomIn=function(a){var b=20;goog.isDefAndNotNull(a)&&!a&&(b=1);a=new goog.math.Vec3(0,0,b);a=X.matrix.createIdentityMatrix(4).translate(a);this._view=new X.matrix(a.multiply(this._view));this._glView=new Float32Array(this._view.flatten());this.dispatchEvent(new X.event.RenderEvent)};
X.camera.prototype.zoomOut=function(a){var b=30;goog.isDefAndNotNull(a)&&!a&&(b=1);a=new goog.math.Vec3(0,0,-b);a=X.matrix.createIdentityMatrix(4).translate(a);this._view=new X.matrix(a.multiply(this._view));this._glView=new Float32Array(this._view.flatten());this.dispatchEvent(new X.event.RenderEvent)};
X.camera.prototype.lookAt_=function(a,b){if(!(a instanceof goog.math.Vec3)||!(b instanceof goog.math.Vec3))throw new X.exception("3D vectors required for calculating the view.");var c=X.matrix.createIdentityMatrix(4),d=goog.math.Vec3.difference(a,b),d=d.normalize(),e=this._up.clone();e.equals(d)&&(e.z+=1.0E-6);var f=goog.math.Vec3.cross(e,d),e=goog.math.Vec3.cross(d,f),f=f.normalize(),e=e.normalize();c.setValueAt(0,0,f.x);c.setValueAt(0,1,f.y);c.setValueAt(0,2,f.z);c.setValueAt(0,3,0);c.setValueAt(1,
0,e.x);c.setValueAt(1,1,e.y);c.setValueAt(1,2,e.z);c.setValueAt(1,3,0);c.setValueAt(2,0,d.x);c.setValueAt(2,1,d.y);c.setValueAt(2,2,d.z);c.setValueAt(2,3,0);c.setValueAt(3,0,0);c.setValueAt(3,1,0);c.setValueAt(3,2,0);c.setValueAt(3,3,1);d=a.clone();return c.translate(d.invert())};goog.exportSymbol("X.camera",X.camera);goog.exportSymbol("X.camera.prototype.observe",X.camera.prototype.observe);goog.exportSymbol("X.camera.prototype.onZoom",X.camera.prototype.onZoom);
goog.exportSymbol("X.camera.prototype.onPan",X.camera.prototype.onPan);goog.exportSymbol("X.camera.prototype.onRotate",X.camera.prototype.onRotate);goog.exportSymbol("X.camera.prototype.perspective",X.camera.prototype.perspective);goog.exportSymbol("X.camera.prototype.view",X.camera.prototype.view);goog.exportSymbol("X.camera.prototype.position",X.camera.prototype.position);goog.exportSymbol("X.camera.prototype.setPosition",X.camera.prototype.setPosition);
goog.exportSymbol("X.camera.prototype.focus",X.camera.prototype.focus);goog.exportSymbol("X.camera.prototype.setFocus",X.camera.prototype.setFocus);goog.exportSymbol("X.camera.prototype.up",X.camera.prototype.up);goog.exportSymbol("X.camera.prototype.setUp",X.camera.prototype.setUp);goog.exportSymbol("X.camera.prototype.pan",X.camera.prototype.pan);goog.exportSymbol("X.camera.prototype.rotate",X.camera.prototype.rotate);goog.exportSymbol("X.camera.prototype.zoomIn",X.camera.prototype.zoomIn);
goog.exportSymbol("X.camera.prototype.zoomOut",X.camera.prototype.zoomOut);goog.exportSymbol("X.camera.prototype.observe",X.camera.prototype.observe);X.renderer=function(a){if(!goog.isDefAndNotNull(a))throw new X.exception("An ID to a valid container (<div>..) is required!");a=goog.dom.getElement(a);if(!goog.dom.isElement(a)||0==a.clientWidth||0==a.clientHeight)throw new X.exception("Could not find the given container or it has an undefined size!");X.base.call(this);this._className="renderer";this._container=a;this._width=this._container.clientWidth;this._height=this._container.clientHeight;this._interactor=this._camera=this._shaderProgram=this._shaders=
this._gl=this._canvas=null;this._objects=[];this._topLevelObjects=[];this._maxZ=this._minZ=this._maxY=this._minY=this._maxX=this._minX=null;this._center=[0,0,0];this._pickFrameBuffer=null;this._attributePointers=new goog.structs.Map;this._uniformLocations=new goog.structs.Map;this._vertexBuffers=new goog.structs.Map;this._normalBuffers=new goog.structs.Map;this._colorBuffers=new goog.structs.Map;this._texturePositionBuffers=new goog.structs.Map;this._textures=new goog.structs.Map;this._progressBar=
this._loader=null;this._locked=!1;window.console.log("XTK Release 1 -- 1/12/12 -- http://www.goXTK.com")};goog.inherits(X.renderer,X.base);X.renderer.prototype.config={PROGRESSBAR_ENABLED:!0,PICKING_ENABLED:!0};X.renderer.prototype.width=function(){return this._width};X.renderer.prototype.height=function(){return this._height};X.renderer.prototype.canvas=function(){if(!goog.isDefAndNotNull(this._canvas))this._canvas=goog.dom.createDom("canvas");return this._canvas};
X.renderer.prototype.container=function(){return this._container};X.renderer.prototype.camera=function(){return this._camera};X.renderer.prototype.interactor=function(){return this._interactor};X.renderer.prototype.loader=function(){if(!goog.isDefAndNotNull(this._loader))this._loader=new X.loader,goog.events.listen(this.loader(),X.event.events.PROGRESS,this.onProgress.bind(this));return this._loader};X.renderer.prototype.onProgress=function(a){this._progressBar&&this._progressBar.setValue(100*a._value)};
X.renderer.prototype.onModified=function(a){goog.isDefAndNotNull(a)&&a instanceof X.event.ModifiedEvent&&this.update_(a._object)};X.renderer.prototype.onHover=function(a){goog.isDefAndNotNull(a)&&a instanceof X.event.HoverEvent&&this.showCaption_(a._x,a._y)};X.renderer.prototype.showProgressBar_=function(){if(this.config.PROGRESSBAR_ENABLED&&!this._progressBar)this._progressBar=new X.progressbar(this.container(),0)};
X.renderer.prototype.hideProgressBar_=function(){if(this.config.PROGRESSBAR_ENABLED&&this._progressBar&&!this._readyCheckTimer2)this._progressBar.done(),this._readyCheckTimer2=goog.Timer.callOnce(function(){this._readyCheckTimer2=null;if(this._progressBar)this._progressBar.kill(),this._progressBar=null;this.render()}.bind(this),700)};X.renderer.prototype.resetViewAndRender=function(){this._camera.reset();this.render_(!1)};
X.renderer.prototype.init=function(){var a=this.canvas();a.width=this.width();a.height=this.height();goog.dom.appendChild(this.container(),a);try{var b=a.getContext("experimental-webgl");if(!b)throw Error();}catch(c){throw alert("WebGL not supported! See http://wiki.goXTK.com/index.php/X:Browsers for instructions.."),Error("WebGL not supported! See http://wiki.goXTK.com/index.php/X:Browsers for instructions..");}try{if(b.clearColor(0,0,0,0),b.enable(b.BLEND),b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA),
b.enable(b.DEPTH_TEST),b.depthFunc(b.LEQUAL),b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT),this.config.PICKING_ENABLED){var d=b.createFramebuffer(),e=b.createRenderbuffer(),f=b.createTexture();b.bindTexture(b.TEXTURE_2D,f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,this.width(),this.height(),0,b.RGB,b.UNSIGNED_BYTE,null);b.bindFramebuffer(b.FRAMEBUFFER,d);b.bindRenderbuffer(b.RENDERBUFFER,e);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,this.width(),this.height());b.bindRenderbuffer(b.RENDERBUFFER,
null);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e);b.bindFramebuffer(b.FRAMEBUFFER,null);this._pickFrameBuffer=d}}catch(g){throw new X.exception("Exception while accessing GL Context!\n"+g);}d=new X.interactor(a);d.init();goog.events.listen(d,X.event.events.RESETVIEW,this.resetViewAndRender.bind(this));goog.events.listen(d,X.event.events.HOVER,this.onHover.bind(this));e=new X.camera(this.width(),
this.height());e.observe(d);goog.events.listen(e,X.event.events.RENDER,this.render_.bind(this,!1));this._canvas=a;this._gl=b;this._camera=e;this._interactor=d;this.addShaders(new X.shaders)};
X.renderer.prototype.addShaders=function(a){if(!goog.isDefAndNotNull(this._canvas)||!goog.isDefAndNotNull(this._gl)||!goog.isDefAndNotNull(this._camera))throw new X.exception("Renderer was not initialized properly!");if(!goog.isDefAndNotNull(a)||!(a instanceof X.shaders))throw new X.exception("Could not add shaders!");a.validate();var b=this._gl.createShader(this._gl.FRAGMENT_SHADER),c=this._gl.createShader(this._gl.VERTEX_SHADER);this._gl.shaderSource(b,a.fragment());this._gl.shaderSource(c,a.vertex());
this._gl.compileShader(b);this._gl.compileShader(c);if(!this._gl.getShaderParameter(b,this._gl.COMPILE_STATUS))throw new X.exception("Fragement Shader compilation failed!\n"+this._gl.getShaderInfoLog(b));if(!this._gl.getShaderParameter(c,this._gl.COMPILE_STATUS))throw new X.exception("Vertex Shader compilation failed!\n"+this._gl.getShaderInfoLog(c));var d=this._gl.createProgram();this._gl.attachShader(d,c);this._gl.attachShader(d,b);this._gl.linkProgram(d);if(!this._gl.getProgramParameter(d,this._gl.LINK_STATUS))throw new X.exception("Could not create shader program!\n"+
this._gl.getShaderInfoLog(b)+"\n"+this._gl.getShaderInfoLog(c)+"\n"+this._gl.getProgramInfoLog(d));this._gl.useProgram(d);this._shaderProgram=d;Object.keys(X.shaders.attributes).forEach(function(a){a=eval("X.shaders.attributes."+a);this._attributePointers.set(a,this._gl.getAttribLocation(this._shaderProgram,a));this._gl.enableVertexAttribArray(this._attributePointers.get(a))}.bind(this));Object.keys(X.shaders.uniforms).forEach(function(a){a=eval("X.shaders.uniforms."+a);this._uniformLocations.set(a,
this._gl.getUniformLocation(this._shaderProgram,a))}.bind(this));this._shaders=a};X.renderer.prototype.add=function(a){this._topLevelObjects.push(a);this.add_(a)};
X.renderer.prototype.add_=function(a){if(!goog.isDefAndNotNull(this._canvas)||!goog.isDefAndNotNull(this._gl)||!goog.isDefAndNotNull(this._camera))throw new X.exception("Renderer was not initialized properly!");if(!goog.isDefAndNotNull(a)||!(a instanceof X.object))throw new X.exception("Illegal object!");if(a.hasChildren())for(var b=a.children(),c=b.length,d=0,d=0;d<c;d++)this.add(b[d]);goog.events.listen(a,X.event.events.MODIFIED,this.onModified.bind(this));this.update_(a)};
X.renderer.prototype.update_=function(a){if(!goog.isDefAndNotNull(this._canvas)||!goog.isDefAndNotNull(this._gl)||!goog.isDefAndNotNull(this._camera))throw new X.exception("Renderer was not initialized properly!");if(!goog.isDefAndNotNull(a)||!(a instanceof X.object))throw new X.exception("Illegal object!");var b=!1;this.get(a.id())&&(b=!0);if(goog.isDefAndNotNull(a.texture())&&a.texture().dirty())this.loader().loadTexture(a);else if(goog.isDefAndNotNull(a.file())&&a.file().dirty())this.loader().loadFile(a);
else if(0!=a.points().count()){for(var c=0;this._locked;)c++;this._locked=!0;b&&a.points().dirty()&&(c=this._vertexBuffers.get(a.id()),goog.isDefAndNotNull(c)&&this._gl.isBuffer(c.glBuffer())&&this._gl.deleteBuffer(c.glBuffer()));c=null;if(!b||a.points().dirty()){var c=this._gl.createBuffer(),d=a.points();this._gl.bindBuffer(this._gl.ARRAY_BUFFER,c);this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(d.all()),this._gl.STATIC_DRAW);var c=new X.buffer(c,d.count(),3),e=a.transform().matrix(),
f=e.multiplyByVector(new goog.math.Vec3(d.minA(),d.minB(),d.minC())),d=e.multiplyByVector(new goog.math.Vec3(d.maxA(),d.maxB(),d.maxC()));if(goog.isNull(this._minX)||f.x<this._minX)this._minX=f.x;if(goog.isNull(this._maxX)||d.x>this._maxX)this._maxX=d.x;if(goog.isNull(this._minY)||f.y<this._minY)this._minY=f.y;if(goog.isNull(this._maxY)||d.y>this._maxY)this._maxY=d.y;if(goog.isNull(this._minZ)||f.z<this._minZ)this._minZ=f.z;if(goog.isNull(this._maxZ)||d.z>this._maxZ)this._maxZ=d.z;this._center=[(this._minX+
this._maxX)/2,(this._minY+this._maxY)/2,(this._minZ+this._maxZ)/2]}else c=this._vertexBuffers.get(a.id());this.loader().addProgress(0.3);b&&a.normals().dirty()&&(d=this._vertexBuffers.get(a.id()),goog.isDefAndNotNull(d)&&this._gl.isBuffer(d.glBuffer())&&this._gl.deleteBuffer(d.glBuffer()));d=null;!b||a.normals().dirty()?(d=this._gl.createBuffer(),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,d),this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(a.normals().all()),this._gl.STATIC_DRAW),d=new X.buffer(d,
a.normals().count(),3)):d=this._normalBuffers.get(a.id());this.loader().addProgress(0.3);b&&a.colors().dirty()&&(f=this._colorBuffers.get(a.id()),goog.isDefAndNotNull(f)&&this._gl.isBuffer(f.glBuffer())&&this._gl.deleteBuffer(f.glBuffer()));f=null;if(0<a.colors().length())if(!b||a.colors().dirty()){if(a.colors().length()!=a.points().length())throw new X.exception("Mismatch between points and point colors!");f=this._gl.createBuffer();this._gl.bindBuffer(this._gl.ARRAY_BUFFER,f);this._gl.bufferData(this._gl.ARRAY_BUFFER,
new Float32Array(a.colors().all()),this._gl.STATIC_DRAW);f=new X.buffer(f,a.colors().count(),3)}else f=this._colorBuffers.get(a.id());this.loader().addProgress(0.3);b&&goog.isDefAndNotNull(a.texture())&&a.texture().dirty()&&(e=this._texturePositionBuffers.get(a.id()),goog.isDefAndNotNull(e)&&this._gl.isBuffer(e.glBuffer())&&this._gl.deleteBuffer(e.glBuffer()));e=null;if(goog.isDefAndNotNull(a.texture()))if(!b||a.texture().dirty()){if(!goog.isDefAndNotNull(a.textureCoordinateMap()))throw new X.exception("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!");
b=this._gl.createTexture();b.image=a.texture().image();this._textures.set(a.texture().file(),b);this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,!1);this._gl.bindTexture(this._gl.TEXTURE_2D,b);this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,b.image);this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR);this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR);this._gl.bindTexture(this._gl.TEXTURE_2D,
null);b=this._gl.createBuffer();this._gl.bindBuffer(this._gl.ARRAY_BUFFER,b);this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(a.textureCoordinateMap()),this._gl.STATIC_DRAW);e=new X.buffer(b,a.textureCoordinateMap().length,2)}else e=this._texturePositionBuffers.get(a.id());this.loader().addProgress(0.1);if(!this._objects.push(a))throw new X.exception("Could not add object to this renderer.");this._vertexBuffers.set(a.id(),c);this._normalBuffers.set(a.id(),d);this._colorBuffers.set(a.id(),
f);this._texturePositionBuffers.set(a.id(),e);this._locked=!1}};X.renderer.prototype.render=function(){if(!this._canvas||!this._gl||!this._camera)throw new X.exception("The renderer was not initialized properly!");if(!goog.isDefAndNotNull(this._readyCheckTimer))this.loader().completed()?this._progressBar?this.hideProgressBar_():this.render_(!1):(this.showProgressBar_(),this._readyCheckTimer=goog.Timer.callOnce(function(){this._readyCheckTimer=null;this.render()}.bind(this),100))};
X.renderer.prototype.generateTree_=function(a,b){for(var c="",d=0;d<b;d++)c+=">";c+=a.id();window.console.log(c);if(a.hasChildren())for(var c=a.children(),d=c.length,e=0,e=0;e<d;e++)this.generateTree_(c[e],b+1)};X.renderer.prototype.get=function(a){if(!goog.isDefAndNotNull(a))throw new X.exception("Invalid object id.");for(var b=0,c=this._objects.length,b=0;b<c;b++)if(this._objects[b].id()==a)return this._objects[b];return null};
X.renderer.prototype.showCaption_=function(a,b){var c=this.get(this.pick(a,b));c&&c.caption()&&(new X.caption(this.container(),a+10,b+10,this.interactor())).setHtml(c.caption())};X.renderer.prototype.pick=function(a,b){if(this.config.PICKING_ENABLED){this.render_(!0);var c=new Uint8Array(4);this._gl.readPixels(a,this._height-b,1,1,this._gl.RGBA,this._gl.UNSIGNED_BYTE,c);var d=Math.round(10*(c[0]/255)),e=Math.round(10*(c[1]/255)),c=Math.round(10*(c[2]/255));return 100*d+10*e+c}return-1};
X.renderer.prototype.render_=function(a){for(var b=0;b<this._topLevelObjects.length;b++)this._topLevelObjects[b].hasChildren();a?this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,this._pickFrameBuffer):this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,null);this._gl.clear(this._gl.COLOR_BUFFER_BIT|this._gl.DEPTH_BUFFER_BIT);var b=this._camera.perspective(),c=this._camera.glView();this._gl.uniformMatrix4fv(this._uniformLocations.get(X.shaders.uniforms.PERSPECTIVE),!1,b);this._gl.uniformMatrix4fv(this._uniformLocations.get(X.shaders.uniforms.VIEW),
!1,c);b=this._center;this._gl.uniform3f(this._uniformLocations.get(X.shaders.uniforms.CENTER),parseFloat(b[0]),parseFloat(b[1]),parseFloat(b[2]));var b=this._objects,c=b.length,d;for(d=0;d<c;++d){var e=b[d];if(e){if(e.visible()){var f=e.id(),g=e.magicMode(),h=this._vertexBuffers.get(f),i=this._normalBuffers.get(f),j=this._colorBuffers.get(f),k=this._texturePositionBuffers.get(f);this._gl.bindBuffer(this._gl.ARRAY_BUFFER,h.glBuffer());this._gl.vertexAttribPointer(this._attributePointers.get(X.shaders.attributes.VERTEXPOSITION),
h.itemSize(),this._gl.FLOAT,!1,0,0);this._gl.bindBuffer(this._gl.ARRAY_BUFFER,i.glBuffer());this._gl.vertexAttribPointer(this._attributePointers.get(X.shaders.attributes.VERTEXNORMAL),i.itemSize(),this._gl.FLOAT,!1,0,0);a?this._gl.uniform1i(this._uniformLocations.get(X.shaders.uniforms.USEPICKING),!0):this._gl.uniform1i(this._uniformLocations.get(X.shaders.uniforms.USEPICKING),!1);if(goog.isDefAndNotNull(j)&&!a&&!g)this._gl.uniform1i(this._uniformLocations.get(X.shaders.uniforms.USEOBJECTCOLOR),!1),
this._gl.bindBuffer(this._gl.ARRAY_BUFFER,j.glBuffer()),this._gl.vertexAttribPointer(this._attributePointers.get(X.shaders.attributes.VERTEXCOLOR),j.itemSize(),this._gl.FLOAT,!1,0,0);else{i=!0;g&&!a&&(i=!1);this._gl.uniform1i(this._uniformLocations.get(X.shaders.uniforms.USEOBJECTCOLOR),i);g=e.color();if(a){if(999<f)throw new X.exception("Id out of bounds.");g=Math.floor(0.01*f);i=Math.floor(0.1*f)-10*g;g=[g/10,i/10,(f-100*g-10*i)/10]}this._gl.uniform3f(this._uniformLocations.get(X.shaders.uniforms.OBJECTCOLOR),
parseFloat(g[0]),parseFloat(g[1]),parseFloat(g[2]));this._gl.vertexAttribPointer(this._attributePointers.get(X.shaders.attributes.VERTEXCOLOR),h.itemSize(),this._gl.FLOAT,!1,0,0)}this._gl.uniform1f(this._uniformLocations.get(X.shaders.uniforms.OBJECTOPACITY),parseFloat(e.opacity()));goog.isDefAndNotNull(e.texture())&&goog.isDefAndNotNull(k)&&!a?(this._gl.uniform1i(this._uniformLocations.get(X.shaders.uniforms.USETEXTURE),!0),this._gl.activeTexture(this._gl.TEXTURE0),this._gl.bindTexture(this._gl.TEXTURE_2D,
this._textures.get(e.texture().file())),this._gl.uniform1i(this._uniformLocations.get(X.shaders.uniforms.TEXTURESAMPLER),0),this._gl.bindBuffer(this._gl.ARRAY_BUFFER,k.glBuffer()),this._gl.vertexAttribPointer(this._attributePointers.get(X.shaders.attributes.VERTEXTEXTUREPOS),k.itemSize(),this._gl.FLOAT,!1,0,0)):(this._gl.uniform1i(this._uniformLocations.get(X.shaders.uniforms.USETEXTURE),!1),this._gl.vertexAttribPointer(this._attributePointers.get(X.shaders.attributes.VERTEXTEXTUREPOS),h.itemSize(),
this._gl.FLOAT,!1,0,0));this._gl.uniformMatrix4fv(this._uniformLocations.get(X.shaders.uniforms.OBJECTTRANSFORM),!1,e.transform().glMatrix());f=-1;e.type()==X.object.types.TRIANGLES?f=this._gl.TRIANGLES:e.type()==X.object.types.LINES?(this._gl.lineWidth(e.lineWidth()),f=this._gl.LINES):e.type()==X.object.types.TRIANGLE_STRIPS?f=this._gl.TRIANGLE_STRIP:e.type()==X.object.types.POLYGONS&&(f=0==h.itemCount()%3?this._gl.TRIANGLES:this._gl.TRIANGLE_FAN);this._gl.drawArrays(f,0,h.itemCount())}}else throw new X.exception("Could not retrieve object for (re-)drawing!");
}};goog.exportSymbol("X.renderer",X.renderer);goog.exportSymbol("X.renderer.prototype.config",X.renderer.prototype.config);goog.exportSymbol("X.renderer.prototype.width",X.renderer.prototype.width);goog.exportSymbol("X.renderer.prototype.height",X.renderer.prototype.height);goog.exportSymbol("X.renderer.prototype.canvas",X.renderer.prototype.canvas);goog.exportSymbol("X.renderer.prototype.container",X.renderer.prototype.container);goog.exportSymbol("X.renderer.prototype.camera",X.renderer.prototype.camera);
goog.exportSymbol("X.renderer.prototype.interactor",X.renderer.prototype.interactor);goog.exportSymbol("X.renderer.prototype.loader",X.renderer.prototype.loader);goog.exportSymbol("X.renderer.prototype.onProgress",X.renderer.prototype.onProgress);goog.exportSymbol("X.renderer.prototype.onModified",X.renderer.prototype.onModified);goog.exportSymbol("X.renderer.prototype.resetViewAndRender",X.renderer.prototype.resetViewAndRender);goog.exportSymbol("X.renderer.prototype.init",X.renderer.prototype.init);
goog.exportSymbol("X.renderer.prototype.addShaders",X.renderer.prototype.addShaders);goog.exportSymbol("X.renderer.prototype.add",X.renderer.prototype.add);goog.exportSymbol("X.renderer.prototype.render",X.renderer.prototype.render);X.sphere=function(a,b){if(!goog.isDefAndNotNull(a)||!(a instanceof Array)||3!=a.length)throw new X.exception("Invalid center.");if(!goog.isNumber(b))throw new X.exception("Invalid radius.");X.object.call(this);this._className="sphere";this._center=a;this._radius=b;this._slices=32;this._stacks=16;this.create_()};goog.inherits(X.sphere,X.object);X.sphere.prototype.create_=function(){this.fromCSG(new CSG.sphere({center:this._center,radius:this._radius,slices:this._slices,stacks:this._stacks}))};
goog.exportSymbol("X.sphere",X.sphere);X.cylinder=function(a,b,c){if(!goog.isDefAndNotNull(a)||!(a instanceof Array)||3!=a.length)throw new X.exception("Invalid start position.");if(!goog.isDefAndNotNull(b)||!(b instanceof Array)||3!=b.length)throw new X.exception("Invalid end position.");if(!goog.isNumber(c))throw new X.exception("Invalid radius.");X.object.call(this);this._className="cylinder";this._start=a;this._end=b;this._radius=c;this._slices=32;this.create_()};goog.inherits(X.cylinder,X.object);
X.cylinder.prototype.create_=function(){this.fromCSG(new CSG.cylinder({start:this._start,end:this._end,radius:this._radius,slices:this._slices}))};goog.exportSymbol("X.cylinder",X.cylinder);X.cube=function(a,b,c,d){if(!goog.isDefAndNotNull(a)||!(a instanceof Array)||3!=a.length)throw new X.exception("Invalid center.");if(!goog.isNumber(b)||!goog.isNumber(c)||!goog.isNumber(d))throw new X.exception("Invalid radii.");X.object.call(this);this._className="cube";this._center=a;this._radiusX=b;this._radiusY=c;this._radiusZ=d;this._textureCoordinateMap=[0,1,1,1,1,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,
0,0,0];this.create_()};goog.inherits(X.cube,X.object);X.cube.prototype.create_=function(){this.fromCSG(new CSG.cube({center:this._center,radius:[this._radiusX,this._radiusY,this._radiusZ]}))};goog.exportSymbol("X.cube",X.cube);