rrule-temporal 2.2.6 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -91
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +70 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +1 -1
- package/dist/src-DcoDqR4A.cjs +2 -0
- package/dist/src-vjCiI_-u.js +2 -0
- package/dist/totext.cjs +1 -1
- package/dist/totext.js +1 -1
- package/package.json +1 -1
- package/dist/src-5ULu8Hra.cjs +0 -2
- package/dist/src-D9fIlUxz.js +0 -2
package/dist/src-5ULu8Hra.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=(e,t)=>`Non-positive ${e}: ${t}`,t=(e,t)=>`Non-finite ${e}: ${t}`,n=e=>`Cannot convert bigint to ${e}`,r=(e,t,n,r)=>i(e,t)+`; must be between ${n}-${r}`,i=(e,t)=>`Invalid ${e}: ${t}`;function a(e){return e===void 0?Object.create(null):f(e)}function o(e,r=`number`){if(typeof e==`bigint`)throw TypeError(n(r));if(e=Number(e),!Number.isFinite(e))throw RangeError(t(r,e));return e}function s(e,t){return Math.trunc(o(e,t))||0}function c(e,t){return l(s(e,t),t)}function l(t,n=`number`){if(t<=0)throw RangeError(e(n,t));return t}function u(e,t,n){return Math.min(Math.max(e,t),n)}function d(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function f(e){if(!d(e))throw TypeError(`Invalid object`);return e}const p=i,m=e=>`Missing ${e}`,h=e=>`No valid fields: `+e.join(),g=(e,t,n)=>i(e,t)+`; must be `+Object.keys(n).join(),_=e=>`Missing year`+(e?`/era/eraYear`:``),ee=`Invalid leap month`,te=e=>i(`Calendar`,e),ne=e=>i(`TimeZone`,e),re=e=>`Cannot parse: ${e}`,ie=e=>`Invalid substring: ${e}`,ae=u,v=d;function y(e){throw RangeError(e)}function b(e){throw TypeError(e)}function oe(e,t,n,r,i){return se(t,((e,t)=>{let n=e[t];return n===void 0&&b(m(t)),n})(e,t),n,r,i)}function se(e,t,n,i,a,o){let s=ae(t,n,i);return a&&t!==s&&y(((e,t,n,i,a)=>a?r(e,a[t],a[n],a[i]):r(e,t,n,i))(e,t,n,i,o)),s}function ce(e,t=Map){let n=new t;return(t,...r)=>{if(n.has(t))return n.get(t);let i=e(t,...r);return n.set(t,i),i}}const le=e=>ue({name:e},1),ue=(e,t)=>fe(e=>({value:e,configurable:1,writable:!t}),e),de=e=>({[Symbol.toStringTag]:{value:e,configurable:1}});function fe(e,t){let n={};for(let r in t)n[r]=e(t[r],r);return n}function pe(e,t){let n={};for(let r of e)n[r]=t;return n}function me(e){let t={};for(let n of e)t[n]=e=>e[n];return t}function he(e,t,n=Object.create(null)){for(let r of e)n[r]=t[r];return n}function ge(e,t,n){for(let r of e)if(t[r]!==n[r])return 0;return 1}function _e(e,t,n){let r={...n};for(let n=0;n<t;n++)r[e[n]]=0;return r}function x(e,...t){return(...n)=>e(...t,...n)}function ve(){}function ye(e){return e[0].toUpperCase()+e.substring(1)}function S(...e){return[].concat(...e).sort()}function be(e){return RegExp(`^${e}$`,`i`)}function xe(e){return parseInt(e.padEnd(9,`0`))}function Se(e){return e&&e!==`+`?-1:1}function Ce(e){return e===void 0?0:parseInt(e)}function we(e,t){return String(t).padStart(e,`0`)}const Te=x(we,2);function C(e,t){return Math.sign(e-t)}function w(e,t){return e<t?-1:e>t?1:0}function Ee(e,t){let n=e/t;return e%t<0n?n-1n:n}function De(e,t){let n=Ee(e,t);return[n,e-n*t]}function Oe(e,t){return[Math.floor(e/t),ke(e,t)]}function ke(e,t){return(e%t+t)%t}function Ae(e,t){return Math.trunc(e/t)||0}function je(e,t){return e%t||0}function Me(e,t=1){return t*(.5+e/5)}function Ne(e){return Math.abs(e%1)===.5}const Pe={bce:-1,ce:0};function Fe(e){let t=e.normalize(`NFD`).toLowerCase().replace(/[^a-z0-9]/g,``);return t===`bc`||t===`b`?`bce`:t===`ad`||t===`a`?`ce`:t}function Ie(e){return e===void 0?`iso8601`:e===0?`gregory`:e.id}const Le=/^M(\d{2})(L?)$/;function Re(e){let t=Le.exec(e);return t||y((e=>`Invalid monthCode: ${e}`)(e)),[parseInt(t[1]),!!t[2]]}function ze(e,t){return`M`+Te(e)+(t?`L`:``)}function Be(e,t,n){return e+(t||n&&e>=n?1:0)}function Ve(e,t){return e-(t&&e>=t?1:0)}const He={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},Ue=Object.keys(He),We=864e5,Ge=1e3,Ke=1e6,qe=1e9,Je=6e10,Ye=36e11,Xe=864e11,Ze=[1,Ge,Ke,qe,Je,Ye,Xe],Qe=BigInt(Ge),$e=BigInt(Ke),et=BigInt(qe),tt=BigInt(Je),nt=BigInt(Ye),T=BigInt(Xe);function rt(e,t){let n=Number(e/T),r=Number(e%T);return Xe/t*n+(Math.trunc(r/t)+r%t/t)}const E=Ue.slice(0,6),it=me(E),at=[`year`],ot=[`day`],st=[`day`,`month`,`year`],ct=[`offset`],lt=[`timeZone`],ut=[`era`,`eraYear`],dt=[`era`,`eraYear`,`year`],ft=[`month`,`monthCode`],pt=[`day`,`month`,`monthCode`],mt=S(E),ht=S(ut,at),gt=S(ft,at),_t=S(ut,gt),vt=S([`monthCode`],at),yt=S(ut,vt),bt=S(ot,[`monthCode`]),xt=S(ot,gt),St=S(ot,ut,gt),Ct=S(xt,E),wt=S(St,E),Tt=S(xt,E,ct),Et=S(St,E,ct),Dt=S(xt,E,ct,lt),Ot=S(St,E,ct,lt),kt=S(ot,vt),At=S(ot,ut,vt),jt=pe(E,0);function Mt(e){return Pt(e,1),e}const Nt={hour:23,minute:59,second:59};function Pt(e,t){let n={};for(let r of E)n[r]=se(r,e[r],0,Nt[r]||999,t);return n}function D(e){return It(e)*qe+Lt(e)}function Ft(e){return 1e3*It(e)+e.millisecond}function It(e){return 3600*e.hour+60*e.minute+e.second}function Lt(e){return e.millisecond*Ke+e.microsecond*Ge+e.nanosecond}function Rt(e){let[t,n]=Oe(e,Xe);return[zt(n),t]}function zt(e){let[t,n]=Oe(e,Ke),[r,i]=Oe(n,Ge);return Bt(t,r,i)}function Bt(e,t=0,n=0){let[r,i]=Oe(e,36e5),[a,o]=Oe(i,6e4),[s,c]=Oe(o,1e3);return{hour:r,minute:a,second:s,millisecond:c,microsecond:t,nanosecond:n}}function Vt(e){let[t,n]=De(e,et);return[Number(t),Number(n)]}function Ht(e){return Wt(e)+BigInt(D(e))}function Ut(e){return Gt(e)+Ft(e)}function Wt(e){return BigInt(Kt(e))*T}function Gt(e){return 864e5*Kt(e)}function Kt(e){return qt(e.year,e.month,e.day)}function qt(e,t=1,n=1){let r=t-1;return e+=Math.floor(r/12),t=ke(r,12),Date.UTC(e%400-400,t,0)/864e5+146097*(Ae(e,400)+1)+n}function Jt(e){let[t,n]=De(e,T);return{...Xt(Number(t)),...zt(Number(n))}}function Yt(e,t=0,n=0){let[r,i]=Oe(e,864e5);return{...Xt(r),...Bt(i,t,n)}}function Xt(e){let t=new Date(864e5*ke(e,146097));return{year:t.getUTCFullYear()+400*Math.floor(e/146097),month:t.getUTCMonth()+1,day:t.getUTCDate()}}function Zt(e,t){return Math.trunc((t-e)/864e5)}function Qt(e){return[e,0]}function $t(e,t){if(!t)return{year:1972,month:e}}function en(e,t,n){return{year:e,month:t,day:n}}function tn(e,t){switch(t){case 2:return rn(e)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function nn(e){return rn(e)?366:365}function rn(e){return e%4==0&&(e%100!=0||e%400==0)}function an(e,t,n){return e+=Ae(n,12),(t+=je(n,12))<1?(e--,t+=12):t>12&&(e++,t-=12),{year:e,month:t}}function on(e,t,n,r){return 12*(n-e)+r-t}function sn(e){return ke(qt(e.year,e.month,e.day)+4,7)||7}function cn(e){return qt(e.year,e.month,e.day)-qt(e.year)+1}function ln(e){let t=e.year,n=Math.floor((cn(e)-sn(e)+10)/7),r=un(t);return n<1?n=r=un(--t):n>r&&(n=1,r=un(++t)),{weekOfYear:n,yearOfWeek:t,Ie:r}}function un(e){let t=sn({year:e,month:1,day:1});return t===4||t===3&&rn(e)?53:52}function dn({year:e}){return e<1?{era:`bce`,eraYear:1-e}:{era:`ce`,eraYear:e}}function fn(e){return pn(e),Mt(e)}function pn(e){return hn(e,1),e}function mn(e){return ge(st,e,hn(e))}function hn(e,t){let{year:n}=e,r=oe(e,`month`,1,12,t);return{year:n,month:r,day:oe(e,`day`,1,tn(n,r),t)}}function O(e,t){return e?e.ie(t):t}function gn(e,t,n){return e?e.O(t,n):Qt(n)}function _n(e,t){return e===0?dn(t):e?e.h(t):{}}function vn(e,t,n,r){return e?e.je(t,n,r):en(t,n,r)}function yn(e,t){return e?e.k(t):12}function bn(e,t,n){return e?e.p(t,n):tn(t,n)}function xn(e,t){let{year:n,month:r}=O(e,t),[i,a]=gn(e,n,r);return ze(i,a)}function Sn(e,t){let{year:n}=O(e,t);return e?e.u(n):rn(n)}function Cn(e,t){let{year:n}=O(e,t);return yn(e,n)}function wn(e,t){let{year:n,month:r}=O(e,t);return bn(e,n,r)}function Tn(e,t){let{year:n}=O(e,t);return e?e.j(n):nn(n)}function En(e,t){if(!e)return cn(t);let{year:n}=O(e,t),r=vn(e,n,1,1);return Kt(t)-Kt(r)+1}function Dn(e,t){return e===void 0?ln(t).weekOfYear:void 0}function On(e,t){return e===void 0?ln(t).yearOfWeek:void 0}const k=Ue.map(e=>e+`s`),kn=me(k),An=S(k),jn=k.slice(0,6),Mn=k.slice(6),Nn=Mn.slice(1),Pn=k.reduce((e,t,n)=>(e[t]=n,e),{}),A=pe(k,0),Fn=pe(jn,0),In=x(_e,k);function Ln(e,t){return t??y(m(e)),t}const j=x(Rn,`string`);function Rn(e,t,n=e){return typeof t!==e&&b(p(n,t)),t}function zn(e,t=`number`){return Number.isInteger(e)||y(((e,t)=>`Non-integer ${e}: ${t}`)(t,e)),e||0}function Bn(e){return typeof e==`symbol`&&b(`Cannot convert Symbol to string`),String(e)}function Vn(e,t){return d(e)?String(e):j(e,t)}function Hn(e){return typeof e==`boolean`?BigInt(e?1:0):typeof e==`string`?BigInt(e):(typeof e!=`bigint`&&b(`Invalid bigint: ${e}`),e)}function Un(e,t){return zn(o(e,t),t)}function Wn(e,t){return typeof e==`string`?((e,t)=>{let n=Object.create(null);return n[e]=t,n})(t,e):f(e)}const Gn=`smallestUnit`,Kn={constrain:0,reject:1},qn={compatible:0,reject:1,earlier:2,later:3},Jn={reject:0,use:1,prefer:2,ignore:3},Yn={auto:0,never:1,critical:2,always:3},Xn={auto:0,never:1,critical:2},Zn={auto:0,never:1},Qn={floor:0,halfFloor:1,ceil:2,halfCeil:3,trunc:4,halfTrunc:5,expand:6,halfExpand:7,halfEven:8},$n=[Math.floor,e=>Ne(e)?Math.floor(e):Math.round(e),Math.ceil,e=>Ne(e)?Math.ceil(e):Math.round(e),Math.trunc,e=>Ne(e)?Math.trunc(e)||0:Math.round(e),e=>e<0?Math.floor(e):Math.ceil(e),e=>Math.sign(e)*Math.round(Math.abs(e))||0,e=>Ne(e)?(e=Math.trunc(e)||0)+e%2:Math.round(e)],er={previous:-1,next:1};function tr(e){let t=e.roundingIncrement;return t===void 0?1:s(t,`roundingIncrement`)}function nr(e){let t=e.fractionalSecondDigits;if(t!==void 0){if(typeof t!=`number`){if(Bn(t)===`auto`)return;y(p(`fractionalSecondDigits`,t))}t=se(`fractionalSecondDigits`,Math.floor(t),0,9,1)}return t}function rr(e,t,n=0,r){let i=t[e];if(i===void 0)return r?n:void 0;if(i=Bn(i),i===`auto`)return r?n:null;let a=He[i];return a===void 0&&(a=Pn[i]),a===void 0&&y(g(e,i,He)),a}function ir(e,t,n,r=0){let i=n[e];if(i===void 0)return r;let a=Bn(i),o=t[a];return o===void 0&&y(g(e,a,t)),o}const ar=x(rr,Gn),or=x(rr,`largestUnit`),sr=x(rr,`unit`),cr=x(ir,`overflow`,Kn),lr=x(ir,`disambiguation`,qn),ur=x(ir,`offset`,Jn),dr=x(ir,`calendarName`,Yn),fr=x(ir,`timeZoneName`,Xn),pr=x(ir,`offset`,Zn),mr=x(ir,`roundingMode`,Qn),hr=x(ir,`direction`,er);function gr(e,t,n,r){let i=r?Xe:Ze[t+1];if(i){let n=Ze[t];i%((e=se(`roundingIncrement`,e,1,i/n-(r?0:1),1))*n)&&y(p(`roundingIncrement`,e))}else e=se(`roundingIncrement`,e,1,n?10**9:1,1);return e}function _r(e,t,n,r){return t!=null&&se(e,t,n,r,1,Ue),t}function vr(e,t){t>e&&y(`smallestUnit > largestUnit`)}function yr(e,t,n,r=9,i=0,o=4){t=a(t);let s=or(t,i),c=tr(t),l=mr(t,o),u=ar(t,i,1);return s=_r(`largestUnit`,s,i,r),u=_r(Gn,u,i,r),s==null?s=Math.max(n,u):vr(s,u),c=gr(c,u,1),e&&(l=(e=>e<4?(e+2)%4:e)(l)),[s,u,c,l]}function br(e,t=6,n){let r=tr(e=Wn(e,Gn)),i=mr(e,7),a=ar(e);return a=Ln(Gn,a),a=_r(Gn,a,0,t),r=gr(r,a,void 0,n),[a,r,i]}function M(e,t){return he(st,e,he(E,t))}function N(e){return e===void 0?0:cr(f(e))}function xr(e,t=0){e=a(e);let n=lr(e),r=ur(e,t);return[cr(e),r,n]}const Sr=BigInt(1e8)*T,Cr=BigInt(-1e8)*T,wr=Cr-T,Tr=-3261848;function Er(e){let t=12*e.year+e.month;return(t<Tr||t>3309129)&&y(`Out-of-bounds date`),e}function P(e,t=1){return Or(Wt(e),t),e}function Dr(e){let t=Wt(e);return Or(t),t!==wr||D(e)||y(`Out-of-bounds date`),e}function Or(e,t=1){(e<(t?wr:Cr)||e>Sr)&&y(`Out-of-bounds date`)}function kr(e){return(e<Cr||e>Sr)&&y(`Out-of-bounds date`),e}function Ar(e,t){return kr(Wt(e)+BigInt(D(e)-t))}function jr(e){return{epochNanoseconds:e}}function Mr(e,t,n){return{calendar:n,timeZone:t,epochNanoseconds:e}}function Nr(e,t){return he(E,e,F(e,t))}function F(e,t){return he(st,e,{calendar:t})}function Pr(e){return he(E,e)}function I(e){return he(k,e,{sign:na(e)})}function Fr(e){return t=e.epochNanoseconds,Number(Ee(t,$e));var t}function Ir(e){return e.epochNanoseconds}function Lr(e,t,n){let r=da(t),[i,a]=((e,t)=>{let n=t((e=Wn(e,`unit`)).relativeTo),r=sr(e);return r=Ln(`unit`,r),[r,n]})(n,e);if(!a&&Ji(Math.max(i,r),a))return zr(t,i);if(a||y(`Missing relativeTo`),!t.sign&&Ji(i,a))return 0;let o=Hi(a),s=o.G(o.i,t);Gi(o,s);let c=o.re(o.i,s,i);return Ji(i,a)?zr(c,i):Rr(c,o.V(s),i,o)}function Rr(e,t,n,r){let i=na(e)||1,a=Br(In(n,e),n,i,r,t),o=a.ae,s=a.de,c=Number(s-o),l=Number(t-o);return a.ye[k[n]]+l/c*i}function zr(e,t){return rt(aa(e),Ze[t])}function Br(e,t,n,r,i){let a=k[t],o=e,s=0,c=Vr(o,a,n,r);return i&&!((e,t,n,r)=>r>0?w(t,e)<=0&&w(e,n)<=0:w(n,e)<=0&&w(e,t)<=0)(i,c.ae,c.de,Math.sign(n))&&(o={...e,[a]:e[a]+n},s=1,c=Vr(o,a,n,r)),{...c,ye:o,He:s}}function Vr(e,t,n,r){let i={...e,[t]:e[t]+n};return{ae:Ui(r,e),de:Ui(r,i),Ae:i}}function Hr(e,t,n){let r=n-t,i=e-t;if(!i)return 0;let a=i<0n?-i:i,o=r<0n?-r:r,s=w(i,0n)===w(r,0n)?1:-1;return w(a,o)<=0?a===o?s:Me(w(2n*a,o),s):Number(i)/Number(r)}function Ur(e,t,n,r){let{epochNanoseconds:i}=e,{timeZone:a,calendar:o}=e;if(t===0&&n===1)return{epochNanoseconds:i,timeZone:a,calendar:o};if(t===6){let t=M(L(e),jt),n=M(yi(t,1),jt),o=di(a,t),s=di(a,n);i=ri(Hr(i,o,s),r)?s:o}else{let o=L(e),s=o.offsetNanoseconds;i=li(a,Kr(o,Yr(t,n),r),s,2,0,1)}return{epochNanoseconds:i,timeZone:a,calendar:o}}function Wr(e){let{timeZone:t}=e,n=M(L(e),jt),r=M(yi(n,1),jt),i=di(t,n);return rt(di(t,r)-i,Ye)}function Gr(e){let{timeZone:t,calendar:n}=e;return Mr(di(t,M(L(e),jt)),t,n)}function Kr(e,t,n){let[r,i]=qr(e,t,n),a=M(yi(e,i),r);return Dr(a),a}function qr(e,t,n){return Rt(ni(D(e),t,n))}function Jr(e){return ni(e,Je,7)}function Yr(e,t){return Ze[e]*t}function Xr(e,t){return BigInt(Ze[e])*BigInt(t)}function Zr(e,t,n){let r=Math.min(da(e),6);return ca($r(aa(e),BigInt(t),n),r)}function Qr(e,t,n,r,i,a,o){if(r===0&&i===1)return e;let s=na(e)||1,[c,l,u]=(Ji(r,o.i)?Wi(o.i)&&r<6&&n>=6?ai:ii:oi)(s,e,t,n,r,i,a,o);return u&&r!==7&&(c=((e,t,n,r,i,a)=>{for(let o=r+1;o<=n;o++){if(o===7&&n!==7)continue;let r=In(o,e);r[k[o]]+=i;let s=w(t,Ui(a,r));if(s&&s!==i)break;e=r}return e})(c,l,n,Math.max(6,r),s,o)),c}function $r(e,t,n){return ti(e,t,n,e/t%2n)}function ei(e,t,n){let[r,i]=De(e,T),a=r*T;return a+ti(i,t,n,(a/t+i/t)%2n)}function ti(e,t,n,r){let i=e/t,a=e%t,o=0;a&&(o=Me(w(2n*(a<0n?-a:a),t),Math.sign(Number(a))));let s=ri(Number(r)+o,n);return(i-r+BigInt(s))*t}function ni(e,t,n){return ri(e/t,n)*t}function ri(e,t){return $n[t](e)}function ii(e,t,n,r,i,a,o){let s=aa(t),c=$r(s,Xr(i,a),o),l=c-s,u=Math.sign(Number(c/T)-Number(s/T))===e,d=ca(c,Math.min(r,6));return[{...t,...d},n+l,u]}function ai(e,t,n,r,i,a,o,s){let c=Number(oa(t)),l=Yr(i,a),u=ni(c,l,o),d=Br({...t,...Fn},6,e,s,n),f=d.ae,p=d.de,m=u-Number(p-f),h=0;m&&Math.sign(m)!==e?n=f+BigInt(u):(h+=e,u=ni(m,l,o),n=p+BigInt(u));let g=la(u);return[{...t,...g,days:t.days+h},n,!!h]}function oi(e,t,n,r,i,a,o,s){let c=k[i],l=In(i,t);i===7&&(t={...t,weeks:t.weeks+Math.trunc(t.days/7)}),l[c]=Ae(t[c],a)*a;let u=Br(l,i,a*e,s,n),d=u.ae,f=u.de,p=Hr(n,d,f),m=u.ye[c],h=u.Ae[c],g=ni(m+p*e*a,a,o),_=g===h;return l[c]=g,[l,_?f:d,u.He||_]}function si(e,t){return e.timeZone.U(e.epochNanoseconds,(e=>{let t=hr(Wn(e,`direction`),0);return t||y(p(`direction`,t)),t})(t))}const L=ce(ci,WeakMap);function ci(e){let{epochNanoseconds:t,timeZone:n}=e,r=n.C(t);return{...Jt(t+BigInt(r)),offsetNanoseconds:r}}function li(e,t,n,r=0,i=0,a,o){if(n!==void 0&&r===1&&(r===1||o))return Ar(t,n);r!==2&&r!==0||P(t,0);let s=e.R(t);if(n!==void 0&&r!==3){let e=((e,t,n,r)=>{let i=Ht(t);r&&(n=Jr(n));for(let t of e){let e=Number(i-t);if(r&&(e=Jr(e)),e===n)return t}})(s,t,n,a);if(e!==void 0)return e;r===0&&y(`Invalid TimeZone offset`)}return o?Ht(t):ui(e,t,i,s)}function ui(e,t,n=0,r=e.R(t)){if(r.length===1)return r[0];if(n===1&&y(`Ambiguous offset`),r.length)return r[n===3?1:0];let i=Ht(t),a=((e,t)=>{let n=e.C(t-T);return(e=>(e>864e11&&y(`Out-of-bounds TimeZone gap`),e))(e.C(t+T)-n)})(e,i),o=Jt(i+BigInt(a*(n===2?-1:1)));return(r=e.R(o))[n===2?0:r.length-1]}function di(e,t){let n=e.R(t);if(n.length)return n[0];let r=Ht(t)-T;return e.U(r,1)}function fi(e,t,n,r,i){let a=N(i);return r.sign&&da(r)<8&&y(`Cannot use small units`),_i(t,bi(t,P(_i(t,n)),e?R(r):r,a))}function pi(e,t){return kr(e+(ua(n=t)&&y(`Cannot use large units`),oa(n)));var n}function mi(e,t,n){let{calendar:r,epochNanoseconds:i,timeZone:a}=e,o=oa(t),s=i;if(ua(t)){let i=L(e);s=ui(a,M(gi(r,i,{...t,...Fn},n),i))+o}else s+=o,N(n);return{...e,epochNanoseconds:kr(s)}}function hi(e,t,n,r){let[i,a]=vi(t,n),o=M(gi(e,t,{...n,...Fn,days:n.days+a},r),i);return Dr(o),o}function gi(e,t,n,r){if(n.years||n.months||n.weeks)return bi(e,t,n,N(r));N(r);let i=n.days+Number(oa(n)/T);return i?P(yi(t,i)):t}function _i(e,t){return yi(t,1-O(e,t).day)}function vi(e,t){let n=oa(t),r=Number(n/T),i=Number(n%T),[a,o]=Rt(D(e)+i);return[a,r+o]}function yi(e,t){return t?Xt(Kt(e)+t):e}function bi(e,t,n,r){let{years:i,months:a,weeks:o,days:s}=n,c;if(s+=Number(oa(n)/T),i||a)c=xi(e,t,i,a,r);else{if(!o&&!s)return t;c=t}return(o||s)&&(c=yi(c,7*o+s)),P(c)}function xi(e,t,n,r,i){let{year:a,month:o,day:s}=O(e,t);if(n){let[t,r]=gn(e,a,o);a+=n,o=Si(e,t,r,e?e.q(a):void 0,i),o=se(`month`,o,1,yn(e,a),i)}if(r){let t=e?e.N(a,o,r):an(a,o,r);({year:a,month:o}=t)}return s=se(`day`,s,1,bn(e,a,o),i),vn(e,a,o,s)}function Si(e,t,n,r,i){if(n){let n=e?e.m:void 0;return r!==void 0&&(n<0||r===t+1)?r:(i===1&&y(ee),n<0?-n:t)}return Be(t,0,r)}function Ci(e,t){return Ie(e)!==Ie(t)&&y(`Mismatching Calendars`),e}function wi(e,t){return e.o!==t.o&&y(`Mismatching TimeZones`),e}function Ti(e){return e.timeZone.id}function Ei(e,t,n,r){let[i,a,o,s]=yr(e,r,3,5),c=zi(t.epochNanoseconds,n.epochNanoseconds,i,a,o,s);return I(e?R(c):c)}function Di(e,t,n,r,i){let[a,o,s,c]=yr(e,i,5),l=n.epochNanoseconds,u=r.epochNanoseconds,d;return w(u,l)?a<6?d=zi(l,u,a,o,s,c):(d=Ni(wi(n.timeZone,r.timeZone),t,n,r,a),d=Qr(d,u,a,o,s,c,Vi(n,Ir,mi))):d=A,I(e?R(d):d)}function Oi(e,t,n,r,i){let[a,o,s,c]=yr(e,i,6),l=Ht(n),u=Ht(r),d=w(u,l),f;return d?a<=6?f=zi(l,u,a,o,s,c):(f=Fi(t,n,r,d,a),f=Qr(f,u,a,o,s,c,Vi(n,Ht,x(hi,t)))):f=A,I(e?R(f):f)}function ki(e,t,n,r,i){let[a,o,s,c]=yr(e,i,6,9,6);return ji(e,t,n,r,a,o,s,c)}function Ai(e,t,n,r,i){let[a,o,s,c]=yr(e,i,9,9,8),l=_i(t,n),u=_i(t,r);return Li(l,u)?ji(e,t,P(l),P(u),a,o,s,c,8):I(A)}function ji(e,t,n,r,i,a,o,s,c=6){let l=Wt(n),u=Wt(r),d;return w(u,l)?i===6?d=zi(l,u,i,a,o,s):(d=Ii(t,n,r,i),a===c&&o===1||(d=Qr(d,u,i,a,o,s,Vi(n,Wt,x(gi,t))))):d=A,I(e?R(d):d)}function Mi(e,t,n,r){let[i,a,o,s]=yr(e,r,5,5),c=ni(D(n)-D(t),Yr(a,o),s),l={...A,...la(c,i)};return I(e?R(l):l)}function Ni(e,t,n,r,i){let a=w(r.epochNanoseconds,n.epochNanoseconds);if(!a)return A;if(i<6)return{...A,...ca(r.epochNanoseconds-n.epochNanoseconds,i)};if(!Li(L(n),L(r)))return{...A,...ca(r.epochNanoseconds-n.epochNanoseconds,5)};let[o,s,c]=Ri(e,n,r,a);return{...i===6?{...A,days:Bi(o,s)}:Ii(t,o,s,i),...la(c)}}function Pi(e,t,n,r){let i=Ht(t),a=Ht(n),o=w(a,i);return o?r<=6?{...A,...ca(a-i,r)}:Fi(e,t,n,o,r):A}function Fi(e,t,n,r,i){let a=n,o=D(n)-D(t);return Math.sign(o)===-r&&(a=yi(n,-r),o+=864e11*r),{...Ii(e,t,a,i),...la(o)}}function Ii(e,t,n,r){if(r<=7){let e=Bi(t,n);return r===7?{...A,weeks:Ae(e,7),days:je(e,7)}:{...A,days:e}}let i=O(e,t),a=O(e,n);if(r===8){let{year:r,month:o,day:s}=i,{year:c,month:l,day:u}=a,d=Math.sign(C(c,r)||C(l,o)||Bi(t,n)),f=0,p=0;if(d){f=e?e.ne(r,o,c,l):on(r,o,c,l);let i=xi(e,t,0,f,0);d*C(s,u)>0&&(f-=d,i=xi(e,t,0,f,0)),p=Bi(i,n)}return{...A,months:f,days:p}}let{year:o,month:s,day:c}=i,{year:l,month:u,day:d}=a,f=l-o,p=u-s,m=d-c;if(f||p){let t=Math.sign(f||p),n=bn(e,l,u),r=0;if(Math.sign(d-c)===-t){let i=n,a=e?e.N(l,u,-t):an(l,u,-t);({year:l,month:u}=a),f=l-o,p=u-s,n=bn(e,l,u),r=t<0?-i:n}if(m=d-Math.min(c,n)+r,f){let[n,r]=gn(e,o,s),[i,a]=gn(e,l,u),c=e?e.m:void 0;if(p=c!==void 0&&r&&!a&&(c<0?t>0&&i===-c:t<0&&i===n)?0:i-n||Number(a)-Number(r),Math.sign(p)===-t){let i=t<0&&-yn(e,l);l-=t,f=l-o,p=u-Si(e,n,r,e?e.q(l):void 0,0)+(i||yn(e,l))}else if(e){let t=Si(e,n,r,e.q(l),0);p=e.ne(l,t,l,u)}}}return{...A,years:f,months:p,days:m}}function Li(e,t){return C(e.year,t.year)||C(e.month,t.month)||C(e.day,t.day)}function Ri(e,t,n,r){let i=L(t),a=L(n),o=n.epochNanoseconds,s=0,c=D(a)-D(i);Math.sign(c)===-r&&s++;let l=s+(r>0?1:0);for(;s<=l;s++){let t=yi(a,s*-r),n=ui(e,M(t,i));if(w(o,n)!==-r)return[i,t,Number(o-n)]}}function zi(e,t,n,r,i,a){return{...A,...ca($r(t-e,Xr(r,i),a),n)}}function Bi(e,t){return Kt(t)-Kt(e)}function Vi(e,t,n){return{i:e,V:t,G:n}}function Hi(e){let{calendar:t}=e;if(Wi(e)){let{timeZone:n}=e;return{i:e,V:Ir,G:mi,re:x(Ni,n,t)}}return{i:Ki(e),V:Ht,G:x(hi,t),re:x(Pi,t)}}function Ui(e,t){return e.V(e.G(e.i,t))}function Wi(e){return`timeZone`in e}function Gi(e,t){Wi(e.i)||(qi(e.i),qi(t))}function Ki(e){return M(e,`hour`in e?e:jt)}function qi(e){Dr(Ki(e))}function Ji(e,t){return e<=6-(t&&Wi(t)?1:0)}function Yi(e,t,n){let r={};for(let i=t;i>=0;i--){let t=Ze[i];r[n[i]]=Ae(e,t),e=je(e,t)}return r}const Xi=2**53;function Zi(e,t,n,r,i){let o=e(a(i).relativeTo),s=Math.max(da(n),da(r));if(Ji(s,o))return Qi(t,n,r,s);o||y(`Missing relativeTo`),t&&(r=R(r));let c=Hi(o),l=c.G(c.i,n),u=c.G(l,r);return I(c.re(c.i,u,s))}function Qi(e,t,n,r){return I(ra(((e,t,n,r)=>{let i=aa(e)+aa(t)*BigInt(r?-1:1);return Number.isFinite(Number(i/T))||y(`Out-of-bounds date`),{...A,...ca(i,n)}})(t,n,r,e)))}function $i(e,t,n){let r=da(t),[i,a,o,s,c]=((e,t,n)=>{e=Wn(e,Gn);let r=or(e),i=n(e.relativeTo),a=tr(e),o=mr(e,7),s=ar(e);return r===void 0&&s===void 0&&y(`Required smallestUnit or largestUnit`),s??=0,r??=Math.max(s,t),vr(r,s),a=gr(a,s,1),a>1&&s>5&&r!==s&&y(`For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit`),[r,s,a,o,i]})(n,r,e);if(!c&&Math.max(r,i)<=6)return I(ra(((e,t,n,r,i)=>{let a=$r(aa(e),Xr(n,r),i);return{...A,...ca(a,t)}})(t,i,a,o,s)));let l=c&&Wi(c)&&i>=6&&a<6;if(!t.sign&&!l)return t;c||y(`Missing relativeTo`);let u=Hi(c),d=u.G(u.i,t);Gi(u,d);let f=u.re(u.i,d,i);return f=Qr(f,u.V(d),i,a,o,s,u),I(f)}function ea(e){return e.sign===-1?ta(e):e}function ta(e){return I(R(e))}function R(e){let t={};for(let n of k)t[n]=-1*e[n]||0;return t}function na(e,t=k){let n=0;for(let r of t){let t=Math.sign(e[r]);t&&(n&&n!==t&&y(`Cannot mix duration signs`),n=t)}return n}function ra(e){for(let t of Nn)se(t,e[t],-4294967295,4294967295,1);let t=aa(e);return ia(Number(t/et)),e}function ia(e){Number.isSafeInteger(e)||y(`Out-of-bounds duration`)}function aa(e){return BigInt(e.days)*T+oa(e)}function oa(e){return BigInt(e.hours)*nt+BigInt(e.minutes)*tt+sa(e)}function sa(e){return BigInt(e.seconds)*et+BigInt(e.milliseconds)*$e+BigInt(e.microseconds)*Qe+BigInt(e.nanoseconds)}function ca(e,t=6){let n=Number(e/T),r=Number(e%T),i=Ze[t],a=t<=3?Number(e/BigInt(i)):Xe/i*n+Ae(r,i);Number.isFinite(a)||y(`Out-of-bounds date`),t<=3&&Math.abs(a)/(qe/Ze[t])>=Xi&&y(`Out-of-bounds date`);let o=Yi(r,t,k);return o[k[t]]=a,o}function la(e,t=5){return Yi(e,t,k)}function ua(e){return!!na(e,Mn)}function da(e){let t=9;for(;t>0&&!e[k[t]];t--);return t}function fa(e,t){return w(e.epochNanoseconds,t.epochNanoseconds)}function pa(e,t){return w(e.epochNanoseconds,t.epochNanoseconds)}function ma(e,t,n,r){let i=e(a(r).relativeTo),o=Math.max(da(t),da(n));if(ge(k,t,n))return 0;if(Ji(o,i))return w(aa(t),aa(n));i||y(`Missing relativeTo`);let s=Hi(i);return w(Ui(s,t),Ui(s,n))}function ha(e,t){return ga(e,t)||_a(e,t)}function ga(e,t){return C(Kt(e),Kt(t))}function _a(e,t){return C(D(e),D(t))}function va(e,t){return!fa(e,t)}function ya(e,t){return!pa(e,t)&&e.timeZone.o===t.timeZone.o&&e.calendar===t.calendar}function ba(e,t){return!ha(e,t)&&e.calendar===t.calendar}function xa(e,t){return!ga(e,t)&&e.calendar===t.calendar}function Sa(e,t){return!ga(e,t)&&e.calendar===t.calendar}function Ca(e,t){return!ga(e,t)&&e.calendar===t.calendar}function wa(e,t){return!_a(e,t)}function Ta(e){return e===0?Pe:e?e.l:void 0}function z(e,t,n=t){return Ta(e)?n:t}function Ea(e,t){let n=e||void 0,r=Ta(e),{era:i,eraYear:a,year:o}=t;if(o!==void 0&&(o=s(o,`year`)),a!==void 0&&(a=s(a,`eraYear`)),i!==void 0||a!==void 0){i!==void 0&&a!==void 0||b(`Mismatching era/eraYear`),r||y(`Forbidden era/eraYear`);let e=Fe(i),t=r[e];t===void 0&&y((e=>`Invalid era: ${e}`)(i));let s=n?.te?n.te(a,e,t):ka(a,t);o!==void 0&&o!==s&&y(`Mismatching year/eraYear`),o=s}else o===void 0&&b(_(r));return o}function Da(e,t,n,r,i){let{month:a,monthCode:o}=t;if(o!==void 0){let t=((e,t,n,r,i=Re(t))=>{let a=e?e.q(n):void 0,[o,s]=i,c=Be(o,s,a);if(s){let t=e?e.m:void 0;t===void 0&&y(ee),t>0?(c>t&&y(ee),a!==c&&(r===1&&y(ee),c=Be(o,0,a))):(c!==-t&&y(ee),a===void 0&&r===1&&y(ee))}return c})(e,o,n,r,i);a!==void 0&&a!==t&&y(`Mismatching month/monthCode`),a=t,r=1}else a===void 0&&b(`Missing month/monthCode`);return se(`month`,a,1,yn(e,n),r)}function Oa(e,t,n,r,i){return oe(t,`day`,1,bn(e,r,n),i)}function ka(e,t){return(t+e)*(Math.sign(t)||1)||0}function Aa(e,t){return Pt(he(E,{...jt,...e}),t)}const ja=be(`([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?`);function Ma(e){let t=Na(e);return t===void 0&&y(re(e)),t}function Na(e,t){let n=ja.exec(e);if(n&&(e=>(e=>{e[0]!==`T`&&e[0]!==`t`||(e=e.slice(1));let t=e.search(/[.,]/),n=t<0?e:e.slice(0,t),r=n.split(`:`);return r.length===1?/^(?:\d{2}|\d{4}|\d{6})$/i.test(n):(r.length===2||r.length===3)&&r.every(e=>e.length===2&&/^\d{2}$/i.test(e))})(e.slice(1)))(n[0]))return((e,t)=>{let n=e[4]||e[5];return t&&n&&y(ie(n)),r=(Ce(e[2])*Ye+Ce(e[3])*Je+Ce(e[4])*qe+xe(e[5]||``))*Se(e[1]),Math.abs(r)>=864e11&&y(`Out-of-bounds offset`),r;var r})(n,t)}const Pa={era:Vn,month:c,monthCode(e,t=`monthCode`){return((e,t)=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`){let n=e.toString;if(typeof n==`function`)return j(n.call(e),t)}return j(e,t)})(e,t)},day:c},Fa=pe(E,s),Ia=pe(k,Un),La={offset(e){return Ma(Vn(e))}},Ra=Object.assign({},Pa,Fa),za=Object.assign({},Ra,La);function B(e,t,n,r,i=!r){let a={},o=0;for(let i of t){let t=e[i];if(t!==void 0){o=1;let e=n[i];e&&(t=e(t,i)),a[i]=t}else r&&r.includes(i)&&b(m(i))}return i&&!o&&b(h(t)),a}function Ba(e,t=jt,n){let r=M(e,t);return Dr(r),Nr(r,n)}function Va(e,t,n){return Ua(e,t,Ga(e,t),N(n))}function Ha(e,t,n){let r=Ga(e,t),i=n();return[Ua(e,t,r,i[0]),...i]}function Ua(e,t,n,r){let i=n[1],a=Da(e,t,i,r,n[0]);return F(P(vn(e,i,a,Oa(e,t,a,i,r))),e)}function Wa(e){if(e.monthCode!==void 0)return Re(e.monthCode)}function Ga(e,t){let n=Ta(e);return t.year!==void 0||t.era!==void 0&&t.eraYear!==void 0||b(_(n)),t.monthCode===void 0&&t.month===void 0&&b(`Missing month/monthCode`),t.day===void 0&&b(m(`day`)),[Wa(t),Ea(e,t)]}function Ka(e,t,n){let r=Ta(e);t.year!==void 0||t.era!==void 0&&t.eraYear!==void 0||b(_(r)),t.monthCode===void 0&&t.month===void 0&&b(`Missing month/monthCode`);let i=Wa(t),a=Ea(e,t);return F(Er(vn(e,a,Da(e,t,a,N(n),i),1)),e)}function qa(e,t,n){let r=e===void 0,i=Ta(e);t.day===void 0&&b(m(`day`)),r||t.month===void 0||t.year!==void 0||t.era!==void 0&&t.eraYear!==void 0||b(_(i));let a=Wa(t),o=t.eraYear!==void 0||t.year!==void 0?Ea(e,t):void 0,s=N(n),c,l,u;if(o===void 0&&r&&(o=1972),o!==void 0){r||P(vn(e,o,1,1));let n=Da(e,t,o,s,a);c=Oa(e,t,n,o,s),[l,u]=gn(e,o,n)}else{t.monthCode===void 0&&b(`Missing month/monthCode`),[l,u]=a;let n=e?e.ge:1972;if(n!==void 0)c=Oa(e,t,Da(e,t,n,s,a),n,s);else{let n=s===0&&e?e.ke?.(l,u,t.day):void 0;c=n===void 0?t.day:n}}u&&((e&&e.Z?.[l])??1/0)<t.day&&(s===1&&y(ee),u=0,c=ae(t.day,1,(e&&e.X)??1/0));let d=e?e.v(l,!!u,c):$t(l,!!u);for(;!d&&s===0&&c>1;)c--,d=e?e.v(l,!!u,c):$t(l,!!u);d||y(`Cannot guess year`);let{year:f,month:p}=d;return F(P(vn(e,f,p,c)),e)}const Ja=Intl.DateTimeFormat;function Ya(e,t){t<-864e13&&y(`Out-of-bounds date`);let n=e.formatToParts(t),r={};for(let e of n)r[e.type]=e.value;return r}const Xa={El_Aaiun:17,Tucuman:12,Tirane:11,Riga:10,Simferopol:9,Vienna:9,Tunis:8,Boa_Vista:6,Fortaleza:6,Maceio:6,Noronha:6,Recife:6,Gaza:6,Hebron:6,DeNoronha:6},Za=-388152e4;function Qa(e,t=4){let n=nr(e);return[mr(e,4),...to(_r(Gn,ar(e),0,t),n)]}function $a(e){return dr(a(e))}function eo(e,t){return Qa(a(e),t)}function to(e,t){return e==null?[t===void 0?1:10**(9-t),t]:[Ze[e],e<4?9-3*e:-1]}function no(e,t,n){let[r,i,o,s]=(e=>{let t=nr(e=a(e)),n=mr(e,4),r=ar(e);return[e.timeZone,n,...to(_r(Gn,r,0,4),t)]})(n),c=r!==void 0;return((e,t,n,r,i,a)=>{n=ei(n,BigInt(i),r);let o=t.C(n);return ho(Jt(n+BigInt(o)),a)+(e?bo(Jr(o)):`Z`)})(c,V(c?e(r):`UTC`),t.epochNanoseconds,i,o,s)}function ro(e,t){let n=(e=>{e=a(e);let t=dr(e),n=nr(e),r=pr(e),i=mr(e,4),o=ar(e);return[t,fr(e),r,i,...to(_r(Gn,o,0,4),n)]})(t);return((e,t,n,r,i,a,o,s,c,l)=>{r=ei(r,BigInt(c),s);let u=n.C(r);return ho(Jt(r+BigInt(u)),l)+bo(Jr(u),o)+xo(t,a)+So(e,i)})(e.calendar,e.timeZone.id,e.timeZone,e.epochNanoseconds,...n)}function io(e,t){let n=(e=>(e=a(e),[dr(e),...Qa(e)]))(t);return((e,t,n,r,i,a)=>ho(Kr(t,i,r),a)+So(e,n))(e.calendar,e,...n)}function ao(e,t){return n=e.calendar,r=e,i=$a(t),go(r)+So(n,i);var n,r,i}function oo(e,t){return co(e.calendar,_o,e,$a(t))}function so(e,t){return co(e.calendar,vo,e,$a(t))}function co(e,t,n,r){return r===1?e===void 0?t(n):go(n):r>1||r===0&&e!==void 0?go(n)+Co(Ie(e),r===2):t(n)}function lo(e,t){return((e,t,n,r)=>yo(qr(e,n,t)[0],r))(e,...eo(t))}function uo(e,t){let[n,r,i]=eo(t,3);return r>1&&ra(e={...e,...Zr(e,r,n)}),fo(e,i)}function fo(e,t){let{sign:n}=e,r=n===-1?R(e):e,{hours:i,minutes:a}=r,o=sa(r),s=Number(o/et),c=Number(o%et);ia(s);let l=To(c,t),u=t>=0||!n||l;return(n<0?`-`:``)+`P`+po({Y:mo(r.years),M:mo(r.months),W:mo(r.weeks),D:mo(r.days)})+(i||a||s||u?`T`+po({H:mo(i),M:mo(a),S:mo(s,u)+l}):``)}function po(e){let t=[];for(let n in e){let r=e[n];r&&t.push(r,n)}return t.join(``)}function mo(e,t){if(!e&&!t)return``;let n=Object.create(null);return n.useGrouping=0,e.toLocaleString(`fullwide`,n)}function ho(e,t){return go(e)+`T`+yo(e,t)}function go(e){return _o(e)+`-`+Te(e.day)}function _o(e){let{year:t}=e;return(t<0||t>9999?Eo(t)+we(6,Math.abs(t)):we(4,t))+`-`+Te(e.month)}function vo(e){return Te(e.month)+`-`+Te(e.day)}function yo(e,t){let n=[Te(e.hour),Te(e.minute)];return t!==-1&&n.push(Te(e.second)+((e,t,n,r)=>To(e*Ke+t*Ge+n,r))(e.millisecond,e.microsecond,e.nanosecond,t)),n.join(`:`)}function bo(e,t=0){if(t===1)return``;let[n,r]=Oe(Math.abs(e),Ye),[i,a]=Oe(r,Je),[o,s]=Oe(a,qe);return Eo(e)+Te(n)+`:`+Te(i)+(o||s?`:`+Te(o)+To(s):``)}function xo(e,t){return t===1?``:`[`+(t===2?`!`:``)+e+`]`}function So(e,t){return t>1||t===0&&e!==void 0?Co(Ie(e),t===2):``}function Co(e,t){return`[`+(t?`!`:``)+`u-ca=`+e+`]`}const wo=/0+$/;function To(e,t){let n=we(9,e);return n=t===void 0?n.replace(wo,``):n.slice(0,t),n?`.`+n:``}function Eo(e){return e<0?`-`:`+`}const Do=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,Oo=/[^\w\/:+-]+/;function ko(e){return Ao(j(e))}function Ao(e){return jo(e).id}function jo(e){let t=e.toUpperCase(),n=(e=>{let t=Na(e,1);if(t!==void 0)return{id:bo(t),_:t,o:t}})(t);return n?{kind:`fixed`,...n}:Mo(t===`UTC`?`UTC`:(e=>(Oo.test(e)&&y(ne(e)),Do.test(e)&&y(`Forbidden ICU TimeZone`),e.toLowerCase().split(`/`).map((e,t)=>(e.length<=3||/\d/.test(e))&&!/etc|yap/.test(e)?e.toUpperCase():e.replace(/baja|dumont|[a-z]+/g,(e,n)=>e.length<=2&&!t||e===`in`||e===`chat`?e.toUpperCase():e.length>2||!n?ye(e).replace(/island|noronha|murdo|rivadavia|urville/,ye):e)).join(`/`)))(e))}const Mo=ce(e=>{if(e===`UTC`)return{kind:`utc`,id:e,o:e};let t=No(e.toUpperCase());return{kind:`named`,id:e,format:t,o:t.resolvedOptions().timeZone}}),No=ce(e=>new Ja(`en-u-hc-h23`,{calendar:`iso8601`,timeZone:e,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}));function V(e){let t=jo(e);return Po(t.id,t)}const Po=ce((e,t)=>t.kind===`named`?new Io(e,t.o,t.format):new Fo(e,t.o,t.kind===`fixed`?t._:0));var Fo=class{constructor(e,t,n){this.id=e,this.o=t,this._=n}C(){return this._}R(e){return[Ar(e,this._)]}U(){}},Io=class{constructor(e,t,n){this.id=e,this.o=t,this.qe=((e,t)=>{let n=ce(e),r=ce(Ro),i=86400*t;function a(e){let[t,a]=zo(e,i),s=Bo(t),c=Bo(a),l=n(s),u=n(c);return l===u?l:o(r(s,c),l,u,e)}function o(t,n,r,i){let a,o;for(;(i===void 0||(a=i<t[0]?n:i>=t[1]?r:void 0)===void 0)&&(o=t[1]-t[0]);){let n=t[0]+Math.floor(o/2);e(n)===r?t[1]=n:t[0]=n+1}return a}return{Ee(e){let t=a(e-86400),n=a(e+86400),r=e-t,i=e-n;if(t===n)return[r];let o=a(r);return o===a(i)?[e-o]:t>n?[r,i]:[]},De:a,U:function e(t,a){if(a>0&&t>=864e10)return;if(a<0){if(t<=Za)return;let n=Lo()+94867200;if(t>n)return e(n,-1)}let[s,c]=zo(a>0?Math.max(t,Za):t,i),l=i*a,u=a>0?Math.max(t,Lo())+94867200:Za,d=()=>a<0?c>u:s<u;for(;d();){let e=Bo(s),i=Bo(c),u=n(e),d=n(i);if(u!==d){let n=r(e,i);o(n,u,d);let s=n[0];if((C(s,t)||1)===a)return s}s+=l,c+=l}}}})((e=>t=>{let n=Ya(e,1e3*t);return 86400*qt((e=>{let t=e.relatedYear;if(t!==void 0)return parseInt(t);let n=parseInt(e.year);return e.era!==void 0&&Fe(e.era)===`bce`?1-n:n})(n),parseInt(n.month),parseInt(n.day))+3600*parseInt(n.hour)+60*parseInt(n.minute)+parseInt(n.second)-t})(n),(e=>Xa[e.split(`/`).pop()]||60)(e))}C(e){return this.qe.De((e=>Vt(e)[0])(e))*qe}R(e){let t=86400*Kt(e)+It(e),n=Lt(e);return this.qe.Ee(t).map(e=>kr(BigInt(e)*et+BigInt(n)))}U(e,t){let[n,r]=Vt(e),i=this.qe.U(n+(t>0||r?1:0),t);if(i!==void 0)return BigInt(i)*et}};function Lo(){return Math.floor(Date.now()/1e3)}function Ro(e,t){return[e,t]}function zo(e,t){let n=Math.floor(e/t)*t;return[n,n+t]}function Bo(e){return ae(e,-1e10,864e10)}function Vo(e,t,n){let r=B(n,z(t,Dt,Ot),za,[],0);if(r.timeZone!==void 0){let n=Va(t,r),i=Aa(r),a=V(e(r.timeZone));return{epochNanoseconds:li(a,M(n,i),r.offset),timeZone:a,calendar:t}}return Va(t,r)}function Ho(e,t,n,r){let i=B(n,z(t,Dt,Ot),za,lt,0),a=e(i.timeZone),[o,s,c,l]=Ha(t,i,()=>xr(r)),u=Aa(i,s),d=V(a);return Mr(li(d,M(o,u),i.offset,c,l),d,t)}function Uo(e,t,n){let r=B(t,z(e,Ct,wt),Ra,[],0),[i,a]=Ha(e,r,()=>[N(n)]);return Ba(i,Aa(r,a),e)}function Wo(e,t,n,r=[]){return Va(e,B(t,z(e,xt,St),Pa,r),n)}function Go(e,t,n,r){return Ka(e,B(t,z(e,gt,_t),Pa,r),n)}function Ko(e,t,n,r){let i=B(n,z(e,xt,St),Pa,ot,0);return t&&i.month!==void 0&&i.monthCode===void 0&&i.year===void 0&&(i.year=1972),qa(e,i,r)}function qo(e,t){return Aa(B(e,mt,Fa,[],1),N(t))}function Jo(e){let t=B(e,An,Ia);return I(ra({...A,...t}))}function Yo(e){y(re(e))}function Xo(e){let t=ws(e=Vn(e)),n;return t||Yo(e),t.F?n=0:t.offset?n=Ma(t.offset):Yo(e),t.timeZoneId&&Na(t.timeZoneId,1),fn(t),jr(Ar(t,n))}function Zo(e,t){let n=ws(j(e));return n||Yo(e),n.timeZoneId?fs(n,t,void 0):(n.F&&Yo(e),ms(n,t))}function Qo(e,t,n){let r=ws(j(e));return r&&r.timeZoneId||Yo(e),fs(r,t,n)}function $o(e,t){let n=ws(j(e));return n&&!n.F||Yo(e),ps(n,t)}function es(e,t){let n=ls(cs(j(e)),void 0,t);return F(n,n.calendar)}function ts(e,t){let n=Ts(j(e));if(n)return ns(n),F(Er(pn(n)),t(n.calendarId));let r=ls(cs(e),us,t),{calendar:i}=r;return F(_i(i,r),i)}function ns(e){e.calendarId!==`iso8601`&&y(ie(e.calendarId))}function rs(e,t){let n=Es(j(e));if(n)return ns(n),F(pn(n),t(n.calendarId));let r=ls(cs(e),ds,t),{calendar:i}=r,{year:a,month:o,day:s}=O(i,r),[c,l]=gn(i,a,o),{year:u,month:d}=((e,t,n,r)=>{let i=e?e.v(t,n,r):$t(t,n);return i||y(`Cannot guess year`),i})(i,c,l,s);return F(P(vn(i,u,d,s)),i)}function is(e){let t=(e=>{let t=Ds(e);return t?(As(t[13]),Os(t,1)):void 0})(e=j(e)),n;return t||(t=ws(e),t?(t.fe||Yo(e),t.F&&y(ie(`Z`)),ns(t)):Yo(e)),(n=Ts(e))&&mn(n)&&Yo(e),(n=Es(e))&&mn(n)&&Yo(e),Pr(Mt(t))}function as(e){let t=(e=>{let t=Cs.exec(e);return t?(e=>{let t=0,n=0,r=0,i={years:a(e[2]),months:a(e[3]),weeks:a(e[4]),days:a(e[5]),hours:a(e[6],e[7],5),minutes:a(e[8],e[9],4),seconds:a(e[10],e[11],3),...Yi(r,2,k)};return t||y(h(k)),Se(e[1])<0&&(i=R(i)),i;function a(e,i,a){let o=0,s=0;return a&&([o,r]=Oe(r,Ze[a])),e!==void 0&&(n&&y(ie(e)),s=(e=>{let t=parseInt(e);return Number.isFinite(t)||y(ie(e)),t})(e),t=1,i&&(r=xe(i)*(Ze[a]/qe),n=1)),o+s}})(t):void 0})(j(e));return t||Yo(e),I(ra(t))}function os(e){let t=ws(e)||Ts(e)||Es(e);if(t)return t.calendarId;let n=Ds(e);return n?As(n[13]).calendarId:e}function ss(e){let t=ws(e);return t&&(t.timeZoneId||t.F&&`UTC`||t.offset)||e}function cs(e){let t=ws(e);return t&&!t.F||Yo(e),t}function ls(e,t,n){return t&&e.calendarId===`iso8601`?(pn(e),e.fe&&Mt(e),ms(t(e),n)):e.fe?ps(e,n):ms(e,n)}function us(e){let t=12*e.year+e.month===Tr?20:1;return{...e,day:t}}function ds(e){return{...e,year:1972}}function fs(e,t,n){let r=V(Ao(e.timeZoneId)),i;if(fn(e),e.fe){let t=e.offset?Ma(e.offset):void 0,[,o,s]=xr(n);i=li(r,e,t,o,s,!(r._||e.offset===void 0||(a=e.offset,a.replace(/\D/g,``).length>4)),e.F)}else xr(n),i=di(r,e);var a;return kr(i),Mr(i,r,t(e.calendarId))}function ps(e,t){return fn(e),Dr(e),{...M(e,e),calendar:t(e.calendarId)}}function ms(e,t){return pn(e),P(e),{calendar:t(e.calendarId),year:e.year,month:e.month,day:e.day}}function hs(e){return`(\\d{2})(?:(:?)(\\d{2})(?:\\${e}(\\d{2})(?:[.,](\\d{1,9}))?)?)?`}function gs(e){return`([+-])`+hs(e)}const _s=`(?:(?:([+-])(\\d{6}))|(\\d{4}))(-?)(\\d{2})\\4(\\d{2})(?:[T ]`+hs(8)+`(Z|`+gs(15)+`)?)?`,vs=be(`(?:(?:([+-])(\\d{6}))|(\\d{4}))-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})`),ys=be(`(?:--)?(\\d{2})-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})`),bs=be(_s+`((?:\\[(!?)([^\\]]*)\\]){0,9})`),xs=be(`T?`+hs(2)+`(${gs(9)})?((?:\\[(!?)([^\\]]*)\\]){0,9})`),Ss=RegExp(`\\[(!?)([^\\]]*)\\]`,`g`),Cs=be(`([+-])?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)(?:[.,](\\d{1,9}))?H)?(?:(\\d+)(?:[.,](\\d{1,9}))?M)?(?:(\\d+)(?:[.,](\\d{1,9}))?S)?)?`);function ws(e){let t=bs.exec(e);return t?(e=>{let t=e[12],n=(t||``).toUpperCase()===`Z`;return{year:ks(e),month:parseInt(e[5]),day:parseInt(e[6]),...Os(e,7),...As(e[19]),fe:!!e[7],F:n,offset:n?void 0:t}})(t):void 0}function Ts(e){let t=vs.exec(e);if(t)return(e=>({year:ks(e),month:parseInt(e[4]),day:1,...As(e[5])}))(t)}function Es(e){let t=ys.exec(e);return t?(e=>({year:1972,month:parseInt(e[1]),day:parseInt(e[2]),...As(e[3])}))(t):void 0}function Ds(e){let t=xs.exec(e);if(t)return t[6]&&Ma(t[6]),t}function Os(e,t){let n=Ce(e[t+3]);return{...Rt(xe(e[t+4]||``))[0],hour:Ce(e[t]),minute:Ce(e[t+2]),second:n===60?59:n}}function ks(e){let t=Se(e[1]),n=parseInt(e[2]||e[3]);return t<0&&!n&&y(ie(-0)),t*n}function As(e){let t,n,r=[];return e.replace(Ss,(e,i,a)=>{let o=!!i,[s,c]=a.split(`=`).reverse();return c?c===`u-ca`?(r.push(s.toLowerCase()),t||=o):(o||/[A-Z]/.test(c))&&y(ie(e)):(n&&y(ie(e)),n=s),``}),r.length>1&&t&&y(ie(e)),{timeZoneId:n,calendarId:r[0]||`iso8601`}}function js(e,t,n){let r=Object.assign(Object.create(null),t);return Ms(r,n,ft),Ta(e)&&(Ms(r,n,dt),e&&e.le&&Ms(r,n,pt,ut)),r}function Ms(e,t,n,r){let i=0,a=[];for(let e of n)t[e]===void 0?a.push(e):i=1;if(Object.assign(e,t),i)for(let t of r||a)delete e[t]}function Ns(e,t,n){let{calendar:r,timeZone:i}=e,a=z(r,Tt,Et),o=L(e),{year:s,month:c,day:l}=O(r,o),u={year:s,monthCode:Bs(r,s,c),day:l,hour:o.hour,minute:o.minute,second:o.second,millisecond:o.millisecond,microsecond:o.microsecond,nanosecond:o.nanosecond,offset:o.offsetNanoseconds},d=B(t,a,za),f=js(r,u,d),p={...u,...d},[m,h,g,_]=Ha(r,f,()=>xr(n,2));return Mr(li(i,M(m,Pt(p,h)),p.offset,g,_),i,r)}function Ps(e,t,n){let{calendar:r}=e,i=z(r,Ct,wt),{year:a,month:o,day:s}=O(r,e),c={year:a,monthCode:Bs(r,a,o),day:s,hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond,microsecond:e.microsecond,nanosecond:e.nanosecond},l=B(t,i,Ra),u=js(r,c,l),d={...c,...l},[f,p]=Ha(r,u,()=>[N(n)]);return Ba(f,Pt(d,p),r)}function Fs(e,t,n){let{calendar:r}=e,i=z(r,xt,St),{year:a,month:o,day:s}=O(r,e);return Va(r,js(r,{year:a,monthCode:Bs(r,a,o),day:s},B(t,i,Pa)),n)}function Is(e,t,n){let{calendar:r}=e,i=z(r,gt,_t),{year:a,month:o}=O(r,e);return Ka(r,js(r,{year:a,monthCode:Bs(r,a,o)},B(t,i,Pa)),n)}function Ls(e,t,n){let{calendar:r}=e,i=z(r,xt,St),{year:a,month:o,day:s}=O(r,e);return qa(r,js(r,{monthCode:Bs(r,a,o),day:s},B(t,i,Pa)),n)}function Rs(e,t,n){return((e,t,n)=>Aa({...he(mt,e),...B(t,mt,Fa)},N(n)))(e,t,n)}function zs(e,t){return I((n=e,r=t,ra({...n,...B(r,An,Ia)})));var n,r}function Bs(e,t,n){let[r,i]=gn(e,t,n);return ze(r,i)}function Vs(e,t,n){return Mr(e.epochNanoseconds,t,n)}function Hs(e){return jr(e.epochNanoseconds)}function Us(e){return Nr(L(e),e.calendar)}function Ws(e){return F(L(e),e.calendar)}function Gs(e){return Pr(L(e))}function Ks(e,t,n){return Mr(kr(((e,t,n)=>ui(e,t,(e=>lr(a(e)))(n)))(t,e,n)),t,e.calendar)}function qs(e,t,n,r){let i=e(r.timeZone),a=r.plainTime,o=a===void 0?void 0:t(a),s=V(i),c;return c=o?ui(s,M(n,o)):di(s,M(n,jt)),Mr(c,s,n.calendar)}function Js(e,t,n){return Qs(e,he(z(e,vt,yt),t),B(f(n),ot,Pa,[]))}function Ys(e,t,n){let r=z(e,at,ht);return Qs(e,he(bt,t),B(f(n),r,Pa,[]))}function Xs(e,t){return qa(e,B(t,bt,Pa))}function Zs(e,t,n){return Ka(e,B(t,z(e,vt,yt),Pa),n)}function Qs(e,t,n){let r=z(e,kt,At),i=js(e,t,n);return i=B(i,r,Pa,[]),Va(e,i)}function $s(e){return jr(kr(BigInt(Un(e))*$e))}function ec(e){return jr(kr(Hn(e)))}function tc(e){return e.timeZone=`UTC`,[`full`,`long`].includes(e.timeStyle)&&(e.timeStyle=`medium`),e}function nc(e,t){return e.timeZone!==void 0&&b(`Cannot specify TimeZone`),e.timeZone=t,e}function rc(e,t,n){let r=e.resolvedOptions().calendar;!n&&t.calendar===void 0||Ie(t.calendar)===r||y(`Mismatching Calendars`)}function ic(e,t,n,r,i){let a=new Set(e),o=new Set(t),s=new Set(n);return(e,t)=>{let n=((e,t,n,r)=>{let i={dateStyle:void 0,timeStyle:void 0,me:{},pe:{},xe:{},oe:0,ue:0};for(let a of Object.keys(e)){let o=e[a];o===void 0||r.has(a)||(t.has(a)?a===`dateStyle`?i.dateStyle=o:a===`timeStyle`?i.timeStyle=o:i.me[a]=o:a===`era`?i.pe[a]=o:n.has(a)?a===`dateStyle`||a===`timeStyle`?i.ue=1:i.oe=1:i.xe[a]=o)}return i})(e,a,o,s),c=n.dateStyle!==void 0,l=n.timeStyle!==void 0,u=c||l,d=Object.keys(n.me).length>0,f=n.oe||n.ue,p=d||c||l,m=Object.keys(n.pe).length>0,h=d||m||n.oe;(!t&&f||t&&f&&!p||u&&h)&&b(`Invalid formatting options`);let g={};return u||p||Object.assign(g,r),Object.assign(g,n.me,n.pe,n.xe),c&&(i?Object.assign(g,i[n.dateStyle]):g.dateStyle=n.dateStyle),l&&(g.timeStyle=n.timeStyle),g}}const ac={year:`numeric`,month:`numeric`,day:`numeric`},oc={hour:`numeric`,minute:`numeric`,second:`numeric`},sc=Object.assign({},ac,oc),cc=Object.assign({},sc,{timeZoneName:`short`}),lc={year:`numeric`,month:`numeric`},uc={month:`numeric`,day:`numeric`},dc=[`weekday`,`year`,`month`,`day`,`dateStyle`],fc=[`dayPeriod`,`hour`,`minute`,`second`,`fractionalSecondDigits`,`timeStyle`],pc=dc.concat(fc),mc=[`weekday`,`day`].concat(fc),hc=[`weekday`,`year`].concat(fc),gc=ic(pc,[],[],sc),_c=ic(pc,[],[],cc),vc=ic(pc,[],[`timeZoneName`],sc),yc=ic(dc,fc,[`timeZoneName`],ac),bc=ic(fc,dc,[`timeZoneName`,`era`],oc),xc=ic([`year`,`month`,`dateStyle`],mc,[`timeZoneName`],lc,{full:{year:`numeric`,month:`long`},long:{year:`numeric`,month:`long`},medium:{year:`numeric`,month:`short`},short:{year:`2-digit`,month:`numeric`}}),Sc=ic([`month`,`day`,`dateStyle`],hc,[`timeZoneName`,`era`],uc,{full:{month:`long`,day:`numeric`},long:{month:`long`,day:`numeric`},medium:{month:`short`,day:`numeric`},short:{month:`numeric`,day:`numeric`}});function Cc(e,t){let{timeZone:n}=e,r=L(e),{offsetNanoseconds:i}=r,a=t||jt,o;return o=t?li(n,M(r,a),i,2):di(n,M(r,a)),Mr(o,n,e.calendar)}function wc(e){let t=Tc(),n=e.C(t);return Jt(t+BigInt(n))}function Tc(){return BigInt(Date.now())*$e}function Ec(){return new Ja().resolvedOptions().timeZone}const Dc=`PlainYearMonth`,Oc=`PlainMonthDay`,kc=`PlainDate`,Ac=`PlainDateTime`,jc=`PlainTime`,Mc=`ZonedDateTime`,Nc=`Instant`,Pc=`Duration`;function Fc(e,t,n,...r){Object.defineProperties(t,le(e)),Object.defineProperties(t.prototype,de(`Temporal.`+e));for(let e of r)Ic(t.prototype,n,e);return t}function Ic(e,t,n){Object.defineProperties(e,fe(e=>({get(){return e(t(this))},configurable:1}),n))}const Lc=ve.name===`noop`?e=>{Object.defineProperty(e,`_str_`,{value:e.toJSON()})}:ve;function Rc(){b(`Invalid calling context`)}function zc(){b(`Cannot use valueOf`)}const Bc={era(e){return _n(e.calendar,e).era},eraYear(e){return _n(e.calendar,e).eraYear},year(e){return O(e.calendar,e).year},month(e){return O(e.calendar,e).month},monthCode(e){return xn(e.calendar,e)}},Vc={era(e){return _n(e.calendar,e).era},eraYear(e){return _n(e.calendar,e).eraYear},year(e){return O(e.calendar,e).year},month(e){return O(e.calendar,e).month},monthCode(e){return xn(e.calendar,e)},day(e){return O(e.calendar,e).day}},Hc={monthCode(e){return xn(e.calendar,e)},day(e){return O(e.calendar,e).day}},Uc={daysInMonth(e){return wn(e.calendar,e)},daysInYear(e){return Tn(e.calendar,e)},monthsInYear(e){return Cn(e.calendar,e)},inLeapYear(e){return Sn(e.calendar,e)}},Wc={dayOfWeek(e){return sn(e)},dayOfYear(e){return En(e.calendar,e)},weekOfYear(e){return Dn(e.calendar,e)},yearOfWeek(e){return On(e.calendar,e)},daysInWeek(){return 7},daysInMonth(e){return wn(e.calendar,e)},daysInYear(e){return Tn(e.calendar,e)},monthsInYear(e){return Cn(e.calendar,e)},inLeapYear(e){return Sn(e.calendar,e)}};function Gc(e){return me(Object.keys(e))}Gc(Uc),Gc(Wc);function Kc(e){let t=e.ve||0;function n(e){return e-t}function r(e){return e+t}return{l:e.l,ge:1972+t,le:e.le,ie(e){return{...e,year:r(e.year)}},je(e,t,r){return en(n(e),t,r)},se(e,t,r){return qt(n(e),t,r)*We},O(e,t){return Qt(t)},v(e,t){let n=$t(e,t);return n&&{year:r(n.year),month:n.month}},u(e){return rn(n(e))},k(){return 12},p(e,t){return tn(n(e),t)},j(e){return nn(n(e))},q(){},h(t){return e.h?.(t,r(t.year))||{}},N(e,t,i){let a=an(n(e),t,i);return{year:r(a.year),month:a.month}},ne(e,t,r,i){return on(n(e),t,n(r),i)}}}function qc(e,t){let n=Jc(e);return{m:t.m,Z:t.Z,X:t.X,ie:n.he,je:x(Xc,n),se:x(Zc,n),O:x(Qc,n,t.m),v:x(al,n,t.m,t.Ce),u:x(el,n,t.m),k:x(rl,n),p:x(nl,n),j:x(tl,n),q:x($c,n,t.m),h:x(il,n),N:x(ol,n),ne:x(sl,n)}}function Jc(e){let t=(e=>new Ja(`en-u-hc-h23`,{calendar:e,timeZone:`UTC`,era:`short`,year:`numeric`,month:`short`,day:`numeric`}))(e);function n(e){return{...Yc(n=Ya(t,e)),month:0,Fe:n.month,day:parseInt(n.day)};var n}let r=(e=>{let t=e(0).year-1970;return ce(function(n){let r=qt(n-t)*We,i,a=0,o=[],s=[];do r+=400*We;while((i=e(r)).year<=n);do r+=(1-i.day)*We,i.year===n&&(o.push(r),s.push(i.Fe)),r-=We,(++a>500||r<-864e13)&&y();while((i=e(r)).year>=n);return{$:o.reverse(),we:s.reverse()}})})(n);return{he:((e,t)=>ce(n=>{let r=Gt(n),i=e(r);return{...i,month:cl(t,i.year,r)}},WeakMap))(n,r),K:r}}function Yc(e){return{era:void 0,eraYear:void 0,year:parseInt(e.relatedYear||e.year)}}function Xc(e,t,n,r){return Yt(Zc(e,t,n,r))}function Zc(e,t,n=1,r=1){return e.K(t).$[n-1]+(r-1)*We}function Qc(e,t,n,r){let i=$c(e,t,n);return[Ve(r,i),i===r]}function $c(e,t,n){if(t===void 0)return;let r=e.K(n).we;if(r.length<=12)return;if(t<0)return-t;for(let e=1;e<r.length;e++)if(r[e]===r[e-1])return e+1;for(let e=0;e<r.length;e++)if(/bis$/i.test(r[e]))return e+1;let i=e.K(n-1).we;for(let e=0;e<r.length;e++)if(r[e]!==i[e])return e+1}function el(e,t,n){if(t!==void 0)return rl(e,n)>12;let r=tl(e,n);return r>tl(e,n-1)||r>tl(e,n+1)}function tl(e,t){return Zt(Zc(e,t),Zc(e,t+1))}function nl(e,t,n){let{$:r}=e.K(t),i=n+1,a=r;return i>r.length&&(i=1,a=e.K(t+1).$),Zt(r[n-1],a[i-1])}function rl(e,t){return e.K(t).$.length}function il(e,t){let n=e.he(t);return{era:n.era,eraYear:n.eraYear}}function al(e,t,n,r,i,a){let o=n?.(r,i,a)||1972,{year:s,month:c,day:l}=e.he({year:o,month:12,day:31}),u=$c(e,t,s),d=Ve(c,u),f=c===u;(C(r,d)||C(Number(i),Number(f))||C(a,l))===1&&s--;for(let n=0;n<100;n++){let o=s-n,c=$c(e,t,o),l=Be(r,i,c);if(i===(l===c)&&a<=nl(e,o,l))return{year:o,month:l}}}function ol(e,t,n,r){if(r)if(Number.isSafeInteger(n+=r)||y(`Out-of-bounds date`),r<0)for(;n<1;)n+=rl(e,--t);else{let r;for(;n>(r=rl(e,t));)n-=r,t++}return{year:t,month:n}}function sl(e,t,n,r,i){let a=C(t,r)||C(n,i);if(!a)return 0;if(t===r)return i-n;if(a<0){let a=rl(e,t)-n+i;for(let n=t+1;n<r;n++)a+=rl(e,n);return a}return-sl(e,r,i,t,n)}function cl(e,t,n){let{$:r}=e(t);for(let e=r.length-1;e>=0;e--)if(n>=r[e])return e+1;y()}const ll=2440588;function ul(e){let t=e.J(2441683),n=ce(t=>e.J(Kt(t)+2440588),WeakMap);function r(t,n){let r=e.q?.(t);return[Ve(n,r),n===r]}return{l:e.l,m:e.m,Z:e.Z,X:e.X,ge:e.ge,te:e.te,ke:e.ke,ie:n,je(t,n,r){return Xt(e.L(t,n,r)-2440588)},se(t,n=1,r=1){return(e.L(t,n,r)-2440588)*We},O(t,n){return(e.O||r)(t,n)},v(n,i,a){return e.v?.(n,i,a)||((n,i,a)=>{i=!!i;let o=e.ge||t.year,[s,c]=r(t.year,t.month);(C(n,s)||C(Number(i),Number(c))||C(a,t.day))===1&&o--;for(let t=0;t<100;t++)for(let r of[o-t,o+t]){let t=e.q?.(r),o=Be(n,i,t);if(o<=e.k(r)&&i===(o===t)&&a<=e.p(r,o))return{year:r,month:o}}})(n,i,a)},u:e.u,k:e.k,p:e.p,j:e.j,q:e.q||ve,h(t){let r=n(t);return e.h?e.h(r):{era:r.era,eraYear:r.eraYear}},N(t,n,r){return((e,t,n,r)=>{if(r)if(Number.isSafeInteger(n+=r)||y(`Out-of-bounds date`),r<0)for(;n<1;)n+=e(--t);else{let r;for(;n>(r=e(t));)n-=r,t++}return{year:t,month:n}})(e.k,t,n,r)},ne(t,n,r,i){return dl(e.k,t,n,r,i)}}}function dl(e,t,n,r,i){let a=C(t,r)||C(n,i);if(!a)return 0;if(t===r)return i-n;if(a<0){let a=e(t)-n+i;for(let n=t+1;n<r;n++)a+=e(n);return a}return-dl(e,r,i,t,n)}const fl={be:0},pl={m:13,Z:{1:0,2:29,8:29,9:29,10:29,11:29,12:0},X:30,Ce(e,t,n){if(t)switch(e){case 1:return 1651;case 2:return n<30?1947:1765;case 3:return n<30?1966:1955;case 4:return n<30?1963:1944;case 5:return n<30?1971:1952;case 6:return n<30?1960:1941;case 7:return n<30?1968:1938;case 8:return n<30?1957:1718;case 9:return 2014;case 10:return 1984;case 11:return n<29?2033:2034;case 12:return 1890}return 1972}};function ml(e){return qc(e,pl)}const hl={am:0},gl={am:0,aa:0},_l={aa:0};function vl(e,t,n=0,r=0){return ul({l:t,te(e,t,n){return t===`aa`&&r?e-5500:ka(e,n)},ke(e,t,n){return ae(n,1,t||e!==13?30:6)},J(t){let[r,i,a]=((e,t)=>{let n=Math.floor((4*(t-e)+3)/1461),r=1+Math.floor((t-yl(e,n,1,1))/30);return[n,r,t+1-yl(e,n,r,1)]})(e,t);return{year:r+n,month:i,day:a}},L(t,r,i){return yl(e,t-n,r,i)},p(e,t){return((e,t)=>t%13==0?bl(e)+5:30)(e-n,t)},j(e){return 365+bl(e-n)},k(){return 13},u(e){return this.j(e)>365},h({year:e}){return n?{era:`aa`,eraYear:e}:r&&e<=0?{era:`aa`,eraYear:e+5500}:{era:`am`,eraYear:e}}})}function yl(e,t,n,r){return e+365*t+Math.floor(t/4)+30*(n-1)+r-1}function bl(e){return Math.floor(ke(e,4)/3)}const xl={am:0};function Sl(e){return ke(7*e+1,19)<7}function Cl(e){let t=Math.floor((235*e-234)/19),n=29*t+Math.floor((12084+13753*t)/25920);return ke(3*(n+1),7)<3&&(n+=1),n}function wl(e){return Cl(e)+(e=>{let t=Cl(e-1),n=Cl(e);return Cl(e+1)-n===356?2:n-t===382?1:0})(e)}function Tl(e){return wl(e+1)-wl(e)}function El(e,t){let n=t>=6&&!Sl(e)?t+1:t;if(n===4||n===7||n===9||n===11||n===13)return 29;let r=(e=>{let t=Tl(e);return t>380&&(t-=30),t===353?0:t===354?1:2})(e);return n===2?r===2?30:29:n===3?r===0?29:30:n===6?Sl(e)?30:0:30}const Dl={shaka:0},Ol=[1392,1390,1391,1392,1391,1392,1389,1392,1392,1390,1391,1390];function kl(e,t,n){return ul({l:{bh:-1,ah:0},J:e,L:t,p(e,t){return n&&Nl(e)?nl(n,e,t):((e,t)=>29+t%2+(t===12&&Ml(e)?1:0))(e,t)},j(e){return n&&Nl(e)?tl(n,e):Ml(e)?355:354},k(){return 12},u(e){return this.j(e)>354},v(e,t,r){let i=n&&!t&&r===30&&Ol[e-1];return n&&i?{year:i,month:e}:void 0},h({year:e}){return e<1?{era:`bh`,eraYear:1-e}:{era:`ah`,eraYear:e}}})}function Al(e,t,n,r){return r+Math.ceil(29.5*(n-1))+354*(t-1)+Math.floor((3+11*t)/30)+e-1}function jl(e,t){let n=Math.floor((30*(t-e)+10646)/10631),r=Math.min(12,Math.ceil((t-(29+Al(e,n,1,1)))/29.5)+1);return{year:n,month:r,day:t-Al(e,n,r,1)+1}}function Ml(e){return ke(14+11*e,30)<11}function Nl(e){return e>=1300&&e<=1600}function Pl(e,t){let n=t-1948440;if(n<460322||n>=566987)return jl(1948440,t);let{year:r,month:i,day:a}=e.he(Xt(t-ll));return{year:r,month:i,day:a}}function Fl(e,t,n,r){return Nl(t)?Zc(e,t,n,r)/We+ll:Al(1948440,t,n,r)}const Il=Object.assign({},Pe,{meiji:1867,taisho:1911,showa:1925,heisei:1988,reiwa:2018});function Ll(e){let t=Kt(e),n=t>=18017?`reiwa`:t>=6947?`heisei`:t>=-15713?`showa`:t>=-20974?`taisho`:t>=-35428?`meiji`:void 0;return n?{era:n,eraYear:e.year-Il[n]}:dn(e)}const Rl={ap:0},zl=[0,31,62,93,124,155,186,216,246,276,306,336];function Bl(e){return ke(25*e+11,33)<8}const Vl={broc:-1,roc:0},Hl=[`buddhist`,()=>Kc({ve:543,l:fl,h(e,t){return{era:`be`,eraYear:t}}})],Ul=[`chinese`,ml],Wl=[`coptic`,()=>vl(1824665,hl)],Gl=[`dangi`,ml],Kl=new Map([Hl,Ul,Wl,Gl,[`ethiopic`,()=>vl(1723856,gl,0,1)],[`ethioaa`,()=>vl(1723856,_l,5500)],[`hebrew`,()=>ul({l:xl,m:-6,J(e){let t=e-347997,n=Math.floor((25920*t/765433*19+234)/235)+1,r=wl(n),i=Math.floor(t-r);for(;i<1;)n--,r=wl(n),i=Math.floor(t-r);let a=1,o=0;for(;o<i;)o+=El(n,a),a++;return a--,o-=El(n,a),{year:n,month:a,day:i-o}},L(e,t,n){let r=wl(e);for(let n=1;n<t;n++)r+=El(e,n);return r+n+347997},p:El,j:Tl,k(e){return Sl(e)?13:12},u:Sl,q(e){return Sl(e)?6:void 0},O(e,t){return Sl(e)&&t===6?[5,1]:[t-(Sl(e)&&t>6?1:0),0]},v(e,t,n){return t&&e===5&&n<=30?{year:5730,month:6}:void 0},h({year:e}){return{era:`am`,eraYear:e}}})],[`indian`,function(){return ul({l:Dl,J(e){let t=Xt(e-ll),n=t.year-78,r=e-(qt(t.year,1,1)+ll),i;if(r<80?(n--,i=rn(t.year-1)?31:30,r+=i+155+90+10):(i=rn(t.year)?31:30,r-=80),r<i)return{year:n,month:1,day:r+1};let a=r-i;return a<155?{year:n,month:Math.floor(a/31)+2,day:a%31+1}:(a-=155,{year:n,month:Math.floor(a/30)+7,day:a%30+1})},L(e,t,n){let r=e+78,i,a;return rn(r)?(i=31,a=qt(r,3,21)+ll):(i=30,a=qt(r,3,22)+ll),t===1||(a+=i+31*Math.min(t-2,5),t>=8&&(a+=30*(t-7))),a+n-1},p(e,t){return t===1&&rn(e+78)||t>=2&&t<=6?31:30},j(e){return rn(e+78)?366:365},k(){return 12},u(e){return this.j(e)>365},h({year:e}){return{era:`shaka`,eraYear:e}}})}],[`japanese`,()=>Kc({l:Il,le:1,h:Ll})],[`islamic-civil`,()=>kl(x(jl,1948440),x(Al,1948440))],[`islamic-tbla`,()=>kl(x(jl,1948439),x(Al,1948439))],[`islamic-umalqura`,e=>{let t=Jc(e);return kl(x(Pl,t),x(Fl,t),t)}],[`persian`,()=>ul({l:Rl,J(e){let t=e-1948320,n=1+Math.floor((33*t+3)/12053),r=t-(365*(n-1)+Math.floor((8*n+21)/33)),i=Math.floor(r<216?r/31:(r-6)/30);return{year:n,month:i+1,day:r-zl[i]+1}},L(e,t,n){return 1948319+365*(e-1)+Math.floor((8*e+21)/33)+zl[t-1]+n},p(e,t){return t<=6?31:t<=11||Bl(e)?30:29},j(e){return Bl(e)?366:365},k(){return 12},u:Bl,h({year:e}){return{era:`ap`,eraYear:e}}})],[`roc`,()=>Kc({ve:-1911,l:Vl,h(e,t){return t<1?{era:`broc`,eraYear:1-t}:{era:`roc`,eraYear:t}}})]]),ql={islamic:1,"islamic-rgsa":1},Jl={"ethiopic-amete-alem":`ethioaa`,islamicc:`islamic-civil`},Yl=ce((e,t)=>{let n=t(e);return n.id=e,n});function Xl(e){let t=Zl(e);return t||y(te(e)),Yl(...t)}function Zl(e){ql[e]&&y(te(e));let t=Jl[e]||e,n=Kl.get(t);return n&&[t,n]}function Ql(e){let t=j(e).toLowerCase();return t===`iso8601`?void 0:t===`gregory`?0:Xl(t)}function $l(e=`iso8601`){return Ql(e)}const eu=new WeakMap,tu=Fc(Mc,class{constructor(e,t,n=void 0){let r=kr(Hn(e)),i=V(ko(t)),a=$l(n);au(this,Mr(r,i,a))}static from(e,t=void 0){return H(iu(e,t))}static compare(e,t){return pa(iu(e),iu(t))}get calendarId(){return Ie(U(this).calendar)}get timeZoneId(){return U(this).timeZone.id}get epochMilliseconds(){return Fr(U(this))}get epochNanoseconds(){return Ir(U(this))}get offset(){return bo(L(U(this)).offsetNanoseconds)}get offsetNanoseconds(){return L(U(this)).offsetNanoseconds}get hoursInDay(){return Wr(U(this))}with(e,t=void 0){return H(Ns(U(this),Au(e),t))}withCalendar(e){return H({...U(this),calendar:$u(e)})}withTimeZone(e){return H({...U(this),timeZone:V(ou(e))})}withPlainTime(e=void 0){return H(Cc(U(this),Lu(e)))}add(e,t=void 0){return H(mi(U(this),J(e),t))}subtract(e,t=void 0){return H(mi(U(this),R(J(e)),t))}until(e,t=void 0){let n=U(this),r=iu(e);return K(I(Di(0,Ci(n.calendar,r.calendar),n,r,t)))}since(e,t=void 0){let n=U(this),r=iu(e);return K(I(Di(1,Ci(n.calendar,r.calendar),n,r,t)))}round(e){let t=U(this),[n,r,i]=br(e);return H(Ur(t,n,r,i))}startOfDay(){return H(Gr(U(this)))}equals(e){return ya(U(this),iu(e))}toInstant(){return lu(Hs(U(this)))}toPlainDateTime(){return Vu(Us(U(this)))}toPlainDate(){return qu(Ws(U(this)))}toPlainTime(){return Nu(Gs(U(this)))}toLocaleString(e=void 0,t={}){let n=U(this),r=new Ja(e,nc(_c(t),Ti(n)));return rc(r,n),r.format(Fr(n))}toString(e=void 0){return ro(U(this),e)}toJSON(){return ro(U(this))}getTimeZoneTransition(e){let t=U(this),n=si(t,e);return n?H({...t,epochNanoseconds:n}):null}valueOf(){return zc()}},nu,Vc,Wc,it);function H(e){return au(Object.create(tu.prototype),e)}function U(e){return ru(e)||Rc()}function nu(e){let t=U(e);return{...L(t),calendar:t.calendar}}function ru(e){return eu.get(e)}function iu(e,t){if(v(e)){let n=ru(e);return n?(xr(t),n):Ho(ou,Zu(e),e,t)}return Qo(e,Ql,t)}function au(e,t){return eu.set(e,t),Lc(e),e}function ou(e){if(v(e)){let t=ru(e);return t||b(ne(e)),t.timeZone.id}return(e=>Ao(ss(j(e))))(e)}const su=new WeakMap,cu=Fc(Nc,class{constructor(e){let t=kr(Hn(e));mu(this,jr(t))}static from(e){return lu(fu(e))}static fromEpochMilliseconds(e){return lu($s(e))}static fromEpochNanoseconds(e){return lu(ec(e))}static compare(e,t){return fa(fu(e),fu(t))}get epochMilliseconds(){return Fr(uu(this))}get epochNanoseconds(){return Ir(uu(this))}add(e){return lu(jr(pi(uu(this).epochNanoseconds,J(e))))}subtract(e){return lu(jr(pi(uu(this).epochNanoseconds,R(J(e)))))}until(e,t=void 0){return K(Ei(0,uu(this),fu(e),t))}since(e,t=void 0){return K(Ei(1,uu(this),fu(e),t))}round(e){let t=uu(this),[n,r,i]=br(e,5,1);return lu(jr(ei(t.epochNanoseconds,Xr(n,r),i)))}equals(e){return va(uu(this),fu(e))}toZonedDateTimeISO(e){return H(Vs(uu(this),V(ou(e))))}toLocaleString(e=void 0,t={}){let n=uu(this);return new Ja(e,gc(t)).format(Fr(n))}toString(e=void 0){return no(ou,uu(this),e)}toJSON(){return no(ou,uu(this))}valueOf(){return zc()}});function lu(e){return mu(Object.create(cu.prototype),e)}function uu(e){return du(e)||Rc()}function du(e){return su.get(e)}function fu(e){if(v(e)){let t=du(e);if(t)return t;let n=ru(e);if(n)return jr(n.epochNanoseconds)}return Xo(e)}const{toTemporalInstant:pu}={toTemporalInstant(){let e=Date.prototype.valueOf.call(this);return lu(jr(BigInt(zn(e))*$e))}};function mu(e,t){return su.set(e,t),Lc(e),e}const hu=new WeakMap,gu=Fc(Oc,class{constructor(e,t,n=void 0,r){let i=s(e),a=s(t),o=$l(n),c=P(pn({year:s(r??1972),month:i,day:a}));xu(this,F(c,o))}static from(e,t=void 0){return _u(bu(e,t))}get calendarId(){return Ie(vu(this).calendar)}with(e,t=void 0){return _u(Ls(vu(this),Au(e),t))}equals(e){return Ca(vu(this),bu(e))}toPlainDate(e){return qu(Ys(vu(this).calendar,this,e))}toLocaleString(e=void 0,t={}){let n=vu(this),r=new Ja(e,tc(Sc(t)));return rc(r,n,1),r.format(Gt(n))}toString(e=void 0){return so(vu(this),e)}toJSON(){return so(vu(this))}valueOf(){return zc()}},vu,Hc);function _u(e){return xu(Object.create(gu.prototype),e)}function vu(e){return yu(e)||Rc()}function yu(e){return hu.get(e)}function bu(e,t){if(v(e)){let n=yu(e);if(n)return N(t),n;let r=Qu(e);return Ko(r===void 0?void 0:r,r===void 0,e,t)}let n=rs(e,Ql);return N(t),n}function xu(e,t){return hu.set(e,t),Lc(e),e}const Su=new WeakMap,Cu=Fc(Dc,class{constructor(e,t,n=void 0,r){let i=s(e),a=s(t),o=$l(n),c=Er(pn({year:i,month:a,day:s(r??1)}));Ou(this,F(c,o))}static from(e,t=void 0){return wu(Du(e,t))}static compare(e,t){return ga(Du(e),Du(t))}get calendarId(){return Ie(Tu(this).calendar)}with(e,t=void 0){return wu(Is(Tu(this),Au(e),t))}add(e,t=void 0){let n=Tu(this);return wu(F(fi(0,n.calendar,n,J(e),t),n.calendar))}subtract(e,t=void 0){let n=Tu(this);return wu(F(fi(1,n.calendar,n,J(e),t),n.calendar))}until(e,t=void 0){let n=Tu(this),r=Du(e);return K(Ai(0,Ci(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=Tu(this),r=Du(e);return K(Ai(1,Ci(n.calendar,r.calendar),n,r,t))}equals(e){return Sa(Tu(this),Du(e))}toPlainDate(e){return qu(Js(Tu(this).calendar,this,e))}toLocaleString(e=void 0,t={}){let n=Tu(this),r=new Ja(e,tc(xc(t)));return rc(r,n,1),r.format(Gt(n))}toString(e=void 0){return oo(Tu(this),e)}toJSON(){return oo(Tu(this))}valueOf(){return zc()}},Tu,Bc,Uc);function wu(e){return Ou(Object.create(Cu.prototype),e)}function Tu(e){return Eu(e)||Rc()}function Eu(e){return Su.get(e)}function Du(e,t){if(v(e)){let n=Eu(e);return n?(N(t),n):Go(Zu(e),e,t)}let n=ts(e,Ql);return N(t),n}function Ou(e,t){return Su.set(e,t),Lc(e),e}function ku(e){if(!v(e))return;let t=du(e);return t?[Nc,t]:(t=ru(e),t?[Mc,t]:(t=Hu(e),t?[Ac,t]:(t=Ju(e),t?[kc,t]:(t=Fu(e),t?[jc,t]:(t=Eu(e),t?[Dc,t]:(t=yu(e),t?[Oc,t]:(t=nd(e),t?[Pc,t]:void 0)))))))}function Au(e){return(ku(e)||e.calendar!==void 0||e.timeZone!==void 0)&&b(`Invalid bag`),e}const ju=new WeakMap,Mu=Fc(jc,class{constructor(e=0,t=0,n=0,r=0,i=0,a=0){Ru(this,Mt(fe(s,{hour:e,minute:t,second:n,millisecond:r,microsecond:i,nanosecond:a})))}static from(e,t=void 0){return Nu(Iu(e,t))}static compare(e,t){return _a(Iu(e),Iu(t))}with(e,t=void 0){return Nu(Rs(Pu(this),Au(e),t))}add(e){return Nu(vi(Pu(this),J(e))[0])}subtract(e){return Nu(vi(Pu(this),R(J(e)))[0])}until(e,t=void 0){return K(Mi(0,Pu(this),Iu(e),t))}since(e,t=void 0){return K(Mi(1,Pu(this),Iu(e),t))}round(e){let t=Pu(this),[n,r,i]=br(e,5);return Nu(qr(t,Yr(n,r),i)[0])}equals(e){return wa(Pu(this),Iu(e))}toLocaleString(e=void 0,t={}){let n=Pu(this);return new Ja(e,tc(bc(t))).format(Ft(n))}toString(e=void 0){return lo(Pu(this),e)}toJSON(){return lo(Pu(this))}valueOf(){return zc()}},Pu,it);function Nu(e){return Ru(Object.create(Mu.prototype),e)}function Pu(e){return Fu(e)||Rc()}function Fu(e){return ju.get(e)}function Iu(e,t){if(v(e)){let n=Fu(e);if(n)return N(t),n;let r=Hu(e);if(r)return N(t),Pr(r);let i=ru(e);return i?(N(t),Gs(i)):qo(e,t)}let n=is(e);return N(t),n}function Lu(e){return e===void 0?void 0:Iu(e)}function Ru(e,t){return ju.set(e,t),Lc(e),e}const zu=new WeakMap,Bu=Fc(Ac,class{constructor(e,t,n,r=0,i=0,a=0,o=0,c=0,l=0,u=void 0){let d=Dr(fn(fe(s,{year:e,month:t,day:n,hour:r,minute:i,second:a,millisecond:o,microsecond:c,nanosecond:l}))),f=$l(u);Wu(this,Nr(d,f))}static from(e,t=void 0){return Vu(Uu(e,t))}static compare(e,t){return ha(Uu(e),Uu(t))}get calendarId(){return Ie(W(this).calendar)}with(e,t=void 0){return Vu(Ps(W(this),Au(e),t))}withCalendar(e){return Vu(Nr(W(this),$u(e)))}withPlainTime(e=void 0){let t=W(this);return Vu(Ba(t,Lu(e),t.calendar))}add(e,t=void 0){let n=W(this);return Vu(Nr(hi(n.calendar,n,J(e),t),n.calendar))}subtract(e,t=void 0){let n=W(this);return Vu(Nr(hi(n.calendar,n,R(J(e)),t),n.calendar))}until(e,t=void 0){let n=W(this),r=Uu(e);return K(Oi(0,Ci(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=W(this),r=Uu(e);return K(Oi(1,Ci(n.calendar,r.calendar),n,r,t))}round(e){let t=W(this),[n,r,i]=br(e);return Vu(Nr(Kr(t,Yr(n,r),i),t.calendar))}equals(e){return ba(W(this),Uu(e))}toZonedDateTime(e,t=void 0){return H(Ks(W(this),V(ou(e)),t))}toPlainDate(){let e=W(this);return qu(F(e,e.calendar))}toPlainTime(){return Nu(Pr(W(this)))}toLocaleString(e=void 0,t={}){let n=W(this),r=new Ja(e,tc(vc(t)));return rc(r,n),r.format(Ut(n))}toString(e=void 0){return io(W(this),e)}toJSON(){return io(W(this))}valueOf(){return zc()}},W,Vc,Wc,it);function Vu(e){return Wu(Object.create(Bu.prototype),e)}function W(e){return Hu(e)||Rc()}function Hu(e){return zu.get(e)}function Uu(e,t){if(v(e)){let n=Hu(e);if(n)return N(t),n;let r=Ju(e);if(r)return N(t),Nr(M(r,jt),r.calendar);let i=ru(e);return i?(N(t),Us(i)):Uo(Zu(e),e,t)}let n=$o(e,Ql);return N(t),n}function Wu(e,t){return zu.set(e,t),Lc(e),e}const Gu=new WeakMap,Ku=Fc(kc,class{constructor(e,t,n,r=void 0){let i=P(pn(fe(s,{year:e,month:t,day:n}))),a=$l(r);Xu(this,F(i,a))}static from(e,t=void 0){return qu(Yu(e,t))}static compare(e,t){return ga(Yu(e),Yu(t))}get calendarId(){return Ie(G(this).calendar)}with(e,t=void 0){return qu(Fs(G(this),Au(e),t))}withCalendar(e){return qu(F(G(this),$u(e)))}add(e,t=void 0){let n=G(this);return qu(F(gi(n.calendar,n,J(e),t),n.calendar))}subtract(e,t=void 0){let n=G(this);return qu(F(gi(n.calendar,n,R(J(e)),t),n.calendar))}until(e,t=void 0){let n=G(this),r=Yu(e);return K(ki(0,Ci(n.calendar,r.calendar),n,r,t))}since(e,t=void 0){let n=G(this),r=Yu(e);return K(ki(1,Ci(n.calendar,r.calendar),n,r,t))}equals(e){return xa(G(this),Yu(e))}toZonedDateTime(e){let t=v(e)?{timeZone:e.timeZone,plainTime:e.plainTime}:{timeZone:e};return H(qs(ou,Iu,G(this),t))}toPlainDateTime(e=void 0){let t=G(this);return Vu(Ba(t,Lu(e),t.calendar))}toPlainYearMonth(){return wu(Zs(G(this).calendar,this))}toPlainMonthDay(){return _u(Xs(G(this).calendar,this))}toLocaleString(e=void 0,t={}){let n=G(this),r=new Ja(e,tc(yc(t)));return rc(r,n),r.format(Gt(n))}toString(e=void 0){return ao(G(this),e)}toJSON(){return ao(G(this))}valueOf(){return zc()}},G,Vc,Wc);function qu(e){return Xu(Object.create(Ku.prototype),e)}function G(e){return Ju(e)||Rc()}function Ju(e){return Gu.get(e)}function Yu(e,t){if(v(e)){let n=Ju(e);if(n)return N(t),n;let r=Hu(e);if(r)return N(t),F(r,r.calendar);let i=ru(e);return i?(N(t),Ws(i)):Wo(Zu(e),e,t)}let n=es(e,Ql);return N(t),n}function Xu(e,t){return Gu.set(e,t),Lc(e),e}function Zu(e){let t=Qu(e);return t===void 0?void 0:t}function Qu(e){let{calendar:t}=e;if(t!==void 0)return $u(t)}function $u(e){if(v(e)){let t=Ju(e)||Hu(e)||ru(e)||yu(e)||Eu(e);return t||b(te(e)),t.calendar}return(e=>Ql(os(j(e))))(e)}const ed=new WeakMap,td=Fc(Pc,class{constructor(e=0,t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0){let u=ra(fe(Un,{years:e,months:t,weeks:n,days:r,hours:i,minutes:a,seconds:o,milliseconds:s,microseconds:c,nanoseconds:l}));id(this,I(u))}static from(e){return K(J(e))}static compare(e,t,n=void 0){return ma(rd,J(e),J(t),n)}get sign(){return q(this).sign}get blank(){return!q(this).sign}with(e){return K(zs(q(this),e))}negated(){return K(ta(q(this)))}abs(){return K(ea(q(this)))}add(e,t=void 0){return K(Zi(rd,0,q(this),J(e),t))}subtract(e,t=void 0){return K(Zi(rd,1,q(this),J(e),t))}round(e){return K($i(rd,q(this),e))}total(e){return Lr(rd,q(this),e)}toLocaleString(e=void 0,t){let n=q(this);return Intl.DurationFormat?new Intl.DurationFormat(e,t).format(n):uo(n,t)}toString(e=void 0){return uo(q(this),e)}toJSON(){return uo(q(this))}valueOf(){return zc()}},q,kn);function K(e){return id(Object.create(td.prototype),e)}function q(e){return nd(e)||Rc()}function nd(e){return ed.get(e)}function J(e){return v(e)?nd(e)||Jo(e):as(e)}function rd(e){if(e!==void 0){if(v(e)){let t=ru(e);if(t)return t;let n=Ju(e);if(n)return n;let r=Hu(e);return r?F(r,r.calendar):Vo(ou,Zu(e),e)}return Zo(e,Ql)}}function id(e,t){return ed.set(e,t),Lc(e),e}const ad=Object.defineProperties({},{...de(`Temporal.Now`),...ue({timeZoneId(){return Ec()},instant(){return lu(jr(Tc()))},zonedDateTimeISO(e=Ec()){let t=V(ou(e));return H(Mr(Tc(),t))},plainDateTimeISO(e=Ec()){return Vu(Nr(wc(V(ou(e)))))},plainDateISO(e=Ec()){return qu(F(wc(V(ou(e)))))},plainTimeISO(e=Ec()){return Nu(Pr(wc(V(ou(e)))))}})}),od=Object.defineProperties({},{...de(`Temporal`),...ue({PlainYearMonth:Cu,PlainMonthDay:gu,PlainDate:Ku,PlainTime:Mu,PlainDateTime:Bu,ZonedDateTime:tu,Instant:cu,Duration:td,Now:ad})}),Y=globalThis.Temporal??od,sd=Y!==od,cd=1e3,ld=864e5,ud=400*ld,dd=30*36e5;function fd(e){if(e===`UTC`||e===`Etc/UTC`||e===`Etc/GMT`)return 0;let t=/^([+-])(\d{2}):?(\d{2})(?::?(\d{2}))?$/.exec(e);return t?(t[1]===`-`?-1:1)*((Number(t[2])*60+Number(t[3]))*60+Number(t[4]??0))*cd:null}var pd=class{constructor(e){this.tzid=e,this.transitions=[],this.offsets=[],this.coverStart=0,this.coverEnd=0,this.covered=!1,this.fixedOffsetMs=fd(e)}formatter(){return this.dtf??=new Intl.DateTimeFormat(`en-US`,{timeZone:this.tzid,hourCycle:`h23`,era:`short`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}exactOffsetMs(e){let t=this.formatter().formatToParts(e),n=0,r=!1,i=1,a=1,o=0,s=0,c=0;for(let e of t)switch(e.type){case`year`:n=Number(e.value);break;case`era`:r=e.value===`BC`||e.value===`B`;break;case`month`:i=Number(e.value);break;case`day`:a=Number(e.value);break;case`hour`:o=Number(e.value)%24;break;case`minute`:s=Number(e.value);break;case`second`:c=Number(e.value);break}r&&(n=1-n);let l=new Date(0);return l.setUTCFullYear(n,i-1,a),l.setUTCHours(o,s,c,0),l.getTime()-Math.floor(e/cd)*cd}ensureCoverage(e,t){if(this.fixedOffsetMs!==null||this.covered&&e>=this.coverStart&&t<=this.coverEnd)return;let n=Math.min(e,this.covered?this.coverStart:e)-ud,r=Math.max(t,this.covered?this.coverEnd:t)+ud;if(this.covered){let e=Math.max(r-n,2*(this.coverEnd-this.coverStart));n<this.coverStart&&(n=Math.min(n,r-e)),r>this.coverEnd&&(r=Math.max(r,n+e))}this.rebuild(Math.floor(n/cd)*cd,Math.ceil(r/cd)*cd)}rebuild(e,t){if(sd){let n=new Y.ZonedDateTime(BigInt(e)*1000000n,this.tzid),r=[],i=[n.offsetNanoseconds/1e6];for(;;){let e=n.getTimeZoneTransition(`next`);if(!e||e.epochMilliseconds>t)break;r.push(e.epochMilliseconds),i.push(e.offsetNanoseconds/1e6),n=e}this.transitions=r,this.offsets=i,this.coverStart=e,this.coverEnd=t,this.covered=!0;return}let n=[],r=[this.exactOffsetMs(e)],i=e,a=r[0];for(;i<t;){let e=Math.min(i+864e5,t);if(this.exactOffsetMs(e)===a){i=e;continue}let o=i,s=e;for(;s-o>cd;){let e=o+Math.floor((s-o)/2/cd)*cd;e<=o&&(e=o+cd),this.exactOffsetMs(e)===a?o=e:s=e}let c=this.exactOffsetMs(s);n.push(s),r.push(c),i=s,a=c}this.transitions=n,this.offsets=r,this.coverStart=e,this.coverEnd=t,this.covered=!0}offsetMsAt(e){if(this.fixedOffsetMs!==null)return this.fixedOffsetMs;this.ensureCoverage(e,e);let t=this.transitions,n=0,r=t.length;for(;n<r;){let i=n+r>>1;t[i]<=e?n=i+1:r=i}return this.offsets[n]}epochMsForWall(e){if(this.fixedOffsetMs!==null)return{epochMs:e-this.fixedOffsetMs,pushed:!1};this.ensureCoverage(e-dd,e+dd);let t=this.offsetMsAt(e-dd),n=e-t;if(this.offsetMsAt(n)===t)return{epochMs:n,pushed:!1};let r=this.offsetMsAt(e+dd),i=e-r;return this.offsetMsAt(i)===r?{epochMs:i,pushed:!1}:{epochMs:n,pushed:!0}}timeOfDayMayHitGap(e,t,n){if(this.fixedOffsetMs!==null)return!1;this.ensureCoverage(t,n);for(let r=0;r<this.transitions.length;r++){let i=this.transitions[r];if(i<t||i>n)continue;let a=this.offsets[r],o=this.offsets[r+1]-a;if(o<=0)continue;let s=e-((i+a)%ld+ld)%ld;if(s>=0?s<o:s+ld<o)return!0}return!1}};const md=new Map;function hd(e){let t=md.get(e);return t||(t=new pd(e),md.set(e,t)),t}const gd=[`YEARLY`,`MONTHLY`,`WEEKLY`,`DAILY`,`HOURLY`,`MINUTELY`,`SECONDLY`],_d=[`MO`,`TU`,`WE`,`TH`,`FR`,`SA`,`SU`],X={MO:1,TU:2,WE:3,TH:4,FR:5,SA:6,SU:7},vd=new Set(gd),yd=new Set(_d),bd=RegExp(`^([+-]?\\d{1,2})?(${_d.join(`|`)})$`),xd=RegExp(`(${_d.join(`|`)})$`),Sd=1e3,Cd=60*Sd,wd=60*Cd,Z=24*wd,Td=7*Z,Ed=[31,28,31,30,31,30,31,31,30,31,30,31],Dd=[0,3,2,5,0,3,5,1,4,6,2,4],Q=BigInt(1e6),Od=BigInt(1e9),kd=BigInt(60)*Od,Ad=BigInt(60)*kd,jd=BigInt(24)*Ad,Md=BigInt(7)*jd,Nd=864e13;function Pd(e,t){let n=Math.abs(e),r=Math.abs(t);for(;r!==0;){let e=n%r;n=r,r=e}return n}function Fd(e){let t=0;for(let n of e??[])t|=1<<n-1;return t}function Id(e,t){return e===0||(e&1<<t-1)!=0}function Ld(e,t){let n=e/t;return e%t<0n?n-1n:n}function Rd(e,t){return-Ld(-e,t)}function zd(e){return Number.isSafeInteger(e)&&e>=-Nd&&e<=Nd}function Bd(e,t,n){let r=e-(t<=2?1:0),i=Math.floor(r/400),a=r-i*400,o=t+(t>2?-3:9),s=Math.floor((153*o+2)/5)+n-1,c=a*365+Math.floor(a/4)-Math.floor(a/100)+s;return i*146097+c-719468}function Vd(e){return((e+3)%7+7)%7+1}function $(e,t){return(e-1+t%7+7)%7+1}function Hd(e){let t=e.toUpperCase().match(xd)?.[1];return!t||!yd.has(t)?null:t}function Ud(e){let t=e.toUpperCase().match(bd);if(!t)return null;let n=t[1]?parseInt(t[1],10):0,r=t[2];return!r||!yd.has(r)?null:{ord:n,weekday:r}}function Wd(e){return typeof e==`object`&&!!e&&typeof e.timeZoneId==`string`&&typeof e.toString==`function`}function Gd(e){let t=e.epochNanoseconds;return typeof t==`bigint`?t:void 0}function Kd(e,t){if(!Wd(e))throw Error(`${t} must be a ZonedDateTime`);try{let t=Gd(e);if(t!==void 0){let n=e.calendarId;return new Y.ZonedDateTime(t,e.timeZoneId,typeof n==`string`?n:`iso8601`)}return Y.ZonedDateTime.from(e.toString())}catch{throw Error(`${t} must be a ZonedDateTime`)}}function qd(e,t){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)||e.toISOString(),BigInt(t)*Q}if(!Wd(e))throw Error(`${t} must be a ZonedDateTime`);return Gd(e)??Kd(e,t).epochNanoseconds}function Jd(e,t){if(e?.length)return e.map(e=>Kd(e,t))}function Yd(e){return typeof e.rruleString==`string`}function Xd(e,t){let n=[...e??[],...Jd(t,`Manual date`)??[]];return n.length>0?n:void 0}function Zd(e){return e.replace(/\r?\n[ \t]/g,``)}function Qd(e,t,n){let r=n===`DATE`||!e.includes(`T`),i=`${e.slice(0,4)}-${e.slice(4,6)}-${e.slice(6,8)}`;if(r)return Y.PlainDate.from(i).toZonedDateTime({timeZone:t});if(e.endsWith(`Z`)){let n=`${i}T${e.slice(9,15)}Z`;return Y.Instant.from(n).toZonedDateTimeISO(t||`UTC`)}else{let n=`${i}T${e.slice(9)}`;return Y.PlainDateTime.from(n).toZonedDateTime(t)}}function $d(e,t,n){let r=[];for(let i of e){let e=ef(i,t);if(!e)continue;let a=e.tzid||n,o=e.value.split(`,`);r.push(...o.map(t=>Qd(t,a,e.valueType)))}return r}function ef(e,t){let n=e.indexOf(`:`);if(n===-1)return null;let r=e.slice(0,n),i=e.slice(n+1),[a,...o]=r.split(`;`);if(a?.toUpperCase()!==t)return null;let s,c;for(let e of o){let t=e.indexOf(`=`);if(t===-1)continue;let n=e.slice(0,t).toUpperCase(),r=e.slice(t+1);n===`VALUE`?s=r.toUpperCase():n===`TZID`&&(c=r)}return{valueType:s,tzid:c,value:i}}function tf(e,t,n){let r=e.trim();if(n&&!/^[+-]?\d+$/.test(r))throw Error(`Invalid ${t} value: ${e}`);return parseInt(r,10)}function nf(e,t=!1,n=!1,r=`number`){let i=e.split(`,`).map(e=>tf(e,r,n));return t?i.sort((e,t)=>e-t):i}function rf(e,t=!1){return e.split(`,`).map(e=>{let n=e.trim();if(/^\d+L$/i.test(n))return n.toUpperCase();let r=tf(n,`BYMONTH`,t);return Number.isFinite(r)?r:n})}function af(e,t,n,r=!1){let i=Zd(e).trim(),a,o=t,s=`DATE-TIME`,c=!1,l=!1,u,d=[],f=[];if(/^DTSTART/im.test(i)){let e=i.split(/\s+/),n=e.find(e=>e.match(/^DTSTART/i)),r=e.find(e=>e.match(/^RRULE:/i)),p=e.filter(e=>e.match(/^EXDATE/i)),m=e.filter(e=>e.match(/^RDATE/i)),h=ef(n,`DTSTART`);if(!h)throw Error(`Invalid DTSTART in ICS snippet`);let{valueType:g,tzid:_,value:ee}=h;s=(g||(ee?.includes(`T`)?`DATE-TIME`:`DATE`)).toUpperCase()===`DATE`?`DATE`:`DATE-TIME`,c=!!_,l=!!ee?.endsWith(`Z`),a=Qd(ee,_??t??o??`UTC`,s),o=_??a.timeZoneId??t??o??`UTC`,u=r,d=$d(p,`EXDATE`,o??`UTC`),f=$d(m,`RDATE`,o??`UTC`)}else a=n?Kd(n,`dtstart`):void 0,u=i,a&&(o=a.timeZoneId,s=`DATE-TIME`,c=!0,l=a.timeZoneId===`UTC`);let p=u?u.replace(/^RRULE:/i,``).split(`;`):[],m={dtstart:a,tzid:o,exDate:d.length>0?d:void 0,rDate:f.length>0?f:void 0},h;for(let e of p){let[t,n]=e.split(`=`);if(t)switch(t.toUpperCase()){case`RSCALE`:n&&(m.rscale=n.toUpperCase(),h&&!m.skip&&(m.skip=h,h=void 0));break;case`SKIP`:{let e=(n||``).toUpperCase();if(![`OMIT`,`BACKWARD`,`FORWARD`].includes(e))throw Error(`Invalid SKIP value: ${n}`);m.rscale?m.skip=e:h=e;break}case`FREQ`:m.freq=n.toUpperCase();break;case`INTERVAL`:m.interval=tf(n,`INTERVAL`,r);break;case`COUNT`:m.count=tf(n,`COUNT`,r);break;case`UNTIL`:{let e=n.includes(`T`);if(s===`DATE`){if(e)throw Error(`UNTIL rule part MUST have the same value type as DTSTART`);m.until=Qd(n,o||`UTC`,`DATE`);break}if(!e){if(r)throw Error(`UNTIL rule part MUST have the same value type as DTSTART`);let e=Qd(n,o||`UTC`,`DATE`).with({hour:23,minute:59,second:59,millisecond:0,microsecond:0,nanosecond:0});m.until=c||l?e.withTimeZone(`UTC`):e;break}if((c||l)&&!n.endsWith(`Z`))throw Error(`UNTIL rule part MUST always be specified as a date with UTC time`);m.until=Qd(n,o||`UTC`,`DATE-TIME`);break}case`BYHOUR`:m.byHour=nf(n,!0,r,`BYHOUR`);break;case`BYMINUTE`:m.byMinute=nf(n,!0,r,`BYMINUTE`);break;case`BYSECOND`:m.bySecond=nf(n,!0,r,`BYSECOND`);break;case`BYDAY`:m.byDay=n.split(`,`).map(e=>e.toUpperCase());break;case`BYMONTH`:m.byMonth=rf(n,r);break;case`BYMONTHDAY`:m.byMonthDay=nf(n,!1,r,`BYMONTHDAY`);break;case`BYYEARDAY`:m.byYearDay=nf(n,!1,r,`BYYEARDAY`);break;case`BYWEEKNO`:m.byWeekNo=nf(n,!1,r,`BYWEEKNO`);break;case`BYSETPOS`:m.bySetPos=nf(n,!1,r,`BYSETPOS`);break;case`WKST`:m.wkst=n?.toUpperCase();break}}if(h&&!m.rscale)throw Error(`SKIP MUST NOT be present unless RSCALE is present`);return h&&m.rscale&&!m.skip&&(m.skip=h),m}var of=class e{static{this.rscaleCalendarSupport={}}static normalizeToPolyfill(e){return Kd(e,`Date`)}toPublicDate(e){if(!e)return null;let t=this.outputTemporal?.ZonedDateTime;if(!t||t===Y.ZonedDateTime)return e;if(this.outputConstructorFastPathAvailable!==!1)try{let n=new t(e.epochNanoseconds,e.timeZoneId,e.calendarId);return this.outputConstructorFastPathAvailable=!0,n}catch{this.outputConstructorFastPathAvailable=!1}return t.from(e.toString())}toPublicDates(e){return!this.outputTemporal||this.outputTemporal.ZonedDateTime===Y.ZonedDateTime?e:e.map(e=>this.toPublicDate(e))}constructor(t){this.outputTemporal=t.temporal;let n;if(Yd(t)){let r=af(t.rruleString,t.tzid,t.dtstart,t.strict??!1);if(!r.dtstart)throw Error(`dtstart is required - provide it either in rruleString or as a separate parameter`);let i=e.normalizeToPolyfill(r.dtstart);this.tzid=r.tzid??t.tzid??`UTC`,this.originalDtstart=i,n={...r,dtstart:i,rDate:Xd(r.rDate,t.rDate),exDate:Xd(r.exDate,t.exDate),count:t.count??r.count,until:t.until?e.normalizeToPolyfill(t.until):r.until,strict:t.strict,maxIterations:t.maxIterations,maxCandidateEvaluations:t.maxCandidateEvaluations,includeDtstart:t.includeDtstart,cache:t.cache,temporal:t.temporal,tzid:this.tzid}}else{let e=Kd(t.dtstart,`Manual dtstart`);n={...t,dtstart:e,until:t.until?Kd(t.until,`Manual until`):void 0,rDate:Jd(t.rDate,`Manual rDate`),exDate:Jd(t.exDate,`Manual exDate`)},n.tzid=n.tzid||e.timeZoneId,this.tzid=n.tzid,this.originalDtstart=e}if(!n.freq)throw Error(`RRULE must include FREQ`);if(n.interval=n.interval??1,n.interval<=0)throw Error(`Cannot create RRule: interval must be greater than 0`);if(this.opts=this.sanitizeOpts(n),this.maxIterations=n.maxIterations??1e4,this.maxCandidateEvaluations=n.maxCandidateEvaluations??1e6,!Number.isSafeInteger(this.maxCandidateEvaluations)||this.maxCandidateEvaluations<=0)throw Error(`maxCandidateEvaluations must be a positive safe integer`);this.includeDtstart=n.includeDtstart??!1,this.parsedByDayTokens=this.buildParsedByDayTokens(this.opts.byDay),this.simpleByDayIsoDays=this.buildByDayIsoDays(this.parsedByDayTokens,!1),this.allByDayIsoDays=this.buildByDayIsoDays(this.parsedByDayTokens,!0),this.hasOrdinalByDay=this.parsedByDayTokens?.some(e=>e.ord!==0)??!1,this.canUseEpochMillisecondsPrecisionFlag=this.originalDtstart.microsecond===0&&this.originalDtstart.nanosecond===0&&(!this.opts.until||this.opts.until.microsecond===0&&this.opts.until.nanosecond===0),this.timeSlotOffsetsMs=this.buildTimeSlotOffsetsMs(),this.hasUniqueTimeSlotOffsets=this.timeSlotOffsetsMs===void 0||new Set(this.timeSlotOffsetsMs).size===this.timeSlotOffsetsMs.length,this.numericByMonths=this.opts.byMonth?.filter(e=>typeof e==`number`)}buildParsedByDayTokens(e){if(!e?.length)return;let t=e.map(e=>{let t=Ud(e);return t?{ord:t.ord,weekday:t.weekday,isoDay:X[t.weekday]}:null}).filter(e=>e!==null);return t.length>0?t:void 0}buildByDayIsoDays(e,t){if(!e?.length)return;let n=e.filter(e=>t||e.ord===0).map(e=>e.isoDay);if(n.length)return[...new Set(n)].sort((e,t)=>e-t)}sanitizeNumericArray(e,t,n,r=!1,i=!1){if(!e)return;let a=[],o=new Set;for(let i of e)Number.isInteger(i)&&i>=t&&i<=n&&(r||i!==0)&&!o.has(i)&&(o.add(i),a.push(i));if(a.length!==0)return i?a.sort((e,t)=>e-t):a}sanitizeByDay(e){let t=[],n=new Set;for(let r of e??[]){if(!r||typeof r!=`string`)continue;let e=r.toUpperCase(),i=Ud(e);if(!i||i.ord===0&&/^[+-]?\d/.test(e))throw Error(`Invalid BYDAY value: ${r}`);n.has(e)||(n.add(e),t.push(e))}return t.length>0?t:void 0}enforceStrictRfc(e){if(!e.strict)return;let t=e.freq;if(e.count!==void 0&&e.until!==void 0)throw Error(`COUNT and UNTIL MUST NOT occur in the same recurrence rule`);if(e.byWeekNo&&t!==`YEARLY`)throw Error(`BYWEEKNO MUST NOT be used unless FREQ=YEARLY`);if(e.byYearDay&&[`DAILY`,`WEEKLY`,`MONTHLY`].includes(t))throw Error(`BYYEARDAY MUST NOT be used when FREQ is DAILY, WEEKLY, or MONTHLY`);if(e.byMonthDay&&t===`WEEKLY`)throw Error(`BYMONTHDAY MUST NOT be used when FREQ is WEEKLY`);let n=(e.byDay??[]).some(e=>/^[+-]?\d/.test(e));if(n&&![`MONTHLY`,`YEARLY`].includes(t))throw Error(`BYDAY with numeric value MUST NOT be used unless FREQ is MONTHLY or YEARLY`);if(n&&t===`YEARLY`&&e.byWeekNo)throw Error(`BYDAY with numeric value MUST NOT be used with FREQ=YEARLY when BYWEEKNO is present`);let r=!!(e.byDay||e.byMonth||e.byMonthDay||e.byYearDay||e.byWeekNo||e.byHour||e.byMinute||e.bySecond);if(e.bySetPos&&!r)throw Error(`BYSETPOS MUST be used with another BYxxx rule part`)}sanitizeOpts(e){if(!vd.has(e.freq))throw Error(`Invalid FREQ value: ${e.freq}`);if(e.byDay=this.sanitizeByDay(e.byDay),e.wkst){let t=e.wkst.toUpperCase();if(!yd.has(t))throw Error(`Invalid WKST value: ${e.wkst}`);e.wkst=t}if(e.byMonth){let t=e.byMonth.filter(e=>typeof e==`number`),n=e.byMonth.filter(e=>typeof e==`string`).map(e=>e.toUpperCase()),r=this.sanitizeNumericArray(t,1,12,!1,!1)??[],i=[...new Set([...r,...n])];e.byMonth=i.length>0?i:void 0}if(e.rscale&&!e.skip&&(e.skip=`OMIT`),e.byMonthDay=this.sanitizeNumericArray(e.byMonthDay,-31,31,!1,!1),e.byYearDay=this.sanitizeNumericArray(e.byYearDay,-366,366,!1,!1),e.byWeekNo=this.sanitizeNumericArray(e.byWeekNo,-53,53,!1,!1),e.byHour=this.sanitizeNumericArray(e.byHour,0,23,!0,!0),e.byMinute=this.sanitizeNumericArray(e.byMinute,0,59,!0,!0),e.bySecond=this.sanitizeNumericArray(e.bySecond,0,59,!0,!0),e.bySetPos){if(e.bySetPos.some(e=>e===0))throw Error(`bySetPos may not contain 0`);e.bySetPos=this.sanitizeNumericArray(e.bySetPos,-1/0,1/0,!1,!1)}return this.enforceStrictRfc(e),e}rawAdvance(e){let{freq:t,interval:n}=this.opts;switch(t){case`DAILY`:return e.add({days:n});case`WEEKLY`:return e.add({weeks:n});case`MONTHLY`:return e.add({months:n});case`YEARLY`:return e.add({years:n});case`HOURLY`:{let t=e.hour,r=e.add({hours:n});return r.hour===t&&n===1&&(r=r.add({hours:n})),r}case`MINUTELY`:return e.add({minutes:n});case`SECONDLY`:return e.add({seconds:n});default:throw Error(`Unsupported FREQ: ${t}`)}}expandByTime(e){if(!this.opts.byHour&&!this.opts.byMinute&&!this.opts.bySecond)return[e];let t=this.opts.byHour??[e.hour],n=this.opts.byMinute??[e.minute],r=this.opts.bySecond??[e.second];if(t.length===1&&n.length===1&&r.length===1){let i=t[0],a=n[0],o=r[0];if(i===e.hour&&a===e.minute&&o===e.second)return[e];let s=this.resolveGeneratedTime(e.toPlainDateTime().with({hour:i,minute:a,second:o}));return s?[s]:[]}let i=[];for(let a of t)for(let t of n)for(let n of r){let r=this.resolveGeneratedTime(e.toPlainDateTime().with({hour:a,minute:t,second:n}));r&&i.push(r)}return i.sort((e,t)=>Y.ZonedDateTime.compare(e,t))}localDateKey(e){return`${e.calendarId}:${e.year}:${e.month}:${e.day}`}sortedUniqueDateCandidates(e){let t=new Map;for(let n of e){let e=this.localDateKey(n);t.has(e)||t.set(e,n)}return[...t.values()].sort((e,t)=>Y.PlainDate.compare(e,t))}resolveGeneratedTime(e){let t=this.originalDtstart,n=this.originalPlainDtstart??=t.toPlainDateTime();if(t.timeZoneId===this.generationTimeZone&&e.equals(n))return t;let r=t.timeZoneId===this.generationTimeZone?t:t.withTimeZone(this.generationTimeZone);r.calendarId!==e.calendarId&&(r=r.withCalendar(e.calendarId));let i=r.with({year:e.year,month:e.month,day:e.day,hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond,microsecond:e.microsecond,nanosecond:e.nanosecond},{offset:`ignore`,overflow:`reject`});return i.toPlainDateTime().equals(e)?i:null}get generationTimeZone(){return this.opts.rscale&&[`CHINESE`,`HEBREW`,`INDIAN`].includes(this.opts.rscale)?this.tzid:this.originalDtstart.timeZoneId}timeOfDayNanoseconds(e){return((e.hour*60*60+e.minute*60+e.second)*1e3+e.millisecond)*1e6+e.microsecond*1e3+e.nanosecond}timeSlotNanoseconds(e,t,n,r){return((t*60*60+n*60+r)*1e3+e.millisecond)*1e6+e.microsecond*1e3+e.nanosecond}needsSortedTimeFallback(e){try{let t=e.startOfDay();return t.add({days:1}).startOfDay().epochNanoseconds-t.epochNanoseconds!==BigInt(864e11)}catch{return!0}}createCandidateWorkBudget(){return{evaluated:0,seenOccurrences:new Set}}recordCandidateEvaluation(e,t=1){if(e.evaluated+=t,e.evaluated>this.maxCandidateEvaluations)throw Error(`Maximum candidate evaluations (${this.maxCandidateEvaluations}) exceeded in all()`)}visitTimeSlots(e,t,n,r,i,a=this.createCandidateWorkBudget()){let o=this.opts.byHour??[this.originalDtstart.hour],s=this.opts.byMinute??[this.originalDtstart.minute],c=this.opts.bySecond??[this.originalDtstart.second],l=e.toPlainDateTime(this.originalDtstart.toPlainTime()),u=(e,t,n)=>this.resolveGeneratedTime(l.with({hour:e,minute:t,second:n}));if(o.length===1&&s.length===1&&c.length===1){this.recordCandidateEvaluation(a);let e=u(o[0],s[0],c[0]);return!e||r&&Y.ZonedDateTime.compare(e,r)<0||i&&Y.ZonedDateTime.compare(e,i)>0?!0:n(e)}if(this.needsSortedTimeFallback(l.toZonedDateTime(this.generationTimeZone))){let e=[];for(let t of o)for(let n of s)for(let o of c){this.recordCandidateEvaluation(a);let s=u(t,n,o);s&&(r&&Y.ZonedDateTime.compare(s,r)<0||i&&Y.ZonedDateTime.compare(s,i)>0||e.push(s))}e.sort((e,t)=>Y.ZonedDateTime.compare(e,t));let l,d=t===1?0:e.length-1,f=t===1?e.length:-1;for(let r=d;r!==f;r+=t){let t=e[r];if(t.epochNanoseconds!==l&&(l=t.epochNanoseconds,!n(t)))return!1}return!0}let d=r?this.timeOfDayNanoseconds(r):void 0,f=i?this.timeOfDayNanoseconds(i):void 0,p=t===1?0:o.length-1,m=t===1?o.length:-1;for(let e=p;e!==m;e+=t){let r=o[e],i=t===1?0:s.length-1,l=t===1?s.length:-1;for(let e=i;e!==l;e+=t){let i=s[e],o=t===1?0:c.length-1,l=t===1?c.length:-1;for(let e=o;e!==l;e+=t){let t=c[e],o=this.timeSlotNanoseconds(this.originalDtstart,r,i,t);if(d!==void 0&&o<d||f!==void 0&&o>f)continue;this.recordCandidateEvaluation(a);let s=u(r,i,t);if(s&&!n(s))return!1}}}return!0}visitDateTimeCandidates(e,t,n,r,i,a=this.createCandidateWorkBudget()){let o=this.sortedUniqueDateCandidates(e);if(!o.length)return!0;let s=o[0],c=r?.withTimeZone(this.generationTimeZone).withCalendar(s.calendarId),l=i?.withTimeZone(this.generationTimeZone).withCalendar(s.calendarId),u=c?.toPlainDate(),d=l?.toPlainDate(),f=t===1?0:o.length-1,p=t===1?o.length:-1,m;for(let e=f;e!==p;e+=t){let r=o[e],i=r;if(u&&Y.PlainDate.compare(i,u)<0||d&&Y.PlainDate.compare(i,d)>0)continue;let s=u&&Y.PlainDate.compare(i,u)===0,f=d&&Y.PlainDate.compare(i,d)===0;if(!this.visitTimeSlots(r,t,e=>e.epochNanoseconds===m?!0:(m=e.epochNanoseconds,n(e)),s?c:void 0,f?l:void 0,a))return!1}return!0}visitPeriodCandidates(e,t,n,r,i=this.createCandidateWorkBudget()){let a=this.opts.bySetPos;if(!a?.length)return this.visitDateTimeCandidates(e,1,t,n,r,i);let o=new Set(a.filter(e=>e>0)),s=new Set(a.filter(e=>e<0).map(e=>-e)),c=new Map;if(o.size>0){let t=0;for(let e of o)t=Math.max(t,e);let n=0;this.visitDateTimeCandidates(e,1,e=>(n+=1,o.has(n)&&c.set(e.epochNanoseconds,e),n<t),void 0,void 0,i)}if(s.size>0){let t=0;for(let e of s)t=Math.max(t,e);let n=0;this.visitDateTimeCandidates(e,-1,e=>(n+=1,s.has(n)&&c.set(e.epochNanoseconds,e),n<t),void 0,void 0,i)}let l=[...c.values()].sort((e,t)=>Y.ZonedDateTime.compare(e,t));for(let e of l)if(!(n&&Y.ZonedDateTime.compare(e,n)<0)&&!(r&&Y.ZonedDateTime.compare(e,r)>0)&&!t(e))return!1;return!0}visitUtcPeriodCandidates(e,t,n,r,i){let a=this.timeSlotOffsetsMs;if(this.tzid!==`UTC`||this.originalDtstart.timeZoneId!==`UTC`||![`iso8601`,`gregory`].includes(e.calendarId)||this.opts.rscale!==void 0||this.opts.byYearDay||this.opts.byWeekNo||this.opts.byMonth?.some(e=>typeof e!=`number`)||!a?.length||!this.hasUniqueTimeSlotOffsets||!Number.isSafeInteger(this.opts.interval)||e.year<=-271821||e.year>=275760||!(this.opts.byDay||this.opts.byMonthDay))return null;let o;if(this.opts.freq===`MONTHLY`){let t=Bd(e.year,e.month,1);o=this.generateMonthlyOccurrenceDaysUtc(e.year,e.month).map(e=>t+e-1)}else if(this.opts.freq===`YEARLY`){if(this.hasOrdinalByDay&&!this.numericByMonths?.length&&(this.opts.byMonthDay||this.parsedByDayTokens?.some(e=>e.ord===0||Math.abs(e.ord)>52)))return null;o=this.generateYearlyOccurrenceDaysUtc(e.year)}else return null;let s=o.length*a.length,c=e=>o[Math.floor(e/a.length)]*Z+a[e%a.length],l=e=>{let t=0,n=s;for(;t<n;){let r=t+Math.floor((n-t)/2);c(r)<e?t=r+1:n=r}return t},u=n?l(Number(Rd(n.epochNanoseconds,Q))):0,d=r?l(Number(Ld(r.epochNanoseconds,Q))+1):s,f=n=>t(new Y.ZonedDateTime(BigInt(c(n))*Q,`UTC`,e.calendarId)),p=this.opts.bySetPos;if(p?.length){let e=0,t=0,n=new Set;for(let r of p){r>0?e=Math.max(e,r):t=Math.max(t,-r);let i=r>0?r-1:s+r;i>=0&&i<s&&n.add(i)}this.recordCandidateEvaluation(i,Math.min(s,e)+Math.min(s,t));for(let e of[...n].sort((e,t)=>e-t))if(e>=u&&e<d&&!f(e))return!1}else for(let e=u;e<d;e++)if(this.recordCandidateEvaluation(i),!f(e))return!1;return!0}nextCandidateSameDate(e){let{freq:t,interval:n=1,byHour:r,byMinute:i,bySecond:a}=this.opts;if(r?.length&&!r.includes(e.hour)){let n=r.find(t=>t>e.hour);return(n===void 0?e.add({days:1}):e).with({hour:n??r[0],minute:i?.[0]??(t===`HOURLY`?this.originalDtstart.minute:0),second:a?.[0]??(t===`SECONDLY`?0:this.originalDtstart.second)})}if(t===`HOURLY`&&r&&r.length===1)return this.applyTimeOverride(e.add({days:n}));if(t===`MINUTELY`&&i&&i.length===1){let t=e.add({hours:n});return r?.length&&!r.includes(t.hour)?this.nextCandidateSameDate(t):t.with({minute:i[0],second:a?.[0]??t.second})}if(a&&a.length>1){let t=a.indexOf(e.second);if(t!==-1&&t<a.length-1)return e.with({second:a[t+1]})}if(t===`MINUTELY`&&r&&r.length>1&&!i){let t=e.add({minutes:n});if(r.includes(t.hour))return t.with({second:a?a[0]:e.second});let i=r.find(t=>t>e.hour)||r[0];return i&&i>e.hour?e.with({hour:i,minute:0,second:a?a[0]:e.second}):this.applyTimeOverride(e.add({days:1}))}if(t===`SECONDLY`){let t=e;if(a&&a.length>0){let e=a.find(e=>e>t.second);if(e!==void 0)return t.with({second:e});t=t.with({second:a[0]}).add({minutes:1})}else t=t.add({seconds:n});if(i&&i.length>0&&(!i.includes(t.minute)||t.minute===e.minute&&t.second<e.second)){let e=i.find(e=>e>t.minute);if(e!==void 0)return t.with({minute:e,second:a?a[0]:0});t=t.with({minute:i[0],second:a?a[0]:0}).add({hours:1})}if(r&&r.length>0&&(!r.includes(t.hour)||t.hour===e.hour&&t.minute<e.minute)){let e=r.find(e=>e>t.hour);if(e!==void 0)return t.with({hour:e,minute:i?i[0]:0,second:a?a[0]:0});t=t.with({hour:r[0],minute:i?i[0]:0,second:a?a[0]:0}).add({days:1})}return t}if(i&&i.length>1){let o=i.indexOf(e.minute);if(o!==-1&&o<i.length-1)return e.with({minute:i[o+1],second:a?a[0]:e.second});if(t===`MINUTELY`&&o===i.length-1){if(r&&r.length>0){let t=r.indexOf(e.hour);return t!==-1&&t<r.length-1?e.with({hour:r[t+1],minute:i[0],second:a?a[0]:e.second}):this.applyTimeOverride(e.add({days:1}))}return e.add({hours:n}).with({minute:i[0],second:a?a[0]:e.second})}}if(r&&r.length>1){let t=r.find(t=>t>e.hour);if(t!==void 0)return e.with({hour:t,minute:i?i[0]:e.minute,second:a?a[0]:e.second})}return t===`HOURLY`&&r&&r.length>1?this.applyTimeOverride(e.add({days:1})):this.applyTimeOverride(this.rawAdvance(e))}applyTimeOverride(e){let{freq:t,byHour:n,byMinute:r,bySecond:i}=this.opts,a=t===`DAILY`||t===`WEEKLY`||t===`MONTHLY`||t===`YEARLY`;if(!n&&!r&&!i&&!a)return e;let o={};return n?o.hour=n[0]:a&&(o.hour=this.originalDtstart.hour),r?o.minute=r[0]:a&&(o.minute=this.originalDtstart.minute),i?o.second=i[0]:a&&(o.second=this.originalDtstart.second),a&&o.hour===e.hour&&o.minute===e.minute&&o.second===e.second?e:e.with(o)}computeFirst(){let e=this.originalDtstart;if(this.opts.byWeekNo?.length&&[`DAILY`,`HOURLY`,`MINUTELY`,`SECONDLY`].includes(this.opts.freq)){let t=this.opts.byWeekNo[0],n=e.year;for(;n<=e.year+10;){let r=e.with({year:n,month:1,day:1}),i=e.with({year:n,month:12,day:31}),a=!1;if(t>0){let e=52;(r.dayOfWeek===4||i.dayOfWeek===4)&&(e=53),a=t<=e}else{let e=52;(r.dayOfWeek===4||i.dayOfWeek===4)&&(e=53),a=-t<=e}if(a){let n=r.add({days:(4-r.dayOfWeek+7)%7}),a;if(t>0)a=n.subtract({days:3}).add({weeks:t-1});else{let e=r.dayOfWeek===4||i.dayOfWeek===4?53:52;a=n.subtract({days:3}).add({weeks:e+t})}if(this.opts.byDay?.length){let t=X,n=this.opts.byDay.map(e=>Hd(e)).filter(e=>e!==null).map(e=>t[e]).filter(Boolean);if(n.length){let t=n.map(e=>{let t=(e-a.dayOfWeek+7)%7;return a.add({days:t})}).sort((e,t)=>Y.ZonedDateTime.compare(e,t))[0];if(t&&Y.ZonedDateTime.compare(t,this.originalDtstart)>=0){e=t;break}}}else if(Y.ZonedDateTime.compare(a,this.originalDtstart)>=0){e=a;break}}n++}}if(this.opts.byDay?.length&&!this.opts.byWeekNo){let t=X;if(this.opts.byDay.some(e=>/^[+-]?\d/.test(e))&&this.opts.byMonth&&(this.opts.freq===`MINUTELY`||this.opts.freq===`SECONDLY`)){let t=this.opts.byMonth.filter(e=>typeof e==`number`).sort((e,t)=>e-t),n=!1;for(let r=e.year;r<=e.year+10&&!n;r++)for(let i of t){if(r===e.year&&i<e.month)continue;let t=e.with({year:r,month:i,day:1}),a=this.generateMonthlyOccurrences(t);for(let t of a)if(Y.ZonedDateTime.compare(t,e)>=0){e=t.toPlainDate().equals(e.toPlainDate())?t:this.applyTimeOverride(t.with({hour:0,minute:0,second:0})),n=!0;break}if(n)break}}else{let n,r=this.opts.byDay.map(e=>Hd(e)).filter(e=>e!==null);if(this.opts.freq===`DAILY`&&r.length===this.opts.byDay.length){let i=this.findFirstMatchingDailyStep(e.dayOfWeek,this.opts.interval,r.map(e=>t[e]));n=i===null?[]:[i*this.opts.interval]}else n=r.map(n=>(t[n]-e.dayOfWeek+7)%7);n.length&&(e=e.add({days:Math.min(...n)}))}}let{byHour:t,byMinute:n,bySecond:r}=this.opts;if(this.opts.freq===`HOURLY`&&!t&&Y.ZonedDateTime.compare(e.with({hour:0,minute:0,second:0,microsecond:0,nanosecond:0}),this.originalDtstart)>0&&(e=e.with({hour:0,minute:0,second:0,microsecond:0,nanosecond:0})),this.opts.freq===`MINUTELY`&&!n&&Y.ZonedDateTime.compare(e.with({hour:0,minute:0,second:0,microsecond:0,nanosecond:0}),this.originalDtstart)>0&&(e=e.with({hour:0,minute:0,second:0,microsecond:0,nanosecond:0})),this.opts.freq===`SECONDLY`&&this.opts.byWeekNo?.length&&!r&&Y.ZonedDateTime.compare(e.with({hour:0,minute:0,second:0,microsecond:0,nanosecond:0}),this.originalDtstart)>0&&(e=e.with({hour:0,minute:0,second:0,microsecond:0,nanosecond:0})),t||n||r){let t=this.expandByTime(e);for(let e of t)if(Y.ZonedDateTime.compare(e,this.originalDtstart)>=0)return e;e=this.applyTimeOverride(this.rawAdvance(e))}return e}matchesByDay(e){let{byDay:t,freq:n}=this.opts;if(!t)return!0;if(!this.hasOrdinalByDay)return this.simpleByDayIsoDays?.includes(e.dayOfWeek)??!1;for(let t of this.parsedByDayTokens??[]){if(n===`DAILY`&&e.dayOfWeek===t.isoDay)return!0;if(t.ord===0){if(e.dayOfWeek===t.isoDay)return!0;continue}let r=e.month,i=e.with({day:1}),a=[];for(;i.month===r;)i.dayOfWeek===t.isoDay&&a.push(i.day),i=i.add({days:1});if(a[t.ord>0?t.ord-1:a.length+t.ord]===e.day)return!0}return!1}matchesByMonth(e){let{byMonth:t}=this.opts;if(!t)return!0;let n=t.filter(e=>typeof e==`number`);return n.length===0?!0:n.includes(e.month)}matchesNumericConstraint(e,t,n){return t.some(t=>e===(t>0?t:n+t+1))}matchesByMonthDay(e){let{byMonthDay:t}=this.opts;if(!t)return!0;let n=e.with({day:1}).add({months:1}).subtract({days:1}).day;return this.matchesNumericConstraint(e.day,t,n)}matchesByHour(e){return!this.opts.byHour||this.opts.byHour.includes(e.hour)}matchesByMinute(e){let{byMinute:t}=this.opts;return t?t.includes(e.minute):!0}matchesBySecond(e){let{bySecond:t}=this.opts;return t?t.includes(e.second):!0}matchesAll(e){return this.matchesByMonth(e)&&this.matchesByWeekNo(e)&&this.matchesByYearDay(e)&&this.matchesByMonthDay(e)&&this.matchesByDay(e)&&this.matchesByHour(e)&&this.matchesByMinute(e)&&this.matchesBySecond(e)}matchesByYearDay(e){let{byYearDay:t}=this.opts;if(!t)return!0;let n=e.dayOfYear,r=e.with({month:12,day:31}).dayOfYear;return this.matchesNumericConstraint(n,t,r)}getIsoWeekInfo(e){let t=`toPlainDate`in e?e.toPlainDate():e,n=t.add({days:4-t.dayOfWeek}),r=n.year,i=t.with({year:r,month:1,day:1}),a=i.add({days:(4-i.dayOfWeek+7)%7}),o=n.since(a).days;return{week:Math.floor(o/7)+1,year:r}}matchesByWeekNo(e){let{byWeekNo:t}=this.opts;if(!t)return!0;let{week:n,year:r}=this.getIsoWeekInfo(e),i=e.with({year:r,month:1,day:1}),a=i.inLeapYear,o=i.dayOfWeek===4||a&&i.dayOfWeek===3?53:52;return t.some(e=>e>0?n===e:n===o+e+1)}hasPossibleYearDayWeekNoCombination(){if(!this.opts.byYearDay||!this.opts.byWeekNo)return!0;let e=this.originalDtstart.with({year:2e3,month:1,day:1,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0});for(let t=0;t<400;t++){let t=e.daysInYear;for(let n of this.opts.byYearDay){let r=n>0?n:t+n+1;if(r>=1&&r<=t&&this.matchesByWeekNo(e.add({days:r-1})))return!0}e=e.add({years:1})}return!1}options(){let{dtstart:e,until:t,rDate:n,exDate:r,temporal:i,...a}=this.cloneOptions();return{...a,...this.outputTemporal?{temporal:this.outputTemporal}:{},dtstart:this.toPublicDate(e),until:t?this.toPublicDate(t):void 0,rDate:n?this.toPublicDates(n):void 0,exDate:r?this.toPublicDates(r):void 0}}cloneOptions(){let{byHour:e,byMinute:t,bySecond:n,byDay:r,byMonth:i,byMonthDay:a,byYearDay:o,byWeekNo:s,bySetPos:c,rDate:l,exDate:u,...d}=this.opts;return{...d,byHour:e?[...e]:void 0,byMinute:t?[...t]:void 0,bySecond:n?[...n]:void 0,byDay:r?[...r]:void 0,byMonth:i?[...i]:void 0,byMonthDay:a?[...a]:void 0,byYearDay:o?[...o]:void 0,byWeekNo:s?[...s]:void 0,bySetPos:c?[...c]:void 0,rDate:l?[...l]:void 0,exDate:u?[...u]:void 0}}cloneUpdateOptions(e){let t={};return Object.prototype.hasOwnProperty.call(e,`byHour`)&&(t.byHour=Array.isArray(e.byHour)?[...e.byHour]:e.byHour),Object.prototype.hasOwnProperty.call(e,`byMinute`)&&(t.byMinute=Array.isArray(e.byMinute)?[...e.byMinute]:e.byMinute),Object.prototype.hasOwnProperty.call(e,`bySecond`)&&(t.bySecond=Array.isArray(e.bySecond)?[...e.bySecond]:e.bySecond),Object.prototype.hasOwnProperty.call(e,`byDay`)&&(t.byDay=Array.isArray(e.byDay)?[...e.byDay]:e.byDay),Object.prototype.hasOwnProperty.call(e,`byMonth`)&&(t.byMonth=Array.isArray(e.byMonth)?[...e.byMonth]:e.byMonth),Object.prototype.hasOwnProperty.call(e,`byMonthDay`)&&(t.byMonthDay=Array.isArray(e.byMonthDay)?[...e.byMonthDay]:e.byMonthDay),Object.prototype.hasOwnProperty.call(e,`byYearDay`)&&(t.byYearDay=Array.isArray(e.byYearDay)?[...e.byYearDay]:e.byYearDay),Object.prototype.hasOwnProperty.call(e,`byWeekNo`)&&(t.byWeekNo=Array.isArray(e.byWeekNo)?[...e.byWeekNo]:e.byWeekNo),Object.prototype.hasOwnProperty.call(e,`bySetPos`)&&(t.bySetPos=Array.isArray(e.bySetPos)?[...e.bySetPos]:e.bySetPos),Object.prototype.hasOwnProperty.call(e,`rDate`)&&(t.rDate=Array.isArray(e.rDate)?[...e.rDate]:e.rDate),Object.prototype.hasOwnProperty.call(e,`exDate`)&&(t.exDate=Array.isArray(e.exDate)?[...e.exDate]:e.exDate),t}with(t){return new e({...this.cloneOptions(),...t,...this.cloneUpdateOptions(t),tzid:t.tzid??this.opts.tzid,dtstart:t.dtstart??this.opts.dtstart})}addDtstartIfNeeded(e,t){if(this.includeDtstart&&!this.matchesAll(this.originalDtstart)){if(t&&this.isExcluded(this.originalDtstart))return!0;if(t&&!t(this.originalDtstart,e.length)||(e.push(this.originalDtstart),this.shouldBreakForCountLimit(e.length)))return!1}return!0}canUseUtcLinearFastPath(e){if(e||!this.canUseUtcCalendarFastPaths()||this.opts.rscale||(this.opts.rDate||this.opts.exDate)&&(this.originalDtstart.timeZoneId!==this.tzid||this.originalDtstart.calendarId!==`iso8601`||this.opts.byHour||this.opts.byMinute||this.opts.bySecond)||this.opts.byMonth||this.opts.byMonthDay||this.opts.byYearDay||this.opts.byWeekNo||this.opts.bySetPos)return!1;switch(this.opts.freq){case`DAILY`:return!this.hasOrdinalByDay&&(!this.opts.byHour||this.canUseEpochMillisecondsPrecisionFlag)&&(!this.opts.byMinute||this.canUseEpochMillisecondsPrecisionFlag)&&(!this.opts.bySecond||this.canUseEpochMillisecondsPrecisionFlag);case`HOURLY`:case`MINUTELY`:case`SECONDLY`:return!this.opts.byDay&&!this.opts.byHour&&!this.opts.byMinute&&!this.opts.bySecond;default:return!1}}canUseUtcWeeklyFastPath(e){return!e&&this.canUseUtcCalendarFastPaths()&&this.opts.freq===`WEEKLY`&&!this.opts.rscale&&!this.opts.rDate&&!this.opts.exDate&&!this.opts.byMonth&&!this.opts.byMonthDay&&!this.opts.byYearDay&&!this.opts.byWeekNo&&!this.opts.bySetPos&&(!this.opts.byHour||this.canUseEpochMillisecondsPrecisionFlag)&&(!this.opts.byMinute||this.canUseEpochMillisecondsPrecisionFlag)&&(!this.opts.bySecond||this.canUseEpochMillisecondsPrecisionFlag)&&!this.hasOrdinalByDay}canUseUtcMonthlyFastPath(e){return!e&&this.canUseUtcCalendarFastPaths()&&this.opts.freq===`MONTHLY`&&!this.opts.rscale&&!this.opts.rDate&&!this.opts.exDate&&!this.opts.byYearDay&&!this.opts.byWeekNo&&this.canUseEpochMillisecondsPrecisionFlag&&this.hasSingleExpandedTimeSlot()&&!!(this.opts.byDay||this.opts.byMonthDay)}utcZdtFromEpochNanoseconds(e){return new Y.ZonedDateTime(e,`UTC`,this.originalDtstart.calendarId)}utcZdtFromEpochMilliseconds(e){return this.utcZdtFromEpochNanoseconds(BigInt(e)*Q)}canUseUtcCalendarFastPaths(){return this.maxCandidateEvaluations===1e6&&this.tzid===`UTC`&&this.originalDtstart.timeZoneId===this.tzid&&[`iso8601`,`gregory`].includes(this.originalDtstart.calendarId)}canUseUtcEpochMillisecondsPrecision(){return this.canUseEpochMillisecondsPrecisionFlag}buildTimeSlotOffsetsMs(){if(!this.canUseEpochMillisecondsPrecisionFlag)return;let e=this.opts.byHour??[this.originalDtstart.hour],t=this.opts.byMinute??[this.originalDtstart.minute],n=this.opts.bySecond??[this.originalDtstart.second],r=this.originalDtstart.millisecond,i=[];for(let a of e)for(let e of t)for(let t of n)i.push(((a*60+e)*60+t)*Sd+r);return i}createNumericQueryPlan(e,t,n,r){let i=n(0),a=n(t-1);if(!i||!a||!zd(i.epochMilliseconds)||!zd(a.epochMilliseconds)||i.epochMilliseconds>a.epochMilliseconds)return null;let o=(e,t,i)=>{if(r)return Math.max(0,Math.min(i,r(e,t)));let a=0,o=i;for(;a<o;){let r=a+Math.floor((o-a)/2),i=n(r);if(!i){o=r;continue}let s=BigInt(i.epochMilliseconds)*Q;(t?s>e:s>=e)?o=r:a=r+1}return a},s=this.opts.until?.epochNanoseconds,c=s===void 0?t:o(s,!0,t);return{kind:e,count:c,maximumCount:t,select:e=>!Number.isSafeInteger(e)||e<0||e>=t?null:n(e),lowerBound:(e,t)=>o(e,t,c)}}buildFixedStepNumericQueryPlan(e){let t;switch(this.opts.freq){case`HOURLY`:t=wd;break;case`MINUTELY`:t=Cd;break;case`SECONDLY`:t=Sd;break;default:return null}if(![`UTC`,`Etc/UTC`,`Etc/GMT`].includes(this.tzid)&&!/^[-+]\d{2}:?\d{2}(?::?\d{2})?$/.test(this.tzid)&&this.opts.freq===`HOURLY`&&this.opts.interval===1)return null;let n=this.originalDtstart.epochMilliseconds,r=t*this.opts.interval;if(!Number.isSafeInteger(r)||r<=0)return null;let i=e=>{let t=n+e*r;return zd(t)?{epochMilliseconds:t,periodIndex:e,occurrenceIndex:e}:null},a=BigInt(n)*Q,o=BigInt(r)*Q,s=BigInt(e);return this.createNumericQueryPlan(`fixed-step`,e,i,(t,n)=>{let r=t-a,i=n?Ld(r,o)+1n:Rd(r,o);return i<=0n?0:i>=s?e:Number(i)})}resolveNumericWallMilliseconds(e){if(!zd(e))return null;if(this.tzid===`UTC`)return e;let t=this.getZoneResolver().epochMsForWall(e);return t.pushed||!zd(t.epochMs)?null:t.epochMs}numericQueryGapHazard(e,t){if(this.tzid===`UTC`)return!1;let n=this.originalDtstart.epochMilliseconds;return 200*366*Z,t-n>632448e7?!0:this.getZoneResolver().timeOfDayMayHitGap(e,n-Z,t+Z)}buildDailyNumericQueryPlan(e){let t=this.opts.interval,n=this.originalDtstart.epochMilliseconds,r=this.tzid===`UTC`?n:this.wallMsOf(this.originalDtstart),i=Math.floor(r/Z),a=Vd(i),o=Fd(this.simpleByDayIsoDays);if(!(this.opts.byHour||this.opts.byMinute||this.opts.bySecond)){let n=r-i*Z,s=this.simpleByDayIsoDays?.length?this.findFirstMatchingDailyStep(a,t,this.simpleByDayIsoDays):0;if(s===null)return null;let c=7/Pd(t,7),l=[];for(let e=0;e<c;e++)Id(o,$(a,(s+e)*t))&&l.push(e);if(l.length===0)return null;let u=this.createNumericQueryPlan(`daily`,e,e=>{let n=Math.floor(e/l.length),i=e%l.length,a=n*c+l[i],o=(s+a)*t;if(!Number.isSafeInteger(a)||!Number.isSafeInteger(o))return null;let u=r+o*Z,d=this.resolveNumericWallMilliseconds(u);return d===null?null:{epochMilliseconds:d,periodIndex:a,occurrenceIndex:e}}),d=u?.select(e-1);return d&&this.numericQueryGapHazard(n,d.epochMilliseconds)?null:u}let s=this.timeSlotOffsetsMs;if(!s?.length||!this.hasUniqueTimeSlotOffsets)return null;let c=this.simpleByDayIsoDays?.length?this.findFirstMatchingDailyStep(a,t,this.simpleByDayIsoDays):0;if(c===null)return null;let l=c*t,u=i+l,d=$(a,l),f=7/Pd(t,7),p=[];if(Id(o,d))for(let e of s){let t=this.resolveNumericWallMilliseconds(u*Z+e);if(t===null)return null;t>=n&&p.push({epochMilliseconds:t,periodIndex:0,occurrenceIndex:p.length})}let m=[];for(let e=0;e<f;e++)if(Id(o,$(d,(1+e)*t)))for(let t of s)m.push({periodOffset:e,timeSlotOffset:t});if(p.length===0&&m.length===0)return null;let h=this.createNumericQueryPlan(`daily`,e,e=>{if(e<p.length)return{...p[e],occurrenceIndex:e};if(m.length===0)return null;let n=e-p.length,r=Math.floor(n/m.length),a=m[n%m.length],o=1+r*f+a.periodOffset,s=l+o*t;if(!Number.isSafeInteger(o)||!Number.isSafeInteger(s))return null;let c=(i+s)*Z+a.timeSlotOffset,u=this.resolveNumericWallMilliseconds(c);return u===null?null:{epochMilliseconds:u,periodIndex:o,occurrenceIndex:e}}),g=h?.select(e-1);return g&&s.some(e=>this.numericQueryGapHazard(e,g.epochMilliseconds))?null:h}buildWeeklyNumericQueryPlan(e){let t=this.timeSlotOffsetsMs;if(!t?.length||!this.hasUniqueTimeSlotOffsets)return null;let n=this.originalDtstart.epochMilliseconds,r=this.tzid===`UTC`?n:this.wallMsOf(this.originalDtstart),i=Math.floor(r/Z),a=Vd(i),o=X[Hd(this.opts.wkst||`MO`)??`MO`]??1,s=(this.opts.byDay?[...this.allByDayIsoDays??[]]:[a]).map(e=>(e-o+7)%7).sort((e,t)=>e-t);if(s.length===0)return null;let c=i-(a-o+7)%7,l=s.flatMap(e=>t.map(t=>({dayOffset:e,timeSlotOffset:t}))),u=[];for(let e of l){let t=(c+e.dayOffset)*Z+e.timeSlotOffset,r=this.resolveNumericWallMilliseconds(t);if(r===null)return null;r>=n&&u.push({epochMilliseconds:r,periodIndex:0,occurrenceIndex:u.length})}let d=this.createNumericQueryPlan(`weekly`,e,e=>{if(e<u.length)return{...u[e],occurrenceIndex:e};let t=e-u.length,n=1+Math.floor(t/l.length),r=l[t%l.length],i=n*this.opts.interval*7;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(i))return null;let a=(c+i+r.dayOffset)*Z+r.timeSlotOffset,o=this.resolveNumericWallMilliseconds(a);return o===null?null:{epochMilliseconds:o,periodIndex:n,occurrenceIndex:e}}),f=d?.select(e-1);return f&&t.some(e=>this.numericQueryGapHazard(e,f.epochMilliseconds))?null:d}buildMonthlyNumericQueryPlan(e){let t=this.opts.interval,n=this.timeSlotOffsetsMs;if(!n?.length||!this.hasUniqueTimeSlotOffsets||this.opts.byMonth?.some(e=>typeof e!=`number`)||this.opts.bySetPos&&new Set(this.opts.bySetPos).size!==this.opts.bySetPos.length)return null;let r=this.originalDtstart.epochMilliseconds,i=this.originalDtstart.year*12+(this.originalDtstart.month-1),a=e=>{let n=e*t,r=i+n;if(!Number.isSafeInteger(n)||!Number.isSafeInteger(r))return null;let{year:a,month:o}=this.monthIndexToYearMonth(r);return this.generateMonthlyOccurrenceEpochsUtc(a,o)},o=a(0);if(!o)return null;let s=[];for(let e of o){let t=this.resolveNumericWallMilliseconds(e);if(t===null)return null;t>=r&&s.push({epochMilliseconds:t,periodIndex:0,occurrenceIndex:s.length})}let c=4800/Pd(t,4800),l=Math.max(0,e-s.length),u=[0];for(let e=0;e<c&&u.at(-1)<l;e++){let t=a(1+e);if(!t)return null;u.push(u[e]+t.length)}let d=u.length-1===c,f=u.at(-1);if(f===0&&s.length<e)return null;let p=this.createNumericQueryPlan(`monthly`,e,e=>{if(e<s.length)return{...s[e],occurrenceIndex:e};if(f===0)return null;let t=e-s.length,n=d?Math.floor(t/f):0,r=d?t%f:t;if(r>=f)return null;let i=1,o=u.length-1;for(;i<o;){let e=i+Math.floor((o-i)/2);u[e]>r?o=e:i=e+1}let l=i-1,p=1+n*c+l;if(!Number.isSafeInteger(p))return null;let m=a(p);if(!m)return null;let h=m[r-u[l]];if(h===void 0)return null;let g=this.resolveNumericWallMilliseconds(h);return g===null?null:{epochMilliseconds:g,periodIndex:p,occurrenceIndex:e}}),m=p?.select(e-1);return m&&n.some(e=>this.numericQueryGapHazard(e,m.epochMilliseconds))?null:p}generateYearlyOccurrenceDaysUtc(e){let t=!!(this.opts.byDay||this.opts.byMonthDay);this.numericByMonths?.length;let n=this.numericByMonths?.length?[...this.numericByMonths].sort((e,t)=>e-t):t?[1,2,3,4,5,6,7,8,9,10,11,12]:[this.originalDtstart.month],r=[];if(this.hasOrdinalByDay&&!this.numericByMonths?.length){let t=this.isGregorianLeapYear(e)?366:365,n=this.gregorianIsoDayOfWeek(e,1,1),i=$(n,t-1),a=new Set;for(let e of this.parsedByDayTokens??[]){if(e.ord===0)continue;let r=e.ord>0?1+(e.isoDay-n+7)%7+7*(e.ord-1):t-(i-e.isoDay+7)%7+7*(e.ord+1);r>=1&&r<=t&&a.add(r)}for(let t of[...a].sort((e,t)=>e-t)){let n=t,i=1;for(;n>this.daysInGregorianMonth(e,i);)n-=this.daysInGregorianMonth(e,i),i+=1;r.push({month:i,day:n})}}else for(let i of n){let n;n=t?this.generateMonthlyOccurrenceDaysUtc(e,i):this.originalDtstart.day<=this.daysInGregorianMonth(e,i)?[this.originalDtstart.day]:[];for(let e of n)r.push({month:i,day:e})}return r.map(({month:t,day:n})=>Bd(e,t,n))}generateYearlyOccurrenceEpochsUtc(e,t=!0){let n=this.timeSlotOffsetsMs;if(!n?.length)return[];let r=[];for(let t of this.generateYearlyOccurrenceDaysUtc(e)){let e=t*Z;if(!zd(e))return[];for(let t of n)r.push(e+t)}if(r.sort((e,t)=>e-t),!t||!this.opts.bySetPos?.length)return r;let i=this.applyBySetPosToSortedList(r).sort((e,t)=>e-t);return i.filter((e,t)=>t===0||e!==i[t-1])}yearlyCandidateEvaluationCountUtc(e){let t=this.generateYearlyOccurrenceEpochsUtc(e,!1).length,n=this.opts.bySetPos;if(!n?.length)return t;let r=0,i=0;for(let e of n)e>0?r=Math.max(r,e):i=Math.max(i,-e);return Math.min(t,r)+Math.min(t,i)}buildYearlyNumericQueryPlan(e){let t=this.opts.interval,n=this.timeSlotOffsetsMs;if(!n?.length||!this.hasUniqueTimeSlotOffsets||this.opts.byMonth?.some(e=>typeof e!=`number`)||this.opts.byYearDay||this.opts.byWeekNo)return null;let r=!!(this.opts.byDay||this.opts.byMonthDay),i=!!this.opts.byMonth&&!r;if(!this.opts.byMonth&&!r&&n.length!==1||i&&(n.length!==1||this.opts.bySetPos)||this.hasOrdinalByDay&&!this.numericByMonths?.length&&(this.opts.byMonthDay||this.parsedByDayTokens?.some(e=>e.ord===0)))return null;let a=this.originalDtstart.epochMilliseconds,o=this.originalDtstart.year,s=e=>{let n=e*t,r=o+n;return!Number.isSafeInteger(n)||!Number.isSafeInteger(r)?null:this.generateYearlyOccurrenceEpochsUtc(r)},c=s(0);if(!c)return null;let l=[];for(let e of c){let t=this.resolveNumericWallMilliseconds(e);if(t===null)return null;t>=a&&l.push({epochMilliseconds:t,periodIndex:0,occurrenceIndex:l.length})}let u=400/Pd(t,400),d=Math.max(0,e-l.length),f=[0],p=[0];for(let e=0;e<u&&f.at(-1)<d;e++){let n=s(1+e);if(!n)return null;f.push(f[e]+n.length);let r=o+(1+e)*t;p.push(p[e]+this.yearlyCandidateEvaluationCountUtc(r))}let m=f.length-1===u,h=f.at(-1);if(h===0&&l.length<e)return null;if(r){let e=this.yearlyCandidateEvaluationCountUtc(o);if(m&&d>0){let t=Math.floor(d/h),n=d%h;if(e+=t*p.at(-1),n>0){let t=1;for(;f[t]<n;)t+=1;e+=p[t]}}else e+=p.at(-1);if(e>this.maxCandidateEvaluations)return null}let g=this.createNumericQueryPlan(`yearly`,e,e=>{if(e<l.length)return{...l[e],occurrenceIndex:e};if(h===0)return null;let t=e-l.length,n=m?Math.floor(t/h):0,r=m?t%h:t;if(r>=h)return null;let i=1,a=f.length-1;for(;i<a;){let e=i+Math.floor((a-i)/2);f[e]>r?a=e:i=e+1}let o=i-1,c=1+n*u+o;if(!Number.isSafeInteger(c))return null;let d=s(c);if(!d)return null;let p=d[r-f[o]];if(p===void 0)return null;let g=this.resolveNumericWallMilliseconds(p);return g===null?null:{epochMilliseconds:g,periodIndex:c,occurrenceIndex:e}}),_=g?.select(e-1);return _&&n.some(e=>this.numericQueryGapHazard(e,_.epochMilliseconds))?null:g}buildNumericQueryPlan(){let e=this.opts.count,t=this.opts.interval;if(e===void 0||!Number.isSafeInteger(e)||e<=0||!Number.isSafeInteger(t)||t<=0||!Number.isSafeInteger(this.maxIterations)||this.maxIterations<=0||this.maxCandidateEvaluations!==1e6||this.includeDtstart||this.opts.rscale!==void 0||!this.canUseEpochMillisecondsPrecisionFlag||this.originalDtstart.timeZoneId!==this.tzid||![`iso8601`,`gregory`].includes(this.originalDtstart.calendarId))return null;let n=!!(this.opts.byMonth||this.opts.byMonthDay||this.opts.byYearDay||this.opts.byWeekNo||this.opts.bySetPos);switch(this.opts.freq){case`HOURLY`:case`MINUTELY`:case`SECONDLY`:return n||this.opts.byDay||this.opts.byHour||this.opts.byMinute||this.opts.bySecond?null:this.buildFixedStepNumericQueryPlan(e);case`DAILY`:return n||this.hasOrdinalByDay||!this.hasUniqueTimeSlotOffsets?null:this.buildDailyNumericQueryPlan(e);case`WEEKLY`:return n||this.hasOrdinalByDay||!this.hasUniqueTimeSlotOffsets?null:this.buildWeeklyNumericQueryPlan(e);case`MONTHLY`:return this.opts.byYearDay||this.opts.byWeekNo||!(this.opts.byDay||this.opts.byMonthDay)||!this.hasUniqueTimeSlotOffsets?null:this.buildMonthlyNumericQueryPlan(e);case`YEARLY`:return this.buildYearlyNumericQueryPlan(e);default:return null}}getNumericQueryPlan(){if(this.numericQueryPlanCache!==void 0)return this.numericQueryPlanCache;try{this.numericQueryPlanCache=this.buildNumericQueryPlan(),this.numericQueryPlanCache&&this.tzid!==`UTC`&&this.resolveNumericWallMilliseconds(this.wallMsOf(this.originalDtstart))!==this.originalDtstart.epochMilliseconds&&(this.numericQueryPlanCache=null)}catch{this.numericQueryPlanCache=null}return this.numericQueryPlanCache}findFirstMatchingDailyStep(e,t,n){let r=e;for(let e=0;e<7;e++){if(n.includes(r))return e;r=$(r,t)}return null}allUtcFastPath(e){if(this.canUseUtcLinearFastPath(e))switch(this.opts.freq){case`DAILY`:return this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this.hasUniqueTimeSlotOffsets?this._allUtcDailyExpanded():null:this._allUtcDailySimple();case`HOURLY`:return this._allUtcFixedStepSimple(Ad*BigInt(this.opts.interval));case`MINUTELY`:return this._allUtcFixedStepSimple(kd*BigInt(this.opts.interval));case`SECONDLY`:return this._allUtcFixedStepSimple(Od*BigInt(this.opts.interval))}return this.canUseUtcMonthlyFastPath(e)?this._allUtcMonthlyByDayOrMonthDay():this.canUseUtcWeeklyFastPath(e)?this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this.hasUniqueTimeSlotOffsets?this._allUtcWeeklyExpanded():null:this._allUtcWeeklySimple():null}_allUtcFixedStepSimple(e){let t=[];if(!this.addDtstartIfNeeded(t))return t;let n=0;if(this.canUseUtcEpochMillisecondsPrecision()){let r=this.originalDtstart.epochMilliseconds,i=Number(e/Q),a=this.opts.until?.epochMilliseconds;for(;;){if(++n>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(a!==void 0&&r>a||(t.push(this.utcZdtFromEpochMilliseconds(r)),this.shouldBreakForCountLimit(t.length)))break;r+=i}return t}let r=this.originalDtstart.epochNanoseconds,i=this.opts.until?.epochNanoseconds;for(;;){if(++n>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(i!==void 0&&r>i||(t.push(this.utcZdtFromEpochNanoseconds(r)),this.shouldBreakForCountLimit(t.length)))break;r+=e}return t}_allUtcDailySimple(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.opts.interval,n=this.simpleByDayIsoDays,r=0;if(this.canUseUtcEpochMillisecondsPrecision()){let i=t*Z,a=this.opts.until?.epochMilliseconds,o=this.originalDtstart.epochMilliseconds,s=this.originalDtstart.dayOfWeek;if(n?.length){let r=this.findFirstMatchingDailyStep(s,t,n);if(r===null)return e;o+=r*i,s=$(s,r*t)}for(;;){if(++r>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(a!==void 0&&o>a||(!n||n.includes(s))&&(e.push(this.utcZdtFromEpochMilliseconds(o)),this.shouldBreakForCountLimit(e.length)))break;o+=i,s=$(s,t)}return e}let i=BigInt(t)*jd,a=this.opts.until?.epochNanoseconds,o=this.originalDtstart.epochNanoseconds,s=this.originalDtstart.dayOfWeek;if(n?.length){let r=this.findFirstMatchingDailyStep(s,t,n);if(r===null)return e;o+=BigInt(r)*i,s=$(s,r*t)}for(;;){if(++r>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(a!==void 0&&o>a||(!n||n.includes(s))&&(e.push(this.utcZdtFromEpochNanoseconds(o)),this.shouldBreakForCountLimit(e.length)))break;o+=i,s=$(s,t)}return e}_allUtcDailyExpanded(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.timeSlotOffsetsMs,n=this.originalDtstart.epochMilliseconds,r=this.opts.until?.epochMilliseconds,i=this.opts.interval,a=this.simpleByDayIsoDays,o=Math.floor(n/Z),s=this.originalDtstart.dayOfWeek;if(a?.length){let t=this.findFirstMatchingDailyStep(s,i,a);if(t===null)return e;let n=t*i;o+=n,s=$(s,n)}let c=0;for(;;){if(++c>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(!a||a.includes(s)){let i=o*Z;for(let a of t){let t=i+a;if(!(t<n)&&(r!==void 0&&t>r||(e.push(this.utcZdtFromEpochMilliseconds(t)),this.shouldBreakForCountLimit(e.length))))return e}}o+=i,s=$(s,i)}}_allUtcWeeklySimple(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.originalDtstart,n=X[Hd(this.opts.wkst||`MO`)??`MO`]??1,r=(this.opts.byDay?[...this.allByDayIsoDays??[]]:[t.dayOfWeek]).map(e=>(e-n+7)%7).sort((e,t)=>e-t),i=(t.dayOfWeek-n+7)%7,a=0;if(this.canUseUtcEpochMillisecondsPrecision()){let n=t.epochMilliseconds,o=this.opts.until?.epochMilliseconds,s=this.opts.interval*Td,c=n-i*Z;for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let t of r){let r=c+t*Z;if(!(r<n)&&(o!==void 0&&r>o||(e.push(this.utcZdtFromEpochMilliseconds(r)),this.shouldBreakForCountLimit(e.length))))return e}c+=s}}let o=t.epochNanoseconds,s=this.opts.until?.epochNanoseconds,c=BigInt(this.opts.interval)*Md,l=o-BigInt(i)*jd;for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let t of r){let n=l+BigInt(t)*jd;if(!(n<o)&&(s!==void 0&&n>s||(e.push(this.utcZdtFromEpochNanoseconds(n)),this.shouldBreakForCountLimit(e.length))))return e}l+=c}}_allUtcWeeklyExpanded(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.originalDtstart,n=t.epochMilliseconds,r=Math.floor(n/Z),i=this.opts.until?.epochMilliseconds,a=this.timeSlotOffsetsMs,o=X[Hd(this.opts.wkst||`MO`)??`MO`]??1,s=(this.opts.byDay?[...this.allByDayIsoDays??[]]:[t.dayOfWeek]).map(e=>(e-o+7)%7).sort((e,t)=>e-t),c=(t.dayOfWeek-o+7)%7,l=this.opts.interval*7,u=r-c,d=0;for(;;){if(++d>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let t of s){let r=(u+t)*Z;for(let t of a){let a=r+t;if(!(a<n)&&(i!==void 0&&a>i||(e.push(this.utcZdtFromEpochMilliseconds(a)),this.shouldBreakForCountLimit(e.length))))return e}}u+=l}}hasSingleExpandedTimeSlot(){if(this.timeSlotOffsetsMs)return this.timeSlotOffsetsMs.length===1;let e=this.opts.byHour??[this.originalDtstart.hour],t=this.opts.byMinute??[this.originalDtstart.minute],n=this.opts.bySecond??[this.originalDtstart.second];return e.length===1&&t.length===1&&n.length===1}buildMonthlyOccurrenceOnDay(e,t){let n=e.day===t?e:e.with({day:t});return this.applyTimeOverride(n)}applyBySetPosToSortedList(e){let{bySetPos:t}=this.opts;if(!t||!t.length||e.length===0)return e;let n=[],r=e.length;for(let i of t){let t=i>0?i-1:r+i;t>=0&&t<r&&n.push(e[t])}return n}generateMonthlyOccurrenceDays(e){let{byDay:t,byMonth:n,byMonthDay:r}=this.opts,i=e.day===1?e:e.with({day:1});if(n&&!n.includes(e.month))return[];let a=i.add({months:1}).subtract({days:1}).day,o=[];if(r&&r.length>0&&(o=r.map(e=>e>0?e:a+e+1).filter(e=>e>=1&&e<=a),o=[...new Set(o)].sort((e,t)=>e-t)),!t&&r&&r.length>0)return o;if(!t)return[e.day];let s=this.parsedByDayTokens;if(!s?.length)return[];let c=i.dayOfWeek,l=(c-1+a-1)%7+1,u=new Set;for(let{ord:e,isoDay:t}of s)if(e===0){let e=1+(t-c+7)%7;for(;e<=a;)u.add(e),e+=7}else{let n;n=e>0?1+(t-c+7)%7+7*(e-1):a-(l-t+7)%7+7*(e+1),n>=1&&n<=a&&u.add(n)}let d=[...u].sort((e,t)=>e-t);if(r&&r.length>0){if(o.length===0)return[];let e=new Set(o);d=d.filter(t=>e.has(t))}return d}isGregorianLeapYear(e){return e%4==0&&(e%100!=0||e%400==0)}daysInGregorianMonth(e,t){return t===2&&this.isGregorianLeapYear(e)?29:Ed[t-1]}gregorianIsoDayOfWeek(e,t,n){let r=e;t<3&&--r;let i=((r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Dd[t-1]+n)%7+7)%7;return i===0?7:i}monthIndexToYearMonth(e){let t=Math.floor(e/12);return{year:t,month:e-t*12+1}}generateMonthlyOccurrenceDaysUtc(e,t){if(this.numericByMonths&&this.numericByMonths.length>0&&!this.numericByMonths.includes(t))return[];let n=this.opts.byMonthDay,r=this.opts.byDay,i=this.daysInGregorianMonth(e,t),a=[];if(n&&n.length>0&&(a=n.map(e=>e>0?e:i+e+1).filter(e=>e>=1&&e<=i),a=[...new Set(a)].sort((e,t)=>e-t)),!r&&n&&n.length>0)return a;if(!r){let e=this.originalDtstart.day;return e>=1&&e<=i?[e]:[]}let o=this.parsedByDayTokens;if(!o?.length)return[];let s=this.gregorianIsoDayOfWeek(e,t,1),c=$(s,i-1),l=new Set;for(let{ord:e,isoDay:t}of o)if(e===0){let e=1+(t-s+7)%7;for(;e<=i;)l.add(e),e+=7}else{let n;n=e>0?1+(t-s+7)%7+7*(e-1):i-(c-t+7)%7+7*(e+1),n>=1&&n<=i&&l.add(n)}let u=[...l].sort((e,t)=>e-t);if(n&&n.length>0){if(a.length===0)return[];let e=new Set(a);u=u.filter(t=>e.has(t))}return u}generateMonthlyOccurrenceEpochsUtc(e,t){let n=this.generateMonthlyOccurrenceDaysUtc(e,t);if(n.length===0)return[];let r=Bd(e,t,1)*Z;if(!zd(r))return[];let i=this.timeSlotOffsetsMs??[0];if(this.opts.bySetPos&&this.opts.bySetPos.length>0){if(i.length===1){let e=this.applyBySetPosToSortedList(n).sort((e,t)=>e-t),t=i[0];return e.map(e=>r+(e-1)*Z+t)}let e=[];for(let t of n){let n=r+(t-1)*Z;for(let t of i)e.push(n+t)}return this.applyBySetPosToSortedList(e).sort((e,t)=>e-t)}let a=[];for(let e of n){let t=r+(e-1)*Z;for(let e of i)a.push(t+e)}return a}_allUtcMonthlyByDayOrMonthDay(){let e=[],t=this.originalDtstart.epochMilliseconds,n=this.opts.until?.epochMilliseconds,r=0;if(!this.addDtstartIfNeeded(e))return e;let i=this.opts.until?.withTimeZone(this.tzid).withCalendar(`iso8601`),a=i?i.year*12+i.month-1:void 0,o=this.originalDtstart.year*12+(this.originalDtstart.month-1);for(;;){if(a!==void 0&&o>a)return e;if(++r>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let{year:i,month:s}=this.monthIndexToYearMonth(o),c=this.generateMonthlyOccurrenceEpochsUtc(i,s);for(let r of c)if(!(r<t)&&(n!==void 0&&r>n||(e.push(this.utcZdtFromEpochMilliseconds(r)),this.shouldBreakForCountLimit(e.length))))return e;o+=this.opts.interval}}getZoneResolver(){return this.zoneResolver??=hd(this.tzid)}zdtFromEpochMs(e){if(sd)return new Y.ZonedDateTime(BigInt(e)*Q,this.tzid,this.originalDtstart.calendarId);let t=this.emitAnchorZdt;return t?t.add({milliseconds:e-t.epochMilliseconds}):(t=this.emitAnchorZdt=new Y.ZonedDateTime(BigInt(e)*Q,this.tzid,this.originalDtstart.calendarId),t)}wallMsOf(e){return e.epochMilliseconds+e.offsetNanoseconds/1e6}canUseTzEpochFastPaths(e){return!(e||this.maxCandidateEvaluations!==1e6||this.tzid===`UTC`||this.originalDtstart.timeZoneId!==this.tzid||this.opts.freq===`YEARLY`||this.opts.rscale||![`iso8601`,`gregory`].includes(this.originalDtstart.calendarId)||!this.canUseEpochMillisecondsPrecisionFlag||this.resolveNumericWallMilliseconds(this.wallMsOf(this.originalDtstart))!==this.originalDtstart.epochMilliseconds)}tzFastPathGapHazard(e){let t=this.originalDtstart.epochMilliseconds,n;if(this.opts.until)n=this.opts.until.epochMilliseconds;else if(this.opts.count!==void 0){let e=this.opts.count*this.opts.interval,r;switch(this.opts.freq){case`DAILY`:r=e*7*Z;break;case`WEEKLY`:r=e*Td;break;default:r=e*(this.numericByMonths?.length?Math.ceil(12/this.numericByMonths.length):1)*31*Z;break}n=t+r+30*Z}else return!0;return 150*366*Z,n-t>474336e7?!0:this.getZoneResolver().timeOfDayMayHitGap(e,t-Z,n+Z)}allTzEpochFastPath(e){if(!this.canUseTzEpochFastPaths(e))return null;let t=!this.opts.byMonth&&!this.opts.byMonthDay&&!this.opts.byYearDay&&!this.opts.byWeekNo&&!this.opts.bySetPos;if(t)switch(this.opts.freq){case`DAILY`:if(!this.hasOrdinalByDay)return this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this.hasUniqueTimeSlotOffsets?this._allTzDailyExpanded():null:this._allTzDailySimple();break;case`HOURLY`:case`MINUTELY`:case`SECONDLY`:if(!this.opts.byDay&&!this.opts.byHour&&!this.opts.byMinute&&!this.opts.bySecond){let e=this.opts.freq===`HOURLY`?wd:this.opts.freq===`MINUTELY`?Cd:Sd;return this._allTzFixedStepSimple(e*this.opts.interval)}break}return this.opts.freq===`MONTHLY`&&!this.opts.byYearDay&&!this.opts.byWeekNo&&this.hasSingleExpandedTimeSlot()&&(this.opts.byDay||this.opts.byMonthDay)?this._allTzMonthlyByDayOrMonthDay():this.opts.freq===`WEEKLY`&&t&&!this.hasOrdinalByDay&&this.hasUniqueTimeSlotOffsets?this.opts.byHour||this.opts.byMinute||this.opts.bySecond?this._allTzWeeklyExpanded():this._allTzWeeklySimple():null}_allTzDailySimple(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.getZoneResolver(),n=this.wallMsOf(this.originalDtstart),r=Math.floor(n/Z),i=n-r*Z;if(this.tzFastPathGapHazard(i))return null;let a=this.opts.interval,o=this.simpleByDayIsoDays,s=this.opts.until?.epochMilliseconds,c=Vd(r);if(o?.length){let t=this.findFirstMatchingDailyStep(c,a,o);if(t===null)return e;r+=t*a,c=$(c,t*a)}let l=0;for(;;){if(++l>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(!o||o.includes(c)){let n=t.epochMsForWall(r*Z+i);if(n.pushed)return null;if(s!==void 0&&n.epochMs>s||(e.push(this.zdtFromEpochMs(n.epochMs)),this.shouldBreakForCountLimit(e.length)))break}r+=a,c=$(c,a)}return e}_allTzDailyExpanded(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.getZoneResolver(),n=this.originalDtstart.epochMilliseconds,r=this.wallMsOf(this.originalDtstart),i=this.timeSlotOffsetsMs;for(let e of i)if(this.tzFastPathGapHazard(e))return null;let a=this.opts.interval,o=this.simpleByDayIsoDays,s=this.opts.until?.epochMilliseconds,c=Math.floor(r/Z),l=Vd(c);if(o?.length){let t=this.findFirstMatchingDailyStep(l,a,o);if(t===null)return e;let n=t*a;c+=n,l=$(l,n)}let u=0;for(;;){if(++u>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(!o||o.includes(l)){let r=c*Z;for(let a of i){let i=t.epochMsForWall(r+a);if(i.pushed)return null;if(!(i.epochMs<n)&&(s!==void 0&&i.epochMs>s||(e.push(this.zdtFromEpochMs(i.epochMs)),this.shouldBreakForCountLimit(e.length))))return e}}c+=a,l=$(l,a)}}_allTzFixedStepSimple(e){let t=[];if(!this.addDtstartIfNeeded(t))return t;let n=this.getZoneResolver(),r=this.opts.until?.epochMilliseconds,i=this.opts.freq===`HOURLY`&&this.opts.interval===1,a=e=>{let t=e+n.offsetMsAt(e);return Math.floor((t%Z+Z)%Z/wd)},o=this.originalDtstart.epochMilliseconds,s=0;for(;;){if(++s>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(r!==void 0&&o>r||(t.push(this.zdtFromEpochMs(o)),this.shouldBreakForCountLimit(t.length)))break;let n=o+e;i&&a(n)===a(o)&&(n+=e),o=n}return t}_allTzWeeklySimple(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.getZoneResolver(),n=this.originalDtstart,r=n.epochMilliseconds,i=this.wallMsOf(n),a=Math.floor(i/Z),o=i-a*Z;if(this.tzFastPathGapHazard(o))return null;let s=Vd(a),c=X[Hd(this.opts.wkst||`MO`)??`MO`]??1,l=(this.opts.byDay?[...this.allByDayIsoDays??[]]:[s]).map(e=>(e-c+7)%7).sort((e,t)=>e-t),u=(s-c+7)%7,d=this.opts.until?.epochMilliseconds,f=this.opts.interval*7,p=a-u,m=0;for(;;){if(++m>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let n of l){let i=t.epochMsForWall((p+n)*Z+o);if(i.pushed)return null;if(!(i.epochMs<r)&&(d!==void 0&&i.epochMs>d||(e.push(this.zdtFromEpochMs(i.epochMs)),this.shouldBreakForCountLimit(e.length))))return e}p+=f}}_allTzWeeklyExpanded(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.getZoneResolver(),n=this.originalDtstart,r=n.epochMilliseconds,i=this.wallMsOf(n),a=Math.floor(i/Z),o=this.timeSlotOffsetsMs;for(let e of o)if(this.tzFastPathGapHazard(e))return null;let s=Vd(a),c=X[Hd(this.opts.wkst||`MO`)??`MO`]??1,l=(this.opts.byDay?[...this.allByDayIsoDays??[]]:[s]).map(e=>(e-c+7)%7).sort((e,t)=>e-t),u=(s-c+7)%7,d=this.opts.until?.epochMilliseconds,f=this.opts.interval*7,p=a-u,m=0;for(;;){if(++m>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);for(let n of l){let i=(p+n)*Z;for(let n of o){let a=t.epochMsForWall(i+n);if(a.pushed)return null;if(!(a.epochMs<r)&&(d!==void 0&&a.epochMs>d||(e.push(this.zdtFromEpochMs(a.epochMs)),this.shouldBreakForCountLimit(e.length))))return e}}p+=f}}_allTzMonthlyByDayOrMonthDay(){let e=[];if(!this.addDtstartIfNeeded(e))return e;let t=this.getZoneResolver(),n=this.originalDtstart.epochMilliseconds,r=this.opts.until?.epochMilliseconds,i=(this.wallMsOf(this.originalDtstart)%Z+Z)%Z;if(this.tzFastPathGapHazard(i))return null;let a=this.opts.until?.withTimeZone(this.tzid).withCalendar(`iso8601`),o=a?a.year*12+a.month-1:void 0,s=this.originalDtstart.year*12+(this.originalDtstart.month-1),c=0;for(;;){if(o!==void 0&&s>o)return e;if(++c>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let{year:i,month:a}=this.monthIndexToYearMonth(s);for(let o of this.generateMonthlyOccurrenceEpochsUtc(i,a)){let i=t.epochMsForWall(o);if(i.pushed)return null;if(!(i.epochMs<n)&&(r!==void 0&&i.epochMs>r||(e.push(this.zdtFromEpochMs(i.epochMs)),this.shouldBreakForCountLimit(e.length))))return e}s+=this.opts.interval}}processOccurrences(e,t,n,r,i){for(let a of e)if(!this.processOccurrence(a,t,n,r,i))return{shouldBreak:!0};return{shouldBreak:!1}}processOccurrence(e,t,n,r,i,a){if(a){if(a.seenOccurrences.size===0&&t.length>0)for(let e of t)a.seenOccurrences.add(e.epochNanoseconds);if(a.seenOccurrences.has(e.epochNanoseconds))return!0;a.seenOccurrences.add(e.epochNanoseconds)}return Y.ZonedDateTime.compare(e,n)<0?!0:this.opts.until&&Y.ZonedDateTime.compare(e,this.opts.until)>0?!1:i&&!i(e)||r&&this.isExcluded(e)?!0:r&&!r(e,t.length)?!1:(t.push(e),!this.shouldBreakForCountLimit(t.length))}_allMonthlyByDayOrMonthDay(e,t){let n=[],r=this.createCandidateWorkBudget(),i=0,a=this.originalDtstart;if(!this.addDtstartIfNeeded(n,e))return this.applyCountLimitAndMergeRDates(n,e);let o=a.toPlainDate().with({day:1});for(;;){if(++i>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let s=t=>this.processOccurrence(t,n,a,e,void 0,r);if(!(this.visitUtcPeriodCandidates(o,s,t??a,this.opts.until,r)??this.visitPeriodCandidates(this.generateMonthlyDateCandidates(o),s,t??a,this.opts.until,r)))break;try{o=o.add({months:this.opts.interval})}catch{break}if(this.opts.until){let e=this.opts.until.withTimeZone(a.timeZoneId).withCalendar(a.calendarId);if(o.year*12+o.month>e.year*12+e.month)break}}return this.applyCountLimitAndMergeRDates(n,e)}_allWeekly(e,t){let n=[],r=this.createCandidateWorkBudget(),i=0,a=this.originalDtstart;if(!this.addDtstartIfNeeded(n,e))return this.applyCountLimitAndMergeRDates(n,e);let o=X,s=this.opts.byDay?[...this.allByDayIsoDays??[]]:this.opts.byMonthDay&&this.opts.byMonthDay.length>0?[...Object.values(o)]:[a.dayOfWeek],c=o[Hd(this.opts.wkst||`MO`)??`MO`]??1,l=(a.dayOfWeek-c+7)%7,u=a.toPlainDate().subtract({days:l});for(;;){if(++i>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let o=s.map(e=>{let t=(e-c+7)%7;return u.add({days:t})}).filter(e=>this.matchesByMonth(e)&&this.matchesByMonthDay(e));if(!this.visitPeriodCandidates(o,t=>this.processOccurrence(t,n,a,e,void 0,r),t??a,this.opts.until,r))break;try{u=u.add({weeks:this.opts.interval})}catch{break}if(this.opts.until){let e=this.opts.until.withTimeZone(a.timeZoneId).withCalendar(a.calendarId);if(Y.PlainDate.compare(u,e.toPlainDate())>0)break}}return this.applyCountLimitAndMergeRDates(n,e)}_allYearlyComplex(e,t){let n=[],r=this.createCandidateWorkBudget(),i=0,a=this.originalDtstart;if(!this.addDtstartIfNeeded(n,e)||this.opts.until&&Y.ZonedDateTime.compare(this.opts.until,a)<0)return this.applyCountLimitAndMergeRDates(n,e);let o=a.toPlainDate().with({month:1,day:1}),s=this.opts.until?this.opts.until.withTimeZone(a.timeZoneId).withCalendar(a.calendarId).year+(this.opts.byWeekNo?1:0):void 0;for(;;){if(++i>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let c=t=>this.processOccurrence(t,n,a,e,void 0,r);if(!(this.visitUtcPeriodCandidates(o,c,t??a,this.opts.until,r)??this.visitPeriodCandidates(this.generateYearlyDateCandidates(o),c,t??a,this.opts.until,r)))break;let l=this.opts.freq===`WEEKLY`?1:this.opts.interval;try{o=o.add({years:l})}catch{break}if(s!==void 0&&o.year>s)break}return this.applyCountLimitAndMergeRDates(n,e)}_allMinutelySecondlyComplex(e){let t=[],n=0;if(!this.addDtstartIfNeeded(t,e))return this.applyCountLimitAndMergeRDates(t,e);let r=this.computeFirst();for(;;){if(++n>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(this.opts.until&&Y.ZonedDateTime.compare(r,this.opts.until)>0)break;if(this.matchesAll(r)){if(e&&this.isExcluded(r)){r=this.nextCandidateSameDate(r);continue}if(e&&!e(r,t.length)||(t.push(r),this.shouldBreakForCountLimit(t.length)))break;r=this.nextCandidateSameDate(r)}else r=this.findNextValidDate(r)}return this.applyCountLimitAndMergeRDates(t,e)}_allMonthlyByWeekNo(e,t){let n=[],r=this.createCandidateWorkBudget(),i=0,a=this.originalDtstart;if(!this.addDtstartIfNeeded(n,e))return this.applyCountLimitAndMergeRDates(n,e);let o=a,s=[...this.opts.byWeekNo].sort((e,t)=>e-t),c=this.opts.interval,l=this.opts.until?this.opts.until.withTimeZone(a.timeZoneId).withCalendar(a.calendarId).year+1:void 0,u=0,d=-1;outer_loop:for(;!this.shouldBreakForCountLimit(n.length);){if(++i>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let f=o.year;if(f!==d&&o.month>=a.month){d=f;let i=s.flatMap(e=>this.generateDateCandidatesForWeekInYear(f,e));if(!this.visitDateTimeCandidates(i,1,t=>this.processOccurrence(t,n,a,e,void 0,r),t??a,this.opts.until,r))break outer_loop}if(u+=c,o=a.add({months:u}),l!==void 0&&o.year>l)break}return this.applyCountLimitAndMergeRDates(n,e)}_allMonthlyByYearDay(e,t){let n=[],r=this.createCandidateWorkBudget(),i=0,a=this.originalDtstart;if(!this.addDtstartIfNeeded(n,e))return this.applyCountLimitAndMergeRDates(n,e);let o=a.year,s=[...this.opts.byYearDay].sort((e,t)=>e-t),c=this.opts.interval,l=a.year*12+a.month;outer_loop:for(;!this.shouldBreakForCountLimit(n.length);){if(++i>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let u=a.toPlainDate().with({year:o,month:1,day:1}),d=u.with({month:12,day:31}).dayOfYear,f=[];for(let e of s){let t=e>0?e:d+e+1;t<=0||t>d||f.push(u.add({days:t-1}))}if(!this.visitDateTimeCandidates(f,1,t=>(t.year*12+t.month-l)%c!==0||!this.matchesByMonth(t)?!0:this.processOccurrence(t,n,a,e,void 0,r),t??a,this.opts.until,r))break outer_loop;if(o++,this.opts.until&&o>this.opts.until.year+2)break;if(!this.opts.until&&this.opts.count){let e=Math.ceil(this.opts.count/(this.opts.byYearDay.length||1))*c+5;if(o>a.year+e)break}}return this.applyCountLimitAndMergeRDates(n,e)}_allDailyMinutelyHourlyWithBySetPos(e){let t=[],n=0,r=this.originalDtstart;if(!this.addDtstartIfNeeded(t,e))return this.applyCountLimitAndMergeRDates(t,e);let i,a;switch(this.opts.freq){case`MINUTELY`:i=r.with({second:0,microsecond:0,nanosecond:0}),a={minutes:this.opts.interval};break;case`HOURLY`:i=r.with({minute:0,second:0,microsecond:0,nanosecond:0}),a={hours:this.opts.interval};break;case`DAILY`:i=r.with({hour:0,minute:0,second:0,microsecond:0,nanosecond:0}),a={days:this.opts.interval};break;default:return this.applyCountLimitAndMergeRDates(t,e)}for(;;){if(++n>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let o=this.expandByTime(i);o=o.filter(e=>this.matchesAll(e)),o=this.applyBySetPos(o);let{shouldBreak:s}=this.processOccurrences(o,t,r,e);if(s||(i=i.add(a),this.opts.until&&Y.ZonedDateTime.compare(i,this.opts.until)>0))break}return this.applyCountLimitAndMergeRDates(t,e)}_allFallback(e){let t=[],n=0,r=this.computeFirst();if(this.includeDtstart&&Y.ZonedDateTime.compare(r,this.originalDtstart)>0&&!(e&&this.isExcluded(this.originalDtstart))&&(e&&!e(this.originalDtstart,t.length)||(t.push(this.originalDtstart),this.shouldBreakForCountLimit(t.length))))return this.applyCountLimitAndMergeRDates(t,e);for(;;){if(++n>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(this.opts.until&&Y.ZonedDateTime.compare(r,this.opts.until)>0||this.matchesAll(r)&&!(e&&this.isExcluded(r))&&(e&&!e(r,t.length)||(t.push(r),this.shouldBreakForCountLimit(t.length))))break;r=this.nextCandidateSameDate(r)}return this.applyCountLimitAndMergeRDates(t,e)}_allCalendarPeriods(e,t){let n=[],r=this.createCandidateWorkBudget(),i=this.originalDtstart,{freq:a,interval:o=1}=this.opts,s=i.toPlainDate(),c=this.opts.until?.withTimeZone(i.timeZoneId).withCalendar(i.calendarId).toPlainDate(),l=a===`DAILY`?s:s.with({day:1});a===`YEARLY`&&(l=l.with({month:1}));let u=a===`YEARLY`?{years:o}:a===`MONTHLY`?{months:o}:{days:o};if(!this.addDtstartIfNeeded(n,e))return this.applyCountLimitAndMergeRDates(n,e);if(a===`DAILY`&&this.simpleByDayIsoDays?.length){let t=this.findFirstMatchingDailyStep(l.dayOfWeek,o,this.simpleByDayIsoDays);if(t===null)return this.applyCountLimitAndMergeRDates(n,e);l=l.add({days:t*o})}for(let o=0;!(c&&Y.PlainDate.compare(l,c)>0);o++){if(o>=this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let s=[];if(a===`DAILY`)this.matchesByMonth(l)&&this.matchesByMonthDay(l)&&this.matchesByDay(l)&&this.matchesByYearDay(l)&&this.matchesByWeekNo(l)&&s.push(l);else{let e=a===`YEARLY`?this.opts.byMonth??[i.monthCode]:[l.month];for(let t of e){if(a===`MONTHLY`&&!this.matchesByMonth(l))continue;let e;try{e=l.with(typeof t==`number`?{month:t}:{monthCode:t},{overflow:`reject`})}catch{continue}let n=this.applySkipForDay(i.calendarId,l.year,e,i.day);n&&s.push(n)}}if(!this.visitPeriodCandidates(s,t=>this.processOccurrence(t,n,i,e,void 0,r),t??i,this.opts.until,r))break;l=l.add(u)}return this.applyCountLimitAndMergeRDates(n,e)}all(e){if(e){let t=[];return this.allInternal((n,r)=>{let i=this.toPublicDate(n);return e(i,r)?(t.push(i),!0):!1}),t}return!e&&this.opts.cache!==!1?(this.allResultCache||=this.allInternal(),this.publicAllResultCache||=this.toPublicDates(this.allResultCache),this.publicAllResultCache.slice()):this.toPublicDates(this.allInternal())}allInternal(e,t){if(this.opts.count===void 0&&!this.opts.until&&!e)throw Error(`all() requires iterator when no COUNT/UNTIL`);if(e&&(this.opts.rDate||this.opts.exDate))return this.iterateRecurrenceSet(e);if(this.opts.count===0)return this.applyCountLimitAndMergeRDates([],e);if(this.opts.until&&Y.ZonedDateTime.compare(this.opts.until,this.originalDtstart)<0){let t=[];return this.addDtstartIfNeeded(t,e),this.applyCountLimitAndMergeRDates(t,e)}if(this.opts.rscale&&[`CHINESE`,`HEBREW`,`INDIAN`].includes(this.opts.rscale)&&([`YEARLY`,`MONTHLY`,`WEEKLY`].includes(this.opts.freq)||this.opts.byYearDay||this.opts.byWeekNo||this.opts.byMonthDay&&this.opts.byMonthDay.length>0))return this._allRscaleNonGregorian(e,t);if(this.opts.byWeekNo&&this.opts.byYearDay&&!this.hasPossibleYearDayWeekNoCombination()){let t=[];return this.addDtstartIfNeeded(t,e),this.applyCountLimitAndMergeRDates(t,e)}let n=this.allUtcFastPath(e);if(n)return this.opts.rDate||this.opts.exDate?this.applyCountLimitAndMergeRDates(n):n;let r=this.allTzEpochFastPath(e);return r?this.opts.rDate||this.opts.exDate?this.applyCountLimitAndMergeRDates(r):r:this.opts.freq===`DAILY`||[`MONTHLY`,`YEARLY`].includes(this.opts.freq)&&!this.opts.byDay&&!this.opts.byMonthDay&&!this.opts.byYearDay&&!this.opts.byWeekNo?this._allCalendarPeriods(e,t):this.opts.freq===`MONTHLY`&&(this.opts.byDay||this.opts.byMonthDay)&&!this.opts.byWeekNo?this._allMonthlyByDayOrMonthDay(e,t):this.opts.freq===`WEEKLY`&&!(this.opts.byYearDay&&this.opts.byYearDay.length>0)&&!(this.opts.byWeekNo&&this.opts.byWeekNo.length>0)?this._allWeekly(e,t):this.opts.freq===`YEARLY`&&(this.opts.byDay||this.opts.byMonthDay||this.opts.byYearDay||this.opts.byWeekNo)||this.opts.freq===`WEEKLY`&&this.opts.byYearDay&&this.opts.byYearDay.length>0||this.opts.freq===`WEEKLY`&&this.opts.byWeekNo&&this.opts.byWeekNo.length>0?this._allYearlyComplex(e,t):(this.opts.freq===`MINUTELY`||this.opts.freq===`SECONDLY`)&&(this.opts.byMonth||this.opts.byWeekNo||this.opts.byYearDay||this.opts.byMonthDay||this.opts.byDay)?this._allMinutelySecondlyComplex(e):this.opts.freq===`MONTHLY`&&this.opts.byWeekNo&&this.opts.byWeekNo.length>0?this._allMonthlyByWeekNo(e,t):this.opts.freq===`MONTHLY`&&this.opts.byYearDay&&this.opts.byYearDay.length>0&&!this.opts.byDay&&!this.opts.byMonthDay?this._allMonthlyByYearDay(e,t):(this.opts.freq===`MINUTELY`||this.opts.freq===`HOURLY`)&&this.opts.bySetPos?this._allDailyMinutelyHourlyWithBySetPos(e):this._allFallback(e)}mergeAndDeduplicateRDates(e){this.opts.rDate&&e.push(...this.opts.rDate);let t=e.map(e=>e.epochNanoseconds),n=!0;for(let e=1;e<t.length;e++)if(t[e-1]>t[e]){n=!1;break}n||(e=e.map((e,t)=>t).sort((e,n)=>t[e]<t[n]?-1:t[e]>t[n]?1:0).map(t=>e[t]),t.sort((e,t)=>e<t?-1:e>t?1:0));let r=[];for(let n=0;n<e.length;n++)(n===0||t[n]!==t[n-1])&&r.push(e[n]);return r}isExcluded(e){return this.isExcludedEpoch(e.epochNanoseconds)}isExcludedEpoch(e){return!this.opts.exDate||this.opts.exDate.length===0?!1:(this.exDateEpochNs===void 0&&(this.exDateEpochNs=new Set(this.opts.exDate.map(e=>e.epochNanoseconds))),this.exDateEpochNs.has(e))}getNumericRDates(){if(this.numericRDatesCache)return this.numericRDatesCache;let e=[...this.opts.rDate??[]].sort((e,t)=>e.epochNanoseconds<t.epochNanoseconds?-1:e.epochNanoseconds>t.epochNanoseconds?1:0),t=[],n;for(let r of e)r.epochNanoseconds!==n&&(n=r.epochNanoseconds,this.isExcludedEpoch(n)||t.push(r));return this.numericRDatesCache=t}numericRDateLowerBound(e,t){let n=this.getNumericRDates(),r=0,i=n.length;for(;r<i;){let a=r+Math.floor((i-r)/2),o=n[a].epochNanoseconds;(t?o>e:o>=e)?i=a:r=a+1}return r}excludeExDates(e){return!this.opts.exDate||this.opts.exDate.length===0?e:e.filter(e=>!this.isExcluded(e))}applyCountLimitAndMergeRDates(e,t){let n=this.opts.count===void 0?e:e.slice(0,Math.max(this.opts.count,0)),r=this.mergeAndDeduplicateRDates(n),i=this.excludeExDates(r);return!t||!this.opts.rDate&&!this.opts.exDate?i:this.applyIterator(i,t)}iterateRecurrenceSet(t){let n=[],r=[...this.opts.rDate??[]].sort((e,t)=>Y.ZonedDateTime.compare(e,t)),i=0,a,o=!1,s=e=>{let r=e.epochNanoseconds;return a===r||(a=r,this.isExcluded(e))?!0:t(e,n.length)?(n.push(e),!0):(o=!0,!1)},c=e=>{for(;i<r.length&&r[i].epochNanoseconds<e;)if(!s(r[i++]))return!1;return!0},l=e=>{if(!c(e.epochNanoseconds)||!s(e))return!1;for(;i<r.length&&r[i].epochNanoseconds===e.epochNanoseconds;)i++;return!0};for((this.opts.count===void 0||this.opts.count>0)&&new e({...this.cloneOptions(),rDate:void 0,exDate:void 0,cache:!1}).allInternal(l);!o&&i<r.length&&s(r[i++]););return n}applyIterator(e,t){let n=[];for(let r of e){if(!t(r,n.length))break;n.push(r)}return n}shouldBreakForCountLimit(e){return this.opts.count===void 0?!1:e>=this.opts.count}hasTimeOfDayBetween(e,t){if(Y.PlainTime.compare(e,t)>=0)return!1;let n=this.originalDtstart,r=this.opts.byHour??[n.hour],i=this.opts.byMinute??[n.minute],a=this.opts.bySecond??[n.second];for(let o of r)for(let r of i)for(let i of a){let a=Y.PlainTime.from({hour:o,minute:r,second:i,millisecond:n.millisecond,microsecond:n.microsecond,nanosecond:n.nanosecond});if(Y.PlainTime.compare(a,e)>=0&&Y.PlainTime.compare(a,t)<0)return!0}return!1}assertNumericCandidateReachable(e){if(e&&e.periodIndex>=this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`)}numericExhaustionCandidate(e){return e.count<e.maximumCount?e.select(e.count):e.count>0?e.select(e.count-1):null}tryNumericNext(e,t){let n=this.getNumericQueryPlan();if(!n)return{handled:!1};let r=n.lowerBound(e,!t);if(!this.opts.rDate&&!this.opts.exDate){if(r>=n.count)return this.assertNumericCandidateReachable(this.numericExhaustionCandidate(n)),{handled:!0,value:null};let e=n.select(r);return e?(this.assertNumericCandidateReachable(e),{handled:!0,value:this.zdtFromEpochMs(e.epochMilliseconds)}):{handled:!1}}let i=this.getNumericRDates()[this.numericRDateLowerBound(e,!t)];for(;r<n.count;){let e=n.select(r);if(!e)return{handled:!1};let t=BigInt(e.epochMilliseconds)*Q;if(this.assertNumericCandidateReachable(e),i&&i.epochNanoseconds<t)return{handled:!0,value:i};if(!this.isExcludedEpoch(t))return{handled:!0,value:this.zdtFromEpochMs(e.epochMilliseconds)};r+=1}let a=this.numericExhaustionCandidate(n);return this.assertNumericCandidateReachable(a),{handled:!0,value:i??null}}tryNumericPrevious(e,t){let n=this.getNumericQueryPlan();if(!n)return{handled:!1};let r=n.lowerBound(e,t),i=r<n.count?n.select(r):this.numericExhaustionCandidate(n);this.assertNumericCandidateReachable(i);let a=r-1;if(!this.opts.rDate&&!this.opts.exDate){if(a<0)return{handled:!0,value:null};let e=n.select(a);return e?{handled:!0,value:this.zdtFromEpochMs(e.epochMilliseconds)}:{handled:!1}}let o=null;for(;a>=0;){let e=n.select(a);if(!e)return{handled:!1};if(!this.isExcludedEpoch(BigInt(e.epochMilliseconds)*Q)){o=e;break}--a}let s=this.getNumericRDates(),c=this.numericRDateLowerBound(e,t)-1,l=c>=0?s[c]:null;return!o||l&&l.epochNanoseconds>BigInt(o.epochMilliseconds)*Q?{handled:!0,value:l}:{handled:!0,value:this.zdtFromEpochMs(o.epochMilliseconds)}}tryNumericBetween(e,t,n){if(e>t)return{handled:!1};let r=this.getNumericQueryPlan();if(!r)return{handled:!1};let i=r.lowerBound(e,!n),a=r.lowerBound(t,n),o=r.lowerBound(t,!0),s=o<r.count?r.select(o):this.numericExhaustionCandidate(r);if(this.assertNumericCandidateReachable(s),i>=a&&!this.opts.rDate)return{handled:!0,value:[]};if(!this.opts.rDate&&!this.opts.exDate){let e=Array(a-i);for(let t=i;t<a;t++){let n=r.select(t);if(!n)return{handled:!1};e[t-i]=this.zdtFromEpochMs(n.epochMilliseconds)}return{handled:!0,value:e}}let c=[];for(let e=i;e<a;e++){let t=r.select(e);if(!t)return{handled:!1};let n=BigInt(t.epochMilliseconds)*Q;this.isExcludedEpoch(n)||c.push(this.zdtFromEpochMs(t.epochMilliseconds))}let l=this.getNumericRDates(),u=this.numericRDateLowerBound(e,!n),d=this.numericRDateLowerBound(t,n),f=[],p=0,m=u;for(;p<c.length||m<d;){let e=c[p],t=l[m];!t||e&&e.epochNanoseconds<=t.epochNanoseconds?(f.push(e),p+=1,t&&t.epochNanoseconds===e.epochNanoseconds&&(m+=1)):(f.push(t),m+=1)}return{handled:!0,value:f}}between(t,n,r=!1){let i=qd(t,`after`),a=qd(n,`before`),o=this.tryNumericBetween(i,a,r);if(o.handled)return this.toPublicDates(o.value);let s=new Y.ZonedDateTime(i,this.tzid,this.originalDtstart.calendarId),c=new Y.ZonedDateTime(a,this.tzid,this.originalDtstart.calendarId),l={...this.opts};(!l.until||Y.ZonedDateTime.compare(c,l.until)<0)&&(l.until=c),l.count===void 0&&Object.assign(l,this.alignedQueryStart(s));let u=new e({...l,strict:l.count===void 0?l.strict:!1,temporal:this.outputTemporal}).allInternal(void 0,l.count===void 0?s:void 0);return this.toPublicDates(u.filter(e=>{let t=r?e.epochNanoseconds>=i:e.epochNanoseconds>i,n=r?e.epochNanoseconds<=a:e.epochNanoseconds<a;return t&&n}))}jumpAlignedDtstart(t){if(t=t.withTimeZone(this.originalDtstart.timeZoneId).withCalendar(this.originalDtstart.calendarId),t.epochNanoseconds<=this.originalDtstart.epochNanoseconds||this.opts.rscale||this.originalDtstart.timeZoneId!==this.tzid||this.opts.freq===`MONTHLY`&&this.opts.byWeekNo||[`MONTHLY`,`YEARLY`].includes(this.opts.freq)&&![`iso8601`,`gregory`].includes(this.originalDtstart.calendarId))return this.originalDtstart;let n=this.opts.interval??1,r=t.withPlainTime(this.originalDtstart.toPlainTime()),i;switch(this.opts.freq){case`YEARLY`:i=`years`;break;case`MONTHLY`:i=`months`;break;case`WEEKLY`:i=`weeks`;break;case`DAILY`:i=`days`;break;case`HOURLY`:i=`hours`;break;case`MINUTELY`:i=`minutes`;break;default:i=`seconds`}let a=e.normalizeToPolyfill(this.opts.dtstart),o=e.normalizeToPolyfill(t).withTimeZone(a.timeZoneId),s=e.normalizeToPolyfill(r.withPlainTime(this.originalDtstart.toPlainTime())).withTimeZone(a.timeZoneId),c=[`hours`,`minutes`,`seconds`].includes(i)?o:s,l=a.until(c,{largestUnit:i})[i],u=Math.floor(l/n),d=e=>{switch(i){case`years`:return{years:e};case`months`:return{months:e};case`weeks`:return{weeks:e};case`days`:return{days:e};case`hours`:return{hours:e};case`minutes`:return{minutes:e};default:return{seconds:e}}},f=[`years`,`months`,`weeks`,`days`].includes(i),p=()=>{for(;u>0;){if(!f)return a.add(d(u*n));try{let e=this.originalDtstart.toPlainDateTime().add(d(u*n),{overflow:`reject`}),t=this.resolveGeneratedTime(e);if(t)return t}catch{}--u}return this.originalDtstart},m=p();this.opts.freq===`HOURLY`&&n===1&&u>0&&m.subtract({hours:1}).hour===m.hour&&(--u,m=p()),u>0&&[`years`,`months`,`weeks`,`days`].includes(i)&&m.toPlainDate().equals(o.toPlainDate())&&Y.ZonedDateTime.compare(m,o)>0&&this.hasTimeOfDayBetween(o.toPlainTime(),m.toPlainTime())&&(--u,m=p());let h=e.normalizeToPolyfill(this.opts.dtstart);return Y.ZonedDateTime.compare(m,h)<0&&(m=h),m}matches(e){let t=qd(e,`date`);return this.nextInternal(t,!0)?.epochNanoseconds===t}occursOn(e){let t=Y.PlainDate.from(e.toString()),n=t.toZonedDateTime({timeZone:this.tzid,plainTime:Y.PlainTime.from(`00:00`)});if(!n.toPlainDate().equals(t))return!1;let r=t.add({days:1}).toZonedDateTime({timeZone:this.tzid,plainTime:Y.PlainTime.from(`00:00`)}),i=this.nextInternal(n.epochNanoseconds,!0);return i!==null&&i.epochNanoseconds<r.epochNanoseconds}nextInternal(e,t){let n=this.tryNumericNext(e,t);if(n.handled)return n.value;let r=null,i=n=>{n.allInternal(n=>(t?n.epochNanoseconds>=e:n.epochNanoseconds>e)?((!r||n.epochNanoseconds<r.epochNanoseconds)&&(r=n),!1):!0)};return this.opts.count===void 0?i(this.ruleFromAlignedDtstart(new Y.ZonedDateTime(e,this.tzid))):i(this),r}next(e=new Date,t=!1){return this.toPublicDate(this.nextInternal(qd(e,`after`),t))}alignedQueryStart(e){let t=this.jumpAlignedDtstart(e);return{dtstart:t,includeDtstart:this.includeDtstart&&t.epochNanoseconds===this.originalDtstart.epochNanoseconds}}ruleFromAlignedDtstart(t){let n=this.alignedQueryStart(t);return n.dtstart.epochNanoseconds===this.originalDtstart.epochNanoseconds?this:new e({...this.opts,temporal:this.outputTemporal,...n})}previous(e=new Date,t=!1){let n=qd(e,`before`),r=this.tryNumericPrevious(n,t);if(r.handled)return this.toPublicDate(r.value);let i=null;if(this.opts.rDate?.length){let e=this.numericRDateLowerBound(n,t)-1;i=e>=0?this.getNumericRDates()[e]:null}let a=this.previousFromRule(n,t,i?.epochNanoseconds);return!a||i&&i.epochNanoseconds>a.epochNanoseconds?this.toPublicDate(i):this.toPublicDate(a)}previousFromRule(t,n,r){let i=this.opts.rDate&&this.opts.rDate.length>0?new e({...this.opts,temporal:this.outputTemporal,rDate:void 0}):this,a=e=>{let r=null;return e.allInternal(e=>(n?e.epochNanoseconds>t:e.epochNanoseconds>=t)?!1:(r=e,!0)),r};if(i.opts.count!==void 0)return a(i);let o=i.opts.until?.epochNanoseconds,s=new Y.ZonedDateTime(o!==void 0&&o<t?o:t,i.tzid,i.originalDtstart.calendarId),c=i.opts.interval??1;for(let e=0;e<16;e++){let t=e===0?s:s.subtract(i.freqDuration(c*4**e)),n=r!==void 0&&t.epochNanoseconds<=r;n&&(t=new Y.ZonedDateTime(r,i.tzid,i.originalDtstart.calendarId));let o=i.ruleFromAlignedDtstart(t),l=a(o);if(l||o===i||n)return l}return a(i)}freqDuration(e){switch(this.opts.freq){case`YEARLY`:return{years:e};case`MONTHLY`:return{months:e};case`WEEKLY`:return{weeks:e};case`DAILY`:return{days:e};case`HOURLY`:return{hours:e};case`MINUTELY`:return{minutes:e};default:return{seconds:e}}}toString(){let e=this.originalDtstart.toString({smallestUnit:`second`}).replace(/[-:]/g,``),t=`DTSTART;TZID=${this.tzid}:${e.slice(0,15)}`,n=[],{freq:r,interval:i,count:a,until:o,byHour:s,byMinute:c,bySecond:l,byDay:u,byMonth:d,byMonthDay:f,bySetPos:p,byWeekNo:m,byYearDay:h,wkst:g,rDate:_,exDate:ee}=this.opts;this.opts.rscale&&n.push(`RSCALE=${this.opts.rscale}`),this.opts.rscale&&this.opts.skip&&n.push(`SKIP=${this.opts.skip}`),n.push(`FREQ=${r}`),i!==1&&n.push(`INTERVAL=${i}`),a!==void 0&&n.push(`COUNT=${a}`),o&&n.push(`UNTIL=${this.formatIcsDateTime(o)}`),s&&n.push(`BYHOUR=${s.join(`,`)}`),c&&n.push(`BYMINUTE=${c.join(`,`)}`),l&&n.push(`BYSECOND=${l.join(`,`)}`),u&&n.push(`BYDAY=${u.join(`,`)}`),d&&n.push(`BYMONTH=${d.join(`,`)}`),f&&n.push(`BYMONTHDAY=${f.join(`,`)}`),p&&n.push(`BYSETPOS=${p.join(`,`)}`),m&&n.push(`BYWEEKNO=${m.join(`,`)}`),h&&n.push(`BYYEARDAY=${h.join(`,`)}`),g&&n.push(`WKST=${g}`);let te=[t,`RRULE:${n.join(`;`)}`];return _&&te.push(`RDATE:${this.joinDates(_)}`),ee&&te.push(`EXDATE:${this.joinDates(ee)}`),te.join(`
|
|
2
|
-
`)}formatIcsDateTime(e){return e.toInstant().toString().replace(/[-:]/g,``).slice(0,15)+`Z`}joinDates(e){return e.map(e=>this.formatIcsDateTime(e))}generateMonthlyDateCandidates(e){let t=e.day===1?e:e.with({day:1});if(!this.opts.byDay&&!this.opts.byMonthDay)return[e];let n=this.generateMonthlyOccurrenceDays(t);return n.length===0?[]:n.map(e=>t.with({day:e}))}generateMonthlyOccurrences(e){let t=[];return this.visitDateTimeCandidates(this.generateMonthlyDateCandidates(e.toPlainDate()),1,e=>(t.push(e),!0)),t}generateYearlyDateCandidates(e){let t=this.opts.byMonth?this.opts.byMonth.filter(e=>typeof e==`number`).sort((e,t)=>e-t):this.opts.byMonthDay||this.opts.byDay?[1,2,3,4,5,6,7,8,9,10,11,12]:[this.originalDtstart.month],n=[];if(this.opts.byDay&&this.opts.byDay.some(e=>/^[+-]?\d/.test(e))&&!this.opts.byMonth){let t=X;for(let r of this.opts.byDay){let i=Ud(r);if(!i||i.ord===0)continue;let a=i.ord,o=t[i.weekday],s;if(a>0){let t=e.with({month:1,day:1}),n=(o-t.dayOfWeek+7)%7;s=t.add({days:n+7*(a-1)})}else{let t=e.with({month:12,day:31}),n=(t.dayOfWeek-o+7)%7;s=t.subtract({days:n+7*(-a-1)})}n.push(s)}}else if(!this.opts.byYearDay&&!this.opts.byWeekNo){n=[];for(let r of t){let t=e.with({month:r,day:1}),i=this.generateMonthlyDateCandidates(t);if(i.length===0&&this.opts.rscale&&this.opts.byMonthDay&&this.opts.byMonthDay.length>0){let e=t.add({months:1}).subtract({days:1}).day,r=this.opts.byMonthDay[0],i=r>0?r:e+r+1;if(i>e||i<=0){let r=this.opts.skip||`OMIT`;if(r===`BACKWARD`)n.push(t.with({day:e}));else if(r===`FORWARD`){let e=t.add({months:1}).with({day:1});n.push(e)}}}else n.push(...i)}}if(this.opts.byYearDay){let t=e.with({month:12,day:31}).dayOfYear;for(let r of this.opts.byYearDay){let i=r>0?r:t+r+1;if(i<=0||i>t)continue;let a=(this.opts.freq,e.with({month:1,day:1}).add({days:i-1}));(!this.opts.byMonth||this.opts.byMonth.includes(a.month))&&n.push(a)}}if(this.opts.byWeekNo){let{lastWeek:t,firstWeekStart:r,tokens:i}=this.isoWeekByDay(e);for(let e of this.opts.byWeekNo){if(e>0&&e>t||e<0&&-e>t)continue;let a=e>0?e-1:t+e,o=r.add({weeks:a});n.push(...this.addByDayDates(i,o))}}return this.sortedUniqueDateCandidates(n)}addByDayDates(e,t){let n=X,r=n[this.opts.wkst||`MO`],i=[];for(let a of e){if(!a)continue;let e=n[a],o=t.add({days:(e-r+7)%7});(!this.opts.byMonth||this.opts.byMonth.includes(o.month))&&i.push(o)}return this.sortedUniqueDateCandidates(i)}findNextValidValue(e,t,n){return t.find(t=>n(t,e)>0)||null}findNextValidDate(e){if(this.opts.byWeekNo&&this.opts.byYearDay){let t=e.with({month:1,day:1,hour:0,minute:0,second:0,millisecond:0}),n=this.opts.byYearDay.map(e=>{let n=t.with({month:12,day:31}).dayOfYear;return e>0?e:n+e+1});for(let e of n){let n=t.add({days:e-1});if(this.matchesByWeekNo(n))break}}if(this.opts.byMonth){let t=this.opts.byMonth.filter(e=>typeof e==`number`);if(t.length&&!t.includes(e.month)){let n=[...t].sort((e,t)=>e-t),r=this.findNextValidValue(e.month,n,(e,t)=>e-t);return e=r?e.with({month:r,day:1,hour:0,minute:0,second:0}):e.add({years:1}).with({month:n[0],day:1,hour:0,minute:0,second:0}),e=this.applyTimeOverride(e),e}}if(this.opts.byWeekNo&&!this.matchesByWeekNo(e))return e=e.add({weeks:1}).with({hour:0,minute:0,second:0}),e=this.applyTimeOverride(e),e;if(this.opts.byYearDay&&!this.matchesByYearDay(e)){let t=[...this.opts.byYearDay].sort((e,t)=>e-t),n=e.dayOfYear,r=e.with({month:12,day:31}).dayOfYear,i=t.find(e=>(e>0?e:r+e+1)>n);if(i){let t=i>0?i:r+i+1;e=this.opts.freq===`MINUTELY`||this.opts.freq===`SECONDLY`?e.with({month:1,day:1,hour:0,minute:0,second:0,millisecond:0}).add({days:t-1}):e.with({month:1,day:1}).add({days:t-1})}else{let n=e.add({years:1}),r=n.with({month:12,day:31}).dayOfYear,i=t[0];if(i!==void 0){let t=i>0?i:r+i+1;e=this.opts.freq===`MINUTELY`||this.opts.freq===`SECONDLY`?n.with({month:1,day:1,hour:0,minute:0,second:0,millisecond:0}).add({days:t-1}):n.with({month:1,day:1}).add({days:t-1})}}return e=this.applyTimeOverride(e),e}if(this.opts.byMonthDay&&!this.matchesByMonthDay(e)){let t=[...this.opts.byMonthDay].sort((e,t)=>e-t),n=e.with({day:1}).add({months:1}).subtract({days:1}).day,r=e.day,i=t.map(e=>e>0?e:n+e+1).filter(e=>e>0&&e<=n).sort((e,t)=>e-t),a=this.findNextValidValue(r,i,(e,t)=>e-t);if(a)e=e.with({day:a,hour:0,minute:0,second:0});else{let n=e.add({months:1}).with({day:1}),r=n.add({months:1}).subtract({days:1}).day,i=t[0];if(i!==void 0){let t=i>0?i:r+i+1;e=n.with({day:Math.max(1,Math.min(t,r)),hour:0,minute:0,second:0})}else e=e.add({months:1}).with({day:1,hour:0,minute:0,second:0})}return e=this.applyTimeOverride(e),e}if(this.opts.byDay&&!this.matchesByDay(e)){let t=this.allByDayIsoDays;if(!t?.length)return this.applyTimeOverride(e.add({days:1}).with({hour:0,minute:0,second:0}));let n=this.findNextValidValue(e.dayOfWeek,t,(e,t)=>e-t);if(n){let t=(n-e.dayOfWeek+7)%7;e=e.add({days:t}).with({hour:0,minute:0,second:0})}else{let n=(t[0]-e.dayOfWeek+7)%7;e=e.add({days:n+7}).with({hour:0,minute:0,second:0})}return e=this.applyTimeOverride(e),e}switch(this.opts.freq){case`SECONDLY`:case`MINUTELY`:e=e.add({days:1}).with({hour:0,minute:0,second:0});break;case`HOURLY`:e=e.add({days:1}).with({hour:0,minute:0,second:0});break;case`DAILY`:case`WEEKLY`:e=e.add({months:1}).with({day:1,hour:0,minute:0,second:0});break;case`MONTHLY`:case`YEARLY`:e=e.add({years:1}).with({month:1,day:1,hour:0,minute:0,second:0});break}return this.applyTimeOverride(e)}applyBySetPos(e){let{bySetPos:t}=this.opts;if(!t||!t.length)return e;let n=[...e].sort((e,t)=>Y.ZonedDateTime.compare(e,t));return this.applyBySetPosToSortedList(n).sort((e,t)=>Y.ZonedDateTime.compare(e,t))}isoWeekByDay(e){let t=X,n=t[this.opts.wkst||`MO`],r=e.with({month:1,day:4}),i=(r.dayOfWeek-n+7)%7,a=r.subtract({days:i}),o=r.add({years:1}).with({month:1,day:4}),s=o.subtract({days:(o.dayOfWeek-n+7)%7});return{lastWeek:a.until(s,{largestUnit:`days`}).days/7,firstWeekStart:a,tokens:this.opts.byDay?.length?this.opts.byDay.map(e=>Hd(e)).filter(e=>e!==null):[Object.entries(t).find(([,e])=>e===this.originalDtstart.dayOfWeek)[0]]}}generateDateCandidatesForWeekInYear(e,t){let n=[],r=this.originalDtstart.toPlainDate().with({year:e,month:1,day:1}),{lastWeek:i,firstWeekStart:a,tokens:o}=this.isoWeekByDay(r);if(t>0&&t>i||t<0&&-t>i)return n;let s=t>0?t-1:i+t,c=a.add({weeks:s});return n.push(...this.addByDayDates(o,c)),this.sortedUniqueDateCandidates(n)}getRscaleCalendarId(){return{GREGORIAN:`gregory`,CHINESE:`chinese`,HEBREW:`hebrew`,INDIAN:`indian`}[this.opts.rscale?.toUpperCase()||``]||null}assertRscaleCalendarSupported(t){if(t===`gregory`||t===`iso8601`)return;let n=e.rscaleCalendarSupport[t];if(n===!0)return;if(n===!1)throw Error(`RSCALE=${this.opts.rscale} is not supported by the current Temporal/Intl implementation`);let r=!0;try{let e=od.ZonedDateTime.from(`2000-01-01T00:00:00+00:00[UTC]`).withCalendar(t);e.year,e.monthCode,e.day}catch{r=!1}if(e.rscaleCalendarSupport[t]=r,!r)throw Error(`RSCALE=${this.opts.rscale} is not supported by the current Temporal/Intl implementation`)}pad2(e){return String(e).padStart(2,`0`)}monthMatchesToken(e,t){if(typeof t==`number`)return e===`M${this.pad2(t)}`;if(/^\d+L$/i.test(t)){let n=parseInt(t,10);return e===`M${this.pad2(n)}L`}return!1}monthsOfYear(e,t){let n=[];for(let r=1;r<=20;r++)try{let i=od.PlainDate.from({calendar:e,year:t,month:r,day:1},{overflow:`reject`});n.push(i)}catch{break}return n}rscaleMonth(e,t,n,r){return r.find(e=>e.monthCode===n)||(this.opts.skip===`BACKWARD`?r.slice().reverse().find(e=>e.monthCode<n)??this.startOfYear(e,t).subtract({months:1}):this.opts.skip===`FORWARD`?r.find(e=>e.monthCode>n)??this.startOfYear(e,t+1):null)}startOfYear(e,t){return od.PlainDate.from({calendar:e,year:t,month:1,day:1})}endOfYear(e,t){return this.startOfYear(e,t+1).subtract({days:1})}rscaleFirstWeekStart(e,t,n){let r=od.PlainDate.from({calendar:e,year:t,month:1,day:4}),i=(r.dayOfWeek-n+7)%7;return r.subtract({days:i})}rscaleLastWeekCount(e,t,n){let r=this.rscaleFirstWeekStart(e,t,n),i=this.endOfYear(e,t).since(r).days;return Math.floor(i/7)+1}lastDayOfMonth(e){return e.with({day:1}).add({months:1}).subtract({days:1}).day}toRscaleZdt(e){return od.ZonedDateTime.from(e.toString())}rscaleDate(e){return Y.PlainDate.from(e.withCalendar(`iso8601`).toString())}rscaleDateAfterUntil(e){if(!this.opts.until)return!1;let t=this.opts.until.withTimeZone(this.generationTimeZone).toPlainDate().withCalendar(`iso8601`);return Y.PlainDate.compare(this.rscaleDate(e),t)>0}rscaleMatchesByYearDay(e,t){let n=this.opts.byYearDay;if(!n||n.length===0)return!0;let r=this.endOfYear(e,t.year).dayOfYear;return n.some(e=>e>0?t.dayOfYear===e:t.dayOfYear===r+e+1)}rscaleMatchesByWeekNo(e,t){let n=this.opts.byWeekNo;if(!n||n.length===0)return!0;let r=X[this.opts.wkst||`MO`],i=t.subtract({days:(t.dayOfWeek-r+7)%7}).add({days:(4-r+7)%7}).year,a=this.rscaleFirstWeekStart(e,i,r),o=this.rscaleLastWeekCount(e,i,r),s=Math.floor(t.since(a).days/7)+1;return n.some(e=>e>0?s===e:s===o+e+1)}rscaleMatchesByMonth(e,t){let n=this.opts.byMonth;return!n||n.length===0?!0:n.some(e=>this.monthMatchesToken(t.monthCode,e))}rscaleMatchesByMonthDay(e){let t=this.opts.byMonthDay;if(!t||t.length===0)return!0;let n=e.with({day:1}).add({months:1}).subtract({days:1}).day,r=e.day;return t.some(e=>e>0?r===e:r===n+e+1)}rscaleMatchesByDayBasic(e){let t=this.opts.byDay;if(!t||t.length===0)return!0;let n=X,r=t.map(e=>Hd(e)).filter(e=>e!==null);return r.length===0?!0:r.some(t=>n[t]===e.dayOfWeek)}rscaleDateMatches(e,t){return this.rscaleMatchesByMonth(e,t)&&this.rscaleMatchesByYearDay(e,t)&&this.rscaleMatchesByWeekNo(e,t)&&this.rscaleMatchesByMonthDay(t)&&this.rscaleMatchesByDayBasic(t)}applySkipForDay(e,t,n,r){let i=this.lastDayOfMonth(n),a=this.opts.skip||`OMIT`;return r>=1&&r<=i?n.with({day:r}):a===`BACKWARD`?n.with({day:i}):a===`FORWARD`?n.add({months:1}).with({day:1}):null}generateMonthlyOccurrencesRscale(e,t,n){let r=[],i=this.opts.byMonthDay,a=this.opts.byDay;if(!a&&!i){let i=this.toRscaleZdt(this.originalDtstart).withCalendar(e).day,a=this.applySkipForDay(e,t,n,i);return a&&r.push(this.rscaleDate(a)),r}let o=e=>{r.push(this.rscaleDate(e))},s=this.lastDayOfMonth(n),c=e=>e>0?e:s+e+1;if(i&&i.length>0)for(let r of i){let i=c(r),a=this.applySkipForDay(e,t,n,i);a&&o(a)}if(a&&a.length>0){let e=X,t={},r=n;for(;r.month===n.month&&r.year===n.year;){let e=r.dayOfWeek;(t[e]||=[]).push(r),r=r.add({days:1})}for(let n of a){let r=Ud(n);if(!r)continue;let i=r.ord,a=t[e[r.weekday]]||[];if(a.length!==0)if(i===0)for(let e of a)o(e);else{let e=a[i>0?i-1:a.length+i];e&&o(e)}}}return this.sortedUniqueDateCandidates(r)}_allRscaleNonGregorian(e,t){let n=this.getRscaleCalendarId();if(!n)return this._allFallback(e);this.assertRscaleCalendarSupported(n);let r=[],i=this.createCandidateWorkBudget(),a=0,o=this.originalDtstart,s=this.toRscaleZdt(o).withCalendar(n),c=this.opts.interval??1;if(!this.addDtstartIfNeeded(r,e))return this.applyCountLimitAndMergeRDates(r,e);if(this.opts.freq===`YEARLY`){let l=0;for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let u=s.year+l*c,d=[],f=this.opts.byMonth,p=this.monthsOfYear(n,u),m=X,h=m[this.opts.wkst||`MO`];if(this.opts.byWeekNo&&this.opts.byWeekNo.length>0){let e=this.rscaleFirstWeekStart(n,u,h),t=this.rscaleLastWeekCount(n,u,h),r=this.opts.byDay?.length?this.opts.byDay.map(e=>Hd(e)).filter(e=>e!==null):[Object.entries(m).find(([,e])=>e===this.originalDtstart.dayOfWeek)[0]];for(let i of this.opts.byWeekNo){let a=i>0?i-1:t+i;if(a<0||a>=t)continue;let o=e.add({weeks:a});for(let e of r){let t=m[e],r=o.add({days:(t-h+7)%7});if(!(f&&f.length>0&&!f.some(e=>this.monthMatchesToken(r.monthCode,e)))){if(this.opts.byYearDay&&this.opts.byYearDay.length>0){let e=this.endOfYear(n,u).dayOfYear;if(!this.opts.byYearDay.some(t=>{let n=t>0?t:e+t+1;return r.dayOfYear===n}))continue}d.push(this.rscaleDate(r))}}}}else if(this.opts.byYearDay&&this.opts.byYearDay.length>0){let e=this.startOfYear(n,u),t=this.endOfYear(n,u).dayOfYear;for(let n of this.opts.byYearDay){let r=n>0?n:t+n+1;if(r<1||r>t)continue;let i=e.add({days:r-1});f&&f.length>0&&!f.some(e=>this.monthMatchesToken(i.monthCode,e))||d.push(this.rscaleDate(i))}}else if(!f||f.length===0){let e=this.rscaleMonth(n,u,s.monthCode,p),t=e?this.applySkipForDay(n,u,e,s.day):null;t&&d.push(this.rscaleDate(t))}else for(let e of f){let t=typeof e==`number`?`M${this.pad2(e)}`:`M${this.pad2(parseInt(e,10))}L`,r=this.rscaleMonth(n,u,t,p);r&&d.push(...this.generateMonthlyOccurrencesRscale(n,u,r))}if(d.length>0&&!this.visitPeriodCandidates(d,t=>this.processOccurrence(t,r,o,e,void 0,i),t??o,this.opts.until,i)||(l++,this.opts.until&&u>this.toRscaleZdt(this.opts.until).withCalendar(n).year))break}return this.applyCountLimitAndMergeRDates(r,e)}if(this.opts.freq===`WEEKLY`){let c=X,l=c[this.opts.wkst||`MO`],u=this.opts.byDay?.length?this.opts.byDay.map(e=>Hd(e)).filter(e=>e!==null):[Object.entries(c).find(([,e])=>e===this.originalDtstart.dayOfWeek)[0]],d=s.toPlainDate().subtract({days:(s.dayOfWeek-l+7)%7});for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let s=[];for(let e of u){let t=c[e],r=d.add({days:(t-l+7)%7});if(this.opts.byWeekNo&&this.opts.byWeekNo.length>0){let e=d.add({days:(4-l+7)%7}).year,t=this.rscaleFirstWeekStart(n,e,l),i=this.rscaleLastWeekCount(n,e,l),a=Math.floor(r.since(t).days/7)+1;if(!this.opts.byWeekNo.some(e=>e>0?a===e:a===i+e+1))continue}if(this.opts.byYearDay&&this.opts.byYearDay.length>0){let e=this.endOfYear(n,r.year).dayOfYear;if(!this.opts.byYearDay.some(t=>t>0?r.dayOfYear===t:r.dayOfYear===e+t+1))continue}let i=this.opts.byMonth;i&&i.length>0&&!i.some(e=>this.monthMatchesToken(r.monthCode,e))||s.push(this.rscaleDate(r))}if(s.length&&!this.visitPeriodCandidates(s,t=>this.processOccurrence(t,r,o,e,void 0,i),t??o,this.opts.until,i))return this.applyCountLimitAndMergeRDates(r,e);if(d=d.add({weeks:this.opts.interval??1}),this.rscaleDateAfterUntil(d))break}return this.applyCountLimitAndMergeRDates(r,e)}if(this.opts.freq===`MONTHLY`){let c=s.toPlainDate().with({day:1});for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);let s=c.year,l=c,u=!0,d=this.opts.byMonth;if(d&&d.length>0&&(u=d.some(e=>this.monthMatchesToken(l.monthCode,e))),u){let a=this.generateMonthlyOccurrencesRscale(n,s,l);if(!this.visitPeriodCandidates(a,t=>this.processOccurrence(t,r,o,e,void 0,i),t??o,this.opts.until,i))break}if(c=c.add({months:this.opts.interval??1}),this.rscaleDateAfterUntil(c))break}return this.applyCountLimitAndMergeRDates(r,e)}if(this.opts.freq===`DAILY`){let c=s.toPlainDate();for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(this.rscaleDateMatches(n,c)){let n=this.rscaleDate(c);if(!this.visitPeriodCandidates([n],t=>this.processOccurrence(t,r,o,e,void 0,i),t??o,this.opts.until,i))break}if(c=c.add({days:this.opts.interval??1}),this.rscaleDateAfterUntil(c))break}return this.applyCountLimitAndMergeRDates(r,e)}if(this.opts.freq===`HOURLY`||this.opts.freq===`MINUTELY`){this.opts.freq;let c=this.opts.freq===`HOURLY`?36e5:6e4,l=this.opts.interval??1,u=s.toPlainDate(),d=this.originalDtstart.toInstant().epochMilliseconds;for(;;){if(++a>this.maxIterations)throw Error(`Maximum iterations (${this.maxIterations}) exceeded in all()`);if(this.rscaleDateMatches(n,u)){let n=this.rscaleDate(u);if(!this.visitPeriodCandidates([n],t=>{let n=t.toInstant().epochMilliseconds-d;return Math.floor(n/c)%l===0?this.processOccurrence(t,r,o,e,void 0,i):!0},t??o,this.opts.until,i))break}if(u=u.add({days:1}),this.rscaleDateAfterUntil(u))break}return this.applyCountLimitAndMergeRDates(r,e)}return this._allFallback(e)}};Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return gd}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return _d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return of}});
|