import{g as H}from"./index-Cq7z4i0o.js";import{r as S}from"./codemirror-DpyRu-EA.js";function q(T,A){for(var e=0;e<A.length;e++){const c=A[e];if(typeof c!="string"&&!Array.isArray(c)){for(const t in c)if(t!=="default"&&!(t in T)){const a=Object.getOwnPropertyDescriptor(c,t);a&&Object.defineProperty(T,t,a.get?a:{enumerable:!0,get:()=>c[t]})}}}return Object.freeze(Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}))}var m={exports:{}},j;function I(){return j||(j=1,(function(T,A){(function(e){e(S())})(function(e){function c(t){return function(a,f){var n=f.line,o=a.getLine(n);function v(l){for(var u,g=f.ch,h=0;;){var p=g<=0?-1:o.lastIndexOf(l[0],g-1);if(p==-1){if(h==1)break;h=1,g=o.length;continue}if(h==1&&p<f.ch)break;if(u=a.getTokenTypeAt(e.Pos(n,p+1)),!/^(comment|string)/.test(u))return{ch:p+1,tokenType:u,pair:l};g=p-1}}function k(l){var u=1,g=a.lastLine(),h,p=l.ch,O;e:for(var y=n;y<=g;++y)for(var d=a.getLine(y),b=y==n?p:0;;){var L=d.indexOf(l.pair[0],b),F=d.indexOf(l.pair[1],b);if(L<0&&(L=d.length),F<0&&(F=d.length),b=Math.min(L,F),b==d.length)break;if(a.getTokenTypeAt(e.Pos(y,b+1))==l.tokenType){if(b==L)++u;else if(!--u){h=y,O=b;break e}}++b}return h==null||n==h?null:{from:e.Pos(n,p),to:e.Pos(h,O)}}for(var i=[],r=0;r<t.length;r++){var s=v(t[r]);s&&i.push(s)}i.sort(function(l,u){return l.ch-u.ch});for(var r=0;r<i.length;r++){var P=k(i[r]);if(P)return P}return null}}e.registerHelper("fold","brace",c([["{","}"],["[","]"]])),e.registerHelper("fold","brace-paren",c([["{","}"],["[","]"],["(",")"]])),e.registerHelper("fold","import",function(t,a){function f(r){if(r<t.firstLine()||r>t.lastLine())return null;var s=t.getTokenAt(e.Pos(r,1));if(/\S/.test(s.string)||(s=t.getTokenAt(e.Pos(r,s.end+1))),s.type!="keyword"||s.string!="import")return null;for(var P=r,l=Math.min(t.lastLine(),r+10);P<=l;++P){var u=t.getLine(P),g=u.indexOf(";");if(g!=-1)return{startCh:s.end,end:e.Pos(P,g)}}}var n=a.line,o=f(n),v;if(!o||f(n-1)||(v=f(n-2))&&v.end.line==n-1)return null;for(var k=o.end;;){var i=f(k.line+1);if(i==null)break;k=i.end}return{from:t.clipPos(e.Pos(n,o.startCh+1)),to:k}}),e.registerHelper("fold","include",function(t,a){function f(i){if(i<t.firstLine()||i>t.lastLine())return null;var r=t.getTokenAt(e.Pos(i,1));if(/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(i,r.end+1))),r.type=="meta"&&r.string.slice(0,8)=="#include")return r.start+8}var n=a.line,o=f(n);if(o==null||f(n-1)!=null)return null;for(var v=n;;){var k=f(v+1);if(k==null)break;++v}return{from:e.Pos(n,o+1),to:t.clipPos(e.Pos(v))}})})})()),m.exports}var _=I();const $=H(_),B=q({__proto__:null,default:$},[_]);export{B as b};
//# sourceMappingURL=brace-fold-CFIklE5l.js.map
