rrule
Version:
JavaScript library for working with recurrence rules for calendar dates.
16 lines • 123 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.rrule=e():t.rrule=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){"use strict";n.d(e,"f",function(){return r}),n.d(e,"e",function(){return i}),n.d(e,"d",function(){return o}),n.d(e,"j",function(){return a}),n.d(e,"k",function(){return s}),n.d(e,"m",function(){return u}),n.d(e,"h",function(){return c}),n.d(e,"l",function(){return l}),n.d(e,"i",function(){return h}),n.d(e,"a",function(){return f}),n.d(e,"b",function(){return d}),n.d(e,"g",function(){return y}),n.d(e,"c",function(){return m});var r=function(t){return null!==t&&void 0!==t},i=function(t){return"number"==typeof t},o=Array.isArray,a=function(t,e){void 0===e&&(e=t),1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r<e;r++)n.push(r);return n},s=function(t,e){var n=0,r=[];if(o(t))for(;n<e;n++)r[n]=[].concat(t);else for(;n<e;n++)r[n]=t;return r},u=function(t){return o(t)?t:[t]};function c(t,e,n){void 0===n&&(n=" ");var r=String(t);return e>>=0,r.length>e?String(r):((e-=r.length)>n.length&&(n+=s(n,e/n.length)),n.slice(0,e)+String(r))}var l=function(t,e,n){var r=t.split(e);return n?r.slice(0,n).concat([r.slice(n).join(e)]):r},h=function(t,e){var n=t%e;return n*e<0?n+e:n},f=function(t,e){return{div:Math.floor(t/e),mod:h(t,e)}},d=function(t){return!r(t)||0===t.length},y=function(t){return!d(t)},m=function(t,e){return y(t)&&-1!==t.indexOf(e)}},function(t,e,n){"use strict";n.r(e);var r,i=n(0),o=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t.MONTH_DAYS=[31,28,31,30,31,30,31,31,30,31,30,31],t.ONE_DAY=864e5,t.MAXYEAR=9999,t.ORDINAL_BASE=new Date(Date.UTC(1970,0,1)),t.PY_WEEKDAYS=[6,0,1,2,3,4,5],t.getYearDay=function(e){var n=new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());return Math.ceil((n.valueOf()-new Date(e.getUTCFullYear(),0,1).valueOf())/t.ONE_DAY)+1},t.isLeapYear=function(t){return t%4==0&&t%100!=0||t%400==0},t.tzOffset=function(t){return 60*t.getTimezoneOffset()*1e3},t.daysBetween=function(e,n){var r=e.getTime()-t.tzOffset(e)-(n.getTime()-t.tzOffset(n));return Math.round(r/t.ONE_DAY)},t.toOrdinal=function(e){return t.daysBetween(e,t.ORDINAL_BASE)},t.fromOrdinal=function(e){return new Date(t.ORDINAL_BASE.getTime()+e*t.ONE_DAY)},t.getMonthDays=function(e){var n=e.getUTCMonth();return 1===n&&t.isLeapYear(e.getUTCFullYear())?29:t.MONTH_DAYS[n]},t.getWeekday=function(e){return t.PY_WEEKDAYS[e.getUTCDay()]},t.monthRange=function(e,n){var r=new Date(Date.UTC(e,n,1));return[t.getWeekday(r),t.getMonthDays(r)]},t.combine=function(t,e){return e=e||t,new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))},t.clone=function(t){return new Date(t.getTime())},t.cloneDates=function(e){for(var n=[],r=0;r<e.length;r++)n.push(t.clone(e[r]));return n},t.sort=function(t){t.sort(function(t,e){return t.getTime()-e.getTime()})},t.timeToUntilString=function(t,e){void 0===e&&(e=!0);var n=new Date(t);return[Object(i.h)(n.getUTCFullYear().toString(),4,"0"),Object(i.h)(n.getUTCMonth()+1,2,"0"),Object(i.h)(n.getUTCDate(),2,"0"),"T",Object(i.h)(n.getUTCHours(),2,"0"),Object(i.h)(n.getUTCMinutes(),2,"0"),Object(i.h)(n.getUTCSeconds(),2,"0"),e?"Z":""].join("")},t.untilStringToDate=function(t){var e=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/.exec(t);if(!e)throw new Error("Invalid UNTIL value: "+t);return new Date(Date.UTC(parseInt(e[1],10),parseInt(e[2],10)-1,parseInt(e[3],10),parseInt(e[5],10)||0,parseInt(e[6],10)||0,parseInt(e[7],10)||0))};var e=function(){function t(t,e,n,r){this.hour=t,this.minute=e,this.second=n,this.millisecond=r||0}return t.prototype.getHours=function(){return this.hour},t.prototype.getMinutes=function(){return this.minute},t.prototype.getSeconds=function(){return this.second},t.prototype.getMilliseconds=function(){return this.millisecond},t.prototype.getTime=function(){return 1e3*(60*this.hour*60+60*this.minute+this.second)+this.millisecond},t}();t.Time=e;var n=function(e){function n(t,n,r,i,o,a,s){var u=e.call(this,i,o,a,s)||this;return u.year=t,u.month=n,u.day=r,u}return o(n,e),n.prototype.getWeekday=function(){return t.getWeekday(new Date(this.getTime()))},n.prototype.getTime=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond)).getTime()},n.prototype.getDay=function(){return this.day},n.prototype.getMonth=function(){return this.month},n.prototype.getYear=function(){return this.year},n.prototype.addYears=function(t){this.year+=t},n.prototype.addMonths=function(t){if(this.month+=t,this.month>12){var e=Math.floor(this.month/12),n=Object(i.i)(this.month,12);this.month=n,this.year+=e,0===this.month&&(this.month=12,--this.year)}},n.prototype.addWeekly=function(t,e){e>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-e))+7*t:this.day+=-(this.getWeekday()-e)+7*t,this.fixDay()},n.prototype.addDaily=function(t){this.day+=t,this.fixDay()},n.prototype.addHours=function(t,e,n){var r=!1;for(e&&(this.hour+=Math.floor((23-this.hour)/t)*t);;){this.hour+=t;var o=Object(i.a)(this.hour,24),a=o.div,s=o.mod;if(a&&(this.hour=s,this.addDaily(a),r=!0),Object(i.b)(n)||Object(i.c)(n,this.hour))break}return r},n.prototype.addMinutes=function(t,e,n,r){var o=!1;for(e&&(this.minute+=Math.floor((1439-(60*this.hour+this.minute))/t)*t);;){this.minute+=t;var a=Object(i.a)(this.minute,60),s=a.div,u=a.mod;if(s&&(this.minute=u,o=this.addHours(s,!1,n)),(Object(i.b)(n)||Object(i.c)(n,this.hour))&&(Object(i.b)(r)||Object(i.c)(r,this.minute)))break}return o},n.prototype.addSeconds=function(t,e,n,r,o){var a=!1;for(e&&(this.second+=Math.floor((86399-(3600*this.hour+60*this.minute+this.second))/t)*t);;){this.second+=t;var s=Object(i.a)(this.second,60),u=s.div,c=s.mod;if(u&&(this.second=c,a=this.addMinutes(u,!1,n,r)),(Object(i.b)(n)||Object(i.c)(n,this.hour))&&(Object(i.b)(r)||Object(i.c)(r,this.minute))&&(Object(i.b)(o)||Object(i.c)(o,this.second)))break}return a},n.prototype.fixDay=function(){if(!(this.day<=28)){var e=t.monthRange(this.year,this.month-1)[1];if(!(this.day<=e))for(;this.day>e;){if(this.day-=e,++this.month,13===this.month&&(this.month=1,++this.year,this.year>t.MAXYEAR))return;e=t.monthRange(this.year,this.month-1)[1]}}},n}(e);t.DateTime=n}(r||(r={}));var a,s=r,u=Object(i.k)(1,31).concat(Object(i.k)(2,28),Object(i.k)(3,31),Object(i.k)(4,30),Object(i.k)(5,31),Object(i.k)(6,30),Object(i.k)(7,31),Object(i.k)(8,31),Object(i.k)(9,30),Object(i.k)(10,31),Object(i.k)(11,30),Object(i.k)(12,31),Object(i.k)(1,7)),c=Object(i.k)(1,31).concat(Object(i.k)(2,29),Object(i.k)(3,31),Object(i.k)(4,30),Object(i.k)(5,31),Object(i.k)(6,30),Object(i.k)(7,31),Object(i.k)(8,31),Object(i.k)(9,30),Object(i.k)(10,31),Object(i.k)(11,30),Object(i.k)(12,31),Object(i.k)(1,7)),l=Object(i.j)(1,29),h=Object(i.j)(1,30),f=Object(i.j)(1,31),d=Object(i.j)(1,32),y=d.concat(h,d,f,d,f,d,d,f,d,f,d,d.slice(0,7)),m=d.concat(l,d,f,d,f,d,d,f,d,f,d,d.slice(0,7)),p=Object(i.j)(-28,0),v=Object(i.j)(-29,0),b=Object(i.j)(-30,0),g=Object(i.j)(-31,0),w=g.concat(v,g,b,g,b,g,g,b,g,b,g,g.slice(0,7)),k=g.concat(p,g,b,g,b,g,g,b,g,b,g,g.slice(0,7)),O=[0,31,60,91,121,152,182,213,244,274,305,335,366],T=[0,31,59,90,120,151,181,212,243,273,304,334,365],S=function(){for(var t=[],e=0;e<55;e++)t=t.concat(Object(i.j)(7));return t}(),E=function(){function t(t){this.yearlen=365,this.nextyearlen=365,this.rrule=t,this.mmask=null,this.mrange=null,this.mdaymask=null,this.nmdaymask=null,this.wdaymask=null,this.wnomask=null,this.nwdaymask=null,this.eastermask=null}return t.prototype.easter=function(t,e){void 0===e&&(e=0);var n=t%19,r=Math.floor(t/100),i=t%100,o=Math.floor(r/4),a=r%4,s=Math.floor((r+8)/25),u=Math.floor((r-s+1)/3),c=Math.floor(19*n+r-o-u+15)%30,l=Math.floor(i/4),h=i%4,f=Math.floor(32+2*a+2*l-c-h)%7,d=Math.floor((n+11*c+22*f)/451),y=Math.floor((c+f-7*d+114)/31),m=(c+f-7*d+114)%31+1,p=Date.UTC(t,y-1,m+e),v=Date.UTC(t,0,1);return[Math.ceil((p-v)/864e5)]},t.prototype.rebuild=function(t,e){var n=this.rrule;t!==this.lastyear&&this.rebuildYear(t),!Object(i.g)(n.options.bynweekday)||e===this.lastmonth&&t===this.lastyear||this.rebuildMonth(t,e),Object(i.f)(n.options.byeaster)&&(this.eastermask=this.easter(t,n.options.byeaster))},t.prototype.rebuildYear=function(t){var e=this.rrule;this.yearlen=s.isLeapYear(t)?366:365,this.nextyearlen=s.isLeapYear(t+1)?366:365;var n=new Date(Date.UTC(t,0,1));this.yearordinal=s.toOrdinal(n),this.yearweekday=s.getWeekday(n);var r=s.getWeekday(n);if(365===this.yearlen?(this.mmask=u,this.mdaymask=m,this.nmdaymask=k,this.wdaymask=S.slice(r),this.mrange=T):(this.mmask=c,this.mdaymask=y,this.nmdaymask=w,this.wdaymask=S.slice(r),this.mrange=O),Object(i.b)(e.options.byweekno))this.wnomask=null;else{this.wnomask=Object(i.k)(0,this.yearlen+7);var o,a=void 0,l=void 0;(a=o=Object(i.i)(7-this.yearweekday+e.options.wkst,7))>=4?(a=0,l=this.yearlen+Object(i.i)(this.yearweekday-e.options.wkst,7)):l=this.yearlen-a;for(var h=Math.floor(l/7),f=Object(i.i)(l,7),d=Math.floor(h+f/4),p=0;p<e.options.byweekno.length;p++){var v=void 0,b=e.options.byweekno[p];if(b<0&&(b+=d+1),b>0&&b<=d){b>1?(v=a+7*(b-1),a!==o&&(v-=7-o)):v=a;for(var g=0;g<7&&(this.wnomask[v]=1,v++,this.wdaymask[v]!==e.options.wkst);g++);}}if(Object(i.c)(e.options.byweekno,1)){v=a+7*d;if(a!==o&&(v-=7-o),v<this.yearlen)for(p=0;p<7&&(this.wnomask[v]=1,v+=1,this.wdaymask[v]!==e.options.wkst);p++);}if(a){var E=void 0;if(Object(i.c)(e.options.byweekno,-1))E=-1;else{var j=s.getWeekday(new Date(Date.UTC(t-1,0,1))),D=Object(i.i)(7-j.valueOf()+e.options.wkst,7),M=s.isLeapYear(t-1)?366:365;D>=4?(D=0,E=Math.floor(52+Object(i.i)(M+Object(i.i)(j-e.options.wkst,7),7)/4)):E=Math.floor(52+Object(i.i)(this.yearlen-a,7)/4)}if(Object(i.c)(e.options.byweekno,E))for(v=0;v<a;v++)this.wnomask[v]=1}}},t.prototype.rebuildMonth=function(t,e){var n=this.rrule,r=[];if(n.options.freq===P.YEARLY)if(Object(i.g)(n.options.bymonth))for(var o=0;o<n.options.bymonth.length;o++)e=n.options.bymonth[o],r.push(this.mrange.slice(e-1,e+1));else r=[[0,this.yearlen]];else n.options.freq===P.MONTHLY&&(r=[this.mrange.slice(e-1,e+1)]);if(Object(i.g)(r)){this.nwdaymask=Object(i.k)(0,this.yearlen);for(o=0;o<r.length;o++){var a=r[o],s=a[0],u=a[1];u-=1;for(var c=0;c<n.options.bynweekday.length;c++){var l=void 0,h=n.options.bynweekday[c][0],f=n.options.bynweekday[c][1];f<0?(l=u+7*(f+1),l-=Object(i.i)(this.wdaymask[l]-h,7)):(l=s+7*(f-1),l+=Object(i.i)(7-this.wdaymask[l]+h,7)),s<=l&&l<=u&&(this.nwdaymask[l]=1)}}}this.lastyear=t,this.lastmonth=e},t.prototype.ydayset=function(){return[Object(i.j)(this.yearlen),0,this.yearlen]},t.prototype.mdayset=function(t,e,n){for(var r=this.mrange[e-1],o=this.mrange[e],a=Object(i.k)(null,this.yearlen),s=r;s<o;s++)a[s]=s;return[a,r,o]},t.prototype.wdayset=function(t,e,n){for(var r=Object(i.k)(null,this.yearlen+7),o=s.toOrdinal(new Date(Date.UTC(t,e-1,n)))-this.yearordinal,a=o,u=0;u<7&&(r[o]=o,++o,this.wdaymask[o]!==this.rrule.options.wkst);u++);return[r,a,o]},t.prototype.ddayset=function(t,e,n){var r=Object(i.k)(null,this.yearlen),o=s.toOrdinal(new Date(Date.UTC(t,e-1,n)))-this.yearordinal;return r[o]=o,[r,o,o+1]},t.prototype.htimeset=function(t,e,n,r){for(var i=[],o=this.rrule,a=0;a<o.options.byminute.length;a++){e=o.options.byminute[a];for(var u=0;u<o.options.bysecond.length;u++)n=o.options.bysecond[u],i.push(new s.Time(t,e,n,r))}return s.sort(i),i},t.prototype.mtimeset=function(t,e,n,r){for(var i=[],o=this.rrule,a=0;a<o.options.bysecond.length;a++)n=o.options.bysecond[a],i.push(new s.Time(t,e,n,r));return s.sort(i),i},t.prototype.stimeset=function(t,e,n,r){return[new s.Time(t,e,n,r)]},t}(),j=function(){function t(t,e){this.minDate=null,this.maxDate=null,this._result=[],this.total=0,this.method=t,this.args=e,"between"===t?(this.maxDate=e.inc?e.before:new Date(e.before.getTime()-1),this.minDate=e.inc?e.after:new Date(e.after.getTime()+1)):"before"===t?this.maxDate=e.inc?e.dt:new Date(e.dt.getTime()-1):"after"===t&&(this.minDate=e.inc?e.dt:new Date(e.dt.getTime()+1))}return t.prototype.accept=function(t){++this.total;var e=this.minDate&&t<this.minDate,n=this.maxDate&&t>this.maxDate;if("between"===this.method){if(e)return!0;if(n)return!1}else if("before"===this.method){if(n)return!1}else if("after"===this.method)return!!e||(this.add(t),!1);return this.add(t)},t.prototype.add=function(t){return this._result.push(t),!0},t.prototype.getValue=function(){var t=this._result;switch(this.method){case"all":case"between":return t;case"before":case"after":return t.length?t[t.length-1]:null}},t.prototype.clone=function(){return new t(this.method,this.args)},t}(),D=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),M=function(t){function e(e,n,r){var i=t.call(this,e,n)||this;return i.iterator=r,i}return D(e,t),e.prototype.add=function(t){return!!this.iterator(t,this._result.length)&&(this._result.push(t),!0)},e}(j);!function(t){t[t.YEARLY=0]="YEARLY",t[t.MONTHLY=1]="MONTHLY",t[t.WEEKLY=2]="WEEKLY",t[t.DAILY=3]="DAILY",t[t.HOURLY=4]="HOURLY",t[t.MINUTELY=5]="MINUTELY",t[t.SECONDLY=6]="SECONDLY"}(a||(a={}));var N=["MO","TU","WE","TH","FR","SA","SU"],x=function(){function t(t,e){if(0===e)throw new Error("Can't create weekday with n == 0");this.weekday=t,this.n=e}return t.prototype.nth=function(e){return this.n===e?this:new t(this.weekday,e)},t.prototype.equals=function(t){return this.weekday===t.weekday&&this.n===t.n},t.prototype.toString=function(){var t=N[this.weekday];return this.n&&(t=(this.n>0?"+":"")+String(this.n)+t),t},t.prototype.getJsWeekday=function(){return 6===this.weekday?0:this.weekday+1},t}();function L(t){var e=[],n={};if(Object.keys(t).forEach(function(r){n[r]=t[r],Object(i.c)(q,r)||e.push(r)}),e.length)throw new Error("Invalid options: "+e.join(", "));return n}var I=function(){return(I=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function _(t){var e=t.split("\n").map(U).filter(function(t){return null!==t});return I({},e[0],e[1])}function A(t){var e={},n=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(t);if(!n)return e;n[0];var r=n[1],i=n[2];return r&&(e.tzid=r),e.dtstart=s.untilStringToDate(i),e}function U(t){if(!(t=t.replace(/^\s+|\s+$/,"")).length)return null;var e=/^([A-Z]+?)[:;]/.exec(t.toUpperCase());if(!e)return C(t);e[0];var n=e[1];switch(n.toUpperCase()){case"RRULE":case"EXRULE":return C(t);case"DTSTART":return A(t);default:throw new Error("Unsupported RFC prop "+n+" in "+t)}}function C(t){var e=A(t.replace(/^RRULE:/i,""));return t.replace(/^(?:RRULE|EXRULE):/i,"").split(";").forEach(function(n){var r=n.split("="),i=r[0],o=r[1];switch(i.toUpperCase()){case"FREQ":e.freq=a[o.toUpperCase()];break;case"WKST":e.wkst=W[o.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var u=function(t){if(-1!==t.indexOf(",")){var e=t.split(",");return e.map(function(t){return/^[+-]?\d+$/.test(t.toString())?Number(t):t})}if(/^[+-]?\d+$/.test(t))return Number(t);return t}(o),c=i.toLowerCase();e[c]=u;break;case"BYWEEKDAY":case"BYDAY":e.byweekday=function(t){return t.split(",").map(function(t){if(2===t.length)return W[t];var e=t.match(/^([+-]?\d)([A-Z]{2})$/),n=Number(e[1]),r=e[2],i=W[r].weekday;return new x(i,n)})}(o);break;case"DTSTART":case"TZID":var l=A(t);e.tzid=l.tzid,e.dtstart=l.dtstart;break;case"UNTIL":e.until=s.untilStringToDate(o);break;case"BYEASTER":e.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+i+"'")}}),e}var Y=n(2),R=function(){function t(t,e){this.date=t,this.tzid=e}return Object.defineProperty(t.prototype,"isUTC",{get:function(){return!this.tzid||"UTC"===this.tzid.toUpperCase()},enumerable:!0,configurable:!0}),t.prototype.toString=function(){var t=s.timeToUntilString(this.date.getTime(),this.isUTC);return this.isUTC?":"+t:";TZID="+this.tzid+":"+t},t.prototype.getTime=function(){return this.date.getTime()},t.prototype.rezonedDate=function(){if(this.isUTC)return this.date;try{return Y.DateTime.fromJSDate(this.date).setZone(this.tzid,{keepLocalTime:!0}).toJSDate()}catch(t){return t instanceof TypeError&&console.error("Using TZID without Luxon available is unsupported. Returned times are in UTC, not the requested time zone"),this.date}},t}();function z(t){for(var e=[],n="",r=Object.keys(t),o=Object.keys(H),a=0;a<r.length;a++)if("tzid"!==r[a]&&Object(i.c)(o,r[a])){var u=r[a].toUpperCase(),c=t[r[a]],l="";if(Object(i.f)(c)&&(!Object(i.d)(c)||c.length)){switch(u){case"FREQ":l=P.FREQUENCIES[t.freq];break;case"WKST":l=Object(i.e)(c)?new x(c).toString():c.toString();break;case"BYWEEKDAY":u="BYDAY",l=Object(i.m)(c).map(function(t){return t instanceof x?t:Object(i.d)(t)?new x(t[0],t[1]):new x(t)}).toString();break;case"DTSTART":n=F(c,t.tzid);break;case"UNTIL":l=s.timeToUntilString(c,!t.tzid);break;default:if(Object(i.d)(c)){for(var h=[],f=0;f<c.length;f++)h[f]=String(c[f]);l=h.toString()}else l=String(c)}l&&e.push([u,l])}}var d=e.map(function(t){return t[0]+"="+t[1].toString()}).join(";"),y="";return""!==d&&(y="RRULE:"+d),[n,y].filter(function(t){return!!t}).join("\n")}function F(t,e){return t?"DTSTART"+new R(new Date(t),e).toString():""}var V=function(){function t(){this.all=!1,this.before=[],this.after=[],this.between=[]}return t.prototype._cacheAdd=function(t,e,n){e&&(e=e instanceof Date?s.clone(e):s.cloneDates(e)),"all"===t?this.all=e:(n._value=e,this[t].push(n))},t.prototype._cacheGet=function(t,e){var n=!1,r=e?Object.keys(e):[],o=function(t){for(var n=0;n<r.length;n++){var i=r[n];if(String(e[i])!==String(t[i]))return!0}return!1},a=this[t];if("all"===t)n=this.all;else if(Object(i.d)(a))for(var u=0;u<a.length;u++){var c=a[u];if(!r.length||!o(c)){n=c._value;break}}if(!n&&this.all){var l=new j(t,e);for(u=0;u<this.all.length&&l.accept(this.all[u]);u++);n=l.getValue(),this._cacheAdd(t,n,e)}return Object(i.d)(n)?s.cloneDates(n):n instanceof Date?s.clone(n):n},t}(),Z=function(){return Z._nlp||(Z._nlp=n(8)),Z._nlp},W={MO:new x(0),TU:new x(1),WE:new x(2),TH:new x(3),FR:new x(4),SA:new x(5),SU:new x(6)},H={freq:a.YEARLY,dtstart:null,interval:1,wkst:W.MO,count:null,until:null,tzid:null,bysetpos:null,bymonth:null,bymonthday:null,bynmonthday:null,byyearday:null,byweekno:null,byweekday:null,bynweekday:null,byhour:null,byminute:null,bysecond:null,byeaster:null},q=Object.keys(H),P=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=!1),this._string=null,this._cache=e?null:new V,this.origOptions=L(t);var n=function(t){var e=L(t),n=Object.keys(t);if(q.forEach(function(t){Object(i.c)(n,t)&&Object(i.f)(e[t])||(e[t]=H[t])}),Object(i.f)(e.byeaster)&&(e.freq=P.YEARLY),!Object(i.f)(e.freq)||!P.FREQUENCIES[e.freq])throw new Error("Invalid frequency: "+e.freq+" "+t.freq);e.dtstart||(e.dtstart=new Date((new Date).setMilliseconds(0)));var r,o=e.dtstart.getTime()%1e3;if(Object(i.f)(e.wkst)?Object(i.e)(e.wkst)||(e.wkst=e.wkst.weekday):e.wkst=P.MO.weekday,Object(i.f)(e.bysetpos)){Object(i.e)(e.bysetpos)&&(e.bysetpos=[e.bysetpos]);for(var a=0;a<e.bysetpos.length;a++)if(0===(l=e.bysetpos[a])||!(l>=-366&&l<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}if(!(Boolean(e.byweekno)||Object(i.g)(e.byweekno)||Object(i.g)(e.byyearday)||Boolean(e.bymonthday)||Object(i.g)(e.bymonthday)||Object(i.f)(e.byweekday)||Object(i.f)(e.byeaster)))switch(e.freq){case P.YEARLY:e.bymonth||(e.bymonth=e.dtstart.getUTCMonth()+1),e.bymonthday=e.dtstart.getUTCDate();break;case P.MONTHLY:e.bymonthday=e.dtstart.getUTCDate();break;case P.WEEKLY:e.byweekday=[s.getWeekday(e.dtstart)]}if(Object(i.f)(e.bymonth)&&!Object(i.d)(e.bymonth)&&(e.bymonth=[e.bymonth]),Object(i.f)(e.byyearday)&&!Object(i.d)(e.byyearday)&&Object(i.e)(e.byyearday)&&(e.byyearday=[e.byyearday]),Object(i.f)(e.bymonthday))if(Object(i.d)(e.bymonthday)){var u=[],c=[];for(a=0;a<e.bymonthday.length;a++){var l;(l=e.bymonthday[a])>0?u.push(l):l<0&&c.push(l)}e.bymonthday=u,e.bynmonthday=c}else e.bymonthday<0?(e.bynmonthday=[e.bymonthday],e.bymonthday=[]):(e.bynmonthday=[],e.bymonthday=[e.bymonthday]);else e.bymonthday=[],e.bynmonthday=[];if(Object(i.f)(e.byweekno)&&!Object(i.d)(e.byweekno)&&(e.byweekno=[e.byweekno]),Object(i.f)(e.byweekday))if(Object(i.e)(e.byweekday))e.byweekday=[e.byweekday],e.bynweekday=null;else if(e.byweekday instanceof x)!e.byweekday.n||e.freq>P.MONTHLY?(e.byweekday=[e.byweekday.weekday],e.bynweekday=null):(e.bynweekday=[[e.byweekday.weekday,e.byweekday.n]],e.byweekday=null);else{var h=[],f=[];for(a=0;a<e.byweekday.length;a++){var d=e.byweekday[a];if(Object(i.e)(d))h.push(d);else{var y=d;!y.n||e.freq>P.MONTHLY?h.push(y.weekday):f.push([y.weekday,y.n])}}e.byweekday=Object(i.g)(h)?h:null,e.bynweekday=Object(i.g)(f)?f:null}else e.bynweekday=null;if(Object(i.f)(e.byhour)?Object(i.e)(e.byhour)&&(e.byhour=[e.byhour]):e.byhour=e.freq<P.HOURLY?[e.dtstart.getUTCHours()]:null,Object(i.f)(e.byminute)?Object(i.e)(e.byminute)&&(e.byminute=[e.byminute]):e.byminute=e.freq<P.MINUTELY?[e.dtstart.getUTCMinutes()]:null,Object(i.f)(e.bysecond)?Object(i.e)(e.bysecond)&&(e.bysecond=[e.bysecond]):e.bysecond=e.freq<P.SECONDLY?[e.dtstart.getUTCSeconds()]:null,e.freq>=P.HOURLY)r=null;else{for(r=[],a=0;a<e.byhour.length;a++)for(var m=e.byhour[a],p=0;p<e.byminute.length;p++)for(var v=e.byminute[p],b=0;b<e.bysecond.length;b++){var g=e.bysecond[b];r.push(new s.Time(m,v,g,o))}s.sort(r)}return{parsedOptions:e,timeset:r}}(t),r=n.parsedOptions,o=n.timeset;this.options=r,this.timeset=o}return t.parseText=function(t,e){return Z().parseText(t,e)},t.fromText=function(t,e){return Z().fromText(t,e)},t.fromString=function(e){return new t(t.parseString(e)||void 0)},t.prototype._cacheGet=function(t,e){return!!this._cache&&this._cache._cacheGet(t,e)},t.prototype._cacheAdd=function(t,e,n){if(this._cache)return this._cache._cacheAdd(t,e,n)},t.prototype.all=function(t){if(t)return this._iter(new M("all",{},t));var e=this._cacheGet("all");return!1===e&&(e=this._iter(new j("all",{})),this._cacheAdd("all",e)),e},t.prototype.between=function(t,e,n,r){void 0===n&&(n=!1);var i={before:e,after:t,inc:n};if(r)return this._iter(new M("between",i,r));var o=this._cacheGet("between",i);return!1===o&&(o=this._iter(new j("between",i)),this._cacheAdd("between",o,i)),o},t.prototype.before=function(t,e){void 0===e&&(e=!1);var n={dt:t,inc:e},r=this._cacheGet("before",n);return!1===r&&(r=this._iter(new j("before",n)),this._cacheAdd("before",r,n)),r},t.prototype.after=function(t,e){void 0===e&&(e=!1);var n={dt:t,inc:e},r=this._cacheGet("after",n);return!1===r&&(r=this._iter(new j("after",n)),this._cacheAdd("after",r,n)),r},t.prototype.count=function(){return this.all().length},t.prototype.toString=function(){return z(this.origOptions)},t.prototype.toText=function(t,e){return Z().toText(this,t,e)},t.prototype.isFullyConvertibleToText=function(){return Z().isFullyConvertible(this)},t.prototype.clone=function(){return new t(this.origOptions)},t.prototype._iter=function(e){var n,r,o=this.options.dtstart,a=new s.DateTime(o.getUTCFullYear(),o.getUTCMonth()+1,o.getUTCDate(),o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.valueOf()%1e3),u=this.options,c=u.freq,l=u.interval,h=u.wkst,f=u.until,d=u.bymonth,y=u.byweekno,m=u.byyearday,p=u.byweekday,v=u.byeaster,b=u.bymonthday,g=u.bynmonthday,w=u.bysetpos,k=u.byhour,O=u.byminute,T=u.bysecond,S=new E(this);S.rebuild(a.year,a.month);var j,D,M,N=(n={},n[t.YEARLY]=S.ydayset,n[t.MONTHLY]=S.mdayset,n[t.WEEKLY]=S.wdayset,n[t.DAILY]=S.ddayset,n[t.HOURLY]=S.ddayset,n[t.MINUTELY]=S.ddayset,n[t.SECONDLY]=S.ddayset,n)[c];c<t.HOURLY?j=this.timeset:(D=(r={},r[t.HOURLY]=S.htimeset,r[t.MINUTELY]=S.mtimeset,r[t.SECONDLY]=S.stimeset,r)[c],j=c>=t.HOURLY&&Object(i.g)(k)&&!Object(i.c)(k,a.hour)||c>=t.MINUTELY&&Object(i.g)(O)&&!Object(i.c)(O,a.minute)||c>=t.SECONDLY&&Object(i.g)(T)&&!Object(i.c)(T,a.second)?[]:D.call(S,a.hour,a.minute,a.second,a.millisecond));for(var x,L=this.options.count;;){for(var I=N.call(S,a.year,a.month,a.day),_=I[0],A=I[1],U=I[2],C=!1,Y=A;Y<U;Y++)(C=J(d,S,M=_[Y],y,p,v,b,g,m))&&(_[M]=null);if(Object(i.g)(w)&&Object(i.g)(j)){for(var R=void 0,z=void 0,F=[],V=0;V<w.length;V++){(x=w[V])<0?(R=Math.floor(x/j.length),z=Object(i.i)(x,j.length)):(R=Math.floor((x-1)/j.length),z=Object(i.i)(x-1,j.length));for(var Z=[],W=A;W<U;W++){var H=_[W];Object(i.f)(H)&&Z.push(H)}var q=void 0;q=R<0?Z.slice(R)[0]:Z[R];var P=j[z],G=s.fromOrdinal(S.yearordinal+q),B=s.combine(G,P);Object(i.c)(F,B)||F.push(B)}s.sort(F);for(V=0;V<F.length;V++){B=F[V];if(f&&B>f)return this.emitResult(e);if(B>=o){var K=this.rezoneIfNeeded(B);if(!e.accept(K))return this.emitResult(e);if(L&&!--L)return this.emitResult(e)}}}else for(V=A;V<U;V++)if(M=_[V],Object(i.f)(M)){var $=s.fromOrdinal(S.yearordinal+M);for(W=0;W<j.length;W++){P=j[W],B=s.combine($,P);if(f&&B>f)return this.emitResult(e);if(B>=o){K=this.rezoneIfNeeded(B);if(!e.accept(K))return this.emitResult(e);if(L&&!--L)return this.emitResult(e)}}}if(c===t.YEARLY?a.addYears(l):c===t.MONTHLY?a.addMonths(l):c===t.WEEKLY?a.addWeekly(l,h):c===t.DAILY?a.addDaily(l):c===t.HOURLY?(a.addHours(l,C,k),j=D.call(S,a.hour,a.minute,a.second)):c===t.MINUTELY?(a.addMinutes(l,C,k,O)&&(C=!1),j=D.call(S,a.hour,a.minute,a.second)):c===t.SECONDLY&&(a.addSeconds(l,C,k,O,T)&&(C=!1),j=D.call(S,a.hour,a.minute,a.second)),a.year>s.MAXYEAR)return this.emitResult(e);S.rebuild(a.year,a.month)}},t.prototype.emitResult=function(t){return this._len=t.total,t.getValue()},t.prototype.rezoneIfNeeded=function(t){return new R(t,this.options.tzid).rezonedDate()},t.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],t.YEARLY=a.YEARLY,t.MONTHLY=a.MONTHLY,t.WEEKLY=a.WEEKLY,t.DAILY=a.DAILY,t.HOURLY=a.HOURLY,t.MINUTELY=a.MINUTELY,t.SECONDLY=a.SECONDLY,t.MO=W.MO,t.TU=W.TU,t.WE=W.WE,t.TH=W.TH,t.FR=W.FR,t.SA=W.SA,t.SU=W.SU,t.parseString=_,t.optionsToString=z,t}();function J(t,e,n,r,o,a,s,u,c){return Object(i.g)(t)&&!Object(i.c)(t,e.mmask[n])||Object(i.g)(r)&&!e.wnomask[n]||Object(i.g)(o)&&!Object(i.c)(o,e.wdaymask[n])||Object(i.g)(e.nwdaymask)&&!e.nwdaymask[n]||null!==a&&!Object(i.c)(e.eastermask,n)||(Object(i.g)(s)||Object(i.g)(u))&&!Object(i.c)(s,e.mdaymask[n])&&!Object(i.c)(u,e.nmdaymask[n])||Object(i.g)(c)&&(n<e.yearlen&&!Object(i.c)(c,n+1)&&!Object(i.c)(c,-e.yearlen+n)||n>=e.yearlen&&!Object(i.c)(c,n+1-e.yearlen)&&!Object(i.c)(c,-e.nextyearlen+n-e.yearlen))}var G=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),B=function(t){function e(e){void 0===e&&(e=!1);var n=t.call(this,{},e)||this;return n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return G(e,t),e.prototype.tzid=function(t){if(void 0!==t&&(this._tzid=t),void 0!==this._tzid)return this._tzid;for(var e=0;e<this._rrule.length;e++){var n=this._rrule[e].origOptions.tzid;if(n)return n}},e.prototype.rrule=function(t){if(!(t instanceof P))throw new TypeError(String(t)+" is not RRule instance");Object(i.c)(this._rrule.map(String),String(t))||this._rrule.push(t)},e.prototype.rdate=function(t){if(!(t instanceof Date))throw new TypeError(String(t)+" is not Date instance");Object(i.c)(this._rdate.map(Number),Number(t))||(this._rdate.push(t),s.sort(this._rdate))},e.prototype.exrule=function(t){if(!(t instanceof P))throw new TypeError(String(t)+" is not RRule instance");Object(i.c)(this._exrule.map(String),String(t))||this._exrule.push(t)},e.prototype.exdate=function(t){if(!(t instanceof Date))throw new TypeError(String(t)+" is not Date instance");Object(i.c)(this._exdate.map(Number),Number(t))||(this._exdate.push(t),s.sort(this._exdate))},e.prototype.rdatesToString=function(t,e){var n=this.tzid(),r=!n||"UTC"===n.toUpperCase();return""+(r?t+":":t+";TZID="+n+":")+e.map(function(t){return s.timeToUntilString(t.valueOf(),r)}).join(",")},e.prototype.valueOf=function(){var t=[];return this._rrule.forEach(function(e){t=t.concat(e.toString().split("\n"))}),this._rdate.length&&t.push(this.rdatesToString("RDATE",this._rdate)),this._exrule.forEach(function(e){t=t.concat(e.toString().split("\n").map(function(t){return t.replace(/^RRULE:/,"EXRULE:")}).filter(function(t){return!/^DTSTART/.test(t)}))}),this._exdate.length&&t.push(this.rdatesToString("EXDATE",this._exdate)),t},e.prototype.toString=function(){return this.valueOf().join("\n")},e.prototype._iter=function(t){var e={},n=this._exrule,r=t.accept,i=this.tzid();function o(t,r){n.forEach(function(n){n.between(t,r,!0).forEach(function(t){e[Number(t)]=!0})})}this._exdate.forEach(function(t){var n=new R(t,i).rezonedDate();e[Number(n)]=!0}),t.accept=function(t){var n=Number(t);return!(!e[n]&&(o(new Date(n-1),new Date(n+1)),!e[n]))||(e[n]=!0,r.call(this,t))},"between"===t.method&&(o(t.args.after,t.args.before),t.accept=function(t){var n=Number(t);return!!e[n]||(e[n]=!0,r.call(this,t))});for(var a=0;a<this._rdate.length;a++){var u=new R(this._rdate[a],i).rezonedDate();if(!t.accept(new Date(u.getTime())))break}this._rrule.forEach(function(e){e._iter(t)});var c=t._result;switch(s.sort(c),t.method){case"all":case"between":return c;case"before":return c.length&&c[c.length-1]||null;case"after":return c.length&&c[0]||null;default:return null}},e.prototype.clone=function(){var t,n=new e(!!this._cache);for(t=0;t<this._rrule.length;t++)n.rrule(this._rrule[t].clone());for(t=0;t<this._rdate.length;t++)n.rdate(new Date(this._rdate[t].getTime()));for(t=0;t<this._exrule.length;t++)n.exrule(this._exrule[t].clone());for(t=0;t<this._exdate.length;t++)n.exdate(new Date(this._exdate[t].getTime()));return n},e}(P),K=function(){return(K=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},$={dtstart:null,cache:!1,unfold:!1,forceset:!1,compatible:!1,tzid:null};function Q(t,e){var n=[],r=[],o=[],a=[],s=A(t),u=s.dtstart,c=s.tzid;return function(t,e){void 0===e&&(e=!1);if(!(t=t&&t.trim()))throw new Error("Invalid empty string");if(!e)return t.split(/\s/);var n=t.split("\n"),r=0;for(;r<n.length;){var i=n[r]=n[r].replace(/\s+$/g,"");i?r>0&&" "===i[0]?(n[r-1]+=i.slice(1),n.splice(r,1)):r+=1:n.splice(r,1)}return n}(t,e.unfold).forEach(function(t){if(t){var e=function(t){var e=function(t){if(-1===t.indexOf(":"))return{name:"RRULE",value:t};var e=Object(i.l)(t,":",1),n=e[0],r=e[1];return{name:n,value:r}}(t),n=e.name,r=e.value,o=n.split(";");if(!o)throw new Error("empty property name");return{name:o[0].toUpperCase(),parms:o.slice(1),value:r}}(t),s=e.name,u=e.parms,l=e.value;switch(s.toUpperCase()){case"RRULE":if(u.length)throw new Error("unsupported RRULE parm: "+u.join(","));n.push(_(t));break;case"RDATE":var h=/RDATE(?:;TZID=([^:=]+))?/i.exec(t),f=(h[0],h[1]);f&&!c&&(c=f),r=r.concat(et(l,u));break;case"EXRULE":if(u.length)throw new Error("unsupported EXRULE parm: "+u.join(","));o.push(_(l));break;case"EXDATE":a=a.concat(et(l,u));break;case"DTSTART":break;default:throw new Error("unsupported property: "+s)}}}),{dtstart:u,tzid:c,rrulevals:n,rdatevals:r,exrulevals:o,exdatevals:a}}function X(t,e){return void 0===e&&(e={}),function(t,e){var n=Q(t,e),r=n.rrulevals,i=n.rdatevals,o=n.exrulevals,a=n.exdatevals,s=n.dtstart,u=n.tzid,c=!1===e.cache;if(e.compatible&&(e.forceset=!0,e.unfold=!0),e.forceset||r.length>1||i.length||o.length||a.length){var l=new B(c);return l.tzid(u||void 0),r.forEach(function(t){l.rrule(new P(tt(t,s,u),c))}),i.forEach(function(t){l.rdate(t)}),o.forEach(function(t){l.exrule(new P(tt(t,s,u),c))}),a.forEach(function(t){l.exdate(t)}),e.compatible&&e.dtstart&&l.rdate(s),l}var h=r[0];return new P(tt(h,h.dtstart||e.dtstart||s,h.tzid||e.tzid||u),c)}(t,function(t){var e=[],n=Object.keys(t),r=Object.keys($);if(n.forEach(function(t){Object(i.c)(r,t)||e.push(t)}),e.length)throw new Error("Invalid options: "+e.join(", "));var o=K({},t);return r.forEach(function(t){Object(i.c)(n,t)||(o[t]=$[t])}),o}(e))}function tt(t,e,n){return K({},t,{dtstart:e,tzid:n})}function et(t,e){return function(t){t.forEach(function(t){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(t))throw new Error("unsupported RDATE/EXDATE parm: "+t)})}(e),t.split(",").map(function(t){return s.untilStringToDate(t)})}n.d(e,"Frequency",function(){return a}),n.d(e,"Weekday",function(){return x}),n.d(e,"RRule",function(){return P}),n.d(e,"RRuleSet",function(){return B}),n.d(e,"rrulestr",function(){return X});
/*!
* rrule.js - Library for working with recurrence rules for calendar dates.
* https://github.com/jakubroztocil/rrule
*
* Copyright 2010, Jakub Roztocil and Lars Schoning
* Licenced under the BSD licence.
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
* Based on:
* python-dateutil - Extensions to the standard Python datetime module.
* Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
* Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
*/e.default=P},function(t,e,n){"use strict";function r(t){return void 0===t}function i(t){return"number"==typeof t}function o(){return"undefined"!=typeof Intl&&Intl.DateTimeFormat}function a(){return!r(Intl.DateTimeFormat.prototype.formatToParts)}function s(t,e,n){if(0!==t.length)return t.reduce(function(t,r){var i=[e(r),r];return t&&n.apply(null,[t[0],i[0]])===t[0]?t:i},null)[1]}function u(t,e){return e.reduce(function(e,n){return e[n]=t[n],e},{})}function c(t,e,n){return i(t)&&t>=e&&t<=n}function l(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return t.toString().length<e?("0".repeat(e)+t).slice(-e):t.toString()}function h(t){if(r(t))return NaN;var e=1e3*parseFloat("0."+t);return Math.floor(e)}function f(t){return t%4==0&&(t%100!=0||t%400==0)}function d(t){return f(t)?366:365}function y(t,e){var n=function(t,e){return t-e*Math.floor(t/e)}(e-1,12)+1;return 2===n?f(t+(e-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function m(t){var e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,n=t-1,r=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7;return 4===e||3===r?53:52}function p(t){return t>99?t:t>60?1900+t:2e3+t}function v(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=new Date(t),s={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);var u=Object.assign({timeZoneName:e},s),c=o();if(c&&a()){var l=new Intl.DateTimeFormat(n,u).formatToParts(i).find(function(t){return"timezonename"===t.type.toLowerCase()});return l?l.value:null}if(c){var h=new Intl.DateTimeFormat(n,s).format(i);return new Intl.DateTimeFormat(n,u).format(i).substring(h.length).replace(/^[, ]+/,"")}return null}function b(t,e){var n=parseInt(t,10)||0,r=parseInt(e,10)||0;return 60*n+(n<0?-r:r)}function g(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i={};for(var o in t)if(t.hasOwnProperty(o)){var a=t[o];if(null!==a&&!r(a)&&!Number.isNaN(a)){var s=e(o,n);s&&(i[s]=a)}}return i}function w(t){return u(t,["hour","minute","second","millisecond"])}Object.defineProperty(e,"__esModule",{value:!0});var k=function(){try{return n(3).inspect.custom}catch(t){return Symbol("util.inspect.custom")}}(),O="numeric",T="short",S="long",E="2-digit",j={year:O,month:O,day:O},D={year:O,month:T,day:O},M={year:O,month:S,day:O},N={year:O,month:S,day:O,weekday:S},x={hour:O,minute:E},L={hour:O,minute:E,second:E},I={hour:O,minute:E,second:E,timeZoneName:T},_={hour:O,minute:E,second:E,timeZoneName:S},A={hour:O,minute:E,hour12:!1},U={hour:O,minute:E,second:E,hour12:!1},C={hour:O,minute:E,second:E,hour12:!1,timeZoneName:T},Y={hour:O,minute:E,second:E,hour12:!1,timeZoneName:S},R={year:O,month:O,day:O,hour:O,minute:E},z={year:O,month:O,day:O,hour:O,minute:E,second:E},F={year:O,month:T,day:O,hour:O,minute:E},V={year:O,month:T,day:O,hour:O,minute:E,second:E},Z={year:O,month:S,day:O,hour:O,minute:E,timeZoneName:T},W={year:O,month:S,day:O,hour:O,minute:E,second:E,timeZoneName:T},H={year:O,month:S,day:O,weekday:S,hour:O,minute:E,timeZoneName:S},q={year:O,month:S,day:O,weekday:S,hour:O,minute:E,second:E,timeZoneName:S};function P(t){return JSON.stringify(t,Object.keys(t).sort())}var J=["January","February","March","April","May","June","July","August","September","October","November","December"],G=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B=["J","F","M","A","M","J","J","A","S","O","N","D"];function K(t){switch(t){case"narrow":return B;case"short":return G;case"long":return J;case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var $=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Q=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],X=["M","T","W","T","F","S","S"];function tt(t){switch(t){case"narrow":return X;case"short":return Q;case"long":return $;case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var et=["AM","PM"],nt=["Before Christ","Anno Domini"],rt=["BC","AD"],it=["B","A"];function ot(t){switch(t){case"narrow":return it;case"short":return rt;case"long":return nt;default:return null}}var at="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},st=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},ut=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),ct=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},lt=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},ht=function(t){function e(){return st(this,e),lt(this,t.apply(this,arguments))}return ct(e,t),e}(Error),ft=function(t){function e(n){return st(this,e),lt(this,t.call(this,"Invalid DateTime: "+n))}return ct(e,t),e}(ht),dt=function(t){function e(n){return st(this,e),lt(this,t.call(this,"Invalid Interval: "+n))}return ct(e,t),e}(ht),yt=function(t){function e(n){return st(this,e),lt(this,t.call(this,"Invalid Duration: "+n))}return ct(e,t),e}(ht),mt=function(t){function e(){return st(this,e),lt(this,t.apply(this,arguments))}return ct(e,t),e}(ht),pt=function(t){function e(n){return st(this,e),lt(this,t.call(this,"Invalid unit "+n))}return ct(e,t),e}(ht),vt=function(t){function e(){return st(this,e),lt(this,t.apply(this,arguments))}return ct(e,t),e}(ht),bt=function(t){function e(){return st(this,e),lt(this,t.call(this,"Zone is an abstract class"))}return ct(e,t),e}(ht),gt=function(){function t(){st(this,t)}return t.prototype.offsetName=function(t,e){throw new bt},t.prototype.offset=function(t){throw new bt},t.prototype.equals=function(t){throw new bt},ut(t,[{key:"type",get:function(){throw new bt}},{key:"name",get:function(){throw new bt}},{key:"universal",get:function(){throw new bt}},{key:"isValid",get:function(){throw new bt}}]),t}(),wt=null,kt=function(t){function e(){return st(this,e),lt(this,t.apply(this,arguments))}return ct(e,t),e.prototype.offsetName=function(t,e){return v(t,e.format,e.locale)},e.prototype.offset=function(t){return-new Date(t).getTimezoneOffset()},e.prototype.equals=function(t){return"local"===t.type},ut(e,[{key:"type",get:function(){return"local"}},{key:"name",get:function(){return o()?(new Intl.DateTimeFormat).resolvedOptions().timeZone:"local"}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!0}}],[{key:"instance",get:function(){return null===wt&&(wt=new e),wt}}]),e}(gt),Ot={};var Tt={year:0,month:1,day:2,hour:3,minute:4,second:5};var St=function(t){function e(n){st(this,e);var r=lt(this,t.call(this));return r.zoneName=n,r.valid=e.isValidZone(n),r}return ct(e,t),e.isValidSpecifier=function(t){return t&&t.match(/^[a-z_+-]{1,256}\/[a-z_+-]{1,256}(\/[a-z_+-]{1,256})?$/i)},e.isValidZone=function(t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(t){return!1}},e.parseGMTOffset=function(t){if(t){var e=t.match(/^Etc\/GMT([+-]\d{1,2})$/i);if(e)return 60*parseInt(e[1])}return null},e.prototype.offsetName=function(t,e){return v(t,e.format,e.locale,this.zoneName)},e.prototype.offset=function(t){var e=new Date(t),n=function(t){return Ot[t]||(Ot[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Ot[t]}(this.zoneName),i=n.formatToParts?function(t,e){for(var n=t.formatToParts(e),i=[],o=0;o<n.length;o++){var a=n[o],s=a.type,u=a.value,c=Tt[s];r(c)||(i[c]=parseInt(u,10))}return i}(n,e):function(t,e){var n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n),i=r[1],o=r[2];return[r[3],i,o,r[4],r[5],r[6]]}(n,e),o=i[0],a=i[1],s=i[2],u=i[3],c=i[4],l=i[5],h=Date.UTC(o,a-1,s,u,c,l),f=e.valueOf();return(h-(f-=f%1e3))/6e4},e.prototype.equals=function(t){return"iana"===t.type&&t.zoneName===this.zoneName},ut(e,[{key:"type",get:function(){return"iana"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return this.valid}}]),e}(gt),Et=null;var jt=function(t){function e(n){st(this,e);var r=lt(this,t.call(this));return r.fixed=n,r}return ct(e,t),e.instance=function(t){return 0===t?e.utcInstance:new e(t)},e.parseSpecifier=function(t){if(t){var n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new e(b(n[1],n[2]))}return null},ut(e,null,[{key:"utcInstance",get:function(){return null===Et&&(Et=new e(0)),Et}}]),e.prototype.offsetName=function(){return this.name},e.prototype.offset=function(){return this.fixed},e.prototype.equals=function(t){return"fixed"===t.type&&t.fixed===this.fixed},ut(e,[{key:"type",get:function(){return"fixed"}},{key:"name",get:function(){return 0===this.fixed?"UTC":"UTC"+function(t){var e=Math.trunc(t.fixed/60),n=Math.abs(t.fixed%60),r=(e>0?"+":"-")+Math.abs(e);return n>0?r+":"+l(n,2):r}(this)}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e}(gt),Dt=null,Mt=function(t){function e(){return st(this,e),lt(this,t.apply(this,arguments))}return ct(e,t),e.prototype.offsetName=function(){return null},e.prototype.offset=function(){return NaN},e.prototype.equals=function(){return!1},ut(e,[{key:"type",get:function(){return"invalid"}},{key:"name",get:function(){return null}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!1}}],[{key:"instance",get:function(){return null===Dt&&(Dt=new e),Dt}}]),e}(gt);function Nt(t,e){var n=void 0;if(r(t)||null===t)return e;if(t instanceof gt)return t;if(function(t){return"string"==typeof t}(t)){var o=t.toLowerCase();return"local"===o?kt.instance:"utc"===o||"gmt"===o?jt.utcInstance:null!=(n=St.parseGMTOffset(t))?jt.instance(n):St.isValidSpecifier(o)?new St(t):jt.parseSpecifier(o)||Mt.instance}return i(t)?jt.instance(t):"object"===(void 0===t?"undefined":at(t))&&t.offset?t:Mt.instance}var xt=function(){return Date.now()},Lt=null,It=null,_t=null,At=null,Ut=!1,Ct=function(){function t(){st(this,t)}return t.resetCaches=function(){qt.resetCache()},ut(t,null,[{key:"now",get:function(){return xt},set:function(t){xt=t}},{key:"defaultZoneName",get:function(){return(Lt||kt.instance).name},set:function(t){Lt=t?Nt(t):null}},{key:"defaultZone",get:function(){return Lt||kt.instance}},{key:"defaultLocale",get:function(){return It},set:function(t){It=t}},{key:"defaultNumberingSystem",get:function(){return _t},set:function(t){_t=t}},{key:"defaultOutputCalendar",get:function(){return At},set:function(t){At=t}},{key:"throwOnInvalid",get:function(){return Ut},set:function(t){Ut=t}}]),t}();function Yt(t,e){var n="",r=t,i=Array.isArray(r),o=0;for(r=i?r:r[Symbol.iterator]();;){var a;if(i){if(o>=r.length)break;a=r[o++]}else{if((o=r.next()).done)break;a=o.value}var s=a;s.literal?n+=s.val:n+=e(s.val)}return n}var Rt={D:j,DD:D,DDD:M,DDDD:N,t:x,tt:L,ttt:I,tttt:_,T:A,TT:U,TTT:C,TTTT:Y,f:R,ff:F,fff:Z,ffff:H,F:z,FF:V,FFF:W,FFFF:q},zt=function(){function t(e,n){st(this,t),this.opts=n,this.loc=e,this.systemLoc=null}return t.create=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new t(e,Object.assign({},{round:!0},n))},t.parseFormat=function(t){for(var e=null,n="",r=!1,i=[],o=0;o<t.length;o++){var a=t.charAt(o);"'"===a?(n.length>0&&i.push({literal:r,val:n}),e=null,n="",r=!r):r?n+=a:a===e?n+=a:(n.length>0&&i.push({literal:!1,val:n}),n=a,e=a)}return n.length>0&&i.push({literal:r,val:n}),i},t.prototype.formatWithSystemDefault=function(t,e){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,Object.assign({},this.opts,e)).format()},t.prototype.formatDateTime=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.loc.dtFormatter(t,Object.assign({},this.opts,e)).format()},t.prototype.formatDateTimeParts=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.loc.dtFormatter(t,Object.assign({},this.opts,e)).formatToParts()},t.prototype.resolvedOptions=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.loc.dtFormatter(t,Object.assign({},this.opts,e)).resolvedOptions()},t.prototype.num=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this.opts.forceSimple)return l(t,e);var n=Object.assign({},this.opts);return e>0&&(n.padTo=e),this.loc.numberFormatter(n).format(t)},t.prototype.formatDateTimeFromString=function(e,n){var r=this,i="en"===this.loc.listingMode(),o=function(t,n){return r.loc.extract(e,t,n)},a=function(t){if(e.isOffsetFixed&&0===e.offset&&t.allowZ)return"Z";var n=Math.trunc(e.offset/60),i=Math.abs(e.offset%60),o=n>=0?"+":"-",a=""+o+Math.abs(n);switch(t.format){case"short":return""+o+r.num(Math.abs(n),2)+":"+r.num(i,2);case"narrow":return i>0?a+":"+i:a;case"techie":return""+o+r.num(Math.abs(n),2)+r.num(i,2);default:throw new RangeError("Value format "+t.format+" is out of range for property format")}},s=function(){return i?function(t){return et[t.hour<12?0:1]}(e):o({hour:"numeric",hour12:!0},"dayperiod")},u=function(t,n){return i?function(t,e){return K(e)[t.month-1]}(e,t):o(n?{month:t}:{month:t,day:"numeric"},"month")},c=function(t,n){return i?function(t,e){return tt(e)[t.weekday-1]}(e,t):o(n?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday")},l=function(t){return i?function(t,e){return ot(e)[t.year<0?0:1]}(e,t):o({era:t},"era")};return Yt(t.parseFormat(n),function(t){var n=r.loc.outputCalendar;switch(t){case"S":return r.num(e.millisecond);case"u":case"SSS":return r.num(e.millisecond,3);case"s":return r.num(e.second);case"ss":return r.num(e.second,2);case"m":return r.num(e.minute);case"mm":return r.num(e.minute,2);case"h":return r.num(e.hour%12==0?12:e.hour%12);case"hh":return r.num(e.hour%12==0?12:e.hour%12,2);case"H":return r.num(e.hour);case"HH":return r.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:r.opts.allowZ});case"ZZ":return a({format:"short",allowZ:r.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:!1});case"ZZZZ":return e.offsetNameShort;case"ZZZZZ":return e.offsetNameLong;case"z":return e.zoneName;case"a":return s();case"d":return n?o({day:"numeric"},"day"):r.num(e.day);case"dd":return n?o({day:"2-digit"},"day"):r.num(e.day,2);case"c":return r.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return r.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return n?o({month:"numeric",day:"numeric"},"month"):r.num(e.month);case"LL":return n?o({month:"2-digit",day:"numeric"},"month"):r.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u