function errorIfNotEmpty(stream){var nonWS=stream.match(/^\s*\S/);return stream.skipToEnd(),nonWS?"error":null}const asciiArmor={name:"asciiarmor",token:function(stream,state){var m;if("top"==state.state)return stream.sol()&&(m=stream.match(/^-----BEGIN (.*)?-----\s*$/))?(state.state="headers",state.type=m[1],"tag"):errorIfNotEmpty(stream);if("headers"==state.state){if(stream.sol()&&stream.match(/^\w+:/))return state.state="header","atom";var result=errorIfNotEmpty(stream);return result&&(state.state="body"),result}return"header"==state.state?(stream.skipToEnd(),state.state="headers","string"):"body"==state.state?stream.sol()&&(m=stream.match(/^-----END (.*)?-----\s*$/))?m[1]!=state.type?"error":(state.state="end","tag"):stream.eatWhile(/[A-Za-z0-9+\/=]/)?null:(stream.next(),"error"):"end"==state.state?errorIfNotEmpty(stream):void 0},blankLine:function(state){"headers"==state.state&&(state.state="body")},startState:function(){return{state:"top",type:null}}};export{asciiArmor};
