openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 2.42 kB
JavaScript
import{n as e}from"./rolldown-runtime-DkW27tQK.js";function t(e){n(e,`start`);var t={},r=e.languageData||{},i=!1;for(var c in e)if(c!=r&&e.hasOwnProperty(c))for(var l=t[c]=[],u=e[c],d=0;d<u.length;d++){var f=u[d];l.push(new a(f,e)),(f.indent||f.dedent)&&(i=!0)}return{name:r.name,startState:function(){return{state:`start`,pending:null,indent:i?[]:null}},copyState:function(e){var t={state:e.state,pending:e.pending,indent:e.indent&&e.indent.slice(0)};return e.stack&&(t.stack=e.stack.slice(0)),t},token:o(t),indent:s(t,r),mergeTokens:r.mergeTokens,languageData:r}}function n(e,t){if(!e.hasOwnProperty(t))throw Error(`Undefined state `+t+` in simple mode`)}function r(e,t){if(!e)return/(?:)/;var n=``;return e instanceof RegExp?(e.ignoreCase&&(n=`i`),e.unicode&&(n+=`u`),e=e.source):e=String(e),RegExp((t===!1?``:`^`)+`(?:`+e+`)`,n)}function i(e){if(!e)return null;if(e.apply)return e;if(typeof e==`string`)return e.replace(/\./g,` `);for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g,` `));return t}function a(e,t){(e.next||e.push)&&n(t,e.next||e.push),this.regex=r(e.regex),this.token=i(e.token),this.data=e}function o(e){return function(t,n){if(n.pending){var r=n.pending.shift();return n.pending.length==0&&(n.pending=null),t.pos+=r.text.length,r.token}for(var i=e[n.state],a=0;a<i.length;a++){var o=i[a],s=(!o.data.sol||t.sol())&&t.match(o.regex);if(s){o.data.next?n.state=o.data.next:o.data.push?((n.stack||=[]).push(n.state),n.state=o.data.push):o.data.pop&&n.stack&&n.stack.length&&(n.state=n.stack.pop()),o.data.indent&&n.indent.push(t.indentation()+t.indentUnit),o.data.dedent&&n.indent.pop();var c=o.token;if(c&&c.apply&&(c=c(s)),s.length>2&&o.token&&typeof o.token!=`string`){n.pending=[];for(var l=2;l<s.length;l++)s[l]&&n.pending.push({text:s[l],token:o.token[l-1]});return t.backUp(s[0].length-(s[1]?s[1].length:0)),c[0]}return c&&c.join?c[0]:c}}return t.next(),null}}function s(e,t){return function(n,r){if(n.indent==null||t.dontIndentStates&&t.dontIndentStates.indexOf(n.state)>-1)return null;var i=n.indent.length-1,a=e[n.state];scan:for(;;){for(var o=0;o<a.length;o++){var s=a[o];if(s.data.dedent&&s.data.dedentIfLineStart!==!1){var c=s.regex.exec(r);if(c&&c[0]){i--,(s.next||s.push)&&(a=e[s.next||s.push]),r=r.slice(c[0].length);continue scan}}}break}return i<0?0:n.indent[i]}}function c(){return(c=e((()=>{})))()}export{t as n,c as t};
//# sourceMappingURL=simple-mode-fO7nmy5X.js.map