-
Notifications
You must be signed in to change notification settings - Fork 0
/
chromeVoxChromeOptionsScript.js~
2039 lines (2039 loc) · 629 KB
/
chromeVoxChromeOptionsScript.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
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
var COMPILED=true;var goog=goog||{};goog.global=this;goog.global.CLOSURE_UNCOMPILED_DEFINES;goog.global.CLOSURE_DEFINES;goog.isDef=function(val){return val!==void 0;};goog.exportPath_=function(name,opt_object,opt_objectToExportTo){var parts=name.split('.');var cur=opt_objectToExportTo||goog.global;if(!(parts[0]in cur)&&cur.execScript){cur.execScript('var '+parts[0]);}
for(var part;parts.length&&(part=parts.shift());){if(!parts.length&&goog.isDef(opt_object)){cur[part]=opt_object;}else if(cur[part]){cur=cur[part];}else{cur=cur[part]={};}}};goog.define=function(name,defaultValue){var value=defaultValue;if(!COMPILED){var uncompiledDefines=goog.global.CLOSURE_UNCOMPILED_DEFINES;var defines=goog.global.CLOSURE_DEFINES;if(uncompiledDefines&&(uncompiledDefines).nodeType===undefined&&Object.prototype.hasOwnProperty.call(uncompiledDefines,name)){value=uncompiledDefines[name];}else if(defines&&(defines).nodeType===undefined&&Object.prototype.hasOwnProperty.call(defines,name)){value=defines[name];}}
return value;};goog.DEBUG=true;goog.LOCALE=goog.define('goog.LOCALE','en');goog.TRUSTED_SITE=goog.define('goog.TRUSTED_SITE',true);goog.STRICT_MODE_COMPATIBLE=goog.define('goog.STRICT_MODE_COMPATIBLE',false);goog.provide=function(name){if(!COMPILED){if(goog.isProvided_(name)){throw Error('Namespace "'+name+'" already declared.');}
delete goog.implicitNamespaces_[name];var namespace=name;while((namespace=namespace.substring(0,namespace.lastIndexOf('.')))){if(goog.getObjectByName(namespace)){break;}
goog.implicitNamespaces_[namespace]=true;}}
goog.exportPath_(name);};goog.setTestOnly=function(opt_message){if(COMPILED&&!goog.DEBUG){opt_message=opt_message||'';throw Error('Importing test-only code into non-debug environment'+
opt_message?': '+opt_message:'.');}};goog.forwardDeclare=function(name){};if(!COMPILED){goog.isProvided_=function(name){return!goog.implicitNamespaces_[name]&&goog.isDefAndNotNull(goog.getObjectByName(name));};goog.implicitNamespaces_={};}
goog.getObjectByName=function(name,opt_obj){var parts=name.split('.');var cur=opt_obj||goog.global;for(var part;part=parts.shift();){if(goog.isDefAndNotNull(cur[part])){cur=cur[part];}else{return null;}}
return cur;};goog.globalize=function(obj,opt_global){var global=opt_global||goog.global;for(var x in obj){global[x]=obj[x];}};goog.addDependency=function(relPath,provides,requires){if(goog.DEPENDENCIES_ENABLED){var provide,require;var path=relPath.replace(/\\/g,'/');var deps=goog.dependencies_;for(var i=0;provide=provides[i];i++){deps.nameToPath[provide]=path;if(!(path in deps.pathToNames)){deps.pathToNames[path]={};}
deps.pathToNames[path][provide]=true;}
for(var j=0;require=requires[j];j++){if(!(path in deps.requires)){deps.requires[path]={};}
deps.requires[path][require]=true;}}};goog.ENABLE_DEBUG_LOADER=goog.define('goog.ENABLE_DEBUG_LOADER',true);goog.require=function(name){if(!COMPILED){if(goog.isProvided_(name)){return;}
if(goog.ENABLE_DEBUG_LOADER){var path=goog.getPathFromDeps_(name);if(path){goog.included_[path]=true;goog.writeScripts_();return;}}
var errorMessage='goog.require could not find: '+name;if(goog.global.console){goog.global.console['error'](errorMessage);}
throw Error(errorMessage);}};goog.basePath='';goog.global.CLOSURE_BASE_PATH;goog.global.CLOSURE_NO_DEPS=true;goog.global.CLOSURE_IMPORT_SCRIPT;goog.nullFunction=function(){};goog.identityFunction=function(opt_returnValue,var_args){return opt_returnValue;};goog.abstractMethod=function(){throw Error('unimplemented abstract method');};goog.addSingletonGetter=function(ctor){ctor.getInstance=function(){if(ctor.instance_){return ctor.instance_;}
if(goog.DEBUG){goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=ctor;}
return ctor.instance_=new ctor;};};goog.instantiatedSingletons_=[];goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER;if(goog.DEPENDENCIES_ENABLED){goog.included_={};goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}};goog.inHtmlDocument_=function(){var doc=goog.global.document;return typeof doc!='undefined'&&'write'in doc;};goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH){goog.basePath=goog.global.CLOSURE_BASE_PATH;return;}else if(!goog.inHtmlDocument_()){return;}
var doc=goog.global.document;var scripts=doc.getElementsByTagName('script');for(var i=scripts.length-1;i>=0;--i){var src=scripts[i].src;var qmark=src.lastIndexOf('?');var l=qmark==-1?src.length:qmark;if(src.substr(l-7,7)=='base.js'){goog.basePath=src.substr(0,l-7);return;}}};goog.importScript_=function(src){var importScript=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;if(!goog.dependencies_.written[src]&&importScript(src)){goog.dependencies_.written[src]=true;}};goog.writeScriptTag_=function(src){if(goog.inHtmlDocument_()){var doc=goog.global.document;if(doc.readyState=='complete'){var isDeps=/\bdeps.js$/.test(src);if(isDeps){return false;}else{throw Error('Cannot write "'+src+'" after document load');}}
doc.write('<script type="text/javascript" src="'+src+'"></'+'script>');return true;}else{return false;}};goog.writeScripts_=function(){var scripts=[];var seenScript={};var deps=goog.dependencies_;function visitNode(path){if(path in deps.written){return;}
if(path in deps.visited){if(!(path in seenScript)){seenScript[path]=true;scripts.push(path);}
return;}
deps.visited[path]=true;if(path in deps.requires){for(var requireName in deps.requires[path]){if(!goog.isProvided_(requireName)){if(requireName in deps.nameToPath){visitNode(deps.nameToPath[requireName]);}else{throw Error('Undefined nameToPath for '+requireName);}}}}
if(!(path in seenScript)){seenScript[path]=true;scripts.push(path);}}
for(var path in goog.included_){if(!deps.written[path]){visitNode(path);}}
for(var i=0;i<scripts.length;i++){if(scripts[i]){goog.importScript_(goog.basePath+scripts[i]);}else{throw Error('Undefined script input');}}};goog.getPathFromDeps_=function(rule){if(rule in goog.dependencies_.nameToPath){return goog.dependencies_.nameToPath[rule];}else{return null;}};goog.findBasePath_();if(!goog.global.CLOSURE_NO_DEPS){goog.importScript_(goog.basePath+'deps.js');}}
goog.typeOf=function(value){var s=typeof value;if(s=='object'){if(value){if(value instanceof Array){return'array';}else if(value instanceof Object){return s;}
var className=Object.prototype.toString.call((value));if(className=='[object Window]'){return'object';}
if((className=='[object Array]'||typeof value.length=='number'&&typeof value.splice!='undefined'&&typeof value.propertyIsEnumerable!='undefined'&&!value.propertyIsEnumerable('splice'))){return'array';}
if((className=='[object Function]'||typeof value.call!='undefined'&&typeof value.propertyIsEnumerable!='undefined'&&!value.propertyIsEnumerable('call'))){return'function';}}else{return'null';}}else if(s=='function'&&typeof value.call=='undefined'){return'object';}
return s;};goog.isNull=function(val){return val===null;};goog.isDefAndNotNull=function(val){return val!=null;};goog.isArray=function(val){return goog.typeOf(val)=='array';};goog.isArrayLike=function(val){var type=goog.typeOf(val);return type=='array'||type=='object'&&typeof val.length=='number';};goog.isDateLike=function(val){return goog.isObject(val)&&typeof val.getFullYear=='function';};goog.isString=function(val){return typeof val=='string';};goog.isBoolean=function(val){return typeof val=='boolean';};goog.isNumber=function(val){return typeof val=='number';};goog.isFunction=function(val){return goog.typeOf(val)=='function';};goog.isObject=function(val){var type=typeof val;return type=='object'&&val!=null||type=='function';};goog.getUid=function(obj){return obj[goog.UID_PROPERTY_]||(obj[goog.UID_PROPERTY_]=++goog.uidCounter_);};goog.hasUid=function(obj){return!!obj[goog.UID_PROPERTY_];};goog.removeUid=function(obj){if('removeAttribute'in obj){obj.removeAttribute(goog.UID_PROPERTY_);}
try{delete obj[goog.UID_PROPERTY_];}catch(ex){}};goog.UID_PROPERTY_='closure_uid_'+((Math.random()*1e9)>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(obj){var type=goog.typeOf(obj);if(type=='object'||type=='array'){if(obj.clone){return obj.clone();}
var clone=type=='array'?[]:{};for(var key in obj){clone[key]=goog.cloneObject(obj[key]);}
return clone;}
return obj;};goog.bindNative_=function(fn,selfObj,var_args){return(fn.call.apply(fn.bind,arguments));};goog.bindJs_=function(fn,selfObj,var_args){if(!fn){throw new Error();}
if(arguments.length>2){var boundArgs=Array.prototype.slice.call(arguments,2);return function(){var newArgs=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(newArgs,boundArgs);return fn.apply(selfObj,newArgs);};}else{return function(){return fn.apply(selfObj,arguments);};}};goog.bind=function(fn,selfObj,var_args){if(Function.prototype.bind&&Function.prototype.bind.toString().indexOf('native code')!=-1){goog.bind=goog.bindNative_;}else{goog.bind=goog.bindJs_;}
return goog.bind.apply(null,arguments);};goog.partial=function(fn,var_args){var args=Array.prototype.slice.call(arguments,1);return function(){var newArgs=args.slice();newArgs.push.apply(newArgs,arguments);return fn.apply(this,newArgs);};};goog.mixin=function(target,source){for(var x in source){target[x]=source[x];}};goog.now=(goog.TRUSTED_SITE&&Date.now)||(function(){return+new Date();});goog.globalEval=function(script){if(goog.global.execScript){goog.global.execScript(script,'JavaScript');}else if(goog.global.eval){if(goog.evalWorksForGlobals_==null){goog.global.eval('var _et_ = 1;');if(typeof goog.global['_et_']!='undefined'){delete goog.global['_et_'];goog.evalWorksForGlobals_=true;}else{goog.evalWorksForGlobals_=false;}}
if(goog.evalWorksForGlobals_){goog.global.eval(script);}else{var doc=goog.global.document;var scriptElt=doc.createElement('script');scriptElt.type='text/javascript';scriptElt.defer=false;scriptElt.appendChild(doc.createTextNode(script));doc.body.appendChild(scriptElt);doc.body.removeChild(scriptElt);}}else{throw Error('goog.globalEval not available');}};goog.evalWorksForGlobals_=null;goog.cssNameMapping_;goog.cssNameMappingStyle_;goog.getCssName=function(className,opt_modifier){var getMapping=function(cssName){return goog.cssNameMapping_[cssName]||cssName;};var renameByParts=function(cssName){var parts=cssName.split('-');var mapped=[];for(var i=0;i<parts.length;i++){mapped.push(getMapping(parts[i]));}
return mapped.join('-');};var rename;if(goog.cssNameMapping_){rename=goog.cssNameMappingStyle_=='BY_WHOLE'?getMapping:renameByParts;}else{rename=function(a){return a;};}
if(opt_modifier){return className+'-'+rename(opt_modifier);}else{return rename(className);}};goog.setCssNameMapping=function(mapping,opt_style){goog.cssNameMapping_=mapping;goog.cssNameMappingStyle_=opt_style;};goog.global.CLOSURE_CSS_NAME_MAPPING;if(!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING){goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING;}
goog.getMsg=function(str,opt_values){var values=opt_values||{};for(var key in values){var value=(''+values[key]).replace(/\$/g,'$$$$');str=str.replace(new RegExp('\\{\\$'+key+'\\}','gi'),value);}
return str;};goog.getMsgWithFallback=function(a,b){return a;};goog.exportSymbol=function(publicPath,object,opt_objectToExportTo){goog.exportPath_(publicPath,object,opt_objectToExportTo);};goog.exportProperty=function(object,publicName,symbol){object[publicName]=symbol;};goog.inherits=function(childCtor,parentCtor){function tempCtor(){};tempCtor.prototype=parentCtor.prototype;childCtor.superClass_=parentCtor.prototype;childCtor.prototype=new tempCtor();childCtor.prototype.constructor=childCtor;childCtor.base=function(me,methodName,var_args){var args=Array.prototype.slice.call(arguments,2);return parentCtor.prototype[methodName].apply(me,args);};};goog.base=function(me,opt_methodName,var_args){var caller=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||(goog.DEBUG&&!caller)){throw Error('arguments.caller not defined. goog.base() cannot be used '+'with strict mode code. See '+'http://www.ecma-international.org/ecma-262/5.1/#sec-C');}
if(caller.superClass_){return caller.superClass_.constructor.apply(me,Array.prototype.slice.call(arguments,1));}
var args=Array.prototype.slice.call(arguments,2);var foundCaller=false;for(var ctor=me.constructor;ctor;ctor=ctor.superClass_&&ctor.superClass_.constructor){if(ctor.prototype[opt_methodName]===caller){foundCaller=true;}else if(foundCaller){return ctor.prototype[opt_methodName].apply(me,args);}}
if(me[opt_methodName]===caller){return me.constructor.prototype[opt_methodName].apply(me,args);}else{throw Error('goog.base called from a method of one name '+'to a method of a different name');}};goog.scope=function(fn){fn.call(goog.global);};if(!COMPILED){goog.global['COMPILED']=COMPILED;}
goog.provide('Msgs');Msgs=function(){};Msgs.NAMESPACE_='chromevox_';Msgs.getLocale=function(){return chrome.i18n.getMessage('locale');};Msgs.getMsg=function(messageId,opt_subs){var message=Msgs.Untranslated[messageId.toUpperCase()];if(message!==undefined)
return Msgs.applySubstitutions_(message,opt_subs);message=chrome.i18n.getMessage(Msgs.NAMESPACE_+messageId,opt_subs);if(message==undefined||message==''){throw new Error('Invalid ChromeVox message id: '+messageId);}
return message;};Msgs.addTranslatedMessagesToDom=function(root){var elts=root.querySelectorAll('.i18n');for(var i=0;i<elts.length;i++){var msgid=elts[i].getAttribute('msgid');if(!msgid){throw new Error('Element has no msgid attribute: '+elts[i]);}
var val=this.getMsg(msgid);if(elts[i].tagName=='INPUT'){elts[i].setAttribute('placeholder',val);}else{elts[i].textContent=val;}
elts[i].classList.add('i18n-processed');}};Msgs.getNumber=function(num){return''+num;};Msgs.applySubstitutions_=function(message,opt_subs){if(opt_subs){for(var i=0;i<opt_subs.length;i++){message=message.replace('$'+(i+1),opt_subs[i]);}}
return message;};Msgs.Untranslated={CHECKBOX_UNCHECKED_STATE_BRL:'( )',CHECKBOX_CHECKED_STATE_BRL:'(x)',RADIO_UNSELECTED_STATE_BRL:'( )',RADIO_SELECTED_STATE_BRL:'(x)',ARIA_HAS_SUBMENU_BRL:'->',ROLE_OPTION:' ',ROLE_OPTION_BRL:' ',ARIA_CHECKED_TRUE_BRL:'(x)',ARIA_CHECKED_FALSE_BRL:'( )',ARIA_CHECKED_MIXED_BRL:'(-)',ARIA_DISABLED_TRUE_BRL:'xx',ARIA_EXPANDED_TRUE_BRL:'-',ARIA_EXPANDED_FALSE_BRL:'+',ARIA_INVALID_TRUE_BRL:'!',ARIA_PRESSED_TRUE_BRL:'=',ARIA_PRESSED_FALSE_BRL:' ',ARIA_PRESSED_MIXED_BRL:'-',ARIA_SELECTED_TRUE_BRL:'(x)',ARIA_SELECTED_FALSE_BRL:'( )',HAS_SUBMENU_BRL:'->',TAG_TIME_BRL:' ',ARIA_VALUE_NOW:'$1',ARIA_VALUE_NOW_BRL:'$1',ARIA_VALUE_TEXT:'$1',ARIA_VALUE_TEXT_BRL:'$1',};goog.provide('cvox.BrailleTable');cvox.BrailleTable.Table;cvox.BrailleTable.TABLE_PATH='braille/tables.json';cvox.BrailleTable.COMMON_DEFS_FILENAME_='cvox-common.cti';cvox.BrailleTable.getAll=function(callback){function appendCommonFilename(tables){tables.forEach(function(table){table.fileNames+=(','+cvox.BrailleTable.COMMON_DEFS_FILENAME_);});return tables;}
var url=chrome.extension.getURL(cvox.BrailleTable.TABLE_PATH);if(!url){throw'Invalid path: '+cvox.BrailleTable.TABLE_PATH;}
var xhr=new XMLHttpRequest();xhr.open('GET',url,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200){callback(appendCommonFilename((JSON.parse(xhr.responseText))));}}};xhr.send();};cvox.BrailleTable.forId=function(tables,id){return tables.filter(function(table){return table.id===id})[0]||null;};cvox.BrailleTable.getUncontracted=function(tables,table){function mostUncontractedOf(current,candidate){if(current.dots==='6'&&candidate.dots==='8'&¤t.locale.lastIndexOf(candidate.locale,0)==0){return candidate;}
if(current.locale===candidate.locale&¤t.dots===candidate.dots&&goog.isDef(current.grade)&&goog.isDef(candidate.grade)&&candidate.grade<current.grade){return candidate;}
return current;}
return tables.reduce(mostUncontractedOf,table);};cvox.BrailleTable.getDisplayName=function(table){var localeName=chrome.accessibilityPrivate.getDisplayNameForLocale(table.locale,chrome.i18n.getUILanguage().toLowerCase());if(!table.grade&&!table.variant){return localeName;}else if(table.grade&&!table.variant){return Msgs.getMsg('braille_table_name_with_grade',[localeName,table.grade]);}else if(!table.grade&&table.variant){return Msgs.getMsg('braille_table_name_with_variant',[localeName,table.variant]);}else{return Msgs.getMsg('braille_table_name_with_variant_and_grade',[localeName,table.variant,table.grade]);}};goog.provide('Spannable');goog.scope(function(){Spannable=function(opt_string,opt_annotation){this.string_=opt_string instanceof Spannable?'':opt_string||'';this.spans_=[];if(opt_string instanceof Spannable)
this.append(opt_string);if(goog.isDef(opt_annotation)){var len=this.string_.length;this.spans_.push({value:opt_annotation,start:0,end:len});}};Spannable.prototype={toString:function(){return this.string_;},get length(){return this.string_.length;},setSpan:function(value,start,end){this.removeSpan(value);if(0<=start&&start<=end&&end<=this.string_.length){this.spans_.push({value:value,start:start,end:end});this.spans_.sort(function(a,b){var ret=a.start-b.start;if(ret==0)
ret=a.end-b.end;return ret;});}else{throw new RangeError('span out of range (start='+start+', end='+end+', len='+this.string_.length+')');}},removeSpan:function(value){for(var i=this.spans_.length-1;i>=0;i--){if(this.spans_[i].value===value){this.spans_.splice(i,1);}}},append:function(other){if(other instanceof Spannable){var otherSpannable=(other);var originalLength=this.length;this.string_+=otherSpannable.string_;other.spans_.forEach(function(span){this.setSpan(span.value,span.start+originalLength,span.end+originalLength);}.bind(this));}else if(typeof other==='string'){this.string_+=(other);}},getSpan:function(position){return valueOfSpan(this.spans_.find(spanCoversPosition(position)));},getSpanInstanceOf:function(constructor){return valueOfSpan(this.spans_.find(spanInstanceOf(constructor)));},getSpansInstanceOf:function(constructor){return(this.spans_.filter(spanInstanceOf(constructor)).map(valueOfSpan));},getSpans:function(position){return(this.spans_.filter(spanCoversPosition(position)).map(valueOfSpan));},hasSpan:function(value){return this.spans_.some(spanValueIs(value));},getSpanStart:function(value){return this.getSpanByValueOrThrow_(value).start;},getSpanEnd:function(value){return this.getSpanByValueOrThrow_(value).end;},getSpanLength:function(value){var span=this.getSpanByValueOrThrow_(value);return span.end-span.start;},getSpanByValueOrThrow_:function(value){var span=this.spans_.find(spanValueIs(value));if(span)
return span;throw new Error('Span '+value+' doesn\'t exist in spannable');},substring:function(start,opt_end){var end=goog.isDef(opt_end)?opt_end:this.string_.length;if(start<0||end>this.string_.length||start>end){throw new RangeError('substring indices out of range');}
var result=new Spannable(this.string_.substring(start,end));this.spans_.forEach(function(span){if(span.start<=end&&span.end>=start){var newStart=Math.max(0,span.start-start);var newEnd=Math.min(end-start,span.end-start);result.spans_.push({value:span.value,start:newStart,end:newEnd});}});return result;},trimLeft:function(){return this.trim_(true,false);},trimRight:function(){return this.trim_(false,true);},trim:function(){return this.trim_(true,true);},trim_:function(trimStart,trimEnd){if(!trimStart&&!trimEnd){return this;}
if(/^\s*$/.test(this.string_)){return this.substring(0,0);}
var trimmedStart=trimStart?this.string_.match(/^\s*/)[0].length:0;var trimmedEnd=trimEnd?this.string_.match(/\s*$/).index:this.string_.length;return this.substring(trimmedStart,trimmedEnd);},toJson:function(){var result={};result.string=this.string_;result.spans=[];this.spans_.forEach(function(span){var serializeInfo=serializableSpansByConstructor.get(span.value.constructor);if(serializeInfo){var spanObj={type:serializeInfo.name,start:span.start,end:span.end};if(serializeInfo.toJson){spanObj.value=serializeInfo.toJson.apply(span.value);}
result.spans.push(spanObj);}});return result;}};Spannable.fromJson=function(obj){if(typeof obj.string!=='string'){throw new Error('Invalid spannable json object: string field not a string');}
if(!(obj.spans instanceof Array)){throw new Error('Invalid spannable json object: no spans array');}
var result=new Spannable(obj.string);result.spans_=obj.spans.map(function(span){if(typeof span.type!=='string'){throw new Error('Invalid span in spannable json object: type not a string');}
if(typeof span.start!=='number'||typeof span.end!=='number'){throw new Error('Invalid span in spannable json object: start or end not a number');}
var serializeInfo=serializableSpansByName.get(span.type);var value=serializeInfo.fromJson(span.value);return{value:value,start:span.start,end:span.end};});return result;};Spannable.registerSerializableSpan=function(constructor,name,fromJson,toJson){var obj={name:name,fromJson:fromJson,toJson:toJson};serializableSpansByName.set(name,obj);serializableSpansByConstructor.set(constructor,obj);};Spannable.registerStatelessSerializableSpan=function(constructor,name){var obj={name:name,toJson:undefined};obj.fromJson=function(obj){return new constructor();};serializableSpansByName.set(name,obj);serializableSpansByConstructor.set(constructor,obj);};var SpanStruct;var SerializeInfo;var SerializedSpannable;var SerializedSpan;var serializableSpansByName=new Map();var serializableSpansByConstructor=new Map();function spanInstanceOf(constructor){return function(span){return span.value instanceof constructor;}}
function spanCoversPosition(position){return function(span){return span.start<=position&&position<span.end;}}
function spanValueIs(value){return function(span){return span.value===value;}}
function valueOfSpan(span){return span?span.value:undefined;}});goog.provide('cvox.ExtraCellsSpan');goog.provide('cvox.ValueSelectionSpan');goog.provide('cvox.ValueSpan');goog.require('Spannable');cvox.ValueSpan=function(offset){this.offset=offset;};cvox.ValueSpan.fromJson=function(obj){return new cvox.ValueSpan(obj.offset);};cvox.ValueSpan.prototype.toJson=function(){return this;};Spannable.registerSerializableSpan(cvox.ValueSpan,'cvox.ValueSpan',cvox.ValueSpan.fromJson,cvox.ValueSpan.prototype.toJson);cvox.ValueSelectionSpan=function(){};Spannable.registerStatelessSerializableSpan(cvox.ValueSelectionSpan,'cvox.ValueSelectionSpan');cvox.ExtraCellsSpan=function(){this.cells=new Uint8Array(0).buffer;};goog.provide('cvox.LibLouis');cvox.LibLouis=function(nmfPath,opt_tablesDir){this.nmfPath_=nmfPath;this.tablesDir_=goog.isDef(opt_tablesDir)?opt_tablesDir:null;this.embedElement_=null;this.pendingRpcCallbacks_={};this.nextMessageId_=1;};cvox.LibLouis.DEBUG=false;cvox.LibLouis.prototype.attachToElement=function(elem){if(this.isAttached()){throw Error('Instance already attached');}
var embed=document.createElement('embed');embed.src=this.nmfPath_;embed.type='application/x-nacl';embed.width=0;embed.height=0;if(!goog.isNull(this.tablesDir_)){embed.setAttribute('tablesdir',this.tablesDir_);}
embed.addEventListener('load',goog.bind(this.onInstanceLoad_,this),false);embed.addEventListener('error',goog.bind(this.onInstanceError_,this),false);embed.addEventListener('message',goog.bind(this.onInstanceMessage_,this),false);elem.appendChild(embed);this.embedElement_=(embed);};cvox.LibLouis.prototype.detach=function(){if(!this.isAttached()){throw Error('cannot detach unattached instance');}
this.embedElement_.parentNode.removeChild(this.embedElement_);this.embedElement_=null;for(var id in this.pendingRpcCallbacks_){this.pendingRpcCallbacks_[id]({});}
this.pendingRpcCallbacks_={};};cvox.LibLouis.prototype.isAttached=function(){return this.embedElement_!==null;};cvox.LibLouis.prototype.getTranslator=function(tableNames,callback){if(!this.isAttached()){callback(null);return;}
this.rpc_('CheckTable',{'table_names':tableNames},function(reply){if(reply['success']){var translator=new cvox.LibLouis.Translator(this,tableNames);callback(translator);}else{callback(null);}}.bind(this));};cvox.LibLouis.prototype.rpc_=function(command,message,callback){if(!this.isAttached()){throw Error('Cannot send RPC: liblouis instance not loaded');}
var messageId=''+this.nextMessageId_++;message['message_id']=messageId;message['command']=command;var json=JSON.stringify(message);if(cvox.LibLouis.DEBUG){window.console.debug('RPC -> '+json);}
this.embedElement_.postMessage(json);this.pendingRpcCallbacks_[messageId]=callback;};cvox.LibLouis.prototype.onInstanceLoad_=function(e){window.console.info('loaded liblouis Native Client instance');};cvox.LibLouis.prototype.onInstanceError_=function(e){window.console.error('failed to load liblouis Native Client instance');this.detach();};cvox.LibLouis.prototype.onInstanceMessage_=function(e){if(cvox.LibLouis.DEBUG){window.console.debug('RPC <- '+e.data);}
var message=(JSON.parse(e.data));var messageId=message['in_reply_to'];if(!goog.isDef(messageId)){window.console.warn('liblouis Native Client module sent message with no ID',message);return;}
if(goog.isDef(message['error'])){window.console.error('liblouis Native Client error',message['error']);}
var callback=this.pendingRpcCallbacks_[messageId];if(goog.isDef(callback)){delete this.pendingRpcCallbacks_[messageId];callback(message);}};cvox.LibLouis.Translator=function(instance,tableNames){this.instance_=instance;this.tableNames_=tableNames;};cvox.LibLouis.Translator.prototype.translate=function(text,callback){if(!this.instance_.isAttached()){callback(null,null,null);return;}
var message={'table_names':this.tableNames_,'text':text};this.instance_.rpc_('Translate',message,function(reply){var cells=null;var textToBraille=null;var brailleToText=null;if(reply['success']&&goog.isString(reply['cells'])){cells=cvox.LibLouis.Translator.decodeHexString_(reply['cells']);if(goog.isDef(reply['text_to_braille'])){textToBraille=reply['text_to_braille'];}
if(goog.isDef(reply['braille_to_text'])){brailleToText=reply['braille_to_text'];}}else if(text.length>0){console.error('Braille translation error for '+JSON.stringify(message));}
callback(cells,textToBraille,brailleToText);});};cvox.LibLouis.Translator.prototype.backTranslate=function(cells,callback){if(!this.instance_.isAttached()){callback(null);return;}
if(cells.byteLength==0){callback('');return;}
var message={'table_names':this.tableNames_,'cells':cvox.LibLouis.Translator.encodeHexString_(cells)};this.instance_.rpc_('BackTranslate',message,function(reply){if(reply['success']&&goog.isString(reply['text'])){callback(reply['text']);}else{callback(null);}});};cvox.LibLouis.Translator.decodeHexString_=function(hex){if(!/^([0-9a-f]{2})*$/i.test(hex)){throw Error('invalid hexadecimal string');}
var array=new Uint8Array(hex.length/2);var idx=0;for(var i=0;i<hex.length;i+=2){array[idx++]=parseInt(hex.substring(i,i+2),16);}
return array.buffer;};cvox.LibLouis.Translator.encodeHexString_=function(arrayBuffer){var array=new Uint8Array(arrayBuffer);var hex='';for(var i=0;i<array.length;i++){var b=array[i];hex+=(b<0x10?'0':'')+b.toString(16);}
return hex;};goog.provide('cvox.ExpandingBrailleTranslator');goog.require('Spannable');goog.require('cvox.ExtraCellsSpan');goog.require('cvox.LibLouis');goog.require('cvox.ValueSelectionSpan');goog.require('cvox.ValueSpan');cvox.ExpandingBrailleTranslator=function(defaultTranslator,opt_uncontractedTranslator){this.defaultTranslator_=defaultTranslator;this.uncontractedTranslator_=opt_uncontractedTranslator||null;};cvox.ExpandingBrailleTranslator.ExpansionType={NONE:0,SELECTION:1,ALL:2};cvox.ExpandingBrailleTranslator.prototype.translate=function(text,expansionType,callback){var expandRanges=this.findExpandRanges_(text,expansionType);var extraCellsSpans=text.getSpansInstanceOf(cvox.ExtraCellsSpan).filter(function(span){return span.cells.byteLength>0;});var extraCellsPositions=extraCellsSpans.map(function(span){return text.getSpanStart(span);});if(expandRanges.length==0&&extraCellsSpans.length==0){this.defaultTranslator_.translate(text.toString(),cvox.ExpandingBrailleTranslator.nullParamsToEmptyAdapter_(text.length,callback));return;}
var chunks=[];function maybeAddChunkToTranslate(translator,start,end){if(start<end)
chunks.push({translator:translator,start:start,end:end});}
function addExtraCellsChunk(pos,cells){var chunk={translator:null,start:pos,end:pos,cells:cells,textToBraille:[],brailleToText:new Array(cells.byteLength)};for(var i=0;i<cells.byteLength;++i)
chunk.brailleToText[i]=0;chunks.push(chunk);}
function addChunk(translator,start,end){while(extraCellsSpans.length>0&&extraCellsPositions[0]<=end){maybeAddChunkToTranslate(translator,start,extraCellsPositions[0]);start=extraCellsPositions.shift();addExtraCellsChunk(start,extraCellsSpans.shift().cells);}
maybeAddChunkToTranslate(translator,start,end);}
var lastEnd=0;for(var i=0;i<expandRanges.length;++i){var range=expandRanges[i];if(lastEnd<range.start){addChunk(this.defaultTranslator_,lastEnd,range.start);}
addChunk(this.uncontractedTranslator_,range.start,range.end);lastEnd=range.end;}
addChunk(this.defaultTranslator_,lastEnd,text.length);var chunksToTranslate=chunks.filter(function(chunk){return chunk.translator;});var numPendingCallbacks=chunksToTranslate.length;function chunkTranslated(chunk,cells,textToBraille,brailleToText){chunk.cells=cells;chunk.textToBraille=textToBraille;chunk.brailleToText=brailleToText;if(--numPendingCallbacks<=0)
finish();}
function finish(){var totalCells=chunks.reduce(function(accum,chunk){return accum+chunk.cells.byteLength},0);var cells=new Uint8Array(totalCells);var cellPos=0;var textToBraille=[];var brailleToText=[];function appendAdjusted(array,toAppend,adjustment){array.push.apply(array,toAppend.map(function(elem){return adjustment+elem;}));}
for(var i=0,chunk;chunk=chunks[i];++i){cells.set(new Uint8Array(chunk.cells),cellPos);appendAdjusted(textToBraille,chunk.textToBraille,cellPos);appendAdjusted(brailleToText,chunk.brailleToText,chunk.start);cellPos+=chunk.cells.byteLength;}
callback(cells.buffer,textToBraille,brailleToText);}
if(chunksToTranslate.length>0){chunksToTranslate.forEach(function(chunk){chunk.translator.translate(text.toString().substring(chunk.start,chunk.end),cvox.ExpandingBrailleTranslator.nullParamsToEmptyAdapter_(chunk.end-chunk.start,goog.partial(chunkTranslated,chunk)));});}else{finish();}};cvox.ExpandingBrailleTranslator.rangeForPosition_=function(str,pos,start,end){if(start<0||end>str.length){throw RangeError('End-points out of range looking for braille expansion range');}
if(pos<start||pos>=end){throw RangeError('Position out of range looking for braille expansion range');}
start=str.substring(start,pos+1).search(/(\s+|\S+)$/)+start;end=pos+/^(\s+|\S+)/.exec(str.substring(pos,end))[0].length;return{start:start,end:end};};cvox.ExpandingBrailleTranslator.prototype.findExpandRanges_=function(text,expansionType){var result=[];if(this.uncontractedTranslator_&&expansionType!=cvox.ExpandingBrailleTranslator.ExpansionType.NONE){var value=text.getSpanInstanceOf(cvox.ValueSpan);if(value){var valueStart=text.getSpanStart(value);var valueEnd=text.getSpanEnd(value);switch(expansionType){case cvox.ExpandingBrailleTranslator.ExpansionType.SELECTION:this.addRangesForSelection_(text,valueStart,valueEnd,result);break;case cvox.ExpandingBrailleTranslator.ExpansionType.ALL:result.push({start:valueStart,end:valueEnd});break;}}}
return result;};cvox.ExpandingBrailleTranslator.prototype.addRangesForSelection_=function(text,valueStart,valueEnd,outRanges){var selection=text.getSpanInstanceOf(cvox.ValueSelectionSpan);if(!selection){return;}
var selectionStart=text.getSpanStart(selection);var selectionEnd=text.getSpanEnd(selection);if(selectionStart<valueStart||selectionEnd>valueEnd){return;}
var expandPositions=[];if(selectionStart==valueEnd){if(selectionStart>valueStart){expandPositions.push(selectionStart-1);}}else{if(selectionStart==selectionEnd&&selectionStart>valueStart){expandPositions.push(selectionStart-1);}
expandPositions.push(selectionStart);if(selectionEnd>selectionStart+1){expandPositions.push(selectionEnd-1);}}
var lastRange=outRanges[outRanges.length-1]||null;for(var i=0;i<expandPositions.length;++i){var range=cvox.ExpandingBrailleTranslator.rangeForPosition_(text.toString(),expandPositions[i],valueStart,valueEnd);if(lastRange&&lastRange.end>=range.start){lastRange.end=range.end;}else{outRanges.push(range);lastRange=range;}}};cvox.ExpandingBrailleTranslator.nullParamsToEmptyAdapter_=function(inputLength,callback){return function(cells,textToBraille,brailleToText){if(!textToBraille){textToBraille=new Array(inputLength);for(var i=0;i<inputLength;++i){textToBraille[i]=0;}}
callback(cells||new ArrayBuffer(0),textToBraille,brailleToText||[]);};};cvox.ExpandingBrailleTranslator.Range_;goog.provide('cvox.BrailleTranslatorManager');goog.require('cvox.BrailleTable');goog.require('cvox.ExpandingBrailleTranslator');goog.require('cvox.LibLouis');cvox.BrailleTranslatorManager=function(opt_liblouisForTest){this.liblouis_=opt_liblouisForTest||new cvox.LibLouis(chrome.extension.getURL('braille/liblouis_nacl.nmf'),chrome.extension.getURL('braille/tables'));this.changeListeners_=[];this.tables_=[];this.expandingTranslator_=null;this.defaultTranslator_=null;this.defaultTableId_=null;this.uncontractedTranslator_=null;this.uncontractedTableId_=null;if(!opt_liblouisForTest){document.addEventListener('DOMContentLoaded',this.loadLiblouis_.bind(this),false);}};cvox.BrailleTranslatorManager.prototype={addChangeListener:function(listener){this.changeListeners_.push(listener);},refresh:function(){var tables=this.tables_;if(tables.length==0)
return;var table=cvox.BrailleTable.forId(tables,localStorage['brailleTable']);if(!table){var currentLocale=chrome.i18n.getMessage('@@ui_locale').split(/[_-]/);var major=currentLocale[0];var minor=currentLocale[1];var firstPass=tables.filter(function(table){return table.locale.split(/[_-]/)[0]==major;});if(firstPass.length>0){table=firstPass[0];if(minor){var secondPass=firstPass.filter(function(table){return table.locale.split(/[_-]/)[1]==minor;});if(secondPass.length>0)
table=secondPass[0];}}}
if(!table)
table=cvox.BrailleTable.forId(tables,'en-US-comp8');localStorage['brailleTable']=table.id;if(!localStorage['brailleTable6'])
localStorage['brailleTable6']='en-US-g1';if(!localStorage['brailleTable8'])
localStorage['brailleTable8']='en-US-comp8';if(table.dots=='6'){localStorage['brailleTableType']='brailleTable6';localStorage['brailleTable6']=table.id;}else{localStorage['brailleTableType']='brailleTable8';localStorage['brailleTable8']=table.id;}
var table8Dot=cvox.BrailleTable.forId(tables,localStorage['brailleTable8']);var uncontractedTable=cvox.BrailleTable.getUncontracted(tables,table8Dot||table);var newDefaultTableId=table.id;var newUncontractedTableId=table.id===uncontractedTable.id?null:uncontractedTable.id;if(newDefaultTableId===this.defaultTableId_&&newUncontractedTableId===this.uncontractedTableId_){return;}
var finishRefresh=function(defaultTranslator,uncontractedTranslator){this.defaultTableId_=newDefaultTableId;this.uncontractedTableId_=newUncontractedTableId;this.expandingTranslator_=new cvox.ExpandingBrailleTranslator(defaultTranslator,uncontractedTranslator);this.defaultTranslator_=defaultTranslator;this.uncontractedTranslator_=uncontractedTranslator;this.changeListeners_.forEach(function(listener){listener();});}.bind(this);this.liblouis_.getTranslator(table.fileNames,function(translator){if(!newUncontractedTableId){finishRefresh(translator,null);}else{this.liblouis_.getTranslator(uncontractedTable.fileNames,function(uncontractedTranslator){finishRefresh(translator,uncontractedTranslator);});}}.bind(this));},getExpandingTranslator:function(){return this.expandingTranslator_;},getDefaultTranslator:function(){return this.defaultTranslator_;},getUncontractedTranslator:function(){return this.uncontractedTranslator_;},fetchTables_:function(){cvox.BrailleTable.getAll(function(tables){this.tables_=tables;this.refresh();}.bind(this));},loadLiblouis_:function(){this.liblouis_.attachToElement((document.body));this.fetchTables_();},getLibLouisForTest:function(){return this.liblouis_;},getTablesForTest:function(){return this.tables_;}};goog.provide('cvox.AbstractEarcons');goog.provide('cvox.Earcon');cvox.Earcon={ALERT_MODAL:'alert_modal',ALERT_NONMODAL:'alert_nonmodal',BUTTON:'button',CHECK_OFF:'check_off',CHECK_ON:'check_on',EDITABLE_TEXT:'editable_text',INVALID_KEYPRESS:'invalid_keypress',LINK:'link',LISTBOX:'listbox',LIST_ITEM:'list_item',LONG_DESC:'long_desc',MATH:'math',OBJECT_CLOSE:'object_close',OBJECT_ENTER:'object_enter',OBJECT_EXIT:'object_exit',OBJECT_OPEN:'object_open',OBJECT_SELECT:'object_select',PAGE_FINISH_LOADING:'page_finish_loading',PAGE_START_LOADING:'page_start_loading',POP_UP_BUTTON:'pop_up_button',RECOVER_FOCUS:'recover_focus',SELECTION:'selection',SELECTION_REVERSE:'selection_reverse',SKIP:'skip',SLIDER:'slider',WRAP:'wrap',WRAP_EDGE:'wrap_edge',};cvox.AbstractEarcons=function(){};cvox.AbstractEarcons.enabled=true;cvox.AbstractEarcons.prototype.playEarcon=function(earcon){};cvox.AbstractEarcons.prototype.cancelEarcon=function(earcon){};cvox.AbstractEarcons.prototype.earconsAvailable=function(){return true;};cvox.AbstractEarcons.prototype.toggle=function(){cvox.AbstractEarcons.enabled=!cvox.AbstractEarcons.enabled;return cvox.AbstractEarcons.enabled;};goog.provide('cvox.ChromeVoxJSON');if(!cvox.ChromeVoxJSON){cvox.ChromeVoxJSON={};}
if(window.JSON&&window.JSON.toString()=='[object JSON]'){cvox.ChromeVoxJSON=window.JSON;}else{(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':'null';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return(this.valueOf());};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof cvox.ChromeVoxJSON.stringify!=='function'){cvox.ChromeVoxJSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof cvox.ChromeVoxJSON.parse!=='function'){cvox.ChromeVoxJSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());}
goog.provide('cvox.ExtensionBridge');goog.require('cvox.ChromeVoxJSON');cvox.ExtensionBridge=function(){};cvox.ExtensionBridge.init=function(){var self=cvox.ExtensionBridge;self.messageListeners=[];self.disconnectListeners=[];if(/^chrome-extension:\/\/.*background\.html$/.test(window.location.href)){self.context=self.BACKGROUND;self.initBackground();return;}
if(chrome&&chrome.extension){self.context=self.CONTENT_SCRIPT;self.initContentScript();}};cvox.ExtensionBridge.BACKGROUND=0;cvox.ExtensionBridge.CONTENT_SCRIPT=1;cvox.ExtensionBridge.PORT_NAME='cvox.ExtensionBridge.Port';cvox.ExtensionBridge.PING_MSG='cvox.ExtensionBridge.Ping';cvox.ExtensionBridge.PONG_MSG='cvox.ExtensionBridge.Pong';cvox.ExtensionBridge.send=function(message){var self=cvox.ExtensionBridge;switch(self.context){case self.BACKGROUND:self.sendBackgroundToContentScript(message);break;case self.CONTENT_SCRIPT:self.sendContentScriptToBackground(message);break;}};cvox.ExtensionBridge.addMessageListener=function(listener){cvox.ExtensionBridge.messageListeners.push(listener);};cvox.ExtensionBridge.addDisconnectListener=function(listener){cvox.ExtensionBridge.disconnectListeners.push(listener);};cvox.ExtensionBridge.removeMessageListeners=function(){cvox.ExtensionBridge.messageListeners.length=0;};cvox.ExtensionBridge.uniqueId=function(){return cvox.ExtensionBridge.id_;};cvox.ExtensionBridge.initBackground=function(){var self=cvox.ExtensionBridge;self.portCache_=[];self.nextPongId_=1;self.id_=0;var onConnectHandler=function(port){if(port.name!=self.PORT_NAME){return;}
self.portCache_.push(port);port.onMessage.addListener(function(message){if(message[cvox.ExtensionBridge.PING_MSG]){var pongMessage={};pongMessage[cvox.ExtensionBridge.PONG_MSG]=self.nextPongId_++;port.postMessage(pongMessage);return;}
for(var i=0;i<self.messageListeners.length;i++){self.messageListeners[i](message,port);}});port.onDisconnect.addListener(function(message){for(var i=0;i<self.portCache_.length;i++){if(self.portCache_[i]==port){self.portCache_.splice(i,1);break;}}});};chrome.extension.onConnect.addListener(onConnectHandler);};cvox.ExtensionBridge.initContentScript=function(){var self=cvox.ExtensionBridge;self.connected=false;self.pingAttempts=0;self.queuedMessages=[];self.id_=-1;var onMessageHandler=function(request,sender,sendResponse){if(request&&request['srcFile']){return;}
if(request[cvox.ExtensionBridge.PONG_MSG]){self.gotPongFromBackgroundPage(request[cvox.ExtensionBridge.PONG_MSG]);}else{for(var i=0;i<self.messageListeners.length;i++){self.messageListeners[i](request,cvox.ExtensionBridge.backgroundPort);}}
sendResponse({});};chrome.extension.onMessage.addListener(onMessageHandler);self.setupBackgroundPort();self.tryToPingBackgroundPage();};cvox.ExtensionBridge.setupBackgroundPort=function(){var self=cvox.ExtensionBridge;self.backgroundPort=chrome.extension.connect({name:self.PORT_NAME});if(!self.backgroundPort){return;}
self.backgroundPort.onMessage.addListener(function(message){if(message[cvox.ExtensionBridge.PONG_MSG]){self.gotPongFromBackgroundPage(message[cvox.ExtensionBridge.PONG_MSG]);}else{for(var i=0;i<self.messageListeners.length;i++){self.messageListeners[i](message,self.backgroundPort);}}});self.backgroundPort.onDisconnect.addListener(function(event){if(!self.connected){self.backgroundPort=null;return;}
for(var i=0;i<self.disconnectListeners.length;i++){self.disconnectListeners[i]();}});};cvox.ExtensionBridge.tryToPingBackgroundPage=function(){var self=cvox.ExtensionBridge;if(self.connected){return;}
self.pingAttempts++;if(self.pingAttempts>5){for(var i=0;i<self.disconnectListeners.length;i++){self.disconnectListeners[i]();}
return;}
var msg={};msg[cvox.ExtensionBridge.PING_MSG]=1;if(!self.backgroundPort){self.setupBackgroundPort();}
if(self.backgroundPort){self.backgroundPort.postMessage(msg);}
window.setTimeout(cvox.ExtensionBridge.tryToPingBackgroundPage,500);};cvox.ExtensionBridge.gotPongFromBackgroundPage=function(pongId){var self=cvox.ExtensionBridge;self.connected=true;self.id_=pongId;while(self.queuedMessages.length>0){self.sendContentScriptToBackground(self.queuedMessages.shift());}};cvox.ExtensionBridge.sendContentScriptToBackground=function(message){var self=cvox.ExtensionBridge;if(!self.connected){self.queuedMessages.push(message);return;}
if(cvox.ExtensionBridge.backgroundPort){cvox.ExtensionBridge.backgroundPort.postMessage(message);}else{chrome.extension.sendMessage(message);}};cvox.ExtensionBridge.sendBackgroundToContentScript=function(message){cvox.ExtensionBridge.portCache_.forEach(function(port){port.postMessage(message);});};cvox.ExtensionBridge.init();goog.provide('cvox.Cursor');cvox.Cursor=function(node,index,text){this.node=node;this.index=index;this.text=text;};cvox.Cursor.prototype.clone=function(){return new cvox.Cursor(this.node,this.index,this.text);};cvox.Cursor.prototype.copyFrom=function(otherCursor){this.node=otherCursor.node;this.index=otherCursor.index;this.text=otherCursor.text;};cvox.Cursor.prototype.equals=function(rhs){return this.node==rhs.node&&this.index==rhs.index&&this.text==rhs.text;};goog.provide('cvox.QueueMode');goog.provide('cvox.TtsCapturingEventListener');goog.provide('cvox.TtsCategory');goog.provide('cvox.TtsInterface');cvox.TtsCategory={LIVE:'live',NAV:'nav'};cvox.QueueMode={FLUSH:0,QUEUE:1,CATEGORY_FLUSH:2};cvox.TtsCapturingEventListener=function(){};cvox.TtsCapturingEventListener.prototype.onTtsStart=function(){};cvox.TtsCapturingEventListener.prototype.onTtsEnd=function(){};cvox.TtsInterface=function(){};cvox.TtsInterface.prototype.speak=function(textString,queueMode,properties){};cvox.TtsInterface.prototype.isSpeaking=function(){};cvox.TtsInterface.prototype.stop=function(){};cvox.TtsInterface.prototype.addCapturingEventListener=function(listener){};cvox.TtsInterface.prototype.increaseOrDecreaseProperty=function(propertyName,increase){};cvox.TtsInterface.prototype.propertyToPercentage=function(property){};cvox.TtsInterface.prototype.getDefaultProperty=function(property){};goog.provide('goog.debug.Error');goog.debug.Error=function(opt_msg){if(Error.captureStackTrace){Error.captureStackTrace(this,goog.debug.Error);}else{var stack=new Error().stack;if(stack){this.stack=stack;}}
if(opt_msg){this.message=String(opt_msg);}};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name='CustomError';goog.provide('goog.dom.NodeType');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.provide('goog.string');goog.string.subs=function(str,var_args){var splitParts=str.split('%s');var returnString='';var subsArguments=Array.prototype.slice.call(arguments,1);while(subsArguments.length&&splitParts.length>1){returnString+=splitParts.shift()+subsArguments.shift();}
return returnString+splitParts.join('%s');};goog.provide('goog.asserts');goog.provide('goog.asserts.AssertionError');goog.require('goog.debug.Error');goog.require('goog.dom.NodeType');goog.require('goog.string');goog.asserts.ENABLE_ASSERTS=goog.define('goog.asserts.ENABLE_ASSERTS',goog.DEBUG);goog.asserts.AssertionError=function(messagePattern,messageArgs){messageArgs.unshift(messagePattern);goog.debug.Error.call(this,goog.string.subs.apply(null,messageArgs));messageArgs.shift();this.messagePattern=messagePattern;};goog.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name='AssertionError';goog.asserts.doAssertFailure_=function(defaultMessage,defaultArgs,givenMessage,givenArgs){var message='Assertion failed';if(givenMessage){message+=': '+givenMessage;var args=givenArgs;}else if(defaultMessage){message+=': '+defaultMessage;args=defaultArgs;}
throw new goog.asserts.AssertionError(''+message,args||[]);};goog.asserts.assert=function(condition,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&!condition){goog.asserts.doAssertFailure_('',null,opt_message,Array.prototype.slice.call(arguments,2));}
return condition;};goog.asserts.fail=function(opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS){throw new goog.asserts.AssertionError('Failure'+(opt_message?': '+opt_message:''),Array.prototype.slice.call(arguments,1));}};goog.asserts.assertNumber=function(value,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(value)){goog.asserts.doAssertFailure_('Expected number but got %s: %s.',[goog.typeOf(value),value],opt_message,Array.prototype.slice.call(arguments,2));}
return(value);};goog.asserts.assertString=function(value,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&!goog.isString(value)){goog.asserts.doAssertFailure_('Expected string but got %s: %s.',[goog.typeOf(value),value],opt_message,Array.prototype.slice.call(arguments,2));}
return(value);};goog.asserts.assertFunction=function(value,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(value)){goog.asserts.doAssertFailure_('Expected function but got %s: %s.',[goog.typeOf(value),value],opt_message,Array.prototype.slice.call(arguments,2));}
return(value);};goog.asserts.assertObject=function(value,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&!goog.isObject(value)){goog.asserts.doAssertFailure_('Expected object but got %s: %s.',[goog.typeOf(value),value],opt_message,Array.prototype.slice.call(arguments,2));}
return(value);};goog.asserts.assertArray=function(value,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&!goog.isArray(value)){goog.asserts.doAssertFailure_('Expected array but got %s: %s.',[goog.typeOf(value),value],opt_message,Array.prototype.slice.call(arguments,2));}
return(value);};goog.asserts.assertBoolean=function(value,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(value)){goog.asserts.doAssertFailure_('Expected boolean but got %s: %s.',[goog.typeOf(value),value],opt_message,Array.prototype.slice.call(arguments,2));}
return(value);};goog.asserts.assertElement=function(value,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&(!goog.isObject(value)||value.nodeType!=goog.dom.NodeType.ELEMENT)){goog.asserts.doAssertFailure_('Expected Element but got %s: %s.',[goog.typeOf(value),value],opt_message,Array.prototype.slice.call(arguments,2));}
return(value);};goog.asserts.assertInstanceof=function(value,type,opt_message,var_args){if(goog.asserts.ENABLE_ASSERTS&&!(value instanceof type)){goog.asserts.doAssertFailure_('instanceof check failed.',null,opt_message,Array.prototype.slice.call(arguments,3));}
return value;};goog.asserts.assertObjectPrototypeIsIntact=function(){for(var key in Object.prototype){goog.asserts.fail(key+' should not be enumerable in Object.prototype.');}};goog.provide('goog.i18n.ordinalRules');goog.i18n.ordinalRules.Keyword={ZERO:'zero',ONE:'one',TWO:'two',FEW:'few',MANY:'many',OTHER:'other'};goog.i18n.ordinalRules.defaultSelect_=function(n,opt_precision){return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.decimals_=function(n){var str=n+'';var result=str.indexOf('.');return(result==-1)?0:str.length-result-1;};goog.i18n.ordinalRules.get_vf_=function(n,opt_precision){var DEFAULT_DIGITS=3;if(undefined===opt_precision){var v=Math.min(goog.i18n.ordinalRules.decimals_(n),DEFAULT_DIGITS);}else{var v=opt_precision;}
var base=Math.pow(10,v);var f=((n*base)|0)%base;return{v:v,f:f};};goog.i18n.ordinalRules.get_wt_=function(v,f){if(f===0){return{w:0,t:0};}
while((f%10)===0){f/=10;v--;}
return{w:v,t:f};};goog.i18n.ordinalRules.enSelect_=function(n,opt_precision){if(n%10==1&&n%100!=11){return goog.i18n.ordinalRules.Keyword.ONE;}
if(n%10==2&&n%100!=12){return goog.i18n.ordinalRules.Keyword.TWO;}
if(n%10==3&&n%100!=13){return goog.i18n.ordinalRules.Keyword.FEW;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.svSelect_=function(n,opt_precision){if((n%10==1||n%10==2)&&n%100!=11&&n%100!=12){return goog.i18n.ordinalRules.Keyword.ONE;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.huSelect_=function(n,opt_precision){if(n==1||n==5){return goog.i18n.ordinalRules.Keyword.ONE;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.kkSelect_=function(n,opt_precision){if(n%10==6||n%10==9||n%10==0&&n!=0){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.mrSelect_=function(n,opt_precision){if(n==1){return goog.i18n.ordinalRules.Keyword.ONE;}
if(n==2||n==3){return goog.i18n.ordinalRules.Keyword.TWO;}
if(n==4){return goog.i18n.ordinalRules.Keyword.FEW;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.sqSelect_=function(n,opt_precision){if(n==1){return goog.i18n.ordinalRules.Keyword.ONE;}
if(n%10==4&&n%100!=14){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.bnSelect_=function(n,opt_precision){if(n==1||n==5||n==7||n==8||n==9||n==10){return goog.i18n.ordinalRules.Keyword.ONE;}
if(n==2||n==3){return goog.i18n.ordinalRules.Keyword.TWO;}
if(n==4){return goog.i18n.ordinalRules.Keyword.FEW;}
if(n==6){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.guSelect_=function(n,opt_precision){if(n==1){return goog.i18n.ordinalRules.Keyword.ONE;}
if(n==2||n==3){return goog.i18n.ordinalRules.Keyword.TWO;}
if(n==4){return goog.i18n.ordinalRules.Keyword.FEW;}
if(n==6){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.kaSelect_=function(n,opt_precision){var i=n|0;if(i==1){return goog.i18n.ordinalRules.Keyword.ONE;}
if(i==0||(i%100>=2&&i%100<=20||i%100==40||i%100==60||i%100==80)){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.frSelect_=function(n,opt_precision){if(n==1){return goog.i18n.ordinalRules.Keyword.ONE;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.neSelect_=function(n,opt_precision){if(n>=1&&n<=4){return goog.i18n.ordinalRules.Keyword.ONE;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.cySelect_=function(n,opt_precision){if(n==0||n==7||n==8||n==9){return goog.i18n.ordinalRules.Keyword.ZERO;}
if(n==1){return goog.i18n.ordinalRules.Keyword.ONE;}
if(n==2){return goog.i18n.ordinalRules.Keyword.TWO;}
if(n==3||n==4){return goog.i18n.ordinalRules.Keyword.FEW;}
if(n==5||n==6){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.azSelect_=function(n,opt_precision){var i=n|0;if((i%10==1||i%10==2||i%10==5||i%10==7||i%10==8)||(i%100==20||i%100==50||i%100==70||i%100==80)){return goog.i18n.ordinalRules.Keyword.ONE;}
if((i%10==3||i%10==4)||(i%1000==100||i%1000==200||i%1000==300||i%1000==400||i%1000==500||i%1000==600||i%1000==700||i%1000==800||i%1000==900)){return goog.i18n.ordinalRules.Keyword.FEW;}
if(i==0||i%10==6||(i%100==40||i%100==60||i%100==90)){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.caSelect_=function(n,opt_precision){if(n==1||n==3){return goog.i18n.ordinalRules.Keyword.ONE;}
if(n==2){return goog.i18n.ordinalRules.Keyword.TWO;}
if(n==4){return goog.i18n.ordinalRules.Keyword.FEW;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.itSelect_=function(n,opt_precision){if(n==11||n==8||n==80||n==800){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.mkSelect_=function(n,opt_precision){var i=n|0;if(i%10==1&&i%100!=11){return goog.i18n.ordinalRules.Keyword.ONE;}
if(i%10==2&&i%100!=12){return goog.i18n.ordinalRules.Keyword.TWO;}
if((i%10==7||i%10==8)&&i%100!=17&&i%100!=18){return goog.i18n.ordinalRules.Keyword.MANY;}
return goog.i18n.ordinalRules.Keyword.OTHER;};goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;if(goog.LOCALE=='af'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='am'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ar'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='az'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.azSelect_;}
if(goog.LOCALE=='bg'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='bn'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.bnSelect_;}
if(goog.LOCALE=='br'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ca'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.caSelect_;}
if(goog.LOCALE=='chr'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='cs'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='cy'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.cySelect_;}
if(goog.LOCALE=='da'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='de'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='de_AT'||goog.LOCALE=='de-AT'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='de_CH'||goog.LOCALE=='de-CH'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='el'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='en'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='en_AU'||goog.LOCALE=='en-AU'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='en_GB'||goog.LOCALE=='en-GB'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='en_IE'||goog.LOCALE=='en-IE'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='en_IN'||goog.LOCALE=='en-IN'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='en_ISO'||goog.LOCALE=='en-ISO'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='en_SG'||goog.LOCALE=='en-SG'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='en_US'||goog.LOCALE=='en-US'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='en_ZA'||goog.LOCALE=='en-ZA'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.enSelect_;}
if(goog.LOCALE=='es'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='es_419'||goog.LOCALE=='es-419'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='es_ES'||goog.LOCALE=='es-ES'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='et'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='eu'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='fa'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='fi'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='fil'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='fr'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='fr_CA'||goog.LOCALE=='fr-CA'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='gl'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='gsw'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='gu'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.guSelect_;}
if(goog.LOCALE=='haw'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='he'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='hi'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.guSelect_;}
if(goog.LOCALE=='hr'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='hu'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.huSelect_;}
if(goog.LOCALE=='hy'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='id'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='in'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='is'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='it'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.itSelect_;}
if(goog.LOCALE=='iw'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ja'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ka'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.kaSelect_;}
if(goog.LOCALE=='kk'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.kkSelect_;}
if(goog.LOCALE=='km'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='kn'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ko'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ky'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ln'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='lo'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='lt'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='lv'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='mk'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.mkSelect_;}
if(goog.LOCALE=='ml'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='mn'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='mo'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='mr'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.mrSelect_;}
if(goog.LOCALE=='ms'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='mt'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='my'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='nb'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ne'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.neSelect_;}
if(goog.LOCALE=='nl'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='no'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='no_NO'||goog.LOCALE=='no-NO'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='or'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='pa'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='pl'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='pt'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='pt_BR'||goog.LOCALE=='pt-BR'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='pt_PT'||goog.LOCALE=='pt-PT'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ro'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='ru'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='sh'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='si'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='sk'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='sl'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='sq'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.sqSelect_;}
if(goog.LOCALE=='sr'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='sv'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.svSelect_;}
if(goog.LOCALE=='sw'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ta'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='te'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='th'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='tl'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='tr'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='uk'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='ur'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='uz'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='vi'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.frSelect_;}
if(goog.LOCALE=='zh'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='zh_CN'||goog.LOCALE=='zh-CN'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='zh_HK'||goog.LOCALE=='zh-HK'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='zh_TW'||goog.LOCALE=='zh-TW'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
if(goog.LOCALE=='zu'){goog.i18n.ordinalRules.select=goog.i18n.ordinalRules.defaultSelect_;}
goog.provide('goog.i18n.pluralRules');goog.i18n.pluralRules.Keyword={ZERO:'zero',ONE:'one',TWO:'two',FEW:'few',MANY:'many',OTHER:'other'};goog.i18n.pluralRules.defaultSelect_=function(n,opt_precision){return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.decimals_=function(n){var str=n+'';var result=str.indexOf('.');return(result==-1)?0:str.length-result-1;};goog.i18n.pluralRules.get_vf_=function(n,opt_precision){var DEFAULT_DIGITS=3;if(undefined===opt_precision){var v=Math.min(goog.i18n.pluralRules.decimals_(n),DEFAULT_DIGITS);}else{var v=opt_precision;}
var base=Math.pow(10,v);var f=((n*base)|0)%base;return{v:v,f:f};};goog.i18n.pluralRules.get_wt_=function(v,f){if(f===0){return{w:0,t:0};}
while((f%10)===0){f/=10;v--;}
return{w:v,t:f};};goog.i18n.pluralRules.gaSelect_=function(n,opt_precision){if(n==1){return goog.i18n.pluralRules.Keyword.ONE;}
if(n==2){return goog.i18n.pluralRules.Keyword.TWO;}
if(n>=3&&n<=6){return goog.i18n.pluralRules.Keyword.FEW;}
if(n>=7&&n<=10){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.roSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(i==1&&vf.v==0){return goog.i18n.pluralRules.Keyword.ONE;}
if(vf.v!=0||n==0||n!=1&&n%100>=1&&n%100<=19){return goog.i18n.pluralRules.Keyword.FEW;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.filSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(vf.v==0&&(i==1||i==2||i==3)||vf.v==0&&i%10!=4&&i%10!=6&&i%10!=9||vf.v!=0&&vf.f%10!=4&&vf.f%10!=6&&vf.f%10!=9){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.frSelect_=function(n,opt_precision){var i=n|0;if(i==0||i==1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.enSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(i==1&&vf.v==0){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.mtSelect_=function(n,opt_precision){if(n==1){return goog.i18n.pluralRules.Keyword.ONE;}
if(n==0||n%100>=2&&n%100<=10){return goog.i18n.pluralRules.Keyword.FEW;}
if(n%100>=11&&n%100<=19){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.daSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);var wt=goog.i18n.pluralRules.get_wt_(vf.v,vf.f);if(n==1||wt.t!=0&&(i==0||i==1)){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.gvSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(vf.v==0&&i%10==1){return goog.i18n.pluralRules.Keyword.ONE;}
if(vf.v==0&&i%10==2){return goog.i18n.pluralRules.Keyword.TWO;}
if(vf.v==0&&(i%100==0||i%100==20||i%100==40||i%100==60||i%100==80)){return goog.i18n.pluralRules.Keyword.FEW;}
if(vf.v!=0){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.cySelect_=function(n,opt_precision){if(n==0){return goog.i18n.pluralRules.Keyword.ZERO;}
if(n==1){return goog.i18n.pluralRules.Keyword.ONE;}
if(n==2){return goog.i18n.pluralRules.Keyword.TWO;}
if(n==3){return goog.i18n.pluralRules.Keyword.FEW;}
if(n==6){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.brSelect_=function(n,opt_precision){if(n%10==1&&n%100!=11&&n%100!=71&&n%100!=91){return goog.i18n.pluralRules.Keyword.ONE;}
if(n%10==2&&n%100!=12&&n%100!=72&&n%100!=92){return goog.i18n.pluralRules.Keyword.TWO;}
if((n%10>=3&&n%10<=4||n%10==9)&&(n%100<10||n%100>19)&&(n%100<70||n%100>79)&&(n%100<90||n%100>99)){return goog.i18n.pluralRules.Keyword.FEW;}
if(n!=0&&n%1000000==0){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.esSelect_=function(n,opt_precision){if(n==1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.siSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if((n==0||n==1)||i==0&&vf.f==1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.slSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(vf.v==0&&i%100==1){return goog.i18n.pluralRules.Keyword.ONE;}
if(vf.v==0&&i%100==2){return goog.i18n.pluralRules.Keyword.TWO;}
if(vf.v==0&&i%100>=3&&i%100<=4||vf.v!=0){return goog.i18n.pluralRules.Keyword.FEW;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.tzmSelect_=function(n,opt_precision){if(n>=0&&n<=1||n>=11&&n<=99){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.srSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(vf.v==0&&i%10==1&&i%100!=11||vf.f%10==1&&vf.f%100!=11){return goog.i18n.pluralRules.Keyword.ONE;}
if(vf.v==0&&i%10>=2&&i%10<=4&&(i%100<12||i%100>14)||vf.f%10>=2&&vf.f%10<=4&&(vf.f%100<12||vf.f%100>14)){return goog.i18n.pluralRules.Keyword.FEW;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.hiSelect_=function(n,opt_precision){var i=n|0;if(i==0||n==1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.mkSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(vf.v==0&&i%10==1||vf.f%10==1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.arSelect_=function(n,opt_precision){if(n==0){return goog.i18n.pluralRules.Keyword.ZERO;}
if(n==1){return goog.i18n.pluralRules.Keyword.ONE;}
if(n==2){return goog.i18n.pluralRules.Keyword.TWO;}
if(n%100>=3&&n%100<=10){return goog.i18n.pluralRules.Keyword.FEW;}
if(n%100>=11&&n%100<=99){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.iuSelect_=function(n,opt_precision){if(n==1){return goog.i18n.pluralRules.Keyword.ONE;}
if(n==2){return goog.i18n.pluralRules.Keyword.TWO;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.csSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(i==1&&vf.v==0){return goog.i18n.pluralRules.Keyword.ONE;}
if(i>=2&&i<=4&&vf.v==0){return goog.i18n.pluralRules.Keyword.FEW;}
if(vf.v!=0){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.pt_PTSelect_=function(n,opt_precision){var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(n==1&&vf.v==0){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.beSelect_=function(n,opt_precision){if(n%10==1&&n%100!=11){return goog.i18n.pluralRules.Keyword.ONE;}
if(n%10>=2&&n%10<=4&&(n%100<12||n%100>14)){return goog.i18n.pluralRules.Keyword.FEW;}
if(n%10==0||n%10>=5&&n%10<=9||n%100>=11&&n%100<=14){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.akSelect_=function(n,opt_precision){if(n>=0&&n<=1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.ptSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);var wt=goog.i18n.pluralRules.get_wt_(vf.v,vf.f);if(i==1&&vf.v==0||i==0&&wt.t==1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.plSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(i==1&&vf.v==0){return goog.i18n.pluralRules.Keyword.ONE;}
if(vf.v==0&&i%10>=2&&i%10<=4&&(i%100<12||i%100>14)){return goog.i18n.pluralRules.Keyword.FEW;}
if(vf.v==0&&i!=1&&i%10>=0&&i%10<=1||vf.v==0&&i%10>=5&&i%10<=9||vf.v==0&&i%100>=12&&i%100<=14){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.ruSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(vf.v==0&&i%10==1&&i%100!=11){return goog.i18n.pluralRules.Keyword.ONE;}
if(vf.v==0&&i%10>=2&&i%10<=4&&(i%100<12||i%100>14)){return goog.i18n.pluralRules.Keyword.FEW;}
if(vf.v==0&&i%10==0||vf.v==0&&i%10>=5&&i%10<=9||vf.v==0&&i%100>=11&&i%100<=14){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.lagSelect_=function(n,opt_precision){var i=n|0;if(n==0){return goog.i18n.pluralRules.Keyword.ZERO;}
if((i==0||i==1)&&n!=0){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.shiSelect_=function(n,opt_precision){var i=n|0;if(i==0||n==1){return goog.i18n.pluralRules.Keyword.ONE;}
if(n>=2&&n<=10){return goog.i18n.pluralRules.Keyword.FEW;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.heSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(i==1&&vf.v==0){return goog.i18n.pluralRules.Keyword.ONE;}
if(i==2&&vf.v==0){return goog.i18n.pluralRules.Keyword.TWO;}
if(vf.v==0&&(n<0||n>10)&&n%10==0){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.isSelect_=function(n,opt_precision){var i=n|0;var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);var wt=goog.i18n.pluralRules.get_wt_(vf.v,vf.f);if(wt.t==0&&i%10==1&&i%100!=11||wt.t!=0){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.ltSelect_=function(n,opt_precision){var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(n%10==1&&(n%100<11||n%100>19)){return goog.i18n.pluralRules.Keyword.ONE;}
if(n%10>=2&&n%10<=9&&(n%100<11||n%100>19)){return goog.i18n.pluralRules.Keyword.FEW;}
if(vf.f!=0){return goog.i18n.pluralRules.Keyword.MANY;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.gdSelect_=function(n,opt_precision){if(n==1||n==11){return goog.i18n.pluralRules.Keyword.ONE;}
if(n==2||n==12){return goog.i18n.pluralRules.Keyword.TWO;}
if(n>=3&&n<=10||n>=13&&n<=19){return goog.i18n.pluralRules.Keyword.FEW;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.lvSelect_=function(n,opt_precision){var vf=goog.i18n.pluralRules.get_vf_(n,opt_precision);if(n%10==0||n%100>=11&&n%100<=19||vf.v==2&&vf.f%100>=11&&vf.f%100<=19){return goog.i18n.pluralRules.Keyword.ZERO;}
if(n%10==1&&n%100!=11||vf.v==2&&vf.f%10==1&&vf.f%100!=11||vf.v!=2&&vf.f%10==1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.kshSelect_=function(n,opt_precision){if(n==0){return goog.i18n.pluralRules.Keyword.ZERO;}
if(n==1){return goog.i18n.pluralRules.Keyword.ONE;}
return goog.i18n.pluralRules.Keyword.OTHER;};goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;if(goog.LOCALE=='af'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='am'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_;}
if(goog.LOCALE=='ar'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.arSelect_;}
if(goog.LOCALE=='az'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='bg'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='bn'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_;}
if(goog.LOCALE=='br'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.brSelect_;}
if(goog.LOCALE=='ca'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='chr'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='cs'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.csSelect_;}
if(goog.LOCALE=='cy'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.cySelect_;}
if(goog.LOCALE=='da'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.daSelect_;}
if(goog.LOCALE=='de'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='de_AT'||goog.LOCALE=='de-AT'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='de_CH'||goog.LOCALE=='de-CH'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='el'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='en'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='en_AU'||goog.LOCALE=='en-AU'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='en_GB'||goog.LOCALE=='en-GB'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='en_IE'||goog.LOCALE=='en-IE'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='en_IN'||goog.LOCALE=='en-IN'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='en_ISO'||goog.LOCALE=='en-ISO'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='en_SG'||goog.LOCALE=='en-SG'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='en_US'||goog.LOCALE=='en-US'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='en_ZA'||goog.LOCALE=='en-ZA'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='es'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='es_419'||goog.LOCALE=='es-419'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='es_ES'||goog.LOCALE=='es-ES'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='et'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='eu'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='fa'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_;}
if(goog.LOCALE=='fi'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='fil'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.filSelect_;}
if(goog.LOCALE=='fr'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.frSelect_;}
if(goog.LOCALE=='fr_CA'||goog.LOCALE=='fr-CA'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.frSelect_;}
if(goog.LOCALE=='gl'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='gsw'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='gu'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_;}
if(goog.LOCALE=='haw'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='he'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.heSelect_;}
if(goog.LOCALE=='hi'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_;}
if(goog.LOCALE=='hr'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.srSelect_;}
if(goog.LOCALE=='hu'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='hy'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.frSelect_;}
if(goog.LOCALE=='id'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='in'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='is'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.isSelect_;}
if(goog.LOCALE=='it'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='iw'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.heSelect_;}
if(goog.LOCALE=='ja'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='ka'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='kk'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='km'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='kn'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_;}
if(goog.LOCALE=='ko'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='ky'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='ln'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.akSelect_;}
if(goog.LOCALE=='lo'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='lt'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.ltSelect_;}
if(goog.LOCALE=='lv'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.lvSelect_;}
if(goog.LOCALE=='mk'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.mkSelect_;}
if(goog.LOCALE=='ml'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='mn'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='mo'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.roSelect_;}
if(goog.LOCALE=='mr'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_;}
if(goog.LOCALE=='ms'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='mt'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.mtSelect_;}
if(goog.LOCALE=='my'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='nb'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='ne'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='nl'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='no'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='no_NO'||goog.LOCALE=='no-NO'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='or'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='pa'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.akSelect_;}
if(goog.LOCALE=='pl'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.plSelect_;}
if(goog.LOCALE=='pt'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.ptSelect_;}
if(goog.LOCALE=='pt_BR'||goog.LOCALE=='pt-BR'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.ptSelect_;}
if(goog.LOCALE=='pt_PT'||goog.LOCALE=='pt-PT'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.pt_PTSelect_;}
if(goog.LOCALE=='ro'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.roSelect_;}
if(goog.LOCALE=='ru'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.ruSelect_;}
if(goog.LOCALE=='sh'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.srSelect_;}
if(goog.LOCALE=='si'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.siSelect_;}
if(goog.LOCALE=='sk'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.csSelect_;}
if(goog.LOCALE=='sl'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.slSelect_;}
if(goog.LOCALE=='sq'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='sr'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.srSelect_;}
if(goog.LOCALE=='sv'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='sw'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='ta'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='te'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='th'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='tl'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.filSelect_;}
if(goog.LOCALE=='tr'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='uk'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.ruSelect_;}
if(goog.LOCALE=='ur'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.enSelect_;}
if(goog.LOCALE=='uz'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.esSelect_;}
if(goog.LOCALE=='vi'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='zh'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='zh_CN'||goog.LOCALE=='zh-CN'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='zh_HK'||goog.LOCALE=='zh-HK'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='zh_TW'||goog.LOCALE=='zh-TW'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.defaultSelect_;}
if(goog.LOCALE=='zu'){goog.i18n.pluralRules.select=goog.i18n.pluralRules.hiSelect_;}
goog.provide('goog.i18n.MessageFormat');goog.require('goog.asserts');goog.require('goog.i18n.ordinalRules');goog.require('goog.i18n.pluralRules');goog.i18n.MessageFormat=function(pattern){this.literals_=[];this.parsedPattern_=[];this.parsePattern_(pattern);};goog.i18n.MessageFormat.LITERAL_PLACEHOLDER_='\uFDDF_';goog.i18n.MessageFormat.Element_={STRING:0,BLOCK:1};goog.i18n.MessageFormat.BlockType_={PLURAL:0,ORDINAL:1,SELECT:2,SIMPLE:3,STRING:4,UNKNOWN:5};goog.i18n.MessageFormat.OTHER_='other';goog.i18n.MessageFormat.REGEX_LITERAL_=new RegExp("'([{}#].*?)'",'g');goog.i18n.MessageFormat.REGEX_DOUBLE_APOSTROPHE_=new RegExp("''",'g');goog.i18n.MessageFormat.prototype.format=function(namedParameters){return this.format_(namedParameters,false);};goog.i18n.MessageFormat.prototype.formatIgnoringPound=function(namedParameters){return this.format_(namedParameters,true);};goog.i18n.MessageFormat.prototype.format_=function(namedParameters,ignorePound){if(this.parsedPattern_.length==0){return'';}
var result=[];this.formatBlock_(this.parsedPattern_,namedParameters,ignorePound,result);var message=result.join('');if(!ignorePound){goog.asserts.assert(message.search('#')==-1,'Not all # were replaced.');}
while(this.literals_.length>0){message=message.replace(this.buildPlaceholder_(this.literals_),this.literals_.pop());}
return message;};goog.i18n.MessageFormat.prototype.formatBlock_=function(parsedPattern,namedParameters,ignorePound,result){for(var i=0;i<parsedPattern.length;i++){switch(parsedPattern[i].type){case goog.i18n.MessageFormat.BlockType_.STRING:result.push(parsedPattern[i].value);break;case goog.i18n.MessageFormat.BlockType_.SIMPLE:var pattern=parsedPattern[i].value;this.formatSimplePlaceholder_(pattern,namedParameters,result);break;case goog.i18n.MessageFormat.BlockType_.SELECT:var pattern=parsedPattern[i].value;this.formatSelectBlock_(pattern,namedParameters,ignorePound,result);break;case goog.i18n.MessageFormat.BlockType_.PLURAL:var pattern=parsedPattern[i].value;this.formatPluralOrdinalBlock_(pattern,namedParameters,goog.i18n.pluralRules.select,ignorePound,result);break;case goog.i18n.MessageFormat.BlockType_.ORDINAL:var pattern=parsedPattern[i].value;this.formatPluralOrdinalBlock_(pattern,namedParameters,goog.i18n.ordinalRules.select,ignorePound,result);break;default:goog.asserts.fail('Unrecognized block type.');}}};goog.i18n.MessageFormat.prototype.formatSimplePlaceholder_=function(parsedPattern,namedParameters,result){var value=namedParameters[parsedPattern];if(!goog.isDef(value)){result.push('Undefined parameter - '+parsedPattern);return;}
this.literals_.push(value);result.push(this.buildPlaceholder_(this.literals_));};goog.i18n.MessageFormat.prototype.formatSelectBlock_=function(parsedPattern,namedParameters,ignorePound,result){var argumentIndex=parsedPattern.argumentIndex;if(!goog.isDef(namedParameters[argumentIndex])){result.push('Undefined parameter - '+argumentIndex);return;}
var option=parsedPattern[namedParameters[argumentIndex]];if(!goog.isDef(option)){option=parsedPattern[goog.i18n.MessageFormat.OTHER_];goog.asserts.assertArray(option,'Invalid option or missing other option for select block.');}
this.formatBlock_(option,namedParameters,ignorePound,result);};goog.i18n.MessageFormat.prototype.formatPluralOrdinalBlock_=function(parsedPattern,namedParameters,pluralSelector,ignorePound,result){var argumentIndex=parsedPattern.argumentIndex;var argumentOffset=parsedPattern.argumentOffset;var pluralValue=+namedParameters[argumentIndex];if(isNaN(pluralValue)){result.push('Undefined or invalid parameter - '+argumentIndex);return;}
var diff=pluralValue-argumentOffset;var option=parsedPattern[namedParameters[argumentIndex]];if(!goog.isDef(option)){goog.asserts.assert(diff>=0,'Argument index smaller than offset.');var item;item=pluralSelector(diff);goog.asserts.assertString(item,'Invalid plural key.');option=parsedPattern[item];if(!goog.isDef(option)){option=parsedPattern[goog.i18n.MessageFormat.OTHER_];}
goog.asserts.assertArray(option,'Invalid option or missing other option for plural block.');}
var pluralResult=[];this.formatBlock_(option,namedParameters,ignorePound,pluralResult);var plural=pluralResult.join('');goog.asserts.assertString(plural,'Empty block in plural.');if(ignorePound){result.push(plural);}else{var localeAwareDiff=diff.toLocaleString();result.push(plural.replace(/#/g,localeAwareDiff));}};goog.i18n.MessageFormat.prototype.parsePattern_=function(pattern){if(pattern){pattern=this.insertPlaceholders_(pattern);this.parsedPattern_=this.parseBlock_(pattern);}};goog.i18n.MessageFormat.prototype.insertPlaceholders_=function(pattern){var literals=this.literals_;var buildPlaceholder=goog.bind(this.buildPlaceholder_,this);pattern=pattern.replace(goog.i18n.MessageFormat.REGEX_DOUBLE_APOSTROPHE_,function(){literals.push("'");return buildPlaceholder(literals);});pattern=pattern.replace(goog.i18n.MessageFormat.REGEX_LITERAL_,function(match,text){literals.push(text);return buildPlaceholder(literals);});return pattern;};goog.i18n.MessageFormat.prototype.extractParts_=function(pattern){var prevPos=0;var inBlock=false;var braceStack=[];var results=[];var braces=/[{}]/g;braces.lastIndex=0;var match;while(match=braces.exec(pattern)){var pos=match.index;if(match[0]=='}'){var brace=braceStack.pop();goog.asserts.assert(goog.isDef(brace)&&brace=='{','No matching { for }.');if(braceStack.length==0){var part={};part.type=goog.i18n.MessageFormat.Element_.BLOCK;part.value=pattern.substring(prevPos,pos);results.push(part);prevPos=pos+1;inBlock=false;}}else{if(braceStack.length==0){inBlock=true;var substring=pattern.substring(prevPos,pos);if(substring!=''){results.push({type:goog.i18n.MessageFormat.Element_.STRING,value:substring});}
prevPos=pos+1;}
braceStack.push('{');}}
goog.asserts.assert(braceStack.length==0,'There are mismatched { or } in the pattern.');var substring=pattern.substring(prevPos);if(substring!=''){results.push({type:goog.i18n.MessageFormat.Element_.STRING,value:substring});}
return results;};goog.i18n.MessageFormat.PLURAL_BLOCK_RE_=/^\s*(\w+)\s*,\s*plural\s*,(?:\s*offset:(\d+))?/;goog.i18n.MessageFormat.ORDINAL_BLOCK_RE_=/^\s*(\w+)\s*,\s*selectordinal\s*,/;goog.i18n.MessageFormat.SELECT_BLOCK_RE_=/^\s*(\w+)\s*,\s*select\s*,/;goog.i18n.MessageFormat.prototype.parseBlockType_=function(pattern){if(goog.i18n.MessageFormat.PLURAL_BLOCK_RE_.test(pattern)){return goog.i18n.MessageFormat.BlockType_.PLURAL;}
if(goog.i18n.MessageFormat.ORDINAL_BLOCK_RE_.test(pattern)){return goog.i18n.MessageFormat.BlockType_.ORDINAL;}
if(goog.i18n.MessageFormat.SELECT_BLOCK_RE_.test(pattern)){return goog.i18n.MessageFormat.BlockType_.SELECT;}
if(/^\s*\w+\s*/.test(pattern)){return goog.i18n.MessageFormat.BlockType_.SIMPLE;}
return goog.i18n.MessageFormat.BlockType_.UNKNOWN;};goog.i18n.MessageFormat.prototype.parseBlock_=function(pattern){var result=[];var parts=this.extractParts_(pattern);for(var i=0;i<parts.length;i++){var block={};if(goog.i18n.MessageFormat.Element_.STRING==parts[i].type){block.type=goog.i18n.MessageFormat.BlockType_.STRING;block.value=parts[i].value;}else if(goog.i18n.MessageFormat.Element_.BLOCK==parts[i].type){var blockType=this.parseBlockType_(parts[i].value);switch(blockType){case goog.i18n.MessageFormat.BlockType_.SELECT:block.type=goog.i18n.MessageFormat.BlockType_.SELECT;block.value=this.parseSelectBlock_(parts[i].value);break;case goog.i18n.MessageFormat.BlockType_.PLURAL:block.type=goog.i18n.MessageFormat.BlockType_.PLURAL;block.value=this.parsePluralBlock_(parts[i].value);break;case goog.i18n.MessageFormat.BlockType_.ORDINAL:block.type=goog.i18n.MessageFormat.BlockType_.ORDINAL;block.value=this.parseOrdinalBlock_(parts[i].value);break;case goog.i18n.MessageFormat.BlockType_.SIMPLE:block.type=goog.i18n.MessageFormat.BlockType_.SIMPLE;block.value=parts[i].value;break;default:goog.asserts.fail('Unknown block type.');}}else{goog.asserts.fail('Unknown part of the pattern.');}
result.push(block);}
return result;};goog.i18n.MessageFormat.prototype.parseSelectBlock_=function(pattern){var argumentIndex='';var replaceRegex=goog.i18n.MessageFormat.SELECT_BLOCK_RE_;pattern=pattern.replace(replaceRegex,function(string,name){argumentIndex=name;return'';});var result={};result.argumentIndex=argumentIndex;var parts=this.extractParts_(pattern);var pos=0;while(pos<parts.length){var key=parts[pos].value;goog.asserts.assertString(key,'Missing select key element.');pos++;goog.asserts.assert(pos<parts.length,'Missing or invalid select value element.');if(goog.i18n.MessageFormat.Element_.BLOCK==parts[pos].type){var value=this.parseBlock_(parts[pos].value);}else{goog.asserts.fail('Expected block type.');}
result[key.replace(/\s/g,'')]=value;pos++;}
goog.asserts.assertArray(result[goog.i18n.MessageFormat.OTHER_],'Missing other key in select statement.');return result;};goog.i18n.MessageFormat.prototype.parsePluralBlock_=function(pattern){var argumentIndex='';var argumentOffset=0;var replaceRegex=goog.i18n.MessageFormat.PLURAL_BLOCK_RE_;pattern=pattern.replace(replaceRegex,function(string,name,offset){argumentIndex=name;if(offset){argumentOffset=parseInt(offset,10);}
return'';});var result={};result.argumentIndex=argumentIndex;result.argumentOffset=argumentOffset;var parts=this.extractParts_(pattern);var pos=0;while(pos<parts.length){var key=parts[pos].value;goog.asserts.assertString(key,'Missing plural key element.');pos++;goog.asserts.assert(pos<parts.length,'Missing or invalid plural value element.');if(goog.i18n.MessageFormat.Element_.BLOCK==parts[pos].type){var value=this.parseBlock_(parts[pos].value);}else{goog.asserts.fail('Expected block type.');}
result[key.replace(/\s*(?:=)?(\w+)\s*/,'$1')]=value;pos++;}
goog.asserts.assertArray(result[goog.i18n.MessageFormat.OTHER_],'Missing other key in plural statement.');return result;};goog.i18n.MessageFormat.prototype.parseOrdinalBlock_=function(pattern){var argumentIndex='';var replaceRegex=goog.i18n.MessageFormat.ORDINAL_BLOCK_RE_;pattern=pattern.replace(replaceRegex,function(string,name){argumentIndex=name;return'';});var result={};result.argumentIndex=argumentIndex;result.argumentOffset=0;var parts=this.extractParts_(pattern);var pos=0;while(pos<parts.length){var key=parts[pos].value;goog.asserts.assertString(key,'Missing ordinal key element.');pos++;goog.asserts.assert(pos<parts.length,'Missing or invalid ordinal value element.');if(goog.i18n.MessageFormat.Element_.BLOCK==parts[pos].type){var value=this.parseBlock_(parts[pos].value);}else{goog.asserts.fail('Expected block type.');}
result[key.replace(/\s*(?:=)?(\w+)\s*/,'$1')]=value;pos++;}
goog.asserts.assertArray(result[goog.i18n.MessageFormat.OTHER_],'Missing other key in selectordinal statement.');return result;};goog.i18n.MessageFormat.prototype.buildPlaceholder_=function(literals){goog.asserts.assert(literals.length>0,'Literal array is empty.');var index=(literals.length-1).toString(10);return goog.i18n.MessageFormat.LITERAL_PLACEHOLDER_+index+'_';};goog.provide('cvox.AbstractTts');goog.require('Msgs');goog.require('cvox.TtsInterface');goog.require('goog.i18n.MessageFormat');cvox.AbstractTts=function(){this.ttsProperties=new Object();this.propertyDefault={'rate':0.5,'pitch':0.5,'volume':0.5};this.propertyMin={'rate':0.0,'pitch':0.0,'volume':0.0};this.propertyMax={'rate':1.0,'pitch':1.0,'volume':1.0};this.propertyStep={'rate':0.1,'pitch':0.1,'volume':0.1};if(cvox.AbstractTts.pronunciationDictionaryRegexp_==undefined){var words=[];for(var word in cvox.AbstractTts.PRONUNCIATION_DICTIONARY){words.push(word);}
var expr='\\b('+words.join('|')+')\\b';cvox.AbstractTts.pronunciationDictionaryRegexp_=new RegExp(expr,'ig');}
if(cvox.AbstractTts.substitutionDictionaryRegexp_==undefined){var symbols=[];for(var symbol in cvox.AbstractTts.SUBSTITUTION_DICTIONARY){symbols.push(symbol);}
var expr='('+symbols.join('|')+')';cvox.AbstractTts.substitutionDictionaryRegexp_=new RegExp(expr,'ig');}};cvox.AbstractTts.prototype.ttsProperties;cvox.AbstractTts.prototype.speak=function(textString,queueMode,properties){return this;};cvox.AbstractTts.prototype.isSpeaking=function(){return false;};cvox.AbstractTts.prototype.stop=function(){};cvox.AbstractTts.prototype.addCapturingEventListener=function(listener){};cvox.AbstractTts.prototype.increaseOrDecreaseProperty=function(propertyName,increase){var min=this.propertyMin[propertyName];var max=this.propertyMax[propertyName];var step=this.propertyStep[propertyName];var current=this.ttsProperties[propertyName];current=increase?current+step:current-step;this.ttsProperties[propertyName]=Math.max(Math.min(current,max),min);};cvox.AbstractTts.prototype.propertyToPercentage=function(property){return(this.ttsProperties[property]-this.propertyMin[property])/Math.abs(this.propertyMax[property]-this.propertyMin[property]);};cvox.AbstractTts.prototype.mergeProperties=function(properties){var mergedProperties=new Object();var p;if(this.ttsProperties){for(p in this.ttsProperties){mergedProperties[p]=this.ttsProperties[p];}}
if(properties){var tts=cvox.AbstractTts;if(typeof(properties[tts.VOLUME])=='number'){mergedProperties[tts.VOLUME]=properties[tts.VOLUME];}
if(typeof(properties[tts.PITCH])=='number'){mergedProperties[tts.PITCH]=properties[tts.PITCH];}
if(typeof(properties[tts.RATE])=='number'){mergedProperties[tts.RATE]=properties[tts.RATE];}
if(typeof(properties[tts.LANG])=='string'){mergedProperties[tts.LANG]=properties[tts.LANG];}
var context=this;var mergeRelativeProperty=function(abs,rel){if(typeof(properties[rel])=='number'&&typeof(mergedProperties[abs])=='number'){mergedProperties[abs]+=properties[rel];var min=context.propertyMin[abs];var max=context.propertyMax[abs];if(mergedProperties[abs]>max){mergedProperties[abs]=max;}else if(mergedProperties[abs]<min){mergedProperties[abs]=min;}}};mergeRelativeProperty(tts.VOLUME,tts.RELATIVE_VOLUME);mergeRelativeProperty(tts.PITCH,tts.RELATIVE_PITCH);mergeRelativeProperty(tts.RATE,tts.RELATIVE_RATE);}
for(p in properties){if(!mergedProperties.hasOwnProperty(p)){mergedProperties[p]=properties[p];}}
return mergedProperties;};cvox.AbstractTts.prototype.preprocess=function(text,properties){if(text.length==1&&text>='A'&&text<='Z'){for(var prop in cvox.AbstractTts.PERSONALITY_CAPITAL)
properties[prop]=cvox.AbstractTts.PERSONALITY_CAPITAL[prop];}
text=text.replace(cvox.AbstractTts.substitutionDictionaryRegexp_,function(symbol){return' '+cvox.AbstractTts.SUBSTITUTION_DICTIONARY[symbol]+' ';});if(text.length==1){return cvox.AbstractTts.CHARACTER_DICTIONARY[text]?(new goog.i18n.MessageFormat(Msgs.getMsg(cvox.AbstractTts.CHARACTER_DICTIONARY[text]))).format({'COUNT':1}):text.toUpperCase();}
text=text.replace(cvox.AbstractTts.pronunciationDictionaryRegexp_,function(word){return cvox.AbstractTts.PRONUNCIATION_DICTIONARY[word.toLowerCase()];});text=text.replace(cvox.AbstractTts.repetitionRegexp_,cvox.AbstractTts.repetitionReplace_);return text;};cvox.AbstractTts.RATE='rate';cvox.AbstractTts.PITCH='pitch';cvox.AbstractTts.VOLUME='volume';cvox.AbstractTts.LANG='lang';cvox.AbstractTts.RELATIVE_RATE='relativeRate';cvox.AbstractTts.RELATIVE_PITCH='relativePitch';cvox.AbstractTts.RELATIVE_VOLUME='relativeVolume';cvox.AbstractTts.COLOR='color';cvox.AbstractTts.FONT_WEIGHT='fontWeight';cvox.AbstractTts.PUNCTUATION_ECHO='punctuationEcho';cvox.AbstractTts.PAUSE='pause';cvox.AbstractTts.PERSONALITY_ANNOTATION={'relativePitch':-0.25,'color':'yellow','punctuationEcho':'none'};cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT={'punctuationEcho':'none'};cvox.AbstractTts.PERSONALITY_SYSTEM_ALERT={'punctuationEcho':'none','doNotInterrupt':true};cvox.AbstractTts.PERSONALITY_ASIDE={'relativePitch':-0.1,'color':'#669'};cvox.AbstractTts.PERSONALITY_CAPITAL={'relativePitch':0.6};cvox.AbstractTts.PERSONALITY_DELETED={'punctuationEcho':'none','relativePitch':-0.6};cvox.AbstractTts.PERSONALITY_QUOTE={'relativePitch':0.1,'color':'#b6b','fontWeight':'bold'};cvox.AbstractTts.PERSONALITY_STRONG={'relativePitch':0.1,'color':'#b66','fontWeight':'bold'};cvox.AbstractTts.PERSONALITY_EMPHASIS={'relativeVolume':0.1,'relativeRate':-0.1,'color':'#6bb','fontWeight':'bold'};cvox.AbstractTts.DEBUG=true;cvox.AbstractTts.CHARACTER_DICTIONARY={' ':'space','`':'backtick','~':'tilde','!':'exclamation','@':'at','#':'pound','$':'dollar','%':'percent','^':'caret','&':'ampersand','*':'asterisk','(':'open_paren',')':'close_paren','-':'dash','_':'underscore','=':'equals','+':'plus','[':'left_bracket',']':'right_bracket','{':'left_brace','}':'right_brace','|':'pipe',';':'semicolon',':':'colon',',':'comma','.':'dot','<':'less_than','>':'greater_than','/':'slash','?':'question_mark','"':'quote','\'':'apostrophe','\t':'tab','\r':'return','\n':'new_line','\\':'backslash'};cvox.AbstractTts.PRONUNCIATION_DICTIONARY={'admob':'ad-mob','adsense':'ad-sense','adwords':'ad-words','angularjs':'angular j s','bcc':'B C C','cc':'C C','chromevox':'chrome vox','cr48':'C R 48','ctrl':'control','doubleclick':'double-click','gmail':'gee mail','gtalk':'gee talk','http':'H T T P','https':'H T T P S','igoogle':'eye google','pagerank':'page-rank','username':'user-name','www':'W W W','youtube':'you tube'};cvox.AbstractTts.pronunciationDictionaryRegexp_;cvox.AbstractTts.SUBSTITUTION_DICTIONARY={'://':'colon slash slash','\u00bc':'one fourth','\u00bd':'one half','\u2190':'left arrow','\u2191':'up arrow','\u2192':'right arrow','\u2193':'down arrow','\u21d0':'left double arrow','\u21d1':'up double arrow','\u21d2':'right double arrow','\u21d3':'down double arrow','\u21e6':'left arrow','\u21e7':'up arrow','\u21e8':'right arrow','\u21e9':'down arrow','\u2303':'control','\u2318':'command','\u2325':'option','\u25b2':'up triangle','\u25b3':'up triangle','\u25b4':'up triangle','\u25b5':'up triangle','\u25b6':'right triangle','\u25b7':'right triangle','\u25b8':'right triangle','\u25b9':'right triangle','\u25ba':'right pointer','\u25bb':'right pointer','\u25bc':'down triangle','\u25bd':'down triangle','\u25be':'down triangle','\u25bf':'down triangle','\u25c0':'left triangle','\u25c1':'left triangle','\u25c2':'left triangle','\u25c3':'left triangle','\u25c4':'left pointer','\u25c5':'left pointer','\uf8ff':'apple'};cvox.AbstractTts.substitutionDictionaryRegexp_;cvox.AbstractTts.repetitionRegexp_=/([-\/\\|!@#$%^&*\(\)=_+\[\]\{\}.?;'":<>])\1{2,}/g;cvox.AbstractTts.repetitionReplace_=function(match){var count=match.length;return' '+(new goog.i18n.MessageFormat(Msgs.getMsg(cvox.AbstractTts.CHARACTER_DICTIONARY[match[0]]))).format({'COUNT':count})+' ';};cvox.AbstractTts.prototype.getDefaultProperty=function(property){return this.propertyDefault[property];};goog.provide('cvox.ChromeVox');goog.addDependency('../host/interface/abstract_host.js',['cvox.AbstractHost'],[]);goog.addDependency('../host/interface/tts_interface.js',['cvox.TtsInterface'],[]);goog.addDependency('../host/interface/braille_interface.js',['cvox.BrailleInterface'],[]);goog.addDependency('../host/interface/mathjax_interface.js',['cvox.MathJaxInterface'],[]);goog.addDependency('../chromevox/messages/msgs.js',['Msgs'],[]);goog.addDependency('../host/interface/abstract_earcons.js',['cvox.AbstractEarcons'],[]);goog.addDependency('../chromevox/common/key_sequence.js',['cvox.KeySequence'],[]);goog.addDependency('../chromevox/injected/navigation_manager.js',['cvox.NavigationManager'],[]);goog.addDependency('../chromevox/injected/serializer.js',['cvox.Serializer'],[]);cvox.VERBOSITY_VERBOSE=0;cvox.VERBOSITY_BRIEF=1;cvox.ChromeVox=function(){};cvox.ChromeVox.host=null;cvox.ChromeVox.tts;cvox.ChromeVox.braille;cvox.ChromeVox.mathJax;cvox.ChromeVox.isActive=true;cvox.ChromeVox.version=null;cvox.ChromeVox.earcons=null;cvox.ChromeVox.navigationManager=null;cvox.ChromeVox.serializer=null;cvox.ChromeVox.isStickyPrefOn=false;cvox.ChromeVox.stickyOverride=null;cvox.ChromeVox.keyPrefixOn=false;cvox.ChromeVox.verbosity=cvox.VERBOSITY_VERBOSE;cvox.ChromeVox.typingEcho=0;cvox.ChromeVox.keyEcho={};cvox.Point;cvox.ChromeVox.position={};cvox.ChromeVox.isChromeOS=navigator.userAgent.indexOf('CrOS')!=-1;cvox.ChromeVox.isMac=navigator.platform.indexOf('Mac')!=-1;cvox.ChromeVox.modKeyStr;if(cvox.ChromeVox.isChromeOS){cvox.ChromeVox.modKeyStr='Shift+Search';}else if(cvox.ChromeVox.isMac){cvox.ChromeVox.modKeyStr='Ctrl+Cmd';}else{cvox.ChromeVox.modKeyStr='Shift+Alt';}
cvox.ChromeVox.sequenceSwitchKeyCodes=[];cvox.ChromeVox.visitedUrls={};cvox.ChromeVox.markInUserCommand=function(){};cvox.ChromeVox.syncToNode=function(targetNode,speakNode,opt_queueMode){};cvox.ChromeVox.speakNode=function(targetNode,queueMode,properties){};cvox.ChromeVox.executeUserCommand=function(commandName){};cvox.ChromeVox.entireDocumentIsHidden=false;cvox.ChromeVox.storeOn=function(store){store['isStickyPrefOn']=cvox.ChromeVox.isStickyPrefOn;cvox.ChromeVox.navigationManager.storeOn(store);};cvox.ChromeVox.readFrom=function(store){cvox.ChromeVox.isStickyPrefOn=store['isStickyPrefOn'];cvox.ChromeVox.navigationManager.readFrom(store);};cvox.ChromeVox.isStickyModeOn=function(){if(cvox.ChromeVox.stickyOverride!==null){return cvox.ChromeVox.stickyOverride;}else{return cvox.ChromeVox.isStickyPrefOn;}};function $(id){return document.getElementById(id);}
cvox.ChromeVox.injectChromeVoxIntoTabs=function(tabs){};cvox.ChromeVox.documentHasFocus=function(){if(!document.hasFocus()||document.hidden){return false;}
if(document.activeElement.tagName=='IFRAME'||document.activeElement.tagName=='WEBVIEW'){return false;}
return true;};goog.provide('cvox.NodeState');goog.provide('cvox.NodeStateUtil');goog.require('Msgs');cvox.NodeState;cvox.NodeStateUtil.expand=function(state){try{return state.map(function(s){if(s.length<1){throw new Error('cvox.NodeState must have at least one entry');}
var args=s.slice(1).map(function(a){if(typeof a=='number'){return Msgs.getNumber(a);}
return a;});return Msgs.getMsg((s[0]),args);}).join(' ');}catch(e){throw new Error('error: '+e+' state: '+state);}};goog.provide('cvox.AriaUtil');goog.require('cvox.AbstractEarcons');goog.require('cvox.ChromeVox');goog.require('cvox.NodeState');goog.require('cvox.NodeStateUtil');cvox.AriaUtil=function(){};cvox.AriaUtil.WIDGET_ROLE_TO_NAME={'alert':'role_alert','alertdialog':'role_alertdialog','button':'role_button','checkbox':'role_checkbox','columnheader':'role_columnheader','combobox':'role_combobox','dialog':'role_dialog','grid':'role_grid','gridcell':'role_gridcell','link':'role_link','listbox':'role_listbox','log':'role_log','marquee':'role_marquee','menu':'role_menu','menubar':'role_menubar','menuitem':'role_menuitem','menuitemcheckbox':'role_menuitemcheckbox','menuitemradio':'role_menuitemradio','option':'role_option','progressbar':'role_progressbar','radio':'role_radio','radiogroup':'role_radiogroup','rowheader':'role_rowheader','scrollbar':'role_scrollbar','slider':'role_slider','spinbutton':'role_spinbutton','status':'role_status','tab':'role_tab','tablist':'role_tablist','tabpanel':'role_tabpanel','textbox':'role_textbox','timer':'role_timer','toolbar':'role_toolbar','tooltip':'role_tooltip','treeitem':'role_treeitem'};cvox.AriaUtil.STRUCTURE_ROLE_TO_NAME={'article':'role_article','application':'role_application','banner':'role_banner','columnheader':'role_columnheader','complementary':'role_complementary','contentinfo':'role_contentinfo','definition':'role_definition','directory':'role_directory','document':'role_document','form':'role_form','group':'role_group','heading':'role_heading','img':'role_img','list':'role_list','listitem':'role_listitem','main':'role_main','math':'role_math','navigation':'role_navigation','note':'role_note','region':'role_region','rowheader':'role_rowheader','search':'role_search','separator':'role_separator'};cvox.AriaUtil.ATTRIBUTE_VALUE_TO_STATUS=[{name:'aria-autocomplete',values:{'inline':'aria_autocomplete_inline','list':'aria_autocomplete_list','both':'aria_autocomplete_both'}},{name:'aria-checked',values:{'true':'aria_checked_true','false':'aria_checked_false','mixed':'aria_checked_mixed'}},{name:'aria-disabled',values:{'true':'aria_disabled_true'}},{name:'aria-expanded',values:{'true':'aria_expanded_true','false':'aria_expanded_false'}},{name:'aria-invalid',values:{'true':'aria_invalid_true','grammar':'aria_invalid_grammar','spelling':'aria_invalid_spelling'}},{name:'aria-multiline',values:{'true':'aria_multiline_true'}},{name:'aria-multiselectable',values:{'true':'aria_multiselectable_true'}},{name:'aria-pressed',values:{'true':'aria_pressed_true','false':'aria_pressed_false','mixed':'aria_pressed_mixed'}},{name:'aria-readonly',values:{'true':'aria_readonly_true'}},{name:'aria-required',values:{'true':'aria_required_true'}},{name:'aria-selected',values:{'true':'aria_selected_true','false':'aria_selected_false'}}];cvox.AriaUtil.isHiddenRecursive=function(targetNode){if(cvox.AriaUtil.isHidden(targetNode)){return true;}
var parent=targetNode.parentElement;while(parent){if((parent.getAttribute('aria-hidden')=='true')&&(parent.getAttribute('chromevoxignoreariahidden')!='true')){return true;}
parent=parent.parentElement;}
return false;};cvox.AriaUtil.isHidden=function(targetNode){if(!targetNode){return true;}
if(targetNode.getAttribute){if((targetNode.getAttribute('aria-hidden')=='true')&&(targetNode.getAttribute('chromevoxignoreariahidden')!='true')){return true;}}
return false;};cvox.AriaUtil.isForcedVisibleRecursive=function(targetNode){var node=targetNode;while(node){if(node.getAttribute){if(node.hasAttribute('aria-hidden')&&(node.getAttribute('chromevoxignoreariahidden')!='true')){return node.getAttribute('aria-hidden')=='false';}}
node=node.parentElement;}
return false;};cvox.AriaUtil.isLeafElement=function(targetElement){var role=targetElement.getAttribute('role');return role=='img'||role=='progressbar';};cvox.AriaUtil.isDescendantOfRole=function(node,roleName){while(node){if(roleName&&node&&(node.getAttribute('role')==roleName)){return true;}
node=node.parentNode;}
return false;};cvox.AriaUtil.getRoleNameMsgForRole_=function(role){var msgId=cvox.AriaUtil.WIDGET_ROLE_TO_NAME[role];if(!msgId){return null;}
return msgId;};cvox.AriaUtil.isButton=function(node){var role=cvox.AriaUtil.getRoleAttribute(node);if(role=='button'){return true;}
if(node.tagName=='BUTTON'){return true;}
if(node.tagName=='INPUT'){return(node.type=='submit'||node.type=='reset'||node.type=='button');}
return false;};cvox.AriaUtil.getRoleNameMsg=function(targetNode){var roleName;if(targetNode&&targetNode.getAttribute){var role=cvox.AriaUtil.getRoleAttribute(targetNode);if(targetNode.getAttribute('aria-haspopup')=='true'&&cvox.AriaUtil.isButton(targetNode)){return'role_popup_button';}
if(role){roleName=cvox.AriaUtil.getRoleNameMsgForRole_(role);if(!roleName){roleName=cvox.AriaUtil.STRUCTURE_ROLE_TO_NAME[role];}}
if(role=='menuitem'){var container=targetNode.parentElement;while(container){if(container.getAttribute&&(cvox.AriaUtil.getRoleAttribute(container)=='menu'||cvox.AriaUtil.getRoleAttribute(container)=='menubar')){break;}
container=container.parentElement;}
if(container&&cvox.AriaUtil.getRoleAttribute(container)=='menubar'){roleName=cvox.AriaUtil.getRoleNameMsgForRole_('menu');}}}
if(!roleName){roleName='';}
return roleName;};cvox.AriaUtil.getRoleName=function(targetNode){var roleMsg=cvox.AriaUtil.getRoleNameMsg(targetNode);var roleName=Msgs.getMsg(roleMsg);var role=cvox.AriaUtil.getRoleAttribute(targetNode);if((role=='heading')&&(targetNode.hasAttribute('aria-level'))){roleName+=' '+targetNode.getAttribute('aria-level');}
return roleName?roleName:'';};cvox.AriaUtil.getStateMsgs=function(targetNode,primary){var state=[];if(!targetNode||!targetNode.getAttribute){return state;}
for(var i=0,attr;attr=cvox.AriaUtil.ATTRIBUTE_VALUE_TO_STATUS[i];i++){var value=targetNode.getAttribute(attr.name);var msgId=attr.values[value];if(msgId){state.push([msgId]);}}
if(targetNode.getAttribute('role')=='grid'){return cvox.AriaUtil.getGridState_(targetNode,targetNode);}
var role=cvox.AriaUtil.getRoleAttribute(targetNode);if(targetNode.getAttribute('aria-haspopup')=='true'){if(role=='menuitem'){state.push(['has_submenu']);}else if(cvox.AriaUtil.isButton(targetNode)){}else{state.push(['has_popup']);}}
var valueText=targetNode.getAttribute('aria-valuetext');if(valueText){state.push(['aria_value_text',valueText]);return state;}
var valueNow=targetNode.getAttribute('aria-valuenow');var valueMin=targetNode.getAttribute('aria-valuemin');var valueMax=targetNode.getAttribute('aria-valuemax');if((valueNow!=null)&&(valueMin!=null)&&(valueMax!=null)){if((role=='scrollbar')||(role=='progressbar')){var percent=Math.round((valueNow/(valueMax-valueMin))*100);state.push(['state_percent',percent]);return state;}}
if(valueNow!=null){state.push(['aria_value_now',valueNow]);}
if(valueMin!=null){state.push(['aria_value_min',valueMin]);}
if(valueMax!=null){state.push(['aria_value_max',valueMax]);}
var parentControl=targetNode;var currentDescendant=null;if(cvox.AriaUtil.isCompositeControl(parentControl)&&primary){currentDescendant=cvox.AriaUtil.getActiveDescendant(parentControl);}else{role=cvox.AriaUtil.getRoleAttribute(targetNode);if(role=='option'||role=='menuitem'||role=='menuitemcheckbox'||role=='menuitemradio'||role=='radio'||role=='tab'||role=='treeitem'){currentDescendant=targetNode;parentControl=targetNode.parentElement;while(parentControl&&!cvox.AriaUtil.isCompositeControl(parentControl)){parentControl=parentControl.parentElement;if(parentControl&&cvox.AriaUtil.getRoleAttribute(parentControl)=='treeitem'){break;}}}}
if(parentControl&&(cvox.AriaUtil.isCompositeControl(parentControl)||cvox.AriaUtil.getRoleAttribute(parentControl)=='treeitem')&¤tDescendant){var parentRole=cvox.AriaUtil.getRoleAttribute(parentControl);var descendantRoleList;switch(parentRole){case'combobox':case'listbox':descendantRoleList=['option'];break;case'menu':descendantRoleList=['menuitem','menuitemcheckbox','menuitemradio'];break;case'radiogroup':descendantRoleList=['radio'];break;case'tablist':descendantRoleList=['tab'];break;case'tree':case'treegrid':case'treeitem':descendantRoleList=['treeitem'];break;}
if(descendantRoleList){var listLength;var currentIndex;var ariaLength=parseInt(currentDescendant.getAttribute('aria-setsize'),10);if(!isNaN(ariaLength)){listLength=ariaLength;}
var ariaIndex=parseInt(currentDescendant.getAttribute('aria-posinset'),10);if(!isNaN(ariaIndex)){currentIndex=ariaIndex;}
if(listLength==undefined||currentIndex==undefined){var descendants=cvox.AriaUtil.getNextLevel(parentControl,descendantRoleList);if(listLength==undefined){listLength=descendants.length;}
if(currentIndex==undefined){for(var j=0;j<descendants.length;j++){if(descendants[j]==currentDescendant){currentIndex=j+1;}}}}
if(currentIndex&&listLength){state.push(['list_position',currentIndex,listLength]);}}}
return state;};cvox.AriaUtil.getGridState_=function(targetNode,parentControl){var activeDescendant=cvox.AriaUtil.getActiveDescendant(parentControl);if(activeDescendant){var descendantSelector='*[role~="row"]';var rows=parentControl.querySelectorAll(descendantSelector);var currentIndex=null;for(var j=0;j<rows.length;j++){var gridcells=rows[j].querySelectorAll('*[role~="gridcell"]');for(var k=0;k<gridcells.length;k++){if(gridcells[k]==activeDescendant){return([['role_gridcell_pos',j+1,k+1]]);}}}}
return[];};cvox.AriaUtil.getActiveDescendantId_=function(targetNode){if(!targetNode.getAttribute){return null;}
var activeId=targetNode.getAttribute('aria-activedescendant');if(!activeId){return null;}
return activeId;};cvox.AriaUtil.getNextLevel=function(parentControl,role){var result=[];var children=parentControl.childNodes;var length=children.length;for(var i=0;i<children.length;i++){if(cvox.AriaUtil.isHidden(children[i])||!cvox.DomUtil.isVisible(children[i])){continue;}
var nextLevel=cvox.AriaUtil.getNextLevelItems(children[i],role);if(nextLevel.length>0){result=result.concat(nextLevel);}}
return result;};cvox.AriaUtil.getNextLevelItems=function(current,role){if(current.nodeType!=1){return[];}
if(role.indexOf(cvox.AriaUtil.getRoleAttribute(current))!=-1){return[current];}else{var children=current.childNodes;var length=children.length;if(length==0){return[];}else{var resultArray=[];for(var i=0;i<length;i++){var result=cvox.AriaUtil.getNextLevelItems(children[i],role);if(result.length>0){resultArray=resultArray.concat(result);}}
return resultArray;}}};cvox.AriaUtil.getActiveDescendant=function(targetNode){var seenIds={};var node=targetNode;while(node){var activeId=cvox.AriaUtil.getActiveDescendantId_(node);if(!activeId){break;}
if(activeId in seenIds){return null;}
seenIds[activeId]=true;node=document.getElementById(activeId);}
if(node==targetNode){return null;}
return node;};cvox.AriaUtil.isControlWidget=function(targetNode){if(targetNode&&targetNode.getAttribute){var role=cvox.AriaUtil.getRoleAttribute(targetNode);switch(role){case'button':case'checkbox':case'combobox':case'listbox':case'menu':case'menuitemcheckbox':case'menuitemradio':case'radio':case'slider':case'progressbar':case'scrollbar':case'spinbutton':case'tab':case'tablist':case'textbox':return true;}}
return false;};cvox.AriaUtil.isCompositeControl=function(targetNode){if(targetNode&&targetNode.getAttribute){var role=cvox.AriaUtil.getRoleAttribute(targetNode);switch(role){case'combobox':case'grid':case'listbox':case'menu':case'menubar':case'radiogroup':case'tablist':case'tree':case'treegrid':return true;}}
return false;};cvox.AriaUtil.getAriaLive=function(node){if(!node.hasAttribute)
return null;var value=node.getAttribute('aria-live');if(value=='off'){return null;}else if(value){return value;}
var role=cvox.AriaUtil.getRoleAttribute(node);switch(role){case'alert':return'assertive';case'log':case'status':return'polite';default:return null;}};cvox.AriaUtil.getAriaAtomic=function(node){if(!node.hasAttribute)
return false;var value=node.getAttribute('aria-atomic');if(value){return(value==='true');}
var role=cvox.AriaUtil.getRoleAttribute(node);if(role=='alert'){return true;}
return false;};cvox.AriaUtil.getAriaBusy=function(node){if(!node.hasAttribute)
return false;var value=node.getAttribute('aria-busy');if(value){return(value==='true');}
return false;};cvox.AriaUtil.getAriaRelevant=function(node,change){if(!node.hasAttribute)
return false;var value;if(node.hasAttribute('aria-relevant')){value=node.getAttribute('aria-relevant');}else{value='additions text';}
if(value=='all'){value='additions removals text';}
var tokens=value.replace(/\s+/g,' ').replace(/^\s+|\s+$/g,'').split(' ');if(change=='all'){return(tokens.indexOf('additions')>=0&&tokens.indexOf('text')>=0&&tokens.indexOf('removals')>=0);}else{return(tokens.indexOf(change)>=0);}};cvox.AriaUtil.getLiveRegions=function(node){var result=[];if(node.querySelectorAll){var nodes=node.querySelectorAll('[role="alert"], [role="log"], [role="marquee"], '+'[role="status"], [role="timer"], [aria-live]');if(nodes){for(var i=0;i<nodes.length;i++){result.push(nodes[i]);}}}
while(node){if(cvox.AriaUtil.getAriaLive(node)){result.push(node);return result;}
node=node.parentElement;}
return result;};cvox.AriaUtil.isLandmark=function(node){if(!node||!node.getAttribute){return false;}
var role=cvox.AriaUtil.getRoleAttribute(node);switch(role){case'application':case'banner':case'complementary':case'contentinfo':case'form':case'main':case'navigation':case'search':return true;}
return false;};cvox.AriaUtil.isGrid=function(node){if(!node||!node.getAttribute){return false;}
var role=cvox.AriaUtil.getRoleAttribute(node);switch(role){case'grid':case'treegrid':return true;}
return false;};cvox.AriaUtil.getEarcon=function(node){if(!node||!node.getAttribute){return null;}
var role=cvox.AriaUtil.getRoleAttribute(node);switch(role){case'button':return cvox.Earcon.BUTTON;case'checkbox':case'radio':case'menuitemcheckbox':case'menuitemradio':var checked=node.getAttribute('aria-checked');if(checked=='true'){return cvox.Earcon.CHECK_ON;}else{return cvox.Earcon.CHECK_OFF;}
case'combobox':case'listbox':return cvox.Earcon.LISTBOX;case'textbox':return cvox.Earcon.EDITABLE_TEXT;case'listitem':return cvox.Earcon.LIST_ITEM;case'link':return cvox.Earcon.LINK;}
return null;};cvox.AriaUtil.getRoleAttribute=function(targetNode){if(!targetNode.getAttribute){return'';}
var role=targetNode.getAttribute('role');if(targetNode.hasAttribute('chromevoxoriginalrole')){role=targetNode.getAttribute('chromevoxoriginalrole');}
return role;};cvox.AriaUtil.isMath=function(node){if(!node||!node.getAttribute){return false;}
var role=cvox.AriaUtil.getRoleAttribute(node);return role=='math';};goog.provide('cvox.DomPredicates');cvox.DomPredicates.checkboxPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='checkbox')||(nodes[i].tagName=='INPUT'&&nodes[i].type=='checkbox')){return nodes[i];}}
return null;};cvox.DomPredicates.radioPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='radio')||(nodes[i].tagName=='INPUT'&&nodes[i].type=='radio')){return nodes[i];}}
return null;};cvox.DomPredicates.sliderPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='slider')||(nodes[i].tagName=='INPUT'&&nodes[i].type=='range')){return nodes[i];}}
return null;};cvox.DomPredicates.graphicPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(nodes[i].tagName=='IMG'||(nodes[i].tagName=='INPUT'&&nodes[i].type=='img')){return nodes[i];}}
return null;};cvox.DomPredicates.buttonPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='button')||nodes[i].tagName=='BUTTON'||(nodes[i].tagName=='INPUT'&&nodes[i].type=='submit')||(nodes[i].tagName=='INPUT'&&nodes[i].type=='button')||(nodes[i].tagName=='INPUT'&&nodes[i].type=='reset')){return nodes[i];}}
return null;};cvox.DomPredicates.comboBoxPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='combobox')||nodes[i].tagName=='SELECT'){return nodes[i];}}
return null;};cvox.DomPredicates.editTextPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='textbox')||nodes[i].tagName=='TEXTAREA'||nodes[i].isContentEditable||(nodes[i].tagName=='INPUT'&&cvox.DomUtil.isInputTypeText(nodes[i]))){return nodes[i];}}
return null;};cvox.DomPredicates.headingPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(nodes[i].getAttribute&&nodes[i].getAttribute('role')=='heading'){return nodes[i];}
switch(nodes[i].tagName){case'H1':case'H2':case'H3':case'H4':case'H5':case'H6':return nodes[i];}}
return null;};cvox.DomPredicates.heading1Predicate=function(nodes){return cvox.DomPredicates.containsTagName_(nodes,'H1');};cvox.DomPredicates.heading2Predicate=function(nodes){return cvox.DomPredicates.containsTagName_(nodes,'H2');};cvox.DomPredicates.heading3Predicate=function(nodes){return cvox.DomPredicates.containsTagName_(nodes,'H3');};cvox.DomPredicates.heading4Predicate=function(nodes){return cvox.DomPredicates.containsTagName_(nodes,'H4');};cvox.DomPredicates.heading5Predicate=function(nodes){return cvox.DomPredicates.containsTagName_(nodes,'H5');};cvox.DomPredicates.heading6Predicate=function(nodes){return cvox.DomPredicates.containsTagName_(nodes,'H6');};cvox.DomPredicates.linkPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='link')||(nodes[i].tagName=='A'&&nodes[i].href)){return nodes[i];}}
return null;};cvox.DomPredicates.tablePredicate=function(nodes){var node=cvox.DomUtil.findTableNodeInList(nodes,{allowCaptions:true});if(node&&!cvox.DomUtil.isLayoutTable(node)){return node;}else{return null;}};cvox.DomPredicates.cellPredicate=function(nodes){for(var i=nodes.length-1;i>=0;--i){var node=nodes[i];if(node.tagName=='TD'||node.tagName=='TH'||(node.getAttribute&&node.getAttribute('role')=='gridcell')){return node;}}
return null;};cvox.DomPredicates.visitedLinkPredicate=function(nodes){for(var i=nodes.length-1;i>=0;--i){if(cvox.DomPredicates.linkPredicate([nodes[i]])&&cvox.ChromeVox.visitedUrls[nodes[i].href]){return nodes[i];}}
return null;};cvox.DomPredicates.listPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='list')||nodes[i].tagName=='UL'||nodes[i].tagName=='OL'){return nodes[i];}}
return null;};cvox.DomPredicates.listItemPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='listitem')||nodes[i].tagName=='LI'){return nodes[i];}}
return null;};cvox.DomPredicates.blockquotePredicate=function(nodes){return cvox.DomPredicates.containsTagName_(nodes,'BLOCKQUOTE');};cvox.DomPredicates.formFieldPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(cvox.DomUtil.isControl(nodes[i])){return nodes[i];}}
return null;};cvox.DomPredicates.landmarkPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(cvox.AriaUtil.isLandmark(nodes[i])){return nodes[i];}}
return null;};cvox.DomPredicates.containsTagName_=function(arr,tagName){var i=arr.length;while(i--){if(arr[i].tagName==tagName){return arr[i];}}
return null;};cvox.DomPredicates.mathPredicate=function(nodes){return cvox.DomUtil.findMathNodeInList(nodes);};cvox.DomPredicates.sectionPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(cvox.DomUtil.isSemanticElt(nodes[i])){return nodes[i];}
if(cvox.AriaUtil.isLandmark(nodes[i])){return nodes[i];}
if(nodes[i].getAttribute&&nodes[i].getAttribute('role')=='heading'){return nodes[i];}
switch(nodes[i].tagName){case'H1':case'H2':case'H3':case'H4':case'H5':case'H6':return nodes[i];}}
return null;};cvox.DomPredicates.controlPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(cvox.DomUtil.isControl(nodes[i])){return nodes[i];}
if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='link')||(nodes[i].tagName=='A'&&nodes[i].href)){return nodes[i];}}
return null;};cvox.DomPredicates.captionPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(nodes[i].tagName=='CAPTION'){return nodes[i];}}
return null;};cvox.DomPredicates.articlePredicate=function(nodes){for(var i=0;i<nodes.length;i++){if((nodes[i].getAttribute&&nodes[i].getAttribute('role')=='article')||nodes[i].tagName=='ARTICLE'){return nodes[i];}}
return null;};cvox.DomPredicates.mediaPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(nodes[i].tagName=='AUDIO'||nodes[i].tagName=='VIDEO'){return nodes[i];}}
return null;};cvox.DomPredicates.orderedListPredicate=function(nodes){for(var i=0;i<nodes.length;i++){if(nodes[i].tagName=='OL'){return nodes[i];}}
return null;};goog.provide('cvox.Memoize');cvox.Memoize=function(){};cvox.Memoize.nodeMap_=null;cvox.Memoize.scopeCount_=0;cvox.Memoize.scope=function(functionScope){var result;try{cvox.Memoize.scopeCount_++;if(cvox.Memoize.scopeCount_==1){cvox.Memoize.nodeMap_={};}
result=functionScope();}finally{cvox.Memoize.scopeCount_--;if(cvox.Memoize.scopeCount_==0){cvox.Memoize.nodeMap_=null;}}
return result;};cvox.Memoize.memoize=function(functionClosure,functionName,node){if(cvox.Memoize.nodeMap_&&cvox.Memoize.nodeMap_[functionName]===undefined){cvox.Memoize.nodeMap_[functionName]=new WeakMap();}
if(!cvox.Memoize.nodeMap_){return functionClosure(node);}
var result=cvox.Memoize.nodeMap_[functionName].get(node);if(result===undefined){result=functionClosure(node);if(result===undefined){throw'A memoized function cannot return undefined.';}
cvox.Memoize.nodeMap_[functionName].set(node,result);}
return result;};goog.provide('cvox.XpathUtil');cvox.XpathUtil=function(){};cvox.XpathUtil.nameSpaces_={'xhtml':'http://www.w3.org/1999/xhtml','mathml':'http://www.w3.org/1998/Math/MathML'};cvox.XpathUtil.resolveNameSpace=function(prefix){return cvox.XpathUtil.nameSpaces_[prefix]||null;};cvox.XpathUtil.evalXPath=function(expression,rootNode){try{var xpathIterator=rootNode.ownerDocument.evaluate(expression,rootNode,cvox.XpathUtil.resolveNameSpace,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);}catch(err){return[];}
var results=[];for(var xpathNode=xpathIterator.iterateNext();xpathNode;xpathNode=xpathIterator.iterateNext()){results.push(xpathNode);}
return results;};cvox.XpathUtil.getLeafNodes=function(rootNode){try{var xpathIterator=rootNode.ownerDocument.evaluate('.//*[count(*)=0]',rootNode,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);}catch(err){return[];}
var results=[];for(var xpathNode=xpathIterator.iterateNext();xpathNode;xpathNode=xpathIterator.iterateNext()){results.push(xpathNode);}
return results;};cvox.XpathUtil.xpathSupported=function(){if(typeof(XPathResult)=='undefined'){return false;}
return true;};cvox.XpathUtil.evaluateBoolean=function(expression,rootNode){try{var xpathResult=rootNode.ownerDocument.evaluate(expression,rootNode,cvox.XpathUtil.resolveNameSpace,XPathResult.BOOLEAN_TYPE,null);}catch(err){return false;}
return xpathResult.booleanValue;};cvox.XpathUtil.evaluateString=function(expression,rootNode){try{var xpathResult=rootNode.ownerDocument.evaluate(expression,rootNode,cvox.XpathUtil.resolveNameSpace,XPathResult.STRING_TYPE,null);}catch(err){return'';}
return xpathResult.stringValue;};goog.provide('cvox.DomUtil');goog.require('cvox.AbstractTts');goog.require('cvox.AriaUtil');goog.require('cvox.ChromeVox');goog.require('cvox.DomPredicates');goog.require('cvox.Memoize');goog.require('cvox.NodeState');goog.require('cvox.XpathUtil');cvox.DomUtil=function(){};cvox.DomUtil.INPUT_TYPE_TO_INFORMATION_TABLE_MSG={'button':'role_button','checkbox':'role_checkbox','color':'input_type_color','datetime':'input_type_datetime','datetime-local':'input_type_datetime_local','date':'input_type_date','email':'input_type_email','file':'input_type_file','image':'role_button','month':'input_type_month','number':'input_type_number','password':'input_type_password','radio':'role_radio','range':'role_slider','reset':'input_type_reset','search':'input_type_search','submit':'role_button','tel':'input_type_number','text':'input_type_text','url':'input_type_url','week':'input_type_week'};cvox.DomUtil.TAG_TO_INFORMATION_TABLE_VERBOSE_MSG={'A':'role_link','ARTICLE':'tag_article','ASIDE':'tag_aside','AUDIO':'tag_audio','BUTTON':'role_button','FOOTER':'tag_footer','H1':'tag_h1','H2':'tag_h2','H3':'tag_h3','H4':'tag_h4','H5':'tag_h5','H6':'tag_h6','HEADER':'tag_header','HGROUP':'tag_hgroup','LI':'tag_li','MARK':'tag_mark','NAV':'tag_nav','OL':'tag_ol','SECTION':'tag_section','SELECT':'tag_select','TABLE':'tag_table','TEXTAREA':'tag_textarea','TIME':'tag_time','UL':'tag_ul','VIDEO':'tag_video'};cvox.DomUtil.TAG_TO_INFORMATION_TABLE_BRIEF_MSG={'AUDIO':'tag_audio','BUTTON':'role_button','SELECT':'tag_select','TABLE':'tag_table','TEXTAREA':'tag_textarea','VIDEO':'tag_video'};cvox.DomUtil.FORMATTING_TAGS=['B','BIG','CITE','CODE','DFN','EM','I','KBD','SAMP','SMALL','SPAN','STRIKE','STRONG','SUB','SUP','U','VAR'];cvox.DomUtil.isVisible=function(node,opt_options){var checkAncestors=true;var checkDescendants=true;if(opt_options){if(opt_options.checkAncestors!==undefined){checkAncestors=opt_options.checkAncestors;}
if(opt_options.checkDescendants!==undefined){checkDescendants=opt_options.checkDescendants;}}
var fname='isVisible-'+checkAncestors+'-'+checkDescendants;return(cvox.Memoize.memoize(cvox.DomUtil.computeIsVisible_.bind(this,node,checkAncestors,checkDescendants),fname,node));};cvox.DomUtil.computeIsVisible_=function(node,checkAncestors,checkDescendants){if(node.tagName=='IFRAME'&&!node.src){return false;}
if(cvox.AriaUtil.isForcedVisibleRecursive(node)){return true;}
if(checkAncestors&&cvox.DomUtil.hasInvisibleAncestor_(node)){return false;}
if(cvox.DomUtil.hasVisibleNodeSubtree_(node,checkDescendants)){return true;}
return false;};cvox.DomUtil.hasInvisibleAncestor_=function(node){var ancestor=node;while(ancestor=ancestor.parentElement){var style=document.defaultView.getComputedStyle(ancestor,null);if(cvox.DomUtil.isInvisibleStyle(style,true)){return true;}
if(ancestor==document.documentElement){return false;}}
return true;};cvox.DomUtil.hasVisibleNodeSubtree_=function(root,recursive){if(!(root instanceof Element)){if(!root.parentElement){return false;}
var parentStyle=document.defaultView.getComputedStyle(root.parentElement,null);var isVisibleParent=!cvox.DomUtil.isInvisibleStyle(parentStyle);return isVisibleParent;}
var rootStyle=document.defaultView.getComputedStyle(root,null);var isRootVisible=!cvox.DomUtil.isInvisibleStyle(rootStyle);if(isRootVisible){return true;}
var isSubtreeInvisible=cvox.DomUtil.isInvisibleStyle(rootStyle,true);if(!recursive||isSubtreeInvisible){return false;}
var children=root.childNodes;for(var i=0;i<children.length;i++){var child=children[i];if(cvox.DomUtil.hasVisibleNodeSubtree_(child,recursive)){return true;}}
return false;};cvox.DomUtil.isInvisibleStyle=function(style,opt_strict){if(!style){return false;}
if(style.display=='none'){return true;}
if(parseFloat(style.opacity)==0){return true;}
if(!opt_strict&&(style.visibility=='hidden'||style.visibility=='collapse')){return true;}
return false;};cvox.DomUtil.isDisabled=function(node){if(node.disabled){return true;}
var ancestor=node;while(ancestor=ancestor.parentElement){if(ancestor.tagName=='FIELDSET'&&ancestor.disabled){return true;}}
return false;};cvox.DomUtil.isSemanticElt=function(node){if(node.tagName){var tag=node.tagName;if((tag=='SECTION')||(tag=='NAV')||(tag=='ARTICLE')||(tag=='ASIDE')||(tag=='HGROUP')||(tag=='HEADER')||(tag=='FOOTER')||(tag=='TIME')||(tag=='MARK')){return true;}}
return false;};cvox.DomUtil.isLeafNode=function(node,opt_allowHidden){if(!(node instanceof Element)){return(node.firstChild==null);}
var element=(node);if(!opt_allowHidden&&!cvox.DomUtil.isVisible(element,{checkAncestors:false})){return true;}
if(!opt_allowHidden&&cvox.AriaUtil.isHidden(element)){return true;}
if(cvox.AriaUtil.isLeafElement(element)){return true;}
switch(element.tagName){case'OBJECT':case'EMBED':case'VIDEO':case'AUDIO':case'IFRAME':case'FRAME':return true;}
if(!!cvox.DomPredicates.linkPredicate([element])){return!cvox.DomUtil.findNode(element,function(node){return!!cvox.DomPredicates.headingPredicate([node]);});}
if(cvox.DomUtil.isLeafLevelControl(element)){return true;}
if(!element.firstChild){return true;}
if(cvox.DomUtil.isMath(element)){return true;}
if(cvox.DomPredicates.headingPredicate([element])){return!cvox.DomUtil.findNode(element,function(n){return!!cvox.DomPredicates.controlPredicate([n]);});}
return false;};cvox.DomUtil.isDescendantOf=function(node,tagName,className){while(node){if(tagName&&className&&(node.tagName&&(node.tagName==tagName))&&(node.className&&(node.className==className))){return true;}else if(tagName&&!className&&(node.tagName&&(node.tagName==tagName))){return true;}else if(!tagName&&className&&(node.className&&(node.className==className))){return true;}
node=node.parentNode;}
return false;};cvox.DomUtil.isDescendantOfNode=function(node,ancestor){while(node&&ancestor){if(node.isSameNode(ancestor)){return true;}
node=node.parentNode;}
return false;};cvox.DomUtil.collapseWhitespace=function(str){return str.replace(/\s+/g,' ').replace(/^\s+|\s+$/g,'');};cvox.DomUtil.getBaseLabel_=function(node,recursive,includeControls){var label='';if(node.hasAttribute){if(node.hasAttribute('aria-labelledby')){var labelNodeIds=node.getAttribute('aria-labelledby').split(' ');for(var labelNodeId,i=0;labelNodeId=labelNodeIds[i];i++){var labelNode=document.getElementById(labelNodeId);if(labelNode){label+=' '+cvox.DomUtil.getName(labelNode,true,includeControls,true);}}}else if(node.hasAttribute('aria-label')){label=node.getAttribute('aria-label');}else if(node.constructor==HTMLImageElement){label=cvox.DomUtil.getImageTitle(node);}else if(node.tagName=='FIELDSET'){var legends=node.getElementsByTagName('LEGEND');label='';for(var legend,i=0;legend=legends[i];i++){label+=' '+cvox.DomUtil.getName(legend,true,includeControls);}}
if(label.length==0&&node&&node.id){var labelFor=document.querySelector('label[for="'+node.id+'"]');if(labelFor){label=cvox.DomUtil.getName(labelFor,recursive,includeControls);}}}
return cvox.DomUtil.collapseWhitespace(label);};cvox.DomUtil.getNearestAncestorLabel_=function(node){var label='';var enclosingLabel=node;while(enclosingLabel&&enclosingLabel.tagName!='LABEL'){enclosingLabel=enclosingLabel.parentElement;}
if(enclosingLabel&&!enclosingLabel.hasAttribute('for')){label=cvox.DomUtil.getName(enclosingLabel,true,false);}
return label;};cvox.DomUtil.getInputName_=function(node){var label='';if(node.type=='image'){label=cvox.DomUtil.getImageTitle(node);}else if(node.type=='submit'){if(node.hasAttribute('value')){label=node.getAttribute('value');}else{label='Submit';}}else if(node.type=='reset'){if(node.hasAttribute('value')){label=node.getAttribute('value');}else{label='Reset';}}else if(node.type=='button'){if(node.hasAttribute('value')){label=node.getAttribute('value');}}
return label;};cvox.DomUtil.getName=function(node,recursive,includeControls,opt_allowHidden){if(!node||node.cvoxGetNameMarked==true){return'';}
node.cvoxGetNameMarked=true;var ret=cvox.DomUtil.getName_(node,recursive,includeControls,opt_allowHidden);node.cvoxGetNameMarked=false;var prefix=cvox.DomUtil.getPrefixText(node);return prefix+ret;};cvox.DomUtil.hasChildrenBasedName_=function(node,opt_allowHidden){if(!!cvox.DomPredicates.linkPredicate([node])||!!cvox.DomPredicates.headingPredicate([node])||node.tagName=='BUTTON'||cvox.AriaUtil.isControlWidget(node)||!cvox.DomUtil.isLeafNode(node,opt_allowHidden)){return true;}else{return false;}};cvox.DomUtil.getName_=function(node,recursive,includeControls,opt_allowHidden){if(typeof(recursive)==='undefined'){recursive=true;}
if(typeof(includeControls)==='undefined'){includeControls=true;}
if(node.constructor==Text){return node.data;}
var label=cvox.DomUtil.getBaseLabel_(node,recursive,includeControls);if(label.length==0&&cvox.DomUtil.isControl(node)){label=cvox.DomUtil.getNearestAncestorLabel_(node);}
if(label.length==0&&node.constructor==HTMLInputElement){label=cvox.DomUtil.getInputName_(node);}
if(cvox.DomUtil.isInputTypeText(node)&&node.hasAttribute('placeholder')){var placeholder=node.getAttribute('placeholder');if(label.length>0){if(cvox.DomUtil.getValue(node).length>0){return label;}else{return label+' with hint '+placeholder;}}else{return placeholder;}}
if(label.length>0){return label;}
if(cvox.DomUtil.collapseWhitespace(node.textContent).length==0&&node.hasAttribute&&node.hasAttribute('title')){return node.getAttribute('title');}
if(!recursive){return'';}
if(cvox.AriaUtil.isCompositeControl(node)){return'';}
if(cvox.DomUtil.hasChildrenBasedName_(node,opt_allowHidden)){return cvox.DomUtil.getNameFromChildren(node,includeControls,opt_allowHidden);}
return'';};cvox.DomUtil.getNameFromChildren=function(node,includeControls,opt_allowHidden){if(includeControls==undefined){includeControls=true;}
var name='';var delimiter='';for(var i=0;i<node.childNodes.length;i++){var child=node.childNodes[i];var prevChild=node.childNodes[i-1]||child;if(!includeControls&&cvox.DomUtil.isControl(child)){continue;}
var isVisible=cvox.DomUtil.isVisible(child,{checkAncestors:false});if(opt_allowHidden||(isVisible&&!cvox.AriaUtil.isHidden(child))){delimiter=(prevChild.tagName=='SPAN'||child.tagName=='SPAN'||child.parentNode.tagName=='SPAN')?'':' ';name+=delimiter+cvox.DomUtil.getName(child,true,includeControls);}}
return name;};cvox.DomUtil.getPrefixText=function(node,opt_index){opt_index=opt_index||0;var ancestors=cvox.DomUtil.getAncestors(node);var prefix='';var firstListitem=cvox.DomPredicates.listItemPredicate(ancestors);var leftmost=firstListitem;while(leftmost&&leftmost.firstChild){leftmost=leftmost.firstChild;}
if(firstListitem&&firstListitem.parentNode&&opt_index==0&&firstListitem.parentNode.tagName=='OL'&&node==leftmost&&document.defaultView.getComputedStyle(firstListitem.parentNode).listStyleType!='none'){var items=cvox.DomUtil.toArray(firstListitem.parentNode.children).filter(function(li){return li.tagName=='LI';});var position=items.indexOf(firstListitem)+1;if(document.defaultView.getComputedStyle(firstListitem.parentNode).listStyleType.indexOf('latin')!=-1){position--;prefix=String.fromCharCode('A'.charCodeAt(0)+position%26);}else{prefix=position;}
prefix+='. ';}
return prefix;};cvox.DomUtil.getControlLabelHeuristics=function(node){if(node.hasAttribute&&((node.hasAttribute('aria-label')&&(node.getAttribute('aria-label')==''))||(node.hasAttribute('aria-title')&&(node.getAttribute('aria-title')=='')))){return'';}
var prevNode=cvox.DomUtil.previousLeafNode(node);var prevTraversalCount=0;while(prevNode&&(!cvox.DomUtil.hasContent(prevNode)||cvox.DomUtil.isControl(prevNode))){prevNode=cvox.DomUtil.previousLeafNode(prevNode);prevTraversalCount++;}
var nextNode=cvox.DomUtil.directedNextLeafNode(node);var nextTraversalCount=0;while(nextNode&&(!cvox.DomUtil.hasContent(nextNode)||cvox.DomUtil.isControl(nextNode))){nextNode=cvox.DomUtil.directedNextLeafNode(nextNode);nextTraversalCount++;}
var guessedLabelNode;if(prevNode&&nextNode){var parentNode=node;var prevCount=0;while(parentNode){if(cvox.DomUtil.isDescendantOfNode(prevNode,parentNode)){break;}
parentNode=parentNode.parentNode;prevCount++;}
parentNode=node;var nextCount=0;while(parentNode){if(cvox.DomUtil.isDescendantOfNode(nextNode,parentNode)){break;}
parentNode=parentNode.parentNode;nextCount++;}
guessedLabelNode=nextCount<prevCount?nextNode:prevNode;}else{guessedLabelNode=prevNode||nextNode;}
if(guessedLabelNode){return cvox.DomUtil.collapseWhitespace(cvox.DomUtil.getValue(guessedLabelNode)+' '+
cvox.DomUtil.getName(guessedLabelNode));}
return'';};cvox.DomUtil.getValue=function(node){var activeDescendant=cvox.AriaUtil.getActiveDescendant(node);if(activeDescendant){return cvox.DomUtil.collapseWhitespace(cvox.DomUtil.getValue(activeDescendant)+' '+
cvox.DomUtil.getName(activeDescendant));}
if(node.constructor==HTMLSelectElement){node=(node);var value='';var start=node.selectedOptions?node.selectedOptions[0]:null;var end=node.selectedOptions?node.selectedOptions[node.selectedOptions.length-1]:null;if(start&&end&&start!=end){value=Msgs.getMsg('selected_options_value',[start.text,end.text]);}else if(start){value=start.text+'';}
return value;}
if(node.constructor==HTMLTextAreaElement){return node.value;}
if(node.constructor==HTMLInputElement){switch(node.type){case'hidden':case'image':case'submit':case'reset':case'button':case'checkbox':case'radio':return'';case'password':return node.value.replace(/./g,'dot ');default:return node.value;}}
if(node.isContentEditable){return cvox.DomUtil.getNameFromChildren(node,true);}
return'';};cvox.DomUtil.getImageTitle=function(node){var text;if(node.hasAttribute('alt')){text=node.alt;}else if(node.hasAttribute('title')){text=node.title;}else{var url=node.src;if(url.substring(0,4)!='data'){var filename=url.substring(url.lastIndexOf('/')+1,url.lastIndexOf('.'));if(filename.length>=1&&filename.length<=16){text=filename+' Image';}else{text='Image';}}else{text='Image';}}
return text;};cvox.DomUtil.getLabelledByTargets=function(){if(cvox.labelledByTargets){return cvox.labelledByTargets;}
var labelledByElements=document.querySelectorAll('[aria-labelledby]');var labelledByTargets={};for(var i=0;i<labelledByElements.length;++i){var element=labelledByElements[i];var attrValue=element.getAttribute('aria-labelledby');var ids=attrValue.split(/ +/);for(var j=0;j<ids.length;j++){labelledByTargets[ids[j]]=true;}}
cvox.labelledByTargets=labelledByTargets;window.setTimeout(function(){cvox.labelledByTargets=null;},0);return labelledByTargets;};cvox.DomUtil.hasContent=function(node){return(cvox.Memoize.memoize(cvox.DomUtil.computeHasContent_.bind(this),'hasContent',node));};cvox.DomUtil.computeHasContent_=function(node){if(node.nodeType==8){return false;}
if(cvox.DomUtil.isDescendantOf(node,'HEAD')){return false;}
if(cvox.DomUtil.isDescendantOf(node,'SCRIPT')){return false;}
if(cvox.DomUtil.isDescendantOf(node,'NOSCRIPT')){return false;}
if(cvox.DomUtil.isDescendantOf(node,'NOEMBED')){return false;}
if(cvox.DomUtil.isDescendantOf(node,'STYLE')){return false;}
if(!cvox.DomUtil.isVisible(node)){return false;}
if(cvox.AriaUtil.isHidden(node)){return false;}
if(cvox.DomUtil.isControl(node)){return true;}
if(cvox.DomUtil.isDescendantOf(node,'VIDEO')){return true;}
if(cvox.DomUtil.isDescendantOf(node,'AUDIO')){return true;}
if((node.tagName=='IFRAME')&&(node.src)&&(node.src.indexOf('javascript:')!=0)){return true;}
var controlQuery='button,input,select,textarea';var enclosingLabel=node.parentElement;while(enclosingLabel&&enclosingLabel.tagName!='LABEL'){enclosingLabel=enclosingLabel.parentElement;}
if(enclosingLabel){var embeddedControl=enclosingLabel.querySelector(controlQuery);if(enclosingLabel.hasAttribute('for')){var targetId=enclosingLabel.getAttribute('for');var targetNode=document.getElementById(targetId);if(targetNode&&cvox.DomUtil.isControl(targetNode)&&!embeddedControl){return false;}}else if(embeddedControl){return false;}}
var enclosingLegend=node.parentElement;while(enclosingLegend&&enclosingLegend.tagName!='LEGEND'){enclosingLegend=enclosingLegend.parentElement;}
if(enclosingLegend){var legendAncestor=enclosingLegend.parentElement;while(legendAncestor&&legendAncestor.tagName!='FIELDSET'){legendAncestor=legendAncestor.parentElement;}
var embeddedControl=legendAncestor&&legendAncestor.querySelector(controlQuery);if(legendAncestor&&!embeddedControl){return false;}}
if(!!cvox.DomPredicates.linkPredicate([node])){return true;}
if(node.tagName=='TABLE'&&!cvox.DomUtil.isLayoutTable(node)){return true;}
if(cvox.DomUtil.isMath(node)){return true;}
if(cvox.DomPredicates.headingPredicate([node])){return true;}
if(cvox.DomUtil.isFocusable(node)){return true;}
var labelledByTargets=cvox.DomUtil.getLabelledByTargets();var enclosingNodeWithId=node;while(enclosingNodeWithId){if(enclosingNodeWithId.id&&labelledByTargets[enclosingNodeWithId.id]){var attrValue=enclosingNodeWithId.getAttribute('aria-labelledby');if(attrValue){var ids=attrValue.split(/ +/);if(ids.indexOf(enclosingNodeWithId.id)==-1){return false;}}else{return false;}}
enclosingNodeWithId=enclosingNodeWithId.parentElement;}
var text=cvox.DomUtil.getValue(node)+' '+cvox.DomUtil.getName(node);var state=cvox.DomUtil.getState(node,true);if(text.match(/^\s+$/)&&state===''){return false;}
return true;};cvox.DomUtil.getAncestors=function(targetNode){var ancestors=new Array();while(targetNode){ancestors.push(targetNode);targetNode=targetNode.parentNode;}
ancestors.reverse();while(ancestors.length&&!ancestors[0].tagName&&!ancestors[0].nodeValue){ancestors.shift();}
return ancestors;};cvox.DomUtil.compareAncestors=function(ancestorsA,ancestorsB){var i=0;while(ancestorsA[i]&&ancestorsB[i]&&(ancestorsA[i]==ancestorsB[i])){i++;}
if(!ancestorsA[i]&&!ancestorsB[i]){i=-1;}
return i;};cvox.DomUtil.getUniqueAncestors=function(previousNode,currentNode,opt_fallback){var prevAncestors=cvox.DomUtil.getAncestors(previousNode);var currentAncestors=cvox.DomUtil.getAncestors(currentNode);var divergence=cvox.DomUtil.compareAncestors(prevAncestors,currentAncestors);var diff=currentAncestors.slice(divergence);return(diff.length==0&&opt_fallback)?currentAncestors:diff;};cvox.DomUtil.getRoleMsg=function(targetNode,verbosity){var info;info=cvox.AriaUtil.getRoleNameMsg(targetNode);if(!info){if(targetNode.tagName=='INPUT'){info=cvox.DomUtil.INPUT_TYPE_TO_INFORMATION_TABLE_MSG[targetNode.type];}else if(targetNode.tagName=='A'&&cvox.DomUtil.isInternalLink(targetNode)){info='internal_link';}else if(targetNode.tagName=='A'&&targetNode.getAttribute('href')&&cvox.ChromeVox.visitedUrls[targetNode.href]){info='visited_link';}else if(targetNode.tagName=='A'&&targetNode.getAttribute('name')){info='';}else if(targetNode.isContentEditable){info='input_type_text';}else if(cvox.DomUtil.isMath(targetNode)){info='math_expr';}else if(targetNode.tagName=='TABLE'&&cvox.DomUtil.isLayoutTable(targetNode)){info='';}else{if(verbosity==cvox.VERBOSITY_BRIEF){info=cvox.DomUtil.TAG_TO_INFORMATION_TABLE_BRIEF_MSG[targetNode.tagName];}else{info=cvox.DomUtil.TAG_TO_INFORMATION_TABLE_VERBOSE_MSG[targetNode.tagName];if(cvox.DomUtil.hasLongDesc(targetNode)){info='image_with_long_desc';}
if(!info&&targetNode.onclick){info='clickable';}}}}
return info;};cvox.DomUtil.getRole=function(targetNode,verbosity){var roleMsg=cvox.DomUtil.getRoleMsg(targetNode,verbosity)||'';var role=roleMsg&&roleMsg!=' '?Msgs.getMsg(roleMsg):'';return role?role:roleMsg;};cvox.DomUtil.getListLength=function(targetNode){var count=0;for(var node=targetNode.firstChild;node;node=node.nextSibling){if(cvox.DomUtil.isVisible(node)&&(node.tagName=='LI'||(node.getAttribute&&node.getAttribute('role')=='listitem'))){if(node.hasAttribute('aria-setsize')){var ariaLength=parseInt(node.getAttribute('aria-setsize'),10);if(!isNaN(ariaLength)){return ariaLength;}}
count++;}}
return count;};cvox.DomUtil.getStateMsgs=function(targetNode,primary){var activeDescendant=cvox.AriaUtil.getActiveDescendant(targetNode);if(activeDescendant){return cvox.DomUtil.getStateMsgs(activeDescendant,primary);}
var info=[];var role=targetNode.getAttribute?targetNode.getAttribute('role'):'';info=cvox.AriaUtil.getStateMsgs(targetNode,primary);if(!info){info=[];}
if(targetNode.tagName=='INPUT'){if(!targetNode.hasAttribute('aria-checked')){var INPUT_MSGS={'checkbox-true':'checkbox_checked_state','checkbox-false':'checkbox_unchecked_state','radio-true':'radio_selected_state','radio-false':'radio_unselected_state'};var msgId=INPUT_MSGS[targetNode.type+'-'+!!targetNode.checked];if(msgId){info.push([msgId]);}}}else if(targetNode.tagName=='SELECT'){if(targetNode.selectedOptions&&targetNode.selectedOptions.length<=1){info.push(['list_position',Msgs.getNumber(targetNode.selectedIndex+1),Msgs.getNumber(targetNode.options.length)]);}else{info.push(['selected_options_state',Msgs.getNumber(targetNode.selectedOptions.length)]);}}else if(targetNode.tagName=='UL'||targetNode.tagName=='OL'||role=='list'){info.push(['list_with_items_not_pluralized',Msgs.getNumber(cvox.DomUtil.getListLength(targetNode))]);}
if(cvox.DomUtil.isDisabled(targetNode)){info.push(['aria_disabled_true']);}
if(targetNode.accessKey){info.push(['access_key',targetNode.accessKey]);}
return info;};cvox.DomUtil.getState=function(targetNode,primary){return cvox.NodeStateUtil.expand(cvox.DomUtil.getStateMsgs(targetNode,primary));};cvox.DomUtil.isFocusable=function(targetNode){if(!targetNode||typeof(targetNode.tabIndex)!='number'){return false;}
if((targetNode.tagName=='A')&&!targetNode.hasAttribute('href')&&!targetNode.hasAttribute('tabindex')){return false;}
if(targetNode.tabIndex>=0){return true;}
if(targetNode.hasAttribute&&targetNode.hasAttribute('tabindex')&&targetNode.getAttribute('tabindex')=='-1'){return true;}
return false;};cvox.DomUtil.findFocusableDescendant=function(targetNode){if(targetNode){var focusableNode=cvox.DomUtil.findNode(targetNode,cvox.DomUtil.isFocusable);if(focusableNode){return focusableNode;}}
return null;};cvox.DomUtil.countFocusableDescendants=function(targetNode){return targetNode?cvox.DomUtil.countNodes(targetNode,cvox.DomUtil.isFocusable):0;};cvox.DomUtil.isAttachedToDocument=function(targetNode){while(targetNode){if(targetNode.tagName&&(targetNode.tagName=='HTML')){return true;}
targetNode=targetNode.parentNode;}
return false;};cvox.DomUtil.clickElem=function(targetNode,shiftKey,callOnClickDirectly,opt_double,opt_handleOwnEvents){var activeDescendant=cvox.AriaUtil.getActiveDescendant(targetNode);if(activeDescendant){targetNode=activeDescendant;}
if(callOnClickDirectly){var onClickFunction=null;if(targetNode.onclick){onClickFunction=targetNode.onclick;}
if(!onClickFunction&&(targetNode.nodeType!=1)&&targetNode.parentNode&&targetNode.parentNode.onclick){onClickFunction=targetNode.parentNode.onclick;}
var keepGoing=true;if(onClickFunction){try{keepGoing=onClickFunction();}catch(exception){}}
if(!keepGoing){return;}}
var evt=document.createEvent('MouseEvents');var evtType=opt_double?'dblclick':'mousedown';evt.initMouseEvent(evtType,true,true,document.defaultView,1,0,0,0,0,false,false,shiftKey,false,0,null);evt.fromCvox=!opt_handleOwnEvents;try{targetNode.dispatchEvent(evt);}catch(e){}
evt=document.createEvent('MouseEvents');evt.initMouseEvent('mouseup',true,true,document.defaultView,1,0,0,0,0,false,false,shiftKey,false,0,null);evt.fromCvox=!opt_handleOwnEvents;try{targetNode.dispatchEvent(evt);}catch(e){}
evt=document.createEvent('MouseEvents');evt.initMouseEvent('click',true,true,document.defaultView,1,0,0,0,0,false,false,shiftKey,false,0,null);evt.fromCvox=!opt_handleOwnEvents;try{targetNode.dispatchEvent(evt);}catch(e){}
if(cvox.DomUtil.isInternalLink(targetNode)){cvox.DomUtil.syncInternalLink(targetNode);}};cvox.DomUtil.syncInternalLink=function(node){var targetNode;var targetId=node.href.split('#')[1];targetNode=document.getElementById(targetId);if(!targetNode){var nodes=document.getElementsByName(targetId);if(nodes.length>0){targetNode=nodes[0];}}
if(targetNode){var parent=targetNode.parentNode;var dummyNode=document.createElement('div');dummyNode.setAttribute('tabindex','-1');parent.insertBefore(dummyNode,targetNode);dummyNode.setAttribute('chromevoxignoreariahidden',1);dummyNode.focus();cvox.ChromeVox.syncToNode(targetNode,false);}};cvox.DomUtil.isInputTypeText=function(node){if(!node||node.constructor!=HTMLInputElement){return false;}
switch(node.type){case'email':case'number':case'password':case'search':case'text':case'tel':case'url':case'':return true;default:return false;}};cvox.DomUtil.isControl=function(node){if(cvox.AriaUtil.isControlWidget(node)&&cvox.DomUtil.isFocusable(node)){return true;}
if(node.tagName){switch(node.tagName){case'BUTTON':case'TEXTAREA':case'SELECT':return true;case'INPUT':return node.type!='hidden';}}
if(node.isContentEditable){return true;}
return false;};cvox.DomUtil.isLeafLevelControl=function(node){if(cvox.DomUtil.isControl(node)){return!(cvox.AriaUtil.isCompositeControl(node)&&cvox.DomUtil.findFocusableDescendant(node));}
return false;};cvox.DomUtil.getSurroundingControl=function(node){var surroundingControl=null;if(!cvox.DomUtil.isControl(node)&&node.hasAttribute&&node.hasAttribute('role')){surroundingControl=node.parentElement;while(surroundingControl&&!cvox.AriaUtil.isCompositeControl(surroundingControl)){surroundingControl=surroundingControl.parentElement;}}
return surroundingControl;};cvox.DomUtil.directedNextLeafLikeNode=function(node,r,isLeaf){if(node!=document.body){while(!cvox.DomUtil.directedNextSibling(node,r)){if(!node){return null;}
node=(node.parentNode);if(node==document.body){return null;}}
if(cvox.DomUtil.directedNextSibling(node,r)){node=(cvox.DomUtil.directedNextSibling(node,r));}}
while(cvox.DomUtil.directedFirstChild(node,r)&&!isLeaf(node)){node=(cvox.DomUtil.directedFirstChild(node,r));}
if(node==document.body){return null;}
return node;};cvox.DomUtil.directedNextLeafNode=function(node,reverse){reverse=!!reverse;return cvox.DomUtil.directedNextLeafLikeNode(node,reverse,cvox.DomUtil.isLeafNode);};cvox.DomUtil.previousLeafNode=function(node){return cvox.DomUtil.directedNextLeafNode(node,true);};cvox.DomUtil.directedFindFirstNode=function(node,r,pred){var child=cvox.DomUtil.directedFirstChild(node,r);while(child){if(pred(child)){return child;}else{var leaf=cvox.DomUtil.directedFindFirstNode(child,r,pred);if(leaf){return leaf;}}
child=cvox.DomUtil.directedNextSibling(child,r);}
return null;};cvox.DomUtil.directedFindDeepestNode=function(node,r,pred){var next=cvox.DomUtil.directedFindFirstNode(node,r,pred);if(!next){if(pred(node)){return node;}else{return null;}}else{return cvox.DomUtil.directedFindDeepestNode(next,r,pred);}};cvox.DomUtil.directedFindNextNode=function(node,ancestor,r,pred,above,deep){above=!!above;deep=!!deep;if(!cvox.DomUtil.isDescendantOfNode(node,ancestor)||node==ancestor){return null;}
var next=cvox.DomUtil.directedNextSibling(node,r);while(next){if(!deep&&pred(next)){return next;}
var leaf=(deep?cvox.DomUtil.directedFindDeepestNode:cvox.DomUtil.directedFindFirstNode)(next,r,pred);if(leaf){return leaf;}
if(deep&&pred(next)){return next;}
next=cvox.DomUtil.directedNextSibling(next,r);}
var parent=(node.parentNode);if(above&&pred(parent)){return parent;}
return cvox.DomUtil.directedFindNextNode(parent,ancestor,r,pred,above,deep);};cvox.DomUtil.getControlValueAndStateString=function(control){var parentControl=cvox.DomUtil.getSurroundingControl(control);if(parentControl){return cvox.DomUtil.collapseWhitespace(cvox.DomUtil.getValue(control)+' '+
cvox.DomUtil.getName(control)+' '+
cvox.DomUtil.getState(control,true));}else{return cvox.DomUtil.collapseWhitespace(cvox.DomUtil.getValue(control)+' '+
cvox.DomUtil.getState(control,true));}};cvox.DomUtil.isInternalLink=function(node){if(node.nodeType==1){var href=node.getAttribute('href');if(href&&href.indexOf('#')!=-1){var path=href.split('#')[0];return path==''||path==window.location.pathname;}}
return false;};cvox.DomUtil.getLinkURL=function(node){if(node.tagName=='A'){if(node.getAttribute('href')){if(cvox.DomUtil.isInternalLink(node)){return Msgs.getMsg('internal_link');}else{return node.getAttribute('href');}}else{return'';}}else if(cvox.AriaUtil.getRoleName(node)==Msgs.getMsg('role_link')){return Msgs.getMsg('unknown_link');}
return'';};cvox.DomUtil.getContainingTable=function(node,kwargs){var ancestors=cvox.DomUtil.getAncestors(node);return cvox.DomUtil.findTableNodeInList(ancestors,kwargs);};cvox.DomUtil.findTableNodeInList=function(nodes,kwargs){kwargs=kwargs||{allowCaptions:false};for(var i=nodes.length-1,node;node=nodes[i];i--){if(node.constructor!=Text){if(!kwargs.allowCaptions&&node.tagName=='CAPTION'){return null;}
if((node.tagName=='TABLE')||cvox.AriaUtil.isGrid(node)){return node;}}}
return null;};cvox.DomUtil.isLayoutTable=function(tableNode){if(tableNode.rows&&(tableNode.rows.length<=1||(tableNode.rows[0].childElementCount==1))){return true;}
if(cvox.AriaUtil.isGrid(tableNode)){return false;}
if(cvox.AriaUtil.isLandmark(tableNode)){return false;}
if(tableNode.caption||tableNode.summary){return false;}
if((cvox.XpathUtil.evalXPath('tbody/tr/th',tableNode).length>0)&&(cvox.XpathUtil.evalXPath('tbody/tr/td',tableNode).length>0)){return false;}
if(cvox.XpathUtil.evalXPath('colgroup',tableNode).length>0){return false;}
if((cvox.XpathUtil.evalXPath('thead',tableNode).length>0)||(cvox.XpathUtil.evalXPath('tfoot',tableNode).length>0)){return false;}
if((cvox.XpathUtil.evalXPath('tbody/tr/td/embed',tableNode).length>0)||(cvox.XpathUtil.evalXPath('tbody/tr/td/object',tableNode).length>0)||(cvox.XpathUtil.evalXPath('tbody/tr/td/iframe',tableNode).length>0)||(cvox.XpathUtil.evalXPath('tbody/tr/td/applet',tableNode).length>0)){return true;}
var points=0;if(!cvox.DomUtil.hasBorder(tableNode)){points++;}
if(tableNode.rows.length<=6){points++;}
if(cvox.DomUtil.countPreviousTags(tableNode)<=12){points++;}
if(cvox.XpathUtil.evalXPath('tbody/tr/td/table',tableNode).length>0){points++;}
return(points>=3);};cvox.DomUtil.countPreviousTags=function(node){var ancestors=cvox.DomUtil.getAncestors(node);return ancestors.length+cvox.DomUtil.countPreviousSiblings(node);};cvox.DomUtil.countPreviousSiblings=function(node){var count=0;var prev=node.previousSibling;while(prev!=null){if(prev.constructor!=Text){count++;}
prev=prev.previousSibling;}
return count;};cvox.DomUtil.hasBorder=function(tableNode){if(tableNode.frame){return(tableNode.frame.indexOf('void')==-1);}
if(tableNode.border){if(tableNode.border.length==1){return(tableNode.border!='0');}else{return(tableNode.border.slice(0,-2)!=0);}}
if(tableNode.style.borderStyle&&tableNode.style.borderStyle=='none'){return false;}
if(tableNode.style.borderWidth){return(tableNode.style.borderWidth.slice(0,-2)!=0);}
if(tableNode.style.borderColor){return true;}
return false;};cvox.DomUtil.getFirstLeafNode=function(){var node=document.body;while(node&&node.firstChild){node=node.firstChild;}
while(node&&!cvox.DomUtil.hasContent(node)){node=cvox.DomUtil.directedNextLeafNode(node);}
return node;};cvox.DomUtil.findNode=function(root,p){var rv=[];var found=cvox.DomUtil.findNodes_(root,p,rv,true,10000);return found?rv[0]:undefined;};cvox.DomUtil.countNodes=function(root,p){var rv=[];cvox.DomUtil.findNodes_(root,p,rv,false,10000);return rv.length;};cvox.DomUtil.findNodes_=function(root,p,rv,findOne,maxChildCount){if((root!=null)||(maxChildCount==0)){var child=root.firstChild;while(child){if(p(child)){rv.push(child);if(findOne){return true;}}
maxChildCount=maxChildCount-1;if(cvox.DomUtil.findNodes_(child,p,rv,findOne,maxChildCount)){return true;}
child=child.nextSibling;}}
return false;};cvox.DomUtil.toArray=function(nodeList){var nodeArray=[];for(var i=0;i<nodeList.length;i++){nodeArray.push(nodeList[i]);}
return nodeArray;};cvox.DomUtil.shallowChildlessClone=function(node,skipattrs){if(node.nodeName=='#text'){return document.createTextNode(node.nodeValue);}
if(node.nodeName=='#comment'){return document.createComment(node.nodeValue);}
var ret=document.createElement(node.nodeName);for(var i=0;i<node.attributes.length;++i){var attr=node.attributes[i];if(skipattrs&&skipattrs[attr.nodeName]){continue;}
ret.setAttribute(attr.nodeName,attr.nodeValue);}
return ret;};cvox.DomUtil.deepClone=function(node,skipattrs){var ret=cvox.DomUtil.shallowChildlessClone(node,skipattrs);for(var i=0;i<node.childNodes.length;++i){ret.appendChild(cvox.DomUtil.deepClone(node.childNodes[i],skipattrs));}
return ret;};cvox.DomUtil.directedFirstChild=function(node,reverse){if(reverse){return node.lastChild;}
return node.firstChild;};cvox.DomUtil.directedNextSibling=function(node,reverse){if(!node){return null;}
if(reverse){return node.previousSibling;}
return node.nextSibling;};cvox.DomUtil.createSimpleClickFunction=function(targetNode){var target=targetNode.cloneNode(true);return function(){cvox.DomUtil.clickElem(target,false,false);};};cvox.DomUtil.addNodeToHead=function(node,opt_id){if(opt_id&&document.getElementById(opt_id)){return;}
var p=document.head||document.body;p.appendChild(node);};cvox.DomUtil.getContainingMath=function(node){var ancestors=cvox.DomUtil.getAncestors(node);return cvox.DomUtil.findMathNodeInList(ancestors);};cvox.DomUtil.findMathNodeInList=function(nodes){for(var i=0,node;node=nodes[i];i++){if(cvox.DomUtil.isMath(node)){return node;}}
return null;};cvox.DomUtil.isMath=function(node){return cvox.DomUtil.isMathml(node)||cvox.DomUtil.isMathJax(node)||cvox.DomUtil.isMathImg(node)||cvox.AriaUtil.isMath(node);};cvox.DomUtil.ALT_MATH_CLASSES={tex:['tex','latex'],asciimath:['numberedequation','inlineformula','displayformula']};cvox.DomUtil.altMathQuerySelector=function(contentType){var classes=cvox.DomUtil.ALT_MATH_CLASSES[contentType];if(classes){return classes.map(function(x){return'img.'+x;}).join(', ');}
return'';};cvox.DomUtil.isMathImg=function(node){if(!node||!node.tagName||!node.className){return false;}
if(node.tagName!='IMG'){return false;}
for(var i=0,className;className=node.classList.item(i);i++){className=className.toLowerCase();if(cvox.DomUtil.ALT_MATH_CLASSES.tex.indexOf(className)!=-1||cvox.DomUtil.ALT_MATH_CLASSES.asciimath.indexOf(className)!=-1){return true;}}
return false;};cvox.DomUtil.isMathml=function(node){if(!node||!node.tagName){return false;}
return node.tagName.toLowerCase()=='math';};cvox.DomUtil.isMathJax=function(node){if(!node||!node.tagName||!node.className){return false;}
function isSpanWithClass(n,cl){return(n.tagName=='SPAN'&&n.className.split(' ').some(function(x){return x.toLowerCase()==cl;}));};if(isSpanWithClass(node,'math')){var ancestors=cvox.DomUtil.getAncestors(node);return ancestors.some(function(x){return isSpanWithClass(x,'mathjax');});}
return false;};cvox.DomUtil.getMathSpanId=function(jaxId){var node=document.getElementById(jaxId+'-Frame');if(node){var span=node.querySelector('span.math');if(span){return span.id;}}
return'';};cvox.DomUtil.hasLongDesc=function(node){if(node&&node.longDesc){return true;}
return false;};cvox.DomUtil.getNodeTagName=function(node){if(node.nodeType==Node.ELEMENT_NODE){return node.tagName;}
return'';};cvox.DomUtil.purgeNodes=function(nodes){return cvox.DomUtil.toArray(nodes).filter(function(node){return node.nodeType!=Node.TEXT_NODE||!node.textContent.match(/^\s+$/);});};cvox.DomUtil.elementToPoint=function(node){if(!node){return{x:0,y:0};}
if(node.constructor==Text){node=node.parentNode;}
var r=node.getBoundingClientRect();return{x:r.left+(r.width/2),y:r.top+(r.height/2)};};cvox.DomUtil.doesInputSupportSelection=function(node){return goog.isDef(node)&&node.tagName=='INPUT'&&node.type!='email'&&node.type!='number';};cvox.DomUtil.getHint=function(node){var desc='';if(node.hasAttribute){if(node.hasAttribute('aria-describedby')){var describedByIds=node.getAttribute('aria-describedby').split(' ');for(var describedById,i=0;describedById=describedByIds[i];i++){var describedNode=document.getElementById(describedById);if(describedNode){desc+=' '+cvox.DomUtil.getName(describedNode,true,true,true);}}}}
return desc;};goog.provide('cvox.ActiveIndicator');goog.require('cvox.Cursor');goog.require('cvox.DomUtil');cvox.ActiveIndicator=function(){this.lastMoveTime_=0;this.zoom_=1;this.container_=null;this.rects_=null;this.lastSyncTarget_=null;this.lastClientRects_=null;this.updateIndicatorTimeoutId_=null;this.blurred_=false;this.innerHeight_;this.innerWidth_;window.addEventListener('focus',goog.bind(function(){this.blurred_=false;if(this.container_){this.container_.classList.remove('cvox_indicator_window_not_focused');}},this),false);window.addEventListener('blur',goog.bind(function(){this.blurred_=true;if(this.container_){this.container_.classList.add('cvox_indicator_window_not_focused');}},this),false);};cvox.ActiveIndicator.STYLE='.cvox_indicator_container {'+' position: absolute !important;'+' left: 0 !important;'+' top: 0 !important;'+' z-index: 2147483647 !important;'+' pointer-events: none !important;'+' margin: 0px !important;'+' padding: 0px !important;'+'}'+'.cvox_indicator_window_not_focused {'+' visibility: hidden !important;'+'}'+'.cvox_indicator_pulsing {'+' -webkit-animation: '+' cvox_indicator_pulsing_animation 0s 2 alternate !important;'+' -webkit-animation-timing-function: ease-in-out !important;'+'}'+'.cvox_indicator_region {'+' opacity: 0 !important;'+' -webkit-transition: opacity 1s !important;'+'}'+'.cvox_indicator_visible {'+' opacity: 1 !important;'+'}'+'.cvox_indicator_container .cvox_indicator_region * {'+' position:absolute !important;'+' box-shadow: 0 0 4px 4px #f7983a !important;'+' border-radius: 6px !important;'+' margin: 0px !important;'+' padding: 0px !important;'+' -webkit-transition: none !important;'+'}'+'.cvox_indicator_animate_normal .cvox_indicator_region * {'+' -webkit-transition: all 0.3s !important;'+'}'+'.cvox_indicator_animate_quick .cvox_indicator_region * {'+' -webkit-transition: all 0.1s !important;'+'}'+'.cvox_indicator_top {'+' border-radius: inherit inherit 0 0 !important;'+'}'+'.cvox_indicator_middle_nw {'+' border-radius: inherit 0 0 0 !important;'+'}'+'.cvox_indicator_middle_ne {'+' border-radius: 0 inherit 0 0 !important;'+'}'+'.cvox_indicator_middle_se {'+' border-radius: 0 0 inherit 0 !important;'+'}'+'.cvox_indicator_middle_sw {'+' border-radius: 0 0 0 inherit !important;'+'}'+'.cvox_indicator_bottom {'+' border-radius: 0 0 inherit inherit !important;'+'}'+'@-webkit-keyframes cvox_indicator_pulsing_animation {'+' 0% {opacity: 1.0}'+' 50% {opacity: 0.5}'+' 100% {opacity: 1.0}'+'}';cvox.ActiveIndicator.QUICK_ANIM_DELAY_MS=100;cvox.ActiveIndicator.NORMAL_ANIM_DELAY_MS=300;cvox.ActiveIndicator.MARGIN=8;cvox.ActiveIndicator.prototype.removeFromDom=function(){if(this.container_&&this.container_.parentElement){this.container_.parentElement.removeChild(this.container_);}};cvox.ActiveIndicator.prototype.syncToNode=function(node){if(!node){return;}
if(node==document.body){this.removeFromDom();return;}
this.syncToNodes([node]);};cvox.ActiveIndicator.prototype.syncToNodes=function(nodes){var clientRects=this.clientRectsFromNodes_(nodes);this.moveIndicator_(clientRects,cvox.ActiveIndicator.MARGIN);this.lastSyncTarget_=nodes;this.lastClientRects_=clientRects;if(this.updateIndicatorTimeoutId_!=null){window.clearTimeout(this.updateIndicatorTimeoutId_);this.updateIndicatorTimeoutId_=null;}};cvox.ActiveIndicator.prototype.syncToRange=function(range){var margin=cvox.ActiveIndicator.MARGIN;if(range.startContainer==range.endContainer&&range.startOffset+1==range.endOffset){margin=1;}
var clientRects=range.getClientRects();this.moveIndicator_(clientRects,margin);this.lastSyncTarget_=range;this.lastClientRects_=clientRects;if(this.updateIndicatorTimeoutId_!=null){window.clearTimeout(this.updateIndicatorTimeoutId_);this.updateIndicatorTimeoutId_=null;}};cvox.ActiveIndicator.prototype.syncToCursorSelection=function(sel){if(sel.start.node==sel.end.node&&sel.start.index==sel.end.index){this.syncToNode(sel.start.node);}else{var range=document.createRange();range.setStart(sel.start.node,sel.start.index);range.setEnd(sel.end.node,sel.end.index);this.syncToRange(range);}};cvox.ActiveIndicator.prototype.updateIndicatorIfChanged=function(){if(this.updateIndicatorTimeoutId_){return;}
this.updateIndicatorTimeoutId_=window.setTimeout(goog.bind(function(){this.handleUpdateIndicatorIfChanged_();},this),100);};cvox.ActiveIndicator.prototype.handleUpdateIndicatorIfChanged_=function(){this.updateIndicatorTimeoutId_=null;if(!this.lastSyncTarget_){return;}
var newClientRects;if(this.lastSyncTarget_ instanceof Array){newClientRects=this.clientRectsFromNodes_(this.lastSyncTarget_);}else{newClientRects=this.lastSyncTarget_.getClientRects();}
if(!newClientRects||newClientRects.length==0){this.syncToNode(document.body);return;}
var needsUpdate=false;if(newClientRects.length!=this.lastClientRects_.length){needsUpdate=true;}else{for(var i=0;i<this.lastClientRects_.length;++i){var last=this.lastClientRects_[i];var current=newClientRects[i];if(last.top!=current.top||last.right!=current.right||last.bottom!=current.bottom||last.left!=last.left){needsUpdate=true;break;}}}
if(needsUpdate){this.moveIndicator_(newClientRects,cvox.ActiveIndicator.MARGIN);this.lastClientRects_=newClientRects;}};cvox.ActiveIndicator.prototype.clientRectsFromNodes_=function(nodes){var clientRects=[];for(var i=0;i<nodes.length;++i){var node=nodes[i];if(node.constructor==Text){var range=document.createRange();range.selectNode(node);var rangeRects=range.getClientRects();for(var j=0;j<rangeRects.length;++j)
clientRects.push(rangeRects[j]);}else{while(node&&!node.getClientRects){node=node.parentElement;}
if(!node){return[];}
var nodeRects=node.getClientRects();for(var j=0;j<nodeRects.length;++j)
clientRects.push(nodeRects[j]);}}
return clientRects;};cvox.ActiveIndicator.prototype.moveIndicator_=function(immutableRects,margin){if(document.body.isContentEditable){this.removeFromDom();return;}
var n=immutableRects.length;if(n==0){return;}
var offsetX;var offsetY;if(window.getComputedStyle(document.body,null).position!='static'){offsetX=-document.body.getBoundingClientRect().left;offsetY=-document.body.getBoundingClientRect().top;}else if(window.getComputedStyle(document.documentElement,null).position!='static'){offsetX=-document.documentElement.getBoundingClientRect().left;offsetY=-document.documentElement.getBoundingClientRect().top;}else{offsetX=window.pageXOffset;offsetY=window.pageYOffset;}
var rects=[];for(var i=0;i<n;i++){rects.push(this.inset_(immutableRects[i],offsetX,offsetY,-offsetX,-offsetY));}
if(!this.container_||!this.container_.parentElement){var oldContainers=document.getElementsByClassName('cvox_indicator_container');for(var j=0,oldContainer;oldContainer=oldContainers[j];j++){if(oldContainer.parentNode){oldContainer.parentNode.removeChild(oldContainer);}}
this.container_=this.createDiv_(document.body,'cvox_indicator_container',document.body.firstChild);}
var style=document.createElement('style');style.id='cvox_indicator_style';style.innerHTML=cvox.ActiveIndicator.STYLE;cvox.DomUtil.addNodeToHead(style,style.id);var now=new Date().getTime();var delta=now-this.lastMoveTime_;this.container_.className='cvox_indicator_container';if(!cvox.ChromeVox.documentHasFocus()||this.blurred_){this.container_.classList.add('cvox_indicator_window_not_focused');}
if(delta>cvox.ActiveIndicator.NORMAL_ANIM_DELAY_MS){this.container_.classList.add('cvox_indicator_animate_normal');}else if(delta>cvox.ActiveIndicator.QUICK_ANIM_DELAY_MS){this.container_.classList.add('cvox_indicator_animate_quick');}
this.lastMoveTime_=now;this.computeZoomLevel_();window.setTimeout(goog.bind(function(){this.container_.classList.add('cvox_indicator_pulsing');},this),0);while(this.container_.childElementCount>1){this.container_.removeChild(this.container_.lastElementChild);}
var regions=[[rects[0]]];var regionRects=[rects[0]];for(i=1;i<rects.length;i++){var found=false;for(var j=0;j<regions.length&&!found;j++){if(this.intersects_(rects[i],regionRects[j])){regions[j].push(rects[i]);regionRects[j]=this.union_(regionRects[j],rects[i]);found=true;}}
if(!found){regions.push([rects[i]]);regionRects.push(rects[i]);}}
do{var merged=false;for(i=0;i<regions.length-1&&!merged;i++){for(j=i+1;j<regions.length&&!merged;j++){if(this.intersects_(regionRects[i],regionRects[j])){regions[i]=regions[i].concat(regions[j]);regionRects[i]=this.union_(regionRects[i],regionRects[j]);regions.splice(j,1);regionRects.splice(j,1);merged=true;}}}}while(merged);for(i=0;i<regions.length;i++){regions[i].sort(function(r1,r2){if(r1.top!=r2.top){return r1.top-r2.top;}else{return r1.left-r2.left;}});}
for(i=0;i<regions.length;i++){var parent=null;if(i==0&&this.container_.childElementCount==1&&this.container_.children[0].childElementCount==6){parent=this.container_.children[0];}
this.updateIndicatorRegion_(regions[i],parent,margin);}};cvox.ActiveIndicator.prototype.updateIndicatorRegion_=function(rects,parent,margin){if(parent){var regionTop=parent.children[0];var regionMiddleNW=parent.children[1];var regionMiddleNE=parent.children[2];var regionMiddleSW=parent.children[3];var regionMiddleSE=parent.children[4];var regionBottom=parent.children[5];}else{parent=this.createDiv_(this.container_,'cvox_indicator_region');window.setTimeout(function(){parent.classList.add('cvox_indicator_visible');},0);regionTop=this.createDiv_(parent,'cvox_indicator_top');regionMiddleNW=this.createDiv_(parent,'cvox_indicator_middle_nw');regionMiddleNE=this.createDiv_(parent,'cvox_indicator_middle_ne');regionMiddleSW=this.createDiv_(parent,'cvox_indicator_middle_sw');regionMiddleSE=this.createDiv_(parent,'cvox_indicator_middle_se');regionBottom=this.createDiv_(parent,'cvox_indicator_bottom');}
var topRect=rects[0];var topMiddle=Math.floor((topRect.top+topRect.bottom)/2);var topIndex=1;var n=rects.length;while(topIndex<n&&rects[topIndex].top<topMiddle){topRect=this.union_(topRect,rects[topIndex]);topMiddle=Math.floor((topRect.top+topRect.bottom)/2);topIndex++;}
if(topIndex==n){var r=this.inset_(topRect,-margin,-margin,-margin,-margin);var q1=Math.floor((3*r.top+1*r.bottom)/4);var q2=Math.floor((2*r.top+2*r.bottom)/4);var q3=Math.floor((1*r.top+3*r.bottom)/4);this.setElementCoords_(regionTop,r.left,r.top,r.right,q1,true,true,true,false);this.setElementCoords_(regionMiddleNW,r.left,q1,r.left,q2,true,true,false,false);this.setElementCoords_(regionMiddleSW,r.left,q2,r.left,q3,true,false,false,true);this.setElementCoords_(regionMiddleNE,r.right,q1,r.right,q2,false,true,true,false);this.setElementCoords_(regionMiddleSE,r.right,q2,r.right,q3,false,false,true,true);this.setElementCoords_(regionBottom,r.left,q3,r.right,r.bottom,true,false,true,true);return;}
var bottomRect=rects[n-1];var bottomMiddle=Math.floor((bottomRect.top+bottomRect.bottom)/2);var bottomIndex=n-2;while(bottomIndex>=0&&rects[bottomIndex].bottom>bottomMiddle){bottomRect=this.union_(bottomRect,rects[bottomIndex]);bottomMiddle=Math.floor((bottomRect.top+bottomRect.bottom)/2);bottomIndex--;}
topRect=this.inset_(topRect,-margin,-margin,-margin,margin);bottomRect=this.inset_(bottomRect,-margin,margin,-margin,-margin);var middleRect;if(topIndex>bottomIndex){middleRect=this.union_(topRect,bottomRect);middleRect.top=topRect.bottom;middleRect.bottom=bottomRect.top;middleRect.height=Math.floor((middleRect.top+middleRect.bottom)/2);}else{middleRect=rects[topIndex];var middleIndex=topIndex+1;while(middleIndex<=bottomIndex){middleRect=this.union_(middleRect,rects[middleIndex]);middleIndex++;}
middleRect=this.inset_(middleRect,-margin,-margin,-margin,-margin);middleRect.left=Math.min(middleRect.left,topRect.left,bottomRect.left);middleRect.right=Math.max(middleRect.right,topRect.right,bottomRect.right);middleRect.width=middleRect.right-middleRect.left;}
if(topRect.right>middleRect.right-40){topRect.right=middleRect.right;topRect.width=topRect.right-topRect.left;}
if(topRect.left<middleRect.left+40){topRect.left=middleRect.left;topRect.width=topRect.right-topRect.left;}
if(bottomRect.right>middleRect.right-40){bottomRect.right=middleRect.right;bottomRect.width=bottomRect.right-bottomRect.left;}
if(bottomRect.left<middleRect.left+40){bottomRect.left=middleRect.left;bottomRect.width=bottomRect.right-bottomRect.left;}
var midline=Math.floor((middleRect.top+middleRect.bottom)/2);this.setElementRect_(regionTop,topRect,true,true,true,false);this.setElementRect_(regionBottom,bottomRect,true,false,true,true);this.setElementCoords_(regionMiddleNW,middleRect.left,topRect.bottom,topRect.left,midline,true,true,false,false);this.setElementCoords_(regionMiddleNE,topRect.right,topRect.bottom,middleRect.right,midline,false,true,true,false);this.setElementCoords_(regionMiddleSW,middleRect.left,midline,bottomRect.left,bottomRect.top,true,false,false,true);this.setElementCoords_(regionMiddleSE,bottomRect.right,midline,middleRect.right,bottomRect.top,false,false,true,true);};cvox.ActiveIndicator.prototype.intersects_=function(r1,r2){var slop=2*cvox.ActiveIndicator.MARGIN;return(r2.left<=r1.right+slop&&r2.right>=r1.left-slop&&r2.top<=r1.bottom+slop&&r2.bottom>=r1.top-slop);};cvox.ActiveIndicator.prototype.union_=function(r1,r2){var result={left:Math.min(r1.left,r2.left),top:Math.min(r1.top,r2.top),right:Math.max(r1.right,r2.right),bottom:Math.max(r1.bottom,r2.bottom)};result.width=result.right-result.left;result.height=result.bottom-result.top;return(result);};cvox.ActiveIndicator.prototype.inset_=function(r,left,top,right,bottom){var result={left:r.left+left,top:r.top+top,right:r.right-right,bottom:r.bottom-bottom};result.width=result.right-result.left;result.height=result.bottom-result.top;return(result);};cvox.ActiveIndicator.prototype.createDiv_=function(parent,className,opt_before){var elem=document.createElement('div');elem.setAttribute('aria-hidden','true');elem.setAttribute('cvoxIgnore','');elem.className=className;if(opt_before){parent.insertBefore(elem,opt_before);}else{parent.appendChild(elem);}
return elem;};cvox.ActiveIndicator.prototype.fixZoom_=function(x){return(Math.round(x*this.zoom_)+0.1)/this.zoom_;};cvox.ActiveIndicator.prototype.fixZoomSum_=function(x,width){var zoomedX=Math.round(x*this.zoom_);var zoomedRight=Math.round((x+width)*this.zoom_);var zoomedWidth=(zoomedRight-zoomedX);return(zoomedWidth+0.1)/this.zoom_;};cvox.ActiveIndicator.prototype.setElementCoords_=function(element,left,top,right,bottom,showLeft,showTop,showRight,showBottom){var origWidth=right-left;var origHeight=bottom-top;var width=right-left;var height=bottom-top;var clipLeft=showLeft?-20:0;var clipTop=showTop?-20:0;var clipRight=showRight?20:0;var clipBottom=showBottom?20:0;if(width==0){if(showRight){left-=5;width+=5;}else if(showLeft){width+=10;}
clipTop=10;clipBottom=10;top-=10;height+=20;}
if(!showBottom)
height+=5;if(!showTop){top-=5;height+=5;clipTop+=5;clipBottom+=5;}
if(clipRight==0&&origWidth==0){clipRight=1;}else{clipRight=this.fixZoomSum_(left,clipRight+origWidth);}
clipBottom=this.fixZoomSum_(top,clipBottom+origHeight);element.style.left=this.fixZoom_(left)+'px';element.style.top=this.fixZoom_(top)+'px';element.style.width=this.fixZoomSum_(left,width)+'px';element.style.height=this.fixZoomSum_(top,height)+'px';element.style.clip='rect('+[clipTop,clipRight,clipBottom,clipLeft].join('px ')+'px)';};cvox.ActiveIndicator.prototype.setElementRect_=function(element,r,showLeft,showTop,showRight,showBottom){this.setElementCoords_(element,r.left,r.top,r.right,r.bottom,showLeft,showTop,showRight,showBottom);};cvox.ActiveIndicator.prototype.computeZoomLevel_=function(){if(window.innerHeight===this.innerHeight_&&window.innerWidth===this.innerWidth_){return;}
this.innerHeight_=window.innerHeight;this.innerWidth_=window.innerWidth;var zoomMeasureElement=document.createElement('div');zoomMeasureElement.innerHTML='X';zoomMeasureElement.setAttribute('style','font: 5000px/1em sans-serif !important;'+' -webkit-text-size-adjust:none !important;'+' visibility:hidden !important;'+' left: -10000px !important;'+' top: -10000px !important;'+' position:absolute !important;');document.body.appendChild(zoomMeasureElement);var zoomLevel=5000/zoomMeasureElement.clientHeight;var newZoom=Math.round(zoomLevel*500)/500;if(newZoom>0.1&&newZoom<10){this.zoom_=newZoom;}
zoomMeasureElement.parentNode.removeChild(zoomMeasureElement);};if(typeof(goog)!='undefined'&&goog.provide){goog.provide('cvox.ApiUtil');}
if(!window['cvox']){window['cvox']={};}
cvox.ApiUtils=function(){};cvox.ApiUtils.nextCvoxId_=1;cvox.ApiUtils.makeNodeReference=function(targetNode){if(targetNode.id&&document.getElementById(targetNode.id)==targetNode){return{'id':targetNode.id};}else if(targetNode instanceof HTMLElement){var cvoxid=cvox.ApiUtils.nextCvoxId_;targetNode.setAttribute('cvoxid',cvoxid);cvox.ApiUtils.nextCvoxId_=(cvox.ApiUtils.nextCvoxId_+1)%100;return{'cvoxid':cvoxid};}else if(targetNode.parentElement){var parent=targetNode.parentElement;var childIndex=-1;for(var i=0;i<parent.childNodes.length;i++){if(parent.childNodes[i]==targetNode){childIndex=i;break;}}
if(childIndex>=0){var cvoxid=cvox.ApiUtils.nextCvoxId_;parent.setAttribute('cvoxid',cvoxid);cvox.ApiUtils.nextCvoxId_=(cvox.ApiUtils.nextCvoxId_+1)%100;return{'cvoxid':cvoxid,'childIndex':childIndex};}}
throw'Cannot reference node: '+targetNode;};cvox.ApiUtils.getNodeFromRef=function(nodeRef){if(nodeRef['id']){return document.getElementById(nodeRef['id']);}else if(nodeRef['cvoxid']){var selector='*[cvoxid="'+nodeRef['cvoxid']+'"]';var element=document.querySelector(selector);if(element&&element.removeAttribute){element.removeAttribute('cvoxid');}
if(nodeRef['childIndex']!=null){return element.childNodes[nodeRef['childIndex']];}else{return element;}}
throw'Bad node reference: '+cvox.ChromeVoxJSON.stringify(nodeRef);};goog.provide('cvox.BuildInfo');cvox.BuildInfo.build='development build';goog.provide('cvox.ScriptInstaller');cvox.ScriptInstaller.denylistPattern=/chrome:\/\/|chrome-extension:\/\//;cvox.ScriptInstaller.installScript=function(srcs,uid,opt_onload,opt_chromevoxScriptBase){if(cvox.ScriptInstaller.denylistPattern.test(document.URL)){return false;}
if(document.querySelector('script['+uid+']')){cvox.ScriptInstaller.uninstallScript(uid);}
if(!srcs||srcs.length==0){return false;}
cvox.ScriptInstaller.installScriptHelper_(srcs,uid,opt_onload,opt_chromevoxScriptBase);return true;};cvox.ScriptInstaller.uninstallScript=function(uid){var scriptNode;if(scriptNode=document.querySelector('script['+uid+']'))
scriptNode.remove();};cvox.ScriptInstaller.installScriptHelper_=function(srcs,uid,opt_onload,opt_chromevoxScriptBase){function next(){if(srcs.length>0){cvox.ScriptInstaller.installScriptHelper_(srcs,uid,opt_onload,opt_chromevoxScriptBase);}else if(opt_onload){opt_onload();}}
var scriptSrc=srcs.shift();if(!scriptSrc){next();return;}
var xhr=new XMLHttpRequest();var url=scriptSrc+'?'+new Date().getTime();xhr.onreadystatechange=function(){if(xhr.readyState==4){var scriptText=xhr.responseText;var apiScript=document.createElement('script');apiScript.type='text/javascript';apiScript.setAttribute(uid,'1');apiScript.textContent=scriptText;if(opt_chromevoxScriptBase){apiScript.setAttribute('chromevoxScriptBase',opt_chromevoxScriptBase);}
var scriptOwner=document.head||document.body;scriptOwner.appendChild(apiScript);next();}};try{xhr.open('GET',url,true);xhr.send(null);}catch(exception){console.log('Warning: ChromeVox external script loading for '+document.location+' stopped after failing to install '+scriptSrc);next();}};goog.provide('cvox.ApiImplementation');goog.provide('cvox.ApiImplementation.Math');goog.require('cvox.ApiUtil');goog.require('cvox.AriaUtil');goog.require('cvox.BuildInfo');goog.require('cvox.ChromeVox');goog.require('cvox.ChromeVoxJSON');goog.require('cvox.DomUtil');goog.require('cvox.ScriptInstaller');cvox.ApiImplementation=function(){};cvox.ApiImplementation.siteSpecificScriptLoader;cvox.ApiImplementation.siteSpecificScriptBase;cvox.ApiImplementation.init=function(opt_onload){window.addEventListener('message',cvox.ApiImplementation.portSetup,true);var scripts=new Array();scripts.push(cvox.ChromeVox.host.getFileSrc('chromevox/injected/api_util.js'));scripts.push(cvox.ChromeVox.host.getApiSrc());scripts.push(cvox.ApiImplementation.siteSpecificScriptLoader);var didInstall=cvox.ScriptInstaller.installScript(scripts,'cvoxapi',opt_onload,cvox.ApiImplementation.siteSpecificScriptBase);if(!didInstall){if(cvox.Api)
window.location.href='javascript:cvox.Api.internalEnable();';}};cvox.ApiImplementation.portSetup=function(event){if(event.data=='cvox.PortSetup'){cvox.ApiImplementation.port=event.ports[0];cvox.ApiImplementation.port.onmessage=function(event){cvox.ApiImplementation.dispatchApiMessage(cvox.ChromeVoxJSON.parse(event.data));};event.stopPropagation();return false;}
return true;};cvox.ApiImplementation.dispatchApiMessage=function(message){var method;switch(message['cmd']){case'speak':method=cvox.ApiImplementation.speak;break;case'speakNodeRef':method=cvox.ApiImplementation.speakNodeRef;break;case'stop':method=cvox.ApiImplementation.stop;break;case'playEarcon':method=cvox.ApiImplementation.playEarcon;break;case'syncToNodeRef':method=cvox.ApiImplementation.syncToNodeRef;break;case'clickNodeRef':method=cvox.ApiImplementation.clickNodeRef;break;case'getBuild':method=cvox.ApiImplementation.getBuild;break;case'getVersion':method=cvox.ApiImplementation.getVersion;break;case'getCurrentNode':method=cvox.ApiImplementation.getCurrentNode;break;case'getCvoxModKeys':method=cvox.ApiImplementation.getCvoxModKeys;break;case'isKeyShortcut':method=cvox.ApiImplementation.isKeyShortcut;break;case'setKeyEcho':method=cvox.ApiImplementation.setKeyEcho;break;case'Math.defineRule':method=cvox.ApiImplementation.Math.defineRule;break;break;}
if(!method){throw'Unknown API call: '+message['cmd'];}
method.apply(cvox.ApiImplementation,message['args']);};function setupEndCallback_(properties,callbackId){var endCallback=function(){cvox.ApiImplementation.port.postMessage(cvox.ChromeVoxJSON.stringify({'id':callbackId}));};if(properties){properties['endCallback']=endCallback;}}
cvox.ApiImplementation.speak=function(callbackId,textString,queueMode,properties){if(cvox.ChromeVox.isActive){if(!properties){properties={};}
setupEndCallback_(properties,callbackId);cvox.ChromeVox.tts.speak(textString,(queueMode),properties);}};cvox.ApiImplementation.speakNode=function(node,queueMode,properties){if(cvox.ChromeVox.isActive){cvox.ChromeVox.tts.speak(cvox.DomUtil.getName(node),(queueMode),properties);}};cvox.ApiImplementation.speakNodeRef=function(callbackId,nodeRef,queueMode,properties){var node=cvox.ApiUtils.getNodeFromRef(nodeRef);if(!properties){properties={};}
setupEndCallback_(properties,callbackId);cvox.ApiImplementation.speakNode(node,queueMode,properties);};cvox.ApiImplementation.stop=function(){if(cvox.ChromeVox.isActive){cvox.ChromeVox.tts.stop();}};cvox.ApiImplementation.playEarcon=function(earcon){if(cvox.ChromeVox.isActive&&cvox.Earcon[earcon]){cvox.ChromeVox.earcons.playEarcon(cvox.Earcon[earcon]);}};cvox.ApiImplementation.syncToNodeRef=function(nodeRef,speakNode){var node=cvox.ApiUtils.getNodeFromRef(nodeRef);cvox.ApiImplementation.syncToNode(node,speakNode);};cvox.ApiImplementation.syncToNode=function(targetNode,opt_speakNode,opt_queueMode){if(!cvox.ChromeVox.isActive){return;}
if(opt_queueMode==undefined){opt_queueMode=cvox.QueueMode.CATEGORY_FLUSH;}
cvox.ChromeVox.navigationManager.updateSelToArbitraryNode(targetNode,true);cvox.ChromeVox.navigationManager.updateIndicator();if(opt_speakNode==undefined){opt_speakNode=false;}
if(cvox.AriaUtil.isHiddenRecursive(targetNode)){opt_speakNode=false;}
if(opt_speakNode){cvox.ChromeVox.navigationManager.speakDescriptionArray(cvox.ApiImplementation.getDesc_(targetNode),(opt_queueMode),null,null,cvox.TtsCategory.NAV);}
cvox.ChromeVox.braille.write(cvox.ChromeVox.navigationManager.getBraille());cvox.ChromeVox.navigationManager.updatePosition(targetNode);};cvox.ApiImplementation.getCurrentNode=function(callbackId){var currentNode=cvox.ChromeVox.navigationManager.getCurrentNode();cvox.ApiImplementation.port.postMessage(cvox.ChromeVoxJSON.stringify({'id':callbackId,'currentNode':cvox.ApiUtils.makeNodeReference(currentNode)}));};cvox.ApiImplementation.getDesc_=function(node){if(!node.hasAttribute('cvoxnodedesc')){return cvox.ChromeVox.navigationManager.getDescription();}
var preDesc=cvox.ChromeVoxJSON.parse(node.getAttribute('cvoxnodedesc'));var currentDesc=new Array();for(var i=0;i<preDesc.length;++i){var inDesc=preDesc[i];currentDesc.push(new cvox.NavDescription({context:inDesc.context,text:inDesc.text,userValue:inDesc.userValue,annotation:inDesc.annotation}));}
return currentDesc;};cvox.ApiImplementation.clickNodeRef=function(nodeRef,shiftKey){cvox.DomUtil.clickElem(cvox.ApiUtils.getNodeFromRef(nodeRef),shiftKey,false);};cvox.ApiImplementation.getBuild=function(callbackId){cvox.ApiImplementation.port.postMessage(cvox.ChromeVoxJSON.stringify({'id':callbackId,'build':cvox.BuildInfo.build}));};cvox.ApiImplementation.getVersion=function(callbackId){var version=cvox.ChromeVox.version;if(version==null){window.setTimeout(function(){cvox.ApiImplementation.getVersion(callbackId);},1000);return;}
cvox.ApiImplementation.port.postMessage(cvox.ChromeVoxJSON.stringify({'id':callbackId,'version':version}));};cvox.ApiImplementation.getCvoxModKeys=function(callbackId){cvox.ApiImplementation.port.postMessage(cvox.ChromeVoxJSON.stringify({'id':callbackId,'keyCodes':cvox.KeyUtil.cvoxModKeyCodes()}));};cvox.ApiImplementation.isKeyShortcut=function(callbackId,keyEvent){var keySeq=cvox.KeyUtil.keyEventToKeySequence(keyEvent);cvox.ApiImplementation.port.postMessage(cvox.ChromeVoxJSON.stringify({'id':callbackId,'isHandled':cvox.ChromeVoxKbHandler.handlerKeyMap.hasKey(keySeq)}));};cvox.ApiImplementation.setKeyEcho=function(keyEcho){var msg=cvox.ChromeVox.keyEcho;msg[document.location.href]=keyEcho;cvox.ChromeVox.host.sendToBackgroundPage({'target':'Prefs','action':'setPref','pref':'keyEcho','value':JSON.stringify(msg)});};cvox.ApiImplementation.Math=function(){};cvox.ApiImplementation.Math.defineRule=function(name,dynamic,action,prec,constraints){var mathStore=cvox.MathmlStore.getInstance();var constraintList=Array.prototype.slice.call(arguments,4);var args=[name,dynamic,action,prec].concat(constraintList);mathStore.defineRule.apply(mathStore,args);};goog.provide('cvox.ChromeVoxEditableTextBase');goog.provide('cvox.TextChangeEvent');goog.provide('cvox.TypingEcho');goog.require('cvox.AbstractTts');goog.require('cvox.ChromeVox');goog.require('cvox.TtsInterface');goog.require('goog.i18n.MessageFormat');cvox.TextChangeEvent=function(newValue,newStart,newEnd,triggeredByUser){this.value=newValue;this.start=newStart;this.end=newEnd;this.triggeredByUser=triggeredByUser;if(this.start>this.end){var tempOffset=this.end;this.end=this.start;this.start=tempOffset;}};cvox.TypingEcho={CHARACTER:0,WORD:1,CHARACTER_AND_WORD:2,NONE:3,COUNT:4};cvox.TypingEcho.cycle=function(cur){return(cur+1)%cvox.TypingEcho.COUNT;};cvox.TypingEcho.shouldSpeakChar=function(typingEcho){return typingEcho==cvox.TypingEcho.CHARACTER_AND_WORD||typingEcho==cvox.TypingEcho.CHARACTER;};cvox.ChromeVoxEditableTextBase=function(value,start,end,isPassword,tts){this.value=value;this.start=start;this.end=end;this.isPassword=isPassword;this.tts=tts;this.multiline=false;this.lastChangeDescribed=false;};cvox.ChromeVoxEditableTextBase.prototype.setup=function(){};cvox.ChromeVoxEditableTextBase.prototype.teardown=function(){};cvox.ChromeVoxEditableTextBase.useIBeamCursor=cvox.ChromeVox.isMac;cvox.ChromeVoxEditableTextBase.eventTypingEcho=false;cvox.ChromeVoxEditableTextBase.prototype.maxShortPhraseLen=60;cvox.ChromeVoxEditableTextBase.prototype.getLineIndex=function(index){return 0;};cvox.ChromeVoxEditableTextBase.prototype.getLineStart=function(index){return 0;};cvox.ChromeVoxEditableTextBase.prototype.getLineEnd=function(index){return this.value.length;};cvox.ChromeVoxEditableTextBase.prototype.getLine=function(index){var lineStart=this.getLineStart(index);var lineEnd=this.getLineEnd(index);return this.value.substr(lineStart,lineEnd-lineStart);};cvox.ChromeVoxEditableTextBase.prototype.isWhitespaceChar=function(ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';};cvox.ChromeVoxEditableTextBase.prototype.isWordBreakChar=function(ch){return!!ch.match(/^\W$/);};cvox.ChromeVoxEditableTextBase.prototype.shouldDescribeChange=function(evt){if(evt.value==this.value&&evt.start==this.start&&evt.end==this.end){return false;}
return true;};cvox.ChromeVoxEditableTextBase.prototype.speak=function(str,opt_triggeredByUser,opt_personality){if(!str){return;}
var queueMode=cvox.QueueMode.QUEUE;if(opt_triggeredByUser===true){queueMode=cvox.QueueMode.FLUSH;}
this.tts.speak(str,queueMode,opt_personality||{});};cvox.ChromeVoxEditableTextBase.prototype.changed=function(evt){if(!this.shouldDescribeChange(evt)){this.lastChangeDescribed=false;return;}
if(evt.value==this.value){this.describeSelectionChanged(evt);}else{this.describeTextChanged(evt);}
this.lastChangeDescribed=true;this.value=evt.value;this.start=evt.start;this.end=evt.end;};cvox.ChromeVoxEditableTextBase.prototype.describeSelectionChanged=function(evt){if(this.isPassword){this.speak((new goog.i18n.MessageFormat(Msgs.getMsg('dot')).format({'COUNT':1})),evt.triggeredByUser);return;}
if(evt.start==evt.end){if(this.start!=this.end){this.speak(Msgs.getMsg('Unselected'),evt.triggeredByUser);}else if(this.getLineIndex(this.start)!=this.getLineIndex(evt.start)){var lineValue=this.getLine(this.getLineIndex(evt.start));if(lineValue==''){lineValue=Msgs.getMsg('text_box_blank');}else if(/^\s+$/.test(lineValue)){lineValue=Msgs.getMsg('text_box_whitespace');}
this.speak(lineValue,evt.triggeredByUser);}else if(this.start==evt.start+1||this.start==evt.start-1){if(!cvox.ChromeVoxEditableTextBase.useIBeamCursor){if(evt.start==this.value.length){if(cvox.ChromeVox.verbosity==cvox.VERBOSITY_VERBOSE){this.speak(Msgs.getMsg('end_of_text_verbose'),evt.triggeredByUser);}else{this.speak(Msgs.getMsg('end_of_text_brief'),evt.triggeredByUser);}}else{this.speak(this.value.substr(evt.start,1),evt.triggeredByUser,{'phoneticCharacters':evt.triggeredByUser});}}else{this.speak(this.value.substr(Math.min(this.start,evt.start),1),evt.triggeredByUser,{'phoneticCharacters':evt.triggeredByUser});}}else{this.speak(this.value.substr(Math.min(this.start,evt.start),Math.abs(this.start-evt.start)),evt.triggeredByUser);}}else{if(this.start+1==evt.start&&this.end==this.value.length&&evt.end==this.value.length){this.speak(this.value.substr(this.start,1),evt.triggeredByUser);this.speak(this.value.substr(evt.start));}else if(this.start==this.end){this.speak(this.value.substr(evt.start,evt.end-evt.start),evt.triggeredByUser);this.speak(Msgs.getMsg('selected'));}else if(this.start==evt.start&&this.end<evt.end){this.speak(this.value.substr(this.end,evt.end-this.end),evt.triggeredByUser);this.speak(Msgs.getMsg('added_to_selection'));}else if(this.start==evt.start&&this.end>evt.end){this.speak(this.value.substr(evt.end,this.end-evt.end),evt.triggeredByUser);this.speak(Msgs.getMsg('removed_from_selection'));}else if(this.end==evt.end&&this.start>evt.start){this.speak(this.value.substr(evt.start,this.start-evt.start),evt.triggeredByUser);this.speak(Msgs.getMsg('added_to_selection'));}else if(this.end==evt.end&&this.start<evt.start){this.speak(this.value.substr(this.start,evt.start-this.start),evt.triggeredByUser);this.speak(Msgs.getMsg('removed_from_selection'));}else{this.speak(this.value.substr(evt.start,evt.end-evt.start),evt.triggeredByUser);this.speak(Msgs.getMsg('selected'));}}};cvox.ChromeVoxEditableTextBase.prototype.describeTextChanged=function(evt){var personality={};if(evt.value.length<this.value.length){personality=cvox.AbstractTts.PERSONALITY_DELETED;}
if(this.isPassword){this.speak((new goog.i18n.MessageFormat(Msgs.getMsg('dot')).format({'COUNT':1})),evt.triggeredByUser,personality);return;}
var value=this.value;var len=value.length;var newLen=evt.value.length;var autocompleteSuffix='';var evtValue=evt.value;var evtEnd=evt.end;if(evt.start<evtEnd&&evtEnd==newLen){autocompleteSuffix=evtValue.substr(evt.start);evtValue=evtValue.substr(0,evt.start);evtEnd=evt.start;}
var prefixLen=this.start;var suffixLen=len-this.end;if(newLen>=prefixLen+suffixLen+(evtEnd-evt.start)&&evtValue.substr(0,prefixLen)==value.substr(0,prefixLen)&&evtValue.substr(newLen-suffixLen)==value.substr(this.end)){if(!(cvox.ChromeVoxEditableContentEditable&&this instanceof cvox.ChromeVoxEditableContentEditable)||newLen<len||this.isWordBreakChar(evt.value[newLen-1]||'')){this.describeTextChangedHelper(evt,prefixLen,suffixLen,autocompleteSuffix,personality);}
return;}
prefixLen=evt.start;suffixLen=newLen-evtEnd;if(this.start==this.end&&evt.start==evtEnd&&evtValue.substr(0,prefixLen)==value.substr(0,prefixLen)&&evtValue.substr(newLen-suffixLen)==value.substr(len-suffixLen)){this.describeTextChangedHelper(evt,prefixLen,suffixLen,autocompleteSuffix,personality);return;}
evtValue+=autocompleteSuffix;if((evtValue.length==(value.length+1))||((evtValue.length+1)==value.length)){if(evtValue.length>value.length){if(evtValue.indexOf(value)==0){this.speak(evtValue[evtValue.length-1],evt.triggeredByUser,personality);return;}else if(evtValue.indexOf(value)==1){this.speak(evtValue[0],evt.triggeredByUser,personality);return;}}
if(evtValue.length<value.length){if(value.indexOf(evtValue)==0){this.speak(value[value.length-1],evt.triggeredByUser,personality);return;}else if(value.indexOf(evtValue)==1){this.speak(value[0],evt.triggeredByUser,personality);return;}}}
if(this.multiline){if(evt.value.length<this.value.length){this.speak(Msgs.getMsg('text_deleted'),evt.triggeredByUser,personality);}
return;}
if(newLen<=this.maxShortPhraseLen){this.describeTextChangedHelper(evt,0,0,'',personality);return;}
prefixLen=0;while(prefixLen<len&&prefixLen<newLen&&value[prefixLen]==evtValue[prefixLen]){prefixLen++;}
while(prefixLen>0&&!this.isWordBreakChar(value[prefixLen-1])){prefixLen--;}
suffixLen=0;while(suffixLen<(len-prefixLen)&&suffixLen<(newLen-prefixLen)&&value[len-suffixLen-1]==evtValue[newLen-suffixLen-1]){suffixLen++;}
while(suffixLen>0&&!this.isWordBreakChar(value[len-suffixLen])){suffixLen--;}
this.describeTextChangedHelper(evt,prefixLen,suffixLen,'',personality);};cvox.ChromeVoxEditableTextBase.prototype.describeTextChangedHelper=function(evt,prefixLen,suffixLen,autocompleteSuffix,opt_personality){var len=this.value.length;var newLen=evt.value.length;var deletedLen=len-prefixLen-suffixLen;var deleted=this.value.substr(prefixLen,deletedLen);var insertedLen=newLen-prefixLen-suffixLen;var inserted=evt.value.substr(prefixLen,insertedLen);var utterance='';var triggeredByUser=evt.triggeredByUser;if(insertedLen>1){utterance=inserted;}else if(insertedLen==1){if((cvox.ChromeVox.typingEcho==cvox.TypingEcho.WORD||cvox.ChromeVox.typingEcho==cvox.TypingEcho.CHARACTER_AND_WORD)&&this.isWordBreakChar(inserted)&&prefixLen>0&&!this.isWordBreakChar(evt.value.substr(prefixLen-1,1))){var index=prefixLen;while(index>0&&!this.isWordBreakChar(evt.value[index-1])){index--;}
if(index<prefixLen){utterance=evt.value.substr(index,prefixLen+1-index);}else{utterance=inserted;triggeredByUser=false;}}else if(cvox.ChromeVox.typingEcho==cvox.TypingEcho.CHARACTER||cvox.ChromeVox.typingEcho==cvox.TypingEcho.CHARACTER_AND_WORD){utterance=cvox.ChromeVoxEditableTextBase.eventTypingEcho?'':inserted;}}else if(deletedLen>1&&!autocompleteSuffix){utterance=deleted+', deleted';}else if(deletedLen==1){utterance=deleted;}
if(autocompleteSuffix&&utterance){utterance+=', '+autocompleteSuffix;}else if(autocompleteSuffix){utterance=autocompleteSuffix;}
if(utterance){this.speak(utterance,triggeredByUser,opt_personality);}};cvox.ChromeVoxEditableTextBase.prototype.moveCursorToNextCharacter=function(){return false;};cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousCharacter=function(){return false;};cvox.ChromeVoxEditableTextBase.prototype.moveCursorToNextWord=function(){return false;};cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousWord=function(){return false;};cvox.ChromeVoxEditableTextBase.prototype.moveCursorToNextLine=function(){return false;};cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousLine=function(){return false;};cvox.ChromeVoxEditableTextBase.prototype.moveCursorToNextParagraph=function(){return false;};cvox.ChromeVoxEditableTextBase.prototype.moveCursorToPreviousParagraph=function(){return false;};goog.provide('cvox.ChromeVoxEventSuspender');cvox.ChromeVoxEventSuspender=function(){};cvox.ChromeVoxEventSuspender.suspendLevel_=0;cvox.ChromeVoxEventSuspender.enterSuspendEvents=function(){cvox.ChromeVoxEventSuspender.suspendLevel_+=1;}
cvox.ChromeVoxEventSuspender.exitSuspendEvents=function(){cvox.ChromeVoxEventSuspender.suspendLevel_-=1;}
cvox.ChromeVoxEventSuspender.areEventsSuspended=function(){return cvox.ChromeVoxEventSuspender.suspendLevel_>0;};cvox.ChromeVoxEventSuspender.withSuspendedEvents=function(f){return function(){cvox.ChromeVoxEventSuspender.enterSuspendEvents();var ret=f.apply(this,arguments);cvox.ChromeVoxEventSuspender.exitSuspendEvents();return ret;};};cvox.ChromeVoxEventSuspender.makeSuspendableHandler=function(handler,ret){return function(){if(cvox.ChromeVoxEventSuspender.areEventsSuspended()){return ret;}
return handler();};};goog.provide('cvox.ChromeVoxHTMLDateWidget');goog.require('Msgs');cvox.ChromeVoxHTMLDateWidget=function(dateElem,tts){var self=this;this.pos_=0;var maxpos=2;if(dateElem.type=='month'||dateElem.type=='week'){maxpos=1;}
this.maxPos_=maxpos;this.dateElem_=dateElem;this.dateTts_=tts;this.pYear_=-1;this.pMonth_=-1;this.pWeek_=-1;this.pDay_=-1;this.keyListener_=function(evt){self.eventHandler_(evt);};this.blurListener_=function(evt){self.shutdown();};if(this.dateElem_.value.length==0){this.forceInitTime_();}
for(var i=0;i<this.maxPos_;i++){var evt=document.createEvent('KeyboardEvent');evt.initKeyboardEvent('keydown',true,true,window,'Left',0,false,false,false,false);this.dateElem_.dispatchEvent(evt);evt=document.createEvent('KeyboardEvent');evt.initKeyboardEvent('keyup',true,true,window,'Left',0,false,false,false,false);this.dateElem_.dispatchEvent(evt);}
this.dateElem_.addEventListener('keydown',this.keyListener_,false);this.dateElem_.addEventListener('keyup',this.keyListener_,false);this.dateElem_.addEventListener('blur',this.blurListener_,false);this.update_(true);};cvox.ChromeVoxHTMLDateWidget.prototype.shutdown=function(){this.dateElem_.removeEventListener('blur',this.blurListener_,false);this.dateElem_.removeEventListener('keydown',this.keyListener_,false);this.dateElem_.removeEventListener('keyup',this.keyListener_,false);};cvox.ChromeVoxHTMLDateWidget.prototype.forceInitTime_=function(){var currentDate=new Date();var valueString='';var yearString=currentDate.getFullYear()+'';var monthString=currentDate.getMonth()+1+'';if(monthString.length<2){monthString='0'+monthString;}
var dayString=currentDate.getDate()+'';switch(this.dateElem_.type){case'month':valueString=yearString+'-'+monthString;break;case'week':currentDate.setHours(0,0,0);currentDate.setDate(currentDate.getDate()+4-(currentDate.getDay()||7));var yearStart=new Date(currentDate.getFullYear(),0,1);var weekString=Math.ceil((((currentDate-yearStart)/86400000)+1)/7)+'';if(weekString.length<2){weekString='0'+weekString;}
weekString='W'+weekString;valueString=yearString+'-'+weekString;break;default:valueString=yearString+'-'+monthString+'-'+dayString;break;}
this.dateElem_.setAttribute('value',valueString);};cvox.ChromeVoxHTMLDateWidget.prototype.handlePosChange_=function(){this.pos_=Math.max(this.pos_,0);this.pos_=Math.min(this.pos_,this.maxPos_);switch(this.pos_){case 0:if(this.dateElem_.type=='week'){this.pWeek_=-1;}else{this.pMonth_=-1;}
break;case 1:if(this.dateElem_.type=='date'){this.pDay_=-1;}else{this.pYear_=-1;}
break;case 2:this.pYear_=-1;break;}};cvox.ChromeVoxHTMLDateWidget.prototype.update_=function(shouldSpeakLabel){var splitDate=this.dateElem_.value.split('-');if(splitDate.length<1){this.forceInitTime_();return;}
var year=-1;var month=-1;var week=-1;var day=-1;year=parseInt(splitDate[0],10);if(this.dateElem_.type=='week'){week=parseInt(splitDate[1].replace('W',''),10);}else if(this.dateElem_.type=='date'){month=parseInt(splitDate[1],10);day=parseInt(splitDate[2],10);}else{month=parseInt(splitDate[1],10);}
var changeMessage='';if(shouldSpeakLabel){changeMessage=cvox.DomUtil.getName(this.dateElem_,true,true)+'\n';}
if(week!=this.pWeek_){changeMessage=changeMessage+
Msgs.getMsg('datewidget_week')+week+'\n';this.pWeek_=week;}
if(month!=this.pMonth_){var monthName='';switch(month){case 1:monthName=Msgs.getMsg('datewidget_january');break;case 2:monthName=Msgs.getMsg('datewidget_february');break;case 3:monthName=Msgs.getMsg('datewidget_march');break;case 4:monthName=Msgs.getMsg('datewidget_april');break;case 5:monthName=Msgs.getMsg('datewidget_may');break;case 6:monthName=Msgs.getMsg('datewidget_june');break;case 7:monthName=Msgs.getMsg('datewidget_july');break;case 8:monthName=Msgs.getMsg('datewidget_august');break;case 9:monthName=Msgs.getMsg('datewidget_september');break;case 10:monthName=Msgs.getMsg('datewidget_october');break;case 11:monthName=Msgs.getMsg('datewidget_november');break;case 12:monthName=Msgs.getMsg('datewidget_december');break;}
changeMessage=changeMessage+monthName+'\n';this.pMonth_=month;}
if(day!=this.pDay_){changeMessage=changeMessage+day+'\n';this.pDay_=day;}
if(year!=this.pYear_){changeMessage=changeMessage+year+'\n';this.pYear_=year;}
if(changeMessage.length>0){this.dateTts_.speak(changeMessage,0,null);}};cvox.ChromeVoxHTMLDateWidget.prototype.eventHandler_=function(evt){var shouldSpeakLabel=false;if(evt.type=='keydown'){if(((evt.keyCode==9)&&!evt.shiftKey)||(evt.keyCode==39)){this.pos_++;this.handlePosChange_();shouldSpeakLabel=true;}
if(((evt.keyCode==9)&&evt.shiftKey)||(evt.keyCode==37)){this.pos_--;this.handlePosChange_();shouldSpeakLabel=true;}}
this.update_(shouldSpeakLabel);};goog.provide('cvox.ChromeVoxHTMLMediaWidget');cvox.ChromeVoxHTMLMediaWidget=function(mediaElem,tts){var self=this;this.mediaElem_=mediaElem;this.mediaTts_=tts;this.keyListener_=function(evt){self.eventHandler_(evt);}
this.blurListener_=function(evt){self.shutdown();}
this.mediaElem_.addEventListener('keydown',this.keyListener_,false);this.mediaElem_.addEventListener('keyup',this.keyListener_,false);this.mediaElem_.addEventListener('blur',this.blurListener_,false);};cvox.ChromeVoxHTMLMediaWidget.prototype.shutdown=function(){this.mediaElem_.removeEventListener('blur',this.blurListener_,false);this.mediaElem_.removeEventListener('keydown',this.keyListener_,false);this.mediaElem_.removeEventListener('keyup',this.keyListener_,false);};cvox.ChromeVoxHTMLMediaWidget.prototype.jumpToTime_=function(targetTime){if(targetTime<0){targetTime=0;}
if(targetTime>this.mediaElem_.duration){targetTime=this.mediaElem_.duration;}
this.mediaElem_.currentTime=targetTime;};cvox.ChromeVoxHTMLMediaWidget.prototype.setVolume_=function(targetVolume){if(targetVolume<0){targetVolume=0;}
if(targetVolume>1.0){targetVolume=1.0;}
this.mediaElem_.volume=targetVolume;};cvox.ChromeVoxHTMLMediaWidget.prototype.eventHandler_=function(evt){if(evt.type=='keydown'){if((evt.keyCode==13)||(evt.keyCode==32)){if(this.mediaElem_.paused){this.mediaElem_.play();}else{this.mediaElem_.pause();}}else if(evt.keyCode==39){this.jumpToTime_(this.mediaElem_.currentTime+(this.mediaElem_.duration/10));}else if(evt.keyCode==37){this.jumpToTime_(this.mediaElem_.currentTime-(this.mediaElem_.duration/10));}else if(evt.keyCode==38){this.setVolume_(this.mediaElem_.volume+.1);}else if(evt.keyCode==40){this.setVolume_(this.mediaElem_.volume-.1);}}};goog.provide('cvox.ChromeVoxHTMLTimeWidget');cvox.ChromeVoxHTMLTimeWidget=function(timeElem,tts){var self=this;this.timeElem_=timeElem;this.timeTts_=tts;this.pHours_=-1;this.pMinutes_=-1;this.pSeconds_=0;this.pMilliseconds_=0;this.pAmpm_='';this.pos_=0;this.maxPos_=2;this.keyListener_=function(evt){self.eventHandler_(evt);};this.blurListener_=function(evt){self.shutdown();};if(this.timeElem_.hasAttribute('step')){var step=this.timeElem_.getAttribute('step');if(step>0){if(step>=1){this.maxPos_=3;}else{this.maxPos_=4;}}}
if(this.timeElem_.value.length==0){this.forceInitTime_();}
for(var i=0;i<this.maxPos_;i++){var evt=document.createEvent('KeyboardEvent');evt.initKeyboardEvent('keydown',true,true,window,'Left',0,false,false,false,false);this.timeElem_.dispatchEvent(evt);evt=document.createEvent('KeyboardEvent');evt.initKeyboardEvent('keyup',true,true,window,'Left',0,false,false,false,false);this.timeElem_.dispatchEvent(evt);}
this.timeElem_.addEventListener('keydown',this.keyListener_,false);this.timeElem_.addEventListener('keyup',this.keyListener_,false);this.timeElem_.addEventListener('blur',this.blurListener_,false);this.update_(true);};cvox.ChromeVoxHTMLTimeWidget.prototype.shutdown=function(){this.timeElem_.removeEventListener('blur',this.blurListener_,false);this.timeElem_.removeEventListener('keydown',this.keyListener_,false);this.timeElem_.removeEventListener('keyup',this.keyListener_,false);};cvox.ChromeVoxHTMLTimeWidget.prototype.forceInitTime_=function(){this.timeElem_.setAttribute('value','12:00');};cvox.ChromeVoxHTMLTimeWidget.prototype.handlePosChange_=function(){if(this.pos_<0){this.pos_=0;}
if(this.pos_>this.maxPos_){this.pos_=this.maxPos_;}
if(this.pos_==this.maxPos_){this.pAmpm_='';return;}
switch(this.pos_){case 0:this.pHours_=-1;break;case 1:this.pMinutes_=-1;break;case 2:this.pSeconds_=-1;break;case 3:this.pMilliseconds_=-1;break;}};cvox.ChromeVoxHTMLTimeWidget.prototype.update_=function(shouldSpeakLabel){var splitTime=this.timeElem_.value.split(':');if(splitTime.length<1){this.forceInitTime_();return;}
var hours=splitTime[0];var minutes=-1;var seconds=0;var milliseconds=0;var ampm=Msgs.getMsg('timewidget_am');if(splitTime.length>1){minutes=splitTime[1];}
if(splitTime.length>2){var splitSecondsAndMilliseconds=splitTime[2].split('.');seconds=splitSecondsAndMilliseconds[0];if(splitSecondsAndMilliseconds.length>1){milliseconds=splitSecondsAndMilliseconds[1];}}
if(hours>12){hours=hours-12;ampm=Msgs.getMsg('timewidget_pm');}
if(hours==12){ampm=Msgs.getMsg('timewidget_pm');}
if(hours==0){hours=12;ampm=Msgs.getMsg('timewidget_am');}
var changeMessage='';if(shouldSpeakLabel){changeMessage=cvox.DomUtil.getName(this.timeElem_,true,true)+'\n';}
if(hours!=this.pHours_){changeMessage=changeMessage+hours+' '+
Msgs.getMsg('timewidget_hours')+'\n';this.pHours_=hours;}
if(minutes!=this.pMinutes_){changeMessage=changeMessage+minutes+' '+
Msgs.getMsg('timewidget_minutes')+'\n';this.pMinutes_=minutes;}
if(seconds!=this.pSeconds_){changeMessage=changeMessage+seconds+' '+