/* 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;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=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 _,g=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>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(un)-(e=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=F(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 Y.fromSeconds(e-n)}},{key:"subtractDateTz",value:function(t){var e=this.toUnixTime(),n=t.toUnixTime();return Y.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||N.convert_time(e,this.zone,t),e.zone=t,e}},{key:"utcOffset",value:function(){return this.zone==N.localTimezone||this.zone==N.utcTimezone?0:this.zone.utcOffset(this)}},{key:"toICALString",value:function(){var t=this.toString();return t.length>10?It.icalendar.value["date-time"].toICAL(t):It.icalendar.value.date.toICAL(t)}},{key:"toString",value:function(){var t=this.year+"-"+W(this.month)+"-"+W(this.day);return this.isDate||(t+="T"+W(this.hour)+":"+W(this.minute)+":"+W(this.second),this.zone===N.utcTimezone&&(t+="Z")),t}},{key:"toJSDate",value:function(){return this.zone==N.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=F(u/60),m.second<0&&(m.second+=60,s--),l=m.minute+r+s,m.minute=l%60,o=F(l/60),m.minute<0&&(m.minute+=60,o--),h=m.hour+n+o,m.hour=h%24,d=F(h/24),m.hour<0&&(m.hour+=24,d--)),m.month>12?y=F((m.month-1)/12):m.month<1&&(y=F(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=N.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;r12||(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:P(t.slice(0,4)),month:P(t.slice(5,7)),day:P(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=N.utcTimezone:n&&(i=n.getParameter("tzid"),n.parent&&("standard"===n.parent.name||"daylight"===n.parent.name?r=N.localTimezone:i&&(r=n.parent.getTimeZoneByID(i))));var a={year:P(t.slice(0,4)),month:P(t.slice(5,7)),day:P(t.slice(8,10)),hour:P(t.slice(11,13)),minute:P(t.slice(14,16)),second:P(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,O)._||(O._=t(e,this,e.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:"Z"}))),t(e,this,O)._}},{key:"_cmp_attr",value:function(t,e,n){return t[n]>e[n]?1:t[n]1)throw new C("invalid ical body. component began but did not end");return e=null,1==n.length?n[0]:n}E.property=function(t,e){var n={component:[[],[]],designSet:e||It.defaultSet};return E._handleContentLine(t,n),n.component[1][0]},E.component=function(t){return E(t)};var C=function(t){function n(){var t;a(this,n);for(var r=arguments.length,i=new Array(r),s=0;su&&(l=-1),-1!==l){if(i=t.slice(0,Math.max(0,l)).toLowerCase(),-1==(s=E._parseParameters(t.slice(Math.max(0,l)),0,e.designSet))[2])throw new C("Invalid parameters in '"+t+"'");if(h=s[0],n=s[1].length+s[2]+l,-1===(r=t.slice(Math.max(0,n)).indexOf(S)))throw new C("Missing parameter value in '"+t+"'");a=t.slice(Math.max(0,n+r+1))}else{if(-1===u)throw new C('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=It.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=E._parseMultiValue(a,v,o,[],p,e.designSet,v)]:p?(m=[y,h,o],E._parseMultiValue(a,p,o,m,null,e.designSet,!1)):m=v?[y,h,o,a=E._parseMultiValue(a,v,o,[],null,e.designSet,v)]:[y,h,o,a=E._parseValue(a,o,e.designSet,!1)],"vcard"!==e.component[0]||0!==e.component[1].length||"version"===i&&"4.0"===a||(e.designSet=It.getDesignSet("vcard3")),e.component[1].push(m)},E._parseValue=function(t,e,n,r){return e in n.value&&"fromICAL"in n.value[e]?n.value[e].fromICAL(t,r):t},E._parseParameters=function(t,e,n){for(var r,i,a,s,o,u,l=e,h=0,c={},f=-1;!1!==h&&-1!==(h=t.indexOf("=",h+1));){if(0==(r=t.slice(l+1,h)).length)throw new C("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=E._rfc6868Escape('"'+o+'"'))),'"'===t[h+1]){if(f=h+2,h=t.indexOf('"',f),o&&-1!=h)for(var d=!0;d;)t[h+1]==o&&'"'==t[h+2]?h=t.indexOf('"',h+3):d=!1;if(-1===h)throw new C('invalid line (no matching double quote) "'+t+'"');a=t.slice(f,h),l=t.indexOf(";",h);var y=t.indexOf(S,h);(-1===l||-1!==y&&l>y)&&(h=!1)}else{f=h+1;var m=t.indexOf(";",f),p=t.indexOf(S,f);-1!==p&&m>p?(m=p,h=!1):-1===m?(m=-1===p?t.length:p,h=!1):(l=m,h=m),a=t.slice(f,m)}if(f+=a.length-(a=E._rfc6868Escape(a)).length,o){var v=u||o;a=E._parseMultiValue(a,v,s,[],null,n)}else a=E._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]},E._rfc6868Escape=function(t){return t.replace(/\^['n^]/g,(function(t){return w[t]}))},E._parseMultiValue=function(t,e,n,r,i,a,s){var o,u=0,l=0;if(0===e.length)return t;for(;-1!==(u=j(t,e,l));)o=t.slice(l,u),o=i?E._parseMultiValue(o,i,n,[],null,a,s):E._parseValue(o,n,a,s),r.push(o),l=u+e.length;return o=t.slice(l),o=i?E._parseMultiValue(o,i,n,[],null,a,s):E._parseValue(o,n,a,s),r.push(o),1==r.length?r[0]:r},E._eachLine=function(t,e){var n,r,i,a=t.length,s=t.search(A),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 x=["tzid","location","tznames","latitude","longitude"],N=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 Ut)this.component=t;else{if(t&&"component"in t)if("string"==typeof t.component){var e=E(t.component);this.component=new Ut(e)}else t.component instanceof Ut?this.component=t.component:this.component=null;for(var n=0,r=x;n=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=H(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=V(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=b.now();e._minimumExpansionYear=n.year}var r=t;if(rn)&&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.yeare.year?1:t.monthe.month?1:t.daye.day?1:t.houre.hour?1:t.minutee.minute?1:t.seconde.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,I)._||(I._=t(e,this,e.fromData({tzid:"UTC"}))),t(e,this,I)._}},{key:"localTimezone",get:function(){return t(e,this,B)._||(B._=t(e,this,e.fromData({tzid:"floating"}))),t(e,this,B)._}},{key:"adjust_change",value:function(t,e,n,r,i){return b.prototype.adjust.call(t,e,n,r,i,t)}}])}(),I={_:null},B={_:null};u(N,"_minimumExpansionYear",-1),u(N,"EXTRA_COVERAGE",5);var M=null,z={get count(){return null===M?0:Object.keys(M).length},reset:function(){M=Object.create(null);var t=N.utcTimezone;M.Z=t,M.UTC=t,M.GMT=t},_hard_reset:function(){M=null},has:function(t){return null!==M&&!!M[t]},get:function(t){return null===M&&this.reset(),M[t]},register:function(t,e){if(null===M&&this.reset(),"string"==typeof t&&e instanceof N){var n=[e,t];t=n[0],e=n[1]}if(e||(t instanceof N?e=t.tzid:"vtimezone"===t.name&&(e=(t=new N(t)).tzid)),!e)throw new TypeError("Neither a timezone nor a name was passed");if(!(t instanceof N))throw new TypeError("timezone must be ICAL.Timezone or ICAL.Component");M[e]=t},remove:function(t){return null===M?null:delete M[t]}};function L(t){return"number"==typeof t&&isNaN(t)}function P(t){var e=parseInt(t,10);if(L(e))throw new Error('Could not extract integer from "'+t+'"');return e}function U(t,e){if(void 0!==t)return t instanceof e?t:new e(t)}function j(t,e,n){for(;-1!==(n=t.indexOf(e,n));){if(!(n>0&&"\\"===t[n-1]))return n;n+=1}return-1}function V(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 H(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;r65535?2:1:(e+=Wt.newLineChar+" "+n.slice(0,Math.max(0,r)),n=n.slice(Math.max(0,r)),r=i=0)}return e.slice(Wt.newLineChar.length+1)}function W(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 F(t){return t<0?Math.ceil(t):Math.floor(t)}function K(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 q=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;an)-(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 It.icalendar.value["utc-offset"].toICAL(this.toString())}},{key:"toString",value:function(){return(1==this.factor?"+":"-")+W(this.hours)+":"+W(this.minutes)}}],[{key:"fromString",value:function(e){var n={};return n.factor="+"===e[0]?1:-1,n.hours=P(e.slice(1,3)),n.minutes=P(e.slice(4,6)),new t(n)}},{key:"fromSeconds",value:function(e){var n=new t;return n.fromSeconds(e),n}}])}(),Z=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 J?this.zone.toSeconds():b.prototype.utcOffset.apply(this,arguments)}},{key:"toICALString",value:function(){return It.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?W(e)+(o||u?"-":""):o||u?"--":"")+(o?W(n):"")+(u?"-"+W(r):""),d=(l?W(i):"-")+(l&&h?":":"")+(h?W(a):"")+(l||h?"":"-")+(h&&c?":":"")+(c?W(s):"");if(this.zone===N.utcTimezone)t="Z";else if(this.zone instanceof J)t=this.zone.toString();else if(this.zone===N.localTimezone)t="";else if(this.zone instanceof N){t=J.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?P(t.slice(e,e+n)):null}var i=t.split("T"),a=i[0],s=i[1],o=s?It.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?N.utcTimezone:u&&":"==u[3]?J.fromString(u):null,e)}}])}(b),G=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=U(t.rule,rt),!this.rule)throw new Error("iterator requires a (ICAL.Recur) rule");if(this.dtstart=U(t.dtstart,b),!this.dtstart)throw new Error("iterator requires a (ICAL.Time) dtstart");if(t.by_data?this.by_data=t.by_data:this.by_data=H(this.rule.parts,!0),t.occurrence_number&&(this.occurrence_number=t.occurrence_number),this.days=t.days||[],t.last&&(this.last=U(t.last,b)),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)try{this.init()}catch(t){if(!(t instanceof X))throw t;this.completed=!0}}},{key:"init",value:function(){var t=this;this.initialized=!0,this.last=this.dtstart.clone();var e=this.by_data;if("BYDAY"in e&&this.sort_byday_rules(e.BYDAY),"BYYEARDAY"in e&&("BYMONTH"in e||"BYWEEKNO"in e||"BYMONTHDAY"in e||"BYDAY"in e))throw new Error("Invalid BYYEARDAY rule");if("BYWEEKNO"in e&&"BYMONTHDAY"in e)throw new Error("BYWEEKNO does not fit to BYMONTHDAY");if("MONTHLY"==this.rule.freq&&("BYYEARDAY"in e||"BYWEEKNO"in e))throw new Error("For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear");if("WEEKLY"==this.rule.freq&&("BYYEARDAY"in e||"BYMONTHDAY"in e))throw new Error("For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear");if("YEARLY"!=this.rule.freq&&"BYYEARDAY"in e)throw new Error("BYYEARDAY may only appear in YEARLY rules");if(this.last.second=this.setup_defaults("BYSECOND","SECONDLY",this.dtstart.second),this.last.minute=this.setup_defaults("BYMINUTE","MINUTELY",this.dtstart.minute),this.last.hour=this.setup_defaults("BYHOUR","HOURLY",this.dtstart.hour),this.last.day=this.setup_defaults("BYMONTHDAY","DAILY",this.dtstart.day),this.last.month=this.setup_defaults("BYMONTH","MONTHLY",this.dtstart.month),"WEEKLY"==this.rule.freq)if("BYDAY"in e){var n=d(this.ruleDayOfWeek(e.BYDAY[0],this.rule.wkst),2)[1],r=n-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)=0||r<0)&&(this.last.day+=r)}else{var i=rt.numericDayToIcalDay(this.dtstart.dayOfWeek());e.BYDAY=[i]}if("YEARLY"==this.rule.freq){for(var a=this.rule.until?this.rule.until.year:2e4;this.last.year<=a&&(this.expand_year_days(this.last.year),!(this.days.length>0));)this.increment_year(this.rule.interval);if(0==this.days.length)throw new X;this._nextByYearDay()}if("MONTHLY"==this.rule.freq)if(this.has_by_data("BYDAY")){var s,o=null,u=this.last.clone(),l=b.daysInMonth(this.last.month,this.last.year),h=v(this.by_data.BYDAY);try{for(h.s();!(s=h.n()).done;){var c=s.value;this.last=u.clone();var f=d(this.ruleDayOfWeek(c),2),y=f[0],m=f[1],p=this.last.nthWeekDay(m,y);if(y>=6||y<=-6)throw new Error("Malformed values in BYDAY part");if(p>l||p<=0){if(o&&o.month==u.month)continue;for(;p>l||p<=0;)this.increment_month(),l=b.daysInMonth(this.last.month,this.last.year),p=this.last.nthWeekDay(m,y)}this.last.day=p,(!o||this.last.compare(o)<0)&&(o=this.last.clone())}}catch(t){h.e(t)}finally{h.f()}if(this.last=o.clone(),this.has_by_data("BYMONTHDAY")&&this._byDayAndMonthDay(!0),this.last.day>l||0==this.last.day)throw new Error("Malformed values in BYDAY part")}else if(this.has_by_data("BYMONTHDAY")){this.last.day=1;var _=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY).filter((function(e){return e>=t.last.day}));if(_.length)this.last.day=_[0],this.by_data.BYMONTHDAY=_;else if(!this.next_month()&&!this.next_month()&&!this.next_month())throw new Error("No possible occurrences")}}},{key:"next",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=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)&&(this.completed=!0),this.completed)return 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(n)){if(e)throw new Error("Same occurrence found twice, protecting you from death by recursion");this.next(!0)}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=b.daysInMonth(e,t),a=[],s=0,o=n.length;si)){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=b.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)&&si)f();else{var y=e[s++];if(y>=n){h=y;for(var m=0;mn&&(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")){if(this.by_indices.BYMONTHDAY++,this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length&&(this.by_indices.BYMONTHDAY=0,this.increment_month(),this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length))return 0;var o=b.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=b.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 b;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=b.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.has_by_data("BYMONTHDAY")&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY)),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=b.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=rt.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;en&&(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=F(this.last.month/12);this.last.month%=12,this.last.month++,0!=t&&this.increment_year(t)}this.has_by_data("BYMONTHDAY")&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY))}},{key:"increment_year",value:function(t){this.last.day=1,this.last.year+=t}},{key:"increment_generic",value:function(t,e,n,r){this.last[e]+=t;var i=F(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 b;this.days=[];for(var n={},r=0,i=["BYDAY","BYWEEKNO","BYMONTHDAY","BYMONTH","BYYEARDAY"];r0?(J=Z+7*(K-1))<=M&&this.days.push(L+J):(J=G+7*(K+1))>0&&this.days.push(L+J)}}catch(t){R.e(t)}finally{R.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,$=v(this.expand_by_day(t));try{for($.s();!(Q=$.n()).done;){var tt=Q.value,et=b.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=v(this.expand_by_day(t));try{for(rt.s();!(nt=rt.n()).done;){var it=nt.value,at=b.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=v(this.expand_by_day(t));try{for(ot.s();!(st=ot.n()).done;){var ut=st.value,lt=b.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):[]);var ht=b.isLeapYear(t)?366:365;return this.days.sort((function(t,e){return t<0&&(t+=ht+1),e<0&&(e+=ht+1),t-e})),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=v(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=v(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;ethis.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=v(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",rt.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(G,"_indexMap",{BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8}),u(G,"_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(G,"UNKNOWN",0),u(G,"CONTRACT",1),u(G,"EXPAND",2),u(G,"ILLEGAL",3);var X=function(t){function n(){return a(this,n),e(this,n,["Recurrence rule has no valid occurrences"])}return l(n,t),o(n)}(f(Error)),Q=/^(SU|MO|TU|WE|TH|FR|SA)$/,$=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,tt={SU:b.SUNDAY,MO:b.MONDAY,TU:b.TUESDAY,WE:b.WEDNESDAY,TH:b.THURSDAY,FR:b.FRIDAY,SA:b.SATURDAY},et=Object.fromEntries(Object.entries(tt).map((function(t){return t.reverse()}))),nt=["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],rt=function(){function t(e){a(this,t),u(this,"parts",null),u(this,"interval",1),u(this,"wkst",b.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 G({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 st?Array.isArray(e[n])?this.parts[r]=e[n]:this.parts[r]=[e[n]]:this[n]=e[n]}this.interval&&"number"!=typeof this.interval&&at.INTERVAL(this.interval,this),this.wkst&&"number"!=typeof this.wkst&&(this.wkst=t.icalDayToNumericDay(this.wkst)),!this.until||this.until instanceof b||(this.until=b.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);n1&&(e+=";INTERVAL="+this.interval);for(var n=0,r=Object.entries(this.parts);n7&&(n-=7),et[n]}}])}();function it(t,e,n,r){var i=r;if("+"===r[0]&&(i=r.slice(1)),i=P(i),void 0!==e&&r '+e);if(void 0!==n&&r>n)throw new Error(t+': invalid value "'+r+'" must be < '+e);return i}var at={FREQ:function(t,e,n){if(-1===nt.indexOf(t))throw new Error('invalid frequency "'+t+'" expected: "'+nt.join(", ")+'"');e.freq=t},COUNT:function(t,e,n){e.count=P(t)},INTERVAL:function(t,e,n){e.interval=P(t),e.interval<1&&(e.interval=1)},UNTIL:function(t,e,n){t.length>10?e.until=It.icalendar.value["date-time"].fromICAL(t):e.until=It.icalendar.value.date.fromICAL(t),n||(e.until=b.fromString(e.until))},WKST:function(t,e,n){if(!Q.test(t))throw new Error('invalid WKST value "'+t+'"');e.wkst=rt.icalDayToNumericDay(t)}},st={BYSECOND:it.bind(void 0,"BYSECOND",0,60),BYMINUTE:it.bind(void 0,"BYMINUTE",0,59),BYHOUR:it.bind(void 0,"BYHOUR",0,23),BYDAY:function(t){if($.test(t))return t;throw new Error('invalid BYDAY value "'+t+'"')},BYMONTHDAY:it.bind(void 0,"BYMONTHDAY",-31,31),BYYEARDAY:it.bind(void 0,"BYYEARDAY",-366,366),BYWEEKNO:it.bind(void 0,"BYWEEKNO",-53,53),BYMONTH:it.bind(void 0,"BYMONTH",1,12),BYSETPOS:it.bind(void 0,"BYSETPOS",-366,366)},ot=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 b))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 b))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 Y))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:b.fromDateTimeString(r[0],n)},a=r[1];return Y.isValueString(a)?i.duration=Y.fromString(a):i.end=b.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?b.fromString(t,e):b.fromDateTimeString(t,e)}return Y.isValueString(e[1])?t.fromData({start:i(e[0],n),duration:Y.fromString(e[1])}):t.fromData({start:i(e[0],n),end:i(e[1],n)})}}])}(),ut=/\\\\|\\,|\\[Nn]/g,lt=/\\|,|\n/g;function ht(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,Tt)}(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 ct={defaultType:"text"},ft={defaultType:"text",multiValue:","},dt={defaultType:"text",structuredValue:";"},yt={defaultType:"integer"},mt={defaultType:"date-time",allowedTypes:["date-time","date"]},pt={defaultType:"date-time"},vt={defaultType:"uri"},_t={defaultType:"utc-offset"},gt={defaultType:"recur"},Dt={defaultType:"date-and-or-time",allowedTypes:["date-time","date","text"]};function Tt(t){switch(t){case"\\\\":return"\\";case"\\;":return";";case"\\,":return",";case"\\n":case"\\N":return"\n";default:return t}}var Yt={categories:ft,url:vt,version:ct,uid:ct},kt={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 L(e)?0:e},toICAL:function(t){return String(t)}},integer:{fromICAL:function(t){var e=parseInt(t);return L(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 J.fromString(t)},undecorate:function(t){return t.toString()}}},bt=K(kt,{text:ht(/\\\\|\\;|\\,|\\[Nn]/g,/\\|;|,|\n/g),uri:{},binary:{decorate:function(t){return g.fromString(t)},undecorate:function(t){return t.toString()}},"cal-address":{},date:{decorate:function(t,e){return It.strict?b.fromDateString(t,e):b.fromString(t,e)},undecorate:function(t){return t.toString()},fromICAL:function(t){return!It.strict&&t.length>=15?bt["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?bt["date-time"].toICAL(t):t}},"date-time":{fromICAL:function(t){if(It.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 bt.date.fromICAL(t)},toICAL:function(t){var e=t.length;if(10!=e||It.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 bt.date.toICAL(t)},decorate:function(t,e){return It.strict?b.fromDateTimeString(t,e):b.fromString(t,e)},undecorate:function(t){return t.toString()}},duration:{decorate:function(t){return Y.fromString(t)},undecorate:function(t){return t.toString()}},period:{fromICAL:function(t){var e=t.split("/");return e[0]=bt["date-time"].fromICAL(e[0]),Y.isValueString(e[1])||(e[1]=bt["date-time"].fromICAL(e[1])),e},toICAL:function(t){return t=t.slice(),It.strict||10!=t[0].length?t[0]=bt["date-time"].toICAL(t[0]):t[0]=bt.date.toICAL(t[0]),Y.isValueString(t[1])||(It.strict||10!=t[1].length?t[1]=bt["date-time"].toICAL(t[1]):t[1]=bt.date.toICAL(t[1])),t.join("/")},decorate:function(t,e){return ot.fromJSON(t,e,!It.strict)},undecorate:function(t){return t.toJSON()}},recur:{fromICAL:function(t){return rt._stringToData(t,!0)},toICAL:function(t){for(var e="",n=0,r=Object.entries(t);n10?bt["date-time"].toICAL(s):bt.date.toICAL(s):"wkst"==a?"number"==typeof s&&(s=rt.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 rt.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}}}),Ot=K(Yt,{action:ct,attach:{defaultType:"uri"},attendee:{defaultType:"cal-address"},calscale:ct,class:ct,comment:ct,completed:pt,contact:ct,created:pt,description:ct,dtend:mt,dtstamp:pt,dtstart:mt,due:mt,duration:{defaultType:"duration"},exdate:{defaultType:"date-time",allowedTypes:["date-time","date"],multiValue:","},exrule:gt,freebusy:{defaultType:"period",multiValue:","},geo:{defaultType:"float",structuredValue:";"},"last-modified":pt,location:ct,method:ct,organizer:{defaultType:"cal-address"},"percent-complete":yt,priority:yt,prodid:ct,"related-to":ct,repeat:yt,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":mt,resources:ft,"request-status":dt,rrule:gt,sequence:yt,status:ct,summary:ct,transp:ct,trigger:{defaultType:"duration",allowedTypes:["duration","date-time"]},tzoffsetfrom:_t,tzoffsetto:_t,tzurl:vt,tzid:ct,tzname:ct}),At=K(kt,{text:ht(ut,lt),uri:ht(ut,lt),date:{decorate:function(t){return Z.fromDateAndOrTimeString(t,"date")},undecorate:function(t){return t.toString()},fromICAL:function(t){return 8==t.length?bt.date.fromICAL(t):"-"==t[0]&&6==t.length?t.slice(0,4)+"-"+t.slice(4):t},toICAL:function(t){return 10==t.length?bt.date.toICAL(t):"-"==t[0]&&7==t.length?t.slice(0,4)+t.slice(5):t}},time:{decorate:function(t){return Z.fromDateAndOrTimeString("T"+t,"time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=At.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=At.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 Z.fromDateAndOrTimeString(t,"date-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){return At["date-and-or-time"].fromICAL(t)},toICAL:function(t){return At["date-and-or-time"].toICAL(t)}},"date-and-or-time":{decorate:function(t){return Z.fromDateAndOrTimeString(t,"date-and-or-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=t.split("T");return(e[0]?At.date.fromICAL(e[0]):"")+(e[1]?"T"+At.time.fromICAL(e[1]):"")},toICAL:function(t){var e=t.split("T");return At.date.toICAL(e[0])+(e[1]?"T"+At.time.toICAL(e[1]):"")}},timestamp:bt["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("")}}}),St=K(Yt,{adr:{defaultType:"text",structuredValue:";",multiValue:","},anniversary:Dt,bday:Dt,caladruri:vt,caluri:vt,clientpidmap:dt,email:ct,fburl:vt,fn:ct,gender:dt,geo:vt,impp:vt,key:vt,kind:ct,lang:{defaultType:"language-tag"},logo:vt,member:vt,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:ft,note:ct,org:{defaultType:"text",structuredValue:";"},photo:vt,related:vt,rev:{defaultType:"timestamp"},role:ct,sound:vt,source:vt,tel:{defaultType:"uri",allowedTypes:["uri","text"]},title:ct,tz:{defaultType:"text",allowedTypes:["text","utc-offset","uri"]},xml:ct}),wt=K(kt,{binary:bt.binary,date:At.date,"date-time":At["date-time"],"phone-number":At["phone-number"],uri:bt.uri,text:bt.text,time:bt.time,vcard:bt.text,"utc-offset":{toICAL:function(t){return t.slice(0,7)},fromICAL:function(t){return t.slice(0,7)},decorate:function(t){return J.fromString(t)},undecorate:function(t){return t.toString()}}}),Et=K(Yt,{fn:ct,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:ft,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:ct,tel:{defaultType:"phone-number"},email:ct,mailer:ct,tz:{defaultType:"utc-offset",allowedTypes:["utc-offset","text"]},geo:{defaultType:"float",structuredValue:";"},title:ct,role:ct,logo:{defaultType:"binary",allowedTypes:["binary","uri"]},agent:{defaultType:"vcard",allowedTypes:["vcard","text","uri"]},org:dt,note:ft,prodid:ct,rev:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(t){return-1===t.indexOf("T")?"date":"date-time"}},"sort-string":ct,sound:{defaultType:"binary",allowedTypes:["binary","uri"]},class:ct,key:{defaultType:"binary",allowedTypes:["binary","text"]}}),Ct={value:bt,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:Ot,propertyGroups:!1},xt={value:At,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:St,propertyGroups:!0},Nt={value:wt,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:Et,propertyGroups:!0},It={strict:!0,defaultSet:Ct,defaultType:"unknown",components:{vcard:xt,vcard3:Nt,vevent:Ct,vtodo:Ct,vjournal:Ct,valarm:Ct,vtimezone:Ct,daylight:Ct,standard:Ct},icalendar:Ct,vcard:xt,vcard3:Nt,getDesignSet:function(t){return t&&t in It.components?It.components[t]:It.defaultSet}},Bt="\r\n",Mt="unknown",zt={'"':"^'","\n":"^n","^":"^^"};function Lt(t){"string"==typeof t[0]&&(t=[t]);for(var e=0,n=t.length,r="";e0&&("version"!==t[1][0][0]||"4.0"!==t[1][0][3])&&(o="vcard3"),e=e||It.getDesignSet(o);a0&&"object"===i(t[0])&&"icaltype"in t[0]&&this.resetType(t[0].icaltype),this.isDecorated)for(;n=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 Pt))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 Pt(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 Lt.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=v(this.getAllSubcomponents("vtimezone"));try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.getFirstProperty("tzid").getFirstValue()===t){var i=new N({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(E.component(e))}}])}(),jt=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=U(t.dtstart,b);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=U(t.last,b)||e.clone(),!t.ruleIterators)throw new Error(".ruleIterators or .component must be given");this.ruleIterators=t.ruleIterators.map((function(t){return U(t,G)})),this.ruleDateInc=t.ruleDateInc,this.exDateInc=t.exDateInc,t.ruleDates&&(this.ruleDates=t.ruleDates.map((function(t){return U(t,b)})),this.ruleDate=this.ruleDates[this.ruleDateInc]),t.exDates&&(this.exDates=t.exDates.map((function(t){return U(t,b)})),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;i0)&&(r=e);return r}}])}(),Vt=function(){function t(e,n){a(this,t),u(this,"exceptions",null),u(this,"strictExceptions",!1),e instanceof Ut||(n=e,e=null),this.component=e||new Ut("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 Ut&&(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=V(this.rangeExceptions,r,Ht);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=V(this.rangeExceptions,[e],Ht);if((n-=1)<0)return null;var r=this.rangeExceptions[n];return ee[0]?1:e[0]>t[0]?-1:0}u(Vt,"THISANDFUTURE","THISANDFUTURE");var Rt=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