// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function u(e,o){var r=Number(o);return/^[-+]/.test(o)?e.getCursor().line+r:r-1}e.defineOption("search",{bottom:!1}),e.commands.jumpToLine=function(t){var e,o,r,s,i,n,l=t.getCursor();o=(n=e=t).phrase("Jump to line:")+' '+n.phrase("(Use line:column or scroll% syntax)")+"",r=t.phrase("Jump to line:"),s=l.line+1+":"+l.ch,i=function(e){var o,r;e&&((o=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(e))?t.setCursor(u(t,o[1]),Number(o[2])):(o=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(e))?(r=Math.round(t.lineCount()*Number(o[1])/100),/^[-+]/.test(o[1])&&(r=l.line+r+1),t.setCursor(r-1,l.ch)):(o=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(e))&&t.setCursor(u(t,o[1]),l.ch))},e.openDialog?e.openDialog(o,i,{value:s,selectValueOnOpen:!0,bottom:e.options.search.bottom}):i(prompt(r,s))},e.keyMap.default["Alt-G"]="jumpToLine"});