import{r as E}from"./codemirror-DpyRu-EA.js";var H={exports:{}},M;function F(){return M||(M=1,(function(S,q){(function(f){f(E())})(function(f){var m=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),o=f.Pos,d={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function B(t){return t&&t.bracketRegex||/[(){}[\]]/}function L(t,r,e){var i=t.getLineHandle(r.line),n=r.ch-1,l=e&&e.afterCursor;l==null&&(l=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var h=B(e),u=!l&&n>=0&&h.test(i.text.charAt(n))&&d[i.text.charAt(n)]||h.test(i.text.charAt(n+1))&&d[i.text.charAt(++n)];if(!u)return null;var a=u.charAt(1)==">"?1:-1;if(e&&e.strict&&a>0!=(n==r.ch))return null;var g=t.getTokenTypeAt(o(r.line,n+1)),s=y(t,o(r.line,n+(a>0?1:0)),a,g,e);return s==null?null:{from:o(r.line,n),to:s&&s.pos,match:s&&s.ch==u.charAt(0),forward:a>0}}function y(t,r,e,i,n){for(var l=n&&n.maxScanLineLength||1e4,h=n&&n.maxScanLines||1e3,u=[],a=B(n),g=e>0?Math.min(r.line+h,t.lastLine()+1):Math.max(t.firstLine()-1,r.line-h),s=r.line;s!=g;s+=e){var c=t.getLine(s);if(c){var k=e>0?0:c.length-1,T=e>0?c.length:-1;if(!(c.length>l))for(s==r.line&&(k=r.ch-(e<0?1:0));k!=T;k+=e){var x=c.charAt(k);if(a.test(x)&&(i===void 0||(t.getTokenTypeAt(o(s,k+1))||"")==(i||""))){var b=d[x];if(b&&b.charAt(1)==">"==e>0)u.push(x);else if(u.length)u.pop();else return{pos:o(s,k),ch:x}}}}}return s-e==(e>0?t.lastLine():t.firstLine())?!1:null}function A(t,r,e){for(var i=t.state.matchBrackets.maxHighlightLineLength||1e3,n=e&&e.highlightNonMatching,l=[],h=t.listSelections(),u=0;u<h.length;u++){var a=h[u].empty()&&L(t,h[u].head,e);if(a&&(a.match||n!==!1)&&t.getLine(a.from.line).length<=i){var g=a.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";l.push(t.markText(a.from,o(a.from.line,a.from.ch+1),{className:g})),a.to&&t.getLine(a.to.line).length<=i&&l.push(t.markText(a.to,o(a.to.line,a.to.ch+1),{className:g}))}}if(l.length){m&&t.state.focused&&t.focus();var s=function(){t.operation(function(){for(var c=0;c<l.length;c++)l[c].clear()})};if(r)setTimeout(s,800);else return s}}function v(t){t.operation(function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=A(t,!1,t.state.matchBrackets)})}function p(t){t.state.matchBrackets&&t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null)}f.defineOption("matchBrackets",!1,function(t,r,e){e&&e!=f.Init&&(t.off("cursorActivity",v),t.off("focus",v),t.off("blur",p),p(t)),r&&(t.state.matchBrackets=typeof r=="object"?r:{},t.on("cursorActivity",v),t.on("focus",v),t.on("blur",p))}),f.defineExtension("matchBrackets",function(){A(this,!0)}),f.defineExtension("findMatchingBracket",function(t,r,e){return(e||typeof r=="boolean")&&(e?(e.strict=r,r=e):r=r?{strict:!0}:null),L(this,t,r)}),f.defineExtension("scanForBracket",function(t,r,e,i){return y(this,t,r,e,i)})})})()),H.exports}export{F as r};
//# sourceMappingURL=matchbrackets-jw92OCMd.js.map
