Presdo.MessageTime=Class.create({_1:["b","l","d","r"].toHashLookup(),_2:{"p":["0","l","r"],"b":["0","a"],"r":["0","a","p"],"d":["0","g"],"l":["0","n","p"],"a":["0","b","r"],"g":["0","d"],"n":["0","l"]},initialize:function(_3){Object.each(_3,function(_4){if(_3[_4]!==undefined){this[_4]=_3[_4];}},this);},clone:function(){var _5=new Presdo.MessageTime();Object.each(this,function(_6){var _7=this[_6];_5[_6]=_7.clone?_7.clone():_7;},this);return _5;},isExclusive:function(_8){if(!_8){return this._1.get(this.cls);}
if(this.cls===undefined||_8.cls===undefined){return false;}
if(this.cls=="o"||_8.cls=="o"){return(this.cls==_8.cls);}
var _9=this._2[this.cls];return(_9&&_9.indexOf(_8.cls)<0);},isNight:function(){var _a=this.cls;switch(_a){case Presdo.MessageTime.DINNER:case Presdo.MessageTime.MIDNIGHT:case Presdo.MessageTime.NIGHT:return true;default:return false;}},isTimeOnly:function(){return(this.time||this.duration)&&!(this.date||this.endDate);},isSpecific:function(){return this._b()&&this._c();},_b:function(){return this.time&&!this.range&&!this.getFlag("not");},_c:function(){return this.date&&!this.getFlag("ti")&&!this.getFlag("not")&&(!this.endDate||this.endDate.sameDateAs(this.date));},getDuration:function(){return this.duration;},getFlag:function(_d){return(this.flags&Presdo.MessageTime._e[_d])!==0;},setFlag:function(_f,_10){var _11=Presdo.MessageTime._e[_f];this.flags=(this.flags&~_11)|(_10?_11:0);},updateFutureDate:function(){},getMessageTimes:function(){return[this];},getTz:function(){return this.tzId||this.tz;},setTz:function(_12){delete this.tz;delete this.tzId;if(_12){if(isNaN(_12)){this.tz=_12.toUpperCase();}else{this.tzId=_12;}}
return this;},tzs:function(){return this.tz?[this.tz]:[];},toDateString:function(_13){var _14=this.duration&&this.time.clone().advanceTime(this.duration*1000);return Date.mergeDateAndTime(this.date,this.time).niceTime(_14,Object.extend({tzStd:this.tz},_13));}});Object.extend(Presdo.MessageTime,{BREAKFAST:"b",LUNCH:"l",DINNER:"d",BRUNCH:"r",NOON:"n",MIDNIGHT:"i",MORNING:"a",AFTERNOON:"p",NIGHT:"g",DOW:"o",ANYTIME:"0",TI:1,NOT:2,FUTURE_DATE:4,_e:{ti:1,not:2,futureDate:4},baseTime:function(){return new Date(0);}});EJson.define("Presdo.MessageTime");


Presdo.MessageTimeConjunction=Class.create({AND:true,OR:false,initialize:function(_1,_2,_3){this.operator=_1||this.OR;this.t1=_2;this.t2=_3;},clone:function(){return new Presdo.MessageTimeConjunction(this.operator,this.t1.clone(),this.t2.clone());},isTimeOnly:function(){return this.t1.isTimeOnly()&&this.t2.isTimeOnly();},isSpecific:function(){return false;},getDuration:function(){return this.t1.getDuration()||this.t2.getDuration();},getMessageTimes:function(){var _4=[];this.eachMessageTime(function(_5){_4.push(_5);});return _4;},getTz:function(){return this.t1.getTz()||this.t2.getTz();},setTz:function(_6){this.t1.setTz(_6);this.t2.setTz(_6);return this;},tzs:function(){return this.t1.tzs().concat(this.t2.tzs());},normalizeTz:function(){this.setTz(this.t2.getTz()||this.t1.getTz());return this;},eachMessageTime:function(_7){[this.t1,this.t2].each(function(_8){if(_8 instanceof Presdo.MessageTimeConjunction){_8.eachMessageTime(_7);}else{_7.call(null,_8);}});}});Object.extend(Presdo.MessageTimeConjunction,{mergeTimes:function(_9){if(!_9){return null;}
if(_9.length==1){return _9[0];}
_9=_9.clone();var _a=_9.pop(),_b=_9.pop();var _c=new Presdo.MessageTimeConjunction(null,_b,_a);while(_9.length>0){_c=new Presdo.MessageTimeConjunction(null,_9.pop(),_c);}
return _c;}});EJson.define("Presdo.MessageTimeConjunction");


Presdo.EventInfo=Class.create({initialize:function(){this.time=null;this.location=null;this.contacts=null;this.title=null;this.timeDescription=null;}});EJson.define("Presdo.EventInfo");


Presdo.ParseContext=Class.create({initialize:function(_1){this.parser=_1;},offset:function(_2,_3){return _3||0;},parseAction:function(_4,_5,_6){return this.parser.CONTINUE;},finishAnalyze:function(_7){}});


Presdo.DefaultContext=Class.create(Presdo.ParseContext,{_1:["TM!","D+T!","DT!","DUR!","TR!","EV!"].toHashLookup(),_2:"at! cnj! to for the in , of ( ) -".split(" ").toHashLookup(),parseAction:function(_3,_4,_5){return _5<2000?this.parser.CONTINUE:this.parser.ABORT;},finishAnalyze:function(_6){var _7=new Presdo.EventInfo();if(_6.length===0){return _7;}
_7.time=this.collectTimes(_6);_7.location=this._8(_6);_7.contacts=this._9(_6);var _a=this.parser.getParser().getInput();_7.title=this._b(_a,_6,_7.contacts);_7.timeDescription=this.generateTimeDescription(_a,_6);return _7;},collectTimes:function(_c){var _d=[];for(var _e=0;_e<_c.length;_e++){var _f=_c[_e].cls;if(this._1.get(_f)){_d.push(_c[_e]);}}
if(_d.length>1){_d=this.parser.getParser().analyzeTokens(_d);}
var _10=[];for(_e=0;_e<_d.length;_e++){var _11=_d[_e].value;if(_11 instanceof Presdo.MessageTime||_11 instanceof Presdo.MessageTimeConjunction){_10.push(_d[_e]);}}
if(_10.length>0){var _12=_10.map(function(_13){return _13.value;});return Presdo.MessageTimeConjunction.mergeTimes(_12);}else{return null;}},_8:function(_14){for(var _15=0;_15<_14.length;_15++){if(_14[_15].cls=="LOC!"){return _14[_15].value.capitalizeWords();}}
return null;},_9:function(_16){var _17=[];for(var _18=0;_18<_16.length;_18++){var _19=_16[_18].cls;if(_19=="CON!"){_17.concatI(_16[_18].value);}}
return _17;},_b:function(_1a,_1b,_1c){var _1d=[];var _1e;for(var _1f=0;_1f<_1b.length;_1f++){var _20=false;var _21=_1b[_1f];_1e=_21.cls;if(_1e=="S-L!"){_1d.concatI(_21);}else{if(this._2.get(_1e)){if(_1d.length>0){_1d.push(_21);}}else{if(Token.getIsClassLiteral(_1e)){_1d.push(_21);}else{if(_1d.length>0){_20=true;}}}}
if(_20){break;}}
while(_1d.length>0){if(this._2.get(_1d.last().cls)){_1d.pop();continue;}
break;}
_1d=_1d.map(function(_22){return _22.value;});var _23=this.parser.getTitleBin();if(_1d.length===0){_1d=_23.length==1?_23.first().split(" "):["Get","together"];}else{if(_23.length>0){_1d.concatI(_23);}}
var _24=true;if(_1d.length>5){var _25=[];for(_1f=0;_1f<5;_1f++){_25.push(_1d[_1f]);}
_1d=_25.join(" ")+"...";_24=false;}else{_1d=_1d.join(" ");}
return _1d.capitalizeFirst();},generateTimeDescription:function(_26,_27){var _28=[];for(var _29=0;_29<_27.length;_29++){var _2a=_27[_29].cls;if(this._1.get(_2a)){_28.push(_26.substring(_27[_29].begin,_27[_29].end));}}
return _28.length>0?_28.join(" ").replace(/^(?:on|for|at|@)\s*/,""):null;}});


Presdo.TimeContext=Class.create(Presdo.DefaultContext,{finishAnalyze:function(_1){var _2=new Presdo.EventInfo();_2.time=this.collectTimes(_1);var _3=this.parser.getParser().getInput();_2.timeDescription=this.generateTimeDescription(_3,_1);return _2;}});


Presdo.TimePreferences=Class.create({initialize:function(){var _1=[new Presdo.TimePreferences.Preference(8,30,undefined,"b",true,false),new Presdo.TimePreferences.Preference(12,0,undefined,"l",true,false),new Presdo.TimePreferences.Preference(19,0,undefined,"d",true,false),new Presdo.TimePreferences.Preference(10,0,undefined,"r",true,false),new Presdo.TimePreferences.Preference(12,0,undefined,"n",false,true),new Presdo.TimePreferences.Preference(0,0,undefined,"i",false,true),new Presdo.TimePreferences.Preference(8,0,14400,"a",false,false),new Presdo.TimePreferences.Preference(13,0,18000,"p",false,false),new Presdo.TimePreferences.Preference(18,0,21600,"g",false,false),new Presdo.TimePreferences.Preference(8,0,57600,"0",false,false)];this._2={};for(var _3=0;_3<_1.length;_3++){var _4=_1[_3];this._2[_4.cls]=_4;}},getDayBeginTime:function(){var _5=this.getPreferences("a");var _6=Presdo.MessageTime.baseTime();_6.setUTCHours(_5.hour);_6.setUTCMinutes(_5.min);return _6;},getDayEndTime:function(){var _7=this.getPreferences("p");var _8=Presdo.MessageTime.baseTime();_8.setUTCHours(_7.hour+_7.duration/3600);_8.setUTCMinutes(_7.min);return _8;},getPreferences:function(_9){return this._2[_9];}});Presdo.TimePreferences.Preference=Class.create({initialize:function(_a,_b,_c,_d,_e,_f){this.hour=_a;this.min=_b;this.duration=_c;this.cls=_d;this.exclusive=_e;this.futureDate=_f;}});Presdo.TimePreferences.Preference.DEFAULT_RANGE_HOURS=2*Date.MILLIS_PER_HOUR/1000;Presdo.AutoCompleteInfo=Class.create({initialize:function(_10,_11,_12,_13){this.value=_10;this.types=_11;this.offset=_12;this.appendString=_13;},offsetEnd:function(){return this.offset+this.value.length;}});Object.extend(Presdo.AutoCompleteInfo,{NAME:"name",LOCATION:"location"});Presdo.ScheduleParser=Class.create({_14:new SymbolMap([["this",0],["next",1]]),_15:new SymbolMap([["until",0],["before",0],["by",0],["after",1]]),_16:new SymbolMap([["between",0],["from",0],[/except(?:\s*for)?/,1]]),_17:new SymbolMap([["breakfast","b"],["lunch","l"],["dinner","d"],["brunch","r"],["noon","n"],["midnight","i"],[/mornings?/,"a"],[/a\.?m\.?/,"a"],[/afternoons?/,"p"],[/nights?/,"g"],[/evenings?/,"g"],[/p\.?m\.?/,"p"],[/any\s*time/,"0"],[/some\s*time/,"0"]]),_18:new SymbolMap([[/weekends?/,0],[/weeks?/,1],[/months?/,2]]),_19:new SymbolMap([[/mon(?:day|\.)?/,1],[/tue(?:sday|s\.?|\.)?/,2],[/wed(?:nesday|s\.?|\.)?/,3],[/thu(?:rs\.?|rsday|\.)?/,4],[/fri(?:day|\.)?/,5],[/sat(?:urday|\.)?/,6],[/sun(?:day|\.)?/,0]]),_1a:new SymbolMap([[/jan(?:uary|\.)?/,0],[/feb(?:ruary|\.)?/,1],[/mar(?:ch|\.)?/,2],[/apr(?:il|\.)?/,3],["may",4],[/jun(?:e|\.)?/,5],[/jul(?:y|\.)?/,6],[/aug(?:ust|\.)?/,7],[/sep(?:tember|t.?|\.)?/,8],[/oct(?:ober|\.)?/,9],[/nov(?:ember|\.)?/,10],[/dec(?:ember|\.)?/,11]]),_1b:new SymbolMap([[/(?:,\s*)?(?:\band\b|&)/,Presdo.MessageTimeConjunction.AND],[/(?:,\s*)?\bor\b/,Presdo.MessageTimeConjunction.OR]]),_1c:{"null":Presdo.DefaultContext},_1d:Presdo.MessageTime.FUTURE_DATE,initialize:function(){this._1e=false;this._1f=null;this._20=false;},getParser:function(){return this.parser;},getTitleBin:function(){return this._21;},_22:function(){if(this._20){return;}
this._23=this._24(false);this._25=this._24(true);this.parser=this._26(this._23).getParser(this);this._27=new Presdo.TimePreferences();this._21=null;this._28=Date.localNow().getUTCFullYear();this._20=true;},_24:function(_29){var _2a=new LexerGenerator({matchWholeWordsByDefault:true});_2a.compile("dow!",this._19.getSymbols());_2a.compile("ct!",[/\d{1,2}(?:(?:(?:[:\.]\d{2})?\s*[ap](?:m\b|\.m\.?)?)|[:\.]\d{2})(?:\s*(?:(?:utc|gmt)\s*[+\-]\d{1,2}(?::?\d{2})?|[a-z]{2,4}t|msd|msk|[hpmcew]t))?/]);_2a.compile("adj!",this._14.getSymbols());_2a.compile("prep!",this._15.getSymbols());_2a.compile("rprep!",this._16.getSymbols());_2a.compile("mon!",this._1a.getSymbols());_2a.compile("ev!",this._17.getSymbols());_2a.compile("ud!",this._18.getSymbols());_2a.compile("dur!",[/(?:\d+|an?)\s*(?:hours?|hrs?|h|minutes?|mins?|m)/]);_2a.compile("odt!",[/\d{1,2}(?:st|nd|rd|th)/]);_2a.compile("cnj!",this._1b.getSymbols(),false);_2a.compile("tel!",[/(?:(?:\+\d{1,3}[\s\-\.]?\(?\d\)?[\s\-\.]?\d{1,5})|(?:\(?\d{2,6}\)?))[\s\-\.]?\d{3,4}[\s\-\.]?\d{4,6}(?:(?: x| ext\.?)\s\d{1,5})?/],false);_2a.compile("add!",[/\d+[\w\s\.\-,]+[A-Za-z]{2}\s*\d{5}(?:-\d{4})?/]);_2a.compile("act!",[/^(?:meet(?:\s*up)?|invite|see|call)/]);_2a.compile("vnty!",[/@[A-Z0-9]+\b/],false);_2a.compile("at!",[/\bat\b|@/],false);_2a.compile("with!",[/w\/|with/]);_2a.compile("n!",[/\d+/]);_2a.compile("em!",[/[<\(\[]?[A-Z0-9._%+\-]+@[A-Z0-9.\-]+\.[A-Z]{2,4}[>\)\]]?/],false);if(_29){_2a.compile("i-em!",[/[A-Z0-9._%+\-]+@(?:(?:[A-Z0-9.\-]+(?:\.)?)+(?:[A-Z]{2,4})?)?/]);}
_2a.compile(null,[/tomo(?:rrow)?|today|ton(?:ight|ite)|the|in|to|on|for|end|of/]);_2a.compile(null,[/[\-\/]/],false);_2a.compile("s!",[/[A-Za-z0-9:\.\-\x27\u00c0-\u00ff_]+/,/"[^\"]*"/],false);_2a.compile(null,[","],false);return _2a.finish();},_26:function(_2b){var _2c=new ParserGenerator(_2b);_2c.compile("ACT!","act!",this._2d);_2c.compile("CON!","i-em!",this._2e);_2c.compile("CON!",["EM!","vnty!"],this._2f);_2c.compile("CON!","CON! !!",this._30);_2c.compile("CON!",["act! CON!","act! S-L!"],this._2f);_2c.compile("CON!","with! !!",this._30);_2c.compile("EM!","em!",ParserActions.return1Action);_2c.compile("EM!","S-L! em!",this._31);_2c.compile("TM!","at! n!",this._32);_2c.compile("LOC!","LOC! , LOC!",this._33);_2c.compile("LOC!","at! tel!",ParserActions.return2Action);_2c.compile("LOC!","tel!",ParserActions.return1Action);_2c.compile("LOC!","add!",ParserActions.return1Action);_2c.compile("LOC!","at! add!",ParserActions.return2Action);_2c.compile("LOC!","at! the S-L! !!",this._34);_2c.compile("LOC!","at! S-L!",this._35);_2c.compile("LOC!",["at! S-L! !!","at! n! !!"],this._34);_2c.compile("LOC!","in S-L!",this._35);_2c.compile("S-L!",["S-L! , s!","S-L! s!","s!"],this._36);_2c.compile("D+T!",["D+T! , DUR!","D+T! DUR!"],this._37);_2c.compile("DT!",["DT! DUR!","DT! , DUR!"],this._37);_2c.compile("TM!",["TM! DUR!","TM! , DUR!","TR! , DUR!","TR! DUR!","EV! , DUR!","EV! DUR!"],this._37);_2c.compile("D+T!",["D+T! D+T!","D+T! , D+T!","D+T! cnj! DT!","DT! cnj! D+T!","D+T! cnj! D+T!"],this._38);_2c.compile("D+T!",["TM! cnj! D+T!","EV! cnj! D+T!","TR! cnj! D+T!","D+T! cnj! TM!","D+T! cnj! n!","D+T! cnj! EV!","D+T! cnj! TR!"],this._39);_2c.compile("TM!",["TM! , TM!","TM! , n!","TM! , TR!","TM! cnj! TM!","TM! cnj! n!","TM! cnj! EV!","TM! cnj! TR!","n! , TM!","n! , EV!","n! , TR!","n! cnj! TM!","n! cnj! n!","n! cnj! EV!","n! cnj! TR!","EV! , EV!","EV! cnj! TM!","EV! cnj! n!","EV! cnj! EV!","EV! cnj! TR!","TR! , TM!","TR! , EV!","TR! , TR!","TR! cnj! TM!","TR! cnj! n!","TR! cnj! EV!","TR! cnj! TR!"],this._3a);_2c.compile("D+T!",["D+T! , TM!","D+T! TM!","TM! D+T!"],this._3b);_2c.compile("D+T!",["EV! D+T!","D+T! EV!"],this._3c);_2c.compile("D+T!",["TR! D+T!","D+T! TR!"],this._3d);_2c.compile("D+T!","on D+T!",ParserActions.return2Action);_2c.compile("D+T!","D+T! , TR!",this._3d);_2c.compile("D+T!",["DT! TR!","TR! DT!","DT! EV!","EV! DT!","DT! , TM!","TM! , DT!","DT! TM!","TM! DT!"],this._3e);_2c.compile("TR!","R!",this._3f);_2c.compile("DT!","prep! DT!",this._40);_2c.compile("DT!","rprep! DT!",this._41);_2c.compile("DT!","DT! cnj! DT!",this._38);_2c.compile("DT!",["DT! , DT!","DT! DT!"],this._38);_2c.compile("DT!",["DT! - DT!","DT! to DT!"],this._42);_2c.compile("DT!",["end of DT!","the end of DT!"],this._43);_2c.compile("DT!","on DT!",ParserActions.return2Action);_2c.compile("DT!","adj! ud!",this._44);_2c.compile("DT!",["adj! n! ud!","adj! S-L! ud!"],this._45);_2c.compile("DT!",["adj! adj! ud!","the ud!","ud!"],this._44);_2c.compile("DT!",["DT! ud!","ud! of DT!","the ud! of DT!"],this._46);_2c.compile("DT!",["in the adj! S-L! ud!","in the adj! n! ud!"],this._47);_2c.compile("DT!",["in S-L! ud!","in n! ud!"],this._48);_2c.compile("DT!",["mon!","in mon!"],this._49);_2c.compile("DT!","in DT!",ParserActions.return2Action);_2c.compile("DT!","DR!",this._4a);_2c.compile("DT!",["dow!","adj! dow!"],this._4b);_2c.compile("D+T!",["dow! n!","adj! dow! n!"],this._4c);_2c.compile("DT!","the odt!",this._4d);_2c.compile("DT!",["tomorrow","tomo"],this._4e);_2c.compile("DT!","today",this._4f);_2c.compile("D+T!",["tonight","tonite"],this._50);_2c.compile("DUR!",["for dur!","dur!"],this._51);_2c.compile("TM!",["TM! , EV!","EV! , TM!","TM! EV!","EV! TM!"],this._52);_2c.compile("TM!",["EV! TR!","EV! , TR!"],this._3d);_2c.compile("TR!","rprep! TR!",this._53);_2c.compile("TR!",["prep! n!","prep! TM!","prep! EV!"],this._54);_2c.compile("TR!",["rprep! n! cnj! n!","rprep! TM! cnj! TM!","rprep! n! cnj! TM!","rprep! TM! cnj! n!"],this._55);_2c.compile("DT!","MDT!",this._56);_2c.compile("MDT!",["MDT! cnj! R!","MDT! DR!","MDT! , DR!","MDT! cnj! DR!","MDT! n!","MDT! , n!","MDT! cnj! n!","MDT! odt!","MDT! , odt!","MDT! cnj! odt!","mon! n!","mon! odt!","mon! R!","mon! DR!"],this._57);_2c.compile("TR!",["TM! - TM!","TM! to TM!","n! - TM!","n! to TM!","TM! - n!","TM! to n!"],this._58);_2c.compile("R!",["n! - n!","n! to n!"],this._59);_2c.compile("MDT!","n! / n!",this._57);_2c.compile("DT!",["n! / n! / n!","n! - mon!","n! - mon! - n!","n! mon!","n! mon! n!"],this._5a);_2c.compile("DR!",["odt! - n!","odt! to n!","n! - odt!","n! to odt!","odt! - odt!","odt! to odt!"],this._5b);_2c.compile("D+T!","adj! ev!",this._5c);_2c.compile("EV!",["ev!","in the ev!","for ev!"],this._5d);_2c.compile("TM!","at! TM!",ParserActions.return2Action);_2c.compile("TM!","ct!",this._5e);return _2c.finish();},_5f:new SymbolMap([["one",1],["two",2],[/a?\s*couple/,2],["three",3],[/a?\s*few/,3],["several",3],["four",4]]),_60:function(_61){var _62=this._63(_61);if(isNaN(_62)){_62=this._5f.getMappedValue(_61);if(_62===undefined){_62=1;}}else{if(_62>12){_62=12;}}
return _62;},_64:function(_65){return _65.getUTCDay()==6?_65.advanceDays(7):_65.advanceToDay(6);},_45:function(_66){var _67=this._60(_66[1].value);var _68=Date.localNow().setToStartOfDay();switch(this._18.getMappedValue(_66.last().value)){case 0:this._64(_68);var _69;for(var _6a=0;_6a<_67;_6a++){var _6b=new Presdo.MessageTime({date:_68.clone(),endDate:_68.clone().advanceDays(1)});_68.advanceDays(7);_69=_69?new Presdo.MessageTimeConjunction(null,_69,_6b):_6b;}
return _69;case 1:return new Presdo.MessageTime({date:_68,endDate:_68.clone().advanceDays(7*_67)});case 2:return new Presdo.MessageTime({date:_68,endDate:_68.clone().advanceDays(30*_67)});}},_47:function(_6c){_6c.splice(0,2);return this._45(_6c);},_48:function(_6d){var _6e=this._60(_6d[1].value);var _6f=Date.localNow().setToStartOfDay();switch(this._18.getMappedValue(_6d[2].value)){case 0:this._64(_6f);_6f.advanceDays((_6e-1)*7);break;case 1:_6f.advanceDays(_6e*7);break;case 2:var _70=_6f.getUTCDate();_6f.setUTCMonth(_6e+_6f.getUTCMonth());if(_70!=_6f.getUTCDate()){var _71=_6f.getUTCMonth();while(_71==_6f.getUTCMonth()){_6f.advanceDays(-1);}}
break;}
return new Presdo.MessageTime({date:_6f,flags:Presdo.MessageTime.TI});},_49:function(_72){var _73=this._74(_72.last().value);var _75=this._76(null,_73);return new Presdo.MessageTime({date:_75,endDate:_75.clone().setToEndOfMonth()});},_77:function(_78,_79,_7a,_7b){var _7c,_7d;if(_7a<_7b){_7d=this._76(_78,_79,_7b);_7c=_7d.clone();_7c.setUTCDate(_7a);}else{if(_7a>_7b){_7c=this._76(null,_79,_7a);_7d=new Date(Date.UTC(_7c.getUTCFullYear(),_7c.getUTCMonth()+1,_7b));}}
return new Presdo.MessageTime({date:_7c,endDate:_7d});},_4a:function(_7e){_7e=_7e[0].value;return this._77(null,null,_7e[0],_7e[1]);},_7f:function(_80){return typeof _80=="string"||_80 instanceof String;},_63:function(_81){if(this._7f(_81)){_81=_81.replace(/^0+/,"");return _81.length===0?0:parseInt(_81,10);}
return _81;},_82:function(_83){var _84=_83.value;return this._63(_83.cls=="odt!"?/(\d{1,2})/.exec(_84)[1]:_84);},_74:function(_85){return this._1a.getMappedValue(_85);},_86:function(_87){var _88=this._63(_87);if(_88<100){_88+=2000;}
if(2037<_88||_88<this._28){_88=this._28;}
return _88;},_89:function(_8a,_8b,_8c){var _8d=this._63(_8a);if(_8d&&_8d<=31){if(_8c&&!(this._7f(_8b)&&_8b.charAt(0)=="0")){var _8e=this._89(_8b,undefined);return _8e[0]?[_8d,_8e[0],_8e[1]]:[_8d,_8e[1]];}else{return[_8d,_8b?this._86(_8b):undefined];}}else{return[undefined,this._86(_8b||_8d)];}},_76:function(_8f,_90,_91){var _92=Date.localNow().setToStartOfDay();var _93=_92.getUTCMonth();var _94=_92.getUTCFullYear();if(!_8f){_8f=_94;if(_90!==null&&_90!==undefined){if(_90<_93||(_90==_93&&_91&&_91<=_92.getUTCDate())){_8f++;}}else{_90=_93;if(_91<=_92.getUTCDate()){_90++;}}}else{if(_8f<_94||(_8f==_94&&(_90<_93||(_90==_93&&_91&&_91<=_92.getUTCDate())))){_8f=_94+1;}}
_91=_91||1;return new Date(Date.UTC(_8f,_90,_91));},_5a:function(_95){var _96,_97,_98,_99;_95=_95.map(function(_9a){return _9a.value;});if(_95[1]=="/"){_96=this._63(_95[0])-1;_99=this._89(_95[2],_95[4]);_97=_99[0];_98=_99[1];}else{_95=_95.without("-");_97=this._63(_95[0]);_96=this._74(_95[1]);if(_95.length>=3){_98=this._86(_95[2]);}}
return new Presdo.MessageTime({date:this._76(_98,_96,_97)});},_56:function(_9b){_9b=_9b[0].value;var _9c=_9b.shift();var _9d=this._63(_9c)-1;if(isNaN(_9d)){_9d=this._74(_9c);}
var _9e,_97,_98,_99,_9f=[];var _a0=_9b.last(),_a1=_9b.length;if(_a1==2&&!(_a0 instanceof Array)){if(!(_9b[0]instanceof Array)){_99=this._89(_9b[0],_9b[1],true);_98=_99.pop();_9b=_99;}}else{if(_a1==1&&!(_a0 instanceof Array)){_99=this._89(_9b[0]);_98=_99.pop();_9b=_99;}}
if(!(_98||_a0 instanceof Array)){_99=this._89(_a0);_98=_99.pop();if(_98){_9b.pop();}}
if(!_98){var _a2=_9b.flatten().max();_98=this._76(null,_9d,_a2).getUTCFullYear();}
for(_9e=0;_9e<_9b.length;_9e++){_97=_9b[_9e];if(_97){_9f.push(_97 instanceof Array?this._77(_98,_9d,this._63(_97[0]),this._63(_97[1])):new Presdo.MessageTime({date:new Date(Date.UTC(_98,_9d,_97))}));}else{_97=this._76(_98,_9d);_9f.push(new Presdo.MessageTime({date:_97,endDate:_97.clone().setToEndOfMonth()}));break;}}
return Presdo.MessageTimeConjunction.mergeTimes(_9f);},_57:function(_a3){var _a4=_a3[0].value;if(!(_a4 instanceof Array)){_a4=[_a4];}
if(_a3.length==5){_a4.push(_a3[2].value);}
var _a5=_a3.last(),_a6=_a5.cls;var _a7=_a5.value;if(_a6=="odt!"){_a7=this._82(_a5);}
_a4.push(_a7);return _a4;},_5b:function(_a8){return[this._82(_a8[0]),this._82(_a8[2])];},_4b:function(_a9){var _aa=_a9.last();var _ab=this._19.getMappedValue(_aa.value);var _ac=Date.localNow().setToStartOfDay();var _ad=_ac.getUTCDay();_ac.advanceToDay(_ab);if(_a9.length>1){if(_a9[0].cls=="adj!"&&this._14.getMappedValue(_a9[0].value)==1&&(_ab===0||(_ad<=_ab&&_ad!==0))){_ac.advanceDays(7);}}
return new Presdo.MessageTime({date:_ac,cls:Presdo.MessageTime.DOW});},_4c:function(_ae){var _af=_ae.clone();var _b0=[_af.pop()];var _b1=this._4b(_af);var _b2=this._32(_b0);return _b2?this._b3(_b1,_b2):_b2;},_4d:function(_b4){var _b5=this._82(_b4.last());return new Presdo.MessageTime({date:this._76(null,null,_b5)});},_4e:function(_b6){var _b7=Date.localNow().setToStartOfDay().advanceDays(1);return new Presdo.MessageTime({date:_b7});},_4f:function(_b8){var _b9=Date.localNow().setToStartOfDay();return new Presdo.MessageTime({date:_b9});},_59:function(_ba){return[_ba[0].value,_ba[2].value];},_50:function(_bb){var _bc=Date.localNow().setToStartOfDay();var _bd=this._27.getPreferences("g");var _be=Presdo.MessageTime.baseTime();_be.setUTCHours(_bd.hour);_be.setUTCMinutes(_bd.min);var _bf=_bd.duration;this._21.push(_bb[0].value);return new Presdo.MessageTime({date:_bc,time:_be,range:_bf,cls:_bd.cls});},_44:function(_c0){var _c1=_c0.length,_c2=_c0.pop().value;var _c3=[];while(true){var _c4=_c0.shift();if(!_c4){break;}
var _c5=this._14.getMappedValue(_c4.value)||0;if(_c5>0&&_c3.last()===0){_c3.pop();}
_c3.push(_c5);}
if(_c3.length===0){_c3=[0];}
switch(this._18.getMappedValue(_c2)){case 0:return this._c6(_c3);case 1:return _c1==1?undefined:this._c7(_c3);case 2:return _c1==1?undefined:this._c8(_c3);}},_c6:function(_c9){var _ca=Date.localNow().setToStartOfDay();if(_ca.getUTCDay()===0){_ca.advanceDays(-1);}else{_ca.advanceToDay(6);}
var _cb=_ca.clone().advanceDays(1);while(_c9.shift()==1){_ca.advanceDays(7);_cb.advanceDays(7);}
return new Presdo.MessageTime({date:_ca,endDate:_cb});},_c7:function(_cc){var _cd=Date.localNow().setToStartOfDay(),_ce=4;while(_cc.length>0){switch(_cc.shift()){case 0:var _cf=_cd.getUTCDay();switch(_cf){case 0:_cd.advanceDays(-1);_ce=1;break;case 6:_ce=1;break;default:_cd.advanceDays(1-_cf);break;}
break;case 1:_ce=4;if(_cd.getUTCDay()==1){_cd.advanceDays(7);}else{_cd.advanceToDay(1);}
break;}}
return new Presdo.MessageTime({date:_cd,endDate:_cd.clone().advanceDays(_ce)});},_c8:function(_d0){var _d1=Date.localNow().setToStartOfDay();_d1.setUTCDate(1);while(_d0.shift()==1){_d1.setUTCMonth(_d1.getUTCMonth()+1);}
return new Presdo.MessageTime({date:_d1,endDate:_d1.clone().setToEndOfMonth()});},_46:function(_d2){var _d3,_97;switch(_d2.length){case 2:_d3=_d2.last();_97=_d2[0];break;case 3:_d3=_d2[0];_97=_d2.last();break;case 4:_d3=_d2[1];_97=_d2.last();break;}
_d3=_d3.value;_97=_97.value;switch(this._18.getMappedValue(_d3)){case 0:if(!_97.endDate){_97.endDate=_97.date.clone().advanceToDay(0);}
return _97;case 1:if(!_97.endDate){_97.endDate=_97.date.clone().advanceToDay(5);}
return _97;case 2:return _97;}},_d4:function(_d5,_d6){return 0<=_d5&&_d5<=(_d6?24:12);},_d7:function(_d8,_d9){if(this._7f(_d8)){_d8=this._63(_d8);}
return this._d4(_d8,_d9)?(_d8<7?_d8+12:_d8):undefined;},_5e:function(_da){var _db=/(\d{1,2})(?:[:\.](\d{2}))?(?:\s*([ap])(?:m\b|\.m\.))?(?:\s*((?:utc|gmt)\s*[+\-]\d{1,2}(?::?\d{2})?|[a-z]{2,4}t|msd|msk|[hpmcew]t))?/i.exec(_da[0].value);var _dc=this._63(_db[1]);var _dd=_db[2]===undefined||_db[2].length===0?0:this._63(_db[2]);var _de=_db[3]&&_db[3].toLowerCase();if(_de=="p"&&_dc<=11){_dc+=12;}else{if(_de=="a"){if(_dc==12){_dc=0;}}else{if(_de===undefined||_de.length===0){_dc=this._d7(_dc,true);}}}
if(_dc!==undefined){var _df=Presdo.MessageTime.baseTime();_df.setUTCHours(_dc);_df.setUTCMinutes(_dd);var _e0=new Presdo.MessageTime({time:_df});if(_db[4]){_e0.setTz(_db[4]);}
_e0.setFlag("futureDate",true);return _e0;}else{return _dc;}},_5c:function(_e1){var _e2=this._5d([_e1.last()]);if(this._14.getMappedValue(_e1[0].value)===0&&!_e2.isExclusive()){_e2.date=Date.localNow().setToStartOfDay();return _e2;}else{return undefined;}},_5d:function(_e3){var _e4=_e3.last().value;var _e5=this._17.getMappedValue(_e4);var _e6=this._27.getPreferences(_e5);var _e7=Presdo.MessageTime.baseTime();_e7.setUTCHours(_e6.hour);_e7.setUTCMinutes(_e6.min);var _e8=_e6.futureDate?this._1d:undefined;var _e9=_e6.duration;var _ea=_e6.cls;var _eb=_e6.exclusive;if(_eb){this._21.push(_e4);}
return new Presdo.MessageTime({time:_e7,range:_e9,cls:_ea,flags:_e8});},_32:function(_ec){var _ed=this._d7(this._63(_ec.last().value));if(_ed!==undefined){var _ee=Presdo.MessageTime.baseTime();_ee.setUTCHours(_ed,0,0,0);return new Presdo.MessageTime({time:_ee,flags:this._1d});}else{return _ed;}},_b3:function(_ef,_f0){if(_f0 instanceof Presdo.MessageTime&&_ef instanceof Presdo.MessageTime){var _f1={};_f1.date=_ef.date;_f1.endDate=_ef.endDate;_f1.flags=_ef.flags;_f1.time=_f0.time;_f1.range=_f0.range;_f1.duration=_f0.duration;_f1.cls=_f0.cls||_ef.cls;return new Presdo.MessageTime(_f1).setTz(_f0.getTz());}else{if(_ef instanceof Presdo.MessageTimeConjunction){return Presdo.MessageTimeConjunction.mergeTimes(_ef.getMessageTimes().map(function(_f2){return this._b3(_f2,_f0);}.bind(this)));}else{return Presdo.MessageTimeConjunction.mergeTimes(_f0.getMessageTimes().map(function(_f3){return this._b3(_ef,_f3);}.bind(this)));}}},_3e:function(_f4){var _f5,_f6,_f7=_f4.length-1;if(_f4[0].cls=="DT!"){_f5=0;_f6=_f7;}else{_f5=_f7;_f6=0;}
var _f8=_f4[_f5].value;var _f9=_f4[_f6].value;return!(_f9 instanceof Presdo.MessageTime)||_f9.cls!=Presdo.MessageTime.ANYTIME?this._b3(_f8,_f9):_f8;},_fa:function(_fb){_fb=this._63(_fb);return this._d4(_fb)?_fb:undefined;},_3f:function(_fc){_fc=_fc[0].value;for(var _fd=0;_fd<2;_fd++){var _fe=this._fa(_fc[_fd]);if(_fe===undefined){return _fe;}
_fc[_fd]=_fe;}
var _ff=_fc[0],_100=_fc[1];var _101=this._d7(_ff);var _102=_101>=12?(_100+12)%24:_100;if(_101>_102){_102+=12;}
var _103=Presdo.MessageTime.baseTime();_103.setUTCHours(_101);var _104=_102-_101<=0?undefined:(_102-_101)*3600;return new Presdo.MessageTime({time:_103,duration:_104,flags:this._1d});},_58:function(_105){var _106=_105[0],_107=_105.last();var _108=_106.cls,_109=_107.cls;var _10a=_106.value,_100=_107.value;var _10b,_10c,_10d,_10e;if(_108=="n!"){_10a=this._fa(_10a);if(_10a===undefined){return _10a;}}
if(_109=="n!"){_100=this._fa(_100);if(_100===undefined){return _100;}}
if(_108=="n!"&&_109=="n!"){return this._3f([new Token(null,[_10a,_100])]);}else{if(_108=="n!"&&_109=="TM!"){var _10f=_100.time;_10d=_10f.getUTCHours();_10c=_10a>_10d?(_10a+12)%24:_10a;if(_10c+12<=_10d){_10c+=12;}
_10e=Presdo.MessageTime.baseTime();_10e.setUTCHours(_10c);_10b=_10f.getUTCMinutes()*60+_10f.getUTCSeconds();return new Presdo.MessageTime({time:_10e,flags:this._1d,duration:(_10d-_10c+24)%24*3600+_10b}).setTz(_100.getTz());}else{if(_108=="TM!"&&_109=="n!"){_10e=_10a.time;_10c=_10e.getUTCHours();_10d=_10c>_100?(_100+12)%24:_100;if(_10c>_10d){_10d+=12;}
_10e.setUTCHours(_10c);_10b=_10e.getUTCMinutes()*60+_10e.getUTCSeconds();return new Presdo.MessageTime({time:_10e,flags:this._1d,duration:(_10d-_10c+24)%24*3600-_10b}).setTz(_10a.getTz());}else{if(_108=="TM!"&&_109=="TM!"){var _110=_10a.time,_111=_100.time;var _112=new Presdo.MessageTime({time:_110,flags:this._1d}).setTz(_100.getTz());if(_110<_111){_112.duration=Date.getSecondsDifference(_110,_111);}else{if(_110>_111){_112.duration=Date.getSecondsDifference(_110,_110.clone().advanceDays(1).setToStartOfDay())+_111.getSecondsSinceMidnight();}}
return _112;}else{return undefined;}}}}},_53:function(_113){var _114=_113[0].value;var _115=_113[1].value;switch(this._16.getMappedValue(_114)){case 0:_115.range=_115.duration+3600;delete _115.duration;return _115;case 1:var _116,_117,_118,_119;_116=_115.time;_117=_116.clone();_117.advanceSeconds(_115.duration);_118=this._27.getDayBeginTime();_119=this._27.getDayEndTime();var _11a=[];var _11b=(_116-_118)/1000;if(_11b>0){_11a.push(new Presdo.MessageTime({time:_118,range:_11b,flags:_115.flags}));}
_11b=(_119-_117)/1000;if(_11b>0){_11a.push(new Presdo.MessageTime({time:_117,range:_11b,flags:_115.flags}));}
return Presdo.MessageTimeConjunction.mergeTimes(_11a);}},_54:function(_11c){var _11d=_11c.last().value,_11e,_11f;if(_11c.last().cls=="n!"){var _120=Presdo.MessageTime.baseTime();var _121=this._d7(_11d);if(_121===undefined){return _121;}
_120.setUTCHours(_121);_11d=_120;_11f=this._1d;}else{_11e=_11d.getTz();_11f=_11d.flags;_11d=_11d.time;}
var _122=Presdo.TimePreferences.Preference.DEFAULT_RANGE_HOURS*1000;var _123=_11c[0].value;var _124=null,_125=null;switch(this._15.getMappedValue(_123)){case 0:_124=this._27.getDayBeginTime();_125=_11d;if(_125-_124<_122){_124=_125.clone().advanceTime(-_122);}
return new Presdo.MessageTime({time:_124,range:Date.getSecondsDifference(_125,_124),flags:_11f}).setTz(_11e);case 1:_124=_11d;_125=this._27.getDayEndTime();if(_125-_124<_122){_125=_124.clone().advanceTime(_122);}
return new Presdo.MessageTime({time:_124,range:Date.getSecondsDifference(_125,_124),flags:_11f}).setTz(_11e);}},_55:function(_126){var _127=this._58(_126.slice(1));return this._53([_126[0],new Token(null,_127)]);},_42:function(_128){return this._129(_128[0].value,_128.last().value);},_129:function(_12a,_12b){var _12c=_12a.date;var _12d=_12b.date||_12b.endDate;if(_12c>_12d||_12c.sameDateAs(_12d)){if(_12b.cls==Presdo.MessageTime.DOW){_12d.advanceDays(7);}else{if(_12d.getUTCFullYear()==this._28&&_12c.getUTCFullYear()==_12d.getUTCFullYear()+1){_12a.date.setUTCFullYear(_12a.date.getUTCFullYear()-1);}else{_12d=undefined;}}}
_12a.endDate=_12d;return _12a;},_43:function(_12e){var _12f=_12e.last().value;if(_12f instanceof Presdo.MessageTime){if(_12f.date&&_12f.endDate){var _130=_12f.endDate;var _131=Date.getDaysDifference(_130,_12f.date);var _132=Math.round(_131/3);_12f.date=_130.clone().setToStartOfDay().advanceDays(-_132);if(_12f.date.sameDateAs(_12f.endDate)){delete _12f.endDate;}else{return _12f;}}
_12f.range=Presdo.TimePreferences.Preference.DEFAULT_RANGE_HOURS;_12f.time=this._27.getDayEndTime().advanceSeconds(-_12f.range);}else{}
return _12f;},_38:function(_133){var _134=_133[0].value.getMessageTimes().concatI(_133.last().value.getMessageTimes());if((_133.length==2||_133[1].cls!="cnj!")&&!this._135(_134,-2,-1)){this._135(_134,-1,-2);}
for(var _136=0;_136<_134.length-1;_136++){var _137=_134.at(_136),_107=_134.at(_136+1);if(_137&&_107.cls==Presdo.MessageTime.DOW&&_137.date>_107.date&&(_137.date.getUTCDay()<_107.date.getUTCDay()||_107.date.getUTCDay()===0)){_107.date.advanceDays(7);if(_107.endDate){_107.endDate.advanceDays(7);}}}
if(_134.length==2){var _138=_134.at(-2),_139=_134.at(-1);if(_138&&!_139.date&&_139.endDate){_138.endDate=_139.endDate;_134.splice(_134.length-2,2,this._129(_138,_139));}}
return _134.length==1?_134[0]:Presdo.MessageTimeConjunction.mergeTimes(_134).normalizeTz();},_135:function(_13a,_13b,_13c){var _13d=_13a.at(_13b),_107=_13a.at(_13c);if(_13d.cls==Presdo.MessageTime.DOW&&_107.cls!=Presdo.MessageTime.DOW&&!_13d.getFlag("not")){_13a.splice(_13a.length-2,2,_107.endDate?this._13e(_13d.date,_107):_107);return true;}
return false;},_39:function(_13f){var _140=this._1b.getMappedValue(_13f[1].value);var _141,_10e,_142;if(_13f[0].cls=="D+T!"){_141=_13f[0].value;_10e=_13f.last().cls!="n!"?_13f.last().value:this._32(_13f);if(!_10e){return _10e;}
_142=new Presdo.MessageTimeConjunction(_140,_141,this._b3(_141,_10e));}else{_141=_13f.last().value;_10e=_13f[0].value;_142=new Presdo.MessageTimeConjunction(_140,this._b3(_141,_10e),_141);}
_142.setTz(_142.getTz());return _142;},_13e:function(_143,_144){var _145=_144.date.advanceToDay(_143.getUTCDay());return new Presdo.MessageTime({date:_145,cls:Presdo.MessageTime.DOW});},_40:function(_146){var _147=_146[0].value;var _148=_146.last().value;switch(this._15.getMappedValue(_147)){case 0:if(_148 instanceof Presdo.MessageTime){_148=_148.endDate?_148.endDate:_148.date;return new Presdo.MessageTime({endDate:this._76(_148.getUTCFullYear(),_148.getUTCMonth(),_148.getUTCDate())});}
break;case 1:if(_148 instanceof Presdo.MessageTime){var _149=_148.endDate?_148.endDate.advanceToDay(1):_148.date.advanceDays(1);return new Presdo.MessageTime({date:_149,flags:Presdo.MessageTime.TI});}
break;}},_41:function(_14a){var _14b=_14a.last().value;switch(this._16.getMappedValue(_14a[0].value)){case 0:var _14c=null,_14d=null;if(_14b instanceof Presdo.MessageTimeConjunction){if(_14b.t1 instanceof Presdo.MessageTime&&_14b.t2 instanceof Presdo.MessageTime){_14c=_14b.t1.date;_14d=_14b.t2.date;}}else{if(_14b.date&&_14b.endDate){_14c=_14b.date;_14d=_14b.endDate;}}
return _14c&&_14d?this._129(new Presdo.MessageTime({date:_14c}),new Presdo.MessageTime({date:_14d})):undefined;case 1:if(_14b instanceof Presdo.MessageTimeConjunction){_14b.eachMessageTime(function(_14e){_14e.setFlag("not",true);});}else{_14b.setFlag("not",true);}
return _14b;}},_3b:function(_14f){var _150=_14f.first().cls;var _151=_14f.first().value,_107=_14f.last().value;var _152,_153;if(_150=="D+T!"){_152=_151;_153=_107;}else{_152=_107;_153=_151;}
if(_152 instanceof Presdo.MessageTime&&_153 instanceof Presdo.MessageTime){if(_152.isNight()&&!_152.isExclusive(_153)){var _154=_153.time.getUTCHours();if(_154<12){_153.time.setUTCHours(_154+12);}
return this._b3(_152,_153);}else{if(!_152.isExclusive(_153)){return this._b3(_152,new Presdo.MessageTimeConjunction(null,_152,_153));}}}else{if(_152){return this._b3(_152 instanceof Presdo.MessageTimeConjunction?_152.t1:_152,Presdo.MessageTimeConjunction.mergeTimes(_152.getMessageTimes().concat([_153])));}}},_3c:function(_155){var _156,_157;if(_155[0].cls=="EV!"){_156=_155[0];_157=_155.last();}else{_156=_155.last();_157=_155[0];}
_156=_156.value;_157=_157.value;if(_156 instanceof Presdo.MessageTime&&_157 instanceof Presdo.MessageTime&&!_156.isExclusive(_157)){if(_157.date){_156.date=_157.date;}
if(_157.endDate){_156.endDate=_157.endDate;}
if(_157.duration){_156.duration=_157.duration;}
_156.setTz(_157.getTz());var _158=_157.cls;if(_157.time&&_158!=Presdo.MessageTime.NIGHT&&_158!=Presdo.MessageTime.MORNING&&_158!=Presdo.MessageTime.AFTERNOON){this._159(_157,_156);_156.time=_157.time;delete _156.range;}
return _156;}},_15a:function(_15b,_15c){if(_15b instanceof Presdo.MessageTimeConjunction){this._15a(_15b.t1,_15c);this._15a(_15b.t2,_15c);}else{if(_15b.duration&&!_15b.range){_15b.range=_15b.duration;delete _15b.duration;}
if(!_15b.duration){_15b.duration=_15c.duration;}}},_37:function(_15d){var _15e=_15d[0].value;this._15a(_15e,_15d.last().value);return _15e;},_159:function(_15f,_160){var _161=_15f.time;var _162=_161.getUTCHours();switch(_160.cls){case Presdo.MessageTime.NIGHT:case Presdo.MessageTime.DINNER:case Presdo.MessageTime.AFTERNOON:if(_162<12){_161.setUTCHours(_162+12);}
break;case Presdo.MessageTime.MORNING:if(_162>12){_161.setUTCHours(_162-12);}
break;}
_15f.updateFutureDate();},_3d:function(_163){var _164=_163[0].cls;var _165=_163[0].value,_166=_163.last().value;var _167,_153;if(_164=="TR!"){_167=_165;_153=_166;}else{_167=_166;_153=_165;}
if(_153.cls==Presdo.MessageTime.ANYTIME){_153.time=_167.time;_153.range=_167.range||(_167.duration+3600);_153.flags=_167.flags;_153.cls=_167.cls;return _153;}else{if(_153.cls){this._159(_167,_153);_153.time=_167.time;_153.setTz(_153.getTz()||_167.getTz());if(!_153.date&&_167.getFlag("futureDate")){_153.setFlag("futureDate",true);}
if(_167.duration){_153.duration=_167.duration;}else{delete _153.duration;}
if(_167.range){_153.range=_167.range;}else{delete _153.range;}
return _153;}else{return this._3a(_163);}}},_52:function(_168){var _169=_168[0].cls,_16a=_168.last().cls;var _16b=_168[0].value,_107=_168.last().value;var _16c=null,_153;if(_16a=="TM!"&&(!(_107 instanceof Presdo.MessageTime)||!_16b.isExclusive(_107))){_16c=_16b;_153=_107;}else{if(_169=="TM!"&&(!(_16b instanceof Presdo.MessageTime)||!_107.isExclusive(_16b))){_16c=_107;_153=_16b;}}
if(_16c){if(_153 instanceof Presdo.MessageTimeConjunction){return this._3a(_168);}else{_153.cls=_16c.cls;this._159(_153,_16c);if(_16c.date){_153.date=_16c.date;}
return _153;}}else{var _16d=this.parser.getPreviousToken();if(_16d&&_16d.cls=="DT!"){return this._3a(_168);}}},_3a:function(_16e){var _16f=_16e[0].cls=="n!"?this._32([_16e[0]]):_16e[0].value;if(_16f===undefined){return;}
var _170=_16e.last().cls=="n!"?this._32([_16e.last()]):_16e.last().value;if(_170===undefined){return;}
var _171=_16e.length==3?this._1b.getMappedValue(_16e[1].value):(_170 instanceof Presdo.MessageTimeConjunction?_170.operator:null);return new Presdo.MessageTimeConjunction(_171,_16f,_170).normalizeTz();},_51:function(_172){var _173=/(\d+|an?)\s*(h|m)/.exec(_172.last().value);var _174=_173[1];var _175=_173[2]=="h"?3600:60;return new Presdo.MessageTime({duration:(this._63(_174)||1)*_175});},_2d:function(_176){var _177=_176[0];var _178=_177.value;if(_177.cls=="act!"&&/call/i.test(_178)){this._21.push(_178);}
return _178;},_2f:function(_179){var _17a=_179.last();var _17b=_17a.value;if(this._1e){this._1f=new Presdo.AutoCompleteInfo(_17b,[Presdo.AutoCompleteInfo.NAME],_17a.begin,", ");}
this._2d(_179);if(_17a.cls=="S-L!"){return _17b.split(", ");}
return _17b instanceof Array?_17b:[_17b];},_30:function(_17c){var _17d=_17c[0].cls=="CON!"?_17c[0].value:[];var _17e=0,_17f=[],_180=-1;var _181=function(_182,_183){_17f.push(_182);if(_180<0){_180=_17c[_183].begin;}};var _184=function(){_17d.push(_17f.join(" "));_17f=[];_180=-1;};for(var _185=1;_185<_17c.length;_185++){var _186=_17c[_185];var _187=_186.cls;if(this._188(_17c,_185)&&!/^(?:em!|vnty!|cnj!|mon!|,)$/.test(_187)&&(_187!="dow!"||_17c[0].cls!="with!"||_185>1)){break;}
var _189=_186.value;if(_189==","||_189==";"||_187=="cnj!"){if(_17f.length>0){_184();}}else{if(/^(?:em!|vnty!)$/.test(_187)){_181(_189,_185);_184();}else{_181(_189,_185);}}
_17e++;}
if(_17f.length>0){var _18a=_17f.join(" ");_17d.push(_18a);if(this._1e){this._1f=new Presdo.AutoCompleteInfo(_18a,[Presdo.AutoCompleteInfo.NAME],_180,", ");}}
if(_17e>0){return[_17d,_17e+1];}},_188:function(_18b,_18c){var _18d=_18b[_18c].cls;return(_18d=="at!"&&_18c+1<_18b.length&&(/^(?:n!|ct!|s!)$/).test(_18b[_18c+1].cls))||!/^(?:s!|S-L!|odt!|[;\(\)])$/.test(_18d)||(!Token.getIsClassLiteral(_18d)&&_18d!="S-L!"&&Token.getIsClassNonTerminal(_18d));},_2e:function(_18e){var _18f=_18e.last();this._1f=new Presdo.AutoCompleteInfo(_18f.value,[Presdo.AutoCompleteInfo.NAME],_18f.begin,", ");return[_18f];},_31:function(_190){return _190[0].value+" "+_190[1].value;},_33:function(_191){return _191[0].value+", "+_191.last().value;},_35:function(_192){var _193=_192.last();var _194=_193.value;if(this._1e){this._1f=new Presdo.AutoCompleteInfo(_194,[Presdo.AutoCompleteInfo.LOCATION],_193.begin);}
return _194;},_34:function(_195){var _196=0;var _197=[];for(var _198=1;_198<_195.length;_198++){var _199=_195[_198].cls;if(!/^(?:n!|add!|tel!|dow!|cnj!|the|of|,)$/.test(_199)&&(this._188(_195,_198)||(/^(?:em!|vnty!)$/).test(_199))){break;}
_197.push(_195[_198].value);_196++;}
var _19a="";for(_198=0;_198<_197.length;_198++){if(!/^[,\)]$/.test(_197[_198])&&!/^[\(]$/.test(_19a.charAt(_19a.length-1))){_19a+=" ";}
_19a+=_197[_198];}
_19a=_19a.strip();if(this._1e){this._1f=new Presdo.AutoCompleteInfo(_19a,[Presdo.AutoCompleteInfo.LOCATION],_195[1].begin);}
if(_196>1){return[_19a,_196+1];}},_36:function(_19b){var _19c=_19b[0].value;var _19d=_19b.last().value;switch(_19b.length){case 1:return _19d;case 3:return _19c+", "+_19d;default:return _19c+" "+_19d;}},_19e:function(_19f,_1a0,_1a1,_1a2){if(!this._20){this._22();}
this._1e=_1a0||false;this._21=[];var _1a3=_1a2?_1a2.offset(_19f):0;this.parser.setLexer(this._1e?this._25.getLexer():this._23.getLexer());return this.parser.analyze(_19f,_1a3,_1a1,_1a2&&_1a2.parseAction.bind(_1a2));},parse:function(_1a4,_1a5){_1a4=this._1a6(_1a4);_1a5=_1a5||"null";var _1a7=new this._1c[_1a5](this);var _1a8=this._19e(_1a4,false,null,_1a7);return _1a7.finishAnalyze(_1a8);},_1a6:function(_1a9){return _1a9.replace(/(?:^\s+)|(?:\s+$)|\u200e|\u200f/,"");},parseAutoComplete:function(_1aa,_1ab){this._1f=null;this._19e(_1aa,true,_1ab!==undefined?_1ab:undefined);var _1ac=this._1f;return _1ac&&(!_1ab||_1ab<=_1ac.offsetEnd())?_1ac:null;},parseTimeDescription:function(_1ad){var _1ae=new Presdo.TimeContext(this);var _1af=this._19e(_1ad,false,undefined,_1ae);return _1ae.finishAnalyze(_1af);}});gScheduleParser=new Presdo.ScheduleParser();


Presdo.InformationRetriever=Class.create({initialize:function(_1){this._2=$H();this._3=$H();this._4=_1||"retrieve";this._5();},_5:function(){},_6:function(_7,_8){var _9=_7.keys();for(var _a=0;_a<_9.length;_a++){var _b=_9[_a];if(this._2.get(_b)){this._2.get(_b).concatUnique(_7.get(_b));}else{this._2.set(_b,_7.get(_b));}
if(_8){var _c=this._3.get(_b)||new Presdo.InformationRetriever.CacheNode();this._3.set(_b,_c);_c.completed=true;}}},_d:function(_e,_f){var _10=[];for(var _11=0;_11<_e.length;_11++){var _12=this._2.get(_e[_11]);if(_12){_10.concatUnique(_12);}}
if(_10.length===0){_10=null;}
_f(_10);},_13:function(_14,_15,_16){this._3.set(_14,this._3.get(_14)||new Presdo.InformationRetriever.CacheNode());var _17=this._3.get(_14);for(var _18=0;_18<_15.length;_18++){if(!_16.forceFetch&&_17.completed){_17=null;break;}
_17=_17.findChildNode(_15[_18]);}
if(_17&&!_16.forceFetch&&(_17.choicesRequested>=_16.numChoices||_17.completed)){return null;}
return _17;},lookup:function(_19,_1a,_1b,_1c){var _1d=_1c||{};_1d.numChoices=_1d.numChoices||10;_1d.forceFetch=_1d.forceFetch||false;_1d.numMaxChoices=_1d.numMaxChoices||50;var _1e=$H();for(var _1f=0;_1f<_19.length;_1f++){var _20=this._13(_19[_1f],_1a,_1d);if(_20){if(_1d.numChoices>_20.choicesRequested){_20.choicesRequested=_1d.numChoices;}
_1e.set(_19[_1f],_20);}}
if(_1e.keys().length===0){this._d(_19,_1b);}else{var _21=function(_22,_23){this._24(_22,_23,_1e);this._d(_19,_1b);};var _25="value"+"="+encodeURIComponent(_1a);_25+="&"+"types"+"="+encodeURIComponent(_1e.keys().toEJson());_25+="&"+"numMaxChoices"+"="+_1d.numMaxChoices;var _26={};_26.parameters=_25;_26.onComplete=_21.bind(this);_26.asynchronous=true;var _27=new Ajax.Request(this._4,_26);}},_24:function(_28,_29,_2a){var _2b=_28.responseText.fromEJson();var _2c=_2a.keys();var _2d=false;for(var _2e=0;_2e<_2c.length;_2e++){if(_2b[_2c[_2e]]=="completed"){_2a.get(_2c[_2e]).completed=true;}else{if(_2b[_2c[_2e]]=="type-completed"){_2d=true;}}}
this._6($H(_2b.result),_2d);}});Presdo.InformationRetriever.CacheNode=Class.create({initialize:function(_2f,_30,_31){this._32=_2f;this._33=_30;this.completed=_31||false;this.choicesRequested=0;this._34=this._34||$H();},addChildNode:function(_35,_36){var _37=new Presdo.InformationRetriever.CacheNode(_35,this,_36);this._34.set(_35,_37);return _37;},findChildNode:function(_38){var _39;if(this._34&&this._34.get(_38)){_39=this._34.get(_38);}else{_39=this.addChildNode(_38);}
return _39;}});


Presdo.InputController=Class.create({initialize:function(_1,_2){this._3="";this._4=[-1,0];this._5=undefined;this._6=_2;this._7=_1;},findTokenBounds:function(_8,_9){if(_8==this._3){return this._4;}
this._3=_8;this._5=this._6.parseAutoComplete(_8,_9);if(this._5){this._4=[this._5.offset,this._5.offsetEnd()];}else{this._4=[-1,0];}
return this._4;},updateChoices:function(_a,_b){if(_a==this._3){if(this._5){this._7.lookup(this._5.types,this._5.value,this._c.bind(this,_a,_b));}else{_b(null);}}else{}},_c:function(_d,_e,_f){if(this._3==_d){_e(_f);}},appendString:function(_10){return this._5&&this._5.appendString;}});


Autocompleter.Contextual=Class.create(Autocompleter.Base,{initialize:function(_1,_2,_3,_4){_4=Object.extend({frequency:0.1},_4);this.baseInitialize(_1,_2,_4);this._5=_3;this._6=this._7.bind(this);},_8:function(_9){var _a="|Il!";var _b=_a.substr(0,1);while(_9.indexOf(_b)!=-1){var _c=Math.floor(Math.random()*_a.length);_b+=String.fromCharCode(_a.charCodeAt(_c));}
return _b;},_d:function(){var _e=0;if(Prototype.Browser.IE){var _f=document.selection.createRange().duplicate();if(!_f.text.empty()){return undefined;}
var _10=this.element.value;var _11=this._8(_10);_f.text=_11;_e=this.element.value.lastIndexOf(_11);this.element.value=_10;Presdo.setCursorPos(this.element,_e);}else{if(this.element.selectionStart!=this.element.selectionEnd){return undefined;}
_e=this.element.selectionStart;}
return _e;},getTokenBounds:function(){if(null!==this.tokenBounds){return this.tokenBounds;}
var _12=this.element.value;if(_12.blank()){return[-1,0];}
var _13=this._d();if(!_13){return[-1,0];}
var _14=-1;var _15=this._5.findTokenBounds(_12,_13);if(_15&&_15[0]>_14){_14=_15[0];}
return(this.tokenBounds=[_14,_15[1]]);},getUpdatedChoices:function(){this._5.updateChoices(this.element.value,this._6);},_7:function(_16){this.options.array=_16||[];this.updateChoices(this.options.selector(this));},setOptions:function(_17){this.options=Object.extend({choices:10,partialSearch:true,partialChars:1,ignoreCase:true,fullSearch:false,selector:function(_18){var _19=[];var _1a=[];var _1b=_18.getToken();for(var _1c=0;_1c<_18.options.array.length&&_19.length<_18.options.choices;_1c++){var _1d=_18.options.array[_1c];var _1e=_18.options.ignoreCase?_1d.toLowerCase().indexOf(_1b.toLowerCase()):_1d.indexOf(_1b);while(_1e!=-1){if(_1e===0&&_1d.length!=_1b.length){_19.push("<li><strong>"+_1d.substr(0,_1b.length)+"</strong>"+_1d.substr(_1b.length)+"</li>");break;}else{if(_1b.length>=_18.options.partialChars&&_18.options.partialSearch&&_1e!=-1){if(_18.options.fullSearch||/\s/.test(_1d.substr(_1e-1,1))){_1a.push("<li>"+_1d.substr(0,_1e)+"<strong>"+_1d.substr(_1e,_1b.length)+"</strong>"+_1d.substr(_1e+_1b.length)+"</li>");break;}}}
_1e=_18.options.ignoreCase?_1d.toLowerCase().indexOf(_1b.toLowerCase(),_1e+1):_1d.indexOf(_1b,_1e+1);}}
if(_1a.length){_19=_19.concat(_1a.slice(0,_18.options.choices-_19.length));}
return"<ul>"+_19.join("")+"</ul>";}},_17||{});},updateElement:function($super,_1f){var _20=this.element.value;$super(_1f);var _21=this._5.appendString&&this._5.appendString(_1f);if(_21){var _22=this.element.value,_23=this.getTokenBounds();var _24=_23[1]+_22.length-_20.length;this.element.value=_22.substring(0,_24)+_21+_22.substring(_24).strip();_24+=_21.length;Presdo.setCursorPos(this.element,_24);}}});


AutoExpandTextArea=Class.create({initialize:function(_1,_2){this._3=$(_1);this._4=false;this.options=_2||{};this.options.submitInterval=this.options.submitInterval||300;this.options.autoCompleteDiv=$(this.options.autoCompleteDiv);this.stopKeyUpEvent=false;this._5=false;this._3.style.overflow="hidden";this._6=this._7(this._3);this._3.parentNode.insertBefore(this._6,this._3);this.resizeTextArea();this._8=this._9.bindAsEventListener(this);this._a=this._b.bindAsEventListener(this);this._c=this._d.bindAsEventListener(this);Event.observe(this._3,"keydown",this._8);Event.observe(this._3,"keypress",this._a);Event.observe(this._3,"keyup",this._c);},destroy:function(){Event.stopObserving(this._3,"keydown",this._8);Event.stopObserving(this._3,"keypress",this._a);Event.stopObserving(this._3,"keyup",this._c);this._6.remove();},_e:["fontFamily","fontWeight","fontSize","fontStyle","fontVariant"],_7:function(_f){var _10=document.createElement("div");_10.style.visibility="hidden";_10.style.paddingLeft=0;_10.style.paddingRight=0;_10.style.position="absolute";_10.style.left=0;_10.style.zIndex="-1";this._e.each(function(_11){_10.style[_11]=Element.getStyle(_f,_11);}.bind(this));if(!Prototype.Browser.IE){_10.style.whiteSpace="pre-wrap";}
if(Element.getStyle(_f,"line-height")=="normal"){var _12=this._13(Element.getStyle(_f,"font-size"));if(Prototype.Browser.IE){_12+=3;}else{_12+=2;}
_10.style.lineHeight=_12+"px";_f.style.lineHeight=_12+"px";}else{_10.style.lineHeight=Element.getStyle(_f,"line-height");}
return _10;},_13:function(_14){var _15=/(\d*)/.exec(_14)[1];return _15.blank()?null:parseInt(_15,10);},resizeTextArea:function(_16){this._17(_16);this._18();},reset:function(){this.stopKeyUpEvent=false;this._5=false;},_19:function(_1a){if(_1a===""){return"&nbsp;";}
var _1b=Prototype.Browser.WebKit?/\n\n$/:/\n$/;_1a=_1a.escapeHTML().replace(_1b,"<br />&nbsp;");if(Prototype.Browser.IE){_1a=_1a.escapeMultilineHTML();}
if(Prototype.Browser.IE||Prototype.Browser.WebKit){_1a+=" &nbsp;&nbsp;";}
return _1a;},_1c:function(){return this._13(Element.getStyle(this._6,"lineHeight"));},_17:function(_1d){var _1e=this._3.value;if(_1d){_1e+=_1d;}
this._6.innerHTML=this._19(_1e);},_1f:function(){return this.options.autoCompleteDiv&&this.options.autoCompleteDiv.visible();},_9:function(_20){if(_20.keyCode==Event.KEY_RETURN){if(!this._1f()&&this.options.onEnterSubmitForm){if(!this._5){if(this._3.value.blank()){this._3.blur();}else{if(this.options.onEnterSubmitForm){var _21=$(this.options.onEnterSubmitForm);if(!_21.onsubmit||_21.onsubmit()){this.stopKeyUpEvent=true;this._5=true;_21.submit();setTimeout(this.reset.bind(this),this.options.submitInterval);}}}}
Event.stop(_20);return false;}else{if(!this.options.onEnterSubmitForm){this.resizeTextArea("\n");}}}
return true;},_b:function(_22){if(Prototype.Browser.Gecko&&this._1f()&&(_22.keyCode==Event.KEY_RETURN||_22.keyCode==Event.KEY_TAB)&&this.options.onEnterSubmitForm){Event.stop(_22);return;}},_d:function(_23){if(this.stopKeyUpEvent){Event.stop(_23);return false;}else{if(_23.keyCode!=Event.KEY_RETURN||this._1f()){var _24=Prototype.Browser.Gecko&&Element.getStyle(this._3,"overflow");this.resizeTextArea();if(Prototype.Browser.Gecko&&_24!=Element.getStyle(this._3,"overflow")){this._3.focus();}}}
return true;},_25:function(){var _26=this;this.timeout=setTimeout(function(){_26.resizeTextArea();},300);},_18:function(){var _27=Element.getDimensions(this._3);if(_27.width!==0){if(!this._4){var _28=(_27.width-this._13(Element.getStyle(this._3,"borderLeftWidth"))-this._13(Element.getStyle(this._3,"borderRightWidth"))-this._13(Element.getStyle(this._3,"paddingLeft"))-this._13(Element.getStyle(this._3,"paddingRight")));if(Prototype.Browser.Gecko){_28-=2;}
this._6.style.width=_28+"px";var _29=this._1c();this.minHeight=this.options.minRows?this.options.minRows*_29:0;this.maxHeight=this.options.maxRows?this.options.maxRows*_29:0;this._4=true;}
var _2a=Element.getDimensions(this._6);var _2b=Math.max(this.minHeight,_2a.height);if(Prototype.Browser.IE){_2b+=2;}
if(this.options.maxRows&&_2b>this.maxHeight){this._3.style.height=this.maxHeight+"px";this._3.style.overflow="auto";}else{this._3.style.height=_2b+"px";this._3.style.overflow="hidden";}}else{this._25();}}});