/*! grafana - v3.1.0 - 2016-07-18
 * Copyright (c) 2016 Torkel Ödegaard; Licensed Apache-2.0 */

define(["angular","jquery"],function(a,b){"use strict";var c=a.module("grafana.services");c.service("dashboardKeybindings",["$rootScope","keyboardManager","$modal","$q",function(a,c,d,e){this.shortcuts=function(f){f.$on("$destroy",function(){c.unbindAll()});var g=null;c.bind("shift+?",function(){if(!g){g=a.$new();var b=d({template:"public/app/partials/help_modal.html",persist:!1,show:!1,scope:g,keyboard:!1});g.$on("$destroy",function(){g=null}),e.when(b).then(function(a){a.modal("show")})}},{inputDisabled:!0}),c.bind("f",function(){f.appEvent("show-dash-search")},{inputDisabled:!0}),c.bind("ctrl+o",function(){var a=f.dashboard.sharedCrosshair;f.dashboard.sharedCrosshair=!a,f.broadcastRefresh()},{inputDisabled:!0}),c.bind("ctrl+h",function(){var a=f.dashboard.hideControls;f.dashboard.hideControls=!a},{inputDisabled:!0}),c.bind("ctrl+s",function(a){f.appEvent("save-dashboard",a)},{inputDisabled:!0}),c.bind("r",function(){f.broadcastRefresh()},{inputDisabled:!0}),c.bind("ctrl+z",function(a){f.appEvent("zoom-out",a)},{inputDisabled:!0}),c.bind("left",function(a){f.appEvent("shift-time-backward",a)},{inputDisabled:!0}),c.bind("right",function(a){f.appEvent("shift-time-forward",a)},{inputDisabled:!0}),c.bind("ctrl+i",function(a){f.appEvent("quick-snapshot",a)},{inputDisabled:!0}),c.bind("esc",function(){var a=b(".popover.in");if(!(a.length>0)){var c=b(".modal").data();c&&c.$scope&&c.$scope.dismiss&&c.$scope.dismiss(),f.appEvent("hide-dash-editor"),f.exitFullscreen()}},{inputDisabled:!0})}}])});