mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
5 lines
86 KiB
JavaScript
5 lines
86 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
* Portions Copyright (C) Philipp Kewisch */
|
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ICAL=e()}(this,(function(){"use strict";function t(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function e(t,e,r){return e=h(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,n()?Reflect.construct(e,r||[],h(t).constructor):e.apply(t,r))}function n(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(n=function(){return!!t})()}function r(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,r(i.key),i)}}function o(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function f(t){var e="function"==typeof Map?new Map:void 0;return f=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(n())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,e);var a=new(t.bind.apply(t,i));return r&&c(a,r.prototype),a}(t,arguments,h(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,t)},f(t)}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,a,s,o=[],u=!0,l=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(o.push(r.value),o.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return o}}(t,e)||y(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function p(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=y(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){o=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}var v,_=function(){function t(e){a(this,t),u(this,"icaltype","binary"),this.value=e}return o(t,[{key:"decodeValue",value:function(){return this._b64_decode(this.value)}},{key:"setEncodedValue",value:function(t){this.value=this._b64_encode(t)}},{key:"_b64_encode",value:function(t){var e,n,r,i,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,u=0,l="",h=[];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,h[u++]=s.charAt(e)+s.charAt(n)+s.charAt(r)+s.charAt(i)}while(o<t.length);l=h.join("");var c=t.length%3;return(c?l.slice(0,c-3):l)+"===".slice(c||3)}},{key:"_b64_decode",value:function(t){var e,n,r,i,a,s,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,l=0,h=[];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,h[l++]=64==i?String.fromCharCode(e):64==a?String.fromCharCode(e,n):String.fromCharCode(e,n,r)}while(u<t.length);return h.join("")}},{key:"toString",value:function(){return this.value}}],[{key:"fromString",value:function(e){return new t(e)}}])}(),g=/([PDWHMTS]{1,1})/,D=["weeks","days","hours","minutes","seconds","isNegative"],T=function(){function t(e){a(this,t),u(this,"weeks",0),u(this,"days",0),u(this,"hours",0),u(this,"minutes",0),u(this,"seconds",0),u(this,"isNegative",!1),u(this,"icalclass","icalduration"),u(this,"icaltype","duration"),this.wrappedJSObject=this,this.fromData(e)}return o(t,[{key:"clone",value:function(){return t.fromData(this)}},{key:"toSeconds",value:function(){var t=this.seconds+60*this.minutes+3600*this.hours+86400*this.days+604800*this.weeks;return this.isNegative?-t:t}},{key:"fromSeconds",value:function(t){var e=Math.abs(t);return this.isNegative=t<0,this.days=H(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=H(e/3600),e-=3600*this.hours,this.minutes=H(e/60),e-=60*this.minutes,this.seconds=e,this}},{key:"fromData",value:function(t){for(var e=0,n=D;e<n.length;e++){var r=n[e];this[r]=t&&r in t?t[r]:0}}},{key:"reset",value:function(){this.isNegative=!1,this.weeks=0,this.days=0,this.hours=0,this.minutes=0,this.seconds=0}},{key:"compare",value:function(t){var e=this.toSeconds(),n=t.toSeconds();return(e>n)-(e<n)}},{key:"normalize",value:function(){this.fromSeconds(this.toSeconds())}},{key:"toString",value: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}},{key:"toICALString",value:function(){return this.toString()}}],[{key:"fromSeconds",value:function(e){return(new t).fromSeconds(e)}},{key:"isValueString",value:function(t){return"P"===t[0]||"P"===t[1]}},{key:"fromString",value:function(e){for(var n=0,r=Object.create(null),i=0;-1!==(n=e.search(g));){var a=e[n],s=e.slice(0,Math.max(0,n));e=e.slice(n+1),i+=Y(a,s,r)}if(i<2)throw new Error('invalid duration value: Not enough duration components in "'+e+'"');return new t(r)}},{key:"fromData",value:function(e){return new t(e)}}])}();function Y(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(M(i))throw new Error('invalid duration value: Invalid number "'+e+'" before "'+t+'"');n[r]=i}return 1}var k=function(){function e(t,n){a(this,e),u(this,"icalclass","icaltime"),u(this,"_cachedUnixTime",null),u(this,"zone",null),u(this,"_pendingNormalization",!1),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,n)}return o(e,[{key:"icaltype",get:function(){return this.isDate?"date":"date-time"}},{key:"clone",value:function(){return new e(this._time,this.zone)}},{key:"reset",value:function(){this.fromData(e.epochTime),this.zone=C.utcTimezone}},{key:"resetTo",value:function(t,e,n,r,i,a,s){this.fromData({year:t,month:e,day:n,hour:r,minute:i,second:a,zone:s})}},{key:"fromJSDate",value:function(t,e){return t?e?(this.zone=C.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=C.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}},{key:"fromData",value:function(t,e){if(t)for(var n=0,r=Object.entries(t);n<r.length;n++){var i=d(r[n],2),a=i[0],s=i[1];"icaltype"!==a&&(this[a]=s)}if(e&&(this.zone=e),t&&!("isDate"in t)?this.isDate=!("hour"in t):t&&"isDate"in t&&(this.isDate=t.isDate),t&&"timezone"in t){var o=B.get(t.timezone);this.zone=o||C.localTimezone}return t&&"zone"in t&&(this.zone=t.zone),this.zone||(this.zone=C.localTimezone),this._cachedUnixTime=null,this}},{key:"dayOfWeek",value:function(t){var n=t||e.SUNDAY,r=(this.year<<12)+(this.month<<8)+(this.day<<3)+n;if(r in e._dowCache)return e._dowCache[r];var i=this.day,a=this.month+(this.month<3?12:0),s=this.year-(this.month<3?1:0),o=i+s+H(26*(a+1)/10)+H(s/4);return o=((o+=6*H(s/100)+H(s/400))+7-n)%7+1,e._dowCache[r]=o,o}},{key:"dayOfYear",value:function(){var t=e.isLeapYear(this.year)?1:0;return e.daysInYearPassedMonth[t][this.month-1]+this.day}},{key:"startOfWeek",value:function(t){var n=t||e.SUNDAY,r=this.clone();return r.day-=(this.dayOfWeek()+7-n)%7,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r}},{key:"endOfWeek",value:function(t){var n=t||e.SUNDAY,r=this.clone();return r.day+=(7-this.dayOfWeek()+n-e.SUNDAY)%7,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r}},{key:"startOfMonth",value:function(){var t=this.clone();return t.day=1,t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t}},{key:"endOfMonth",value:function(){var t=this.clone();return t.day=e.daysInMonth(t.month,t.year),t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t}},{key:"startOfYear",value: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}},{key:"endOfYear",value: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}},{key:"startDoyWeek",value:function(t){var n=t||e.SUNDAY,r=this.dayOfWeek()-n;return r<0&&(r+=7),this.dayOfYear()-r}},{key:"getDominicalLetter",value:function(){return e.getDominicalLetter(this.year)}},{key:"nthWeekDay",value:function(t,n){var r,i=e.daysInMonth(this.month,this.year),a=n,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,r=t}else{o.day=i,a++,(r=o.dayOfWeek()-t)<0&&(r+=7),r=i-r}return s+(r+=7*a)}},{key:"isNthWeekDay",value:function(t,e){var n=this.dayOfWeek();return 0===e&&n===t||this.nthWeekDay(t,e)===this.day}},{key:"weekNumber",value:function(t){var n,r=(this.year<<12)+(this.month<<8)+(this.day<<3)+t;if(r in e._wnCache)return e._wnCache[r];var i=this.clone();i.isDate=!0;var a=this.year;12==i.month&&i.day>25?(n=e.weekOneStarts(a+1,t),i.compare(n)<0?n=e.weekOneStarts(a,t):a++):(n=e.weekOneStarts(a,t),i.compare(n)<0&&(n=e.weekOneStarts(--a,t)));var s=H(i.subtractDate(n).toSeconds()/86400/7)+1;return e._wnCache[r]=s,s}},{key:"addDuration",value: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}},{key:"subtractDate",value:function(t){var e=this.toUnixTime()+this.utcOffset(),n=t.toUnixTime()+t.utcOffset();return T.fromSeconds(e-n)}},{key:"subtractDateTz",value:function(t){var e=this.toUnixTime(),n=t.toUnixTime();return T.fromSeconds(e-n)}},{key:"compare",value:function(t){var e=this.toUnixTime(),n=t.toUnixTime();return e>n?1:n>e?-1:0}},{key:"compareDateOnlyTz",value:function(t,n){var r=this.convertToZone(n),i=t.convertToZone(n),a=0;return 0!=(a=e._cmp_attr(r,i,"year"))||0!=(a=e._cmp_attr(r,i,"month"))||(a=e._cmp_attr(r,i,"day")),a}},{key:"convertToZone",value:function(t){var e=this.clone(),n=this.zone.tzid==t.tzid;return this.isDate||n||C.convert_time(e,this.zone,t),e.zone=t,e}},{key:"utcOffset",value:function(){return this.zone==C.localTimezone||this.zone==C.utcTimezone?0:this.zone.utcOffset(this)}},{key:"toICALString",value:function(){var t=this.toString();return t.length>10?Ct.icalendar.value["date-time"].toICAL(t):Ct.icalendar.value.date.toICAL(t)}},{key:"toString",value:function(){var t=this.year+"-"+R(this.month)+"-"+R(this.day);return this.isDate||(t+="T"+R(this.hour)+":"+R(this.minute)+":"+R(this.second),this.zone===C.utcTimezone&&(t+="Z")),t}},{key:"toJSDate",value:function(){return this.zone==C.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())}},{key:"_normalize",value:function(){return this._time.isDate&&(this._time.hour=0,this._time.minute=0,this._time.second=0),this.adjust(0,0,0,0),this}},{key:"adjust",value:function(t,n,r,i,a){var s,o,u,l,h,c,f,d=0,y=0,m=a||this._time;if(m.isDate||(u=m.second+i,m.second=u%60,s=H(u/60),m.second<0&&(m.second+=60,s--),l=m.minute+r+s,m.minute=l%60,o=H(l/60),m.minute<0&&(m.minute+=60,o--),h=m.hour+n+o,m.hour=h%24,d=H(h/24),m.hour<0&&(m.hour+=24,d--)),m.month>12?y=H((m.month-1)/12):m.month<1&&(y=H(m.month/12)-1),m.year+=y,m.month-=12*y,(c=m.day+t+d)>0)for(;!(c<=(f=e.daysInMonth(m.month,m.year)));)m.month++,m.month>12&&(m.year++,m.month=1),c-=f;else for(;c<=0;)1==m.month?(m.year--,m.month=12):m.month--,c+=e.daysInMonth(m.month,m.year);return m.day=c,this._cachedUnixTime=null,this}},{key:"fromUnixTime",value:function(t){this.zone=C.utcTimezone;var e=new Date(1e3*t);this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this._time.isDate?(this.hour=0,this.minute=0,this.second=0):(this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()),this._cachedUnixTime=null}},{key:"toUnixTime",value: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}},{key:"toJSON",value: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}}],[{key:"daysInMonth",value:function(t,n){var r=30;return t<1||t>12||(r=[0,31,28,31,30,31,30,31,31,30,31,30,31][t],2==t&&(r+=e.isLeapYear(n))),r}},{key:"isLeapYear",value:function(t){return t<=1752?t%4==0:t%4==0&&t%100!=0||t%400==0}},{key:"fromDayOfYear",value:function(t,n){var r=n,i=t,a=new e;a.auto_normalize=!1;var s=e.isLeapYear(r)?1:0;if(i<1)return r--,s=e.isLeapYear(r)?1:0,i+=e.daysInYearPassedMonth[s][12],e.fromDayOfYear(i,r);if(i>e.daysInYearPassedMonth[s][12])return s=e.isLeapYear(r)?1:0,i-=e.daysInYearPassedMonth[s][12],r++,e.fromDayOfYear(i,r);a.year=r,a.isDate=!0;for(var o=11;o>=0;o--)if(i>e.daysInYearPassedMonth[s][o]){a.month=o+1,a.day=i-e.daysInYearPassedMonth[s][o];break}return a.auto_normalize=!0,a}},{key:"fromStringv2",value:function(t){return new e({year:parseInt(t.slice(0,4),10),month:parseInt(t.slice(5,7),10),day:parseInt(t.slice(8,10),10),isDate:!0})}},{key:"fromDateString",value:function(t){return new e({year:L(t.slice(0,4)),month:L(t.slice(5,7)),day:L(t.slice(8,10)),isDate:!0})}},{key:"fromDateTimeString",value:function(t,n){if(t.length<19)throw new Error('invalid date-time value: "'+t+'"');var r,i;t[19]&&"Z"===t[19]?r=C.utcTimezone:n&&(i=n.getParameter("tzid"),n.parent&&("standard"===n.parent.name||"daylight"===n.parent.name?r=C.localTimezone:i&&(r=n.parent.getTimeZoneByID(i))));var a={year:L(t.slice(0,4)),month:L(t.slice(5,7)),day:L(t.slice(8,10)),hour:L(t.slice(11,13)),minute:L(t.slice(14,16)),second:L(t.slice(17,19))};return i&&!r&&(a.timezone=i),new e(a,r)}},{key:"fromString",value:function(t,n){return t.length>10?e.fromDateTimeString(t,n):e.fromDateString(t)}},{key:"fromJSDate",value:function(t,n){return(new e).fromJSDate(t,n)}},{key:"now",value:function(){return e.fromJSDate(new Date,!1)}},{key:"weekOneStarts",value:function(t,n){var r=e.fromData({year:t,month:1,day:1,isDate:!0}),i=r.dayOfWeek(),a=n||e.DEFAULT_WEEK_START;return i>e.THURSDAY&&(r.day+=7),a>e.THURSDAY&&(r.day-=7),r.day-=i-a,r}},{key:"getDominicalLetter",value:function(t){var n="GFEDCBA",r=(t+(t/4|0)+(t/400|0)-(t/100|0)-1)%7;return e.isLeapYear(t)?n[(r+6)%7]+n[r]:n[r]}},{key:"epochTime",get:function(){return t(e,this,b)._||(b._=t(e,this,e.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:"Z"}))),t(e,this,b)._}},{key:"_cmp_attr",value:function(t,e,n){return t[n]>e[n]?1:t[n]<e[n]?-1:0}}])}();v=k,u(k,"_dowCache",{}),u(k,"_wnCache",{}),u(k,"fromData",(function(t,e){return(new v).fromData(t,e)}));var b={_:null};u(k,"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]]),u(k,"SUNDAY",1),u(k,"MONDAY",2),u(k,"TUESDAY",3),u(k,"WEDNESDAY",4),u(k,"THURSDAY",5),u(k,"FRIDAY",6),u(k,"SATURDAY",7),u(k,"DEFAULT_WEEK_START",2),function(){function t(t){Object.defineProperty(k.prototype,t,{get:function(){return this._pendingNormalization&&(this._normalize(),this._pendingNormalization=!1),this._time[t]},set:function(e){"isDate"===t&&e&&!this._time.isDate&&this.adjust(0,0,0,0),this._cachedUnixTime=null,this._pendingNormalization=!0,this._time[t]=e}})}t("year"),t("month"),t("day"),t("hour"),t("minute"),t("second"),t("isDate")}();var O=/[^ \t]/,A={"^'":'"',"^n":"\n","^^":"^"};function S(t){var e={},n=e.component=[];if(e.stack=[n],S._eachLine(t,(function(t,n){S._handleContentLine(n,e)})),e.stack.length>1)throw new w("invalid ical body. component began but did not end");return e=null,1==n.length?n[0]:n}S.property=function(t,e){var n={component:[[],[]],designSet:e||Ct.defaultSet};return S._handleContentLine(t,n),n.component[1][0]},S.component=function(t){return S(t)};var w=function(t){function n(t){var r;a(this,n),(r=e(this,n,[t])).name=r.constructor.name;try{throw new Error}catch(t){if(t.stack){var i=t.stack.split("\n");i.shift(),r.stack=i.join("\n")}}return r}return l(n,t),o(n)}(f(Error));S.ParserError=w,S._handleContentLine=function(t,e){var n,r,i,a,s,o,u=t.indexOf(":"),l=t.indexOf(";"),h={};if(-1!==l&&-1!==u&&l>u&&(l=-1),-1!==l){if(i=t.slice(0,Math.max(0,l)).toLowerCase(),-1==(s=S._parseParameters(t.slice(Math.max(0,l)),0,e.designSet))[2])throw new w("Invalid parameters in '"+t+"'");if(h=s[0],n=s[1].length+s[2]+l,-1===(r=t.slice(Math.max(0,n)).indexOf(":")))throw new w("Missing parameter value in '"+t+"'");a=t.slice(Math.max(0,n+r+1))}else{if(-1===u)throw new w('invalid line (no token ";" or ":") "'+t+'"');if(i=t.slice(0,Math.max(0,u)).toLowerCase(),a=t.slice(Math.max(0,u+1)),"begin"===i){var c=[a.toLowerCase(),[],[]];return 1===e.stack.length?e.component.push(c):e.component[2].push(c),e.stack.push(e.component),e.component=c,void(e.designSet||(e.designSet=Ct.getDesignSet(e.component[0])))}if("end"===i)return void(e.component=e.stack.pop())}var f,d,y,m,p=!1,v=!1;e.designSet.propertyGroups&&-1!==i.indexOf(".")?(d=i.split("."),h.group=d[0],y=d[1]):y=i,y in e.designSet.property&&("multiValue"in(f=e.designSet.property[y])&&(p=f.multiValue),"structuredValue"in f&&(v=f.structuredValue),a&&"detectType"in f&&(o=f.detectType(a))),o||(o="value"in h?h.value.toLowerCase():f?f.defaultType:"unknown"),delete h.value,p&&v?m=[y,h,o,a=S._parseMultiValue(a,v,o,[],p,e.designSet,v)]:p?(m=[y,h,o],S._parseMultiValue(a,p,o,m,null,e.designSet,!1)):m=v?[y,h,o,a=S._parseMultiValue(a,v,o,[],null,e.designSet,v)]:[y,h,o,a=S._parseValue(a,o,e.designSet,!1)],"vcard"!==e.component[0]||0!==e.component[1].length||"version"===i&&"4.0"===a||(e.designSet=Ct.getDesignSet("vcard3")),e.component[1].push(m)},S._parseValue=function(t,e,n,r){return e in n.value&&"fromICAL"in n.value[e]?n.value[e].fromICAL(t,r):t},S._parseParameters=function(t,e,n){for(var r,i,a,s,o,u,l=e,h=0,c={},f=-1;!1!==h&&-1!==(h=P(t,"=",h+1));){if(0==(r=t.slice(l+1,h)).length)throw new w("Empty parameter name in '"+t+"'");if(u=!1,o=!1,s=(i=r.toLowerCase())in n.param&&n.param[i].valueType?n.param[i].valueType:"text",i in n.param&&(o=n.param[i].multiValue,n.param[i].multiValueSeparateDQuote&&(u=S._rfc6868Escape('"'+o+'"'))),'"'===t[h+1]){if(h=P(t,'"',f=h+2),o&&-1!=h)for(var d=!0;d;)t[h+1]==o&&'"'==t[h+2]?h=P(t,'"',h+3):d=!1;if(-1===h)throw new w('invalid line (no matching double quote) "'+t+'"');a=t.slice(f,h),-1===(l=P(t,";",h))&&(h=!1)}else{var y=P(t,";",f=h+1),m=P(t,":",f);-1!==m&&y>m?(y=m,h=!1):-1===y?(y=-1===m?t.length:m,h=!1):(l=y,h=y),a=t.slice(f,y)}if(a=S._rfc6868Escape(a),o){var p=u||o;a=S._parseMultiValue(a,p,s,[],null,n)}else a=S._parseValue(a,s,n);o&&i in c?Array.isArray(c[i])?c[i].push(a):c[i]=[c[i],a]:c[i]=a}return[c,a,f]},S._rfc6868Escape=function(t){return t.replace(/\^['n^]/g,(function(t){return A[t]}))},S._parseMultiValue=function(t,e,n,r,i,a,s){var o,u=0,l=0;if(0===e.length)return t;for(;-1!==(u=P(t,e,l));)o=t.slice(l,u),o=i?S._parseMultiValue(o,i,n,[],null,a,s):S._parseValue(o,n,a,s),r.push(o),l=u+e.length;return o=t.slice(l),o=i?S._parseMultiValue(o,i,n,[],null,a,s):S._parseValue(o,n,a,s),r.push(o),1==r.length?r[0]:r},S._eachLine=function(t,e){var n,r,i,a=t.length,s=t.search(O),o=s;do{i=(o=t.indexOf("\n",s)+1)>1&&"\r"===t[o-2]?2:1,0===o&&(o=a,i=0)," "===(r=t[s])||"\t"===r?n+=t.slice(s+1,o-i):(n&&e(null,n),n=t.slice(s,o-i)),s=o}while(o!==a);(n=n.trim()).length&&e(null,n)};var E=["tzid","location","tznames","latitude","longitude"],C=function(){function e(t){a(this,e),u(this,"tzid",""),u(this,"location",""),u(this,"tznames",""),u(this,"latitude",0),u(this,"longitude",0),u(this,"component",null),u(this,"expandedUntilYear",0),u(this,"icalclass","icaltimezone"),this.wrappedJSObject=this,this.fromData(t)}return o(e,[{key:"fromData",value:function(t){if(this.expandedUntilYear=0,this.changes=[],t instanceof Lt)this.component=t;else{if(t&&"component"in t)if("string"==typeof t.component){var e=S(t.component);this.component=new Lt(e)}else t.component instanceof Lt?this.component=t.component:this.component=null;for(var n=0,r=E;n<r.length;n++){var i=r[n];t&&i in t&&(this[i]=t[i])}}return this.component instanceof Lt&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue("tzid")),this}},{key:"utcOffset",value:function(t){if(this==e.utcTimezone||this==e.localTimezone)return 0;if(this._ensureCoverage(t.year),!this.changes.length)return 0;for(var n={year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second},r=this._findNearbyChange(n),i=-1,a=1;;){var s=j(this.changes[r],!0);if(s.utcOffset<s.prevUtcOffset?e.adjust_change(s,0,0,0,s.utcOffset):e.adjust_change(s,0,0,0,s.prevUtcOffset),e._compare_change_fn(n,s)>=0?i=r:a=-1,-1==a&&-1!=i)break;if((r+=a)<0)return 0;if(r>=this.changes.length)break}var o=this.changes[i];if(o.utcOffset-o.prevUtcOffset<0&&i>0){var u=j(o,!0);if(e.adjust_change(u,0,0,0,u.prevUtcOffset),e._compare_change_fn(n,u)<0){var l=this.changes[i-1],h=!1;o.is_daylight!=h&&l.is_daylight==h&&(o=l)}}return o.utcOffset}},{key:"_findNearbyChange",value:function(t){var n=U(this.changes,t,e._compare_change_fn);return n>=this.changes.length?this.changes.length-1:n}},{key:"_ensureCoverage",value:function(t){if(-1==e._minimumExpansionYear){var n=k.now();e._minimumExpansionYear=n.year}var r=t;if(r<e._minimumExpansionYear&&(r=e._minimumExpansionYear),r+=e.EXTRA_COVERAGE,!this.changes.length||this.expandedUntilYear<t){for(var i=this.component.getAllSubcomponents(),a=i.length,s=0;s<a;s++)this._expandComponent(i[s],r,this.changes);this.changes.sort(e._compare_change_fn),this.expandedUntilYear=r}}},{key:"_expandComponent",value:function(t,n,r){if(!t.hasProperty("dtstart")||!t.hasProperty("tzoffsetto")||!t.hasProperty("tzoffsetfrom"))return null;var i,a=t.getFirstProperty("dtstart").getFirstValue();function s(t){return t.factor*(3600*t.hours+60*t.minutes)}function o(){var e={};return e.is_daylight="daylight"==t.name,e.utcOffset=s(t.getFirstProperty("tzoffsetto").getFirstValue()),e.prevUtcOffset=s(t.getFirstProperty("tzoffsetfrom").getFirstValue()),e}if(t.hasProperty("rrule")||t.hasProperty("rdate")){var u,l=p(t.getAllProperties("rdate"));try{for(l.s();!(u=l.n()).done;){var h=u.value.getFirstValue();(i=o()).year=h.year,i.month=h.month,i.day=h.day,h.isDate?(i.hour=a.hour,i.minute=a.minute,i.second=a.second,a.zone!=e.utcTimezone&&e.adjust_change(i,0,0,0,-i.prevUtcOffset)):(i.hour=h.hour,i.minute=h.minute,i.second=h.second,h.zone!=e.utcTimezone&&e.adjust_change(i,0,0,0,-i.prevUtcOffset)),r.push(i)}}catch(t){l.e(t)}finally{l.f()}var c=t.getFirstProperty("rrule");if(c){c=c.getFirstValue(),i=o(),c.until&&c.until.zone==e.utcTimezone&&(c.until.adjust(0,0,0,i.prevUtcOffset),c.until.zone=e.localTimezone);for(var f,d=c.iterator(a);(f=d.next())&&(i=o(),!(f.year>n)&&f);)i.year=f.year,i.month=f.month,i.day=f.day,i.hour=f.hour,i.minute=f.minute,i.second=f.second,i.isDate=f.isDate,e.adjust_change(i,0,0,0,-i.prevUtcOffset),r.push(i)}}else(i=o()).year=a.year,i.month=a.month,i.day=a.day,i.hour=a.hour,i.minute=a.minute,i.second=a.second,e.adjust_change(i,0,0,0,-i.prevUtcOffset),r.push(i);return r}},{key:"toString",value:function(){return this.tznames?this.tznames:this.tzid}}],[{key:"_compare_change_fn",value: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}},{key:"convert_time",value:function(t,n,r){if(t.isDate||n.tzid==r.tzid||n==e.localTimezone||r==e.localTimezone)return t.zone=r,t;var i=n.utcOffset(t);return t.adjust(0,0,0,-i),i=r.utcOffset(t),t.adjust(0,0,0,i),null}},{key:"fromData",value:function(t){return(new e).fromData(t)}},{key:"utcTimezone",get:function(){return t(e,this,x)._||(x._=t(e,this,e.fromData({tzid:"UTC"}))),t(e,this,x)._}},{key:"localTimezone",get:function(){return t(e,this,N)._||(N._=t(e,this,e.fromData({tzid:"floating"}))),t(e,this,N)._}},{key:"adjust_change",value:function(t,e,n,r,i){return k.prototype.adjust.call(t,e,n,r,i,t)}}])}(),x={_:null},N={_:null};u(C,"_minimumExpansionYear",-1),u(C,"EXTRA_COVERAGE",5);var I=null,B={get count(){return null===I?0:Object.keys(I).length},reset:function(){I=Object.create(null);var t=C.utcTimezone;I.Z=t,I.UTC=t,I.GMT=t},has:function(t){return null!==I&&!!I[t]},get:function(t){return null===I&&this.reset(),I[t]},register:function(t,e){if(null===I&&this.reset(),t instanceof Lt&&"vtimezone"===t.name&&(t=(e=new C(t)).tzid),!(e instanceof C))throw new TypeError("timezone must be ICAL.Timezone or ICAL.Component");I[t]=e},remove:function(t){return null===I?null:delete I[t]}};function M(t){return"number"==typeof t&&isNaN(t)}function L(t){var e=parseInt(t,10);if(M(e))throw new Error('Could not extract integer from "'+t+'"');return e}function z(t,e){if(void 0!==t)return t instanceof e?t:new e(t)}function P(t,e,n){for(;-1!==(n=t.indexOf(e,n));){if(!(n>0&&"\\"===t[n-1]))return n;n+=1}return-1}function U(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}function j(t,e){if(t&&"object"==i(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?j(t[r],!0):t[r]);return n}for(var a={},s=0,o=Object.entries(t);s<o.length;s++){var u=d(o[s],2),l=u[0],h=u[1];a[l]=e?j(h,!0):h}return a}return t}function V(t){for(var e="",n=t||"",r=0,i=0;n.length;){var a=n.codePointAt(r);a<128?++i:i+=a<2048?2:a<65536?3:4,i<Vt.foldLength+1?r+=a>65535?2:1:(e+=Vt.newLineChar+" "+n.slice(0,Math.max(0,r)),n=n.slice(Math.max(0,r)),r=i=0)}return e.slice(Vt.newLineChar.length+1)}function R(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}}function H(t){return t<0?Math.ceil(t):Math.floor(t)}function W(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}var F=Object.freeze({__proto__:null,updateTimezones:function(t){var e,n,r,i,a;if(!t||"vcalendar"!==t.name)return t;for(e=t.getAllSubcomponents(),n=[],r={},a=0;a<e.length;a++){if("vtimezone"===e[a].name)r[e[a].getFirstProperty("tzid").getFirstValue()]=e[a];else n=n.concat(e[a].getAllProperties())}for(i={},a=0;a<n.length;a++){var s=n[a].getParameter("tzid");s&&(i[s]=!0)}for(var o=0,u=Object.entries(r);o<u.length;o++){var l=d(u[o],2),h=l[0],c=l[1];i[h]||t.removeSubcomponent(c)}for(var f=0,y=Object.keys(i);f<y.length;f++){var m=y[f];!r[m]&&B.has(m)&&t.addSubcomponent(B.get(m).component)}return t},isStrictlyNaN:M,strictParseInt:L,formatClassType:z,unescapedIndexOf:P,binsearchInsert:U,clone:j,foldline:V,pad2:R,trunc:H,extend:W}),K=function(){function t(e){a(this,t),u(this,"hours",0),u(this,"minutes",0),u(this,"factor",1),u(this,"icaltype","utc-offset"),this.fromData(e)}return o(t,[{key:"clone",value:function(){return t.fromSeconds(this.toSeconds())}},{key:"fromData",value:function(t){if(t)for(var e=0,n=Object.entries(t);e<n.length;e++){var r=d(n[e],2),i=r[0],a=r[1];this[i]=a}this._normalize()}},{key:"fromSeconds",value:function(t){var e=Math.abs(t);return this.factor=t<0?-1:1,this.hours=H(e/3600),e-=3600*this.hours,this.minutes=H(e/60),this}},{key:"toSeconds",value:function(){return this.factor*(60*this.minutes+3600*this.hours)}},{key:"compare",value:function(t){var e=this.toSeconds(),n=t.toSeconds();return(e>n)-(n>e)}},{key:"_normalize",value: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)}},{key:"toICALString",value:function(){return Ct.icalendar.value["utc-offset"].toICAL(this.toString())}},{key:"toString",value:function(){return(1==this.factor?"+":"-")+R(this.hours)+":"+R(this.minutes)}}],[{key:"fromString",value:function(e){var n={};return n.factor="+"===e[0]?1:-1,n.hours=L(e.slice(1,3)),n.minutes=L(e.slice(4,6)),new t(n)}},{key:"fromSeconds",value:function(e){var n=new t;return n.fromSeconds(e),n}}])}(),q=function(t){function n(t,r,i){var s;return a(this,n),u(s=e(this,n,[t,r]),"icalclass","vcardtime"),u(s,"icaltype","date-and-or-time"),s.icaltype=i||"date-and-or-time",s}return l(n,t),o(n,[{key:"clone",value:function(){return new n(this._time,this.zone,this.icaltype)}},{key:"_normalize",value:function(){return this}},{key:"utcOffset",value:function(){return this.zone instanceof K?this.zone.toSeconds():k.prototype.utcOffset.apply(this,arguments)}},{key:"toICALString",value:function(){return Ct.vcard.value[this.icaltype].toICAL(this.toString())}},{key:"toString",value:function(){var t,e=this.year,n=this.month,r=this.day,i=this.hour,a=this.minute,s=this.second,o=null!==n,u=null!==r,l=null!==i,h=null!==a,c=null!==s,f=(null!==e?R(e)+(o||u?"-":""):o||u?"--":"")+(o?R(n):"")+(u?"-"+R(r):""),d=(l?R(i):"-")+(l&&h?":":"")+(h?R(a):"")+(l||h?"":"-")+(h&&c?":":"")+(c?R(s):"");if(this.zone===C.utcTimezone)t="Z";else if(this.zone instanceof K)t=this.zone.toString();else if(this.zone===C.localTimezone)t="";else if(this.zone instanceof C){t=K.fromSeconds(this.zone.utcOffset(this)).toString()}else t="";switch(this.icaltype){case"time":return d+t;case"date-and-or-time":case"date-time":return f+("--"==d?"":"T"+d+t);case"date":return f}return null}}],[{key:"fromDateAndOrTimeString",value:function(t,e){function r(t,e,n){return t?L(t.slice(e,e+n)):null}var i=t.split("T"),a=i[0],s=i[1],o=s?Ct.vcard.value.time._splitZone(s):[],u=o[0],l=o[1],h=a?a.length:0,c=l?l.length:0,f=a&&"-"==a[0]&&"-"==a[1],d=l&&"-"==l[0];return new n({year:f?null:r(a,0,4),month:!f||4!=h&&7!=h?7==h||10==h?r(a,5,2):null:r(a,2,2),day:5==h?r(a,3,2):7==h&&f?r(a,5,2):10==h?r(a,8,2):null,hour:d?null:r(l,0,2),minute:d&&3==c?r(l,1,2):c>4?r(l,d?1:3,2):null,second:4==c?r(l,2,2):6==c?r(l,4,2):8==c?r(l,6,2):null},u="Z"==u?C.utcTimezone:u&&":"==u[3]?K.fromString(u):null,e)}}])}(k),J=function(){function t(e){a(this,t),u(this,"completed",!1),u(this,"rule",null),u(this,"dtstart",null),u(this,"last",null),u(this,"occurrence_number",0),u(this,"by_indices",null),u(this,"initialized",!1),u(this,"by_data",null),u(this,"days",null),u(this,"days_index",0),this.fromData(e)}return o(t,[{key:"fromData",value:function(t){if(this.rule=z(t.rule,tt),!this.rule)throw new Error("iterator requires a (ICAL.Recur) rule");if(this.dtstart=z(t.dtstart,k),!this.dtstart)throw new Error("iterator requires a (ICAL.Time) dtstart");t.by_data?this.by_data=t.by_data:this.by_data=j(this.rule.parts,!0),t.occurrence_number&&(this.occurrence_number=t.occurrence_number),this.days=t.days||[],t.last&&(this.last=z(t.last,k)),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()}},{key:"init",value: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 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");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);var e=this.last.day=this.setup_defaults("BYMONTHDAY","DAILY",this.dtstart.day);if(this.last.month=this.setup_defaults("BYMONTH","MONTHLY",this.dtstart.month),"WEEKLY"==this.rule.freq)if("BYDAY"in t){var n=d(this.ruleDayOfWeek(t.BYDAY[0],this.rule.wkst),2)[1],r=n-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)<n&&r>=0||r<0)&&(this.last.day+=r)}else{var i=tt.numericDayToIcalDay(this.dtstart.dayOfWeek());t.BYDAY=[i]}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 a,s=null,o=this.last.clone(),u=k.daysInMonth(this.last.month,this.last.year),l=p(this.by_data.BYDAY);try{for(l.s();!(a=l.n()).done;){var h=a.value;this.last=o.clone();var c=d(this.ruleDayOfWeek(h),2),f=c[0],y=c[1],m=this.last.nthWeekDay(y,f);if(f>=6||f<=-6)throw new Error("Malformed values in BYDAY part");if(m>u||m<=0){if(s&&s.month==o.month)continue;for(;m>u||m<=0;)this.increment_month(),u=k.daysInMonth(this.last.month,this.last.year),m=this.last.nthWeekDay(y,f)}this.last.day=m,(!s||this.last.compare(s)<0)&&(s=this.last.clone())}}catch(t){l.e(t)}finally{l.f()}if(this.last=s.clone(),this.has_by_data("BYMONTHDAY")&&this._byDayAndMonthDay(!0),this.last.day>u||0==this.last.day)throw new Error("Malformed values in BYDAY part")}else if(this.has_by_data("BYMONTHDAY")){this.last.day=1;var v=k.daysInMonth(this.last.month,this.last.year);if(e<0)this.last.day=v+e+1;else if(this.by_data.BYMONTHDAY[0]>v){if(!this.next_month()&&!this.next_month()&&!this.next_month())throw new Error("No possible occurrences")}else this.last.day=e}}},{key:"next",value: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()||this.last.compare(this.dtstart)<0||!t);if(0==this.last.compare(e))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)}},{key:"next_second",value:function(){return this.next_generic("BYSECOND","SECONDLY","second","minute")}},{key:"increment_second",value:function(t){return this.increment_generic(t,"second",60,"minute")}},{key:"next_minute",value:function(){return this.next_generic("BYMINUTE","MINUTELY","minute","hour","next_second")}},{key:"increment_minute",value:function(t){return this.increment_generic(t,"minute",60,"hour")}},{key:"next_hour",value:function(){return this.next_generic("BYHOUR","HOURLY","hour","monthday","next_minute")}},{key:"increment_hour",value:function(t){this.increment_generic(t,"hour",24,"monthday")}},{key:"next_day",value:function(){var t="DAILY"==this.rule.freq;return 0==this.next_hour()||(t?this.increment_monthday(this.rule.interval):this.increment_monthday(1)),0}},{key:"next_week",value: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}},{key:"normalizeByMonthDayRules",value:function(t,e,n){for(var r,i=k.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}))}},{key:"_byDayAndMonthDay",value:function(t){var e,n,r,i,a=this.by_data.BYDAY,s=0,o=a.length,u=0,l=this,h=this.last.day;function c(){for(i=k.daysInMonth(l.last.month,l.last.year),e=l.normalizeByMonthDayRules(l.last.year,l.last.month,l.by_data.BYMONTHDAY),r=e.length;e[s]<=h&&(!t||e[s]!=h)&&s<r-1;)s++}function f(){h=0,l.increment_month(),s=0,c()}c(),t&&(h-=1);for(var d=48;!u&&d;)if(d--,(n=h+1)>i)f();else{var y=e[s++];if(y>=n){h=y;for(var m=0;m<o;m++){var p=this.ruleDayOfWeek(a[m]),v=p[0],_=p[1];if(this.last.day=h,this.last.isNthWeekDay(_,v)){u=1;break}}u||s!==r||f()}else f()}if(d<=0)throw new Error("Malformed values in BYDAY combined with BYMONTHDAY parts");return u}},{key:"next_month",value:function(){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,n=k.daysInMonth(this.last.month,this.last.year),r=0,i=0;if(this.has_by_data("BYSETPOS")){for(var a=this.last.day,s=1;s<=n;s++)this.last.day=s,this.is_day_in_byday(this.last)&&(i++,s<=a&&r++);this.last.day=a}for(t=0,e=this.last.day+1;e<=n;e++)if(this.last.day=e,this.is_day_in_byday(this.last)&&(!this.has_by_data("BYSETPOS")||this.check_set_position(++r)||this.check_set_position(r-i-1))){t=1;break}e>n&&(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 o=k.daysInMonth(this.last.month,this.last.year),u=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY];u<0&&(u=o+u+1),u>o?(this.last.day=1,t=this.is_day_in_byday(this.last)):this.last.day=u}else{this.increment_month();var l=k.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>l?t=0:this.last.day=this.by_data.BYMONTHDAY[0]}return t}},{key:"next_weekday_by_week",value:function(){var t=0;if(0==this.next_hour())return t;if(!this.has_by_data("BYDAY"))return 1;for(;;){var e=new k;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=k.fromDayOfYear(i+r,this.last.year);return this.last.year=a.year,this.last.month=a.month,this.last.day=a.day,t}}}},{key:"next_year",value: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}},{key:"_nextByYearDay",value:function(){var t=this.days[this.days_index],e=this.last.year;t<1&&(t+=1,e+=1);var n=k.fromDayOfYear(t,e);this.last.day=n.day,this.last.month=n.month}},{key:"ruleDayOfWeek",value:function(t,e){var n=t.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);return n?[parseInt(n[1]||0,10),t=tt.icalDayToNumericDay(n[2],e)]:[0,0]}},{key:"next_generic",value: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]++;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}},{key:"increment_monthday",value:function(t){for(var e=0;e<t;e++){var n=k.daysInMonth(this.last.month,this.last.year);this.last.day++,this.last.day>n&&(this.last.day-=n,this.increment_month())}}},{key:"increment_month",value: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=H(this.last.month/12);this.last.month%=12,this.last.month++,0!=t&&this.increment_year(t)}}},{key:"increment_year",value:function(t){this.last.year+=t}},{key:"increment_generic",value:function(t,e,n,r){this.last[e]+=t;var i=H(this.last[e]/n);this.last[e]%=n,0!=i&&this["increment_"+r](i)}},{key:"has_by_data",value:function(t){return t in this.rule.parts}},{key:"expand_year_days",value:function(t){var e=new k;this.days=[];for(var n={},r=0,i=["BYDAY","BYWEEKNO","BYMONTHDAY","BYMONTH","BYYEARDAY"];r<i.length;r++){var a=i[r];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 l=this.by_data.BYMONTH[u];e.month=l,e.day=1;var h=e.weekNumber(this.rule.wkst);e.day=k.daysInMonth(l,t);var c=e.weekNumber(this.rule.wkst);for(u=h;u<c;u++)o[u]=1}for(var f=0;f<this.by_data.BYWEEKNO.length&&s;f++){this.by_data.BYWEEKNO[f]<52?s&=o[f]:s=0}s?delete n.BYMONTH:delete n.BYWEEKNO}var d=Object.keys(n).length;if(0==d){var y=this.dtstart.clone();y.year=this.last.year,this.days.push(y.dayOfYear())}else if(1==d&&"BYMONTH"in n){var m,v=p(this.by_data.BYMONTH);try{for(v.s();!(m=v.n()).done;){var _=m.value,g=this.dtstart.clone();g.year=t,g.month=_,g.isDate=!0,this.days.push(g.dayOfYear())}}catch(t){v.e(t)}finally{v.f()}}else if(1==d&&"BYMONTHDAY"in n){var D,T=p(this.by_data.BYMONTHDAY);try{for(T.s();!(D=T.n()).done;){var Y=D.value,b=this.dtstart.clone();if(Y<0)Y=Y+k.daysInMonth(b.month,t)+1;b.day=Y,b.year=t,b.isDate=!0,this.days.push(b.dayOfYear())}}catch(t){T.e(t)}finally{T.f()}}else if(2==d&&"BYMONTHDAY"in n&&"BYMONTH"in n){var O,A=p(this.by_data.BYMONTH);try{for(A.s();!(O=A.n()).done;){var S,w=O.value,E=k.daysInMonth(w,t),C=p(this.by_data.BYMONTHDAY);try{for(C.s();!(S=C.n()).done;){var x=S.value;x<0&&(x=x+E+1),e.day=x,e.month=w,e.year=t,e.isDate=!0,this.days.push(e.dayOfYear())}}catch(t){C.e(t)}finally{C.f()}}}catch(t){A.e(t)}finally{A.f()}}else if(1==d&&"BYWEEKNO"in n);else if(2==d&&"BYWEEKNO"in n&&"BYMONTHDAY"in n);else if(1==d&&"BYDAY"in n)this.days=this.days.concat(this.expand_by_day(t));else if(2==d&&"BYDAY"in n&&"BYMONTH"in n){var N,I=p(this.by_data.BYMONTH);try{for(I.s();!(N=I.n()).done;){var B=N.value,M=k.daysInMonth(B,t);e.year=t,e.month=B,e.day=1,e.isDate=!0;var L=e.dayOfWeek(),z=e.dayOfYear()-1;e.day=M;var P=e.dayOfWeek();if(this.has_by_data("BYSETPOS")){for(var U=[],j=1;j<=M;j++)e.day=j,this.is_day_in_byday(e)&&U.push(j);for(var V=0;V<U.length;V++)(this.check_set_position(V+1)||this.check_set_position(V-U.length))&&this.days.push(z+U[V])}else{var R,H=p(this.by_data.BYDAY);try{for(H.s();!(R=H.n()).done;){var W=R.value,F=this.ruleDayOfWeek(W),K=F[0],q=F[1],J=void 0,Z=(q+7-L)%7+1,G=M-(P+7-q)%7;if(0==K)for(var X=Z;X<=M;X+=7)this.days.push(z+X);else K>0?(J=Z+7*(K-1))<=M&&this.days.push(z+J):(J=G+7*(K+1))>0&&this.days.push(z+J)}}catch(t){H.e(t)}finally{H.f()}}}}catch(t){I.e(t)}finally{I.f()}this.days.sort((function(t,e){return t-e}))}else if(2==d&&"BYDAY"in n&&"BYMONTHDAY"in n){var Q,$=p(this.expand_by_day(t));try{for($.s();!(Q=$.n()).done;){var tt=Q.value,et=k.fromDayOfYear(tt,t);this.by_data.BYMONTHDAY.indexOf(et.day)>=0&&this.days.push(tt)}}catch(t){$.e(t)}finally{$.f()}}else if(3==d&&"BYDAY"in n&&"BYMONTHDAY"in n&&"BYMONTH"in n){var nt,rt=p(this.expand_by_day(t));try{for(rt.s();!(nt=rt.n()).done;){var it=nt.value,at=k.fromDayOfYear(it,t);this.by_data.BYMONTH.indexOf(at.month)>=0&&this.by_data.BYMONTHDAY.indexOf(at.day)>=0&&this.days.push(it)}}catch(t){rt.e(t)}finally{rt.f()}}else if(2==d&&"BYDAY"in n&&"BYWEEKNO"in n){var st,ot=p(this.expand_by_day(t));try{for(ot.s();!(st=ot.n()).done;){var ut=st.value,lt=k.fromDayOfYear(ut,t).weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(lt)&&this.days.push(ut)}}catch(t){ot.e(t)}finally{ot.f()}}else 3==d&&"BYDAY"in n&&"BYWEEKNO"in n&&"BYMONTHDAY"in n||(this.days=1==d&&"BYYEARDAY"in n?this.days.concat(this.by_data.BYYEARDAY):[]);return 0}},{key:"expand_by_day",value: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,a=n.dayOfWeek(),s=n.dayOfYear(),o=p(this.by_data.BYDAY);try{for(o.s();!(i=o.n()).done;){var u=i.value,l=this.ruleDayOfWeek(u),h=l[0],c=l[1];if(0==h)for(var f=(c+7-r)%7+1;f<=s;f+=7)e.push(f);else if(h>0){var d=void 0;d=c>=r?c-r+1:c-r+8,e.push(d+7*(h-1))}else{var y=void 0;h=-h,y=c<=a?s-a+c:s-a+c-7,e.push(y-7*(h-1))}}}catch(t){o.e(t)}finally{o.f()}return e}},{key:"is_day_in_byday",value:function(t){if(this.by_data.BYDAY){var e,n=p(this.by_data.BYDAY);try{for(n.s();!(e=n.n()).done;){var r=e.value,i=this.ruleDayOfWeek(r),a=i[0],s=i[1],o=t.dayOfWeek();if(0==a&&s==o||t.nthWeekDay(s,a)==t.day)return 1}}catch(t){n.e(t)}finally{n.f()}}return 0}},{key:"check_set_position",value:function(t){return!!this.has_by_data("BYSETPOS")&&-1!==this.by_data.BYSETPOS.indexOf(t)}},{key:"sort_byday_rules",value:function(t){for(var e=0;e<t.length;e++)for(var n=0;n<e;n++){if(this.ruleDayOfWeek(t[n],this.rule.wkst)[1]>this.ruleDayOfWeek(t[e],this.rule.wkst)[1]){var r=t[e];t[e]=t[n],t[n]=r}}}},{key:"check_contract_restriction",value: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,o=p(this.by_data[e]);try{for(o.s();!(s=o.n()).done;){if(s.value==n){a=!0;break}}}catch(t){o.e(t)}finally{o.f()}}else a=!0;return a}},{key:"check_contracting_rules",value: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",tt.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)}},{key:"setup_defaults",value: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}},{key:"toJSON",value: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}}])}();u(J,"_indexMap",{BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8}),u(J,"_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]}),u(J,"UNKNOWN",0),u(J,"CONTRACT",1),u(J,"EXPAND",2),u(J,"ILLEGAL",3);var Z=/^(SU|MO|TU|WE|TH|FR|SA)$/,G=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,X={SU:k.SUNDAY,MO:k.MONDAY,TU:k.TUESDAY,WE:k.WEDNESDAY,TH:k.THURSDAY,FR:k.FRIDAY,SA:k.SATURDAY},Q=Object.fromEntries(Object.entries(X).map((function(t){return t.reverse()}))),$=["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],tt=function(){function t(e){a(this,t),u(this,"parts",null),u(this,"interval",1),u(this,"wkst",k.MONDAY),u(this,"until",null),u(this,"count",null),u(this,"freq",null),u(this,"icalclass","icalrecur"),u(this,"icaltype","recur"),this.wrappedJSObject=this,this.parts={},e&&"object"===i(e)&&this.fromData(e)}return o(t,[{key:"iterator",value:function(t){return new J({rule:this,dtstart:t})}},{key:"clone",value:function(){return new t(this.toJSON())}},{key:"isFinite",value:function(){return!(!this.count&&!this.until)}},{key:"isByCount",value:function(){return!(!this.count||this.until)}},{key:"addComponent",value:function(t,e){var n=t.toUpperCase();n in this.parts?this.parts[n].push(e):this.parts[n]=[e]}},{key:"setComponent",value:function(t,e){this.parts[t.toUpperCase()]=e.slice()}},{key:"getComponent",value:function(t){var e=t.toUpperCase();return e in this.parts?this.parts[e].slice():[]}},{key:"getNextOccurrence",value: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}},{key:"fromData",value:function(e){for(var n in e){var r=n.toUpperCase();r in rt?Array.isArray(e[n])?this.parts[r]=e[n]:this.parts[r]=[e[n]]:this[n]=e[n]}this.interval&&"number"!=typeof this.interval&&nt.INTERVAL(this.interval,this),this.wkst&&"number"!=typeof this.wkst&&(this.wkst=t.icalDayToNumericDay(this.wkst)),!this.until||this.until instanceof k||(this.until=k.fromString(this.until))}},{key:"toJSON",value:function(){var e=Object.create(null);e.freq=this.freq,this.count&&(e.count=this.count),this.interval>1&&(e.interval=this.interval);for(var n=0,r=Object.entries(this.parts);n<r.length;n++){var i=d(r[n],2),a=i[0],s=i[1];Array.isArray(s)&&1==s.length?e[a.toLowerCase()]=s[0]:e[a.toLowerCase()]=j(s)}return this.until&&(e.until=this.until.toString()),"wkst"in this&&this.wkst!==k.DEFAULT_WEEK_START&&(e.wkst=t.numericDayToIcalDay(this.wkst)),e}},{key:"toString",value:function(){var e="FREQ="+this.freq;this.count&&(e+=";COUNT="+this.count),this.interval>1&&(e+=";INTERVAL="+this.interval);for(var n=0,r=Object.entries(this.parts);n<r.length;n++){var i=d(r[n],2);e+=";"+i[0]+"="+i[1]}return this.until&&(e+=";UNTIL="+this.until.toICALString()),"wkst"in this&&this.wkst!==k.DEFAULT_WEEK_START&&(e+=";WKST="+t.numericDayToIcalDay(this.wkst)),e}}],[{key:"fromString",value:function(e){return new t(this._stringToData(e,!1))}},{key:"fromData",value:function(e){return new t(e)}},{key:"_stringToData",value: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("="),o=s[0].toUpperCase(),u=s[0].toLowerCase(),l=e?u:o,h=s[1];if(o in rt){for(var c=h.split(","),f=0,d=c.length;f<d;f++)c[f]=rt[o](c[f]);n[l]=1==c.length?c[0]:c}else o in nt?nt[o](h,n,e):n[u]=h}return n}},{key:"icalDayToNumericDay",value:function(t,e){var n=e||k.SUNDAY;return(X[t]-n+7)%7+1}},{key:"numericDayToIcalDay",value:function(t,e){var n=t+(e||k.SUNDAY)-k.SUNDAY;return n>7&&(n-=7),Q[n]}}])}();function et(t,e,n,r){var i=r;if("+"===r[0]&&(i=r.slice(1)),i=L(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}var nt={FREQ:function(t,e,n){if(-1===$.indexOf(t))throw new Error('invalid frequency "'+t+'" expected: "'+$.join(", ")+'"');e.freq=t},COUNT:function(t,e,n){e.count=L(t)},INTERVAL:function(t,e,n){e.interval=L(t),e.interval<1&&(e.interval=1)},UNTIL:function(t,e,n){t.length>10?e.until=Ct.icalendar.value["date-time"].fromICAL(t):e.until=Ct.icalendar.value.date.fromICAL(t),n||(e.until=k.fromString(e.until))},WKST:function(t,e,n){if(!Z.test(t))throw new Error('invalid WKST value "'+t+'"');e.wkst=tt.icalDayToNumericDay(t)}},rt={BYSECOND:et.bind(void 0,"BYSECOND",0,60),BYMINUTE:et.bind(void 0,"BYMINUTE",0,59),BYHOUR:et.bind(void 0,"BYHOUR",0,23),BYDAY:function(t){if(G.test(t))return t;throw new Error('invalid BYDAY value "'+t+'"')},BYMONTHDAY:et.bind(void 0,"BYMONTHDAY",-31,31),BYYEARDAY:et.bind(void 0,"BYYEARDAY",-366,366),BYWEEKNO:et.bind(void 0,"BYWEEKNO",-53,53),BYMONTH:et.bind(void 0,"BYMONTH",1,12),BYSETPOS:et.bind(void 0,"BYSETPOS",-366,366)},it=function(){function t(e){if(a(this,t),u(this,"start",null),u(this,"end",null),u(this,"duration",null),u(this,"icalclass","icalperiod"),u(this,"icaltype","period"),this.wrappedJSObject=this,e&&"start"in e){if(e.start&&!(e.start instanceof k))throw new TypeError(".start must be an instance of ICAL.Time");this.start=e.start}if(e&&e.end&&e.duration)throw new Error("cannot accept both end and duration");if(e&&"end"in e){if(e.end&&!(e.end instanceof k))throw new TypeError(".end must be an instance of ICAL.Time");this.end=e.end}if(e&&"duration"in e){if(e.duration&&!(e.duration instanceof T))throw new TypeError(".duration must be an instance of ICAL.Duration");this.duration=e.duration}}return o(t,[{key:"clone",value:function(){return t.fromData({start:this.start?this.start.clone():null,end:this.end?this.end.clone():null,duration:this.duration?this.duration.clone():null})}},{key:"getDuration",value:function(){return this.duration?this.duration:this.end.subtractDate(this.start)}},{key:"getEnd",value:function(){if(this.end)return this.end;var t=this.start.clone();return t.addDuration(this.duration),t}},{key:"toString",value:function(){return this.start+"/"+(this.end||this.duration)}},{key:"toJSON",value:function(){return[this.start.toString(),(this.end||this.duration).toString()]}},{key:"toICALString",value:function(){return this.start.toICALString()+"/"+(this.end||this.duration).toICALString()}}],[{key:"fromString",value:function(e,n){var r=e.split("/");if(2!==r.length)throw new Error('Invalid string value: "'+e+'" must contain a "/" char.');var i={start:k.fromDateTimeString(r[0],n)},a=r[1];return T.isValueString(a)?i.duration=T.fromString(a):i.end=k.fromDateTimeString(a,n),new t(i)}},{key:"fromData",value:function(e){return new t(e)}},{key:"fromJSON",value:function(e,n,r){function i(t,e){return r?k.fromString(t,e):k.fromDateTimeString(t,e)}return T.isValueString(e[1])?t.fromData({start:i(e[0],n),duration:T.fromString(e[1])}):t.fromData({start:i(e[0],n),end:i(e[1],n)})}}])}(),at=/\\\\|\\,|\\[Nn]/g,st=/\\|,|\n/g;function ot(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,e.flags));return t.replace(e,_t)}(e,t,n)},toICAL:function(t,n){var r=e;return n&&(r=new RegExp(r.source+"|"+n,r.flags)),t.replace(r,(function(t){switch(t){case"\\":return"\\\\";case";":return"\\;";case",":return"\\,";case"\n":return"\\n";default:return t}}))}}}var ut={defaultType:"text"},lt={defaultType:"text",multiValue:","},ht={defaultType:"text",structuredValue:";"},ct={defaultType:"integer"},ft={defaultType:"date-time",allowedTypes:["date-time","date"]},dt={defaultType:"date-time"},yt={defaultType:"uri"},mt={defaultType:"utc-offset"},pt={defaultType:"recur"},vt={defaultType:"date-and-or-time",allowedTypes:["date-time","date","text"]};function _t(t){switch(t){case"\\\\":return"\\";case"\\;":return";";case"\\,":return",";case"\\n":case"\\N":return"\n";default:return t}}var gt={categories:lt,url:yt,version:ut,uid:ut},Dt={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 e=parseFloat(t);return M(e)?0:e},toICAL:function(t){return String(t)}},integer:{fromICAL:function(t){var e=parseInt(t);return M(e)?0:e},toICAL:function(t){return String(t)}},"utc-offset":{toICAL:function(t){return t.length<7?t.slice(0,3)+t.slice(4,6):t.slice(0,3)+t.slice(4,6)+t.slice(7,9)},fromICAL:function(t){return t.length<6?t.slice(0,3)+":"+t.slice(3,5):t.slice(0,3)+":"+t.slice(3,5)+":"+t.slice(5,7)},decorate:function(t){return K.fromString(t)},undecorate:function(t){return t.toString()}}},Tt=W(Dt,{text:ot(/\\\\|\\;|\\,|\\[Nn]/g,/\\|;|,|\n/g),uri:{},binary:{decorate:function(t){return _.fromString(t)},undecorate:function(t){return t.toString()}},"cal-address":{},date:{decorate:function(t,e){return Ct.strict?k.fromDateString(t,e):k.fromString(t,e)},undecorate:function(t){return t.toString()},fromICAL:function(t){return!Ct.strict&&t.length>=15?Tt["date-time"].fromICAL(t):t.slice(0,4)+"-"+t.slice(4,6)+"-"+t.slice(6,8)},toICAL:function(t){var e=t.length;return 10==e?t.slice(0,4)+t.slice(5,7)+t.slice(8,10):e>=19?Tt["date-time"].toICAL(t):t}},"date-time":{fromICAL:function(t){if(Ct.strict||8!=t.length){var e=t.slice(0,4)+"-"+t.slice(4,6)+"-"+t.slice(6,8)+"T"+t.slice(9,11)+":"+t.slice(11,13)+":"+t.slice(13,15);return t[15]&&"Z"===t[15]&&(e+="Z"),e}return Tt.date.fromICAL(t)},toICAL:function(t){var e=t.length;if(10!=e||Ct.strict){if(e>=19){var n=t.slice(0,4)+t.slice(5,7)+t.slice(8,13)+t.slice(14,16)+t.slice(17,19);return t[19]&&"Z"===t[19]&&(n+="Z"),n}return t}return Tt.date.toICAL(t)},decorate:function(t,e){return Ct.strict?k.fromDateTimeString(t,e):k.fromString(t,e)},undecorate:function(t){return t.toString()}},duration:{decorate:function(t){return T.fromString(t)},undecorate:function(t){return t.toString()}},period:{fromICAL:function(t){var e=t.split("/");return e[0]=Tt["date-time"].fromICAL(e[0]),T.isValueString(e[1])||(e[1]=Tt["date-time"].fromICAL(e[1])),e},toICAL:function(t){return t=t.slice(),Ct.strict||10!=t[0].length?t[0]=Tt["date-time"].toICAL(t[0]):t[0]=Tt.date.toICAL(t[0]),T.isValueString(t[1])||(Ct.strict||10!=t[1].length?t[1]=Tt["date-time"].toICAL(t[1]):t[1]=Tt.date.toICAL(t[1])),t.join("/")},decorate:function(t,e){return it.fromJSON(t,e,!Ct.strict)},undecorate:function(t){return t.toJSON()}},recur:{fromICAL:function(t){return tt._stringToData(t,!0)},toICAL:function(t){for(var e="",n=0,r=Object.entries(t);n<r.length;n++){var i=d(r[n],2),a=i[0],s=i[1];"until"==a?s=s.length>10?Tt["date-time"].toICAL(s):Tt.date.toICAL(s):"wkst"==a?"number"==typeof s&&(s=tt.numericDayToIcalDay(s)):Array.isArray(s)&&(s=s.join(",")),e+=a.toUpperCase()+"="+s+";"}return e.slice(0,Math.max(0,e.length-1))},decorate:function(t){return tt.fromData(t)},undecorate:function(t){return t.toJSON()}},time:{fromICAL:function(t){if(t.length<6)return t;var e=t.slice(0,2)+":"+t.slice(2,4)+":"+t.slice(4,6);return"Z"===t[6]&&(e+="Z"),e},toICAL:function(t){if(t.length<8)return t;var e=t.slice(0,2)+t.slice(3,5)+t.slice(6,8);return"Z"===t[8]&&(e+="Z"),e}}}),Yt=W(gt,{action:ut,attach:{defaultType:"uri"},attendee:{defaultType:"cal-address"},calscale:ut,class:ut,comment:ut,completed:dt,contact:ut,created:dt,description:ut,dtend:ft,dtstamp:dt,dtstart:ft,due:ft,duration:{defaultType:"duration"},exdate:{defaultType:"date-time",allowedTypes:["date-time","date"],multiValue:","},exrule:pt,freebusy:{defaultType:"period",multiValue:","},geo:{defaultType:"float",structuredValue:";"},"last-modified":dt,location:ut,method:ut,organizer:{defaultType:"cal-address"},"percent-complete":ct,priority:ct,prodid:ut,"related-to":ut,repeat:ct,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":ft,resources:lt,"request-status":ht,rrule:pt,sequence:ct,status:ut,summary:ut,transp:ut,trigger:{defaultType:"duration",allowedTypes:["duration","date-time"]},tzoffsetfrom:mt,tzoffsetto:mt,tzurl:yt,tzid:ut,tzname:ut}),kt=W(Dt,{text:ot(at,st),uri:ot(at,st),date:{decorate:function(t){return q.fromDateAndOrTimeString(t,"date")},undecorate:function(t){return t.toString()},fromICAL:function(t){return 8==t.length?Tt.date.fromICAL(t):"-"==t[0]&&6==t.length?t.slice(0,4)+"-"+t.slice(4):t},toICAL:function(t){return 10==t.length?Tt.date.toICAL(t):"-"==t[0]&&7==t.length?t.slice(0,4)+t.slice(5):t}},time:{decorate:function(t){return q.fromDateAndOrTimeString("T"+t,"time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=kt.time._splitZone(t,!0),n=e[0],r=e[1];return 6==r.length?r=r.slice(0,2)+":"+r.slice(2,4)+":"+r.slice(4,6):4==r.length&&"-"!=r[0]?r=r.slice(0,2)+":"+r.slice(2,4):5==r.length&&(r=r.slice(0,3)+":"+r.slice(3,5)),5!=n.length||"-"!=n[0]&&"+"!=n[0]||(n=n.slice(0,3)+":"+n.slice(3)),r+n},toICAL:function(t){var e=kt.time._splitZone(t),n=e[0],r=e[1];return 8==r.length?r=r.slice(0,2)+r.slice(3,5)+r.slice(6,8):5==r.length&&"-"!=r[0]?r=r.slice(0,2)+r.slice(3,5):6==r.length&&(r=r.slice(0,3)+r.slice(4,6)),6!=n.length||"-"!=n[0]&&"+"!=n[0]||(n=n.slice(0,3)+n.slice(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.slice(0,Math.max(0,i))):t.length>6&&("-"==s||"+"==s)?(n=t.slice(a),r=t.slice(0,Math.max(0,a))):(n="",r=t),[n,r]}},"date-time":{decorate:function(t){return q.fromDateAndOrTimeString(t,"date-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){return kt["date-and-or-time"].fromICAL(t)},toICAL:function(t){return kt["date-and-or-time"].toICAL(t)}},"date-and-or-time":{decorate:function(t){return q.fromDateAndOrTimeString(t,"date-and-or-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=t.split("T");return(e[0]?kt.date.fromICAL(e[0]):"")+(e[1]?"T"+kt.time.fromICAL(e[1]):"")},toICAL:function(t){var e=t.split("T");return kt.date.toICAL(e[0])+(e[1]?"T"+kt.time.toICAL(e[1]):"")}},timestamp:Tt["date-time"],"language-tag":{matches:/^[a-zA-Z0-9-]+$/},"phone-number":{fromICAL:function(t){return Array.from(t).filter((function(t){return"\\"===t?void 0:t})).join("")},toICAL:function(t){return Array.from(t).map((function(t){return","===t||";"===t?"\\"+t:t})).join("")}}}),bt=W(gt,{adr:{defaultType:"text",structuredValue:";",multiValue:","},anniversary:vt,bday:vt,caladruri:yt,caluri:yt,clientpidmap:ht,email:ut,fburl:yt,fn:ut,gender:ht,geo:yt,impp:yt,key:yt,kind:ut,lang:{defaultType:"language-tag"},logo:yt,member:yt,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:lt,note:ut,org:{defaultType:"text",structuredValue:";"},photo:yt,related:yt,rev:{defaultType:"timestamp"},role:ut,sound:yt,source:yt,tel:{defaultType:"uri",allowedTypes:["uri","text"]},title:ut,tz:{defaultType:"text",allowedTypes:["text","utc-offset","uri"]},xml:ut}),Ot=W(Dt,{binary:Tt.binary,date:kt.date,"date-time":kt["date-time"],"phone-number":kt["phone-number"],uri:Tt.uri,text:Tt.text,time:Tt.time,vcard:Tt.text,"utc-offset":{toICAL:function(t){return t.slice(0,7)},fromICAL:function(t){return t.slice(0,7)},decorate:function(t){return K.fromString(t)},undecorate:function(t){return t.toString()}}}),At=W(gt,{fn:ut,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:lt,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:ut,tel:{defaultType:"phone-number"},email:ut,mailer:ut,tz:{defaultType:"utc-offset",allowedTypes:["utc-offset","text"]},geo:{defaultType:"float",structuredValue:";"},title:ut,role:ut,logo:{defaultType:"binary",allowedTypes:["binary","uri"]},agent:{defaultType:"vcard",allowedTypes:["vcard","text","uri"]},org:ht,note:lt,prodid:ut,rev:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(t){return-1===t.indexOf("T")?"date":"date-time"}},"sort-string":ut,sound:{defaultType:"binary",allowedTypes:["binary","uri"]},class:ut,key:{defaultType:"binary",allowedTypes:["binary","text"]}}),St={value:Tt,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:Yt,propertyGroups:!1},wt={value:kt,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:bt,propertyGroups:!0},Et={value:Ot,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:At,propertyGroups:!0},Ct={strict:!0,defaultSet:St,defaultType:"unknown",components:{vcard:wt,vcard3:Et,vevent:St,vtodo:St,vjournal:St,valarm:St,vtimezone:St,daylight:St,standard:St},icalendar:St,vcard:wt,vcard3:Et,getDesignSet:function(t){return t&&t in Ct.components?Ct.components[t]:Ct.defaultSet}},xt="\r\n",Nt="unknown",It={'"':"^'","\n":"^n","^":"^^"};function Bt(t){"string"==typeof t[0]&&(t=[t]);for(var e=0,n=t.length,r="";e<n;e++)r+=Bt.component(t[e])+xt;return r}Bt.component=function(t,e){var n=t[0].toUpperCase(),r="BEGIN:"+n+xt,i=t[1],a=0,s=i.length,o=t[0];for("vcard"===o&&t[1].length>0&&("version"!==t[1][0][0]||"4.0"!==t[1][0][3])&&(o="vcard3"),e=e||Ct.getDesignSet(o);a<s;a++)r+=Bt.property(i[a],e)+xt;for(var u=t[2]||[],l=0,h=u.length;l<h;l++)r+=Bt.component(u[l],e)+xt;return r+="END:"+n},Bt.property=function(t,e,n){var r=t[0].toUpperCase(),i=t[0],a=t[1];e||(e=Ct.defaultSet);var s,o=a.group;s=e.propertyGroups&&o?o.toUpperCase()+"."+r:r;for(var u=function(){var t=d(h[l],2),n=t[0],r=t[1];if(e.propertyGroups&&"group"==n)return 1;var i=e.param[n],a=i&&i.multiValue;a&&Array.isArray(r)?(r=r.map((function(t){return t=Bt._rfc6868Unescape(t),t=Bt.paramPropertyValue(t,i.multiValueSeparateDQuote)})),r=Bt.multiValue(r,a,"unknown",null,e)):(r=Bt._rfc6868Unescape(r),r=Bt.paramPropertyValue(r)),s+=";"+n.toUpperCase()+"="+r},l=0,h=Object.entries(a);l<h.length;l++)u();if(3===t.length)return s+":";var c,f=t[2],y=!1,m=!1,p=!1;return i in e.property?("multiValue"in(c=e.property[i])&&(y=c.multiValue),"structuredValue"in c&&Array.isArray(t[3])&&(m=c.structuredValue),"defaultType"in c?f===c.defaultType&&(p=!0):f===Nt&&(p=!0)):f===Nt&&(p=!0),p||(s+=";VALUE="+f.toUpperCase()),s+=":",s+=y&&m?Bt.multiValue(t[3],m,f,y,e,m):y?Bt.multiValue(t.slice(3),y,f,null,e,!1):m?Bt.multiValue(t[3],m,f,null,e,m):Bt.value(t[3],f,e,!1),n?s:V(s)},Bt.paramPropertyValue=function(t,e){return e||-1!==P(t,",")||-1!==P(t,":")||-1!==P(t,";")?'"'+t+'"':t},Bt.multiValue=function(t,e,n,r,i,a){for(var s="",o=t.length,u=0;u<o;u++)r&&Array.isArray(t[u])?s+=Bt.multiValue(t[u],r,n,null,i,a):s+=Bt.value(t[u],n,i,a),u!==o-1&&(s+=e);return s},Bt.value=function(t,e,n,r){return e in n.value&&"toICAL"in n.value[e]?n.value[e].toICAL(t,r):t},Bt._rfc6868Unescape=function(t){return t.replace(/[\n^"]/g,(function(t){return It[t]}))};var Mt=function(){function t(e,n){a(this,t),this._parent=n||null,"string"==typeof e?(this.jCal=[e,{},Ct.defaultType],this.jCal[2]=this.getDefaultType()):this.jCal=e,this._updateType()}return o(t,[{key:"type",get:function(){return this.jCal[2]}},{key:"name",get:function(){return this.jCal[0]}},{key:"parent",get:function(){return this._parent},set:function(t){var e=!this._parent||t&&t._designSet!=this._parent._designSet;this._parent=t,this.type==Ct.defaultType&&e&&(this.jCal[2]=this.getDefaultType(),this._updateType())}},{key:"_designSet",get:function(){return this.parent?this.parent._designSet:Ct.defaultSet}},{key:"_updateType",value:function(){var t=this._designSet;this.type in t.value&&("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]))}},{key:"_hydrateValue",value: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]}},{key:"_decorate",value:function(t){return this._designSet.value[this.type].decorate(t,this)}},{key:"_undecorate",value:function(t){return this._designSet.value[this.type].undecorate(t,this)}},{key:"_setDecoratedValue",value:function(t,e){this._values||(this._values=[]),"object"===i(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))}},{key:"getParameter",value:function(t){return t in this.jCal[1]?this.jCal[1][t]:void 0}},{key:"getFirstParameter",value:function(t){var e=this.getParameter(t);return Array.isArray(e)?e[0]:e}},{key:"setParameter",value: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}},{key:"removeParameter",value:function(t){delete this.jCal[1][t]}},{key:"getDefaultType",value:function(){var t=this.jCal[0],e=this._designSet;if(t in e.property){var n=e.property[t];if("defaultType"in n)return n.defaultType}return Ct.defaultType}},{key:"resetType",value:function(t){this.removeAllValues(),this.jCal[2]=t,this._updateType()}},{key:"getFirstValue",value:function(){return this._hydrateValue(0)}},{key:"getValues",value: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}},{key:"removeAllValues",value:function(){this._values&&(this._values.length=0),this.jCal.length=3}},{key:"setValues",value: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"===i(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]}},{key:"setValue",value:function(t){this.removeAllValues(),"object"===i(t)&&"icaltype"in t&&this.resetType(t.icaltype),this.isDecorated?this._setDecoratedValue(t,0):this.jCal[3]=t}},{key:"toJSON",value:function(){return this.jCal}},{key:"toICALString",value:function(){return Bt.property(this.jCal,this._designSet,!0)}}],[{key:"fromString",value:function(e,n){return new t(S.property(e,n))}}])}(),Lt=function(){function t(e,n){a(this,t),u(this,"_hydratedPropertyCount",0),u(this,"_hydratedComponentCount",0),u(this,"_timezoneCache",null),"string"==typeof e&&(e=[e,[],[]]),this.jCal=e,this.parent=n||null,this.parent||"vcalendar"!==this.name||(this._timezoneCache=new Map)}return o(t,[{key:"name",get:function(){return this.jCal[0]}},{key:"_designSet",get:function(){return this.parent&&this.parent._designSet||Ct.getDesignSet(this.name)}},{key:"_hydrateComponent",value: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}},{key:"_hydrateProperty",value:function(t){if(this._properties||(this._properties=[],this._hydratedPropertyCount=0),this._properties[t])return this._properties[t];var e=new Mt(this.jCal[1][t],this);return this._hydratedPropertyCount++,this._properties[t]=e}},{key:"getFirstSubcomponent",value: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}},{key:"getAllSubcomponents",value: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||[]}},{key:"hasProperty",value: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}},{key:"getFirstProperty",value: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}},{key:"getFirstPropertyValue",value:function(t){var e=this.getFirstProperty(t);return e?e.getFirstValue():null}},{key:"getAllProperties",value: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||[]}},{key:"_removeObjectByIndex",value: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)}},{key:"_removeObject",value: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}},{key:"_removeAllObjects",value: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)}},{key:"addSubcomponent",value: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}},{key:"removeSubcomponent",value:function(t){var e=this._removeObject(2,"_components",t);return e&&this._hydratedComponentCount--,e}},{key:"removeAllSubcomponents",value:function(t){var e=this._removeAllObjects(2,"_components",t);return this._hydratedComponentCount=0,e}},{key:"addProperty",value:function(t){if(!(t instanceof Mt))throw new TypeError("must be 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}},{key:"addPropertyWithValue",value:function(t,e){var n=new Mt(t);return n.setValue(e),this.addProperty(n),n}},{key:"updatePropertyWithValue",value:function(t,e){var n=this.getFirstProperty(t);return n?n.setValue(e):n=this.addPropertyWithValue(t,e),n}},{key:"removeProperty",value:function(t){var e=this._removeObject(1,"_properties",t);return e&&this._hydratedPropertyCount--,e}},{key:"removeAllProperties",value:function(t){var e=this._removeAllObjects(1,"_properties",t);return this._hydratedPropertyCount=0,e}},{key:"toJSON",value:function(){return this.jCal}},{key:"toString",value:function(){return Bt.component(this.jCal,this._designSet)}},{key:"getTimeZoneByID",value:function(t){if(this.parent)return this.parent.getTimeZoneByID(t);if(!this._timezoneCache)return null;if(this._timezoneCache.has(t))return this._timezoneCache.get(t);var e,n=p(this.getAllSubcomponents("vtimezone"));try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.getFirstProperty("tzid").getFirstValue()===t){var i=new C({component:r,tzid:t});return this._timezoneCache.set(t,i),i}}}catch(t){n.e(t)}finally{n.f()}return null}}],[{key:"fromString",value:function(e){return new t(S.component(e))}}])}(),zt=function(){return o((function t(e){a(this,t),u(this,"complete",!1),u(this,"ruleIterators",null),u(this,"ruleDates",null),u(this,"exDates",null),u(this,"ruleDateInc",0),u(this,"exDateInc",0),u(this,"exDate",null),u(this,"ruleDate",null),u(this,"dtstart",null),u(this,"last",null),this.ruleDates=[],this.exDates=[],this.fromData(e)}),[{key:"fromData",value:function(t){var e=z(t.dtstart,k);if(!e)throw new Error(".dtstart (ICAL.Time) must be given");if(this.dtstart=e,t.component)this._init(t.component);else{if(this.last=z(t.last,k)||e.clone(),!t.ruleIterators)throw new Error(".ruleIterators or .component must be given");this.ruleIterators=t.ruleIterators.map((function(t){return z(t,J)})),this.ruleDateInc=t.ruleDateInc,this.exDateInc=t.exDateInc,t.ruleDates&&(this.ruleDates=t.ruleDates.map((function(t){return z(t,k)})),this.ruleDate=this.ruleDates[this.ruleDateInc]),t.exDates&&(this.exDates=t.exDates.map((function(t){return z(t,k)})),this.exDate=this.exDates[this.exDateInc]),void 0!==t.complete&&(this.complete=t.complete)}}},{key:"next",value:function(){for(var t,e,n,r=0;;){if(r++>500)throw new Error("max tries have occurred, rule may be impossible to fulfill.");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()}}},{key:"toJSON",value: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}},{key:"_extractDates",value:function(t,e){for(var n=[],r=t.getAllProperties(e),i=0,a=r.length;i<a;i++){var s,o=p(r[i].getValues());try{for(o.s();!(s=o.n()).done;){var u=s.value,l=U(n,u,(function(t,e){return t.compare(e)}));n.splice(l,0,u)}}catch(t){o.e(t)}finally{o.f()}}return n}},{key:"_init",value:function(t){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!t.hasProperty("rdate")&&!t.hasProperty("rrule")&&!t.hasProperty("recurrence-id"))return this.ruleDate=this.last.clone(),void(this.complete=!0);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=U(this.ruleDates,this.last,(function(t,e){return t.compare(e)})),this.ruleDate=this.ruleDates[this.ruleDateInc]),t.hasProperty("rrule"))for(var e,n=t.getAllProperties("rrule"),r=0,i=n.length;r<i;r++)e=n[r].getFirstValue().iterator(this.dtstart),this.ruleIterators.push(e),e.next();t.hasProperty("exdate")&&(this.exDates=this._extractDates(t,"exdate"),this.exDateInc=U(this.exDates,this.last,(function(t,e){return t.compare(e)})),this.exDate=this.exDates[this.exDateInc])}},{key:"_nextExDay",value:function(){this.exDate=this.exDates[++this.exDateInc]}},{key:"_nextRuleDay",value:function(){this.ruleDate=this.ruleDates[++this.ruleDateInc]}},{key:"_nextRecurrenceIter",value: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}}])}(),Pt=function(){function t(e,n){a(this,t),u(this,"exceptions",null),u(this,"strictExceptions",!1),e instanceof Lt||(n=e,e=null),this.component=e||new Lt("vevent"),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],n&&n.strictExceptions&&(this.strictExceptions=n.strictExceptions),n&&n.exceptions?n.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)}return o(t,[{key:"relateException",value:function(e){if(this.isRecurrenceException())throw new Error("cannot relate exception to exceptions");if(e instanceof Lt&&(e=new t(e)),this.strictExceptions&&e.uid!==this.uid)throw new Error("attempted to relate unrelated exception");var n=e.recurrenceId.toString();if(this.exceptions[n]=e,e.modifiesFuture()){var r=[e.recurrenceId.toUnixTime(),n],i=U(this.rangeExceptions,r,Ut);this.rangeExceptions.splice(i,0,r)}}},{key:"modifiesFuture",value:function(){return!!this.component.hasProperty("recurrence-id")&&this.component.getFirstProperty("recurrence-id").getParameter("range")===t.THISANDFUTURE}},{key:"findRangeException",value:function(t){if(!this.rangeExceptions.length)return null;var e=t.toUnixTime(),n=U(this.rangeExceptions,[e],Ut);if((n-=1)<0)return null;var r=this.rangeExceptions[n];return e<r[0]?null:r[1]}},{key:"getOccurrenceDetails",value:function(t){var e,n=t.toString(),r=t.convertToZone(C.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 l=o.recurrenceId.clone(),h=o.startDate.clone();l.zone=h.zone,u=h.subtractDate(l),this._rangeExceptionCache[s]=u}var c=t.clone();c.zone=o.startDate.zone,c.addDuration(u),(a=c.clone()).addDuration(o.duration),i.startDate=c,i.endDate=a}else(a=t.clone()).addDuration(this.duration),i.endDate=a,i.startDate=t,i.item=this}return i}},{key:"iterator",value:function(t){return new zt({component:this.component,dtstart:t||this.startDate})}},{key:"isRecurring",value:function(){var t=this.component;return t.hasProperty("rrule")||t.hasProperty("rdate")}},{key:"isRecurrenceException",value:function(){return this.component.hasProperty("recurrence-id")}},{key:"getRecurrenceTypes",value: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}},{key:"uid",get:function(){return this._firstProp("uid")},set:function(t){this._setProp("uid",t)}},{key:"startDate",get:function(){return this._firstProp("dtstart")},set:function(t){this._setTime("dtstart",t)}},{key:"endDate",get:function(){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:function(t){this.component.hasProperty("duration")&&this.component.removeProperty("duration"),this._setTime("dtend",t)}},{key:"duration",get:function(){var t=this._firstProp("duration");return t||this.endDate.subtractDateTz(this.startDate)},set:function(t){this.component.hasProperty("dtend")&&this.component.removeProperty("dtend"),this._setProp("duration",t)}},{key:"location",get:function(){return this._firstProp("location")},set:function(t){this._setProp("location",t)}},{key:"attendees",get:function(){return this.component.getAllProperties("attendee")}},{key:"summary",get:function(){return this._firstProp("summary")},set:function(t){this._setProp("summary",t)}},{key:"description",get:function(){return this._firstProp("description")},set:function(t){this._setProp("description",t)}},{key:"color",get:function(){return this._firstProp("color")},set:function(t){this._setProp("color",t)}},{key:"organizer",get:function(){return this._firstProp("organizer")},set:function(t){this._setProp("organizer",t)}},{key:"sequence",get:function(){return this._firstProp("sequence")},set:function(t){this._setProp("sequence",t)}},{key:"recurrenceId",get:function(){return this._firstProp("recurrence-id")},set:function(t){this._setTime("recurrence-id",t)}},{key:"_setTime",value:function(t,e){var n=this.component.getFirstProperty(t);n||(n=new Mt(t),this.component.addProperty(n)),e.zone===C.localTimezone||e.zone===C.utcTimezone?n.removeParameter("tzid"):n.setParameter("tzid",e.zone.tzid),n.setValue(e)}},{key:"_setProp",value:function(t,e){this.component.updatePropertyWithValue(t,e)}},{key:"_firstProp",value:function(t){return this.component.getFirstPropertyValue(t)}},{key:"toString",value:function(){return this.component.toString()}}])}();function Ut(t,e){return t[0]>e[0]?1:e[0]>t[0]?-1:0}u(Pt,"THISANDFUTURE","THISANDFUTURE");var jt=function(){return o((function t(e){a(this,t),u(this,"parseEvent",!0),u(this,"parseTimezone",!0),u(this,"oncomplete",(function(){})),u(this,"onerror",(function(t){})),u(this,"ontimezone",(function(t){})),u(this,"onevent",(function(t){})),void 0===e&&(e={});for(var n=0,r=Object.entries(e);n<r.length;n++){var i=d(r[n],2),s=i[0],o=i[1];this[s]=o}}),[{key:"process",value:function(t){"string"==typeof t&&(t=S(t)),t instanceof Lt||(t=new Lt(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 C({tzid:a,component:e}))}break;case"vevent":this.parseEvent&&this.onevent(new Pt(e));break;default:continue}this.oncomplete()}}])}(),Vt={foldLength:75,debug:!1,newLineChar:"\r\n",Binary:_,Component:Lt,ComponentParser:jt,Duration:T,Event:Pt,Period:it,Property:Mt,Recur:tt,RecurExpansion:zt,RecurIterator:J,Time:k,Timezone:C,TimezoneService:B,UtcOffset:K,VCardTime:q,parse:S,stringify:Bt,design:Ct,helpers:F};return Vt}));
|