Liferay.Loader.define("fragment-web$codemirror@5.65.2/addon/fold/foldcode",["module","exports","require","../../lib/codemirror"],(function(o,n,e){var r,t=void 0;window;r=function(o){"use strict";function doFold(n,e,r,t){if(r&&r.call){var i=r;r=null}else i=getOption(n,r,"rangeFinder");"number"==typeof e&&(e=o.Pos(e,0));var f=getOption(n,r,"minFoldSize");function getRange(o){var r=i(n,e);if(!r||r.to.line-r.from.line<f)return null;if("fold"===t)return r;for(var d=n.findMarksAt(r.from),l=0;l<d.length;++l)if(d[l].__isFold){if(!o)return null;r.cleared=!0,d[l].clear()}return r}var d=getRange(!0);if(getOption(n,r,"scanUp"))for(;!d&&e.line>n.firstLine();)e=o.Pos(e.line-1,0),d=getRange(!1);if(d&&!d.cleared&&"unfold"!==t){var l=function makeWidget(o,n,e){var r=getOption(o,n,"widget");if("function"==typeof r&&(r=r(e.from,e.to)),"string"==typeof r){var t=document.createTextNode(r);(r=document.createElement("span")).appendChild(t),r.className="CodeMirror-foldmarker"}else r&&(r=r.cloneNode(!0));return r}(n,r,d);o.on(l,"mousedown",(function(n){a.clear(),o.e_preventDefault(n)}));var a=n.markText(d.from,d.to,{replacedWith:l,clearOnEnter:getOption(n,r,"clearOnEnter"),__isFold:!0});a.on("clear",(function(e,r){o.signal(n,"unfold",n,e,r)})),o.signal(n,"fold",n,d.from,d.to)}}o.newFoldFunction=function(o,n){return function(e,r){doFold(e,r,{rangeFinder:o,widget:n})}},o.defineExtension("foldCode",(function(o,n,e){doFold(this,o,n,e)})),o.defineExtension("isFolded",(function(o){for(var n=this.findMarksAt(o),e=0;e<n.length;++e)if(n[e].__isFold)return!0})),o.commands.toggleFold=function(o){o.foldCode(o.getCursor())},o.commands.fold=function(o){o.foldCode(o.getCursor(),null,"fold")},o.commands.unfold=function(o){o.foldCode(o.getCursor(),{scanUp:!1},"unfold")},o.commands.foldAll=function(n){n.operation((function(){for(var e=n.firstLine(),r=n.lastLine();e<=r;e++)n.foldCode(o.Pos(e,0),{scanUp:!1},"fold")}))},o.commands.unfoldAll=function(n){n.operation((function(){for(var e=n.firstLine(),r=n.lastLine();e<=r;e++)n.foldCode(o.Pos(e,0),{scanUp:!1},"unfold")}))},o.registerHelper("fold","combine",(function(){var o=Array.prototype.slice.call(arguments,0);return function(n,e){for(var r=0;r<o.length;++r){var t=o[r](n,e);if(t)return t}}})),o.registerHelper("fold","auto",(function(o,n){for(var e=o.getHelpers(n,"fold"),r=0;r<e.length;r++){var t=e[r](o,n);if(t)return t}}));var n={rangeFinder:o.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function getOption(o,e,r){if(e&&void 0!==e[r])return e[r];var t=o.options.foldOptions;return t&&void 0!==t[r]?t[r]:n[r]}o.defineOption("foldOptions",null),o.defineExtension("foldOption",(function(o,n){return getOption(this,o,n)}))},"object"==typeof n&&"object"==typeof o?r(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],r):r(CodeMirror)}));
//# sourceMappingURL=foldcode.js.map