forked from larrybolt/online-ics-feed-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ical.min.js
2 lines (2 loc) · 78.9 KB
/
ical.min.js
1
2
"object"==typeof module?ICAL=module.exports:"object"!=typeof ICAL&&(this.ICAL={}),ICAL.foldLength=75,ICAL.newLineChar="\r\n",ICAL.helpers={updateTimezones:function(t){var e,n,r,i,a,s;if(!t||"vcalendar"!==t.name)return t;for(e=t.getAllSubcomponents(),n=[],r={},a=0;a<e.length;a++)"vtimezone"===e[a].name?r[s=e[a].getFirstProperty("tzid").getFirstValue()]=e[a]:n=n.concat(e[a].getAllProperties());for(i={},a=0;a<n.length;a++)(s=n[a].getParameter("tzid"))&&(i[s]=!0);for(a in r)r.hasOwnProperty(a)&&!i[a]&&t.removeSubcomponent(r[a]);for(a in i)i.hasOwnProperty(a)&&!r[a]&&ICAL.TimezoneService.has(a)&&t.addSubcomponent(ICAL.TimezoneService.get(a).component);return t},isStrictlyNaN:function(t){return"number"==typeof t&&isNaN(t)},strictParseInt:function(t){var e=parseInt(t,10);if(ICAL.helpers.isStrictlyNaN(e))throw new Error('Could not extract integer from "'+t+'"');return e},formatClassType:function(t,e){if(void 0!==t)return t instanceof e?t:new e(t)},unescapedIndexOf:function(t,e,n){for(;-1!==(n=t.indexOf(e,n));){if(!(n>0&&"\\"===t[n-1]))return n;n+=1}return-1},binsearchInsert:function(t,e,n){if(!t.length)return 0;for(var r,i,a=0,s=t.length-1;a<=s;)if((i=n(e,t[r=a+Math.floor((s-a)/2)]))<0)s=r-1;else{if(!(i>0))break;a=r+1}return i<0?r:i>0?r+1:r},dumpn:function(){ICAL.debug&&("undefined"!=typeof console&&"log"in console?ICAL.helpers.dumpn=function(t){console.log(t)}:ICAL.helpers.dumpn=function(t){dump(t+"\n")},ICAL.helpers.dumpn(arguments[0]))},clone:function(t,e){if(t&&"object"==typeof t){if(t instanceof Date)return new Date(t.getTime());if("clone"in t)return t.clone();if(Array.isArray(t)){for(var n=[],r=0;r<t.length;r++)n.push(e?ICAL.helpers.clone(t[r],!0):t[r]);return n}var i={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(i[a]=e?ICAL.helpers.clone(t[a],!0):t[a]);return i}return t},foldline:function(t){for(var e="",n=t||"";n.length;)e+=ICAL.newLineChar+" "+n.substr(0,ICAL.foldLength),n=n.substr(ICAL.foldLength);return e.substr(ICAL.newLineChar.length+1)},pad2:function(t){"string"!=typeof t&&("number"==typeof t&&(t=parseInt(t)),t=String(t));switch(t.length){case 0:return"00";case 1:return"0"+t;default:return t}},trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)},inherits:function(t,e,n){function r(){}r.prototype=t.prototype,e.prototype=new r,n&&ICAL.helpers.extend(n,e.prototype)},extend:function(t,e){for(var n in t){var r=Object.getOwnPropertyDescriptor(t,n);r&&!Object.getOwnPropertyDescriptor(e,n)&&Object.defineProperty(e,n,r)}return e}},ICAL.design=function(){"use strict";var t=/\\\\|\\,|\\[Nn]/g,e=/\\|,|\n/g;function n(t,e){return{matches:/.*/,fromICAL:function(e,n){return function(t,e,n){if(-1===t.indexOf("\\"))return t;n&&(e=new RegExp(e.source+"|\\\\"+n));return t.replace(e,f)}(e,t,n)},toICAL:function(t,n){var r=e;return n&&(r=new RegExp(r.source+"|"+n)),t.replace(r,function(t){switch(t){case"\\":return"\\\\";case";":return"\\;";case",":return"\\,";case"\n":return"\\n";default:return t}})}}}var r={defaultType:"text"},i={defaultType:"text",multiValue:","},a={defaultType:"text",structuredValue:";"},s={defaultType:"integer"},o={defaultType:"date-time",allowedTypes:["date-time","date"]},u={defaultType:"date-time"},h={defaultType:"uri"},c={defaultType:"utc-offset"},l={defaultType:"recur"},d={defaultType:"date-and-or-time",allowedTypes:["date-time","date","text"]};function f(t){switch(t){case"\\\\":return"\\";case"\\;":return";";case"\\,":return",";case"\\n":case"\\N":return"\n";default:return t}}var m={categories:i,url:h,version:r,uid:r},p={boolean:{values:["TRUE","FALSE"],fromICAL:function(t){switch(t){case"TRUE":return!0;case"FALSE":default:return!1}},toICAL:function(t){return t?"TRUE":"FALSE"}},float:{matches:/^[+-]?\d+\.\d+$/,fromICAL:function(t){var e=parseFloat(t);return ICAL.helpers.isStrictlyNaN(e)?0:e},toICAL:function(t){return String(t)}},integer:{fromICAL:function(t){var e=parseInt(t);return ICAL.helpers.isStrictlyNaN(e)?0:e},toICAL:function(t){return String(t)}},"utc-offset":{toICAL:function(t){return t.length<7?t.substr(0,3)+t.substr(4,2):t.substr(0,3)+t.substr(4,2)+t.substr(7,2)},fromICAL:function(t){return t.length<6?t.substr(0,3)+":"+t.substr(3,2):t.substr(0,3)+":"+t.substr(3,2)+":"+t.substr(5,2)},decorate:function(t){return ICAL.UtcOffset.fromString(t)},undecorate:function(t){return t.toString()}}},y=ICAL.helpers.extend(p,{text:n(/\\\\|\\;|\\,|\\[Nn]/g,/\\|;|,|\n/g),uri:{},binary:{decorate:function(t){return ICAL.Binary.fromString(t)},undecorate:function(t){return t.toString()}},"cal-address":{},date:{decorate:function(t,e){return ICAL.Time.fromDateString(t,e)},undecorate:function(t){return t.toString()},fromICAL:function(t){return t.substr(0,4)+"-"+t.substr(4,2)+"-"+t.substr(6,2)},toICAL:function(t){return t.length>11?t:t.substr(0,4)+t.substr(5,2)+t.substr(8,2)}},"date-time":{fromICAL:function(t){var e=t.substr(0,4)+"-"+t.substr(4,2)+"-"+t.substr(6,2)+"T"+t.substr(9,2)+":"+t.substr(11,2)+":"+t.substr(13,2);return t[15]&&"Z"===t[15]&&(e+="Z"),e},toICAL:function(t){if(t.length<19)return t;var e=t.substr(0,4)+t.substr(5,2)+t.substr(8,5)+t.substr(14,2)+t.substr(17,2);return t[19]&&"Z"===t[19]&&(e+="Z"),e},decorate:function(t,e){return ICAL.Time.fromDateTimeString(t,e)},undecorate:function(t){return t.toString()}},duration:{decorate:function(t){return ICAL.Duration.fromString(t)},undecorate:function(t){return t.toString()}},period:{fromICAL:function(t){var e=t.split("/");return e[0]=y["date-time"].fromICAL(e[0]),ICAL.Duration.isValueString(e[1])||(e[1]=y["date-time"].fromICAL(e[1])),e},toICAL:function(t){return t[0]=y["date-time"].toICAL(t[0]),ICAL.Duration.isValueString(t[1])||(t[1]=y["date-time"].toICAL(t[1])),t.join("/")},decorate:function(t,e){return ICAL.Period.fromJSON(t,e)},undecorate:function(t){return t.toJSON()}},recur:{fromICAL:function(t){return ICAL.Recur._stringToData(t,!0)},toICAL:function(t){var e="";for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];"until"==n?r=r.length>10?y["date-time"].toICAL(r):y.date.toICAL(r):"wkst"==n?"number"==typeof r&&(r=ICAL.Recur.numericDayToIcalDay(r)):Array.isArray(r)&&(r=r.join(",")),e+=n.toUpperCase()+"="+r+";"}return e.substr(0,e.length-1)},decorate:function(t){return ICAL.Recur.fromData(t)},undecorate:function(t){return t.toJSON()}},time:{fromICAL:function(t){if(t.length<6)return t;var e=t.substr(0,2)+":"+t.substr(2,2)+":"+t.substr(4,2);return"Z"===t[6]&&(e+="Z"),e},toICAL:function(t){if(t.length<8)return t;var e=t.substr(0,2)+t.substr(3,2)+t.substr(6,2);return"Z"===t[8]&&(e+="Z"),e}}}),A=ICAL.helpers.extend(m,{action:r,attach:{defaultType:"uri"},attendee:{defaultType:"cal-address"},calscale:r,class:r,comment:r,completed:u,contact:r,created:u,description:r,dtend:o,dtstamp:u,dtstart:o,due:o,duration:{defaultType:"duration"},exdate:{defaultType:"date-time",allowedTypes:["date-time","date"],multiValue:","},exrule:l,freebusy:{defaultType:"period",multiValue:","},geo:{defaultType:"float",structuredValue:";"},"last-modified":u,location:r,method:r,organizer:{defaultType:"cal-address"},"percent-complete":s,priority:s,prodid:r,"related-to":r,repeat:s,rdate:{defaultType:"date-time",allowedTypes:["date-time","date","period"],multiValue:",",detectType:function(t){return-1!==t.indexOf("/")?"period":-1===t.indexOf("T")?"date":"date-time"}},"recurrence-id":o,resources:i,"request-status":a,rrule:l,sequence:s,status:r,summary:r,transp:r,trigger:{defaultType:"duration",allowedTypes:["duration","date-time"]},tzoffsetfrom:c,tzoffsetto:c,tzurl:h,tzid:r,tzname:r}),C=ICAL.helpers.extend(p,{text:n(t,e),uri:n(t,e),date:{decorate:function(t){return ICAL.VCardTime.fromDateAndOrTimeString(t,"date")},undecorate:function(t){return t.toString()},fromICAL:function(t){return 8==t.length?y.date.fromICAL(t):"-"==t[0]&&6==t.length?t.substr(0,4)+"-"+t.substr(4):t},toICAL:function(t){return 10==t.length?y.date.toICAL(t):"-"==t[0]&&7==t.length?t.substr(0,4)+t.substr(5):t}},time:{decorate:function(t){return ICAL.VCardTime.fromDateAndOrTimeString("T"+t,"time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=C.time._splitZone(t,!0),n=e[0],r=e[1];return 6==r.length?r=r.substr(0,2)+":"+r.substr(2,2)+":"+r.substr(4,2):4==r.length&&"-"!=r[0]?r=r.substr(0,2)+":"+r.substr(2,2):5==r.length&&(r=r.substr(0,3)+":"+r.substr(3,2)),5!=n.length||"-"!=n[0]&&"+"!=n[0]||(n=n.substr(0,3)+":"+n.substr(3)),r+n},toICAL:function(t){var e=C.time._splitZone(t),n=e[0],r=e[1];return 8==r.length?r=r.substr(0,2)+r.substr(3,2)+r.substr(6,2):5==r.length&&"-"!=r[0]?r=r.substr(0,2)+r.substr(3,2):6==r.length&&(r=r.substr(0,3)+r.substr(4,2)),6!=n.length||"-"!=n[0]&&"+"!=n[0]||(n=n.substr(0,3)+n.substr(4)),r+n},_splitZone:function(t,e){var n,r,i=t.length-1,a=t.length-(e?5:6),s=t[a];return"Z"==t[i]?(n=t[i],r=t.substr(0,i)):t.length>6&&("-"==s||"+"==s)?(n=t.substr(a),r=t.substr(0,a)):(n="",r=t),[n,r]}},"date-time":{decorate:function(t){return ICAL.VCardTime.fromDateAndOrTimeString(t,"date-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){return C["date-and-or-time"].fromICAL(t)},toICAL:function(t){return C["date-and-or-time"].toICAL(t)}},"date-and-or-time":{decorate:function(t){return ICAL.VCardTime.fromDateAndOrTimeString(t,"date-and-or-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=t.split("T");return(e[0]?C.date.fromICAL(e[0]):"")+(e[1]?"T"+C.time.fromICAL(e[1]):"")},toICAL:function(t){var e=t.split("T");return C.date.toICAL(e[0])+(e[1]?"T"+C.time.toICAL(e[1]):"")}},timestamp:y["date-time"],"language-tag":{matches:/^[a-zA-Z0-9-]+$/}}),I=ICAL.helpers.extend(m,{adr:{defaultType:"text",structuredValue:";",multiValue:","},anniversary:d,bday:d,caladruri:h,caluri:h,clientpidmap:a,email:r,fburl:h,fn:r,gender:a,geo:h,impp:h,key:h,kind:r,lang:{defaultType:"language-tag"},logo:h,member:h,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:i,note:r,org:{defaultType:"text",structuredValue:";"},photo:h,related:h,rev:{defaultType:"timestamp"},role:r,sound:h,source:h,tel:{defaultType:"uri",allowedTypes:["uri","text"]},title:r,tz:{defaultType:"text",allowedTypes:["text","utc-offset","uri"]},xml:r}),T=ICAL.helpers.extend(p,{binary:y.binary,date:C.date,"date-time":C["date-time"],"phone-number":{},uri:y.uri,text:y.text,time:y.time,vcard:y.text,"utc-offset":{toICAL:function(t){return t.substr(0,7)},fromICAL:function(t){return t.substr(0,7)},decorate:function(t){return ICAL.UtcOffset.fromString(t)},undecorate:function(t){return t.toString()}}}),L=ICAL.helpers.extend(m,{fn:r,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:i,photo:{defaultType:"binary",allowedTypes:["binary","uri"]},bday:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(t){return-1===t.indexOf("T")?"date":"date-time"}},adr:{defaultType:"text",structuredValue:";",multiValue:","},label:r,tel:{defaultType:"phone-number"},email:r,mailer:r,tz:{defaultType:"utc-offset",allowedTypes:["utc-offset","text"]},geo:{defaultType:"float",structuredValue:";"},title:r,role:r,logo:{defaultType:"binary",allowedTypes:["binary","uri"]},agent:{defaultType:"vcard",allowedTypes:["vcard","text","uri"]},org:a,note:i,prodid:r,rev:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(t){return-1===t.indexOf("T")?"date":"date-time"}},"sort-string":r,sound:{defaultType:"binary",allowedTypes:["binary","uri"]},class:r,key:{defaultType:"binary",allowedTypes:["binary","text"]}}),_={value:y,param:{cutype:{values:["INDIVIDUAL","GROUP","RESOURCE","ROOM","UNKNOWN"],allowXName:!0,allowIanaToken:!0},"delegated-from":{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},"delegated-to":{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},encoding:{values:["8BIT","BASE64"]},fbtype:{values:["FREE","BUSY","BUSY-UNAVAILABLE","BUSY-TENTATIVE"],allowXName:!0,allowIanaToken:!0},member:{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},partstat:{values:["NEEDS-ACTION","ACCEPTED","DECLINED","TENTATIVE","DELEGATED","COMPLETED","IN-PROCESS"],allowXName:!0,allowIanaToken:!0},range:{values:["THISLANDFUTURE"]},related:{values:["START","END"]},reltype:{values:["PARENT","CHILD","SIBLING"],allowXName:!0,allowIanaToken:!0},role:{values:["REQ-PARTICIPANT","CHAIR","OPT-PARTICIPANT","NON-PARTICIPANT"],allowXName:!0,allowIanaToken:!0},rsvp:{values:["TRUE","FALSE"]},"sent-by":{valueType:"cal-address"},tzid:{matches:/^\//},value:{values:["binary","boolean","cal-address","date","date-time","duration","float","integer","period","recur","text","time","uri","utc-offset"],allowXName:!0,allowIanaToken:!0}},property:A},v={value:C,param:{type:{valueType:"text",multiValue:","},value:{values:["text","uri","date","time","date-time","date-and-or-time","timestamp","boolean","integer","float","utc-offset","language-tag"],allowXName:!0,allowIanaToken:!0}},property:I},g={value:T,param:{type:{valueType:"text",multiValue:","},value:{values:["text","uri","date","date-time","phone-number","time","boolean","integer","float","utc-offset","vcard","binary"],allowXName:!0,allowIanaToken:!0}},property:L},D={defaultSet:_,defaultType:"unknown",components:{vcard:v,vcard3:g,vevent:_,vtodo:_,vjournal:_,valarm:_,vtimezone:_,daylight:_,standard:_},icalendar:_,vcard:v,vcard3:g,getDesignSet:function(t){return t&&t in D.components?D.components[t]:D.defaultSet}};return D}(),ICAL.stringify=function(){"use strict";var t="\r\n",e=ICAL.design,n=ICAL.helpers;function r(e){"string"==typeof e[0]&&(e=[e]);for(var n=0,i=e.length,a="";n<i;n++)a+=r.component(e[n])+t;return a}r.component=function(n,i){var a=n[0].toUpperCase(),s="BEGIN:"+a+t,o=n[1],u=0,h=o.length,c=n[0];for("vcard"===c&&n[1].length>0&&("version"!==n[1][0][0]||"4.0"!==n[1][0][3])&&(c="vcard3"),i=i||e.getDesignSet(c);u<h;u++)s+=r.property(o[u],i)+t;for(var l=n[2]||[],d=0,f=l.length;d<f;d++)s+=r.component(l[d],i)+t;return s+="END:"+a},r.property=function(t,n,i){var a,s=t[0].toUpperCase(),o=t[0],u=t[1],h=s;for(a in u){var c=u[a];if(u.hasOwnProperty(a)){(f=a in n.param&&n.param[a].multiValue)&&Array.isArray(c)?(n.param[a].multiValueSeparateDQuote&&(f='"'+f+'"'),c=c.map(r._rfc6868Unescape),c=r.multiValue(c,f,"unknown",null,n)):c=r._rfc6868Unescape(c),h+=";"+a.toUpperCase(),h+="="+r.propertyValue(c)}}if(3===t.length)return h+":";var l=t[2];n||(n=e.defaultSet);var d,f=!1,m=!1,p=!1;return o in n.property?("multiValue"in(d=n.property[o])&&(f=d.multiValue),"structuredValue"in d&&Array.isArray(t[3])&&(m=d.structuredValue),"defaultType"in d?l===d.defaultType&&(p=!0):"unknown"===l&&(p=!0)):"unknown"===l&&(p=!0),p||(h+=";VALUE="+l.toUpperCase()),h+=":",h+=f&&m?r.multiValue(t[3],m,l,f,n,m):f?r.multiValue(t.slice(3),f,l,null,n,!1):m?r.multiValue(t[3],m,l,null,n,m):r.value(t[3],l,n,!1),i?h:ICAL.helpers.foldline(h)},r.propertyValue=function(t){return-1===n.unescapedIndexOf(t,",")&&-1===n.unescapedIndexOf(t,":")&&-1===n.unescapedIndexOf(t,";")?t:'"'+t+'"'},r.multiValue=function(t,e,n,i,a,s){for(var o="",u=t.length,h=0;h<u;h++)i&&Array.isArray(t[h])?o+=r.multiValue(t[h],i,n,null,a,s):o+=r.value(t[h],n,a,s),h!==u-1&&(o+=e);return o},r.value=function(t,e,n,r){return e in n.value&&"toICAL"in n.value[e]?n.value[e].toICAL(t,r):t},r._rfc6868Unescape=function(t){return t.replace(/[\n^"]/g,function(t){return i[t]})};var i={'"':"^'","\n":"^n","^":"^^"};return r}(),ICAL.parse=function(){"use strict";var t=/[^ \t]/,e=ICAL.design,n=ICAL.helpers;function r(t){this.message=t,this.name="ParserError";try{throw new Error}catch(t){if(t.stack){var e=t.stack.split("\n");e.shift(),this.stack=e.join("\n")}}}r.prototype=Error.prototype;function i(t){var e={},n=e.component=[];if(e.stack=[n],i._eachLine(t,function(t,n){i._handleContentLine(n,e)}),e.stack.length>1)throw new r("invalid ical body. component began but did not end");return e=null,1==n.length?n[0]:n}i.property=function(t,n){var r={component:[[],[]],designSet:n||e.defaultSet};return i._handleContentLine(t,r),r.component[1][0]},i.component=function(t){return i(t)},i.ParserError=r,i._handleContentLine=function(t,n){var a,s,o,u,h=t.indexOf(":"),c=t.indexOf(";"),l={};-1!==c&&-1!==h&&c>h&&(c=-1);var d;if(-1!==c){if(o=t.substring(0,c).toLowerCase(),-1==(d=i._parseParameters(t.substring(c),0,n.designSet))[2])throw new r("Invalid parameters in '"+t+"'");if(l=d[0],a=d[1].length+d[2]+c,-1===(s=t.substring(a).indexOf(":")))throw new r("Missing parameter value in '"+t+"'");u=t.substring(a+s+1)}else{if(-1===h)throw new r('invalid line (no token ";" or ":") "'+t+'"');if(o=t.substring(0,h).toLowerCase(),u=t.substring(h+1),"begin"===o){var f=[u.toLowerCase(),[],[]];return 1===n.stack.length?n.component.push(f):n.component[2].push(f),n.stack.push(n.component),n.component=f,void(n.designSet||(n.designSet=e.getDesignSet(n.component[0])))}if("end"===o)return void(n.component=n.stack.pop())}var m,p,y=!1,A=!1;o in n.designSet.property&&("multiValue"in(p=n.designSet.property[o])&&(y=p.multiValue),"structuredValue"in p&&(A=p.structuredValue),u&&"detectType"in p&&(m=p.detectType(u))),m||(m="value"in l?l.value.toLowerCase():p?p.defaultType:"unknown"),delete l.value;var C;y&&A?C=[o,l,m,u=i._parseMultiValue(u,A,m,[],y,n.designSet,A)]:y?i._parseMultiValue(u,y,m,C=[o,l,m],null,n.designSet,!1):C=A?[o,l,m,u=i._parseMultiValue(u,A,m,[],null,n.designSet,A)]:[o,l,m,u=i._parseValue(u,m,n.designSet,!1)],"vcard"!==n.component[0]||0!==n.component[1].length||"version"===o&&"4.0"===u||(n.designSet=e.getDesignSet("vcard3")),n.component[1].push(C)},i._parseValue=function(t,e,n,r){return e in n.value&&"fromICAL"in n.value[e]?n.value[e].fromICAL(t,r):t},i._parseParameters=function(t,e,a){for(var s,o,u,h,c,l,d=e,f=0,m={},p=-1;!1!==f&&-1!==(f=n.unescapedIndexOf(t,"=",f+1));){if(0==(s=t.substr(d+1,f-d-1)).length)throw new r("Empty parameter name in '"+t+"'");h=(o=s.toLowerCase())in a.param&&a.param[o].valueType?a.param[o].valueType:"text",o in a.param&&(c=a.param[o].multiValue,a.param[o].multiValueSeparateDQuote&&(l=i._rfc6868Escape('"'+c+'"')));if('"'===t[f+1]){if(p=f+2,f=n.unescapedIndexOf(t,'"',p),c&&-1!=f)for(var y=!0;y;)t[f+1]==c&&'"'==t[f+2]?f=n.unescapedIndexOf(t,'"',f+3):y=!1;if(-1===f)throw new r('invalid line (no matching double quote) "'+t+'"');u=t.substr(p,f-p),-1===(d=n.unescapedIndexOf(t,";",f))&&(f=!1)}else{p=f+1;var A=n.unescapedIndexOf(t,";",p),C=n.unescapedIndexOf(t,":",p);-1!==C&&A>C?(A=C,f=!1):-1===A?(A=-1===C?t.length:C,f=!1):(d=A,f=A),u=t.substr(p,A-p)}if(u=i._rfc6868Escape(u),c){var I=l||c;m[o]=i._parseMultiValue(u,I,h,[],null,a)}else m[o]=i._parseValue(u,h,a)}return[m,u,p]},i._rfc6868Escape=function(t){return t.replace(/\^['n^]/g,function(t){return a[t]})};var a={"^'":'"',"^n":"\n","^^":"^"};return i._parseMultiValue=function(t,e,r,a,s,o,u){var h,c=0,l=0;if(0===e.length)return t;for(;-1!==(c=n.unescapedIndexOf(t,e,l));)h=t.substr(l,c-l),h=s?i._parseMultiValue(h,s,r,[],null,o,u):i._parseValue(h,r,o,u),a.push(h),l=c+e.length;return h=t.substr(l),h=s?i._parseMultiValue(h,s,r,[],null,o,u):i._parseValue(h,r,o,u),a.push(h),1==a.length?a[0]:a},i._eachLine=function(e,n){var r,i,a,s=e.length,o=e.search(t),u=o;do{a=(u=e.indexOf("\n",o)+1)>1&&"\r"===e[u-2]?2:1,0===u&&(u=s,a=0)," "===(i=e[o])||"\t"===i?r+=e.substr(o+1,u-o-(a+1)):(r&&n(null,r),r=e.substr(o,u-o-a)),o=u}while(u!==s);(r=r.trim()).length&&n(null,r)},i}(),ICAL.Component=function(){"use strict";function t(t,e){"string"==typeof t&&(t=[t,[],[]]),this.jCal=t,this.parent=e||null}return t.prototype={_hydratedPropertyCount:0,_hydratedComponentCount:0,get name(){return this.jCal[0]},get _designSet(){var t=this.parent&&this.parent._designSet;return t||ICAL.design.getDesignSet(this.name)},_hydrateComponent:function(e){if(this._components||(this._components=[],this._hydratedComponentCount=0),this._components[e])return this._components[e];var n=new t(this.jCal[2][e],this);return this._hydratedComponentCount++,this._components[e]=n},_hydrateProperty:function(t){if(this._properties||(this._properties=[],this._hydratedPropertyCount=0),this._properties[t])return this._properties[t];var e=new ICAL.Property(this.jCal[1][t],this);return this._hydratedPropertyCount++,this._properties[t]=e},getFirstSubcomponent:function(t){if(t){for(var e=0,n=this.jCal[2],r=n.length;e<r;e++)if(n[e][0]===t){return this._hydrateComponent(e)}}else if(this.jCal[2].length)return this._hydrateComponent(0);return null},getAllSubcomponents:function(t){var e=this.jCal[2].length,n=0;if(t){for(var r=this.jCal[2],i=[];n<e;n++)t===r[n][0]&&i.push(this._hydrateComponent(n));return i}if(!this._components||this._hydratedComponentCount!==e)for(;n<e;n++)this._hydrateComponent(n);return this._components||[]},hasProperty:function(t){for(var e=this.jCal[1],n=e.length,r=0;r<n;r++)if(e[r][0]===t)return!0;return!1},getFirstProperty:function(t){if(t){for(var e=0,n=this.jCal[1],r=n.length;e<r;e++)if(n[e][0]===t){return this._hydrateProperty(e)}}else if(this.jCal[1].length)return this._hydrateProperty(0);return null},getFirstPropertyValue:function(t){var e=this.getFirstProperty(t);return e?e.getFirstValue():null},getAllProperties:function(t){var e=this.jCal[1].length,n=0;if(t){for(var r=this.jCal[1],i=[];n<e;n++)t===r[n][0]&&i.push(this._hydrateProperty(n));return i}if(!this._properties||this._hydratedPropertyCount!==e)for(;n<e;n++)this._hydrateProperty(n);return this._properties||[]},_removeObjectByIndex:function(t,e,n){if((e=e||[])[n]){var r=e[n];"parent"in r&&(r.parent=null)}e.splice(n,1),this.jCal[t].splice(n,1)},_removeObject:function(t,e,n){var r=0,i=this.jCal[t],a=i.length,s=this[e];if("string"==typeof n){for(;r<a;r++)if(i[r][0]===n)return this._removeObjectByIndex(t,s,r),!0}else if(s)for(;r<a;r++)if(s[r]&&s[r]===n)return this._removeObjectByIndex(t,s,r),!0;return!1},_removeAllObjects:function(t,e,n){for(var r=this[e],i=this.jCal[t],a=i.length-1;a>=0;a--)n&&i[a][0]!==n||this._removeObjectByIndex(t,r,a)},addSubcomponent:function(t){this._components||(this._components=[],this._hydratedComponentCount=0),t.parent&&t.parent.removeSubcomponent(t);var e=this.jCal[2].push(t.jCal);return this._components[e-1]=t,this._hydratedComponentCount++,t.parent=this,t},removeSubcomponent:function(t){var e=this._removeObject(2,"_components",t);return e&&this._hydratedComponentCount--,e},removeAllSubcomponents:function(t){var e=this._removeAllObjects(2,"_components",t);return this._hydratedComponentCount=0,e},addProperty:function(t){if(!(t instanceof ICAL.Property))throw new TypeError("must instance of ICAL.Property");this._properties||(this._properties=[],this._hydratedPropertyCount=0),t.parent&&t.parent.removeProperty(t);var e=this.jCal[1].push(t.jCal);return this._properties[e-1]=t,this._hydratedPropertyCount++,t.parent=this,t},addPropertyWithValue:function(t,e){var n=new ICAL.Property(t);return n.setValue(e),this.addProperty(n),n},updatePropertyWithValue:function(t,e){var n=this.getFirstProperty(t);return n?n.setValue(e):n=this.addPropertyWithValue(t,e),n},removeProperty:function(t){var e=this._removeObject(1,"_properties",t);return e&&this._hydratedPropertyCount--,e},removeAllProperties:function(t){var e=this._removeAllObjects(1,"_properties",t);return this._hydratedPropertyCount=0,e},toJSON:function(){return this.jCal},toString:function(){return ICAL.stringify.component(this.jCal,this._designSet)}},t.fromString=function(e){return new t(ICAL.parse.component(e))},t}(),ICAL.Property=function(){"use strict";var t=2,e=ICAL.design;function n(n,r){this._parent=r||null,"string"==typeof n?(this.jCal=[n,{},e.defaultType],this.jCal[t]=this.getDefaultType()):this.jCal=n,this._updateType()}return n.prototype={get type(){return this.jCal[t]},get name(){return this.jCal[0]},get parent(){return this._parent},set parent(n){var r=!this._parent||n&&n._designSet!=this._parent._designSet;return this._parent=n,this.type==e.defaultType&&r&&(this.jCal[t]=this.getDefaultType(),this._updateType()),n},get _designSet(){return this.parent?this.parent._designSet:e.defaultSet},_updateType:function(){var t=this._designSet;if(this.type in t.value){t.value[this.type];"decorate"in t.value[this.type]?this.isDecorated=!0:this.isDecorated=!1,this.name in t.property&&(this.isMultiValue="multiValue"in t.property[this.name],this.isStructuredValue="structuredValue"in t.property[this.name])}},_hydrateValue:function(t){return this._values&&this._values[t]?this._values[t]:this.jCal.length<=3+t?null:this.isDecorated?(this._values||(this._values=[]),this._values[t]=this._decorate(this.jCal[3+t])):this.jCal[3+t]},_decorate:function(t){return this._designSet.value[this.type].decorate(t,this)},_undecorate:function(t){return this._designSet.value[this.type].undecorate(t,this)},_setDecoratedValue:function(t,e){this._values||(this._values=[]),"object"==typeof t&&"icaltype"in t?(this.jCal[3+e]=this._undecorate(t),this._values[e]=t):(this.jCal[3+e]=t,this._values[e]=this._decorate(t))},getParameter:function(t){return t in this.jCal[1]?this.jCal[1][t]:void 0},setParameter:function(t,e){var n=t.toLowerCase();"string"==typeof e&&n in this._designSet.param&&"multiValue"in this._designSet.param[n]&&(e=[e]),this.jCal[1][t]=e},removeParameter:function(t){delete this.jCal[1][t]},getDefaultType:function(){var t=this.jCal[0],n=this._designSet;if(t in n.property){var r=n.property[t];if("defaultType"in r)return r.defaultType}return e.defaultType},resetType:function(e){this.removeAllValues(),this.jCal[t]=e,this._updateType()},getFirstValue:function(){return this._hydrateValue(0)},getValues:function(){var t=this.jCal.length-3;if(t<1)return[];for(var e=0,n=[];e<t;e++)n[e]=this._hydrateValue(e);return n},removeAllValues:function(){this._values&&(this._values.length=0),this.jCal.length=3},setValues:function(t){if(!this.isMultiValue)throw new Error(this.name+": does not not support mulitValue.\noverride isMultiValue");var e=t.length,n=0;if(this.removeAllValues(),e>0&&"object"==typeof t[0]&&"icaltype"in t[0]&&this.resetType(t[0].icaltype),this.isDecorated)for(;n<e;n++)this._setDecoratedValue(t[n],n);else for(;n<e;n++)this.jCal[3+n]=t[n]},setValue:function(t){this.removeAllValues(),"object"==typeof t&&"icaltype"in t&&this.resetType(t.icaltype),this.isDecorated?this._setDecoratedValue(t,0):this.jCal[3]=t},toJSON:function(){return this.jCal},toICALString:function(){return ICAL.stringify.property(this.jCal,this._designSet,!0)}},n.fromString=function(t,e){return new n(ICAL.parse.property(t,e))},n}(),ICAL.UtcOffset=function(){function t(t){this.fromData(t)}return t.prototype={hours:0,minutes:0,factor:1,icaltype:"utc-offset",clone:function(){return ICAL.UtcOffset.fromSeconds(this.toSeconds())},fromData:function(t){if(t)for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);this._normalize()},fromSeconds:function(t){var e=Math.abs(t);return this.factor=t<0?-1:1,this.hours=ICAL.helpers.trunc(e/3600),e-=3600*this.hours,this.minutes=ICAL.helpers.trunc(e/60),this},toSeconds:function(){return this.factor*(60*this.minutes+3600*this.hours)},compare:function(t){var e=this.toSeconds(),n=t.toSeconds();return(e>n)-(n>e)},_normalize:function(){for(var t=this.toSeconds(),e=this.factor;t<-43200;)t+=97200;for(;t>50400;)t-=97200;this.fromSeconds(t),0==t&&(this.factor=e)},toICALString:function(){return ICAL.design.icalendar.value["utc-offset"].toICAL(this.toString())},toString:function(){return(1==this.factor?"+":"-")+ICAL.helpers.pad2(this.hours)+":"+ICAL.helpers.pad2(this.minutes)}},t.fromString=function(t){var e={};return e.factor="+"===t[0]?1:-1,e.hours=ICAL.helpers.strictParseInt(t.substr(1,2)),e.minutes=ICAL.helpers.strictParseInt(t.substr(4,2)),new ICAL.UtcOffset(e)},t.fromSeconds=function(e){var n=new t;return n.fromSeconds(e),n},t}(),ICAL.Binary=function(){function t(t){this.value=t}return t.prototype={icaltype:"binary",decodeValue:function(){return this._b64_decode(this.value)},setEncodedValue:function(t){this.value=this._b64_encode(t)},_b64_encode:function(t){var e,n,r,i,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,u=0,h="",c=[];if(!t)return t;do{e=(a=t.charCodeAt(o++)<<16|t.charCodeAt(o++)<<8|t.charCodeAt(o++))>>18&63,n=a>>12&63,r=a>>6&63,i=63&a,c[u++]=s.charAt(e)+s.charAt(n)+s.charAt(r)+s.charAt(i)}while(o<t.length);h=c.join("");var l=t.length%3;return(l?h.slice(0,l-3):h)+"===".slice(l||3)},_b64_decode:function(t){var e,n,r,i,a,s,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,h=0,c=[];if(!t)return t;t+="";do{e=(s=o.indexOf(t.charAt(u++))<<18|o.indexOf(t.charAt(u++))<<12|(i=o.indexOf(t.charAt(u++)))<<6|(a=o.indexOf(t.charAt(u++))))>>16&255,n=s>>8&255,r=255&s,c[h++]=64==i?String.fromCharCode(e):64==a?String.fromCharCode(e,n):String.fromCharCode(e,n,r)}while(u<t.length);return c.join("")},toString:function(){return this.value}},t.fromString=function(e){return new t(e)},t}(),ICAL.Period=function(t){if(this.wrappedJSObject=this,t&&"start"in t){if(t.start&&!(t.start instanceof ICAL.Time))throw new TypeError(".start must be an instance of ICAL.Time");this.start=t.start}if(t&&t.end&&t.duration)throw new Error("cannot accept both end and duration");if(t&&"end"in t){if(t.end&&!(t.end instanceof ICAL.Time))throw new TypeError(".end must be an instance of ICAL.Time");this.end=t.end}if(t&&"duration"in t){if(t.duration&&!(t.duration instanceof ICAL.Duration))throw new TypeError(".duration must be an instance of ICAL.Duration");this.duration=t.duration}},ICAL.Period.prototype={start:null,end:null,duration:null,icalclass:"icalperiod",icaltype:"period",clone:function(){return ICAL.Period.fromData({start:this.start?this.start.clone():null,end:this.end?this.end.clone():null,duration:this.duration?this.duration.clone():null})},getDuration:function(){return this.duration?this.duration:this.end.subtractDate(this.start)},getEnd:function(){if(this.end)return this.end;var t=this.start.clone();return t.addDuration(this.duration),t},toString:function(){return this.start+"/"+(this.end||this.duration)},toJSON:function(){return[this.start.toString(),(this.end||this.duration).toString()]},toICALString:function(){return this.start.toICALString()+"/"+(this.end||this.duration).toICALString()}},ICAL.Period.fromString=function(t,e){var n=t.split("/");if(2!==n.length)throw new Error('Invalid string value: "'+t+'" must contain a "/" char.');var r={start:ICAL.Time.fromDateTimeString(n[0],e)},i=n[1];return ICAL.Duration.isValueString(i)?r.duration=ICAL.Duration.fromString(i):r.end=ICAL.Time.fromDateTimeString(i,e),new ICAL.Period(r)},ICAL.Period.fromData=function(t){return new ICAL.Period(t)},ICAL.Period.fromJSON=function(t,e){return ICAL.Duration.isValueString(t[1])?ICAL.Period.fromData({start:ICAL.Time.fromDateTimeString(t[0],e),duration:ICAL.Duration.fromString(t[1])}):ICAL.Period.fromData({start:ICAL.Time.fromDateTimeString(t[0],e),end:ICAL.Time.fromDateTimeString(t[1],e)})},function(){var t=/([PDWHMTS]{1,1})/;ICAL.Duration=function(t){this.wrappedJSObject=this,this.fromData(t)},ICAL.Duration.prototype={weeks:0,days:0,hours:0,minutes:0,seconds:0,isNegative:!1,icalclass:"icalduration",icaltype:"duration",clone:function(){return ICAL.Duration.fromData(this)},toSeconds:function(){var t=this.seconds+60*this.minutes+3600*this.hours+86400*this.days+604800*this.weeks;return this.isNegative?-t:t},fromSeconds:function(t){var e=Math.abs(t);return this.isNegative=t<0,this.days=ICAL.helpers.trunc(e/86400),this.days%7==0?(this.weeks=this.days/7,this.days=0):this.weeks=0,e-=86400*(this.days+7*this.weeks),this.hours=ICAL.helpers.trunc(e/3600),e-=3600*this.hours,this.minutes=ICAL.helpers.trunc(e/60),e-=60*this.minutes,this.seconds=e,this},fromData:function(t){var e=["weeks","days","hours","minutes","seconds","isNegative"];for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];this[r]=t&&r in t?t[r]:0}},reset:function(){this.isNegative=!1,this.weeks=0,this.days=0,this.hours=0,this.minutes=0,this.seconds=0},compare:function(t){var e=this.toSeconds(),n=t.toSeconds();return(e>n)-(e<n)},normalize:function(){this.fromSeconds(this.toSeconds())},toString:function(){if(0==this.toSeconds())return"PT0S";var t="";return this.isNegative&&(t+="-"),t+="P",this.weeks&&(t+=this.weeks+"W"),this.days&&(t+=this.days+"D"),(this.hours||this.minutes||this.seconds)&&(t+="T",this.hours&&(t+=this.hours+"H"),this.minutes&&(t+=this.minutes+"M"),this.seconds&&(t+=this.seconds+"S")),t},toICALString:function(){return this.toString()}},ICAL.Duration.fromSeconds=function(t){return(new ICAL.Duration).fromSeconds(t)};function e(t,e,n){var r;switch(t){case"P":n.isNegative=!(!e||"-"!==e);break;case"D":r="days";break;case"W":r="weeks";break;case"H":r="hours";break;case"M":r="minutes";break;case"S":r="seconds";break;default:return 0}if(r){if(!e&&0!==e)throw new Error('invalid duration value: Missing number before "'+t+'"');var i=parseInt(e,10);if(ICAL.helpers.isStrictlyNaN(i))throw new Error('invalid duration value: Invalid number "'+e+'" before "'+t+'"');n[r]=i}return 1}ICAL.Duration.isValueString=function(t){return"P"===t[0]||"P"===t[1]},ICAL.Duration.fromString=function(n){for(var r=0,i=Object.create(null),a=0;-1!==(r=n.search(t));){var s=n[r],o=n.substr(0,r);n=n.substr(r+1),a+=e(s,o,i)}if(a<2)throw new Error('invalid duration value: Not enough duration components in "'+n+'"');return new ICAL.Duration(i)},ICAL.Duration.fromData=function(t){return new ICAL.Duration(t)}}(),function(){var t=["tzid","location","tznames","latitude","longitude"];ICAL.Timezone=function(t){this.wrappedJSObject=this,this.fromData(t)},ICAL.Timezone.prototype={tzid:"",location:"",tznames:"",latitude:0,longitude:0,component:null,expandedUntilYear:0,icalclass:"icaltimezone",fromData:function(e){if(this.expandedUntilYear=0,this.changes=[],e instanceof ICAL.Component)this.component=e;else{if(e&&"component"in e)if("string"==typeof e.component){var n=ICAL.parse(e.component);this.component=new ICAL.Component(n)}else e.component instanceof ICAL.Component?this.component=e.component:this.component=null;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];e&&i in e&&(this[i]=e[i])}}return this.component instanceof ICAL.Component&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue("tzid")),this},utcOffset:function(t){if(this==ICAL.Timezone.utcTimezone||this==ICAL.Timezone.localTimezone)return 0;if(this._ensureCoverage(t.year),!this.changes.length)return 0;for(var e={year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second},n=this._findNearbyChange(e),r=-1,i=1;;){var a=ICAL.helpers.clone(this.changes[n],!0);a.utcOffset<a.prevUtcOffset?ICAL.Timezone.adjust_change(a,0,0,0,a.utcOffset):ICAL.Timezone.adjust_change(a,0,0,0,a.prevUtcOffset);if(ICAL.Timezone._compare_change_fn(e,a)>=0?r=n:i=-1,-1==i&&-1!=r)break;if((n+=i)<0)return 0;if(n>=this.changes.length)break}var s=this.changes[r];if(s.utcOffset-s.prevUtcOffset<0&&r>0){var o=ICAL.helpers.clone(s,!0);if(ICAL.Timezone.adjust_change(o,0,0,0,o.prevUtcOffset),ICAL.Timezone._compare_change_fn(e,o)<0){var u=this.changes[r-1];0!=s.is_daylight&&0==u.is_daylight&&(s=u)}}return s.utcOffset},_findNearbyChange:function(t){var e=ICAL.helpers.binsearchInsert(this.changes,t,ICAL.Timezone._compare_change_fn);return e>=this.changes.length?this.changes.length-1:e},_ensureCoverage:function(t){if(-1==ICAL.Timezone._minimumExpansionYear){var e=ICAL.Time.now();ICAL.Timezone._minimumExpansionYear=e.year}var n=t;if(n<ICAL.Timezone._minimumExpansionYear&&(n=ICAL.Timezone._minimumExpansionYear),(n+=ICAL.Timezone.EXTRA_COVERAGE)>ICAL.Timezone.MAX_YEAR&&(n=ICAL.Timezone.MAX_YEAR),!this.changes.length||this.expandedUntilYear<t){for(var r=this.component.getAllSubcomponents(),i=r.length,a=0;a<i;a++)this._expandComponent(r[a],n,this.changes);this.changes.sort(ICAL.Timezone._compare_change_fn),this.expandedUntilYear=n}},_expandComponent:function(t,e,n){if(!t.hasProperty("dtstart")||!t.hasProperty("tzoffsetto")||!t.hasProperty("tzoffsetfrom"))return null;var r,i=t.getFirstProperty("dtstart").getFirstValue();function a(t){return t.factor*(3600*t.hours+60*t.minutes)}function s(){var e={};return e.is_daylight="daylight"==t.name,e.utcOffset=a(t.getFirstProperty("tzoffsetto").getFirstValue()),e.prevUtcOffset=a(t.getFirstProperty("tzoffsetfrom").getFirstValue()),e}if(t.hasProperty("rrule")||t.hasProperty("rdate")){var o=t.getAllProperties("rdate");for(var u in o)if(o.hasOwnProperty(u)){var h=o[u].getFirstValue();(r=s()).year=h.year,r.month=h.month,r.day=h.day,h.isDate?(r.hour=i.hour,r.minute=i.minute,r.second=i.second,i.zone!=ICAL.Timezone.utcTimezone&&ICAL.Timezone.adjust_change(r,0,0,0,-r.prevUtcOffset)):(r.hour=h.hour,r.minute=h.minute,r.second=h.second,h.zone!=ICAL.Timezone.utcTimezone&&ICAL.Timezone.adjust_change(r,0,0,0,-r.prevUtcOffset)),n.push(r)}var c=t.getFirstProperty("rrule");if(c){c=c.getFirstValue(),r=s(),c.until&&c.until.zone==ICAL.Timezone.utcTimezone&&(c.until.adjust(0,0,0,r.prevUtcOffset),c.until.zone=ICAL.Timezone.localTimezone);for(var l,d=c.iterator(i);(l=d.next())&&(r=s(),!(l.year>e)&&l);)r.year=l.year,r.month=l.month,r.day=l.day,r.hour=l.hour,r.minute=l.minute,r.second=l.second,r.isDate=l.isDate,ICAL.Timezone.adjust_change(r,0,0,0,-r.prevUtcOffset),n.push(r)}}else(r=s()).year=i.year,r.month=i.month,r.day=i.day,r.hour=i.hour,r.minute=i.minute,r.second=i.second,ICAL.Timezone.adjust_change(r,0,0,0,-r.prevUtcOffset),n.push(r);return n},toString:function(){return this.tznames?this.tznames:this.tzid}},ICAL.Timezone._compare_change_fn=function(t,e){return t.year<e.year?-1:t.year>e.year?1:t.month<e.month?-1:t.month>e.month?1:t.day<e.day?-1:t.day>e.day?1:t.hour<e.hour?-1:t.hour>e.hour?1:t.minute<e.minute?-1:t.minute>e.minute?1:t.second<e.second?-1:t.second>e.second?1:0},ICAL.Timezone.convert_time=function(t,e,n){if(t.isDate||e.tzid==n.tzid||e==ICAL.Timezone.localTimezone||n==ICAL.Timezone.localTimezone)return t.zone=n,t;var r=e.utcOffset(t);return t.adjust(0,0,0,-r),r=n.utcOffset(t),t.adjust(0,0,0,r),null},ICAL.Timezone.fromData=function(t){return(new ICAL.Timezone).fromData(t)},ICAL.Timezone.utcTimezone=ICAL.Timezone.fromData({tzid:"UTC"}),ICAL.Timezone.localTimezone=ICAL.Timezone.fromData({tzid:"floating"}),ICAL.Timezone.adjust_change=function(t,e,n,r,i){return ICAL.Time.prototype.adjust.call(t,e,n,r,i,t)},ICAL.Timezone._minimumExpansionYear=-1,ICAL.Timezone.MAX_YEAR=2035,ICAL.Timezone.EXTRA_COVERAGE=5}(),ICAL.TimezoneService=function(){var t,e={reset:function(){t=Object.create(null);var e=ICAL.Timezone.utcTimezone;t.Z=e,t.UTC=e,t.GMT=e},has:function(e){return!!t[e]},get:function(e){return t[e]},register:function(e,n){if(e instanceof ICAL.Component&&"vtimezone"===e.name&&(e=(n=new ICAL.Timezone(e)).tzid),!(n instanceof ICAL.Timezone))throw new TypeError("timezone must be ICAL.Timezone or ICAL.Component");t[e]=n},remove:function(e){return delete t[e]}};return e.reset(),e}(),ICAL.Time=function(t,e){this.wrappedJSObject=this;var n=this._time=Object.create(null);n.year=0,n.month=1,n.day=1,n.hour=0,n.minute=0,n.second=0,n.isDate=!1,this.fromData(t,e)},ICAL.Time._dowCache={},ICAL.Time._wnCache={},ICAL.Time.prototype={icalclass:"icaltime",_cachedUnixTime:null,get icaltype(){return this.isDate?"date":"date-time"},zone:null,_pendingNormalization:!1,clone:function(){return new ICAL.Time(this._time,this.zone)},reset:function(){this.fromData(ICAL.Time.epochTime),this.zone=ICAL.Timezone.utcTimezone},resetTo:function(t,e,n,r,i,a,s){this.fromData({year:t,month:e,day:n,hour:r,minute:i,second:a,zone:s})},fromJSDate:function(t,e){return t?e?(this.zone=ICAL.Timezone.utcTimezone,this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()):(this.zone=ICAL.Timezone.localTimezone,this.year=t.getFullYear(),this.month=t.getMonth()+1,this.day=t.getDate(),this.hour=t.getHours(),this.minute=t.getMinutes(),this.second=t.getSeconds()):this.reset(),this._cachedUnixTime=null,this},fromData:function(t,e){if(t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if("icaltype"===n)continue;this[n]=t[n]}if(e&&(this.zone=e),!t||"isDate"in t?t&&"isDate"in t&&(this.isDate=t.isDate):this.isDate=!("hour"in t),t&&"timezone"in t){var r=ICAL.TimezoneService.get(t.timezone);this.zone=r||ICAL.Timezone.localTimezone}return t&&"zone"in t&&(this.zone=t.zone),this.zone||(this.zone=ICAL.Timezone.localTimezone),this._cachedUnixTime=null,this},dayOfWeek:function(){var t=(this.year<<9)+(this.month<<5)+this.day;if(t in ICAL.Time._dowCache)return ICAL.Time._dowCache[t];var e=this.day,n=this.month+(this.month<3?12:0),r=this.year-(this.month<3?1:0),i=e+r+ICAL.helpers.trunc(26*(n+1)/10)+ICAL.helpers.trunc(r/4);return i=((i+=6*ICAL.helpers.trunc(r/100)+ICAL.helpers.trunc(r/400))+6)%7+1,ICAL.Time._dowCache[t]=i,i},dayOfYear:function(){var t=ICAL.Time.isLeapYear(this.year)?1:0;return ICAL.Time.daysInYearPassedMonth[t][this.month-1]+this.day},startOfWeek:function(t){var e=t||ICAL.Time.SUNDAY,n=this.clone();return n.day-=(this.dayOfWeek()+7-e)%7,n.isDate=!0,n.hour=0,n.minute=0,n.second=0,n},endOfWeek:function(t){var e=t||ICAL.Time.SUNDAY,n=this.clone();return n.day+=(7-this.dayOfWeek()+e-ICAL.Time.SUNDAY)%7,n.isDate=!0,n.hour=0,n.minute=0,n.second=0,n},startOfMonth:function(){var t=this.clone();return t.day=1,t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t},endOfMonth:function(){var t=this.clone();return t.day=ICAL.Time.daysInMonth(t.month,t.year),t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t},startOfYear:function(){var t=this.clone();return t.day=1,t.month=1,t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t},endOfYear:function(){var t=this.clone();return t.day=31,t.month=12,t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t},startDoyWeek:function(t){var e=t||ICAL.Time.SUNDAY,n=this.dayOfWeek()-e;return n<0&&(n+=7),this.dayOfYear()-n},getDominicalLetter:function(){return ICAL.Time.getDominicalLetter(this.year)},nthWeekDay:function(t,e){var n,r=ICAL.Time.daysInMonth(this.month,this.year),i=e,a=0,s=this.clone();if(i>=0){s.day=1,0!=i&&i--,a=s.day;var o=t-s.dayOfWeek();o<0&&(o+=7),a+=o,a-=t,n=t}else s.day=r,i++,(n=s.dayOfWeek()-t)<0&&(n+=7),n=r-n;return a+(n+=7*i)},isNthWeekDay:function(t,e){var n=this.dayOfWeek();return 0===e&&n===t||this.nthWeekDay(t,e)===this.day},weekNumber:function(t){var e=(this.year<<12)+(this.month<<8)+(this.day<<3)+t;if(e in ICAL.Time._wnCache)return ICAL.Time._wnCache[e];var n,r=this.clone();r.isDate=!0;var i=this.year;12==r.month&&r.day>25?(n=ICAL.Time.weekOneStarts(i+1,t),r.compare(n)<0?n=ICAL.Time.weekOneStarts(i,t):i++):(n=ICAL.Time.weekOneStarts(i,t),r.compare(n)<0&&(n=ICAL.Time.weekOneStarts(--i,t)));var a=r.subtractDate(n).toSeconds()/86400,s=ICAL.helpers.trunc(a/7)+1;return ICAL.Time._wnCache[e]=s,s},addDuration:function(t){var e=t.isNegative?-1:1,n=this.second,r=this.minute,i=this.hour,a=this.day;n+=e*t.seconds,r+=e*t.minutes,i+=e*t.hours,a+=e*t.days,a+=7*e*t.weeks,this.second=n,this.minute=r,this.hour=i,this.day=a,this._cachedUnixTime=null},subtractDate:function(t){var e=this.toUnixTime()+this.utcOffset(),n=t.toUnixTime()+t.utcOffset();return ICAL.Duration.fromSeconds(e-n)},subtractDateTz:function(t){var e=this.toUnixTime(),n=t.toUnixTime();return ICAL.Duration.fromSeconds(e-n)},compare:function(t){var e=this.toUnixTime(),n=t.toUnixTime();return e>n?1:n>e?-1:0},compareDateOnlyTz:function(t,e){function n(t){return ICAL.Time._cmp_attr(r,i,t)}var r=this.convertToZone(e),i=t.convertToZone(e),a=0;return 0!=(a=n("year"))?a:0!=(a=n("month"))?a:a=n("day")},convertToZone:function(t){var e=this.clone(),n=this.zone.tzid==t.tzid;return this.isDate||n||ICAL.Timezone.convert_time(e,this.zone,t),e.zone=t,e},utcOffset:function(){return this.zone==ICAL.Timezone.localTimezone||this.zone==ICAL.Timezone.utcTimezone?0:this.zone.utcOffset(this)},toICALString:function(){var t=this.toString();return t.length>10?ICAL.design.icalendar.value["date-time"].toICAL(t):ICAL.design.icalendar.value.date.toICAL(t)},toString:function(){var t=this.year+"-"+ICAL.helpers.pad2(this.month)+"-"+ICAL.helpers.pad2(this.day);return this.isDate||(t+="T"+ICAL.helpers.pad2(this.hour)+":"+ICAL.helpers.pad2(this.minute)+":"+ICAL.helpers.pad2(this.second),this.zone===ICAL.Timezone.utcTimezone&&(t+="Z")),t},toJSDate:function(){return this.zone==ICAL.Timezone.localTimezone?this.isDate?new Date(this.year,this.month-1,this.day):new Date(this.year,this.month-1,this.day,this.hour,this.minute,this.second,0):new Date(1e3*this.toUnixTime())},_normalize:function(){return this._time.isDate,this._time.isDate&&(this._time.hour=0,this._time.minute=0,this._time.second=0),this.adjust(0,0,0,0),this},adjust:function(t,e,n,r,i){var a,s,o,u,h,c,l,d=0,f=0,m=i||this._time;if(m.isDate||(o=m.second+r,m.second=o%60,a=ICAL.helpers.trunc(o/60),m.second<0&&(m.second+=60,a--),u=m.minute+n+a,m.minute=u%60,s=ICAL.helpers.trunc(u/60),m.minute<0&&(m.minute+=60,s--),h=m.hour+e+s,m.hour=h%24,d=ICAL.helpers.trunc(h/24),m.hour<0&&(m.hour+=24,d--)),m.month>12?f=ICAL.helpers.trunc((m.month-1)/12):m.month<1&&(f=ICAL.helpers.trunc(m.month/12)-1),m.year+=f,m.month-=12*f,(c=m.day+t+d)>0)for(;!(c<=(l=ICAL.Time.daysInMonth(m.month,m.year)));)m.month++,m.month>12&&(m.year++,m.month=1),c-=l;else for(;c<=0;)1==m.month?(m.year--,m.month=12):m.month--,c+=ICAL.Time.daysInMonth(m.month,m.year);return m.day=c,this._cachedUnixTime=null,this},fromUnixTime:function(t){this.zone=ICAL.Timezone.utcTimezone;var e=ICAL.Time.epochTime.clone();e.adjust(0,0,0,t),this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=Math.floor(e.second),this._cachedUnixTime=null},toUnixTime:function(){if(null!==this._cachedUnixTime)return this._cachedUnixTime;var t=this.utcOffset(),e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second-t);return this._cachedUnixTime=e/1e3,this._cachedUnixTime},toJSON:function(){for(var t,e=["year","month","day","hour","minute","second","isDate"],n=Object.create(null),r=0,i=e.length;r<i;r++)n[t=e[r]]=this[t];return this.zone&&(n.timezone=this.zone.tzid),n}},function(){function t(t){Object.defineProperty(ICAL.Time.prototype,t,{get:function(){return this._pendingNormalization&&(this._normalize(),this._pendingNormalization=!1),this._time[t]},set:function(e){return"isDate"===t&&e&&!this._time.isDate&&this.adjust(0,0,0,0),this._cachedUnixTime=null,this._pendingNormalization=!0,this._time[t]=e,e}})}"defineProperty"in Object&&(t("year"),t("month"),t("day"),t("hour"),t("minute"),t("second"),t("isDate"))}(),ICAL.Time.daysInMonth=function(t,e){var n=30;return t<1||t>12?n:(n=[0,31,28,31,30,31,30,31,31,30,31,30,31][t],2==t&&(n+=ICAL.Time.isLeapYear(e)),n)},ICAL.Time.isLeapYear=function(t){return t<=1752?t%4==0:t%4==0&&t%100!=0||t%400==0},ICAL.Time.fromDayOfYear=function(t,e){var n=e,r=t,i=new ICAL.Time;i.auto_normalize=!1;var a=ICAL.Time.isLeapYear(n)?1:0;if(r<1)return n--,a=ICAL.Time.isLeapYear(n)?1:0,r+=ICAL.Time.daysInYearPassedMonth[a][12],ICAL.Time.fromDayOfYear(r,n);if(r>ICAL.Time.daysInYearPassedMonth[a][12])return a=ICAL.Time.isLeapYear(n)?1:0,r-=ICAL.Time.daysInYearPassedMonth[a][12],n++,ICAL.Time.fromDayOfYear(r,n);i.year=n,i.isDate=!0;for(var s=11;s>=0;s--)if(r>ICAL.Time.daysInYearPassedMonth[a][s]){i.month=s+1,i.day=r-ICAL.Time.daysInYearPassedMonth[a][s];break}return i.auto_normalize=!0,i},ICAL.Time.fromStringv2=function(t){return new ICAL.Time({year:parseInt(t.substr(0,4),10),month:parseInt(t.substr(5,2),10),day:parseInt(t.substr(8,2),10),isDate:!0})},ICAL.Time.fromDateString=function(t){return new ICAL.Time({year:ICAL.helpers.strictParseInt(t.substr(0,4)),month:ICAL.helpers.strictParseInt(t.substr(5,2)),day:ICAL.helpers.strictParseInt(t.substr(8,2)),isDate:!0})},ICAL.Time.fromDateTimeString=function(t,e){if(t.length<19)throw new Error('invalid date-time value: "'+t+'"');var n;return t[19]&&"Z"===t[19]?n="Z":e&&(n=e.getParameter("tzid")),new ICAL.Time({year:ICAL.helpers.strictParseInt(t.substr(0,4)),month:ICAL.helpers.strictParseInt(t.substr(5,2)),day:ICAL.helpers.strictParseInt(t.substr(8,2)),hour:ICAL.helpers.strictParseInt(t.substr(11,2)),minute:ICAL.helpers.strictParseInt(t.substr(14,2)),second:ICAL.helpers.strictParseInt(t.substr(17,2)),timezone:n})},ICAL.Time.fromString=function(t){return t.length>10?ICAL.Time.fromDateTimeString(t):ICAL.Time.fromDateString(t)},ICAL.Time.fromJSDate=function(t,e){return(new ICAL.Time).fromJSDate(t,e)},ICAL.Time.fromData=function(t,e){return(new ICAL.Time).fromData(t,e)},ICAL.Time.now=function(){return ICAL.Time.fromJSDate(new Date,!1)},ICAL.Time.weekOneStarts=function(t,e){var n=ICAL.Time.fromData({year:t,month:1,day:1,isDate:!0}),r=n.dayOfWeek(),i=e||ICAL.Time.DEFAULT_WEEK_START;return r>ICAL.Time.THURSDAY&&(n.day+=7),i>ICAL.Time.THURSDAY&&(n.day-=7),n.day-=r-i,n},ICAL.Time.getDominicalLetter=function(t){var e=(t+(t/4|0)+(t/400|0)-(t/100|0)-1)%7;return ICAL.Time.isLeapYear(t)?"GFEDCBA"[(e+6)%7]+"GFEDCBA"[e]:"GFEDCBA"[e]},ICAL.Time.epochTime=ICAL.Time.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:"Z"}),ICAL.Time._cmp_attr=function(t,e,n){return t[n]>e[n]?1:t[n]<e[n]?-1:0},ICAL.Time.daysInYearPassedMonth=[[0,31,59,90,120,151,181,212,243,273,304,334,365],[0,31,60,91,121,152,182,213,244,274,305,335,366]],ICAL.Time.SUNDAY=1,ICAL.Time.MONDAY=2,ICAL.Time.TUESDAY=3,ICAL.Time.WEDNESDAY=4,ICAL.Time.THURSDAY=5,ICAL.Time.FRIDAY=6,ICAL.Time.SATURDAY=7,ICAL.Time.DEFAULT_WEEK_START=ICAL.Time.MONDAY,ICAL.VCardTime=function(t,e,n){this.wrappedJSObject=this;var r=this._time=Object.create(null);r.year=null,r.month=null,r.day=null,r.hour=null,r.minute=null,r.second=null,this.icaltype=n||"date-and-or-time",this.fromData(t,e)},ICAL.helpers.inherits(ICAL.Time,ICAL.VCardTime,{icalclass:"vcardtime",icaltype:"date-and-or-time",zone:null,clone:function(){return new ICAL.VCardTime(this._time,this.zone,this.icaltype)},_normalize:function(){return this},utcOffset:function(){return this.zone instanceof ICAL.UtcOffset?this.zone.toSeconds():ICAL.Time.prototype.utcOffset.apply(this,arguments)},toICALString:function(){return ICAL.design.vcard.value[this.icaltype].toICAL(this.toString())},toString:function(){var t,e=ICAL.helpers.pad2,n=this.year,r=this.month,i=this.day,a=this.hour,s=this.minute,o=this.second,u=null!==r,h=null!==i,c=null!==a,l=null!==s,d=null!==o,f=(null!==n?e(n)+(u||h?"-":""):u||h?"--":"")+(u?e(r):"")+(h?"-"+e(i):""),m=(c?e(a):"-")+(c&&l?":":"")+(l?e(s):"")+(c||l?"":"-")+(l&&d?":":"")+(d?e(o):"");switch(t=this.zone===ICAL.Timezone.utcTimezone?"Z":this.zone instanceof ICAL.UtcOffset?this.zone.toString():this.zone===ICAL.Timezone.localTimezone?"":this.zone instanceof ICAL.Timezone?ICAL.UtcOffset.fromSeconds(this.zone.utcOffset(this)).toString():"",this.icaltype){case"time":return m+t;case"date-and-or-time":case"date-time":return f+("--"==m?"":"T"+m+t);case"date":return f}return null}}),ICAL.VCardTime.fromDateAndOrTimeString=function(t,e){function n(t,e,n){return t?ICAL.helpers.strictParseInt(t.substr(e,n)):null}var r=t.split("T"),i=r[0],a=r[1],s=a?ICAL.design.vcard.value.time._splitZone(a):[],o=s[0],u=s[1],h=(ICAL.helpers.strictParseInt,i?i.length:0),c=u?u.length:0,l=i&&"-"==i[0]&&"-"==i[1],d=u&&"-"==u[0],f={year:l?null:n(i,0,4),month:!l||4!=h&&7!=h?7==h?n(i,5,2):10==h?n(i,5,2):null:n(i,2,2),day:5==h?n(i,3,2):7==h&&l?n(i,5,2):10==h?n(i,8,2):null,hour:d?null:n(u,0,2),minute:d&&3==c?n(u,1,2):c>4?n(u,d?1:3,2):null,second:4==c?n(u,2,2):6==c?n(u,4,2):8==c?n(u,6,2):null};return o="Z"==o?ICAL.Timezone.utcTimezone:o&&":"==o[3]?ICAL.UtcOffset.fromString(o):null,new ICAL.VCardTime(f,o,e)},function(){var t={SU:ICAL.Time.SUNDAY,MO:ICAL.Time.MONDAY,TU:ICAL.Time.TUESDAY,WE:ICAL.Time.WEDNESDAY,TH:ICAL.Time.THURSDAY,FR:ICAL.Time.FRIDAY,SA:ICAL.Time.SATURDAY},e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);ICAL.Recur=function(t){this.wrappedJSObject=this,this.parts={},t&&"object"==typeof t&&this.fromData(t)},ICAL.Recur.prototype={parts:null,interval:1,wkst:ICAL.Time.MONDAY,until:null,count:null,freq:null,icalclass:"icalrecur",icaltype:"recur",iterator:function(t){return new ICAL.RecurIterator({rule:this,dtstart:t})},clone:function(){return new ICAL.Recur(this.toJSON())},isFinite:function(){return!(!this.count&&!this.until)},isByCount:function(){return!(!this.count||this.until)},addComponent:function(t,e){var n=t.toUpperCase();n in this.parts?this.parts[n].push(e):this.parts[n]=[e]},setComponent:function(t,e){this.parts[t.toUpperCase()]=e.slice()},getComponent:function(t){var e=t.toUpperCase();return e in this.parts?this.parts[e].slice():[]},getNextOccurrence:function(t,e){var n,r=this.iterator(t);do{n=r.next()}while(n&&n.compare(e)<=0);return n&&e.zone&&(n.zone=e.zone),n},fromData:function(t){for(var e in t){var n=e.toUpperCase();n in u?Array.isArray(t[e])?this.parts[n]=t[e]:this.parts[n]=[t[e]]:this[e]=t[e]}this.interval&&"number"!=typeof this.interval&&o.INTERVAL(this.interval,this),this.wkst&&"number"!=typeof this.wkst&&(this.wkst=ICAL.Recur.icalDayToNumericDay(this.wkst)),!this.until||this.until instanceof ICAL.Time||(this.until=ICAL.Time.fromString(this.until))},toJSON:function(){var t=Object.create(null);t.freq=this.freq,this.count&&(t.count=this.count),this.interval>1&&(t.interval=this.interval);for(var e in this.parts)if(this.parts.hasOwnProperty(e)){var n=this.parts[e];Array.isArray(n)&&1==n.length?t[e.toLowerCase()]=n[0]:t[e.toLowerCase()]=ICAL.helpers.clone(this.parts[e])}return this.until&&(t.until=this.until.toString()),"wkst"in this&&this.wkst!==ICAL.Time.DEFAULT_WEEK_START&&(t.wkst=ICAL.Recur.numericDayToIcalDay(this.wkst)),t},toString:function(){var t="FREQ="+this.freq;this.count&&(t+=";COUNT="+this.count),this.interval>1&&(t+=";INTERVAL="+this.interval);for(var e in this.parts)this.parts.hasOwnProperty(e)&&(t+=";"+e+"="+this.parts[e]);return this.until&&(t+=";UNTIL="+this.until.toICALString()),"wkst"in this&&this.wkst!==ICAL.Time.DEFAULT_WEEK_START&&(t+=";WKST="+ICAL.Recur.numericDayToIcalDay(this.wkst)),t}};function r(t,e,n,r){var i=r;if("+"===r[0]&&(i=r.substr(1)),i=ICAL.helpers.strictParseInt(i),void 0!==e&&r<e)throw new Error(t+': invalid value "'+r+'" must be > '+e);if(void 0!==n&&r>n)throw new Error(t+': invalid value "'+r+'" must be < '+e);return i}ICAL.Recur.icalDayToNumericDay=function(e){return t[e]},ICAL.Recur.numericDayToIcalDay=function(t){return e[t]};var i=/^(SU|MO|TU|WE|TH|FR|SA)$/,a=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,s=["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],o={FREQ:function(t,e,n){if(-1===s.indexOf(t))throw new Error('invalid frequency "'+t+'" expected: "'+s.join(", ")+'"');e.freq=t},COUNT:function(t,e,n){e.count=ICAL.helpers.strictParseInt(t)},INTERVAL:function(t,e,n){e.interval=ICAL.helpers.strictParseInt(t),e.interval<1&&(e.interval=1)},UNTIL:function(t,e,n){t.length>10?e.until=ICAL.design.icalendar.value["date-time"].fromICAL(t):e.until=ICAL.design.icalendar.value.date.fromICAL(t),n||(e.until=ICAL.Time.fromString(e.until))},WKST:function(t,e,n){if(!i.test(t))throw new Error('invalid WKST value "'+t+'"');e.wkst=ICAL.Recur.icalDayToNumericDay(t)}},u={BYSECOND:r.bind(this,"BYSECOND",0,60),BYMINUTE:r.bind(this,"BYMINUTE",0,59),BYHOUR:r.bind(this,"BYHOUR",0,23),BYDAY:function(t){if(a.test(t))return t;throw new Error('invalid BYDAY value "'+t+'"')},BYMONTHDAY:r.bind(this,"BYMONTHDAY",-31,31),BYYEARDAY:r.bind(this,"BYYEARDAY",-366,366),BYWEEKNO:r.bind(this,"BYWEEKNO",-53,53),BYMONTH:r.bind(this,"BYMONTH",0,12),BYSETPOS:r.bind(this,"BYSETPOS",-366,366)};ICAL.Recur.fromString=function(t){var e=ICAL.Recur._stringToData(t,!1);return new ICAL.Recur(e)},ICAL.Recur.fromData=function(t){return new ICAL.Recur(t)},ICAL.Recur._stringToData=function(t,e){for(var n=Object.create(null),r=t.split(";"),i=r.length,a=0;a<i;a++){var s=r[a].split("="),h=s[0].toUpperCase(),c=s[0].toLowerCase(),l=e?c:h,d=s[1];if(h in u){for(var f=d.split(","),m=0,p=f.length;m<p;m++)f[m]=u[h](f[m]);n[l]=1==f.length?f[0]:f}else h in o?o[h](d,n,e):n[c]=d}return n}}(),ICAL.RecurIterator=function(){function t(t){this.fromData(t)}return t.prototype={completed:!1,rule:null,dtstart:null,last:null,occurrence_number:0,by_indices:null,initialized:!1,by_data:null,days:null,days_index:0,fromData:function(t){if(this.rule=ICAL.helpers.formatClassType(t.rule,ICAL.Recur),!this.rule)throw new Error("iterator requires a (ICAL.Recur) rule");if(this.dtstart=ICAL.helpers.formatClassType(t.dtstart,ICAL.Time),!this.dtstart)throw new Error("iterator requires a (ICAL.Time) dtstart");t.by_data?this.by_data=t.by_data:this.by_data=ICAL.helpers.clone(this.rule.parts,!0),t.occurrence_number&&(this.occurrence_number=t.occurrence_number),this.days=t.days||[],t.last&&(this.last=ICAL.helpers.formatClassType(t.last,ICAL.Time)),this.by_indices=t.by_indices,this.by_indices||(this.by_indices={BYSECOND:0,BYMINUTE:0,BYHOUR:0,BYDAY:0,BYMONTH:0,BYWEEKNO:0,BYMONTHDAY:0}),this.initialized=t.initialized||!1,this.initialized||this.init()},init:function(){this.initialized=!0,this.last=this.dtstart.clone();var t=this.by_data;if("BYDAY"in t&&this.sort_byday_rules(t.BYDAY,this.rule.wkst),"BYYEARDAY"in t&&("BYMONTH"in t||"BYWEEKNO"in t||"BYMONTHDAY"in t||"BYDAY"in t))throw new Error("Invalid BYYEARDAY rule");if("BYWEEKNO"in t&&"BYMONTHDAY"in t)throw new Error("BYWEEKNO does not fit to BYMONTHDAY");if("MONTHLY"==this.rule.freq&&("BYYEARDAY"in t||"BYWEEKNO"in t))throw new Error("For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear");if("WEEKLY"==this.rule.freq&&("BYYEARDAY"in t||"BYMONTHDAY"in t))throw new Error("For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear");if("YEARLY"!=this.rule.freq&&"BYYEARDAY"in t)throw new Error("BYYEARDAY may only appear in YEARLY rules");if(this.last.second=this.setup_defaults("BYSECOND","SECONDLY",this.dtstart.second),this.last.minute=this.setup_defaults("BYMINUTE","MINUTELY",this.dtstart.minute),this.last.hour=this.setup_defaults("BYHOUR","HOURLY",this.dtstart.hour),this.last.day=this.setup_defaults("BYMONTHDAY","DAILY",this.dtstart.day),this.last.month=this.setup_defaults("BYMONTH","MONTHLY",this.dtstart.month),"WEEKLY"==this.rule.freq)if("BYDAY"in t){var e=(u=this.ruleDayOfWeek(t.BYDAY[0]))[0],n=(h=u[1])-this.last.dayOfWeek();(this.last.dayOfWeek()<h&&n>=0||n<0)&&(this.last.day+=n)}else{var r=ICAL.Recur.numericDayToIcalDay(this.dtstart.dayOfWeek());t.BYDAY=[r]}if("YEARLY"==this.rule.freq){for(;this.expand_year_days(this.last.year),!(this.days.length>0);)this.increment_year(this.rule.interval);this._nextByYearDay()}if("MONTHLY"==this.rule.freq&&this.has_by_data("BYDAY")){var i=null,a=this.last.clone(),s=ICAL.Time.daysInMonth(this.last.month,this.last.year);for(var o in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(o)){this.last=a.clone();e=(u=this.ruleDayOfWeek(this.by_data.BYDAY[o]))[0];var u,h=u[1],c=this.last.nthWeekDay(h,e);if(e>=6||e<=-6)throw new Error("Malformed values in BYDAY part");if(c>s||c<=0){if(i&&i.month==a.month)continue;for(;c>s||c<=0;)this.increment_month(),s=ICAL.Time.daysInMonth(this.last.month,this.last.year),c=this.last.nthWeekDay(h,e)}this.last.day=c,(!i||this.last.compare(i)<0)&&(i=this.last.clone())}if(this.last=i.clone(),this.has_by_data("BYMONTHDAY")&&this._byDayAndMonthDay(!0),this.last.day>s||0==this.last.day)throw new Error("Malformed values in BYDAY part")}else if(this.has_by_data("BYMONTHDAY")&&this.last.day<0){s=ICAL.Time.daysInMonth(this.last.month,this.last.year);this.last.day=s+this.last.day+1}},next:function(){var t=this.last?this.last.clone():null;if(this.rule.count&&this.occurrence_number>=this.rule.count||this.rule.until&&this.last.compare(this.rule.until)>0)return this.completed=!0,null;if(0==this.occurrence_number&&this.last.compare(this.dtstart)>=0)return this.occurrence_number++,this.last;var e;do{switch(e=1,this.rule.freq){case"SECONDLY":this.next_second();break;case"MINUTELY":this.next_minute();break;case"HOURLY":this.next_hour();break;case"DAILY":this.next_day();break;case"WEEKLY":this.next_week();break;case"MONTHLY":e=this.next_month();break;case"YEARLY":this.next_year();break;default:return null}}while(!this.check_contracting_rules()||this.last.compare(this.dtstart)<0||!e);if(0==this.last.compare(t))throw new Error("Same occurrence found twice, protecting you from death by recursion");return this.rule.until&&this.last.compare(this.rule.until)>0?(this.completed=!0,null):(this.occurrence_number++,this.last)},next_second:function(){return this.next_generic("BYSECOND","SECONDLY","second","minute")},increment_second:function(t){return this.increment_generic(t,"second",60,"minute")},next_minute:function(){return this.next_generic("BYMINUTE","MINUTELY","minute","hour","next_second")},increment_minute:function(t){return this.increment_generic(t,"minute",60,"hour")},next_hour:function(){return this.next_generic("BYHOUR","HOURLY","hour","monthday","next_minute")},increment_hour:function(t){this.increment_generic(t,"hour",24,"monthday")},next_day:function(){this.by_data;var t="DAILY"==this.rule.freq;return 0==this.next_hour()?0:(t?this.increment_monthday(this.rule.interval):this.increment_monthday(1),0)},next_week:function(){var t=0;if(0==this.next_weekday_by_week())return t;if(this.has_by_data("BYWEEKNO")){++this.by_indices.BYWEEKNO;this.by_indices.BYWEEKNO==this.by_data.BYWEEKNO.length&&(this.by_indices.BYWEEKNO=0,t=1),this.last.month=1,this.last.day=1;var e=this.by_data.BYWEEKNO[this.by_indices.BYWEEKNO];this.last.day+=7*e,t&&this.increment_year(1)}else this.increment_monthday(7*this.rule.interval);return t},normalizeByMonthDayRules:function(t,e,n){for(var r,i=ICAL.Time.daysInMonth(e,t),a=[],s=0,o=n.length;s<o;s++)if(r=n[s],!(Math.abs(r)>i)){if(r<0)r=i+(r+1);else if(0===r)continue;-1===a.indexOf(r)&&a.push(r)}return a.sort(function(t,e){return t-e})},_byDayAndMonthDay:function(t){var e,n,r,i,a=this.by_data.BYDAY,s=0,o=a.length,u=0,h=this,c=this.last.day;function l(){for(i=ICAL.Time.daysInMonth(h.last.month,h.last.year),e=h.normalizeByMonthDayRules(h.last.year,h.last.month,h.by_data.BYMONTHDAY),r=e.length;e[s]<=c&&(!t||e[s]!=c)&&s<r-1;)s++}function d(){c=0,h.increment_month(),s=0,l()}l(),t&&(c-=1);for(var f=48;!u&&f;)if(f--,(n=c+1)>i)d();else{var m=e[s++];if(m>=n){c=m;for(var p=0;p<o;p++){var y=this.ruleDayOfWeek(a[p]),A=y[0],C=y[1];if(this.last.day=c,this.last.isNthWeekDay(C,A)){u=1;break}}u||s!==r||d()}else d()}if(f<=0)throw new Error("Malformed values in BYDAY combined with BYMONTHDAY parts");return u},next_month:function(){this.rule.freq;var t=1;if(0==this.next_hour())return t;if(this.has_by_data("BYDAY")&&this.has_by_data("BYMONTHDAY"))t=this._byDayAndMonthDay();else if(this.has_by_data("BYDAY")){var e=ICAL.Time.daysInMonth(this.last.month,this.last.year),n=0,r=0;if(this.has_by_data("BYSETPOS")){for(var i=this.last.day,a=1;a<=e;a++)this.last.day=a,this.is_day_in_byday(this.last)&&(r++,a<=i&&n++);this.last.day=i}t=0;for(a=this.last.day+1;a<=e;a++)if(this.last.day=a,this.is_day_in_byday(this.last)&&(!this.has_by_data("BYSETPOS")||this.check_set_position(++n)||this.check_set_position(n-r-1))){t=1;break}a>e&&(this.last.day=1,this.increment_month(),this.is_day_in_byday(this.last)?this.has_by_data("BYSETPOS")&&!this.check_set_position(1)||(t=1):t=0)}else if(this.has_by_data("BYMONTHDAY")){this.by_indices.BYMONTHDAY++,this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length&&(this.by_indices.BYMONTHDAY=0,this.increment_month());e=ICAL.Time.daysInMonth(this.last.month,this.last.year);(a=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY])<0&&(a=e+a+1),a>e?(this.last.day=1,t=this.is_day_in_byday(this.last)):this.last.day=a}else{this.increment_month();e=ICAL.Time.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>e?t=0:this.last.day=this.by_data.BYMONTHDAY[0]}return t},next_weekday_by_week:function(){var t=0;if(0==this.next_hour())return t;if(!this.has_by_data("BYDAY"))return 1;for(;;){var e=new ICAL.Time;this.by_indices.BYDAY++,this.by_indices.BYDAY==Object.keys(this.by_data.BYDAY).length&&(this.by_indices.BYDAY=0,t=1);var n=this.by_data.BYDAY[this.by_indices.BYDAY],r=this.ruleDayOfWeek(n)[1];(r-=this.rule.wkst)<0&&(r+=7),e.year=this.last.year,e.month=this.last.month,e.day=this.last.day;var i=e.startDoyWeek(this.rule.wkst);if(!(r+i<1)||t){var a=ICAL.Time.fromDayOfYear(i+r,this.last.year);return this.last.year=a.year,this.last.month=a.month,this.last.day=a.day,t}}},next_year:function(){if(0==this.next_hour())return 0;if(++this.days_index==this.days.length){this.days_index=0;do{this.increment_year(this.rule.interval),this.expand_year_days(this.last.year)}while(0==this.days.length)}return this._nextByYearDay(),1},_nextByYearDay:function(){var t=this.days[this.days_index],e=this.last.year;t<1&&(t+=1,e+=1);var n=ICAL.Time.fromDayOfYear(t,e);this.last.day=n.day,this.last.month=n.month},ruleDayOfWeek:function(t){var e=t.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);if(e){return[parseInt(e[1]||0,10),t=ICAL.Recur.icalDayToNumericDay(e[2])]}return[0,0]},next_generic:function(t,e,n,r,i){var a=t in this.by_data,s=this.rule.freq==e,o=0;if(i&&0==this[i]())return o;if(a){this.by_indices[t]++;this.by_indices[t];var u=this.by_data[t];this.by_indices[t]==u.length&&(this.by_indices[t]=0,o=1),this.last[n]=u[this.by_indices[t]]}else s&&this["increment_"+n](this.rule.interval);return a&&o&&s&&this["increment_"+r](1),o},increment_monthday:function(t){for(var e=0;e<t;e++){var n=ICAL.Time.daysInMonth(this.last.month,this.last.year);this.last.day++,this.last.day>n&&(this.last.day-=n,this.increment_month())}},increment_month:function(){if(this.last.day=1,this.has_by_data("BYMONTH"))this.by_indices.BYMONTH++,this.by_indices.BYMONTH==this.by_data.BYMONTH.length&&(this.by_indices.BYMONTH=0,this.increment_year(1)),this.last.month=this.by_data.BYMONTH[this.by_indices.BYMONTH];else{"MONTHLY"==this.rule.freq?this.last.month+=this.rule.interval:this.last.month++,this.last.month--;var t=ICAL.helpers.trunc(this.last.month/12);this.last.month%=12,this.last.month++,0!=t&&this.increment_year(t)}},increment_year:function(t){this.last.year+=t},increment_generic:function(t,e,n,r){this.last[e]+=t;var i=ICAL.helpers.trunc(this.last[e]/n);this.last[e]%=n,0!=i&&this["increment_"+r](i)},has_by_data:function(t){return t in this.rule.parts},expand_year_days:function(t){var e=new ICAL.Time;this.days=[];var n={},r=["BYDAY","BYWEEKNO","BYMONTHDAY","BYMONTH","BYYEARDAY"];for(var i in r)if(r.hasOwnProperty(i)){var a=r[i];a in this.rule.parts&&(n[a]=this.rule.parts[a])}if("BYMONTH"in n&&"BYWEEKNO"in n){var s=1,o={};e.year=t,e.isDate=!0;for(var u=0;u<this.by_data.BYMONTH.length;u++){var h=this.by_data.BYMONTH[u];e.month=h,e.day=1;var c=e.weekNumber(this.rule.wkst);e.day=ICAL.Time.daysInMonth(h,t);var l=e.weekNumber(this.rule.wkst);for(u=c;u<l;u++)o[u]=1}for(var d=0;d<this.by_data.BYWEEKNO.length&&s;d++){(U=this.by_data.BYWEEKNO[d])<52?s&=o[d]:s=0}s?delete n.BYMONTH:delete n.BYWEEKNO}var f=Object.keys(n).length;if(0==f){var m=this.dtstart.clone();m.year=this.last.year,this.days.push(m.dayOfYear())}else if(1==f&&"BYMONTH"in n){for(var p in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(p)){var y=this.dtstart.clone();y.year=t,y.month=this.by_data.BYMONTH[p],y.isDate=!0,this.days.push(y.dayOfYear())}}else if(1==f&&"BYMONTHDAY"in n){for(var A in this.by_data.BYMONTHDAY)if(this.by_data.BYMONTHDAY.hasOwnProperty(A)){var C=this.dtstart.clone();if((L=this.by_data.BYMONTHDAY[A])<0){L=L+(T=ICAL.Time.daysInMonth(C.month,t))+1}C.day=L,C.year=t,C.isDate=!0,this.days.push(C.dayOfYear())}}else if(2==f&&"BYMONTHDAY"in n&&"BYMONTH"in n){for(var p in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(p)){var I=this.by_data.BYMONTH[p],T=ICAL.Time.daysInMonth(I,t);for(var A in this.by_data.BYMONTHDAY)if(this.by_data.BYMONTHDAY.hasOwnProperty(A)){var L;(L=this.by_data.BYMONTHDAY[A])<0&&(L=L+T+1),e.day=L,e.month=I,e.year=t,e.isDate=!0,this.days.push(e.dayOfYear())}}}else if(1==f&&"BYWEEKNO"in n);else if(2==f&&"BYWEEKNO"in n&&"BYMONTHDAY"in n);else if(1==f&&"BYDAY"in n)this.days=this.days.concat(this.expand_by_day(t));else if(2==f&&"BYDAY"in n&&"BYMONTH"in n){for(var p in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(p)){h=this.by_data.BYMONTH[p],T=ICAL.Time.daysInMonth(h,t);e.year=t,e.month=this.by_data.BYMONTH[p],e.day=1,e.isDate=!0;var _=e.dayOfWeek(),v=e.dayOfYear()-1;e.day=T;var g=e.dayOfWeek();if(this.has_by_data("BYSETPOS")){for(var D=[],Y=1;Y<=T;Y++)e.day=Y,this.is_day_in_byday(e)&&D.push(Y);for(var b=0;b<D.length;b++)(this.check_set_position(b+1)||this.check_set_position(b-D.length))&&this.days.push(v+D[b])}else for(var O in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(O)){var S,w=this.by_data.BYDAY[O],E=this.ruleDayOfWeek(w),N=E[0],x=E[1],z=(x+7-_)%7+1,B=T-(g+7-x)%7;if(0==N)for(Y=z;Y<=T;Y+=7)this.days.push(v+Y);else N>0?(S=z+7*(N-1))<=T&&this.days.push(v+S):(S=B+7*(N+1))>0&&this.days.push(v+S)}}this.days.sort(function(t,e){return t-e})}else if(2==f&&"BYDAY"in n&&"BYMONTHDAY"in n){var P=this.expand_by_day(t);for(var M in P)if(P.hasOwnProperty(M)){Y=P[M];var k=ICAL.Time.fromDayOfYear(Y,t);this.by_data.BYMONTHDAY.indexOf(k.day)>=0&&this.days.push(Y)}}else if(3==f&&"BYDAY"in n&&"BYMONTHDAY"in n&&"BYMONTH"in n){P=this.expand_by_day(t);for(var M in P)if(P.hasOwnProperty(M)){Y=P[M],k=ICAL.Time.fromDayOfYear(Y,t);this.by_data.BYMONTH.indexOf(k.month)>=0&&this.by_data.BYMONTHDAY.indexOf(k.day)>=0&&this.days.push(Y)}}else if(2==f&&"BYDAY"in n&&"BYWEEKNO"in n){P=this.expand_by_day(t);for(var M in P)if(P.hasOwnProperty(M)){Y=P[M];var U=(k=ICAL.Time.fromDayOfYear(Y,t)).weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(U)&&this.days.push(Y)}}else 3==f&&"BYDAY"in n&&"BYWEEKNO"in n&&"BYMONTHDAY"in n||(this.days=1==f&&"BYYEARDAY"in n?this.days.concat(this.by_data.BYYEARDAY):[]);return 0},expand_by_day:function(t){var e=[],n=this.last.clone();n.year=t,n.month=1,n.day=1,n.isDate=!0;var r=n.dayOfWeek();n.month=12,n.day=31,n.isDate=!0;var i=n.dayOfWeek(),a=n.dayOfYear();for(var s in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(s)){var o=this.by_data.BYDAY[s],u=this.ruleDayOfWeek(o),h=u[0],c=u[1];if(0==h)for(var l=(c+7-r)%7+1;l<=a;l+=7)e.push(l);else if(h>0){var d;d=c>=r?c-r+1:c-r+8,e.push(d+7*(h-1))}else{var f;h=-h,f=c<=i?a-i+c:a-i+c-7,e.push(f-7*(h-1))}}return e},is_day_in_byday:function(t){for(var e in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(e)){var n=this.by_data.BYDAY[e],r=this.ruleDayOfWeek(n),i=r[0],a=r[1],s=t.dayOfWeek();if(0==i&&a==s||t.nthWeekDay(a,i)==t.day)return 1}return 0},check_set_position:function(t){if(this.has_by_data("BYSETPOS")){return-1!==this.by_data.BYSETPOS.indexOf(t)}return!1},sort_byday_rules:function(t,e){for(var n=0;n<t.length;n++)for(var r=0;r<n;r++){var i=this.ruleDayOfWeek(t[r])[1],a=this.ruleDayOfWeek(t[n])[1];if(a-=e,(i-=e)<0&&(i+=7),a<0&&(a+=7),i>a){var s=t[n];t[n]=t[r],t[r]=s}}},check_contract_restriction:function(e,n){var r=t._indexMap[e],i=t._expandMap[this.rule.freq][r],a=!1;if(e in this.by_data&&i==t.CONTRACT){var s=this.by_data[e];for(var o in s)if(s.hasOwnProperty(o)&&s[o]==n){a=!0;break}}else a=!0;return a},check_contracting_rules:function(){var t=this.last.dayOfWeek(),e=this.last.weekNumber(this.rule.wkst),n=this.last.dayOfYear();return this.check_contract_restriction("BYSECOND",this.last.second)&&this.check_contract_restriction("BYMINUTE",this.last.minute)&&this.check_contract_restriction("BYHOUR",this.last.hour)&&this.check_contract_restriction("BYDAY",ICAL.Recur.numericDayToIcalDay(t))&&this.check_contract_restriction("BYWEEKNO",e)&&this.check_contract_restriction("BYMONTHDAY",this.last.day)&&this.check_contract_restriction("BYMONTH",this.last.month)&&this.check_contract_restriction("BYYEARDAY",n)},setup_defaults:function(e,n,r){var i=t._indexMap[e];return t._expandMap[this.rule.freq][i]!=t.CONTRACT&&(e in this.by_data||(this.by_data[e]=[r]),this.rule.freq!=n)?this.by_data[e][0]:r},toJSON:function(){var t=Object.create(null);return t.initialized=this.initialized,t.rule=this.rule.toJSON(),t.dtstart=this.dtstart.toJSON(),t.by_data=this.by_data,t.days=this.days,t.last=this.last.toJSON(),t.by_indices=this.by_indices,t.occurrence_number=this.occurrence_number,t}},t._indexMap={BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8},t._expandMap={SECONDLY:[1,1,1,1,1,1,1,1],MINUTELY:[2,1,1,1,1,1,1,1],HOURLY:[2,2,1,1,1,1,1,1],DAILY:[2,2,2,1,1,1,1,1],WEEKLY:[2,2,2,2,3,3,1,1],MONTHLY:[2,2,2,2,2,3,3,1],YEARLY:[2,2,2,2,2,2,2,2]},t.UNKNOWN=0,t.CONTRACT=1,t.EXPAND=2,t.ILLEGAL=3,t}(),ICAL.RecurExpansion=function(){function t(t){return ICAL.helpers.formatClassType(t,ICAL.Time)}function e(t,e){return t.compare(e)}function n(t){this.ruleDates=[],this.exDates=[],this.fromData(t)}return n.prototype={complete:!1,ruleIterators:null,ruleDates:null,exDates:null,ruleDateInc:0,exDateInc:0,exDate:null,ruleDate:null,dtstart:null,last:null,fromData:function(e){var n=ICAL.helpers.formatClassType(e.dtstart,ICAL.Time);if(!n)throw new Error(".dtstart (ICAL.Time) must be given");if(this.dtstart=n,e.component)this._init(e.component);else{if(this.last=t(e.last)||n.clone(),!e.ruleIterators)throw new Error(".ruleIterators or .component must be given");this.ruleIterators=e.ruleIterators.map(function(t){return ICAL.helpers.formatClassType(t,ICAL.RecurIterator)}),this.ruleDateInc=e.ruleDateInc,this.exDateInc=e.exDateInc,e.ruleDates&&(this.ruleDates=e.ruleDates.map(t),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.exDates&&(this.exDates=e.exDates.map(t),this.exDate=this.exDates[this.exDateInc]),void 0!==e.complete&&(this.complete=e.complete)}},next:function(){for(var t,e,n,r=0;;){if(r++>500)throw new Error("max tries have occured, rule may be impossible to forfill.");if(e=this.ruleDate,t=this._nextRecurrenceIter(this.last),!e&&!t){this.complete=!0;break}if((!e||t&&e.compare(t.last)>0)&&(e=t.last.clone(),t.next()),this.ruleDate===e&&this._nextRuleDay(),this.last=e,!this.exDate||((n=this.exDate.compare(this.last))<0&&this._nextExDay(),0!==n))return this.last;this._nextExDay()}},toJSON:function(){function t(t){return t.toJSON()}var e=Object.create(null);return e.ruleIterators=this.ruleIterators.map(t),this.ruleDates&&(e.ruleDates=this.ruleDates.map(t)),this.exDates&&(e.exDates=this.exDates.map(t)),e.ruleDateInc=this.ruleDateInc,e.exDateInc=this.exDateInc,e.last=this.last.toJSON(),e.dtstart=this.dtstart.toJSON(),e.complete=this.complete,e},_extractDates:function(t,n){function r(t){i=ICAL.helpers.binsearchInsert(a,t,e),a.splice(i,0,t)}for(var i,a=[],s=t.getAllProperties(n),o=s.length,u=0;u<o;u++)s[u].getValues().forEach(r);return a},_init:function(t){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!((n=t).hasProperty("rdate")||n.hasProperty("rrule")||n.hasProperty("recurrence-id")))return this.ruleDate=this.last.clone(),void(this.complete=!0);var n;if(t.hasProperty("rdate")&&(this.ruleDates=this._extractDates(t,"rdate"),this.ruleDates[0]&&this.ruleDates[0].compare(this.dtstart)<0?(this.ruleDateInc=0,this.last=this.ruleDates[0].clone()):this.ruleDateInc=ICAL.helpers.binsearchInsert(this.ruleDates,this.last,e),this.ruleDate=this.ruleDates[this.ruleDateInc]),t.hasProperty("rrule"))for(var r,i=t.getAllProperties("rrule"),a=0,s=i.length;a<s;a++)r=i[a].getFirstValue().iterator(this.dtstart),this.ruleIterators.push(r),r.next();t.hasProperty("exdate")&&(this.exDates=this._extractDates(t,"exdate"),this.exDateInc=ICAL.helpers.binsearchInsert(this.exDates,this.last,e),this.exDate=this.exDates[this.exDateInc])},_nextExDay:function(){this.exDate=this.exDates[++this.exDateInc]},_nextRuleDay:function(){this.ruleDate=this.ruleDates[++this.ruleDateInc]},_nextRecurrenceIter:function(){var t=this.ruleIterators;if(0===t.length)return null;for(var e,n,r,i=t.length,a=0;a<i;a++)n=(e=t[a]).last,e.completed?(i--,0!==a&&a--,t.splice(a,1)):(!r||r.last.compare(n)>0)&&(r=e);return r}},n}(),ICAL.Event=function(){function t(t,e){t instanceof ICAL.Component||(e=t,t=null),this.component=t||new ICAL.Component("vevent"),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],e&&e.strictExceptions&&(this.strictExceptions=e.strictExceptions),e&&e.exceptions?e.exceptions.forEach(this.relateException,this):this.component.parent&&!this.isRecurrenceException()&&this.component.parent.getAllSubcomponents("vevent").forEach(function(t){t.hasProperty("recurrence-id")&&this.relateException(t)},this)}t.prototype={THISANDFUTURE:"THISANDFUTURE",exceptions:null,strictExceptions:!1,relateException:function(t){if(this.isRecurrenceException())throw new Error("cannot relate exception to exceptions");if(t instanceof ICAL.Component&&(t=new ICAL.Event(t)),this.strictExceptions&&t.uid!==this.uid)throw new Error("attempted to relate unrelated exception");var n=t.recurrenceId.toString();if(this.exceptions[n]=t,t.modifiesFuture()){var r=[t.recurrenceId.toUnixTime(),n],i=ICAL.helpers.binsearchInsert(this.rangeExceptions,r,e);this.rangeExceptions.splice(i,0,r)}},modifiesFuture:function(){if(!this.component.hasProperty("recurrence-id"))return!1;return this.component.getFirstProperty("recurrence-id").getParameter("range")===this.THISANDFUTURE},findRangeException:function(t){if(!this.rangeExceptions.length)return null;var n=t.toUnixTime(),r=ICAL.helpers.binsearchInsert(this.rangeExceptions,[n],e);if((r-=1)<0)return null;var i=this.rangeExceptions[r];return n<i[0]?null:i[1]},getOccurrenceDetails:function(t){var e,n=t.toString(),r=t.convertToZone(ICAL.Timezone.utcTimezone).toString(),i={recurrenceId:t};if(n in this.exceptions)e=i.item=this.exceptions[n],i.startDate=e.startDate,i.endDate=e.endDate,i.item=e;else if(r in this.exceptions)e=this.exceptions[r],i.startDate=e.startDate,i.endDate=e.endDate,i.item=e;else{var a,s=this.findRangeException(t);if(s){var o=this.exceptions[s];i.item=o;var u=this._rangeExceptionCache[s];if(!u){var h=o.recurrenceId.clone(),c=o.startDate.clone();h.zone=c.zone,u=c.subtractDate(h),this._rangeExceptionCache[s]=u}var l=t.clone();l.zone=o.startDate.zone,l.addDuration(u),(a=l.clone()).addDuration(o.duration),i.startDate=l,i.endDate=a}else(a=t.clone()).addDuration(this.duration),i.endDate=a,i.startDate=t,i.item=this}return i},iterator:function(t){return new ICAL.RecurExpansion({component:this.component,dtstart:t||this.startDate})},isRecurring:function(){var t=this.component;return t.hasProperty("rrule")||t.hasProperty("rdate")},isRecurrenceException:function(){return this.component.hasProperty("recurrence-id")},getRecurrenceTypes:function(){for(var t=this.component.getAllProperties("rrule"),e=0,n=t.length,r=Object.create(null);e<n;e++){r[t[e].getFirstValue().freq]=!0}return r},get uid(){return this._firstProp("uid")},set uid(t){this._setProp("uid",t)},get startDate(){return this._firstProp("dtstart")},set startDate(t){this._setTime("dtstart",t)},get endDate(){var t=this._firstProp("dtend");if(!t){var e=this._firstProp("duration");t=this.startDate.clone(),e?t.addDuration(e):t.isDate&&(t.day+=1)}return t},set endDate(t){this.component.hasProperty("duration")&&this.component.removeProperty("duration"),this._setTime("dtend",t)},get duration(){var t=this._firstProp("duration");return t||this.endDate.subtractDate(this.startDate)},set duration(t){this.component.hasProperty("dtend")&&this.component.removeProperty("dtend"),this._setProp("duration",t)},get location(){return this._firstProp("location")},set location(t){return this._setProp("location",t)},get attendees(){return this.component.getAllProperties("attendee")},get summary(){return this._firstProp("summary")},set summary(t){this._setProp("summary",t)},get description(){return this._firstProp("description")},set description(t){this._setProp("description",t)},get organizer(){return this._firstProp("organizer")},set organizer(t){this._setProp("organizer",t)},get sequence(){return this._firstProp("sequence")},set sequence(t){this._setProp("sequence",t)},get recurrenceId(){return this._firstProp("recurrence-id")},set recurrenceId(t){this._setProp("recurrence-id",t)},_setTime:function(t,e){var n=this.component.getFirstProperty(t);n||(n=new ICAL.Property(t),this.component.addProperty(n)),e.zone===ICAL.Timezone.localTimezone||e.zone===ICAL.Timezone.utcTimezone?n.removeParameter("tzid"):n.setParameter("tzid",e.zone.tzid),n.setValue(e)},_setProp:function(t,e){this.component.updatePropertyWithValue(t,e)},_firstProp:function(t){return this.component.getFirstPropertyValue(t)},toString:function(){return this.component.toString()}};function e(t,e){return t[0]>e[0]?1:e[0]>t[0]?-1:0}return t}(),ICAL.ComponentParser=function(){function t(t){void 0===t&&(t={});var e;for(e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}return t.prototype={parseEvent:!0,parseTimezone:!0,oncomplete:function(){},onerror:function(t){},ontimezone:function(t){},onevent:function(t){},process:function(t){"string"==typeof t&&(t=ICAL.parse(t)),t instanceof ICAL.Component||(t=new ICAL.Component(t));for(var e,n=t.getAllSubcomponents(),r=0,i=n.length;r<i;r++)switch((e=n[r]).name){case"vtimezone":if(this.parseTimezone){var a=e.getFirstPropertyValue("tzid");a&&this.ontimezone(new ICAL.Timezone({tzid:a,component:e}))}break;case"vevent":this.parseEvent&&this.onevent(new ICAL.Event(e));break;default:continue}this.oncomplete()}},t}();
//# sourceMappingURL=ical.min.js.map