/* @license Copyright (C) Exontrol. All rights reserved. */ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(t="undefined"!=typeof globalThis?globalThis:t||self,n(t.exontrol||{}))}(this,function(t){"use strict";function n(){return Math.max.apply(0,arguments)}var i=i||window.exontrol;i.Mrg(i,function(){function t(t){return i.ToS(t).trim()}function r(t,n){var r,e=i.ToS(t);return(n=i.ToS(n,A))&&(r=n.length-e.length)>0&&(e=n.substr(0,r)+e),e}function e(t){return"MINUTELY"==t?"N":t.charAt(0)}function o(t){return t%x}function s(t){return t-o(t)}function u(t,n,i,r,e,o){return Date.Create(t,n,i,r,e,o)}function h(t,n,i){return null!=t&&(t=u(t)),null==t?t=n||i:(null!=n&&(n=u(n))&&(t=t.getTime()>n.getTime()?t:n),null!=i&&(i=u(i))&&(t=t.getTime()=O&&(this.m-=O,this.y++)},V.prototype.nW=function(t){var n=this.get();n&&this.set(n.NextWeek(t||this.int))},V.prototype.nD=function(t){var n=this.get();n&&this.set(n.NextDay(t||this.int))},V.prototype.nH=function(t){var n=~~((t=t||this.int)/24);n&&this.nD(n),this.h+=t%24,this.h>=24&&(this.h-=24,this.nD(1))},V.prototype.nN=function(t){var n=~~((t=t||this.int)/60);n&&this.nH(n),this.n+=t%60,this.n>=60&&(this.n-=60,this.nH(1))},V.prototype.nS=function(t){var n=~~((t=t||this.int)/60);n&&this.nN(n),this.s+=t%60,this.s>=60&&(this.s-=60,this.nN(1))};var ct={ignoreUnknownRule:!0};return R.version="1.8",R.type="IRecur",R.count=256,R.toU=function(t){return i.ToS(t).toUpperCase()},R.Parse=function(n,e){i.IsO(n)&&(n=function(n){function e(n){return i.IsD(n)?function(t){var n=r(c(t),w)+r(a(t))+r(l(t));return(y(t)||p(t)||d(t))&&(n+=r(y(t))+r(p(t))+r(d(t))+"Z"),n}(n):t(n)}var o="";if(n)for(var s in n)o+=(o.length?S:"")+s+I+e(n[s]);return o}(n)),n=t(n);var o=U.get(n);return!o&&U.set(n,o=new R(e).parse(n)),o},R.prototype.init=function(){this.mR=null,this.oE=null,this.oT=null,this.r=null},R.prototype.parse=function(r){function o(t){var n,i,r,e=void 0;return t&&(n=t.match(k))&&(i=[~~(r=n[1]).substr(0,4),~~r.substr(4,2),~~r.substr(6,2)],Date.parse(i.join("-"))&&(i[1]--,(r=n[2])&&(r=r.substr(1))&&(i.push(~~r.substr(0,2)),i.push(~~r.substr(2,2)),i.push(~~r.substr(4,2))),e=n[3]||!r?new Date(Date.UTC(i[0],i[1],i[2],i[3]||0,i[4]||0,i[5]||0)):new Date(i[0],i[1],i[2],i[3]||0,i[4]||0,i[5]||0),isNaN(e)&&(e=void 0))),e}function s(n,r){this.oE||(this.oE=n,(r=t(r))&&(this.oE=i.Cpy(this.oE))&&(this.oE.desc=this.oE.desc.replace("...",r)))}function h(t,n,i){var r=this.get(t);return null!=r&&(null!=(r=n.call(this,r))?this.set(t,r):(this.del(t),i&&s.call(this,i))),!this.oE}function a(){function t(){function t(t,n){var i=[],r=[],e={l:!0};this.r.fR(t,e);for(var o=e.s.copy(),s=e.e.getTime();o.getTime()<=s;o.NextDay())this.vBy(o)&&r.push(o.copy());return r.length&&(n?n.forEach(function(t){var n=function(t,n){if(t<0&&(t=n.length+t+1),--t>=0&&t=s)&&c.push(h))}),c}.call(this,c(t.date),this.r.byM,o,s,h,a,e).forEachU(function(r){return!this.enumT(r,function(r){return!t.out(r)&&n.pushnn(i(r.getTime())),t.idle()&&(!t.count||n.len()=-53&&t<=53),i&&(e=(n=n||new Map).get(r),!~(e=e||[]).indexOf(t)&&e.push(t),!e.z&&(e.z=!t),n.set(r,e))))}),n}(t)},ut.invalidByDay)&&h.call(this,tt,function(t){return f(t,-31,31,0)},ut.invalidByMonthDay)&&h.call(this,nt,function(t){return f(t,-366,366,0)},ut.invalidByYearDay)&&h.call(this,et,function(t){return f(t,-366,366,0)},ut.invalidBySetPos)&&h.call(this,rt,function(t){return f(t,1,12)},ut.invalidByMonth)&&h.call(this,J,function(t){return f(t,0,23)},ut.invalidByHour)&&h.call(this,$,function(t){return f(t,0,59)},ut.invalidByMinute)&&h.call(this,Z,function(t){return f(t,0,60)},ut.invalidBySecond)&&(this.oO.ignoreUnknownRule||!(r=function(){var t;return this.mR&&this.mR.forEach(function(n,i){t||ht.has(i)||(t=i)}),t}.call(this))?(this.r={},function(){var t=this.freq();this.r.fR=this["fR"+e(t)].bind(this)}.call(this),function(){var t,n,i=this.r;i.rgqVBy=[],(t=this.bymonth())&&(i.byM=t,i.rgqVBy.push(this.qVbyM)),(t=this.byweekno())&&(i.byW=t,i.rgqVBy.push(this.qVbyW)),(t=this.bymonthday())&&(i.byMD=t,i.rgqVBy.push(this.qVbyMD)),(t=this.byyearday())&&(i.byYD=t,i.rgqVBy.push(this.qVbyYD)),(t=this.byday())&&(i.byD=t,(n=this.freq())==P?i.rgqVBy.push(this.qVbyDM):n==L?i.byM?i.rgqVBy.push(this.qVbyDM):i.rgqVBy.push(this.qVbyDY):i.rgqVBy.push(this.qVbyD))}.call(this),function(){var t=this.r;N.forEachU(function(n){return t[n]&&(t.c=this["c"+i.getP(n)].bind(this))&&(t.cN=n)},this)}.call(this),function(){var t=this.r;t.rgV=[],t.c&&N.forEach(function(n){t[n]&&t.rgV.push(this["v"+i.getP(n)])},this)}.call(this),t.call(this)):s.call(this,ut.unknownRule,r))}else s.call(this,ut.missFreq);else s.call(this,ut.empty);return this}function f(t,n,r,e){var o;return t&&t.split(",").forEach(function(t){i.IsI(t)&&(t=~~t,null!=e&&t==e||t>=n&&t<=r&&!~(o=o||[]).indexOf(t)&&o.push(t))}),o}if(this.init(),r=t(r)){var v,g={P:r,C:0,W:S};for(this.mR=new Map;~g.C;)M(g),~M(v={P:g.V,C:0,W:I})&&this.set(v.V.trim(),R.toU(g.V.substr(v.C).trim()))}return a.call(this)},R.prototype.valid=function(){return!this.oE},R.prototype.error=function(){return this.oE&&this.oE.desc||""},R.prototype.get=function(t){return this.mR&&this.mR.get(R.toU(t))},R.prototype.has=function(t){return this.mR&&this.mR.has(R.toU(t))},R.prototype.set=function(t,n){this.mR&&this.mR.set(R.toU(t),n)},R.prototype.del=function(t){this.mR&&this.mR.delete(R.toU(t))},R.prototype.freq=function(){return this.get("FREQ")},R.prototype.interval=function(){return~~n(1,this.get(j))},R.prototype.count=function(){return~~n(1,this.get(G))},R.prototype.dtstart=function(){return this.get(F)||Date.Now()},R.prototype.until=function(){return this.get(K)},R.prototype.wkst=function(){return this.has(ot)?this.get(ot):1},R.prototype.bymonth=function(){var t=this.get(rt);return t&&new i.Arr(t)},R.prototype.byweekno=function(){var t=this.get(it);return t&&new i.Arr(t)},R.prototype.bymonthday=function(){var t=this.get(tt);return t&&new i.Arr(t)},R.prototype.byyearday=function(){var t=this.get(nt);return t&&new i.Arr(t)},R.prototype.byday=function(){return this.get(X)},R.prototype.bysetpos=function(){var t=this.get(et);return t&&new i.Arr(t)},R.prototype.dFR=function(t,i,r){if(t.l){var e=this.r.dS.getTime();i=n(i,e),r=n(r,e)}t.s=new Date(i),t.e=new Date(r)},R.prototype.bytime=function(t){var n=this.get(t);return n&&n.slice()},R.prototype.fRY=function(t,n){var i=c(t),r=o(this.r.dS.getTime());return this.dFR(n,Date.UTC(i,0,1)+r,Date.UTC(i,11,31)+r),i},R.prototype.fRM=function(t,n){var i=c(t),r=a(t)-1,e=o(this.r.dS.getTime());return this.dFR(n,Date.UTC(i,r,1)+e,Date.UTC(i,r,m(i,r))+e),r+1},R.prototype.fRW=function(t,n){var i=this.wkst(),r=v(t,i),e=o(this.r.dS.getTime()),u=s(r.getTime());return this.dFR(n,u+e,u+(C-1)*x+e),b(t,i)},R.prototype.fRD=function(t,n){var i=s(t.getTime())+o(this.r.dS.getTime());return this.dFR(n,i,i),l(t)},R.prototype.fRH=function(t,n){return y(t)},R.prototype.fRN=function(t,n){return p(t)},R.prototype.fRS=function(t,n){return d(t)},R.prototype.qVbyM=function(t){return~this.r.byM.indexOf(a(t))},R.prototype.qVbyW=function(t){var n=this.wkst(),i=this.r.byW,r=b(t,n);return~i.indexOf(r)||~i.indexOf(-(B(c(t),n)-(r-1)))||1==r&&12==a(t)&&~i.indexOf(-B(c(t)+1,n))||53==r&&1==a(t)&&~i.indexOf(-(B(c(t)-1,n)-(r-1)))},R.prototype.qVbyMD=function(t){var n=l(t),i=this.r.byMD;return~i.indexOf(n)||~i.indexOf(-(m(c(t),a(t)-1)-(n-1)))},R.prototype.qVbyYD=function(t){var n=function(t){return t.yDay()}(t)+1,i=this.r.byYD;return~i.indexOf(n)||~i.indexOf(-(T(c(t))-(n-1)))},R.prototype.qVbyWD=function(t){return this.r.byD.get(f(t))},R.prototype.qVbyDM=function(t){var n=this.qVbyWD(t);return n&&(n.z||n.forEachU(function(n){return function(n){function i(n){return c(t)==c(n)&&a(t)==a(n)}var r=t.copy().addD(-n*C);return!i(r)&&i(r.addD((n<0?-1:1)*C))}(n)}))},R.prototype.qVbyDY=function(t){var n=this.qVbyWD(t);return n&&(n.z||n.forEachU(function(n){return function(n){function i(n){return c(t)==c(n)}var r=t.copy().addD(-n*C);return!i(r)&&i(r.addD((n<0?-1:1)*C))}(n)}))},R.prototype.qVbyD=function(t){return this.qVbyWD(t)},R.prototype.qVby=function(t){for(var n=!0,i=this.r.rgqVBy,r=0,e=i.length;n&&r=1&&e<=r&&t.add(u(n,o,e).getTime())})})},R.prototype.cByW=function(t,i){var r=this.wkst();this.cBy(t,i,"byW",function(t,i,e){e.forEach(function(e){var o,s=B(i,r);if(e<0&&(e=s+e+1),e>=1&&e<=s){for(o=v(u(i,1,1),r).addD(n(0,e-1)*C);b(o,r)!=e;)o.NextDay();for(var h=0;h0;e=o?e-1:e+1;for(var s,h=1;h<=O;h++)s=u(n,h,1),(s=o?g(s,r):v(s.NextMonth().PrevDay(),r)).addD(e*C),c(s)==n&&a(s)==h&&t.add(s.getTime())}else i(t,n,r)}:r==L&&(e=function(t,n,r,e){if(e){var o=e>0,s=u(n,1,1);e=o?e-1:e+1,(s=o?g(s,r):v(s.NextYear().PrevDay(),r)).addD(e*C),c(s)==n&&t.add(s.getTime())}else i(t,n,r)}),this.cBy(t,n,"byD",function(t,n,r){r.forEach(function(r,o){r.forEach(function(r){(r?e:i)(t,n,o,r)})})})},R.prototype.cByM=function(t,n){this.cBy(t,n,"byM",function(t,n,i){i.forEach(function(i){for(var r=1,e=m(n,i-1),o=u(n,i,1);r<=e;r++,o.NextDay())t.add(o.getTime())})})},R.prototype.val=function(t,n,r){var e=new i.Arr,o=t.GetYear();return n.call(this,e,o),r&&(n.call(this,e,o-1),n.call(this,e,o+1)),e.has(s(t.getTime()))},R.prototype.vByYD=function(t){return this.val(t,this.cByYD)},R.prototype.vByMD=function(t){return this.val(t,this.cByMD)},R.prototype.vByW=function(t){return this.val(t,this.cByW,!0)},R.prototype.vByD=function(t){return this.val(t,this.cByD)},R.prototype.vByM=function(t){return this.val(t,this.cByM)},R.prototype.vBy=function(t){for(var n=!0,i=this.r.rgV,r=0,e=i.length;n&&rh?1:t.getTime()=0;e--)if(T=b[e]){if(++T.i