!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var r=["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"],n=["Date","Subject","Comments","Keywords","Resent-Date"];e.registerHelper("hintWords","mbox",r.concat(n));var a=/^[ \t]/,o=/^From /,d=new RegExp("^("+r.join("|")+"): "),c=new RegExp("^("+n.join("|")+"): "),m=/^[^:]+:/,s=/^[^ ]+@[^ ]+/,u=/^.*?(?=[^ ]+?@[^ ]+)/,f=/^<.*?>/,l=/^.*?(?=<.*>)/;function t(e,r){if(e.sol()){if(r.inSeparator=!1,r.inHeader&&e.match(a))return null;if(r.inHeader=!1,r.header=null,e.match(o))return r.inHeaders=!0,r.inSeparator=!0,"atom";var n,t=!1;return(n=e.match(c))||(t=!0)&&(n=e.match(d))?(r.inHeaders=!0,r.inHeader=!0,r.emailPermitted=t,r.header=n[1],"atom"):r.inHeaders&&(n=e.match(m))?(r.inHeader=!0,r.emailPermitted=!0,r.header=n[1],"atom"):(r.inHeaders=!1,e.skipToEnd(),null)}if(r.inSeparator)return e.match(s)?"link":(e.match(u)||e.skipToEnd(),"atom");if(r.inHeader){var i=function(e){return"Subject"===e?"header":"string"}(r.header);if(r.emailPermitted){if(e.match(f))return i+" link";if(e.match(l))return i}return e.skipToEnd(),i}return e.skipToEnd(),null}e.defineMode("mbox",function(){return{startState:function(){return{inSeparator:!1,inHeader:!1,emailPermitted:!1,header:null,inHeaders:!1}},token:t,blankLine:function(e){e.inHeaders=e.inSeparator=e.inHeader=!1}}}),e.defineMIME("application/mbox","mbox")});