logoichat / static /chunks /d362c049.93b10acb34b885e3.js
charlycop's picture
Upload 131 files
6fa5b70 verified
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[833],{5682:function(t){var e,r,n,i,a;(e=t.exports).foldLength=75,e.newLineChar="\r\n",e.helpers={updateTimezones:function(t){var r,n,i,a,s,o;if(!t||"vcalendar"!==t.name)return t;for(s=0,r=t.getAllSubcomponents(),n=[],i={};s<r.length;s++)"vtimezone"===r[s].name?i[o=r[s].getFirstProperty("tzid").getFirstValue()]=r[s]:n=n.concat(r[s].getAllProperties());for(s=0,a={};s<n.length;s++)(o=n[s].getParameter("tzid"))&&(a[o]=!0);for(s in i)i.hasOwnProperty(s)&&!a[s]&&t.removeSubcomponent(i[s]);for(s in a)a.hasOwnProperty(s)&&!i[s]&&e.TimezoneService.has(s)&&t.addSubcomponent(e.TimezoneService.get(s).component);return t},isStrictlyNaN:function(t){return"number"==typeof t&&isNaN(t)},strictParseInt:function(t){var r=parseInt(t,10);if(e.helpers.isStrictlyNaN(r))throw Error('Could not extract integer from "'+t+'"');return r},formatClassType:function(t,e){return void 0===t?void 0:t instanceof e?t:new e(t)},unescapedIndexOf:function(t,e,r){for(;-1!==(r=t.indexOf(e,r));){if(!(r>0)||"\\"!==t[r-1])return r;r+=1}return -1},binsearchInsert:function(t,e,r){if(!t.length)return 0;for(var n,i,a=0,s=t.length-1;a<=s;)if((i=r(e,t[n=a+Math.floor((s-a)/2)]))<0)s=n-1;else if(i>0)a=n+1;else break;return i<0?n:i>0?n+1:n},dumpn:function(){e.debug&&("undefined"!=typeof console&&"log"in console?e.helpers.dumpn=function(t){console.log(t)}:e.helpers.dumpn=function(t){dump(t+"\n")},e.helpers.dumpn(arguments[0]))},clone:function(t,r){if(!t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if("clone"in t)return t.clone();if(Array.isArray(t)){for(var n=[],i=0;i<t.length;i++)n.push(r?e.helpers.clone(t[i],!0):t[i]);return n}var a={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r?a[s]=e.helpers.clone(t[s],!0):a[s]=t[s]);return a},foldline:function(t){for(var r="",n=t||"",i=0,a=0;n.length;){var s=n.codePointAt(i);s<128?++a:s<2048?a+=2:s<65536?a+=3:a+=4,a<e.foldLength+1?i+=s>65535?2:1:(r+=e.newLineChar+" "+n.substring(0,i),n=n.substring(i),i=a=0)}return r.substr(e.newLineChar.length+1)},pad2:function(t){switch("string"!=typeof t&&("number"==typeof t&&(t=parseInt(t)),t=String(t)),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,r,n){function i(){}i.prototype=t.prototype,r.prototype=new i,n&&e.helpers.extend(n,r.prototype)},extend:function(t,e){for(var r in t){var n=Object.getOwnPropertyDescriptor(t,r);n&&!Object.getOwnPropertyDescriptor(e,r)&&Object.defineProperty(e,r,n)}return e}},e.design=function(){"use strict";var t=/\\\\|\\,|\\[Nn]/g,r=/\\|,|\n/g;function n(t,e){return{matches:/.*/,fromICAL:function(e,r){var n;return n=t,-1===e.indexOf("\\")?e:(r&&(n=RegExp(n.source+"|\\\\"+r)),e.replace(n,m))},toICAL:function(t,r){var n=e;return r&&(n=RegExp(n.source+"|"+r)),t.replace(n,function(t){switch(t){case"\\":return"\\\\";case";":return"\\;";case",":return"\\,";case"\n":return"\\n";default:return t}})}}}var i={defaultType:"text"},a={defaultType:"text",multiValue:","},s={defaultType:"text",structuredValue:";"},o={defaultType:"integer"},u={defaultType:"date-time",allowedTypes:["date-time","date"]},h={defaultType:"date-time"},c={defaultType:"uri"},l={defaultType:"utc-offset"},d={defaultType:"recur"},f={defaultType:"date-and-or-time",allowedTypes:["date-time","date","text"]};function m(t){switch(t){case"\\\\":return"\\";case"\\;":return";";case"\\,":return",";case"\\n":case"\\N":return"\n";default:return t}}var y={categories:a,url:c,version:i,uid:i},T={boolean:{values:["TRUE","FALSE"],fromICAL:function(t){return"TRUE"===t},toICAL:function(t){return t?"TRUE":"FALSE"}},float:{matches:/^[+-]?\d+\.\d+$/,fromICAL:function(t){var r=parseFloat(t);return e.helpers.isStrictlyNaN(r)?0:r},toICAL:function(t){return String(t)}},integer:{fromICAL:function(t){var r=parseInt(t);return e.helpers.isStrictlyNaN(r)?0:r},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 e.UtcOffset.fromString(t)},undecorate:function(t){return t.toString()}}},_=e.helpers.extend(T,{text:n(/\\\\|\\;|\\,|\\[Nn]/g,/\\|;|,|\n/g),uri:{},binary:{decorate:function(t){return e.Binary.fromString(t)},undecorate:function(t){return t.toString()}},"cal-address":{},date:{decorate:function(t,r){return E.strict?e.Time.fromDateString(t,r):e.Time.fromString(t,r)},undecorate:function(t){return t.toString()},fromICAL:function(t){return!E.strict&&t.length>=15?_["date-time"].fromICAL(t):t.substr(0,4)+"-"+t.substr(4,2)+"-"+t.substr(6,2)},toICAL:function(t){var e=t.length;return 10==e?t.substr(0,4)+t.substr(5,2)+t.substr(8,2):e>=19?_["date-time"].toICAL(t):t}},"date-time":{fromICAL:function(t){if(!E.strict&&8==t.length)return _.date.fromICAL(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){var e=t.length;if(10==e&&!E.strict)return _.date.toICAL(t);if(!(e>=19))return t;var r=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]&&(r+="Z"),r},decorate:function(t,r){return E.strict?e.Time.fromDateTimeString(t,r):e.Time.fromString(t,r)},undecorate:function(t){return t.toString()}},duration:{decorate:function(t){return e.Duration.fromString(t)},undecorate:function(t){return t.toString()}},period:{fromICAL:function(t){var r=t.split("/");return r[0]=_["date-time"].fromICAL(r[0]),e.Duration.isValueString(r[1])||(r[1]=_["date-time"].fromICAL(r[1])),r},toICAL:function(t){return E.strict||10!=t[0].length?t[0]=_["date-time"].toICAL(t[0]):t[0]=_.date.toICAL(t[0]),e.Duration.isValueString(t[1])||(E.strict||10!=t[1].length?t[1]=_["date-time"].toICAL(t[1]):t[1]=_.date.toICAL(t[1])),t.join("/")},decorate:function(t,r){return e.Period.fromJSON(t,r,!E.strict)},undecorate:function(t){return t.toJSON()}},recur:{fromICAL:function(t){return e.Recur._stringToData(t,!0)},toICAL:function(t){var r="";for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];"until"==n?i=i.length>10?_["date-time"].toICAL(i):_.date.toICAL(i):"wkst"==n?"number"==typeof i&&(i=e.Recur.numericDayToIcalDay(i)):Array.isArray(i)&&(i=i.join(",")),r+=n.toUpperCase()+"="+i+";"}return r.substr(0,r.length-1)},decorate:function(t){return e.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}}}),v=e.helpers.extend(y,{action:i,attach:{defaultType:"uri"},attendee:{defaultType:"cal-address"},calscale:i,class:i,comment:i,completed:h,contact:i,created:h,description:i,dtend:u,dtstamp:h,dtstart:u,due:u,duration:{defaultType:"duration"},exdate:{defaultType:"date-time",allowedTypes:["date-time","date"],multiValue:","},exrule:d,freebusy:{defaultType:"period",multiValue:","},geo:{defaultType:"float",structuredValue:";"},"last-modified":h,location:i,method:i,organizer:{defaultType:"cal-address"},"percent-complete":o,priority:o,prodid:i,"related-to":i,repeat:o,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":u,resources:a,"request-status":s,rrule:d,sequence:o,status:i,summary:i,transp:i,trigger:{defaultType:"duration",allowedTypes:["duration","date-time"]},tzoffsetfrom:l,tzoffsetto:l,tzurl:c,tzid:i,tzname:i}),g=e.helpers.extend(T,{text:n(t,r),uri:n(t,r),date:{decorate:function(t){return e.VCardTime.fromDateAndOrTimeString(t,"date")},undecorate:function(t){return t.toString()},fromICAL:function(t){return 8==t.length?_.date.fromICAL(t):"-"==t[0]&&6==t.length?t.substr(0,4)+"-"+t.substr(4):t},toICAL:function(t){return 10==t.length?_.date.toICAL(t):"-"==t[0]&&7==t.length?t.substr(0,4)+t.substr(5):t}},time:{decorate:function(t){return e.VCardTime.fromDateAndOrTimeString("T"+t,"time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=g.time._splitZone(t,!0),r=e[0],n=e[1];return 6==n.length?n=n.substr(0,2)+":"+n.substr(2,2)+":"+n.substr(4,2):4==n.length&&"-"!=n[0]?n=n.substr(0,2)+":"+n.substr(2,2):5==n.length&&(n=n.substr(0,3)+":"+n.substr(3,2)),5==r.length&&("-"==r[0]||"+"==r[0])&&(r=r.substr(0,3)+":"+r.substr(3)),n+r},toICAL:function(t){var e=g.time._splitZone(t),r=e[0],n=e[1];return 8==n.length?n=n.substr(0,2)+n.substr(3,2)+n.substr(6,2):5==n.length&&"-"!=n[0]?n=n.substr(0,2)+n.substr(3,2):6==n.length&&(n=n.substr(0,3)+n.substr(4,2)),6==r.length&&("-"==r[0]||"+"==r[0])&&(r=r.substr(0,3)+r.substr(4)),n+r},_splitZone:function(t,e){var r,n,i=t.length-1,a=t.length-(e?5:6),s=t[a];return"Z"==t[i]?(r=t[i],n=t.substr(0,i)):t.length>6&&("-"==s||"+"==s)?(r=t.substr(a),n=t.substr(0,a)):(r="",n=t),[r,n]}},"date-time":{decorate:function(t){return e.VCardTime.fromDateAndOrTimeString(t,"date-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){return g["date-and-or-time"].fromICAL(t)},toICAL:function(t){return g["date-and-or-time"].toICAL(t)}},"date-and-or-time":{decorate:function(t){return e.VCardTime.fromDateAndOrTimeString(t,"date-and-or-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=t.split("T");return(e[0]?g.date.fromICAL(e[0]):"")+(e[1]?"T"+g.time.fromICAL(e[1]):"")},toICAL:function(t){var e=t.split("T");return g.date.toICAL(e[0])+(e[1]?"T"+g.time.toICAL(e[1]):"")}},timestamp:_["date-time"],"language-tag":{matches:/^[a-zA-Z0-9-]+$/}}),D=e.helpers.extend(y,{adr:{defaultType:"text",structuredValue:";",multiValue:","},anniversary:f,bday:f,caladruri:c,caluri:c,clientpidmap:s,email:i,fburl:c,fn:i,gender:s,geo:c,impp:c,key:c,kind:i,lang:{defaultType:"language-tag"},logo:c,member:c,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:a,note:i,org:{defaultType:"text",structuredValue:";"},photo:c,related:c,rev:{defaultType:"timestamp"},role:i,sound:c,source:c,tel:{defaultType:"uri",allowedTypes:["uri","text"]},title:i,tz:{defaultType:"text",allowedTypes:["text","utc-offset","uri"]},xml:i}),Y=e.helpers.extend(T,{binary:_.binary,date:g.date,"date-time":g["date-time"],"phone-number":{},uri:_.uri,text:_.text,time:_.time,vcard:_.text,"utc-offset":{toICAL:function(t){return t.substr(0,7)},fromICAL:function(t){return t.substr(0,7)},decorate:function(t){return e.UtcOffset.fromString(t)},undecorate:function(t){return t.toString()}}}),b=e.helpers.extend(y,{fn:i,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:a,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:i,tel:{defaultType:"phone-number"},email:i,mailer:i,tz:{defaultType:"utc-offset",allowedTypes:["utc-offset","text"]},geo:{defaultType:"float",structuredValue:";"},title:i,role:i,logo:{defaultType:"binary",allowedTypes:["binary","uri"]},agent:{defaultType:"vcard",allowedTypes:["vcard","text","uri"]},org:s,note:a,prodid:i,rev:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(t){return -1===t.indexOf("T")?"date":"date-time"}},"sort-string":i,sound:{defaultType:"binary",allowedTypes:["binary","uri"]},class:i,key:{defaultType:"binary",allowedTypes:["binary","text"]}}),O={value:_,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:["THISANDFUTURE"]},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:v},A={value:g,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:D},S={value:Y,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:b},E={strict:!0,defaultSet:O,defaultType:"unknown",components:{vcard:A,vcard3:S,vevent:O,vtodo:O,vjournal:O,valarm:O,vtimezone:O,daylight:O,standard:O},icalendar:O,vcard:A,vcard3:S,getDesignSet:function(t){return t&&t in E.components?E.components[t]:E.defaultSet}};return E}(),e.stringify=function(){"use strict";var t="unknown",r=e.design,n=e.helpers;function i(t){"string"==typeof t[0]&&(t=[t]);for(var e=0,r=t.length,n="";e<r;e++)n+=i.component(t[e])+"\r\n";return n}i.component=function(t,e){var n=t[0].toUpperCase(),a="BEGIN:"+n+"\r\n",s=t[1],o=0,u=s.length,h=t[0];for("vcard"===h&&t[1].length>0&&!("version"===t[1][0][0]&&"4.0"===t[1][0][3])&&(h="vcard3"),e=e||r.getDesignSet(h);o<u;o++)a+=i.property(s[o],e)+"\r\n";for(var c=t[2]||[],l=0,d=c.length;l<d;l++)a+=i.component(c[l],e)+"\r\n";return a+"END:"+n},i.property=function(n,a,s){var o,u,h=n[0].toUpperCase(),c=n[0],l=n[1],d=h;for(o in l){var f=l[o];if(l.hasOwnProperty(o)){var m=o in a.param&&a.param[o].multiValue;m&&Array.isArray(f)?(a.param[o].multiValueSeparateDQuote&&(m='"'+m+'"'),f=f.map(i._rfc6868Unescape),f=i.multiValue(f,m,"unknown",null,a)):f=i._rfc6868Unescape(f),d+=";"+o.toUpperCase()+"="+i.propertyValue(f)}}if(3===n.length)return d+":";var y=n[2];a||(a=r.defaultSet);var m=!1,T=!1,_=!1;return c in a.property?("multiValue"in(u=a.property[c])&&(m=u.multiValue),"structuredValue"in u&&Array.isArray(n[3])&&(T=u.structuredValue),"defaultType"in u?y===u.defaultType&&(_=!0):y===t&&(_=!0)):y===t&&(_=!0),_||(d+=";VALUE="+y.toUpperCase()),d+=":",m&&T?d+=i.multiValue(n[3],T,y,m,a,T):m?d+=i.multiValue(n.slice(3),m,y,null,a,!1):T?d+=i.multiValue(n[3],T,y,null,a,T):d+=i.value(n[3],y,a,!1),s?d:e.helpers.foldline(d)},i.propertyValue=function(t){return -1===n.unescapedIndexOf(t,",")&&-1===n.unescapedIndexOf(t,":")&&-1===n.unescapedIndexOf(t,";")?t:'"'+t+'"'},i.multiValue=function(t,e,r,n,a,s){for(var o="",u=t.length,h=0;h<u;h++)n&&Array.isArray(t[h])?o+=i.multiValue(t[h],n,r,null,a,s):o+=i.value(t[h],r,a,s),h!==u-1&&(o+=e);return o},i.value=function(t,e,r,n){return e in r.value&&"toICAL"in r.value[e]?r.value[e].toICAL(t,n):t},i._rfc6868Unescape=function(t){return t.replace(/[\n^"]/g,function(t){return a[t]})};var a={'"':"^'","\n":"^n","^":"^^"};return i}(),e.parse=function(){"use strict";var t=/[^ \t]/,r=e.design,n=e.helpers;function i(t){this.message=t,this.name="ParserError";try{throw Error()}catch(t){if(t.stack){var e=t.stack.split("\n");e.shift(),this.stack=e.join("\n")}}}function a(t){var e={},r=e.component=[];if(e.stack=[r],a._eachLine(t,function(t,r){a._handleContentLine(r,e)}),e.stack.length>1)throw new i("invalid ical body. component began but did not end");return e=null,1==r.length?r[0]:r}i.prototype=Error.prototype,a.property=function(t,e){var n={component:[[],[]],designSet:e||r.defaultSet};return a._handleContentLine(t,n),n.component[1][0]},a.component=function(t){return a(t)},a.ParserError=i,a._handleContentLine=function(t,e){var n,s,o,u,h,c,l,d,f=t.indexOf(":"),m=t.indexOf(";"),y={};if(-1!==m&&-1!==f&&m>f&&(m=-1),-1!==m){if(o=t.substring(0,m).toLowerCase(),-1==(h=a._parseParameters(t.substring(m),0,e.designSet))[2])throw new i("Invalid parameters in '"+t+"'");if(y=h[0],n=h[1].length+h[2]+m,-1!==(s=t.substring(n).indexOf(":")))u=t.substring(n+s+1);else throw new i("Missing parameter value in '"+t+"'")}else if(-1!==f){if(o=t.substring(0,f).toLowerCase(),u=t.substring(f+1),"begin"===o){var T=[u.toLowerCase(),[],[]];1===e.stack.length?e.component.push(T):e.component[2].push(T),e.stack.push(e.component),e.component=T,e.designSet||(e.designSet=r.getDesignSet(e.component[0]));return}if("end"===o){e.component=e.stack.pop();return}}else throw new i('invalid line (no token ";" or ":") "'+t+'"');var _=!1,v=!1;o in e.designSet.property&&("multiValue"in(l=e.designSet.property[o])&&(_=l.multiValue),"structuredValue"in l&&(v=l.structuredValue),u&&"detectType"in l&&(c=l.detectType(u))),c||(c="value"in y?y.value.toLowerCase():l?l.defaultType:"unknown"),delete y.value,_&&v?(u=a._parseMultiValue(u,v,c,[],_,e.designSet,v),d=[o,y,c,u]):_?(d=[o,y,c],a._parseMultiValue(u,_,c,d,null,e.designSet,!1)):(u=v?a._parseMultiValue(u,v,c,[],null,e.designSet,v):a._parseValue(u,c,e.designSet,!1),d=[o,y,c,u]),"vcard"!==e.component[0]||0!==e.component[1].length||"version"===o&&"4.0"===u||(e.designSet=r.getDesignSet("vcard3")),e.component[1].push(d)},a._parseValue=function(t,e,r,n){return e in r.value&&"fromICAL"in r.value[e]?r.value[e].fromICAL(t,n):t},a._parseParameters=function(t,e,r){for(var s,o,u,h,c,l,d=e,f=0,m={},y=-1;!1!==f&&-1!==(f=n.unescapedIndexOf(t,"=",f+1));){if(0==(h=t.substr(d+1,f-d-1)).length)throw new i("Empty parameter name in '"+t+"'");if(c=h.toLowerCase(),u=!1,o=!1,s=c in r.param&&r.param[c].valueType?r.param[c].valueType:"text",c in r.param&&(o=r.param[c].multiValue,r.param[c].multiValueSeparateDQuote&&(u=a._rfc6868Escape('"'+o+'"'))),'"'===t[f+1]){if(y=f+2,f=n.unescapedIndexOf(t,'"',y),o&&-1!=f)for(var T=!0;T;)t[f+1]==o&&'"'==t[f+2]?f=n.unescapedIndexOf(t,'"',f+3):T=!1;if(-1===f)throw new i('invalid line (no matching double quote) "'+t+'"');l=t.substr(y,f-y),-1===(d=n.unescapedIndexOf(t,";",f))&&(f=!1)}else{y=f+1;var _=n.unescapedIndexOf(t,";",y),v=n.unescapedIndexOf(t,":",y);-1!==v&&_>v?(_=v,f=!1):-1===_?(_=-1===v?t.length:v,f=!1):(d=_,f=_),l=t.substr(y,_-y)}if(l=a._rfc6868Escape(l),o){var g=u||o;l=a._parseMultiValue(l,g,s,[],null,r)}else l=a._parseValue(l,s,r);o&&c in m?Array.isArray(m[c])?m[c].push(l):m[c]=[m[c],l]:m[c]=l}return[m,l,y]},a._rfc6868Escape=function(t){return t.replace(/\^['n^]/g,function(t){return s[t]})};var s={"^'":'"',"^n":"\n","^^":"^"};return a._parseMultiValue=function(t,e,r,i,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?a._parseMultiValue(h,s,r,[],null,o,u):a._parseValue(h,r,o,u),i.push(h),l=c+e.length;return h=t.substr(l),h=s?a._parseMultiValue(h,s,r,[],null,o,u):a._parseValue(h,r,o,u),i.push(h),1==i.length?i[0]:i},a._eachLine=function(e,r){var n,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])||" "===i?n+=e.substr(o+1,u-o-(a+1)):(n&&r(null,n),n=e.substr(o,u-o-a)),o=u;while(u!==s);(n=n.trim()).length&&r(null,n)},a}(),e.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(){return this.parent&&this.parent._designSet||e.design.getDesignSet(this.name)},_hydrateComponent:function(e){if(this._components||(this._components=[],this._hydratedComponentCount=0),this._components[e])return this._components[e];var r=new t(this.jCal[2][e],this);return this._hydratedComponentCount++,this._components[e]=r},_hydrateProperty:function(t){if(this._properties||(this._properties=[],this._hydratedPropertyCount=0),this._properties[t])return this._properties[t];var r=new e.Property(this.jCal[1][t],this);return this._hydratedPropertyCount++,this._properties[t]=r},getFirstSubcomponent:function(t){if(t){for(var e=0,r=this.jCal[2],n=r.length;e<n;e++)if(r[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,r=0;if(t){for(var n=this.jCal[2],i=[];r<e;r++)t===n[r][0]&&i.push(this._hydrateComponent(r));return i}if(!this._components||this._hydratedComponentCount!==e)for(;r<e;r++)this._hydrateComponent(r);return this._components||[]},hasProperty:function(t){for(var e=this.jCal[1],r=e.length,n=0;n<r;n++)if(e[n][0]===t)return!0;return!1},getFirstProperty:function(t){if(t){for(var e=0,r=this.jCal[1],n=r.length;e<n;e++)if(r[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,r=0;if(t){for(var n=this.jCal[1],i=[];r<e;r++)t===n[r][0]&&i.push(this._hydrateProperty(r));return i}if(!this._properties||this._hydratedPropertyCount!==e)for(;r<e;r++)this._hydrateProperty(r);return this._properties||[]},_removeObjectByIndex:function(t,e,r){if((e=e||[])[r]){var n=e[r];"parent"in n&&(n.parent=null)}e.splice(r,1),this.jCal[t].splice(r,1)},_removeObject:function(t,e,r){var n=0,i=this.jCal[t],a=i.length,s=this[e];if("string"==typeof r){for(;n<a;n++)if(i[n][0]===r)return this._removeObjectByIndex(t,s,n),!0}else if(s){for(;n<a;n++)if(s[n]&&s[n]===r)return this._removeObjectByIndex(t,s,n),!0}return!1},_removeAllObjects:function(t,e,r){for(var n=this[e],i=this.jCal[t],a=i.length-1;a>=0;a--)r&&i[a][0]!==r||this._removeObjectByIndex(t,n,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 e.Property))throw TypeError("must instance of ICAL.Property");this._properties||(this._properties=[],this._hydratedPropertyCount=0),t.parent&&t.parent.removeProperty(t);var r=this.jCal[1].push(t.jCal);return this._properties[r-1]=t,this._hydratedPropertyCount++,t.parent=this,t},addPropertyWithValue:function(t,r){var n=new e.Property(t);return n.setValue(r),this.addProperty(n),n},updatePropertyWithValue:function(t,e){var r=this.getFirstProperty(t);return r?r.setValue(e):r=this.addPropertyWithValue(t,e),r},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 e.stringify.component(this.jCal,this._designSet)}},t.fromString=function(r){return new t(e.parse.component(r))},t}(),e.Property=function(){"use strict";var t=e.design;function r(e,r){this._parent=r||null,"string"==typeof e?(this.jCal=[e,{},t.defaultType],this.jCal[2]=this.getDefaultType()):this.jCal=e,this._updateType()}return r.prototype={get type(){return this.jCal[2]},get name(){return this.jCal[0]},get parent(){return this._parent},set parent(p){var n=!this._parent||p&&p._designSet!=this._parent._designSet;return this._parent=p,this.type==t.defaultType&&n&&(this.jCal[2]=this.getDefaultType(),this._updateType()),p},get _designSet(){return this.parent?this.parent._designSet:t.defaultSet},_updateType:function(){var t=this._designSet;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},getFirstParameter:function(t){var e=this.getParameter(t);return Array.isArray(e)?e[0]:e},setParameter:function(t,e){var r=t.toLowerCase();"string"==typeof e&&r in this._designSet.param&&"multiValue"in this._designSet.param[r]&&(e=[e]),this.jCal[1][t]=e},removeParameter:function(t){delete this.jCal[1][t]},getDefaultType:function(){var e=this.jCal[0],r=this._designSet;if(e in r.property){var n=r.property[e];if("defaultType"in n)return n.defaultType}return t.defaultType},resetType:function(t){this.removeAllValues(),this.jCal[2]=t,this._updateType()},getFirstValue:function(){return this._hydrateValue(0)},getValues:function(){var t=this.jCal.length-3;if(t<1)return[];for(var e=0,r=[];e<t;e++)r[e]=this._hydrateValue(e);return r},removeAllValues:function(){this._values&&(this._values.length=0),this.jCal.length=3},setValues:function(t){if(!this.isMultiValue)throw Error(this.name+": does not not support mulitValue.\noverride isMultiValue");var e=t.length,r=0;if(this.removeAllValues(),e>0&&"object"==typeof t[0]&&"icaltype"in t[0]&&this.resetType(t[0].icaltype),this.isDecorated)for(;r<e;r++)this._setDecoratedValue(t[r],r);else for(;r<e;r++)this.jCal[3+r]=t[r]},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 e.stringify.property(this.jCal,this._designSet,!0)}},r.fromString=function(t,n){return new r(e.parse.property(t,n))},r}(),e.UtcOffset=function(){function t(t){this.fromData(t)}return t.prototype={hours:0,minutes:0,factor:1,icaltype:"utc-offset",clone:function(){return e.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 r=Math.abs(t);return this.factor=t<0?-1:1,this.hours=e.helpers.trunc(r/3600),r-=3600*this.hours,this.minutes=e.helpers.trunc(r/60),this},toSeconds:function(){return this.factor*(60*this.minutes+3600*this.hours)},compare:function(t){var e=this.toSeconds(),r=t.toSeconds();return(e>r)-(r>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 e.design.icalendar.value["utc-offset"].toICAL(this.toString())},toString:function(){return(1==this.factor?"+":"-")+e.helpers.pad2(this.hours)+":"+e.helpers.pad2(this.minutes)}},t.fromString=function(t){var r={};return r.factor="+"===t[0]?1:-1,r.hours=e.helpers.strictParseInt(t.substr(1,2)),r.minutes=e.helpers.strictParseInt(t.substr(4,2)),new e.UtcOffset(r)},t.fromSeconds=function(e){var r=new t;return r.fromSeconds(e),r},t}(),e.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,r,n,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,r=a>>12&63,n=a>>6&63,i=63&a,c[u++]=s.charAt(e)+s.charAt(r)+s.charAt(n)+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,r,n,i,a,s,o,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=0,c=0,l=[];if(!t)return t;t+="";do i=u.indexOf(t.charAt(h++)),e=(o=i<<18|u.indexOf(t.charAt(h++))<<12|(a=u.indexOf(t.charAt(h++)))<<6|(s=u.indexOf(t.charAt(h++))))>>16&255,r=o>>8&255,n=255&o,64==a?l[c++]=String.fromCharCode(e):64==s?l[c++]=String.fromCharCode(e,r):l[c++]=String.fromCharCode(e,r,n);while(h<t.length);return l.join("")},toString:function(){return this.value}},t.fromString=function(e){return new t(e)},t}(),e.Period=function(t){if(this.wrappedJSObject=this,t&&"start"in t){if(t.start&&!(t.start instanceof e.Time))throw TypeError(".start must be an instance of ICAL.Time");this.start=t.start}if(t&&t.end&&t.duration)throw Error("cannot accept both end and duration");if(t&&"end"in t){if(t.end&&!(t.end instanceof e.Time))throw TypeError(".end must be an instance of ICAL.Time");this.end=t.end}if(t&&"duration"in t){if(t.duration&&!(t.duration instanceof e.Duration))throw TypeError(".duration must be an instance of ICAL.Duration");this.duration=t.duration}},e.Period.prototype={start:null,end:null,duration:null,icalclass:"icalperiod",icaltype:"period",clone:function(){return e.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()}},e.Period.fromString=function(t,r){var n=t.split("/");if(2!==n.length)throw Error('Invalid string value: "'+t+'" must contain a "/" char.');var i={start:e.Time.fromDateTimeString(n[0],r)},a=n[1];return e.Duration.isValueString(a)?i.duration=e.Duration.fromString(a):i.end=e.Time.fromDateTimeString(a,r),new e.Period(i)},e.Period.fromData=function(t){return new e.Period(t)},e.Period.fromJSON=function(t,r,n){function i(t,r){return n?e.Time.fromString(t,r):e.Time.fromDateTimeString(t,r)}return e.Duration.isValueString(t[1])?e.Period.fromData({start:i(t[0],r),duration:e.Duration.fromString(t[1])}):e.Period.fromData({start:i(t[0],r),end:i(t[1],r)})},r=/([PDWHMTS]{1,1})/,e.Duration=function(t){this.wrappedJSObject=this,this.fromData(t)},e.Duration.prototype={weeks:0,days:0,hours:0,minutes:0,seconds:0,isNegative:!1,icalclass:"icalduration",icaltype:"duration",clone:function(){return e.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 r=Math.abs(t);return this.isNegative=t<0,this.days=e.helpers.trunc(r/86400),this.days%7==0?(this.weeks=this.days/7,this.days=0):this.weeks=0,r-=(this.days+7*this.weeks)*86400,this.hours=e.helpers.trunc(r/3600),r-=3600*this.hours,this.minutes=e.helpers.trunc(r/60),r-=60*this.minutes,this.seconds=r,this},fromData:function(t){var e=["weeks","days","hours","minutes","seconds","isNegative"];for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];t&&n in t?this[n]=t[n]:this[n]=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(),r=t.toSeconds();return(e>r)-(e<r)},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()}},e.Duration.fromSeconds=function(t){return new e.Duration().fromSeconds(t)},e.Duration.isValueString=function(t){return"P"===t[0]||"P"===t[1]},e.Duration.fromString=function(t){for(var n=0,i=Object.create(null),a=0;-1!==(n=t.search(r));){var s=t[n],o=t.substr(0,n);t=t.substr(n+1),a+=function(t,r,n){var i;switch(t){case"P":r&&"-"===r?n.isNegative=!0:n.isNegative=!1;break;case"D":i="days";break;case"W":i="weeks";break;case"H":i="hours";break;case"M":i="minutes";break;case"S":i="seconds";break;default:return 0}if(i){if(!r&&0!==r)throw Error('invalid duration value: Missing number before "'+t+'"');var a=parseInt(r,10);if(e.helpers.isStrictlyNaN(a))throw Error('invalid duration value: Invalid number "'+r+'" before "'+t+'"');n[i]=a}return 1}(s,o,i)}if(a<2)throw Error('invalid duration value: Not enough duration components in "'+t+'"');return new e.Duration(i)},e.Duration.fromData=function(t){return new e.Duration(t)},n=["tzid","location","tznames","latitude","longitude"],e.Timezone=function(t){this.wrappedJSObject=this,this.fromData(t)},e.Timezone.prototype={tzid:"",location:"",tznames:"",latitude:0,longitude:0,component:null,expandedUntilYear:0,icalclass:"icaltimezone",fromData:function(t){if(this.expandedUntilYear=0,this.changes=[],t instanceof e.Component)this.component=t;else{if(t&&"component"in t){if("string"==typeof t.component){var r=e.parse(t.component);this.component=new e.Component(r)}else t.component instanceof e.Component?this.component=t.component:this.component=null}for(var i in n)if(n.hasOwnProperty(i)){var a=n[i];t&&a in t&&(this[a]=t[a])}}return this.component instanceof e.Component&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue("tzid")),this},utcOffset:function(t){if(this==e.Timezone.utcTimezone||this==e.Timezone.localTimezone||(this._ensureCoverage(t.year),!this.changes.length))return 0;for(var r={year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second},n=this._findNearbyChange(r),i=-1,a=1;;){var s=e.helpers.clone(this.changes[n],!0);if(s.utcOffset<s.prevUtcOffset?e.Timezone.adjust_change(s,0,0,0,s.utcOffset):e.Timezone.adjust_change(s,0,0,0,s.prevUtcOffset),e.Timezone._compare_change_fn(r,s)>=0?i=n:a=-1,-1==a&&-1!=i)break;if((n+=a)<0)return 0;if(n>=this.changes.length)break}var o=this.changes[i];if(o.utcOffset-o.prevUtcOffset<0&&i>0){var u=e.helpers.clone(o,!0);if(e.Timezone.adjust_change(u,0,0,0,u.prevUtcOffset),0>e.Timezone._compare_change_fn(r,u)){var h=this.changes[i-1];!1!=o.is_daylight&&!1==h.is_daylight&&(o=h)}}return o.utcOffset},_findNearbyChange:function(t){var r=e.helpers.binsearchInsert(this.changes,t,e.Timezone._compare_change_fn);return r>=this.changes.length?this.changes.length-1:r},_ensureCoverage:function(t){if(-1==e.Timezone._minimumExpansionYear){var r=e.Time.now();e.Timezone._minimumExpansionYear=r.year}var n=t;if(n<e.Timezone._minimumExpansionYear&&(n=e.Timezone._minimumExpansionYear),(n+=e.Timezone.EXTRA_COVERAGE)>e.Timezone.MAX_YEAR&&(n=e.Timezone.MAX_YEAR),!this.changes.length||this.expandedUntilYear<t){for(var i=this.component.getAllSubcomponents(),a=i.length,s=0;s<a;s++)this._expandComponent(i[s],n,this.changes);this.changes.sort(e.Timezone._compare_change_fn),this.expandedUntilYear=n}},_expandComponent:function(t,r,n){if(!t.hasProperty("dtstart")||!t.hasProperty("tzoffsetto")||!t.hasProperty("tzoffsetfrom"))return null;var 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();(l=s()).year=h.year,l.month=h.month,l.day=h.day,h.isDate?(l.hour=i.hour,l.minute=i.minute,l.second=i.second,i.zone!=e.Timezone.utcTimezone&&e.Timezone.adjust_change(l,0,0,0,-l.prevUtcOffset)):(l.hour=h.hour,l.minute=h.minute,l.second=h.second,h.zone!=e.Timezone.utcTimezone&&e.Timezone.adjust_change(l,0,0,0,-l.prevUtcOffset)),n.push(l)}var c=t.getFirstProperty("rrule");if(c){c=c.getFirstValue(),l=s(),c.until&&c.until.zone==e.Timezone.utcTimezone&&(c.until.adjust(0,0,0,l.prevUtcOffset),c.until.zone=e.Timezone.localTimezone);for(var l,d,f=c.iterator(i);(d=f.next())&&(l=s(),!(d.year>r)&&d);)l.year=d.year,l.month=d.month,l.day=d.day,l.hour=d.hour,l.minute=d.minute,l.second=d.second,l.isDate=d.isDate,e.Timezone.adjust_change(l,0,0,0,-l.prevUtcOffset),n.push(l)}}else(l=s()).year=i.year,l.month=i.month,l.day=i.day,l.hour=i.hour,l.minute=i.minute,l.second=i.second,e.Timezone.adjust_change(l,0,0,0,-l.prevUtcOffset),n.push(l);return n},toString:function(){return this.tznames?this.tznames:this.tzid}},e.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},e.Timezone.convert_time=function(t,r,n){if(t.isDate||r.tzid==n.tzid||r==e.Timezone.localTimezone||n==e.Timezone.localTimezone)return t.zone=n,t;var i=r.utcOffset(t);return t.adjust(0,0,0,-i),i=n.utcOffset(t),t.adjust(0,0,0,i),null},e.Timezone.fromData=function(t){return new e.Timezone().fromData(t)},e.Timezone.utcTimezone=e.Timezone.fromData({tzid:"UTC"}),e.Timezone.localTimezone=e.Timezone.fromData({tzid:"floating"}),e.Timezone.adjust_change=function(t,r,n,i,a){return e.Time.prototype.adjust.call(t,r,n,i,a,t)},e.Timezone._minimumExpansionYear=-1,e.Timezone.MAX_YEAR=2035,e.Timezone.EXTRA_COVERAGE=5,e.TimezoneService=((a={get count(){return Object.keys(i).length},reset:function(){i=Object.create(null);var t=e.Timezone.utcTimezone;i.Z=t,i.UTC=t,i.GMT=t},has:function(t){return!!i[t]},get:function(t){return i[t]},register:function(t,r){if(t instanceof e.Component&&"vtimezone"===t.name&&(t=(r=new e.Timezone(t)).tzid),r instanceof e.Timezone)i[t]=r;else throw TypeError("timezone must be ICAL.Timezone or ICAL.Component")},remove:function(t){return delete i[t]}}).reset(),a),e.Time=function(t,e){this.wrappedJSObject=this;var r=this._time=Object.create(null);r.year=0,r.month=1,r.day=1,r.hour=0,r.minute=0,r.second=0,r.isDate=!1,this.fromData(t,e)},e.Time._dowCache={},e.Time._wnCache={},e.Time.prototype={icalclass:"icaltime",_cachedUnixTime:null,get icaltype(){return this.isDate?"date":"date-time"},zone:null,_pendingNormalization:!1,clone:function(){return new e.Time(this._time,this.zone)},reset:function(){this.fromData(e.Time.epochTime),this.zone=e.Timezone.utcTimezone},resetTo:function(t,e,r,n,i,a,s){this.fromData({year:t,month:e,day:r,hour:n,minute:i,second:a,zone:s})},fromJSDate:function(t,r){return t?r?(this.zone=e.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=e.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,r){if(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if("icaltype"===n)continue;this[n]=t[n]}}if(r&&(this.zone=r),!t||"isDate"in t?t&&"isDate"in t&&(this.isDate=t.isDate):this.isDate=!("hour"in t),t&&"timezone"in t){var i=e.TimezoneService.get(t.timezone);this.zone=i||e.Timezone.localTimezone}return t&&"zone"in t&&(this.zone=t.zone),this.zone||(this.zone=e.Timezone.localTimezone),this._cachedUnixTime=null,this},dayOfWeek:function(t){var r=t||e.Time.SUNDAY,n=(this.year<<12)+(this.month<<8)+(this.day<<3)+r;if(n in e.Time._dowCache)return e.Time._dowCache[n];var i=this.day,a=this.month+(this.month<3?12:0),s=this.year-(this.month<3?1:0),o=i+s+e.helpers.trunc((a+1)*26/10)+e.helpers.trunc(s/4);return o+=6*e.helpers.trunc(s/100)+e.helpers.trunc(s/400),o=(o+7-r)%7+1,e.Time._dowCache[n]=o,o},dayOfYear:function(){var t=e.Time.isLeapYear(this.year)?1:0;return e.Time.daysInYearPassedMonth[t][this.month-1]+this.day},startOfWeek:function(t){var r=t||e.Time.SUNDAY,n=this.clone();return n.day-=(this.dayOfWeek()+7-r)%7,n.isDate=!0,n.hour=0,n.minute=0,n.second=0,n},endOfWeek:function(t){var r=t||e.Time.SUNDAY,n=this.clone();return n.day+=(7-this.dayOfWeek()+r-e.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=e.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 r=t||e.Time.SUNDAY,n=this.dayOfWeek()-r;return n<0&&(n+=7),this.dayOfYear()-n},getDominicalLetter:function(){return e.Time.getDominicalLetter(this.year)},nthWeekDay:function(t,r){var n,i=e.Time.daysInMonth(this.month,this.year),a=r,s=0,o=this.clone();if(a>=0){o.day=1,0!=a&&a--,s=o.day;var u=t-o.dayOfWeek();u<0&&(u+=7),s+=u,s-=t,n=t}else{o.day=i;var h=o.dayOfWeek();a++,(n=h-t)<0&&(n+=7),n=i-n}return s+(n+=7*a)},isNthWeekDay:function(t,e){var r=this.dayOfWeek();return 0===e&&r===t||this.nthWeekDay(t,e)===this.day},weekNumber:function(t){var r,n=(this.year<<12)+(this.month<<8)+(this.day<<3)+t;if(n in e.Time._wnCache)return e.Time._wnCache[n];var i=this.clone();i.isDate=!0;var a=this.year;12==i.month&&i.day>25?(r=e.Time.weekOneStarts(a+1,t),0>i.compare(r)?r=e.Time.weekOneStarts(a,t):a++):(r=e.Time.weekOneStarts(a,t),0>i.compare(r)&&(r=e.Time.weekOneStarts(--a,t)));var s=i.subtractDate(r).toSeconds()/86400,o=e.helpers.trunc(s/7)+1;return e.Time._wnCache[n]=o,o},addDuration:function(t){var e=t.isNegative?-1:1,r=this.second,n=this.minute,i=this.hour,a=this.day;r+=e*t.seconds,n+=e*t.minutes,i+=e*t.hours,a+=e*t.days+7*e*t.weeks,this.second=r,this.minute=n,this.hour=i,this.day=a,this._cachedUnixTime=null},subtractDate:function(t){var r=this.toUnixTime()+this.utcOffset(),n=t.toUnixTime()+t.utcOffset();return e.Duration.fromSeconds(r-n)},subtractDateTz:function(t){var r=this.toUnixTime(),n=t.toUnixTime();return e.Duration.fromSeconds(r-n)},compare:function(t){var e=this.toUnixTime(),r=t.toUnixTime();return e>r?1:r>e?-1:0},compareDateOnlyTz:function(t,r){function n(t){return e.Time._cmp_attr(i,a,t)}var i=this.convertToZone(r),a=t.convertToZone(r),s=0;return 0!=(s=n("year"))||0!=(s=n("month"))?s:s=n("day")},convertToZone:function(t){var r=this.clone(),n=this.zone.tzid==t.tzid;return this.isDate||n||e.Timezone.convert_time(r,this.zone,t),r.zone=t,r},utcOffset:function(){return this.zone==e.Timezone.localTimezone||this.zone==e.Timezone.utcTimezone?0:this.zone.utcOffset(this)},toICALString:function(){var t=this.toString();return t.length>10?e.design.icalendar.value["date-time"].toICAL(t):e.design.icalendar.value.date.toICAL(t)},toString:function(){var t=this.year+"-"+e.helpers.pad2(this.month)+"-"+e.helpers.pad2(this.day);return this.isDate||(t+="T"+e.helpers.pad2(this.hour)+":"+e.helpers.pad2(this.minute)+":"+e.helpers.pad2(this.second),this.zone!==e.Timezone.utcTimezone||(t+="Z")),t},toJSDate:function(){return this.zone!=e.Timezone.localTimezone?new Date(1e3*this.toUnixTime()):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)},_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,r,n,i,a){var s,o,u,h,c,l,d,f=0,m=0,y=a||this._time;if(!y.isDate&&(s=y.second+i,y.second=s%60,l=e.helpers.trunc(s/60),y.second<0&&(y.second+=60,l--),o=y.minute+n+l,y.minute=o%60,d=e.helpers.trunc(o/60),y.minute<0&&(y.minute+=60,d--),u=y.hour+r+d,y.hour=u%24,f=e.helpers.trunc(u/24),y.hour<0&&(y.hour+=24,f--)),y.month>12?m=e.helpers.trunc((y.month-1)/12):y.month<1&&(m=e.helpers.trunc(y.month/12)-1),y.year+=m,y.month-=12*m,(h=y.day+t+f)>0)for(;!(h<=(c=e.Time.daysInMonth(y.month,y.year)));)y.month++,y.month>12&&(y.year++,y.month=1),h-=c;else for(;h<=0;)1==y.month?(y.year--,y.month=12):y.month--,h+=e.Time.daysInMonth(y.month,y.year);return y.day=h,this._cachedUnixTime=null,this},fromUnixTime:function(t){this.zone=e.Timezone.utcTimezone;var r=e.Time.epochTime.clone();r.adjust(0,0,0,t),this.year=r.year,this.month=r.month,this.day=r.day,this.hour=r.hour,this.minute=r.minute,this.second=Math.floor(r.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"],r=Object.create(null),n=0,i=e.length;n<i;n++)r[t=e[n]]=this[t];return this.zone&&(r.timezone=this.zone.tzid),r}},function(){function t(t){Object.defineProperty(e.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"))}(),e.Time.daysInMonth=function(t,r){var n=30;return t<1||t>12||(n=[0,31,28,31,30,31,30,31,31,30,31,30,31][t],2==t&&(n+=e.Time.isLeapYear(r))),n},e.Time.isLeapYear=function(t){return t<=1752?t%4==0:t%4==0&&t%100!=0||t%400==0},e.Time.fromDayOfYear=function(t,r){var n=r,i=t,a=new e.Time;a.auto_normalize=!1;var s=e.Time.isLeapYear(n)?1:0;if(i<1)return n--,s=e.Time.isLeapYear(n)?1:0,i+=e.Time.daysInYearPassedMonth[s][12],e.Time.fromDayOfYear(i,n);if(i>e.Time.daysInYearPassedMonth[s][12])return s=e.Time.isLeapYear(n)?1:0,i-=e.Time.daysInYearPassedMonth[s][12],n++,e.Time.fromDayOfYear(i,n);a.year=n,a.isDate=!0;for(var o=11;o>=0;o--)if(i>e.Time.daysInYearPassedMonth[s][o]){a.month=o+1,a.day=i-e.Time.daysInYearPassedMonth[s][o];break}return a.auto_normalize=!0,a},e.Time.fromStringv2=function(t){return new e.Time({year:parseInt(t.substr(0,4),10),month:parseInt(t.substr(5,2),10),day:parseInt(t.substr(8,2),10),isDate:!0})},e.Time.fromDateString=function(t){return new e.Time({year:e.helpers.strictParseInt(t.substr(0,4)),month:e.helpers.strictParseInt(t.substr(5,2)),day:e.helpers.strictParseInt(t.substr(8,2)),isDate:!0})},e.Time.fromDateTimeString=function(t,r){var n;if(t.length<19)throw Error('invalid date-time value: "'+t+'"');return t[19]&&"Z"===t[19]?n="Z":r&&(n=r.getParameter("tzid")),new e.Time({year:e.helpers.strictParseInt(t.substr(0,4)),month:e.helpers.strictParseInt(t.substr(5,2)),day:e.helpers.strictParseInt(t.substr(8,2)),hour:e.helpers.strictParseInt(t.substr(11,2)),minute:e.helpers.strictParseInt(t.substr(14,2)),second:e.helpers.strictParseInt(t.substr(17,2)),timezone:n})},e.Time.fromString=function(t,r){return t.length>10?e.Time.fromDateTimeString(t,r):e.Time.fromDateString(t)},e.Time.fromJSDate=function(t,r){return new e.Time().fromJSDate(t,r)},e.Time.fromData=function(t,r){return new e.Time().fromData(t,r)},e.Time.now=function(){return e.Time.fromJSDate(new Date,!1)},e.Time.weekOneStarts=function(t,r){var n=e.Time.fromData({year:t,month:1,day:1,isDate:!0}),i=n.dayOfWeek(),a=r||e.Time.DEFAULT_WEEK_START;return i>e.Time.THURSDAY&&(n.day+=7),a>e.Time.THURSDAY&&(n.day-=7),n.day-=i-a,n},e.Time.getDominicalLetter=function(t){var r="GFEDCBA",n=(t+(t/4|0)+(t/400|0)-(t/100|0)-1)%7;return e.Time.isLeapYear(t)?r[(n+6)%7]+r[n]:r[n]},e.Time.epochTime=e.Time.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:"Z"}),e.Time._cmp_attr=function(t,e,r){return t[r]>e[r]?1:t[r]<e[r]?-1:0},e.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]],e.Time.SUNDAY=1,e.Time.MONDAY=2,e.Time.TUESDAY=3,e.Time.WEDNESDAY=4,e.Time.THURSDAY=5,e.Time.FRIDAY=6,e.Time.SATURDAY=7,e.Time.DEFAULT_WEEK_START=e.Time.MONDAY,e.VCardTime=function(t,e,r){this.wrappedJSObject=this;var n=this._time=Object.create(null);n.year=null,n.month=null,n.day=null,n.hour=null,n.minute=null,n.second=null,this.icaltype=r||"date-and-or-time",this.fromData(t,e)},e.helpers.inherits(e.Time,e.VCardTime,{icalclass:"vcardtime",icaltype:"date-and-or-time",zone:null,clone:function(){return new e.VCardTime(this._time,this.zone,this.icaltype)},_normalize:function(){return this},utcOffset:function(){return this.zone instanceof e.UtcOffset?this.zone.toSeconds():e.Time.prototype.utcOffset.apply(this,arguments)},toICALString:function(){return e.design.vcard.value[this.icaltype].toICAL(this.toString())},toString:function(){var t,r=e.helpers.pad2,n=this.year,i=this.month,a=this.day,s=this.hour,o=this.minute,u=this.second,h=null!==i,c=null!==a,l=null!==s,d=null!==o,f=null!==u,m=(null!==n?r(n)+(h||c?"-":""):h||c?"--":"")+(h?r(i):"")+(c?"-"+r(a):""),y=(l?r(s):"-")+(l&&d?":":"")+(d?r(o):"")+(l||d?"":"-")+(d&&f?":":"")+(f?r(u):"");switch(t=this.zone===e.Timezone.utcTimezone?"Z":this.zone instanceof e.UtcOffset?this.zone.toString():this.zone===e.Timezone.localTimezone?"":this.zone instanceof e.Timezone?e.UtcOffset.fromSeconds(this.zone.utcOffset(this)).toString():"",this.icaltype){case"time":return y+t;case"date-and-or-time":case"date-time":return m+("--"==y?"":"T"+y+t);case"date":return m}return null}}),e.VCardTime.fromDateAndOrTimeString=function(t,r){function n(t,r,n){return t?e.helpers.strictParseInt(t.substr(r,n)):null}var i=t.split("T"),a=i[0],s=i[1],o=s?e.design.vcard.value.time._splitZone(s):[],u=o[0],h=o[1];e.helpers.strictParseInt;var c=a?a.length:0,l=h?h.length:0,d=a&&"-"==a[0]&&"-"==a[1],f=h&&"-"==h[0],m={year:d?null:n(a,0,4),month:d&&(4==c||7==c)?n(a,2,2):7==c?n(a,5,2):10==c?n(a,5,2):null,day:5==c?n(a,3,2):7==c&&d?n(a,5,2):10==c?n(a,8,2):null,hour:f?null:n(h,0,2),minute:f&&3==l?n(h,1,2):l>4?n(h,f?1:3,2):null,second:4==l?n(h,2,2):6==l?n(h,4,2):8==l?n(h,6,2):null};return u="Z"==u?e.Timezone.utcTimezone:u&&":"==u[3]?e.UtcOffset.fromString(u):null,new e.VCardTime(m,u,r)},function(){var t={SU:e.Time.SUNDAY,MO:e.Time.MONDAY,TU:e.Time.TUESDAY,WE:e.Time.WEDNESDAY,TH:e.Time.THURSDAY,FR:e.Time.FRIDAY,SA:e.Time.SATURDAY},r={};for(var n in t)t.hasOwnProperty(n)&&(r[t[n]]=n);function i(t,r,n,i){var a=i;if("+"===i[0]&&(a=i.substr(1)),a=e.helpers.strictParseInt(a),void 0!==r&&i<r)throw Error(t+': invalid value "'+i+'" must be > '+r);if(void 0!==n&&i>n)throw Error(t+': invalid value "'+i+'" must be < '+r);return a}e.Recur=function(t){this.wrappedJSObject=this,this.parts={},t&&"object"==typeof t&&this.fromData(t)},e.Recur.prototype={parts:null,interval:1,wkst:e.Time.MONDAY,until:null,count:null,freq:null,icalclass:"icalrecur",icaltype:"recur",iterator:function(t){return new e.RecurIterator({rule:this,dtstart:t})},clone:function(){return new e.Recur(this.toJSON())},isFinite:function(){return!!(this.count||this.until)},isByCount:function(){return!!(this.count&&!this.until)},addComponent:function(t,e){var r=t.toUpperCase();r in this.parts?this.parts[r].push(e):this.parts[r]=[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 r,n=this.iterator(t);do r=n.next();while(r&&0>=r.compare(e));return r&&e.zone&&(r.zone=e.zone),r},fromData:function(t){for(var r in t){var n=r.toUpperCase();n in h?Array.isArray(t[r])?this.parts[n]=t[r]:this.parts[n]=[t[r]]:this[r]=t[r]}this.interval&&"number"!=typeof this.interval&&u.INTERVAL(this.interval,this),this.wkst&&"number"!=typeof this.wkst&&(this.wkst=e.Recur.icalDayToNumericDay(this.wkst)),!this.until||this.until instanceof e.Time||(this.until=e.Time.fromString(this.until))},toJSON:function(){var t=Object.create(null);for(var r in t.freq=this.freq,this.count&&(t.count=this.count),this.interval>1&&(t.interval=this.interval),this.parts)if(this.parts.hasOwnProperty(r)){var n=this.parts[r];Array.isArray(n)&&1==n.length?t[r.toLowerCase()]=n[0]:t[r.toLowerCase()]=e.helpers.clone(this.parts[r])}return this.until&&(t.until=this.until.toString()),"wkst"in this&&this.wkst!==e.Time.DEFAULT_WEEK_START&&(t.wkst=e.Recur.numericDayToIcalDay(this.wkst)),t},toString:function(){var t="FREQ="+this.freq;for(var r in this.count&&(t+=";COUNT="+this.count),this.interval>1&&(t+=";INTERVAL="+this.interval),this.parts)this.parts.hasOwnProperty(r)&&(t+=";"+r+"="+this.parts[r]);return this.until&&(t+=";UNTIL="+this.until.toICALString()),"wkst"in this&&this.wkst!==e.Time.DEFAULT_WEEK_START&&(t+=";WKST="+e.Recur.numericDayToIcalDay(this.wkst)),t}},e.Recur.icalDayToNumericDay=function(r,n){var i=n||e.Time.SUNDAY;return(t[r]-i+7)%7+1},e.Recur.numericDayToIcalDay=function(t,n){var i=t+(n||e.Time.SUNDAY)-e.Time.SUNDAY;return i>7&&(i-=7),r[i]};var a=/^(SU|MO|TU|WE|TH|FR|SA)$/,s=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,o=["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],u={FREQ:function(t,e,r){if(-1!==o.indexOf(t))e.freq=t;else throw Error('invalid frequency "'+t+'" expected: "'+o.join(", ")+'"')},COUNT:function(t,r,n){r.count=e.helpers.strictParseInt(t)},INTERVAL:function(t,r,n){r.interval=e.helpers.strictParseInt(t),r.interval<1&&(r.interval=1)},UNTIL:function(t,r,n){t.length>10?r.until=e.design.icalendar.value["date-time"].fromICAL(t):r.until=e.design.icalendar.value.date.fromICAL(t),n||(r.until=e.Time.fromString(r.until))},WKST:function(t,r,n){if(a.test(t))r.wkst=e.Recur.icalDayToNumericDay(t);else throw Error('invalid WKST value "'+t+'"')}},h={BYSECOND:i.bind(this,"BYSECOND",0,60),BYMINUTE:i.bind(this,"BYMINUTE",0,59),BYHOUR:i.bind(this,"BYHOUR",0,23),BYDAY:function(t){if(s.test(t))return t;throw Error('invalid BYDAY value "'+t+'"')},BYMONTHDAY:i.bind(this,"BYMONTHDAY",-31,31),BYYEARDAY:i.bind(this,"BYYEARDAY",-366,366),BYWEEKNO:i.bind(this,"BYWEEKNO",-53,53),BYMONTH:i.bind(this,"BYMONTH",1,12),BYSETPOS:i.bind(this,"BYSETPOS",-366,366)};e.Recur.fromString=function(t){var r=e.Recur._stringToData(t,!1);return new e.Recur(r)},e.Recur.fromData=function(t){return new e.Recur(t)},e.Recur._stringToData=function(t,e){for(var r=Object.create(null),n=t.split(";"),i=n.length,a=0;a<i;a++){var s=n[a].split("="),o=s[0].toUpperCase(),c=s[0].toLowerCase(),l=e?c:o,d=s[1];if(o in h){for(var f=d.split(","),m=0,y=f.length;m<y;m++)f[m]=h[o](f[m]);r[l]=1==f.length?f[0]:f}else o in u?u[o](d,r,e):r[c]=d}return r}}(),e.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=e.helpers.formatClassType(t.rule,e.Recur),!this.rule)throw Error("iterator requires a (ICAL.Recur) rule");if(this.dtstart=e.helpers.formatClassType(t.dtstart,e.Time),!this.dtstart)throw Error("iterator requires a (ICAL.Time) dtstart");t.by_data?this.by_data=t.by_data:this.by_data=e.helpers.clone(this.rule.parts,!0),t.occurrence_number&&(this.occurrence_number=t.occurrence_number),this.days=t.days||[],t.last&&(this.last=e.helpers.formatClassType(t.last,e.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),"BYYEARDAY"in t&&("BYMONTH"in t||"BYWEEKNO"in t||"BYMONTHDAY"in t||"BYDAY"in t))throw Error("Invalid BYYEARDAY rule");if("BYWEEKNO"in t&&"BYMONTHDAY"in t)throw Error("BYWEEKNO does not fit to BYMONTHDAY");if("MONTHLY"==this.rule.freq&&("BYYEARDAY"in t||"BYWEEKNO"in t))throw Error("For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear");if("WEEKLY"==this.rule.freq&&("BYYEARDAY"in t||"BYMONTHDAY"in t))throw Error("For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear");if("YEARLY"!=this.rule.freq&&"BYYEARDAY"in t)throw 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 r=this.ruleDayOfWeek(t.BYDAY[0],this.rule.wkst),n=r[0],i=r[1],a=i-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)<i&&a>=0||a<0)&&(this.last.day+=a)}else{var s=e.Recur.numericDayToIcalDay(this.dtstart.dayOfWeek());t.BYDAY=[s]}}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 o=null,u=this.last.clone(),h=e.Time.daysInMonth(this.last.month,this.last.year);for(var c in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(c)){this.last=u.clone();var r=this.ruleDayOfWeek(this.by_data.BYDAY[c]),n=r[0],i=r[1],l=this.last.nthWeekDay(i,n);if(n>=6||n<=-6)throw Error("Malformed values in BYDAY part");if(l>h||l<=0){if(o&&o.month==u.month)continue;for(;l>h||l<=0;)this.increment_month(),h=e.Time.daysInMonth(this.last.month,this.last.year),l=this.last.nthWeekDay(i,n)}this.last.day=l,(!o||0>this.last.compare(o))&&(o=this.last.clone())}if(this.last=o.clone(),this.has_by_data("BYMONTHDAY")&&this._byDayAndMonthDay(!0),this.last.day>h||0==this.last.day)throw Error("Malformed values in BYDAY part")}else if(this.has_by_data("BYMONTHDAY")&&this.last.day<0){var h=e.Time.daysInMonth(this.last.month,this.last.year);this.last.day=h+this.last.day+1}},next:function(){var t,e=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;do switch(t=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":t=this.next_month();break;case"YEARLY":this.next_year();break;default:return null}while(!this.check_contracting_rules()||0>this.last.compare(this.dtstart)||!t);if(0==this.last.compare(e))throw 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()||(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,r,n){for(var i,a=e.Time.daysInMonth(r,t),s=[],o=0,u=n.length;o<u;o++)if(!(Math.abs(i=n[o])>a)){if(i<0)i=a+(i+1);else if(0===i)continue;-1===s.indexOf(i)&&s.push(i)}return s.sort(function(t,e){return t-e})},_byDayAndMonthDay:function(t){var r,n,i,a,s=this.by_data.BYDAY,o=0,u=s.length,h=0,c=this,l=this.last.day;function d(){for(a=e.Time.daysInMonth(c.last.month,c.last.year),i=(r=c.normalizeByMonthDayRules(c.last.year,c.last.month,c.by_data.BYMONTHDAY)).length;r[o]<=l&&!(t&&r[o]==l)&&o<i-1;)o++}function f(){l=0,c.increment_month(),o=0,d()}d(),t&&(l-=1);for(var m=48;!h&&m;){if(m--,(n=l+1)>a){f();continue}var y=r[o++];if(y>=n)l=y;else{f();continue}for(var T=0;T<u;T++){var _=this.ruleDayOfWeek(s[T]),v=_[0],g=_[1];if(this.last.day=l,this.last.isNthWeekDay(g,v)){h=1;break}}if(!h&&o===i){f();continue}}if(m<=0)throw Error("Malformed values in BYDAY combined with BYMONTHDAY parts");return h},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 r=e.Time.daysInMonth(this.last.month,this.last.year),n=0,i=0;if(this.has_by_data("BYSETPOS")){for(var a=this.last.day,s=1;s<=r;s++)this.last.day=s,this.is_day_in_byday(this.last)&&(i++,s<=a&&n++);this.last.day=a}t=0;for(var s=this.last.day+1;s<=r;s++)if(this.last.day=s,this.is_day_in_byday(this.last)&&(!this.has_by_data("BYSETPOS")||this.check_set_position(++n)||this.check_set_position(n-i-1))){t=1;break}s>r&&(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());var r=e.Time.daysInMonth(this.last.month,this.last.year),s=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY];s<0&&(s=r+s+1),s>r?(this.last.day=1,t=this.is_day_in_byday(this.last)):this.last.day=s}else{this.increment_month();var r=e.Time.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>r?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 r=new e.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],i=this.ruleDayOfWeek(n)[1];(i-=this.rule.wkst)<0&&(i+=7),r.year=this.last.year,r.month=this.last.month,r.day=this.last.day;var a=r.startDoyWeek(this.rule.wkst);if(!(i+a<1)||t){var s=e.Time.fromDayOfYear(a+i,this.last.year);return this.last.year=s.year,this.last.month=s.month,this.last.day=s.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],r=this.last.year;t<1&&(t+=1,r+=1);var n=e.Time.fromDayOfYear(t,r);this.last.day=n.day,this.last.month=n.month},ruleDayOfWeek:function(t,r){var n=t.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);return n?[parseInt(n[1]||0,10),t=e.Recur.icalDayToNumericDay(n[2],r)]:[0,0]},next_generic:function(t,e,r,n,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[r]=u[this.by_indices[t]]}else s&&this["increment_"+r](this.rule.interval);return a&&o&&s&&this["increment_"+n](1),o},increment_monthday:function(t){for(var r=0;r<t;r++){var n=e.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=e.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,r,n,i){this.last[r]+=t;var a=e.helpers.trunc(this.last[r]/n);this.last[r]%=n,0!=a&&this["increment_"+i](a)},has_by_data:function(t){return t in this.rule.parts},expand_year_days:function(t){var r=new e.Time;this.days=[];var n={},i=["BYDAY","BYWEEKNO","BYMONTHDAY","BYMONTH","BYYEARDAY"];for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];s in this.rule.parts&&(n[s]=this.rule.parts[s])}if("BYMONTH"in n&&"BYWEEKNO"in n){var o=1,u={};r.year=t,r.isDate=!0;for(var h=0;h<this.by_data.BYMONTH.length;h++){var c=this.by_data.BYMONTH[h];r.month=c,r.day=1;var l=r.weekNumber(this.rule.wkst);r.day=e.Time.daysInMonth(c,t);var d=r.weekNumber(this.rule.wkst);for(h=l;h<d;h++)u[h]=1}for(var f=0;f<this.by_data.BYWEEKNO.length&&o;f++){var m=this.by_data.BYWEEKNO[f];m<52?o&=u[f]:o=0}o?delete n.BYMONTH:delete n.BYWEEKNO}var y=Object.keys(n).length;if(0==y){var T=this.dtstart.clone();T.year=this.last.year,this.days.push(T.dayOfYear())}else if(1==y&&"BYMONTH"in n){for(var _ in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(_)){var v=this.dtstart.clone();v.year=t,v.month=this.by_data.BYMONTH[_],v.isDate=!0,this.days.push(v.dayOfYear())}}else if(1==y&&"BYMONTHDAY"in n){for(var g in this.by_data.BYMONTHDAY)if(this.by_data.BYMONTHDAY.hasOwnProperty(g)){var D=this.dtstart.clone(),Y=this.by_data.BYMONTHDAY[g];if(Y<0){var b=e.Time.daysInMonth(D.month,t);Y=Y+b+1}D.day=Y,D.year=t,D.isDate=!0,this.days.push(D.dayOfYear())}}else if(2==y&&"BYMONTHDAY"in n&&"BYMONTH"in n){for(var _ in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(_)){var O=this.by_data.BYMONTH[_],b=e.Time.daysInMonth(O,t);for(var g in this.by_data.BYMONTHDAY)if(this.by_data.BYMONTHDAY.hasOwnProperty(g)){var Y=this.by_data.BYMONTHDAY[g];Y<0&&(Y=Y+b+1),r.day=Y,r.month=O,r.year=t,r.isDate=!0,this.days.push(r.dayOfYear())}}}else if(1==y&&"BYWEEKNO"in n);else if(2==y&&"BYWEEKNO"in n&&"BYMONTHDAY"in n);else if(1==y&&"BYDAY"in n)this.days=this.days.concat(this.expand_by_day(t));else if(2==y&&"BYDAY"in n&&"BYMONTH"in n){for(var _ in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(_)){var c=this.by_data.BYMONTH[_],b=e.Time.daysInMonth(c,t);r.year=t,r.month=this.by_data.BYMONTH[_],r.day=1,r.isDate=!0;var A=r.dayOfWeek(),S=r.dayOfYear()-1;r.day=b;var E=r.dayOfWeek();if(this.has_by_data("BYSETPOS")){for(var C=[],N=1;N<=b;N++)r.day=N,this.is_day_in_byday(r)&&C.push(N);for(var I=0;I<C.length;I++)(this.check_set_position(I+1)||this.check_set_position(I-C.length))&&this.days.push(S+C[I])}else for(var w in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(w)){var x,z=this.by_data.BYDAY[w],B=this.ruleDayOfWeek(z),P=B[0],M=B[1],L=(M+7-A)%7+1,k=b-(E+7-M)%7;if(0==P)for(var N=L;N<=b;N+=7)this.days.push(S+N);else P>0?(x=L+(P-1)*7)<=b&&this.days.push(S+x):(x=k+(P+1)*7)>0&&this.days.push(S+x)}}this.days.sort(function(t,e){return t-e})}else if(2==y&&"BYDAY"in n&&"BYMONTHDAY"in n){var U=this.expand_by_day(t);for(var R in U)if(U.hasOwnProperty(R)){var N=U[R],V=e.Time.fromDayOfYear(N,t);this.by_data.BYMONTHDAY.indexOf(V.day)>=0&&this.days.push(N)}}else if(3==y&&"BYDAY"in n&&"BYMONTHDAY"in n&&"BYMONTH"in n){var U=this.expand_by_day(t);for(var R in U)if(U.hasOwnProperty(R)){var N=U[R],V=e.Time.fromDayOfYear(N,t);this.by_data.BYMONTH.indexOf(V.month)>=0&&this.by_data.BYMONTHDAY.indexOf(V.day)>=0&&this.days.push(N)}}else if(2==y&&"BYDAY"in n&&"BYWEEKNO"in n){var U=this.expand_by_day(t);for(var R in U)if(U.hasOwnProperty(R)){var N=U[R],V=e.Time.fromDayOfYear(N,t),m=V.weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(m)&&this.days.push(N)}}else 3==y&&"BYDAY"in n&&"BYWEEKNO"in n&&"BYMONTHDAY"in n||(1==y&&"BYYEARDAY"in n?this.days=this.days.concat(this.by_data.BYYEARDAY):this.days=[]);return 0},expand_by_day:function(t){var e=[],r=this.last.clone();r.year=t,r.month=1,r.day=1,r.isDate=!0;var n=r.dayOfWeek();r.month=12,r.day=31,r.isDate=!0;var i=r.dayOfWeek(),a=r.dayOfYear();for(var s in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(s)){var o,u,h=this.by_data.BYDAY[s],c=this.ruleDayOfWeek(h),l=c[0],d=c[1];if(0==l)for(var f=(d+7-n)%7+1,m=f;m<=a;m+=7)e.push(m);else l>0?(o=d>=n?d-n+1:d-n+8,e.push(o+(l-1)*7)):(l=-l,u=d<=i?a-i+d:a-i+d-7,e.push(u-(l-1)*7))}return e},is_day_in_byday:function(t){for(var e in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(e)){var r=this.by_data.BYDAY[e],n=this.ruleDayOfWeek(r),i=n[0],a=n[1],s=t.dayOfWeek();if(0==i&&a==s||t.nthWeekDay(a,i)==t.day)return 1}return 0},check_set_position:function(t){return!!this.has_by_data("BYSETPOS")&&-1!==this.by_data.BYSETPOS.indexOf(t)},sort_byday_rules:function(t){for(var e=0;e<t.length;e++)for(var r=0;r<e;r++)if(this.ruleDayOfWeek(t[r],this.rule.wkst)[1]>this.ruleDayOfWeek(t[e],this.rule.wkst)[1]){var n=t[e];t[e]=t[r],t[r]=n}},check_contract_restriction:function(e,r){var n=t._indexMap[e],i=t._expandMap[this.rule.freq][n],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]==r){a=!0;break}}else a=!0;return a},check_contracting_rules:function(){var t=this.last.dayOfWeek(),r=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",e.Recur.numericDayToIcalDay(t))&&this.check_contract_restriction("BYWEEKNO",r)&&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,r,n){var i=t._indexMap[e];return t._expandMap[this.rule.freq][i]!=t.CONTRACT&&(e in this.by_data||(this.by_data[e]=[n]),this.rule.freq!=r)?this.by_data[e][0]:n},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}(),e.RecurExpansion=function(){function t(t){return e.helpers.formatClassType(t,e.Time)}function r(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(r){var n=e.helpers.formatClassType(r.dtstart,e.Time);if(n)this.dtstart=n;else throw Error(".dtstart (ICAL.Time) must be given");if(r.component)this._init(r.component);else{if(this.last=t(r.last)||n.clone(),!r.ruleIterators)throw Error(".ruleIterators or .component must be given");this.ruleIterators=r.ruleIterators.map(function(t){return e.helpers.formatClassType(t,e.RecurIterator)}),this.ruleDateInc=r.ruleDateInc,this.exDateInc=r.exDateInc,r.ruleDates&&(this.ruleDates=r.ruleDates.map(t),this.ruleDate=this.ruleDates[this.ruleDateInc]),r.exDates&&(this.exDates=r.exDates.map(t),this.exDate=this.exDates[this.exDateInc]),void 0!==r.complete&&(this.complete=r.complete)}},next:function(){for(var t,e,r,n=0;;){if(n++>500)throw 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&&((r=this.exDate.compare(this.last))<0&&this._nextExDay(),0===r)){this._nextExDay();continue}return this.last}},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 i(t){a=e.helpers.binsearchInsert(s,t,r),s.splice(a,0,t)}for(var a,s=[],o=t.getAllProperties(n),u=o.length,h=0;h<u;h++)o[h].getValues().forEach(i);return s},_init:function(t){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!(t.hasProperty("rdate")||t.hasProperty("rrule")||t.hasProperty("recurrence-id"))){this.ruleDate=this.last.clone(),this.complete=!0;return}if(t.hasProperty("rdate")&&(this.ruleDates=this._extractDates(t,"rdate"),this.ruleDates[0]&&0>this.ruleDates[0].compare(this.dtstart)?(this.ruleDateInc=0,this.last=this.ruleDates[0].clone()):this.ruleDateInc=e.helpers.binsearchInsert(this.ruleDates,this.last,r),this.ruleDate=this.ruleDates[this.ruleDateInc]),t.hasProperty("rrule"))for(var n,i=t.getAllProperties("rrule"),a=0,s=i.length;a<s;a++)n=i[a].getFirstValue().iterator(this.dtstart),this.ruleIterators.push(n),n.next();t.hasProperty("exdate")&&(this.exDates=this._extractDates(t,"exdate"),this.exDateInc=e.helpers.binsearchInsert(this.exDates,this.last,r),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,e,r,n=this.ruleIterators;if(0===n.length)return null;for(var i=n.length,a=0;a<i;a++){if(e=(t=n[a]).last,t.completed){i--,0!==a&&a--,n.splice(a,1);continue}(!r||r.last.compare(e)>0)&&(r=t)}return r}},n}(),e.Event=function(){function t(t,r){t instanceof e.Component||(r=t,t=null),t?this.component=t:this.component=new e.Component("vevent"),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],r&&r.strictExceptions&&(this.strictExceptions=r.strictExceptions),r&&r.exceptions?r.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)}function r(t,e){return t[0]>e[0]?1:e[0]>t[0]?-1:0}return t.prototype={THISANDFUTURE:"THISANDFUTURE",exceptions:null,strictExceptions:!1,relateException:function(t){if(this.isRecurrenceException())throw Error("cannot relate exception to exceptions");if(t instanceof e.Component&&(t=new e.Event(t)),this.strictExceptions&&t.uid!==this.uid)throw Error("attempted to relate unrelated exception");var n=t.recurrenceId.toString();if(this.exceptions[n]=t,t.modifiesFuture()){var i=[t.recurrenceId.toUnixTime(),n],a=e.helpers.binsearchInsert(this.rangeExceptions,i,r);this.rangeExceptions.splice(a,0,i)}},modifiesFuture:function(){return!!this.component.hasProperty("recurrence-id")&&this.component.getFirstProperty("recurrence-id").getParameter("range")===this.THISANDFUTURE},findRangeException:function(t){if(!this.rangeExceptions.length)return null;var n=t.toUnixTime(),i=e.helpers.binsearchInsert(this.rangeExceptions,[n],r);if((i-=1)<0)return null;var a=this.rangeExceptions[i];return n<a[0]?null:a[1]},getOccurrenceDetails:function(t){var r=t.toString(),n=t.convertToZone(e.Timezone.utcTimezone).toString(),i={recurrenceId:t};if(r in this.exceptions)a=i.item=this.exceptions[r],i.startDate=a.startDate,i.endDate=a.endDate,i.item=a;else if(n in this.exceptions)a=this.exceptions[n],i.startDate=a.startDate,i.endDate=a.endDate,i.item=a;else{var a,s,o=this.findRangeException(t);if(o){var u=this.exceptions[o];i.item=u;var h=this._rangeExceptionCache[o];if(!h){var c=u.recurrenceId.clone(),l=u.startDate.clone();c.zone=l.zone,h=l.subtractDate(c),this._rangeExceptionCache[o]=h}var d=t.clone();d.zone=u.startDate.zone,d.addDuration(h),(s=d.clone()).addDuration(u.duration),i.startDate=d,i.endDate=s}else(s=t.clone()).addDuration(this.duration),i.endDate=s,i.startDate=t,i.item=this}return i},iterator:function(t){return new e.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,r=t.length,n=Object.create(null);e<r;e++)n[t[e].getFirstValue().freq]=!0;return n},get uid(){return this._firstProp("uid")},set uid(value){this._setProp("uid",value)},get startDate(){return this._firstProp("dtstart")},set startDate(value){this._setTime("dtstart",value)},get endDate(){var n=this._firstProp("dtend");if(!n){var i=this._firstProp("duration");n=this.startDate.clone(),i?n.addDuration(i):n.isDate&&(n.day+=1)}return n},set endDate(value){this.component.hasProperty("duration")&&this.component.removeProperty("duration"),this._setTime("dtend",value)},get duration(){var a=this._firstProp("duration");if(!a)return this.endDate.subtractDateTz(this.startDate);return a},set duration(value){this.component.hasProperty("dtend")&&this.component.removeProperty("dtend"),this._setProp("duration",value)},get location(){return this._firstProp("location")},set location(value){return this._setProp("location",value)},get attendees(){return this.component.getAllProperties("attendee")},get summary(){return this._firstProp("summary")},set summary(value){this._setProp("summary",value)},get description(){return this._firstProp("description")},set description(value){this._setProp("description",value)},get color(){return this._firstProp("color")},set color(value){this._setProp("color",value)},get organizer(){return this._firstProp("organizer")},set organizer(value){this._setProp("organizer",value)},get sequence(){return this._firstProp("sequence")},set sequence(value){this._setProp("sequence",value)},get recurrenceId(){return this._firstProp("recurrence-id")},set recurrenceId(value){this._setTime("recurrence-id",value)},_setTime:function(t,r){var n=this.component.getFirstProperty(t);n||(n=new e.Property(t),this.component.addProperty(n)),r.zone===e.Timezone.localTimezone||r.zone===e.Timezone.utcTimezone?n.removeParameter("tzid"):n.setParameter("tzid",r.zone.tzid),n.setValue(r)},_setProp:function(t,e){this.component.updatePropertyWithValue(t,e)},_firstProp:function(t){return this.component.getFirstPropertyValue(t)},toString:function(){return this.component.toString()}},t}(),e.ComponentParser=function(){function t(t){var e;for(e in void 0===t&&(t={}),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=e.parse(t)),t instanceof e.Component||(t=new e.Component(t));for(var r,n=t.getAllSubcomponents(),i=0,a=n.length;i<a;i++)switch((r=n[i]).name){case"vtimezone":if(this.parseTimezone){var s=r.getFirstPropertyValue("tzid");s&&this.ontimezone(new e.Timezone({tzid:s,component:r}))}break;case"vevent":this.parseEvent&&this.onevent(new e.Event(r));break;default:continue}this.oncomplete()}},t}()}}]);