Liferay.Loader.define("portal-search-web$codemirror@5.62.0/addon/wrap/hardwrap",["module","exports","require","../../lib/codemirror"],(function(r,t,e){window,function(r){"use strict";var t=r.Pos;function e(r,t,e){for(var o=e.paragraphStart||r.getHelper(t,"paragraphStart"),n=t.line,a=r.firstLine();n>a;--n){var i=r.getLine(n);if(o&&o.test(i))break;if(!/\S/.test(i)){++n;break}}for(var f=e.paragraphEnd||r.getHelper(t,"paragraphEnd"),l=t.line+1,h=r.lastLine();l<=h;++l){if(i=r.getLine(l),f&&f.test(i)){++l;break}if(!/\S/.test(i))break}return{from:n,to:l}}function o(r,t,e,o,n){for(var a=t;a<r.length&&" "==r.charAt(a);)a++;for(;a>0&&!e.test(r.slice(a-1,a+1));--a);if(!n&&a<=r.match(/^[ \t]*/)[0].length)for(a=t+1;a<r.length-1&&!e.test(r.slice(a-1,a+1));++a);for(var i=!0;;i=!1){var f=a;if(o)for(;" "==r.charAt(f-1);)--f;if(0!=f||!i)return{from:f,to:a};a=t}}function n(e,n,a,i){n=e.clipPos(n),a=e.clipPos(a);var f=i.column||80,l=i.wrapOn||/\s\S|-[^\.\d]/,h=!1!==i.forceBreak,s=!1!==i.killTrailingSpace,c=[],g="",p=n.line,m=e.getRange(n,a,!1);if(!m.length)return null;var u=m[0].match(/^[ \t]*/)[0];u.length>=f&&(f=u.length+1);for(var v=0;v<m.length;++v){var d=m[v],b=g.length,w=0;g&&d&&!l.test(g.charAt(g.length-1)+d.charAt(0))&&(g+=" ",w=1);var x="";if(v&&(x=d.match(/^\s*/)[0],d=d.slice(x.length)),g+=d,v){var L=g.length>f&&u==x&&o(g,f,l,s,h);L&&L.from==b&&L.to==b+w?(g=u+d,++p):c.push({text:[w?" ":""],from:t(p,b),to:t(p+1,x.length)})}for(;g.length>f;){var k=o(g,f,l,s,h);if(!(k.from!=k.to||h&&u!==g.slice(0,k.to)))break;c.push({text:["",u],from:t(p,k.from),to:t(p,k.to)}),g=u+g.slice(k.to),++p}}return c.length&&e.operation((function(){for(var t=0;t<c.length;++t){var o=c[t];(o.text||r.cmpPos(o.from,o.to))&&e.replaceRange(o.text,o.from,o.to)}})),c.length?{from:c[0].from,to:r.changeEnd(c[c.length-1])}:null}r.defineExtension("wrapParagraph",(function(r,o){o=o||{},r||(r=this.getCursor());var a=e(this,r,o);return n(this,t(a.from,0),t(a.to-1),o)})),r.commands.wrapLines=function(r){r.operation((function(){for(var o=r.listSelections(),a=r.lastLine()+1,i=o.length-1;i>=0;i--){var f,l=o[i];if(l.empty()){var h=e(r,l.head,{});f={from:t(h.from,0),to:t(h.to-1)}}else f={from:l.from(),to:l.to()};f.to.line>=a||(a=f.from.line,n(r,f.from,f.to,{}))}}))},r.defineExtension("wrapRange",(function(r,t,e){return n(this,r,t,e||{})})),r.defineExtension("wrapParagraphsInRange",(function(r,o,a){a=a||{};for(var i=this,f=[],l=r.line;l<=o.line;){var h=e(i,t(l,0),a);f.push(h),l=h.to}var s=!1;return f.length&&i.operation((function(){for(var r=f.length-1;r>=0;--r)s=s||n(i,t(f[r].from,0),t(f[r].to-1),a)})),s}))}("object"==typeof t&&"object"==typeof r?e("../../lib/codemirror"):CodeMirror)}));
//# sourceMappingURL=hardwrap.js.map