Liferay.Loader.define("fragment-web$codemirror@5.65.2/addon/fold/foldgutter",["module","exports","require","../../lib/codemirror","./foldcode"],(function(o,t,e){var r,n=void 0;window;r=function(o){"use strict";o.defineOption("foldGutter",!1,(function(t,e,r){r&&r!=o.Init&&(t.clearGutter(t.state.foldGutter.options.gutter),t.state.foldGutter=null,t.off("gutterClick",onGutterClick),t.off("changes",onChange),t.off("viewportChange",onViewportChange),t.off("fold",onFold),t.off("unfold",onFold),t.off("swapDoc",onChange)),e&&(t.state.foldGutter=new State(function parseOptions(o){return!0===o&&(o={}),null==o.gutter&&(o.gutter="CodeMirror-foldgutter"),null==o.indicatorOpen&&(o.indicatorOpen="CodeMirror-foldgutter-open"),null==o.indicatorFolded&&(o.indicatorFolded="CodeMirror-foldgutter-folded"),o}(e)),updateInViewport(t),t.on("gutterClick",onGutterClick),t.on("changes",onChange),t.on("viewportChange",onViewportChange),t.on("fold",onFold),t.on("unfold",onFold),t.on("swapDoc",onChange))}));var t=o.Pos;function State(o){this.options=o,this.from=this.to=0}function isFolded(o,e){for(var r=o.findMarks(t(e,0),t(e+1,0)),n=0;n<r.length;++n)if(r[n].__isFold){var i=r[n].find(-1);if(i&&i.line===e)return r[n]}}function marker(o){if("string"==typeof o){var t=document.createElement("div");return t.className=o+" CodeMirror-guttermarker-subtle",t}return o.cloneNode(!0)}function updateFoldInfo(o,e,r){var n=o.state.foldGutter.options,i=e-1,d=o.foldOption(n,"minFoldSize"),a=o.foldOption(n,"rangeFinder"),f="string"==typeof n.indicatorFolded&&classTest(n.indicatorFolded),l="string"==typeof n.indicatorOpen&&classTest(n.indicatorOpen);o.eachLine(e,r,(function(e){++i;var r=null,u=e.gutterMarkers;if(u&&(u=u[n.gutter]),isFolded(o,i)){if(f&&u&&f.test(u.className))return;r=marker(n.indicatorFolded)}else{var c=t(i,0),s=a&&a(o,c);if(s&&s.to.line-s.from.line>=d){if(l&&u&&l.test(u.className))return;r=marker(n.indicatorOpen)}}(r||u)&&o.setGutterMarker(e,n.gutter,r)}))}function classTest(o){return new RegExp("(^|\\s)"+o+"(?:$|\\s)\\s*")}function updateInViewport(o){var t=o.getViewport(),e=o.state.foldGutter;e&&(o.operation((function(){updateFoldInfo(o,t.from,t.to)})),e.from=t.from,e.to=t.to)}function onGutterClick(o,e,r){var n=o.state.foldGutter;if(n){var i=n.options;if(r==i.gutter){var d=isFolded(o,e);d?d.clear():o.foldCode(t(e,0),i)}}}function onChange(o){var t=o.state.foldGutter;if(t){var e=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout((function(){updateInViewport(o)}),e.foldOnChangeTimeSpan||600)}}function onViewportChange(o){var t=o.state.foldGutter;if(t){var e=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout((function(){var e=o.getViewport();t.from==t.to||e.from-t.to>20||t.from-e.to>20?updateInViewport(o):o.operation((function(){e.from<t.from&&(updateFoldInfo(o,e.from,t.from),t.from=e.from),e.to>t.to&&(updateFoldInfo(o,t.to,e.to),t.to=e.to)}))}),e.updateViewportTimeSpan||400)}}function onFold(o,t){var e=o.state.foldGutter;if(e){var r=t.line;r>=e.from&&r<e.to&&updateFoldInfo(o,r,r+1)}}},"object"==typeof t&&"object"==typeof o?r(e("../../lib/codemirror"),e("./foldcode")):"function"==typeof n&&n.amd?n(["../../lib/codemirror","./foldcode"],r):r(CodeMirror)}));
//# sourceMappingURL=foldgutter.js.map