text: define("jira/ajs/input/keyboard",["jira/util/navigator","jquery"],function(Navigator,$){var _keyCodeToEnum={},_enumToKeyCode={},_keyCodeToIsAscii={};var Keyboard={};var SpecialKey=Keyboard.SpecialKey={BACKSPACE:specialKey("backspace",8,true),TAB:specialKey("tab",9,true),RETURN:specialKey("return",13,true),SHIFT:specialKey("shift",16),CTRL:specialKey("ctrl",17),ALT:specialKey("alt",18),PAUSE:specialKey("pause",19),CAPS_LOCK:specialKey("capslock",20),ESC:specialKey("esc",27,true),SPACE:specialKey("space",32,true),PAGE_UP:specialKey("pageup",33),PAGE_DOWN:specialKey("pagedown",34),END:specialKey("end",35),HOME:specialKey("home",36),LEFT:specialKey("left",37),UP:specialKey("up",38),RIGHT:specialKey("right",39),DOWN:specialKey("down",40),INSERT:specialKey("insert",45),DELETE:specialKey("del",46),F1:specialKey("f1",112),F2:specialKey("f2",113),F3:specialKey("f3",114),F4:specialKey("f4",115),F5:specialKey("f5",116),F6:specialKey("f6",117),F7:specialKey("f7",118),F8:specialKey("f8",119),F9:specialKey("f9",120),F10:specialKey("f10",121),F11:specialKey("f11",122),F12:specialKey("f12",123),NUMLOCK:specialKey("numlock",144),SCROLL:specialKey("scroll",145),META:specialKey("meta",224)};function specialKey(name,keyCode,isAscii){_keyCodeToEnum[keyCode]=name;_enumToKeyCode[name]=keyCode;if(isAscii){_keyCodeToIsAscii[keyCode]=true}return name}SpecialKey.eventType=function(){return Navigator.isMozilla()?"keypress":"keydown"};SpecialKey.fromKeyCode=function(keyCode){return _keyCodeToEnum[keyCode]};SpecialKey.toKeyCode=function(specialKey){return _enumToKeyCode[specialKey]};SpecialKey.isAscii=function(keyCode){return !!_keyCodeToIsAscii[keyCode]};SpecialKey.isSpecialKey=function(keyName){return !!SpecialKey.toKeyCode(keyName)};function originalEvent(e){return e.originalEvent||e}Keyboard.characterEntered=function(keypressEvent){var e=originalEvent(keypressEvent);if(e.type==="keypress"){var characterCode=characterCodeForKeypress(e);if(characterCode!==null&&(!SpecialKey.isAscii(characterCode)||SpecialKey.fromKeyCode(characterCode)===SpecialKey.SPACE)){return String.fromCharCode(characterCode)}}return undefined};function characterCodeForKeypress(keypressEvent){var e=originalEvent(keypressEvent);if(e.which==null){return e.keyCode}else{if(e.which!=0&&e.charCode!=0){return e.which}else{return null}}}Keyboard.specialKeyEntered=function(e){e=originalEvent(e);if(Navigator.isMozilla()){if(e.type==="keypress"){var characterCode=characterCodeForKeypress(e);if(characterCode===null){return SpecialKey.fromKeyCode(e.keyCode)}else{if(SpecialKey.isAscii(characterCode)){return SpecialKey.fromKeyCode(characterCode)}}}}else{if(e.type!=="keypress"){return SpecialKey.fromKeyCode(e.keyCode)}}return undefined};function keyEntered(e){e=originalEvent(e);var special=Keyboard.specialKeyEntered(e);if(special){return special}else{if(Navigator.isMozilla()){if(e.type==="keypress"){var characterCode=characterCodeForKeypress(e);if(characterCode!==null){return String.fromCharCode(characterCode).toLowerCase()}}}else{if(e.type!=="keypress"){return String.fromCharCode(e.keyCode).toLowerCase()}}}return undefined}Keyboard.shortcutEntered=function(e){e=originalEvent(e);if(e.type===SpecialKey.eventType()){var specialKey=Keyboard.specialKeyEntered(e),modifiers="";if(e.altKey&&specialKey!==SpecialKey.ALT){modifiers+=modifier(SpecialKey.ALT)}if(e.ctrlKey&&specialKey!==SpecialKey.CTRL){modifiers+=modifier(SpecialKey.CTRL)}if(e.metaKey&&!e.ctrlKey&&specialKey!==SpecialKey.META){modifiers+=modifier(SpecialKey.META)}if(e.shiftKey&&specialKey!==SpecialKey.SHIFT){modifiers+=modifier(SpecialKey.SHIFT)}if(specialKey){return modifiers+specialKey}else{if(modifiers.length>0&&modifiers!=="shift+"){var key=keyEntered(e);if(key){return modifiers+key}}}}return undefined};function modifier(modifier){return modifier+"+"}return Keyboard});AJS.namespace("JIRA.Keyboard",null,require("jira/ajs/input/keyboard"));