Liferay.Loader.define("portal-search-web$codemirror@5.62.0/addon/selection/mark-selection",["module","exports","require","../../lib/codemirror"],(function(e,t,o){window,function(e){"use strict";function t(e){e.state.markedSelection&&e.operation((function(){!function(e){if(!e.somethingSelected())return l(e);if(e.listSelections().length>1)return a(e);var t=e.getCursor("start"),o=e.getCursor("end"),r=e.state.markedSelection;if(!r.length)return i(e,t,o);var c=r[0].find(),f=r[r.length-1].find();if(!c||!f||o.line-t.line<=8||n(t,f.to)>=0||n(o,c.from)<=0)return a(e);for(;n(t,c.from)>0;)r.shift().clear(),c=r[0].find();for(n(t,c.from)<0&&(c.to.line-t.line<8?(r.shift().clear(),i(e,t,c.to,0)):i(e,t,c.from,0));n(o,f.to)<0;)r.pop().clear(),f=r[r.length-1].find();n(o,f.to)>0&&(o.line-f.from.line<8?(r.pop().clear(),i(e,f.from,o)):i(e,f.to,o))}(e)}))}function o(e){e.state.markedSelection&&e.state.markedSelection.length&&e.operation((function(){l(e)}))}e.defineOption("styleSelectedText",!1,(function(r,n,i){var c=i&&i!=e.Init;n&&!c?(r.state.markedSelection=[],r.state.markedSelectionStyle="string"==typeof n?n:"CodeMirror-selectedtext",a(r),r.on("cursorActivity",t),r.on("change",o)):!n&&c&&(r.off("cursorActivity",t),r.off("change",o),l(r),r.state.markedSelection=r.state.markedSelectionStyle=null)}));var r=e.Pos,n=e.cmpPos;function i(e,t,o,i){if(0!=n(t,o))for(var l=e.state.markedSelection,a=e.state.markedSelectionStyle,c=t.line;;){var f=c==t.line?t:r(c,0),s=c+8,d=s>=o.line,m=d?o:r(s,0),u=e.markText(f,m,{className:a});if(null==i?l.push(u):l.splice(i++,0,u),d)break;c=s}}function l(e){for(var t=e.state.markedSelection,o=0;o<t.length;++o)t[o].clear();t.length=0}function a(e){l(e);for(var t=e.listSelections(),o=0;o<t.length;o++)i(e,t[o].from(),t[o].to())}}("object"==typeof t&&"object"==typeof e?o("../../lib/codemirror"):CodeMirror)}));
//# sourceMappingURL=mark-selection.js.map