var e=[`From`,`Sender`,`Reply-To`,`To`,`Cc`,`Bcc`,`Message-ID`,`In-Reply-To`,`References`,`Resent-From`,`Resent-Sender`,`Resent-To`,`Resent-Cc`,`Resent-Bcc`,`Resent-Message-ID`,`Return-Path`,`Received`],t=[`Date`,`Subject`,`Comments`,`Keywords`,`Resent-Date`],n=/^[ \t]/,r=/^From /,i=RegExp(`^(`+e.join(`|`)+`): `),a=RegExp(`^(`+t.join(`|`)+`): `),o=/^[^:]+:/,s=/^[^ ]+@[^ ]+/,c=/^.*?(?=[^ ]+?@[^ ]+)/,l=/^<.*?>/,u=/^.*?(?=<.*>)/;function d(e){return e===`Subject`?`header`:`string`}function f(e,t){if(e.sol()){if(t.inSeparator=!1,t.inHeader&&e.match(n))return null;if(t.inHeader=!1,t.header=null,e.match(r))return t.inHeaders=!0,t.inSeparator=!0,`atom`;var f,p=!1;return(f=e.match(a))||(p=!0)&&(f=e.match(i))?(t.inHeaders=!0,t.inHeader=!0,t.emailPermitted=p,t.header=f[1],`atom`):t.inHeaders&&(f=e.match(o))?(t.inHeader=!0,t.emailPermitted=!0,t.header=f[1],`atom`):(t.inHeaders=!1,e.skipToEnd(),null)}if(t.inSeparator)return e.match(s)?`link`:(e.match(c)||e.skipToEnd(),`atom`);if(t.inHeader){var m=d(t.header);if(t.emailPermitted){if(e.match(l))return m+` link`;if(e.match(u))return m}return e.skipToEnd(),m}return e.skipToEnd(),null}const p={name:`mbox`,startState:function(){return{inSeparator:!1,inHeader:!1,emailPermitted:!1,header:null,inHeaders:!1}},token:f,blankLine:function(e){e.inHeaders=e.inSeparator=e.inHeader=!1},languageData:{autocomplete:e.concat(t)}};export{p as mbox};