'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,d,c){a instanceof String&&(a=String(a));for(var e=a.length,g=0;g<e;g++){var h=a[g];if(d.call(c,h,g,a))return{i:g,v:h}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,d,c){a!=Array.prototype&&a!=Object.prototype&&(a[d]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(a,d,c,e){if(d){c=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var g=a[e];g in c||(c[g]={});c=c[g]}a=a[a.length-1];e=c[a];d=d(e);d!=e&&null!=d&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:d})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function d(b){b.state.markedSelection&&b.operation(function(){r(b)})}function c(b){b.state.markedSelection&&b.state.markedSelection.length&&b.operation(function(){g(b)})}function e(b,a,f,c){if(0!=l(a,f))for(var n=b.state.markedSelection,e=b.state.markedSelectionStyle,g=a.line;;){var d=g==a.line?a:q(g,
0);g+=m;var p=g>=f.line,h=p?f:q(g,0);d=b.markText(d,h,{className:e});null==c?n.push(d):n.splice(c++,0,d);if(p)break}}function g(b){b=b.state.markedSelection;for(var a=0;a<b.length;++a)b[a].clear();b.length=0}function h(a){g(a);for(var b=a.listSelections(),f=0;f<b.length;f++)e(a,b[f].from(),b[f].to())}function r(a){if(!a.somethingSelected())return g(a);if(1<a.listSelections().length)return h(a);var b=a.getCursor("start"),f=a.getCursor("end"),c=a.state.markedSelection;if(!c.length)return e(a,b,f);var d=
c[0].find(),k=c[c.length-1].find();if(!d||!k||f.line-b.line<=m||0<=l(b,k.to)||0>=l(f,d.from))return h(a);for(;0<l(b,d.from);)c.shift().clear(),d=c[0].find();0>l(b,d.from)&&(d.to.line-b.line<m?(c.shift().clear(),e(a,b,d.to,0)):e(a,b,d.from,0));for(;0>l(f,k.to);)c.pop().clear(),k=c[c.length-1].find();0<l(f,k.to)&&(f.line-k.from.line<m?(c.pop().clear(),e(a,k.from,f)):e(a,k.to,f))}a.defineOption("styleSelectedText",!1,function(b,e,f){f=f&&f!=a.Init;e&&!f?(b.state.markedSelection=[],b.state.markedSelectionStyle=
"string"==typeof e?e:"CodeMirror-selectedtext",h(b),b.on("cursorActivity",d),b.on("change",c)):!e&&f&&(b.off("cursorActivity",d),b.off("change",c),g(b),b.state.markedSelection=b.state.markedSelectionStyle=null)});var m=8,q=a.Pos,l=a.cmpPos});
