Liferay.Loader.define("journal-web$codemirror@5.65.12/addon/edit/matchbrackets",["module","exports","require","../../lib/codemirror"],(function(t,e,r){var a,n=void 0;window;a=function(t){var e=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),r=t.Pos,a={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function bracketRegex(t){return t&&t.bracketRegex||/[(){}[\]]/}function findMatchingBracket(t,e,n){var c=t.getLineHandle(e.line),i=e.ch-1,o=n&&n.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var h=bracketRegex(n),l=!o&&i>=0&&h.test(c.text.charAt(i))&&a[c.text.charAt(i)]||h.test(c.text.charAt(i+1))&&a[c.text.charAt(++i)];if(!l)return null;var s=">"==l.charAt(1)?1:-1;if(n&&n.strict&&s>0!=(i==e.ch))return null;var f=t.getTokenTypeAt(r(e.line,i+1)),u=scanForBracket(t,r(e.line,i+(s>0?1:0)),s,f,n);return null==u?null:{from:r(e.line,i),to:u&&u.pos,match:u&&u.ch==l.charAt(0),forward:s>0}}function scanForBracket(t,e,n,c,i){for(var o=i&&i.maxScanLineLength||1e4,h=i&&i.maxScanLines||1e3,l=[],s=bracketRegex(i),f=n>0?Math.min(e.line+h,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-h),u=e.line;u!=f;u+=n){var g=t.getLine(u);if(g){var d=n>0?0:g.length-1,m=n>0?g.length:-1;if(!(g.length>o))for(u==e.line&&(d=e.ch-(n<0?1:0));d!=m;d+=n){var k=g.charAt(d);if(s.test(k)&&(void 0===c||(t.getTokenTypeAt(r(u,d+1))||"")==(c||""))){var B=a[k];if(B&&">"==B.charAt(1)==n>0)l.push(k);else{if(!l.length)return{pos:r(u,d),ch:k};l.pop()}}}}}return u-n!=(n>0?t.lastLine():t.firstLine())&&null}function matchBrackets(t,a,n){for(var c=t.state.matchBrackets.maxHighlightLineLength||1e3,i=n&&n.highlightNonMatching,o=[],h=t.listSelections(),l=0;l<h.length;l++){var s=h[l].empty()&&findMatchingBracket(t,h[l].head,n);if(s&&(s.match||!1!==i)&&t.getLine(s.from.line).length<=c){var f=s.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";o.push(t.markText(s.from,r(s.from.line,s.from.ch+1),{className:f})),s.to&&t.getLine(s.to.line).length<=c&&o.push(t.markText(s.to,r(s.to.line,s.to.ch+1),{className:f}))}}if(o.length){e&&t.state.focused&&t.focus();var clear=function(){t.operation((function(){for(var t=0;t<o.length;t++)o[t].clear()}))};if(!a)return clear;setTimeout(clear,800)}}function doMatchBrackets(t){t.operation((function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=matchBrackets(t,!1,t.state.matchBrackets)}))}function clearHighlighted(t){t.state.matchBrackets&&t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null)}t.defineOption("matchBrackets",!1,(function(e,r,a){a&&a!=t.Init&&(e.off("cursorActivity",doMatchBrackets),e.off("focus",doMatchBrackets),e.off("blur",clearHighlighted),clearHighlighted(e)),r&&(e.state.matchBrackets="object"==typeof r?r:{},e.on("cursorActivity",doMatchBrackets),e.on("focus",doMatchBrackets),e.on("blur",clearHighlighted))})),t.defineExtension("matchBrackets",(function(){matchBrackets(this,!0)})),t.defineExtension("findMatchingBracket",(function(t,e,r){return(r||"boolean"==typeof e)&&(r?(r.strict=e,e=r):e=e?{strict:!0}:null),findMatchingBracket(this,t,e)})),t.defineExtension("scanForBracket",(function(t,e,r,a){return scanForBracket(this,t,e,r,a)}))},"object"==typeof e&&"object"==typeof t?a(r("../../lib/codemirror")):"function"==typeof n&&n.amd?n(["../../lib/codemirror"],a):a(CodeMirror)}));
//# sourceMappingURL=matchbrackets.js.map