!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",a),e.removeLineClass(e.state.activeLines[t],"gutter",s)}function n(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function i(e,i){for(var r=[],c=0;c<i.length;c++){var l=i[c],f=e.getOption("styleActiveLine");if("object"==typeof f&&f.nonEmpty?l.anchor.line==l.head.line:l.empty()){var d=e.getLineHandleVisualStart(l.head.line);r[r.length-1]!=d&&r.push(d)}}n(e.state.activeLines,r)||e.operation(function(){t(e);for(var n=0;n<r.length;n++)e.addLineClass(r[n],"wrap",o),e.addLineClass(r[n],"background",a),e.addLineClass(r[n],"gutter",s);e.state.activeLines=r})}function r(e,t){i(e,t.ranges)}var o="CodeMirror-activeline",a="CodeMirror-activeline-background",s="CodeMirror-activeline-gutter";e.defineOption("styleActiveLine",!1,function(n,o,a){var s=a!=e.Init&&a;o!=s&&(s&&(n.off("beforeSelectionChange",r),t(n),delete n.state.activeLines),o&&(n.state.activeLines=[],i(n,n.listSelections()),n.on("beforeSelectionChange",r)))})});