// 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("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(u){"use strict";var r=u.commands,d=u.Pos;function t(t,n){t.extendSelectionsBy(function(e){return t.display.shift||t.doc.extend||e.empty()?function(e,t,n){if(n<0&&0==t.ch)return e.clipPos(d(t.line-1));var r=e.getLine(t.line);if(0=r.length)return e.clipPos(d(t.line+1,0));for(var o,i="start",l=t.ch,a=l,s=n<0?0:r.length;a!=s;a+=n,0){var c=r.charAt(n<0?a-1:a),f="_"!=c&&u.isWordChar(c)?"w":"o";if("w"==f&&c.toUpperCase()==c&&(f="W"),"start"==i)"o"!=f?(i="in",o=f):l=a+n;else if("in"==i&&o!=f){if("w"==o&&"W"==f&&n<0&&a--,"W"==o&&"w"==f&&0=t&&e.execCommand("goLineUp")),e.scrollTo(null,n.top-e.defaultTextHeight())},r.scrollLineDown=function(e){var t,n=e.getScrollInfo();e.somethingSelected()||(t=e.lineAtHeight(n.top,"local")+1,e.getCursor().line<=t&&e.execCommand("goLineDown")),e.scrollTo(null,n.top+e.defaultTextHeight())},r.splitSelectionByLine=function(e){for(var t=e.listSelections(),n=[],r=0;ro.line&&l==i.line&&0==i.ch||n.push({anchor:l==o.line?o:d(l,0),head:l==i.line?i:d(l)});e.setSelections(n,0)},r.singleSelectionTop=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},r.selectLine=function(e){for(var t=e.listSelections(),n=[],r=0;ro.lastLine()?o.replaceRange("\n"+r,d(o.lastLine()),null,"+swapLine"):o.replaceRange(r+"\n",d(n,0),null,"+swapLine")}o.setSelections(l),o.scrollIntoView()})},r.swapLineDown=function(o){if(o.isReadOnly())return u.Pass;for(var e=o.listSelections(),i=[],t=o.lastLine()+1,n=e.length-1;0<=n;n--){var r=e[n],l=r.to().line+1,a=r.from().line;0!=r.to().ch||r.empty()||l--,l