Liferay.Loader.define("journal-web$codemirror@5.65.2/addon/fold/brace-fold",["module","exports","require","../../lib/codemirror"],(function(e,r,n){var t,i=void 0;window;t=function(e){"use strict";function bracketFolding(r){return function(n,t){var i=t.line,o=n.getLine(i);function findOpening(r){for(var l,a=t.ch,f=0;;){var s=a<=0?-1:o.lastIndexOf(r[0],a-1);if(-1!=s){if(1==f&&s<t.ch)break;if(l=n.getTokenTypeAt(e.Pos(i,s+1)),!/^(comment|string)/.test(l))return{ch:s+1,tokenType:l,pair:r};a=s-1}else{if(1==f)break;f=1,a=o.length}}}function findRange(r){var t,o,l=1,a=n.lastLine(),f=r.ch;e:for(var s=i;s<=a;++s)for(var u=n.getLine(s),d=s==i?f:0;;){var c=u.indexOf(r.pair[0],d),g=u.indexOf(r.pair[1],d);if(c<0&&(c=u.length),g<0&&(g=u.length),(d=Math.min(c,g))==u.length)break;if(n.getTokenTypeAt(e.Pos(s,d+1))==r.tokenType)if(d==c)++l;else if(!--l){t=s,o=d;break e}++d}return null==t||i==t?null:{from:e.Pos(i,f),to:e.Pos(t,o)}}for(var l=[],a=0;a<r.length;a++){var f=findOpening(r[a]);f&&l.push(f)}for(l.sort((function(e,r){return e.ch-r.ch})),a=0;a<l.length;a++){var s=findRange(l[a]);if(s)return s}return null}}e.registerHelper("fold","brace",bracketFolding([["{","}"],["[","]"]])),e.registerHelper("fold","brace-paren",bracketFolding([["{","}"],["[","]"],["(",")"]])),e.registerHelper("fold","import",(function(r,n){function hasImport(n){if(n<r.firstLine()||n>r.lastLine())return null;var t=r.getTokenAt(e.Pos(n,1));if(/\S/.test(t.string)||(t=r.getTokenAt(e.Pos(n,t.end+1))),"keyword"!=t.type||"import"!=t.string)return null;for(var i=n,o=Math.min(r.lastLine(),n+10);i<=o;++i){var l=r.getLine(i).indexOf(";");if(-1!=l)return{startCh:t.end,end:e.Pos(i,l)}}}var t,i=n.line,o=hasImport(i);if(!o||hasImport(i-1)||(t=hasImport(i-2))&&t.end.line==i-1)return null;for(var l=o.end;;){var a=hasImport(l.line+1);if(null==a)break;l=a.end}return{from:r.clipPos(e.Pos(i,o.startCh+1)),to:l}})),e.registerHelper("fold","include",(function(r,n){function hasInclude(n){if(n<r.firstLine()||n>r.lastLine())return null;var t=r.getTokenAt(e.Pos(n,1));return/\S/.test(t.string)||(t=r.getTokenAt(e.Pos(n,t.end+1))),"meta"==t.type&&"#include"==t.string.slice(0,8)?t.start+8:void 0}var t=n.line,i=hasInclude(t);if(null==i||null!=hasInclude(t-1))return null;for(var o=t;null!=hasInclude(o+1);)++o;return{from:e.Pos(t,i+1),to:r.clipPos(e.Pos(o))}}))},"object"==typeof r&&"object"==typeof e?t(n("../../lib/codemirror")):"function"==typeof i&&i.amd?i(["../../lib/codemirror"],t):t(CodeMirror)}));
//# sourceMappingURL=brace-fold.js.map