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){if(goog.global.CLOSURE_UNCOMPILED_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES,name)){value=goog.global.CLOSURE_UNCOMPILED_DEFINES[name];}else if(goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,name)){value=goog.global.CLOSURE_DEFINES[name];}}
goog.exportPath_(name,value);};goog.DEBUG=true;goog.define('goog.LOCALE','en');goog.define('goog.TRUSTED_SITE',true);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.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('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.PlatformFilter');goog.provide('cvox.PlatformUtil');goog.require('cvox.ChromeVox');cvox.PlatformFilter={NONE:0,WINDOWS:1,MAC:2,LINUX:4,WML:7,CHROMEOS:8,ANDROID:16};cvox.PlatformUtil.matchesPlatform=function(filter){var uA=navigator.userAgent;if(filter==undefined){return true;}else if(uA.indexOf('Android')!=-1){return(filter&cvox.PlatformFilter.ANDROID)!=0;}else if(uA.indexOf('Win')!=-1){return(filter&cvox.PlatformFilter.WINDOWS)!=0;}else if(uA.indexOf('Mac')!=-1){return(filter&cvox.PlatformFilter.MAC)!=0;}else if(uA.indexOf('Linux')!=-1){return(filter&cvox.PlatformFilter.LINUX)!=0;}else if(uA.indexOf('CrOS')!=-1){return(filter&cvox.PlatformFilter.CHROMEOS)!=0;}
return false;};goog.provide('cvox.KeySequence');goog.require('cvox.ChromeVox');goog.require('cvox.PlatformFilter');cvox.KeySequence=function(originalEvent,opt_cvoxModifier,opt_doubleTap,opt_skipStripping,opt_requireStickyMode){this.doubleTap=!!opt_doubleTap;this.requireStickyMode=!!opt_requireStickyMode;this.platformFilter;this.skipStripping=!!opt_skipStripping;if(opt_cvoxModifier==undefined){this.cvoxModifier=this.isCVoxModifierActive(originalEvent);}else{this.cvoxModifier=opt_cvoxModifier;}
this.stickyMode=!!originalEvent['stickyMode'];this.prefixKey=!!originalEvent['keyPrefix'];if(this.stickyMode&&this.prefixKey){throw'Prefix key and sticky mode cannot both be enabled: '+originalEvent;}
var event=this.resolveChromeOSSpecialKeys_(originalEvent);this.keys={ctrlKey:[],searchKeyHeld:[],altKey:[],altGraphKey:[],shiftKey:[],metaKey:[],keyCode:[]};this.extractKey_(event);};cvox.KeySequence.KEY_PRESS_CODE={39:222,44:188,45:189,46:190,47:191,59:186,91:219,92:220,93:221};cvox.KeySequence.doubleTapCache=[];cvox.KeySequence.prototype.addKeyEvent=function(additionalKeyEvent){if(this.keys.keyCode.length>1){return false;}
this.extractKey_(additionalKeyEvent);return true;};cvox.KeySequence.prototype.equals=function(rhs){if(!this.checkKeyEquality_(rhs)){return false;}
if(this.doubleTap!=rhs.doubleTap){return false;}
if(this.requireStickyMode||rhs.requireStickyMode){return(this.stickyMode||rhs.stickyMode)&&!this.cvoxModifier&&!rhs.cvoxModifier;}
if(this.cvoxModifier===rhs.cvoxModifier){return true;}
var unmodified=this.cvoxModifier?rhs:this;return unmodified.stickyMode||unmodified.prefixKey;};cvox.KeySequence.prototype.extractKey_=function(keyEvent){for(var prop in this.keys){if(prop=='keyCode'){var keyCode;if(keyEvent.type=='keypress'&&keyEvent[prop]>=97&&keyEvent[prop]<=122){keyCode=keyEvent[prop]-32;}else if(keyEvent.type=='keypress'){keyCode=cvox.KeySequence.KEY_PRESS_CODE[keyEvent[prop]];}
this.keys[prop].push(keyCode||keyEvent[prop]);}else{if(this.isKeyModifierActive(keyEvent,prop)){this.keys[prop].push(true);}else{this.keys[prop].push(false);}}}
if(this.cvoxModifier){this.rationalizeKeys_();}};cvox.KeySequence.prototype.rationalizeKeys_=function(){if(this.skipStripping){return;}
var modifierKeyCombo=cvox.ChromeVox.modKeyStr.split(/\+/g);var index=this.keys.keyCode.length-1;if(modifierKeyCombo.indexOf('Ctrl')!=-1){this.keys.ctrlKey[index]=false;}
if(modifierKeyCombo.indexOf('Alt')!=-1){this.keys.altKey[index]=false;}
if(modifierKeyCombo.indexOf('Shift')!=-1){this.keys.shiftKey[index]=false;}
var metaKeyName=this.getMetaKeyName_();if(modifierKeyCombo.indexOf(metaKeyName)!=-1){if(metaKeyName=='Search'){this.keys.searchKeyHeld[index]=false;this.keys.metaKey[index]=false;}else if(metaKeyName=='Cmd'||metaKeyName=='Win'){this.keys.metaKey[index]=false;}}};cvox.KeySequence.prototype.getMetaKeyName_=function(){if(cvox.ChromeVox.isChromeOS){return'Search';}else if(cvox.ChromeVox.isMac){return'Cmd';}else{return'Win';}};cvox.KeySequence.prototype.checkKeyEquality_=function(rhs){for(var i in this.keys){for(var j=this.keys[i].length;j--;){if(this.keys[i][j]!==rhs.keys[i][j])
return false;}}
return true;};cvox.KeySequence.prototype.getFirstKeyCode=function(){return this.keys.keyCode[0];};cvox.KeySequence.prototype.length=function(){return this.keys.keyCode.length;};cvox.KeySequence.prototype.isModifierKey=function(keyCode){return keyCode==16||keyCode==17||keyCode==18||keyCode==91||keyCode==93;};cvox.KeySequence.prototype.isCVoxModifierActive=function(keyEvent){var modifierKeyCombo=cvox.ChromeVox.modKeyStr.split(/\+/g);if(this.isKeyModifierActive(keyEvent,'ctrlKey')){modifierKeyCombo=modifierKeyCombo.filter(function(modifier){return modifier!='Ctrl';});}
if(this.isKeyModifierActive(keyEvent,'altKey')){modifierKeyCombo=modifierKeyCombo.filter(function(modifier){return modifier!='Alt';});}
if(this.isKeyModifierActive(keyEvent,'shiftKey')){modifierKeyCombo=modifierKeyCombo.filter(function(modifier){return modifier!='Shift';});}
if(this.isKeyModifierActive(keyEvent,'metaKey')||this.isKeyModifierActive(keyEvent,'searchKeyHeld')){var metaKeyName=this.getMetaKeyName_();modifierKeyCombo=modifierKeyCombo.filter(function(modifier){return modifier!=metaKeyName;});}
return(modifierKeyCombo.length==0);};cvox.KeySequence.prototype.isKeyModifierActive=function(keyEvent,modifier){switch(modifier){case'ctrlKey':return(keyEvent.ctrlKey||keyEvent.keyCode==17);break;case'altKey':return(keyEvent.altKey||(keyEvent.keyCode==18));break;case'shiftKey':return(keyEvent.shiftKey||(keyEvent.keyCode==16));break;case'metaKey':return(keyEvent.metaKey||(keyEvent.keyCode==91));break;case'searchKeyHeld':return((cvox.ChromeVox.isChromeOS&&keyEvent.keyCode==91)||keyEvent['searchKeyHeld']);break;}
return false;};cvox.KeySequence.prototype.isAnyModifierActive=function(){for(var modifierType in this.keys){for(var i=0;i<this.length();i++){if(this.keys[modifierType][i]&&modifierType!='keyCode'){return true;}}}
return false;};cvox.KeySequence.deserialize=function(sequenceObject){var firstSequenceEvent={};firstSequenceEvent['stickyMode']=(sequenceObject.stickyMode==undefined)?false:sequenceObject.stickyMode;firstSequenceEvent['prefixKey']=(sequenceObject.prefixKey==undefined)?false:sequenceObject.prefixKey;var secondKeyPressed=sequenceObject.keys.keyCode.length>1;var secondSequenceEvent={};for(var keyPressed in sequenceObject.keys){firstSequenceEvent[keyPressed]=sequenceObject.keys[keyPressed][0];if(secondKeyPressed){secondSequenceEvent[keyPressed]=sequenceObject.keys[keyPressed][1];}}
var skipStripping=sequenceObject.skipStripping!==undefined?sequenceObject.skipStripping:true;var keySeq=new cvox.KeySequence(firstSequenceEvent,sequenceObject.cvoxModifier,sequenceObject.doubleTap,skipStripping,sequenceObject.requireStickyMode);if(secondKeyPressed){cvox.ChromeVox.sequenceSwitchKeyCodes.push(new cvox.KeySequence(firstSequenceEvent,sequenceObject.cvoxModifier));keySeq.addKeyEvent(secondSequenceEvent);}
if(sequenceObject.doubleTap){cvox.KeySequence.doubleTapCache.push(keySeq);}
return keySeq;};cvox.KeySequence.fromStr=function(keyStr){var sequenceEvent={};var secondSequenceEvent={};var secondKeyPressed;if(keyStr.indexOf('>')==-1){secondKeyPressed=false;}else{secondKeyPressed=true;}
var cvoxPressed=false;sequenceEvent['stickyMode']=false;sequenceEvent['prefixKey']=false;var tokens=keyStr.split('+');for(var i=0;i<tokens.length;i++){var seqs=tokens[i].split('>');for(var j=0;j<seqs.length;j++){if(seqs[j].charAt(0)=='#'){var keyCode=parseInt(seqs[j].substr(1),10);if(j>0){secondSequenceEvent['keyCode']=keyCode;}else{sequenceEvent['keyCode']=keyCode;}}
var keyName=seqs[j];if(seqs[j].length==1){if(j>0){secondSequenceEvent['keyCode']=seqs[j].charCodeAt(0);}else{sequenceEvent['keyCode']=seqs[j].charCodeAt(0);}}else{if(j>0){cvox.KeySequence.setModifiersOnEvent_(keyName,secondSequenceEvent);if(keyName=='Cvox'){cvoxPressed=true;}}else{cvox.KeySequence.setModifiersOnEvent_(keyName,sequenceEvent);if(keyName=='Cvox'){cvoxPressed=true;}}}}}
var keySeq=new cvox.KeySequence(sequenceEvent,cvoxPressed);if(secondKeyPressed){keySeq.addKeyEvent(secondSequenceEvent);}
return keySeq;};cvox.KeySequence.setModifiersOnEvent_=function(keyName,seqEvent){if(keyName=='Ctrl'){seqEvent['ctrlKey']=true;seqEvent['keyCode']=17;}else if(keyName=='Alt'){seqEvent['altKey']=true;seqEvent['keyCode']=18;}else if(keyName=='Shift'){seqEvent['shiftKey']=true;seqEvent['keyCode']=16;}else if(keyName=='Search'){seqEvent['searchKeyHeld']=true;seqEvent['keyCode']=91;}else if(keyName=='Cmd'){seqEvent['metaKey']=true;seqEvent['keyCode']=91;}else if(keyName=='Win'){seqEvent['metaKey']=true;seqEvent['keyCode']=91;}else if(keyName=='Insert'){seqEvent['keyCode']=45;}};cvox.KeySequence.prototype.resolveChromeOSSpecialKeys_=function(originalEvent){if(!this.cvoxModifier||this.stickyMode||this.prefixKey||!cvox.ChromeVox.isChromeOS){return originalEvent;}
var evt={};for(var key in originalEvent){evt[key]=originalEvent[key];}
switch(evt['keyCode']){case 33:evt['keyCode']=38;break;case 34:evt['keyCode']=40;break;case 35:evt['keyCode']=39;break;case 36:evt['keyCode']=37;break;case 45:evt['keyCode']=190;break;case 46:evt['keyCode']=8;break;case 112:evt['keyCode']=49;break;case 113:evt['keyCode']=50;break;case 114:evt['keyCode']=51;break;case 115:evt['keyCode']=52;break;case 116:evt['keyCode']=53;break;case 117:evt['keyCode']=54;break;case 118:evt['keyCode']=55;break;case 119:evt['keyCode']=56;break;case 120:evt['keyCode']=57;break;case 121:evt['keyCode']=48;break;case 122:evt['keyCode']=189;break;case 123:evt['keyCode']=187;break;}
return evt;};goog.provide('Msgs');Msgs=function(){};Msgs.NAMESPACE_='chromevox_';Msgs.localeNameDict_=null;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.getLocaleDisplayName=function(locale){if(!Msgs.localeNameDict_){Msgs.localeNameDict_=(JSON.parse(this.getMsg('locale_dict')));}
var name=Msgs.localeNameDict_[locale];if(!name){throw Error('Unsupported locale identifier: '+locale);}
return name;};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.KeyUtil');goog.provide('cvox.SimpleKeyEvent');goog.require('Msgs');goog.require('cvox.ChromeVox');goog.require('cvox.KeySequence');cvox.SimpleKeyEvent;cvox.KeyUtil=function(){};cvox.KeyUtil.modeKeyPressTime=0;cvox.KeyUtil.sequencing=false;cvox.KeyUtil.prevKeySequence=null;cvox.KeyUtil.stickyKeySequence=null;cvox.KeyUtil.maxSeqLength=2;cvox.KeyUtil.keyEventToKeySequence=function(keyEvent){var util=cvox.KeyUtil;if(util.prevKeySequence&&(util.maxSeqLength==util.prevKeySequence.length())){util.sequencing=false;util.prevKeySequence=null;}
var keyIsPrefixed=util.sequencing||keyEvent['keyPrefix']||keyEvent['stickyMode'];var keySequence=new cvox.KeySequence(keyEvent);var keyWasCvox=keySequence.cvoxModifier;if(keyIsPrefixed||keyWasCvox){if(!util.sequencing&&util.isSequenceSwitchKeyCode(keySequence)){util.sequencing=true;util.prevKeySequence=keySequence;return keySequence;}else if(util.sequencing){if(util.prevKeySequence.addKeyEvent(keyEvent)){keySequence=util.prevKeySequence;util.prevKeySequence=null;util.sequencing=false;return keySequence;}else{throw'Think sequencing is enabled, yet util.prevKeySequence already'+'has two key codes'+util.prevKeySequence;}}}else{util.sequencing=false;}
var currTime=new Date().getTime();if(cvox.KeyUtil.isDoubleTapKey(keySequence)&&util.prevKeySequence&&keySequence.equals(util.prevKeySequence)){var prevTime=util.modeKeyPressTime;var delta=currTime-prevTime;if(prevTime>0&&delta>100&&delta<300){keySequence=util.prevKeySequence;keySequence.doubleTap=true;util.prevKeySequence=null;util.sequencing=false;if(cvox.ChromeVox.isChromeOS&&keyEvent.keyCode==cvox.KeyUtil.getStickyKeyCode()){cvox.ChromeVox.searchKeyHeld=false;}
return keySequence;}}
util.prevKeySequence=keySequence;util.modeKeyPressTime=currTime;return keySequence;};cvox.KeyUtil.keyCodeToString=function(keyCode){if(keyCode==17){return'Ctrl';}
if(keyCode==18){return'Alt';}
if(keyCode==16){return'Shift';}
if((keyCode==91)||(keyCode==93)){if(cvox.ChromeVox.isChromeOS){return'Search';}else if(cvox.ChromeVox.isMac){return'Cmd';}else{return'Win';}}
if(keyCode==45){return'Insert';}
if(keyCode>=65&&keyCode<=90){return String.fromCharCode(keyCode);}else if(keyCode>=48&&keyCode<=57){return String.fromCharCode(keyCode);}else{return'#'+keyCode;}};cvox.KeyUtil.modStringToKeyCode=function(keyString){switch(keyString){case'Ctrl':return 17;case'Alt':return 18;case'Shift':return 16;case'Cmd':case'Win':return 91;}
return-1;};cvox.KeyUtil.cvoxModKeyCodes=function(){var modKeyCombo=cvox.ChromeVox.modKeyStr.split(/\+/g);var modKeyCodes=modKeyCombo.map(function(keyString){return cvox.KeyUtil.modStringToKeyCode(keyString);});return modKeyCodes;};cvox.KeyUtil.isSequenceSwitchKeyCode=function(rhKeySeq){for(var i=0;i<cvox.ChromeVox.sequenceSwitchKeyCodes.length;i++){var lhKeySeq=cvox.ChromeVox.sequenceSwitchKeyCodes[i];if(lhKeySeq.equals(rhKeySeq)){return true;}}
return false;};cvox.KeyUtil.getReadableNameForKeyCode=function(keyCode){var msg=Msgs.getMsg.bind(Msgs);var cros=cvox.ChromeVox.isChromeOS;if(keyCode==0){return'Power button';}else if(keyCode==17){return'Control';}else if(keyCode==18){return'Alt';}else if(keyCode==16){return'Shift';}else if(keyCode==9){return'Tab';}else if((keyCode==91)||(keyCode==93)){if(cros){return'Search';}else if(cvox.ChromeVox.isMac){return'Cmd';}else{return'Win';}}else if(keyCode==8){return'Backspace';}else if(keyCode==32){return'Space';}else if(keyCode==35){return'end';}else if(keyCode==36){return'home';}else if(keyCode==37){return'Left arrow';}else if(keyCode==38){return'Up arrow';}else if(keyCode==39){return'Right arrow';}else if(keyCode==40){return'Down arrow';}else if(keyCode==45){return'Insert';}else if(keyCode==13){return'Enter';}else if(keyCode==27){return'Escape';}else if(keyCode==112){return cros?msg('back_key'):'F1';}else if(keyCode==113){return cros?msg('forward_key'):'F2';}else if(keyCode==114){return cros?msg('refresh_key'):'F3';}else if(keyCode==115){return cros?msg('toggle_full_screen_key'):'F4';}else if(keyCode==116){return cros?msg('window_overview_key'):'F5';}else if(keyCode==117){return cros?msg('brightness_down_key'):'F6';}else if(keyCode==118){return cros?msg('brightness_up_key'):'F7';}else if(keyCode==119){return cros?msg('volume_mute_key'):'F8';}else if(keyCode==120){return cros?msg('volume_down_key'):'F9';}else if(keyCode==121){return cros?msg('volume_up_key'):'F10';}else if(keyCode==122){return'F11';}else if(keyCode==123){return'F12';}else if(keyCode==186){return'Semicolon';}else if(keyCode==187){return'Equal sign';}else if(keyCode==188){return'Comma';}else if(keyCode==189){return'Dash';}else if(keyCode==190){return'Period';}else if(keyCode==191){return'Forward slash';}else if(keyCode==192){return'Grave accent';}else if(keyCode==219){return'Open bracket';}else if(keyCode==220){return'Back slash';}else if(keyCode==221){return'Close bracket';}else if(keyCode==222){return'Single quote';}else if(keyCode==115){return'Toggle full screen';}else if(keyCode>=48&&keyCode<=90){return String.fromCharCode(keyCode);}
return'';};cvox.KeyUtil.getStickyKeyCode=function(){var stickyKeyCode=45;if(cvox.ChromeVox.isChromeOS||cvox.ChromeVox.isMac){stickyKeyCode=91;}
return stickyKeyCode;};cvox.KeyUtil.getReadableNameForStr=function(keyStr){return null;};cvox.KeyUtil.keySequenceToString=function(keySequence,opt_readableKeyCode,opt_modifiers){var str='';var numKeys=keySequence.length();for(var index=0;index<numKeys;index++){if(str!=''&&!opt_modifiers){str+='>';}else if(str!=''){str+='+';}
var tempStr='';for(var keyPressed in keySequence.keys){if(!keySequence.keys[keyPressed][index]){continue;}
var modifier='';switch(keyPressed){case'ctrlKey':modifier='Ctrl';break;case'searchKeyHeld':var searchKey=cvox.KeyUtil.getReadableNameForKeyCode(91);modifier=searchKey;break;case'altKey':modifier='Alt';break;case'altGraphKey':modifier='AltGraph';break;case'shiftKey':modifier='Shift';break;case'metaKey':var metaKey=cvox.KeyUtil.getReadableNameForKeyCode(91);modifier=metaKey;break;case'keyCode':var keyCode=keySequence.keys[keyPressed][index];if(!keySequence.isModifierKey(keyCode)&&!opt_modifiers){if(opt_readableKeyCode){tempStr+=cvox.KeyUtil.getReadableNameForKeyCode(keyCode);}else{tempStr+=cvox.KeyUtil.keyCodeToString(keyCode);}}}
if(str.indexOf(modifier)==-1){tempStr+=modifier+'+';}}
str+=tempStr;if(str[str.length-1]=='+'){str=str.slice(0,-1);}}
if(keySequence.cvoxModifier||keySequence.prefixKey){if(str!=''){str='ChromeVox+'+str;}else{str='Cvox';}}else if(keySequence.stickyMode){if(str[str.length-1]=='>'){str=str.slice(0,-1);}
str=str+'+'+str;}
return str;};cvox.KeyUtil.isDoubleTapKey=function(key){var isSet=false;var originalState=key.doubleTap;key.doubleTap=true;for(var i=0,keySeq;keySeq=cvox.KeySequence.doubleTapCache[i];i++){if(keySeq.equals(key)){isSet=true;break;}}
key.doubleTap=originalState;return isSet;};goog.provide('cvox.KeyMap');goog.require('cvox.KeyUtil');goog.require('cvox.PlatformUtil');cvox.KeyMap=function(commandsAndKeySequences){this.bindings_=commandsAndKeySequences;this.commandToKey_={};this.buildCommandToKey_();};cvox.KeyMap.KEYMAP_PATH='chromevox/background/keymaps/';cvox.KeyMap.AVAILABLE_MAP_INFO={'keymap_classic':{'file':'classic_keymap.json'},'keymap_flat':{'file':'flat_keymap.json'},'keymap_next':{'file':'next_keymap.json'},'keymap_experimental':{'file':'experimental.json'}};cvox.KeyMap.DEFAULT_KEYMAP=0;cvox.KeyMap.prototype.length=function(){return this.bindings_.length;};cvox.KeyMap.prototype.keys=function(){return this.bindings_.map(function(binding){return binding.sequence;});};cvox.KeyMap.prototype.bindings=function(){return this.bindings_;};cvox.KeyMap.prototype.toJSON=function(){return JSON.stringify({bindings:this.bindings_});};cvox.KeyMap.prototype.toLocalStorage=function(){localStorage['keyBindings']=this.toJSON();};cvox.KeyMap.prototype.hasBinding=function(command,sequence){if(this.commandToKey_!=null){return this.commandToKey_[command]==sequence;}else{for(var i=0;i<this.bindings_.length;i++){var binding=this.bindings_[i];if(binding.command==command&&binding.sequence==sequence){return true;}}}
return false;};cvox.KeyMap.prototype.hasCommand=function(command){if(this.commandToKey_!=null){return this.commandToKey_[command]!=undefined;}else{for(var i=0;i<this.bindings_.length;i++){var binding=this.bindings_[i];if(binding.command==command){return true;}}}
return false;};cvox.KeyMap.prototype.hasKey=function(key){for(var i=0;i<this.bindings_.length;i++){var binding=this.bindings_[i];if(binding.sequence.equals(key)){return true;}}
return false;};cvox.KeyMap.prototype.commandForKey=function(key){if(key!=null){for(var i=0;i<this.bindings_.length;i++){var binding=this.bindings_[i];if(binding.sequence.equals(key)){return binding.command;}}}
return null;};cvox.KeyMap.prototype.keyForCommand=function(command){if(this.commandToKey_!=null){return[this.commandToKey_[command]];}else{var keySequenceArray=[];for(var i=0;i<this.bindings_.length;i++){var binding=this.bindings_[i];if(binding.command==command){keySequenceArray.push(binding.sequence);}}}
return(keySequenceArray.length>0)?keySequenceArray:[];};cvox.KeyMap.prototype.merge=function(inputMap){var keys=inputMap.keys();var cleanMerge=true;for(var i=0;i<keys.length;++i){var key=keys[i];var command=inputMap.commandForKey(key);if(command=='toggleStickyMode'){continue;}else if(key&&command&&!this.hasKey(key)&&!this.hasCommand(command)){this.bind_(command,key);}else{cleanMerge=false;}}
return cleanMerge;};cvox.KeyMap.prototype.rebind=function(command,newKey){if(this.hasCommand(command)&&!this.hasKey(newKey)){this.bind_(command,newKey);return true;}
return false;};cvox.KeyMap.prototype.bind_=function(command,newKey){var bound=false;for(var i=0;i<this.bindings_.length;i++){var binding=this.bindings_[i];if(binding.command==command){delete binding.sequence;binding.sequence=newKey;if(this.commandToKey_!=null){this.commandToKey_[binding.command]=newKey;}
bound=true;}}
if(!bound){var binding={'command':command,'sequence':newKey};this.bindings_.push(binding);this.commandToKey_[binding.command]=binding.sequence;}};cvox.KeyMap.fromDefaults=function(){return(cvox.KeyMap.fromPath(cvox.KeyMap.KEYMAP_PATH+
cvox.KeyMap.AVAILABLE_MAP_INFO['keymap_classic'].file));};cvox.KeyMap.fromNext=function(){return cvox.KeyMap.fromPath(cvox.KeyMap.KEYMAP_PATH+
cvox.KeyMap.AVAILABLE_MAP_INFO['keymap_next'].file);};cvox.KeyMap.fromJSON=function(json){try{var commandsAndKeySequences=(JSON.parse(json).bindings);commandsAndKeySequences=commandsAndKeySequences.filter(function(value){return value.sequence.platformFilter===undefined||cvox.PlatformUtil.matchesPlatform(value.sequence.platformFilter);});}catch(e){console.error('Failed to load key map from JSON');console.error(e);return null;}
if(typeof(commandsAndKeySequences)!='object'){return null;}
for(var i=0;i<commandsAndKeySequences.length;i++){if(commandsAndKeySequences[i].command==undefined||commandsAndKeySequences[i].sequence==undefined){return null;}else{commandsAndKeySequences[i].sequence=(cvox.KeySequence.deserialize(commandsAndKeySequences[i].sequence));}}
return new cvox.KeyMap(commandsAndKeySequences);};cvox.KeyMap.fromLocalStorage=function(){if(localStorage['keyBindings']){return cvox.KeyMap.fromJSON(localStorage['keyBindings']);}
return null;};cvox.KeyMap.fromPath=function(path){return cvox.KeyMap.fromJSON(cvox.KeyMap.readJSON_(path));};cvox.KeyMap.fromCurrentKeyMap=function(){var map=localStorage['currentKeyMap'];if(map&&cvox.KeyMap.AVAILABLE_MAP_INFO[map]){return(cvox.KeyMap.fromPath(cvox.KeyMap.KEYMAP_PATH+cvox.KeyMap.AVAILABLE_MAP_INFO[map].file));}else{return cvox.KeyMap.fromDefaults();}};cvox.KeyMap.readJSON_=function(path){var url=chrome.extension.getURL(path);if(!url){throw'Invalid path: '+path;}
var xhr=new XMLHttpRequest();xhr.open('GET',url,false);xhr.send();return xhr.responseText;};cvox.KeyMap.prototype.resetModifier=function(){localStorage['cvoxKey']=cvox.ChromeVox.modKeyStr;};cvox.KeyMap.prototype.buildCommandToKey_=function(){for(var i=0;i<this.bindings_.length;i++){var binding=this.bindings_[i];if(this.commandToKey_[binding.command]!=undefined){continue;}
this.commandToKey_[binding.command]=binding.sequence;}};goog.provide('cvox.ChromeVoxKbHandler');goog.require('cvox.ChromeVox');goog.require('cvox.KeyMap');goog.require('cvox.KeySequence');goog.require('cvox.KeyUtil');cvox.ChromeVoxKbHandler={};cvox.ChromeVoxKbHandler.handlerKeyMap;cvox.ChromeVoxKbHandler.commandHandler;cvox.ChromeVoxKbHandler.loadKeyToFunctionsTable=function(keyToFunctionsTable){if(!window.JSON){return;}
cvox.ChromeVoxKbHandler.handlerKeyMap=cvox.KeyMap.fromJSON(keyToFunctionsTable);};cvox.ChromeVoxKbHandler.sortKeyToFunctionsTable_=function(keyToFunctionsTable){var sortingArray=[];for(var keySeqStr in keyToFunctionsTable){sortingArray.push([keySeqStr,keyToFunctionsTable[keySeqStr]]);}
function compareKeyStr(a,b){if(a[0].length<b[0].length){return-1;}else if(b[0].length<a[0].length){return 1;}else{return a[0].localeCompare(b[0]);}};sortingArray.sort(compareKeyStr);return sortingArray;};cvox.ChromeVoxKbHandler.basicKeyDownActionsListener=function(evt){var keySequence=cvox.KeyUtil.keyEventToKeySequence(evt);var functionName;if(cvox.ChromeVoxKbHandler.handlerKeyMap!=undefined){functionName=cvox.ChromeVoxKbHandler.handlerKeyMap.commandForKey(keySequence);}else{functionName=null;}
if(!functionName){return!cvox.KeyUtil.sequencing;}
if(!cvox.ChromeVox.isActive&&functionName!='toggleChromeVox'){return true;}
var returnValue=true;var commandResult=cvox.ChromeVoxKbHandler.commandHandler(functionName);if(commandResult!==undefined){returnValue=commandResult;}else if(keySequence.cvoxModifier){returnValue=false;}
if(cvox.ChromeVox.entireDocumentIsHidden){returnValue=true;}
return returnValue;};goog.provide('cvox.CommandStore');goog.require('cvox.PlatformFilter');cvox.CommandStore.categories=function(){var categorySet={};for(var cmd in cvox.CommandStore.CMD_WHITELIST){var struct=cvox.CommandStore.CMD_WHITELIST[cmd];if(struct.category){categorySet[struct.category]=true;}}
var ret=[];for(var category in categorySet){ret.push(category);}
return ret;};cvox.CommandStore.messageForCommand=function(command){return(cvox.CommandStore.CMD_WHITELIST[command]||{}).msgId;};cvox.CommandStore.categoryForCommand=function(command){return(cvox.CommandStore.CMD_WHITELIST[command]||{}).category;};cvox.CommandStore.commandsForCategory=function(category){var ret=[];for(var cmd in cvox.CommandStore.CMD_WHITELIST){var struct=cvox.CommandStore.CMD_WHITELIST[cmd];if(category==struct.category){ret.push(cmd);}}
return ret;};cvox.CommandStore.CMD_WHITELIST={'toggleStickyMode':{announce:false,msgId:'toggle_sticky_mode','disallowOOBE':true,category:'modifier_keys'},'toggleKeyPrefix':{announce:false,skipInput:true,msgId:'prefix_key','disallowOOBE':true,category:'modifier_keys'},'passThroughMode':{announce:false,msgId:'pass_through_key_description',category:'modifier_keys'},'stopSpeech':{announce:false,disallowContinuation:true,doDefault:true,msgId:'stop_speech_key',category:'controlling_speech'},'toggleChromeVox':{announce:false,platformFilter:cvox.PlatformFilter.WML,msgId:'toggle_chromevox_active',category:'modifier_keys'},'toggleChromeVoxVersion':{announce:false},'showNextUpdatePage':{msgId:'show_next_update_description',announce:false,'category':'help_commands'},'openChromeVoxMenus':{announce:false,msgId:'menus_title'},'decreaseTtsRate':{announce:false,msgId:'decrease_tts_rate',category:'controlling_speech'},'increaseTtsRate':{announce:false,msgId:'increase_tts_rate',category:'controlling_speech'},'decreaseTtsPitch':{announce:false,msgId:'decrease_tts_pitch',category:'controlling_speech'},'increaseTtsPitch':{announce:false,msgId:'increase_tts_pitch',category:'controlling_speech'},'decreaseTtsVolume':{announce:false,msgId:'decrease_tts_volume',category:'controlling_speech'},'increaseTtsVolume':{announce:false,msgId:'increase_tts_volume',category:'controlling_speech'},'cyclePunctuationEcho':{announce:false,msgId:'cycle_punctuation_echo',category:'controlling_speech'},'cycleTypingEcho':{announce:false,msgId:'cycle_typing_echo',category:'controlling_speech'},'toggleEarcons':{announce:true,msgId:'toggle_earcons',category:'controlling_speech'},'handleTab':{allowEvents:true,msgId:'handle_tab_next',disallowContinuation:true,category:'navigation'},'handleTabPrev':{allowEvents:true,msgId:'handle_tab_prev',disallowContinuation:true,category:'navigation'},'forward':{forward:true,announce:true,msgId:'forward',category:'navigation'},'backward':{backward:true,announce:true,msgId:'backward',category:'navigation'},'right':{forward:true,announce:true,msgId:'right',category:'navigation'},'left':{backward:true,announce:true,msgId:'left',category:'navigation'},'previousGranularity':{announce:true,msgId:'previous_granularity',category:'navigation'},'nextGranularity':{announce:true,msgId:'next_granularity',category:'navigation'},'previousCharacter':{backward:true,announce:true,msgId:'previous_character',skipInput:true,category:'navigation'},'nextCharacter':{forward:true,announce:true,msgId:'next_character',skipInput:true,category:'navigation'},'previousWord':{backward:true,announce:true,msgId:'previous_word',skipInput:true,category:'navigation'},'nextWord':{forward:true,announce:true,msgId:'next_word',skipInput:true,category:'navigation'},'previousLine':{backward:true,announce:true,msgId:'previous_line',category:'navigation'},'nextLine':{forward:true,announce:true,msgId:'next_line',category:'navigation'},'previousSentence':{backward:true,announce:true,msgId:'previous_sentence',skipInput:true,category:'navigation'},'nextSentence':{forward:true,announce:true,msgId:'next_sentence',skipInput:true,category:'navigation'},'previousObject':{backward:true,announce:true,msgId:'previous_object',skipInput:true,category:'navigation'},'nextObject':{forward:true,announce:true,msgId:'next_object',skipInput:true,category:'navigation'},'previousGroup':{backward:true,announce:true,msgId:'previous_group',skipInput:true,category:'navigation'},'nextGroup':{forward:true,announce:true,msgId:'next_group',skipInput:true,category:'navigation'},'jumpToTop':{forward:true,announce:true,msgId:'jump_to_top',category:'navigation'},'jumpToBottom':{backward:true,announce:true,msgId:'jump_to_bottom',category:'navigation'},'moveToStartOfLine':{forward:true,announce:true},'moveToEndOfLine':{backward:true,announce:true},'readFromHere':{forward:true,announce:false,msgId:'read_from_here',category:'navigation'},'performDefaultAction':{disallowContinuation:true,msgId:'perform_default_action',doDefault:true,skipInput:true,category:'navigation'},'forceClickOnCurrentItem':{announce:true,disallowContinuation:true,allowEvents:true,msgId:'force_click_on_current_item',category:'navigation'},'forceDoubleClickOnCurrentItem':{announce:true,allowEvents:true,disallowContinuation:true},'readLinkURL':{announce:false,msgId:'read_link_url',category:'information'},'readCurrentTitle':{announce:false,msgId:'read_current_title',category:'information'},'readCurrentURL':{announce:false,msgId:'read_current_url',category:'information'},'fullyDescribe':{announce:false,msgId:'fully_describe',category:'information'},'speakTimeAndDate':{announce:false,msgId:'speak_time_and_date',category:'information'},'toggleSelection':{announce:true,msgId:'toggle_selection',category:'information'},'toggleSearchWidget':{announce:false,disallowContinuation:true,msgId:'toggle_search_widget',category:'information'},'toggleKeyboardHelp':{announce:false,disallowContinuation:true,msgId:'show_power_key',category:'help_commands'},'help':{announce:false,msgId:'help','disallowOOBE':true,disallowContinuation:true,category:'help_commands'},'contextMenu':{announce:false,msgId:'show_context_menu',disallowContinuation:true},'showOptionsPage':{announce:false,disallowContinuation:true,msgId:'show_options_page','disallowOOBE':true,category:'help_commands'},'showKbExplorerPage':{announce:false,disallowContinuation:true,msgId:'show_kb_explorer_page','disallowOOBE':true,category:'help_commands'},'toggleBrailleCaptions':{announce:false,msgId:'braille_captions',category:'help_commands'},'showFormsList':{announce:false,disallowContinuation:true,nodeList:'formField',msgId:'show_forms_list',category:'overview'},'showHeadingsList':{announce:false,nodeList:'heading',disallowContinuation:true,msgId:'show_headings_list',category:'overview'},'showLandmarksList':{announce:false,nodeList:'landmark',disallowContinuation:true,msgId:'show_landmarks_list',category:'overview'},'showLinksList':{announce:false,nodeList:'link',disallowContinuation:true,msgId:'show_links_list',category:'overview'},'showTablesList':{announce:false,nodeList:'table',disallowContinuation:true,msgId:'show_tables_list',category:'overview'},'nextArticle':{forward:true,findNext:'article'},'nextButton':{forward:true,findNext:'button',msgId:'next_button',category:'jump_commands'},'nextCheckbox':{forward:true,findNext:'checkbox',msgId:'next_checkbox',category:'jump_commands'},'nextComboBox':{forward:true,findNext:'combobox',msgId:'next_combo_box',category:'jump_commands'},'nextControl':{forward:true,findNext:'control'},'nextEditText':{forward:true,findNext:'editText',msgId:'next_edit_text',category:'jump_commands'},'nextFormField':{forward:true,findNext:'formField',msgId:'next_form_field',category:'jump_commands'},'nextGraphic':{forward:true,findNext:'graphic',msgId:'next_graphic',category:'jump_commands'},'nextHeading':{forward:true,findNext:'heading',msgId:'next_heading',category:'jump_commands'},'nextHeading1':{forward:true,findNext:'heading1',msgId:'next_heading1',category:'jump_commands'},'nextHeading2':{forward:true,findNext:'heading2',msgId:'next_heading2',category:'jump_commands'},'nextHeading3':{forward:true,findNext:'heading3',msgId:'next_heading3',category:'jump_commands'},'nextHeading4':{forward:true,findNext:'heading4',msgId:'next_heading4',category:'jump_commands'},'nextHeading5':{forward:true,findNext:'heading5',msgId:'next_heading5',category:'jump_commands'},'nextHeading6':{forward:true,findNext:'heading6',msgId:'next_heading6',category:'jump_commands'},'nextLandmark':{forward:true,findNext:'landmark',msgId:'next_landmark',category:'jump_commands'},'nextLink':{forward:true,findNext:'link',msgId:'next_link',category:'jump_commands'},'nextList':{forward:true,findNext:'list',msgId:'next_list',category:'jump_commands'},'nextListItem':{forward:true,findNext:'listItem',msgId:'next_list_item',category:'jump_commands'},'nextMath':{forward:true,findNext:'math',msgId:'next_math',category:'jump_commands'},'nextMedia':{forward:true,findNext:'media',msgId:'next_media',category:'jump_commands'},'nextRadio':{forward:true,findNext:'radio',msgId:'next_radio',category:'jump_commands'},'nextSection':{forward:true,findNext:'section'},'nextSlider':{forward:true,findNext:'slider'},'nextTable':{forward:true,findNext:'table',msgId:'next_table',category:'jump_commands'},'nextVisitedLink':{forward:true,findNext:'visitedLink',msgId:'next_visited_link',category:'jump_commands'},'previousArticle':{backward:true,findNext:'article'},'previousButton':{backward:true,findNext:'button',msgId:'previous_button',category:'jump_commands'},'previousCheckbox':{backward:true,findNext:'checkbox',msgId:'previous_checkbox',category:'jump_commands'},'previousComboBox':{backward:true,findNext:'combobox',msgId:'previous_combo_box',category:'jump_commands'},'previousControl':{backward:true,findNext:'control'},'previousEditText':{backward:true,findNext:'editText',msgId:'previous_edit_text',category:'jump_commands'},'previousFormField':{backward:true,findNext:'formField',msgId:'previous_form_field',category:'jump_commands'},'previousGraphic':{backward:true,findNext:'graphic',msgId:'previous_graphic',category:'jump_commands'},'previousHeading':{backward:true,findNext:'heading',msgId:'previous_heading',category:'jump_commands'},'previousHeading1':{backward:true,findNext:'heading1',msgId:'previous_heading1',category:'jump_commands'},'previousHeading2':{backward:true,findNext:'heading2',msgId:'previous_heading2',category:'jump_commands'},'previousHeading3':{backward:true,findNext:'heading3',msgId:'previous_heading3',category:'jump_commands'},'previousHeading4':{backward:true,findNext:'heading4',msgId:'previous_heading4',category:'jump_commands'},'previousHeading5':{backward:true,findNext:'heading5',msgId:'previous_heading5',category:'jump_commands'},'previousHeading6':{backward:true,findNext:'heading6',msgId:'previous_heading6',category:'jump_commands'},'previousLandmark':{backward:true,findNext:'landmark',msgId:'previous_landmark',category:'jump_commands'},'previousLink':{backward:true,findNext:'link',msgId:'previous_link',category:'jump_commands'},'previousList':{backward:true,findNext:'list',msgId:'previous_list',category:'jump_commands'},'previousListItem':{backward:true,findNext:'listItem',msgId:'previous_list_item',category:'jump_commands'},'previousMath':{backward:true,findNext:'math',msgId:'previous_math',category:'jump_commands'},'previousMedia':{backward:true,findNext:'media',msgId:'previous_media',category:'jump_commands'},'previousRadio':{backward:true,findNext:'radio',msgId:'previous_radio',category:'jump_commands'},'previousSection':{backward:true,findNext:'section'},'previousSlider':{backward:true,findNext:'slider'},'previousTable':{backward:true,findNext:'table',msgId:'previous_table',category:'jump_commands'},'previousVisitedLink':{backward:true,findNext:'visitedLink',msgId:'previous_visited_link',category:'jump_commands'},'announceHeaders':{announce:false,msgId:'announce_headers',category:'tables'},'speakTableLocation':{announce:false,msgId:'speak_table_location',category:'tables'},'goToFirstCell':{announce:true,msgId:'skip_to_beginning',category:'tables'},'goToLastCell':{announce:true,msgId:'skip_to_end',category:'tables'},'goToRowFirstCell':{announce:true,msgId:'skip_to_row_beginning',category:'tables'},'goToRowLastCell':{announce:true,msgId:'skip_to_row_end',category:'tables'},'goToColFirstCell':{announce:true,msgId:'skip_to_col_beginning',category:'tables'},'goToColLastCell':{announce:true,msgId:'skip_to_col_end',category:'tables'},'previousRow':{backward:true,announce:true,skipInput:true},'previousCol':{backward:true,announce:true,skipInput:true},'nextRow':{forward:true,announce:true,skipInput:true},'nextCol':{forward:true,announce:true,skipInput:true},'enterShifter':{announce:true,msgId:'enter_content',category:'navigation'},'exitShifter':{announce:true,msgId:'exit_content',category:'navigation'},'exitShifterContent':{announce:true},'openLongDesc':{announce:false,msgId:'open_long_desc',category:'information'},'pauseAllMedia':{announce:false,msgId:'pause_all_media',category:'information'},'toggleSemantics':{announce:false,msgId:'toggle_semantics',category:'information'},'routing':{announce:false,allowEvents:true,msgId:'braille_routing',category:'braille'},'pan_left':{backward:true,announce:true,msgId:'braille_pan_left',category:'braille'},'pan_right':{forward:true,announce:true,msgId:'braille_pan_right',category:'braille'},'line_up':{backward:true,announce:true,msgId:'braille_line_up',category:'braille'},'line_down':{forward:true,announce:true,msgId:'braille_line_down',category:'braille'},'top':{forward:true,announce:true,msgId:'braille_top',category:'braille'},'bottom':{backward:true,announce:true,msgId:'braille_bottom',category:'braille'},'enableConsoleTts':{announce:false,msgId:'enable_tts_log',category:'developer'},'startHistoryRecording':{announce:false},'stopHistoryRecording':{announce:false},'autorunner':{announce:false},'debug':{announce:false},'nop':{announce:false}};cvox.CommandStore.NODE_INFO_MAP={'checkbox':{predicate:'checkboxPredicate',forwardError:'no_next_checkbox',backwardError:'no_previous_checkbox',typeMsg:'role_checkbox'},'radio':{predicate:'radioPredicate',forwardError:'no_next_radio_button',backwardError:'no_previous_radio_button',typeMsg:'role_radio'},'slider':{predicate:'sliderPredicate',forwardError:'no_next_slider',backwardError:'no_previous_slider',typeMsg:'role_slider'},'graphic':{predicate:'graphicPredicate',forwardError:'no_next_graphic',backwardError:'no_previous_graphic',typeMsg:'UNUSED'},'article':{predicate:'articlePredicate',forwardError:'no_next_ARTICLE',backwardError:'no_previous_ARTICLE',typeMsg:'TAG_ARTICLE'},'button':{predicate:'buttonPredicate',forwardError:'no_next_button',backwardError:'no_previous_button',typeMsg:'role_button'},'combobox':{predicate:'comboBoxPredicate',forwardError:'no_next_combo_box',backwardError:'no_previous_combo_box',typeMsg:'role_combobox'},'editText':{predicate:'editTextPredicate',forwardError:'no_next_edit_text',backwardError:'no_previous_edit_text',typeMsg:'input_type_text'},'heading':{predicate:'headingPredicate',forwardError:'no_next_heading',backwardError:'no_previous_heading',typeMsg:'role_heading'},'heading1':{predicate:'heading1Predicate',forwardError:'no_next_heading_1',backwardError:'no_previous_heading_1'},'heading2':{predicate:'heading2Predicate',forwardError:'no_next_heading_2',backwardError:'no_previous_heading_2'},'heading3':{predicate:'heading3Predicate',forwardError:'no_next_heading_3',backwardError:'no_previous_heading_3'},'heading4':{predicate:'heading4Predicate',forwardError:'no_next_heading_4',backwardError:'no_previous_heading_4'},'heading5':{predicate:'heading5Predicate',forwardError:'no_next_heading_5',backwardError:'no_previous_heading_5'},'heading6':{predicate:'heading6Predicate',forwardError:'no_next_heading_6',backwardError:'no_previous_heading_6'},'link':{predicate:'linkPredicate',forwardError:'no_next_link',backwardError:'no_previous_link',typeMsg:'role_link'},'table':{predicate:'tablePredicate',forwardError:'no_next_table',backwardError:'no_previous_table',typeMsg:'table_strategy'},'visitedLink':{predicate:'visitedLinkPredicate',forwardError:'no_next_visited_link',backwardError:'no_previous_visited_link',typeMsg:'role_link'},'list':{predicate:'listPredicate',forwardError:'no_next_list',backwardError:'no_previous_list',typeMsg:'role_list'},'listItem':{predicate:'listItemPredicate',forwardError:'no_next_list_item',backwardError:'no_previous_list_item',typeMsg:'role_listitem'},'formField':{predicate:'formFieldPredicate',forwardError:'no_next_form_field',backwardError:'no_previous_form_field',typeMsg:'role_form'},'landmark':{predicate:'landmarkPredicate',forwardError:'no_next_landmark',backwardError:'no_previous_landmark',typeMsg:'role_landmark'},'math':{predicate:'mathPredicate',forwardError:'no_next_math',backwardError:'no_previous_math',typeMsg:'math_expr'},'media':{predicate:'mediaPredicate',forwardError:'no_next_media_widget',backwardError:'no_previous_media_widget'},'section':{predicate:'sectionPredicate',forwardError:'no_next_section',backwardError:'no_previous_section'},'control':{predicate:'controlPredicate',forwardError:'no_next_control',backwardError:'no_previous_control'}};goog.provide('cvox.KbExplorer');goog.require('cvox.ChromeVoxKbHandler');goog.require('cvox.CommandStore');goog.require('cvox.KeyMap');goog.require('cvox.KeyUtil');cvox.KbExplorer=function(){};cvox.KbExplorer.init=function(){var backgroundWindow=chrome.extension.getBackgroundPage();backgroundWindow.addEventListener('keydown',cvox.KbExplorer.onKeyDown,true);backgroundWindow.addEventListener('keyup',cvox.KbExplorer.onKeyUp,true);backgroundWindow.addEventListener('keypress',cvox.KbExplorer.onKeyPress,true);window.onbeforeunload=function(evt){backgroundWindow.removeEventListener('keydown',cvox.KbExplorer.onKeyDown,true);backgroundWindow.removeEventListener('keyup',cvox.KbExplorer.onKeyUp,true);backgroundWindow.removeEventListener('keypress',cvox.KbExplorer.onKeyPress,true);};if(localStorage['useNext']=='true'){cvox.ChromeVoxKbHandler.handlerKeyMap=cvox.KeyMap.fromNext();cvox.ChromeVox.modKeyStr='Search';}else{cvox.ChromeVoxKbHandler.handlerKeyMap=cvox.KeyMap.fromDefaults();cvox.ChromeVox.modKeyStr='Search+Shift';}
cvox.ChromeVoxKbHandler.commandHandler=cvox.KbExplorer.onCommand;};cvox.KbExplorer.onKeyDown=function(evt){chrome.extension.getBackgroundPage()['speak'](cvox.KeyUtil.getReadableNameForKeyCode(evt.keyCode),false,{});if(evt.keyCode==87&&evt.ctrlKey){return true;}
cvox.ChromeVoxKbHandler.basicKeyDownActionsListener(evt);evt.preventDefault();evt.stopPropagation();return false;};cvox.KbExplorer.onKeyUp=function(evt){evt.preventDefault();evt.stopPropagation();};cvox.KbExplorer.onKeyPress=function(evt){evt.preventDefault();evt.stopPropagation();};cvox.KbExplorer.onCommand=function(command){var msg=cvox.CommandStore.messageForCommand(command);if(msg){var commandText=Msgs.getMsg(msg);chrome.extension.getBackgroundPage()['speak'](commandText);return true;}};goog.require('cvox.KbExplorer');document.addEventListener('DOMContentLoaded',function(){cvox.KbExplorer.init();},false);
